Skip to content

refactor: extract argparse setup into cli_parser.py#77

Merged
chanakyav merged 1 commit intomainfrom
refactor/extract-cli-parser
Mar 25, 2026
Merged

refactor: extract argparse setup into cli_parser.py#77
chanakyav merged 1 commit intomainfrom
refactor/extract-cli-parser

Conversation

@chanakyav
Copy link
Copy Markdown
Owner

Summary

Extract the argument parser construction (~80 lines) from main() in cli.py into a dedicated cli_parser.py module with a build_parser() function.

Why

Prep for the stacked PR chain work (#52). cli.py is currently 849 lines. Adding the autopilot chain command would push it past 1,000. By extracting the parser now:

  • cli.py drops to ~750 lines (handlers only)
  • cli_parser.py (~95 lines) is the single place to add new subcommand parsers
  • Clean separation: parser construction vs command execution

Changes

  • New: src/autopilot_loop/cli_parser.py with build_parser() function
  • Modified: src/autopilot_loop/cli.py -- main() now calls build_parser()

Verification

  • ruff check: zero errors
  • pytest: all 293 tests pass
  • No behavior change. Pure code move.

Move the argument parser construction (~80 lines) from main() in cli.py
into a dedicated cli_parser.py module with a build_parser() function.

This keeps cli.py focused on command handlers and gives future commands
(e.g. autopilot chain) a clean place to add their parsers without
bloating cli.py past 1,000 lines.

No behavior change. All 293 tests pass.
@chanakyav chanakyav merged commit 994cdf8 into main Mar 25, 2026
3 checks passed
@chanakyav chanakyav deleted the refactor/extract-cli-parser branch March 25, 2026 02:09
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.

1 participant