mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-09 08:21:50 +00:00
refactor(cli): extract 18 model-flow wizard functions into model_setup_flows (god-file Phase 2)
Lift the 18 _model_flow_* provider-setup wizard functions out of hermes_cli/main.py into hermes_cli/model_setup_flows.py. Behavior-neutral; main.py 14050 -> 11479 LOC. select_provider_and_model (the dispatcher) STAYS in main.py and re-imports the flows via an explicit 'from hermes_cli.model_setup_flows import (...)' block, so both its bare-name calls and existing test monkeypatches targeting hermes_cli.main._model_flow_* keep resolving against main's namespace unchanged. Imports: 3 neutral deps (argparse, os, subprocess) at the module top; the 14 main.py-internal helpers the flows call (_prompt_api_key, _save_custom_provider, the reasoning-effort/stepfun/qwen helpers, _run_anthropic_oauth_flow, ...) are lazy-imported per-flow (from hermes_cli.main import ...) so the new module never imports main at module scope -> no import cycle. Repointed one source-inspection change-detector (test_setup_ollama_cloud_force_refresh) to read the module the ollama-cloud branch moved to. Validation: 6563/6563 hermes_cli tests pass; live flow-dispatch probe confirms the lazy main-internal imports resolve at runtime.
This commit is contained in:
parent
55b83c3d99
commit
a77efada5f
3 changed files with 2677 additions and 2597 deletions
2619
hermes_cli/main.py
2619
hermes_cli/main.py
File diff suppressed because it is too large
Load diff
2648
hermes_cli/model_setup_flows.py
Normal file
2648
hermes_cli/model_setup_flows.py
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -9,10 +9,13 @@ from __future__ import annotations
|
|||
|
||||
def test_setup_ollama_cloud_passes_force_refresh(monkeypatch):
|
||||
"""The provider-setup model-fetch for ollama-cloud must pass ``force_refresh=True``."""
|
||||
import hermes_cli.main as main_mod
|
||||
# The ollama-cloud branch lives in ``_model_flow_api_key_provider``, which was
|
||||
# extracted from main.py into hermes_cli/model_setup_flows.py (god-file
|
||||
# decomposition Phase 2). Inspect the module the code now lives in.
|
||||
import hermes_cli.model_setup_flows as flows_mod
|
||||
import inspect
|
||||
|
||||
src = inspect.getsource(main_mod)
|
||||
src = inspect.getsource(flows_mod)
|
||||
|
||||
# Locate the ollama-cloud branch in the provider setup flow.
|
||||
marker = 'provider_id == "ollama-cloud"'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue