Download src/cli/index.ts from hongcoding/agentlens: direct link, hf CLI and curl.
- Browser
- Download file 3.72 kB
-
https://huggingface.co/datasets/hongcoding/agentlens/resolve/main/src/cli/index.ts
- Command line
-
hf download hf://datasets/hongcoding/agentlens/src/cli/index.ts
-
curl -L -o index.ts https://huggingface.co/datasets/hongcoding/agentlens/resolve/main/src/cli/index.ts
3.72 kB
| import { Command } from "commander"; | |
| import { readFileSync } from "node:fs"; | |
| import { dirname, join } from "node:path"; | |
| import { fileURLToPath } from "node:url"; | |
| const __dirname = dirname(fileURLToPath(import.meta.url)); | |
| const pkg = JSON.parse(readFileSync(join(__dirname, "../../package.json"), "utf-8")); | |
| const program = new Command(); | |
| program | |
| .name("agentlens") | |
| .description("Cross-agent config migration & output QA for AI coding agents") | |
| .version(pkg.version); | |
| program | |
| .command("scan") | |
| .description("Detect all AI agent configs in the current project and show rules summary") | |
| .option("-p, --path <path>", "project root", process.cwd()) | |
| .action(async (opts) => { | |
| const { scanProject } = await import("./commands/scan.js"); | |
| await scanProject(opts.path); | |
| }); | |
| program | |
| .command("move") | |
| .description("Migrate rules from one agent format to another") | |
| .requiredOption("--from <agent>", "source agent (claude|cursor|codex|windsurf|copilot)") | |
| .requiredOption("--to <agent>", "target agent (claude|cursor|codex|windsurf|copilot)") | |
| .option("-p, --path <path>", "project root", process.cwd()) | |
| .option("-o, --output <file>", "output file path") | |
| .action(async (opts) => { | |
| const { moveRules } = await import("./commands/move.js"); | |
| await moveRules(opts); | |
| }); | |
| program | |
| .command("drift") | |
| .description("Detect config drift across agent rule files") | |
| .option("-p, --path <path>", "project root", process.cwd()) | |
| .action(async (opts) => { | |
| const { detectDrift } = await import("./commands/drift.js"); | |
| await detectDrift(opts.path); | |
| }); | |
| program | |
| .command("check") | |
| .description("Run adversarial QA on code changes or files") | |
| .argument("[target]", "git diff range or file path", "HEAD~1..HEAD") | |
| .option("-p, --path <path>", "project root", process.cwd()) | |
| .action(async (target, opts) => { | |
| const { checkCode } = await import("./commands/check.js"); | |
| await checkCode(target, opts.path); | |
| }); | |
| program | |
| .command("install") | |
| .description("One-click install AgentLens into target AI agents as MCP server") | |
| .option("--target <agent>", "target agent (claude|cursor|codex|all)", "all") | |
| .action(async (opts) => { | |
| const { installTo } = await import("./commands/install.js"); | |
| await installTo(opts.target); | |
| }); | |
| program | |
| .command("export") | |
| .description("Export a full agent data bundle (personas + materials + conversations) — currently DSH only") | |
| .requiredOption("--from <agent>", "source agent (dsh)") | |
| .option("-o, --out <dir>", "output directory", "./dsh-export") | |
| .option("--with-attachments", "also copy attachments (can be hundreds of MB)") | |
| .option("--no-materials", "skip workspace/memory materials") | |
| .option("--no-conversations", "skip conversation transcripts") | |
| .action(async (opts) => { | |
| const { exportData } = await import("./commands/export.js"); | |
| await exportData(opts); | |
| }); | |
| program | |
| .command("import") | |
| .description("One-click: export DSH data AND wire it into a target agent's real config (instructions + skill)") | |
| .requiredOption("--from <agent>", "source agent (dsh)") | |
| .requiredOption("--to <agent>", "target agent (codex|claude|zcode|workbuddy|mimo)") | |
| .option("-o, --out <dir>", "data directory (default ~/<target>-import)") | |
| .option("--with-attachments", "also copy attachments (can be hundreds of MB)") | |
| .action(async (opts) => { | |
| const { importData } = await import("./commands/import.js"); | |
| await importData(opts); | |
| }); | |
| program | |
| .command("mcp") | |
| .description("Start AgentLens as an MCP server (for Claude Code, Cursor, etc.)") | |
| .action(async () => { | |
| const { startMcpServer } = await import("../mcp/server.js"); | |
| await startMcpServer(); | |
| }); | |
| program.parse(); | |