refactor(cli): extract 32 slash-command handlers into CLICommandsMixin (god-file Phase 4)

Lift the `_handle_*_command` cluster (2,077 LOC) out of HermesCLI into
hermes_cli/cli_commands_mixin.py; HermesCLI now inherits CLICommandsMixin so
every self.<handler> call resolves unchanged via the MRO. Behavior-neutral.

Import discipline mirrors gateway/slash_commands.py (PR #41886): neutral deps
imported at the mixin module top level; cli.py-internal helpers/constants
(_cprint, _ACCENT, save_config_value, ...) imported lazily inside each handler
via 'from cli import ...' so the mixin never imports cli at module scope.

cli.py 16215 -> 14139 LOC. One test mock repointed (cli.is_browser_debug_ready
-> hermes_cli.cli_commands_mixin.is_browser_debug_ready).
This commit is contained in:
teknium1 2026-06-08 01:42:15 -07:00 committed by Teknium
parent 4eb8972390
commit 0904bc7ea2
3 changed files with 2178 additions and 2079 deletions

2080
cli.py

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -238,7 +238,7 @@ class TestChromeDebugLaunch:
cli._pending_input = Queue()
monkeypatch.delenv("BROWSER_CDP_URL", raising=False)
with patch("cli.is_browser_debug_ready", return_value=True), \
with patch("hermes_cli.cli_commands_mixin.is_browser_debug_ready", return_value=True), \
patch("tools.browser_tool.cleanup_all_browsers"), \
patch("tools.browser_tool._ensure_cdp_supervisor"), \
redirect_stdout(StringIO()):