Skip to content

refactor(cli): split output-formatting and parser construction into s… - #115

Merged
Lyellr88 merged 2 commits into
MARM-mainfrom
refactor/cli-output-and-parser-split
Jul 26, 2026
Merged

refactor(cli): split output-formatting and parser construction into s…#115
Lyellr88 merged 2 commits into
MARM-mainfrom
refactor/cli-output-and-parser-split

Conversation

@Lyellr88

@Lyellr88 Lyellr88 commented Jul 26, 2026

Copy link
Copy Markdown
Owner

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:

  • 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).

Summary by CodeRabbit

  • Documentation

    • Added an Unreleased v2.29.1 changelog entry.
  • Refactor

    • Reorganized CLI argument parsing and output formatting while preserving existing behavior.
    • Maintained the current command structure, help content, dispatching, and runtime controls.
  • Tests

    • Added coverage for output formatting, queue status reporting, and size conversions.
    • Updated CLI tests to reflect the reorganized implementation.

…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).
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Lyellr88, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a42a5fea-2788-476d-8187-9b0eeb16284b

📥 Commits

Reviewing files that changed from the base of the PR and between 2418ddd and 8fe1493.

📒 Files selected for processing (1)
  • CHANGELOG.md
📝 Walkthrough

Walkthrough

The CLI parser construction and output formatting logic moved from cli.py into services/cli_parser.py and services/cli_output.py. cli.py continues to orchestrate dispatch and runtime lifecycle. Tests now import parser and help helpers from the new service module.

Changes

CLI module split

Layer / File(s) Summary
Parser construction and command wiring
marm-mcp-server/marm_mcp_server/services/cli_parser.py
Defines shared options, Docker arguments, stable help rendering, product subcommands, and compatibility arguments.
Output rendering service
marm-mcp-server/marm_mcp_server/services/cli_output.py
Provides payload, status, doctor, maintenance, size-formatting, and queue-state rendering helpers.
CLI orchestration and validation
marm-mcp-server/marm_mcp_server/cli.py, marm-mcp-server/tests/*, CHANGELOG.md
cli.py delegates parser and output work while tests follow the moved helpers; the changelog records the split.
Estimated code review effort: 3 (Moderate) ~20 minutes

Possibly related PRs

  • Lyellr88/marm-memory#104: Overlaps with this PR’s CLI command-definition changes and the embeddings migration option.
  • Lyellr88/marm-memory#111: Added the command smoke coverage now updated to import parser and help helpers from services/cli_parser.
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread CHANGELOG.md

<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>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@Lyellr88
Lyellr88 merged commit 195b21d into MARM-main Jul 26, 2026
7 checks passed
@Lyellr88
Lyellr88 deleted the refactor/cli-output-and-parser-split branch July 26, 2026 04:19
@coderabbitai coderabbitai Bot mentioned this pull request Jul 26, 2026
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