refactor(cli): split output-formatting and parser construction into s… - #115
Conversation
…ervices cli.py had already gone through one service-module split (docker, key, package, workflow, logs, projects) in v2.28.0. What remained was argparse plumbing, dispatch, and output printing -- two more clean, self-contained cuts: - services/cli_output.py: _print_payload, _format_size, _queue_state, _print_status, _print_doctor, _print_maintenance. Pure functions, zero coupling to argparse or dispatch. - services/cli_parser.py: _product_parser, _compatibility_parser, _add_profile_arguments, _add_docker_run_arguments, _ProductArgumentParser, _product_help. Pure argparse construction, no runtime side effects. _dispatch_product, main(), _run_foreground, and the runtime-preset/ dispatch helpers stay in cli.py -- that's the real orchestration and belongs in the owner file. cli.py: 786 -> 509 lines. Verbatim extraction, no behavior change. Opus-reviewed; the review caught one real miss (tests/test_runtime_cli.py:317 still called cli._product_help() after it was correctly dropped from cli.py's imports) -- fixed by importing from the new module directly, matching the fix already applied in test_command_smoke.py. Also added direct unit tests for _format_size/_queue_state (services/cli_output.py had zero dedicated coverage before, only indirect exercise through existing cli.py tests). Full suite: 810 passed, 29 skipped, same 6 pre-existing sandbox-only failures (bundled spaCy concept model unavailable in this environment, confirmed present on a clean MARM-main checkout before this change).
|
Warning Review limit reached
Next review available in: 46 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe CLI parser construction and output formatting logic moved from ChangesCLI module split
Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2418dddcd0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| <details> | ||
| <summary><strong>Unreleased: Concept Store Module Split (v2.29.1)</strong></summary> | ||
| <summary><strong>Unreleased: Product CLI Module Split (v2.29.1)</strong></summary> |
There was a problem hiding this comment.
Synchronize the v2.29.1 version surfaces
With this unreleased section as the first changelog entry, python scripts/find-versions.py treats 2.29.1 as the target, while pyproject.toml, runtime constants, server.json, Docker metadata, READMEs, and installation docs all remain at 2.29.0. Consequently, builds from this commit still identify themselves as 2.29.0 and the repository's version audit reports conflicting versions; either leave the unreleased entry unversioned or update every required version surface.
AGENTS.md reference: AGENTS.md:L39-L49
Useful? React with 👍 / 👎.
cli.py Refactor -
cli.py had already gone through one service-module split (docker, key, package, workflow, logs, projects) in v2.28.0. What remained was argparse plumbing, dispatch, and output printing -- two more clean, self-contained cuts:
_dispatch_product, main(), _run_foreground, and the runtime-preset/ dispatch helpers stay in cli.py -- that's the real orchestration and belongs in the owner file. cli.py: 786 -> 509 lines.
Verbatim extraction, no behavior change. Opus-reviewed; the review caught one real miss (tests/test_runtime_cli.py:317 still called cli._product_help() after it was correctly dropped from cli.py's imports) -- fixed by importing from the new module directly, matching the fix already applied in test_command_smoke.py. Also added direct unit tests for _format_size/_queue_state (services/cli_output.py had zero dedicated coverage before, only indirect exercise through existing cli.py tests).
Full suite: 810 passed, 29 skipped, same 6 pre-existing sandbox-only failures (bundled spaCy concept model unavailable in this environment, confirmed present on a clean MARM-main checkout before this change).
Summary by CodeRabbit
Documentation
Refactor
Tests