Skip to content

refactor(cli): extract usage/insights cluster into CLIUsageMixin (cli.py god-file slice R4) - #79368

Open
andrexibiza wants to merge 2 commits into
NousResearch:mainfrom
andrexibiza:fix/cli-usage-extract
Open

refactor(cli): extract usage/insights cluster into CLIUsageMixin (cli.py god-file slice R4)#79368
andrexibiza wants to merge 2 commits into
NousResearch:mainfrom
andrexibiza:fix/cli-usage-extract

Conversation

@andrexibiza

@andrexibiza andrexibiza commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

cli.py god-file slice R4: extract the usage/insights/context-display cluster from cli.py into hermes_cli/cli_usage_mixin.py (class CLIUsageMixin). Part of the repo-wide large-file decomposition (tracker #78647).

What changed and why

  • Usage/insights cluster (window 11202–11442, 241 lines, 5 members: _handle_usage_command, _usage_reset, _show_context_breakdown, _show_usage, _show_insights) moved byte-verbatim (golden sha e117ff8728… confirmed)
  • True read-only slice: zero self-writes to cli.py module globals (verified — the consensus lane caught pass A's wrong claims about the window boundaries)
  • One sanctioned seam edit: lazy from cli import format_duration_compact inside _show_usage (pure function, documented in module docstring)
  • CLIUsageMixin appended last to HermesCLI bases; _manual_compress stays in cli.py (explicit R3-consensus deferral)
  • Double-blind: 2 analysts → consensus (R4-CONSENSUS.md, 5-member window won over 6-member) → implementer → 2 blind re-reviewers (both APPROVED; EOF blank-line MINOR fixed in a follow-up hygiene commit 38d5b61b24)

Testing

  • test_cli_usage_seam.py: 14 passed (identity asserts 5/5, no-back-import subprocess, usage reset, context-breakdown shape, insights aggregation)
  • Static undefined-name scan: 0 real names in the moved module
  • ruff clean · git diff --check clean (after hygiene fix) · LF-only · DCO signed

Coordination / interlock

Part of #78647
Part of #55136

….py god-file slice R4)

Signed-off-by: andrexibiza <84248988+andrexibiza@users.noreply.github.com>
Signed-off-by: andrexibiza <84248988+andrexibiza@users.noreply.github.com>
@alt-glitch alt-glitch added type/refactor Code restructuring, no behavior change comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have labels Aug 5, 2026
@andrexibiza

Copy link
Copy Markdown
Contributor Author

🔒 This shard is part of the cli.py KILL LOCK — the permanent record of the 18,485-line whole, the mess it caused (#54960 duplicate-tracking chaos, #65303 no ESC-interrupt, #72797 XML-tag loss, #75461 redaction bypass, #76914 unfinalized sessions, #77764 approval truncation, #39446 /reload-mcp blocking, terminal-escape leaks), every shard in the wave, the #12355 block on R1, and every open fixer PR still fighting the surface (#73104 #75476 #77776 #75084 #76804 #76995 #71295 #78871 #74491 #72821 #57453 #61429 #71027 #62027 #65192 #71088 #74038 #69918 #67484 #12355 #75207 #32193 #74281 #37818 #27172 #65785).

Lock: posted on #55136 · Indexed by the Kill All Gods meta-issue #78647.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants