fix: honor --branch and --max-files in bootcamp health#50
Merged
Conversation
The health subcommand's -b/--branch and -m/--max-files short flags collide with the root command's options, which captured them before the subcommand parsed them — so user-supplied values were silently ignored (branch fell back to default, max-files was always 500). Route both via getCliFlagValue from raw argv (the same workaround the diff command uses for --output). Also surface filesScanned in the --json output, which makes --max-files observable and is useful to consumers. Adds an e2e test asserting --max-files limits the scan, plus a filesScanned unit assertion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Summary
Fixes a flag-routing bug in the
bootcamp healthcommand (added in #48):-b/--branchand-m/--max-fileswere silently ignored.Root cause
The root
bootcampcommand defines-b, --branchand-m, --max-files. Because the root command also has options + an action alongside subcommands, Commander captures those flags at the root before thehealthsubcommand parses them. The subcommand's own defaults (branch: "",max-files: "500") then masked the missing values — sobootcamp health <repo> --branch dev --max-files 42always used the default branch and a 500-file scan.Fix
Read
--branchand--max-filesfrom raw argv via the existinggetCliFlagValuehelper — the same workaround thediffcommand already uses for--output. Removed the masking default on the subcommand's--max-filesoption.Also added a
filesScannedfield to the--jsonoutput. It's genuinely useful to consumers and makes--max-filesobservable for testing.Testing
bootcamp health --json --max-files 3scans ≤ 3 entries while the default scans more — directly proving the routing fix--jsonunit test to assertfilesScannedlint✓,typecheck✓,build✓, full unit suite 1049 passing, health e2e (4) ✓