Skill: CLI Command Wiring
Bug class: Commands implemented in packages/squad-cli/src/cli/commands/ but never routed in cli-entry.ts.
Checklist — Adding a New CLI Command
Create command file in packages/squad-cli/src/cli/commands/<name>.ts
- Export a
run<Name>(cwd, options) async function (or class with static methods for utility modules)
Add routing block in packages/squad-cli/src/cli-entry.ts inside main():
if (cmd === '<name>') {
const { run<Name> } = await import('./cli/commands/<name>.js');
// parse args, call function
await run<Name>(process.cwd(), options);
return;
}
Add help text in the help section of cli-entry.ts (search for Commands:):
console.log(` ${BOLD}<name>${RESET} <description>`);
console.log(` Usage: <name> [flags]`);
Verify both exist — the recurring bug is doing step 1 but missing steps 2-3.
Wiring Patterns by Command Type
| Type |
Example |
How to wire |
| Standard command |
export.ts, build.ts |
run*() function, parse flags from args |
| Placeholder command |
loop, hire |
Inline in cli-entry.ts, prints pending message |
| Utility/check module |
rc-tunnel.ts, copilot-bridge.ts |
Wire as diagnostic check (e.g., isDevtunnelAvailable()) |
| Subcommand of another |
init-remote.ts |
Already used inside parent + standalone alias |
Common Import Pattern
import { BOLD, RESET, DIM, RED, GREEN, YELLOW } from './cli/core/output.js';
Use dynamic await import() for command modules to keep startup fast (lazy loading).
History
- #237 / PR #244: 4 commands wired (rc, copilot-bridge, init-remote, rc-tunnel). aspire, link, loop, hire were already present.
1---2name: cli-wiring3description: Skill: CLI Command Wiring4---5# Skill: CLI Command Wiring67**Bug class:** Commands implemented in `packages/squad-cli/src/cli/commands/` but never routed in `cli-entry.ts`.89## Checklist — Adding a New CLI Command10111. **Create command file** in `packages/squad-cli/src/cli/commands/<name>.ts`12 - Export a `run<Name>(cwd, options)` async function (or class with static methods for utility modules)13142. **Add routing block** in `packages/squad-cli/src/cli-entry.ts` inside `main()`:15 ```ts16 if (cmd === '<name>') {17 const { run<Name> } = await import('./cli/commands/<name>.js');18 // parse args, call function19 await run<Name>(process.cwd(), options);20 return;21 }22 ```23243. **Add help text** in the help section of `cli-entry.ts` (search for `Commands:`):25 ```ts26 console.log(` ${BOLD}<name>${RESET} <description>`);27 console.log(` Usage: <name> [flags]`);28 ```29304. **Verify both exist** — the recurring bug is doing step 1 but missing steps 2-3.3132## Wiring Patterns by Command Type3334| Type | Example | How to wire |35|------|---------|-------------|36| Standard command | `export.ts`, `build.ts` | `run*()` function, parse flags from `args` |37| Placeholder command | `loop`, `hire` | Inline in cli-entry.ts, prints pending message |38| Utility/check module | `rc-tunnel.ts`, `copilot-bridge.ts` | Wire as diagnostic check (e.g., `isDevtunnelAvailable()`) |39| Subcommand of another | `init-remote.ts` | Already used inside parent + standalone alias |4041## Common Import Pattern4243```ts44import { BOLD, RESET, DIM, RED, GREEN, YELLOW } from './cli/core/output.js';45```4647Use dynamic `await import()` for command modules to keep startup fast (lazy loading).4849## History5051- **#237 / PR #244:** 4 commands wired (rc, copilot-bridge, init-remote, rc-tunnel). aspire, link, loop, hire were already present.