Skip to content

feat: use commander for CLI parsing - #12

Merged
lollipop-onl merged 2 commits into
mainfrom
claude/ghostq-cli-base-library-9ae0da
Jul 18, 2026
Merged

feat: use commander for CLI parsing#12
lollipop-onl merged 2 commits into
mainfrom
claude/ghostq-cli-base-library-9ae0da

Conversation

@lollipop-onl

Copy link
Copy Markdown
Member

背景

CLI は process.argv を手動でパースしており、version flag が無かった。ghostq -v が何も出力しない状態だった。

変更

  • commander を導入し src/index.ts を移行
    • -v / --version を追加(meta.versionpackage.json から供給)
    • root/各サブコマンドの --help を自動生成、unknown command / missing argument を自動処理
    • adopt <files...> を可変長 positional でネイティブに配列受け取り(rawArgs 手動フィルタを廃止)
  • commander は唯一の runtime dependency で、--compile 時にバイナリへ bundle される → 配布物は外部ランタイム不要のまま
  • 「Runtime dependencies: none」を明記していた DEVELOPMENT.md / AGENTS.md を実態に合わせて更新
  • README のコマンド一覧に -v / -h を追記

確認

  • bun run typecheck
  • bun test → 52 pass ✅
  • bun run build → compile 版で -v / status / root 動作確認 ✅

🤖 Generated with Claude Code

lollipop-onl and others added 2 commits July 18, 2026 21:16
The CLI parsed argv by hand and had no version flag, so `ghostq -v`
printed nothing. Adopt commander to get `-v`/`--version`, auto-generated
`--help` for the root command and every subcommand, and variadic
positional handling for `adopt <files...>` without manually filtering
rawArgs.

commander is the sole runtime dependency and is bundled into the
compiled binary, so the distributed artifact still needs no external
runtime. Docs that claimed zero runtime dependencies are updated to
reflect this.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the hand-maintained command list with the actual `--help` output
so it can't drift, and add a comment reminding to re-paste it when the
CLI changes. Drop the version/help option lines — they don't need
documenting.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lollipop-onl
lollipop-onl merged commit a8dcff5 into main Jul 18, 2026
1 check passed
@lollipop-onl
lollipop-onl deleted the claude/ghostq-cli-base-library-9ae0da branch July 18, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant