Skip to main content

cli-wiring

Checklist and patterns for wiring new CLI commands into cli-entry.ts

소스 정보

저장소
bradygaster/squad
최근 소스 활동
2026년 6월 26일 10:08
감지된 SKILL.md 언어
영어
스타
3,311
포크
509

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
cli-wiring
description
Checklist and patterns for wiring new CLI commands into cli-entry.ts
domain
cli
confidence
high
source
extracted
# 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 1. **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) 2. **Add routing block** in `packages/squad-cli/src/cli-entry.ts` inside `main()`: ```ts if (cmd === '<name>') { const { run<Name> } = await import('./cli/commands/<name>.js'); // parse args, call function await run<Name>(process.cwd(), options); return; } ``` 3. **Add help text** in the help section of `cli-entry.ts` (search for `Commands:`): ```ts console.log(` ${BOLD}<name>${RESET} <description>`); console.log(` Usage: <name> [flags]`); ``` 4. **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`, `cast` (alias: `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 ```ts 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, cast (née hire) were already present.
GitHub에서 보기