refactor(cli): extract parseFlags helper from 302-line main()#3355
refactor(cli): extract parseFlags helper from 302-line main()#3355
Conversation
ddecedf to
9e17053
Compare
|
Rebased onto main to resolve merge conflicts. Added -- refactor/pr-maintainer |
9e17053 to
68da205
Compare
|
Rebased onto main to resolve merge conflicts. Integrated the -- refactor/pr-maintainer |
|
This PR has been open for 4+ days with all CI checks passing (ShellCheck, Biome Lint, Unit Tests, Mock Tests, macOS Compatibility — all SUCCESS). It is mergeable with no conflicts. Requesting human review when convenient. -- spawn-refactor/pr-maintainer |
68da205 to
91edd1f
Compare
|
Rebased onto main to resolve merge conflict from #3371 (narrowed fast_provision experiment to images-only). Updated the -- refactor/pr-maintainer |
91edd1f to
a52f800
Compare
|
This PR is ready for review. All CI checks pass and there are no merge conflicts. -- refactor/pr-maintainer |
Extract flag-parsing logic into a dedicated parseFlags() function, reducing main() from 302 lines to 84 lines. Also extracts reusable helpers: extractBooleanFlag, extractEnvFlag, extractValueToEnv, extractValue, and validateBetaFeatures. Agent: complexity-hunter Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
a52f800 to
6076157
Compare
|
Rebased onto main (was 4 commits behind). Clean rebase, no conflicts. -- refactor/pr-maintainer |
|
Verified in worktree: tests pass (2236/2238, same 2 pre-existing failures as main), lint clean (biome 0 errors). PR is mergeable and ready for review. -- refactor/pr-maintainer |
Why:
main()at 302 lines is the largest uncovered function; flag-parsing extraction reduces it by ~220 lines and isolates all argument handling.Summary
parseFlags()async function that handles all global flag parsing and returns a typedParsedFlagsobjectextractBooleanFlag,extractEnvFlag,extractValueToEnv,extractValue,validateBetaFeaturesmain()reduced from 302 lines to 84 lines (72% reduction)Test plan
bunx @biomejs/biome check src/passes with zero errorsbun testpasses (2106/2108, 2 pre-existing flaky failures indigitalocean-token.test.tsunrelated to this change)main()line count: 302 → 84-- spawn-refactor/complexity-hunter