feat(cli): scriptable output, shell completion, and CLI refactor#51
Closed
Remeic wants to merge 4 commits into
Closed
feat(cli): scriptable output, shell completion, and CLI refactor#51Remeic wants to merge 4 commits into
Remeic wants to merge 4 commits into
Conversation
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.
8acc222 to
c57743c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #51 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 19 25 +6
Lines 554 585 +31
Branches 137 135 -2
=========================================
+ Hits 554 585 +31 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
Senior-polish pass that builds on the already-solid foundation (100% coverage + 100% mutation, multi-OS CI, release automation). Focus: scriptability, CLI craft, and removing duplication — plus docs that surface the genuinely sophisticated transactional design.
Changes
Refactor —
refactor(cli)src/lib/errors.ts— sharedformatError(was duplicated inprofile-store.ts+profile-config-copy.ts)src/lib/ui.ts— central output/colors/icons onnode:utilstyleText; NO_COLOR / non-TTY aware (clean strings in pipes, color in a terminal)src/lib/run-action.ts— uniform CLI error handling (✗ message+ exit 1); removes ~9 duplicatedcatchblocks and fixeslistwhich previously had none (raw stack trace instead of clean error)Features —
feat(cli)ccm list --json/ccm status --json— machine-readable output for scripting/piping; shared projection inprofile-view.ts(emitsnull, not the—placeholder)ccm completion <bash|zsh|fish>— completion script with the command list derived from the live registry, so it never drifts as commands are addedDocs —
docsARCHITECTURE.md— state reconciliation, the transactional stage→mutate→finalize + rollback protocol, the testability DI seam, and why error handling lives inrunActionnotindex.tsCLAUDE.md,.editorconfig, README (--json+ completion sections), CONTRIBUTING linkQuality gates
mutate[];list.ts/status.tsnewly added to the mutate set and brought to 100%Notes
node:utilstyleText, completion hand-derived fromprogram.commands.CLAUDE.mdonly (noAGENTS.md), flat-array JSON shape, static command-name completion.Verify