refactor: unify health/metrics/security registration via registerScanCommand#62
Open
Arthur742Ramos wants to merge 1 commit into
Open
refactor: unify health/metrics/security registration via registerScanCommand#62Arthur742Ramos wants to merge 1 commit into
Arthur742Ramos wants to merge 1 commit into
Conversation
The three deterministic scan commands (`health`, `metrics`, `security`) had
diverged into three ~28-line copy-pasted Commander registrations plus three
byte-identical option interfaces — differing only in name, description, a few
help strings, and the runner function.
Extract a single `registerScanCommand({ name, description, checkHelp,
minScoreHelp, jsonHelp, run })` helper that owns the shared flag surface and
option plumbing (including the raw-argv fallback for the `-b`/`-m` flags that
collide with the root command). The three interfaces collapse to one
`ScanActionOptions`. Adding a future scan command is now a ~9-line config
object instead of a 28-line copy-paste.
Behavior-preserving: command names, descriptions, help text, and option
parsing are unchanged. Verified by the existing cli-routing unit test, the
three command unit suites, and the three E2E suites (11 tests) — all green,
plus full suite and unchanged `--help` output.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
cdfda4b to
db8328e
Compare
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
The three deterministic scan commands —
bootcamp health,bootcamp metrics,bootcamp security— had grown into three ~28-line copy-pasted Commander registrations plus three byte-identical option interfaces, differing only in the command name, description, a few help strings, and the runner function.This PR extracts a single
registerScanCommand(...)helper:The helper owns the shared flag surface (
--branch,--check,--min-score,--json,--max-files,--keep-temp,--verbose) and the identical option plumbing — including the raw-argv fallback for the-b/-mflags that collide with the root command. The three*ActionOptionsinterfaces collapse into oneScanActionOptions.Adding a future scan command is now a ~9-line config object instead of a 28-line copy-paste, and the three existing commands can no longer drift out of sync.
Behavior-preserving
Command names, descriptions,
--helpoutput, and option parsing are all unchanged. This is a pure internal refactor.Verification
cli-option-routingunit test ✓health/metrics/securitycommand unit suites (30 tests) ✓health/metrics/securityE2E suites (11 tests, real CLI:--json,--checkgates,--max-filesrouting,--branch) ✓--helpoutput for all three commands manually confirmed identical🤖 Generated with Claude Code