Skip to content

refactor: split cli.py into cli/ package (#155) - #160

Merged
hlin99 merged 1 commit into
mainfrom
refactor/cli-modularization
Apr 5, 2026
Merged

hlin99 merged 1 commit into
mainfrom
refactor/cli-modularization

Conversation

@hlin99

@hlin99 hlin99 commented Apr 5, 2026

Copy link
Copy Markdown
Member

Closes #155

Summary

Split the monolithic 3015-line cli.py into a cli/ package with 11 modules, each under 500 lines.

Module breakdown

Module Lines Contents
__init__.py 214 main(), config loading, dispatch
parsers.py 490 All argparse subcommand definitions
batch.py 418 batch-compare, rerun
data.py 368 snapshot, cache, history, dataset-stats
report.py 338 report, diff, regression, summary, filter, explain, annotate, cluster, aggregate
analysis.py 217 watch, entropy, length-bias, sensitivity, fingerprint
compare.py 193 compare-logprobs, compare-output, compare-streaming
_common.py 184 Shared helpers
benchmark.py 163 benchmark, reproducibility, concurrency-sweep, bisect
config_cmd.py 93 init, config, profiles, completion
diagnose.py 83 diagnose, healthcheck, detect, check-kv

Verification

  • All 1064 existing tests pass
  • ruff check and isort --check pass
  • pyproject.toml entry point unchanged (xpyd_acc.cli:main)
  • Pure refactor — no functional changes
  • Old cli.py removed

Split the monolithic 3015-line cli.py into a cli/ package with 11 modules:
- __init__.py: main(), config loading, dispatch (214 lines)
- __main__.py: python -m support (5 lines)
- _common.py: shared helpers (184 lines)
- parsers.py: all argparse definitions (490 lines)
- compare.py: logprobs, output, streaming comparison (193 lines)
- batch.py: batch-compare, rerun, snapshot replay (418 lines)
- diagnose.py: diagnose, healthcheck, detect, check-kv (83 lines)
- report.py: report, diff, regression, summary, filter, explain, annotate, cluster, aggregate (338 lines)
- benchmark.py: benchmark, reproducibility, concurrency-sweep, bisect (163 lines)
- data.py: snapshot capture, cache, history, dataset-stats (368 lines)
- config_cmd.py: init, config, profiles, completion (93 lines)
- analysis.py: watch, entropy, length-bias, sensitivity, fingerprint (217 lines)

All 1064 existing tests pass. No functional changes.

@hlin99-Review-Bot hlin99-Review-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.

✅ Approved by hlin99-Review-Bot

Idea Value: High — splitting a 3076-line monolith into 11 focused modules is a clear maintainability win. Well-scoped, no functional changes.

Code Quality:

  • Module breakdown is logical and well-organized
  • Re-exports in __init__.py preserve backward compatibility for test patching
  • All 1064 tests pass, lint clean
  • CI all green (lint + test 3.10/3.11/3.12)
  • docs/iterations/current.md updated
  • Entry point unchanged (xpyd_acc.cli:main)

No issues found. Pure mechanical refactor, cleanly executed.

@hlin99-Review-BotX hlin99-Review-BotX 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.

✅ Approved by hlin99-Review-BotX

Idea Value: High — a 3076-line monolith split into 11 focused modules is a clear maintainability and navigability win. Logical groupings, no functional changes.

Code Quality:

  • __init__.py re-exports all handlers preserving backward-compatible patch paths for tests — good attention to detail
  • parsers.py cleanly centralizes all argparse definitions via register_all()
  • __main__.py enables python -m execution (5 lines, correct)
  • All 1064 tests pass, lint clean, CI green across 3.10/3.11/3.12
  • docs/iterations/current.md updated
  • Entry point xpyd_acc.cli:main unchanged in pyproject.toml

No issues found. Second approval — should auto-merge.

@hlin99
hlin99 merged commit 4c146ce into main Apr 5, 2026
5 checks passed
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.

M73: CLI Modularization — split monolithic cli.py into cli/ package

3 participants