/** * cli.ts — CLI registration for `openclaw devclaw setup`. * * Uses Commander.js (provided by OpenClaw plugin SDK context). */ import type { Command } from "commander"; import { runSetup } from "./setup/index.js"; import { ALL_TIERS, DEFAULT_MODELS, type Tier } from "./tiers.js"; /** * Register the `devclaw` CLI command group on a Commander program. */ export function registerCli(program: Command): void { const devclaw = program .command("devclaw") .description("DevClaw development pipeline tools"); devclaw .command("setup") .description("Set up DevClaw: create agent, configure models, write workspace files") .option("--new-agent ", "Create a new agent with this name") .option("--agent ", "Use an existing agent by ID") .option("--workspace ", "Direct workspace path") .option("--junior ", `Junior dev model (default: ${DEFAULT_MODELS.dev.junior})`) .option("--medior ", `Medior dev model (default: ${DEFAULT_MODELS.dev.medior})`) .option("--senior ", `Senior dev model (default: ${DEFAULT_MODELS.dev.senior})`) .option("--reviewer ", `Reviewer model (default: ${DEFAULT_MODELS.qa.reviewer})`) .option("--tester ", `Tester model (default: ${DEFAULT_MODELS.qa.tester})`) .action(async (opts) => { const models: Partial> = {}; if (opts.junior) models["dev.junior"] = opts.junior; if (opts.medior) models["dev.medior"] = opts.medior; if (opts.senior) models["dev.senior"] = opts.senior; if (opts.reviewer) models["qa.reviewer"] = opts.reviewer; if (opts.tester) models["qa.tester"] = opts.tester; const result = await runSetup({ newAgentName: opts.newAgent, agentId: opts.agent, workspacePath: opts.workspace, models: Object.keys(models).length > 0 ? models : undefined, }); if (result.agentCreated) { console.log(`Agent "${result.agentId}" created`); } console.log("Models configured:"); for (const tier of ALL_TIERS) { console.log(` ${tier}: ${result.models[tier]}`); } console.log("Files written:"); for (const file of result.filesWritten) { console.log(` ${file}`); } if (result.warnings.length > 0) { console.log("\nWarnings:"); for (const w of result.warnings) { console.log(` ${w}`); } } console.log("\nDone! Next steps:"); console.log(" 1. Add bot to a Telegram group"); console.log(' 2. Register a project: "Register project at for group "'); console.log(" 3. Create your first issue and pick it up"); }); }