feat: use commander for CLI parsing - #12
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
CLI は
process.argvを手動でパースしており、version flag が無かった。ghostq -vが何も出力しない状態だった。変更
commanderを導入しsrc/index.tsを移行-v/--versionを追加(meta.versionはpackage.jsonから供給)--helpを自動生成、unknown command / missing argument を自動処理adopt <files...>を可変長 positional でネイティブに配列受け取り(rawArgs 手動フィルタを廃止)--compile時にバイナリへ bundle される → 配布物は外部ランタイム不要のまま-v/-hを追記確認
bun run typecheck✅bun test→ 52 pass ✅bun run build→ compile 版で-v/status/root動作確認 ✅🤖 Generated with Claude Code