Skip to content

feat(cli): scriptable output, shell completion, and CLI refactor#52

Merged
Remeic merged 4 commits into
mainfrom
feat/scriptable-output
Jun 1, 2026
Merged

feat(cli): scriptable output, shell completion, and CLI refactor#52
Remeic merged 4 commits into
mainfrom
feat/scriptable-output

Conversation

@Remeic
Copy link
Copy Markdown
Owner

@Remeic Remeic commented Jun 1, 2026

Replaces #51 (closed when its branch was renamed feat/senior-polishfeat/scriptable-output).

Summary

Builds on the existing foundation (100% coverage + 100% mutation, multi-OS CI, release automation). Focus: scriptability, CLI craft, removing duplication — plus docs that surface the transactional design.

Changes

Refactor — refactor(cli)

  • src/lib/errors.ts — shared formatError (was duplicated in profile-store.ts + profile-config-copy.ts)
  • src/lib/ui.ts — central output/colors/icons on node:util styleText; NO_COLOR / non-TTY aware
  • src/lib/run-action.ts — uniform CLI error handling (✗ message + exit 1); removes ~9 duplicated catch blocks and fixes list which previously had none

Features — feat(cli)

  • ccm list --json / ccm status --json — machine-readable output; shared projection in profile-view.ts (emits null, not the placeholder)
  • ccm completion <bash|zsh|fish> — command list derived from the live registry, never drifts

Docs — docs

  • ARCHITECTURE.md — state reconciliation, transactional stage→mutate→finalize + rollback, the testability DI seam, why error handling lives in runAction not index.ts
  • CLAUDE.md, .editorconfig, README (--json + completion), CONTRIBUTING link

Quality gates

  • ✅ Lint (Biome), Build (tsup)
  • 365 tests (was 326)
  • ✅ Coverage 100% (statements / branches / functions / lines)
  • ✅ Mutation (Stryker) 100.00%, 0 survivors — every new file added to mutate[]; list.ts/status.ts newly mutated and brought to 100%
  • ✅ Rebased on latest main (0.6.0 release, TypeScript 6.0.3) — gates re-verified

Verify

ccm list --json | jq '.[] | select(.loggedIn) | .name'
ccm completion zsh
NO_COLOR=1 ccm status   # no ANSI escapes

Remeic added 4 commits June 1, 2026 12:00
Extract shared formatError (errors.ts), terminal output/colors/icons
(ui.ts, NO_COLOR/TTY-aware via styleText), and a runAction wrapper that
gives every command uniform error UX. Removes duplicated catch blocks and
ANSI magic strings; fixes list-style commands lacking error handling.
list/status gain --json for scriptable output (shared projection in
profile-view.ts; null instead of the — placeholder). New ccm completion
<bash|zsh|fish> derives the command list from the live registry so it
never drifts. All new modules added to the Stryker mutate set.
ARCHITECTURE.md covers state reconciliation, the transactional
stage/rollback protocol, the testability DI seam, and why error handling
lives in runAction rather than index.ts. README documents --json and shell
completion; CLAUDE.md captures the build/test/mutation invariants.
@Remeic Remeic merged commit c84be86 into main Jun 1, 2026
18 checks passed
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