Skip to content

fix: honor --branch and --max-files in bootcamp health#50

Merged
Arthur742Ramos merged 1 commit into
mainfrom
arthur742ramos/health-flag-routing
Jun 11, 2026
Merged

fix: honor --branch and --max-files in bootcamp health#50
Arthur742Ramos merged 1 commit into
mainfrom
arthur742ramos/health-flag-routing

Conversation

@Arthur742Ramos

Copy link
Copy Markdown
Owner

Summary

Fixes a flag-routing bug in the bootcamp health command (added in #48): -b/--branch and -m/--max-files were silently ignored.

Root cause

The root bootcamp command defines -b, --branch and -m, --max-files. Because the root command also has options + an action alongside subcommands, Commander captures those flags at the root before the health subcommand parses them. The subcommand's own defaults (branch: "", max-files: "500") then masked the missing values — so bootcamp health <repo> --branch dev --max-files 42 always used the default branch and a 500-file scan.

Fix

Read --branch and --max-files from raw argv via the existing getCliFlagValue helper — the same workaround the diff command already uses for --output. Removed the masking default on the subcommand's --max-files option.

Also added a filesScanned field to the --json output. It's genuinely useful to consumers and makes --max-files observable for testing.

Testing

  • New e2e test: bootcamp health --json --max-files 3 scans ≤ 3 entries while the default scans more — directly proving the routing fix
  • Updated the --json unit test to assert filesScanned
  • Local validation: lint ✓, typecheck ✓, build ✓, full unit suite 1049 passing, health e2e (4) ✓

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>
@Arthur742Ramos Arthur742Ramos merged commit 2b76b5e into main Jun 11, 2026
13 checks passed
@Arthur742Ramos Arthur742Ramos deleted the arthur742ramos/health-flag-routing branch June 11, 2026 17:21
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.

2 participants