Skip to content

refactor(cli): build CLI on citty - #62

Merged
Karnak19 merged 1 commit into
mainfrom
refactor/cli-citty
Jun 9, 2026
Merged

refactor(cli): build CLI on citty#62
Karnak19 merged 1 commit into
mainfrom
refactor/cli-citty

Conversation

@Karnak19

@Karnak19 Karnak19 commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Follow-up to #60 — migrates the CLI from the hand-rolled arg parser to citty.

What

  • cli/index.ts + cli/schema.ts rewritten as defineCommand/runMain with generate + schema (8 nested subcommands).
  • Declarative, typed args/positionals → auto-generated --help/usage for every command and consistent flag parsing (short flags like -c now work everywhere, not just on generate).
  • cli/action.ts: small wrapper preserving the previous clean one-line error output (citty's default dumps a full stack, and its CLIError isn't exported).
  • Drops the splitArgs unit tests (parsing is citty's job now); command-merge and auth-resolution tests remain.
  • Adds citty as pbkit's first runtime dependency.

pbkit generate behavior is unchanged.

Verification

  • tsc --noEmit clean
  • bun test — 139 pass / 0 fail
  • Build OK
  • Manually verified: auto-help for pbkit / pbkit schema / each subcommand; clean one-line errors for no-creds / partial-creds / no-config; unknown-command shows usage; generate paths unchanged.

🤖 Generated with Claude Code

Replace the hand-rolled arg parser with citty's defineCommand/runMain. Both
`generate` and `schema` (with its 8 nested subcommands) now get auto-generated
--help/usage and consistent flag parsing. A small action() wrapper preserves
the previous clean one-line error output instead of citty's stack dump.

generate behavior is unchanged. The splitArgs unit tests are dropped (parsing
is now citty's responsibility); command merge and auth-resolution tests remain.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Karnak19
Karnak19 merged commit 3c7dd9a into main Jun 9, 2026
3 checks passed
@Karnak19
Karnak19 deleted the refactor/cli-citty branch June 9, 2026 09:14
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