Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,414 changes: 128 additions & 2,286 deletions cli.py

Large diffs are not rendered by default.

609 changes: 609 additions & 0 deletions cli_config.py

Large diffs are not rendered by default.

1,015 changes: 1,015 additions & 0 deletions cli_display.py

Large diffs are not rendered by default.

701 changes: 701 additions & 0 deletions cli_git.py

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/cli/test_cli_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def test_model_provider_wins_over_root_provider(self, tmp_path, monkeypatch):
}))

import cli
monkeypatch.setattr(cli, "_hermes_home", hermes_home)
monkeypatch.setattr("cli_config._hermes_home", hermes_home)
cfg = cli.load_cli_config()

assert cfg["model"]["provider"] == "openrouter"
Expand All @@ -595,7 +595,7 @@ def test_root_provider_used_as_fallback_when_model_provider_missing(self, tmp_pa
}))

import cli
monkeypatch.setattr(cli, "_hermes_home", hermes_home)
monkeypatch.setattr("cli_config._hermes_home", hermes_home)
cfg = cli.load_cli_config()

assert cfg["model"]["provider"] == "opencode-go"
Expand All @@ -617,7 +617,7 @@ def test_root_base_url_used_as_fallback_when_model_base_url_missing(self, tmp_pa
}))

import cli
monkeypatch.setattr(cli, "_hermes_home", hermes_home)
monkeypatch.setattr("cli_config._hermes_home", hermes_home)
cfg = cli.load_cli_config()

assert cfg["model"]["base_url"] == "https://example.com/v1"
Expand Down
6 changes: 3 additions & 3 deletions tests/cli/test_cli_light_mode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Tests for the light-mode terminal detection + color remap in cli.py.
"""Tests for the light-mode terminal detection + color remap in cli_display.py.

Covers the env-override path and the SkinConfig.get_color() wrapper that
the resize / light-mode salvage installs at module import time. We don't
Expand All @@ -14,8 +14,8 @@

@pytest.fixture
def cli_mod(monkeypatch):
"""Import cli with the light-mode cache cleared each test."""
import cli as _cli
"""Import cli_display with the light-mode cache cleared each test."""
import cli_display as _cli

# The module-level _install_skin_light_mode_hook() and import-time
# _detect_light_mode() prime ran once at first import. We just reset
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/test_cli_save_config_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def config_env(self, tmp_path, monkeypatch):
"model": {"default": "test-model", "provider": "openrouter"},
"display": {"skin": "default"},
}))
monkeypatch.setattr("cli._hermes_home", hermes_home)
monkeypatch.setattr("cli_config._hermes_home", hermes_home)
return config_path

def test_calls_roundtrip_yaml_update(self, config_env, monkeypatch):
Expand Down
4 changes: 2 additions & 2 deletions tests/cli/test_cprint_bg_thread.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Tests for cli._cprint's bg-thread cooperation with prompt_toolkit.
"""Tests for cli_display._cprint's bg-thread cooperation with prompt_toolkit.

Background: when a prompt_toolkit Application is running, a bg thread that
calls ``_pt_print`` directly can race with the input-area redraw and the
Expand All @@ -18,7 +18,7 @@

import pytest

import cli
import cli_display as cli


@pytest.fixture(autouse=True)
Expand Down
5 changes: 3 additions & 2 deletions tests/cli/test_resume_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from unittest.mock import MagicMock, patch

import cli as cli_mod
import cli_display

sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))

Expand Down Expand Up @@ -316,8 +317,8 @@ def test_panel_is_stored_as_resize_aware_history_entry(self):
output = self._capture_display(cli)

assert "Previous Conversation" in output
assert len(cli_mod._OUTPUT_HISTORY) == 1
assert callable(cli_mod._OUTPUT_HISTORY[0])
assert len(cli_display._OUTPUT_HISTORY) == 1
assert callable(cli_display._OUTPUT_HISTORY[0])
finally:
cli_mod._configure_output_history(True, 200)

Expand Down
6 changes: 3 additions & 3 deletions tests/hermes_cli/test_config_env_expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def test_cli_config_ignores_empty_terminal_section(self, tmp_path, monkeypatch):
config_file = tmp_path / "config.yaml"
config_file.write_text("terminal:\n")

monkeypatch.setattr("cli._hermes_home", tmp_path)
monkeypatch.setattr("cli_config._hermes_home", tmp_path)

from cli import load_cli_config
config = load_cli_config()
Expand All @@ -173,7 +173,7 @@ def test_cli_config_expands_auxiliary_api_key(self, tmp_path, monkeypatch):

monkeypatch.setenv("TEST_VISION_KEY_XYZ", "vis-key-123")
# Patch the hermes home so load_cli_config finds our test config
monkeypatch.setattr("cli._hermes_home", tmp_path)
monkeypatch.setattr("cli_config._hermes_home", tmp_path)

from cli import load_cli_config
config = load_cli_config()
Expand All @@ -190,7 +190,7 @@ def test_cli_config_unresolved_kept_verbatim(self, tmp_path, monkeypatch):
config_file.write_text(config_yaml)

monkeypatch.delenv("UNSET_CLI_VAR_ABC", raising=False)
monkeypatch.setattr("cli._hermes_home", tmp_path)
monkeypatch.setattr("cli_config._hermes_home", tmp_path)

from cli import load_cli_config
config = load_cli_config()
Expand Down
2 changes: 1 addition & 1 deletion tests/hermes_cli/test_ignore_user_config_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _write_user_config(self, tmp_path, model_default):
def _reload_cli(self, monkeypatch, tmp_path):
"""Point cli._hermes_home at tmp_path and return a fresh load_cli_config."""
import cli
monkeypatch.setattr(cli, "_hermes_home", tmp_path)
monkeypatch.setattr("cli_config._hermes_home", tmp_path)
return cli.load_cli_config

def test_user_config_loaded_when_flag_unset(self, tmp_path, monkeypatch):
Expand Down
8 changes: 4 additions & 4 deletions tests/hermes_cli/test_managed_scope_cli_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ def homes(tmp_path, monkeypatch):
def _load_cli_config(home):
"""Call cli.py's standalone loader fresh.

cli.py binds ``_hermes_home = get_hermes_home()`` at import time (module
cli_config.py binds ``_hermes_home = get_hermes_home()`` at import time (module
singleton), so monkeypatching HERMES_HOME after import doesn't move it.
Point the module's cached home at the test's home for the duration of the
call. (In real use cli is imported once per process with the real home, so
this only matters for tests that swap HERMES_HOME.)
"""
import cli
import cli_config

cli._hermes_home = home
return cli.load_cli_config()
cli_config._hermes_home = home
return cli_config.load_cli_config()


def test_cli_config_honors_managed_skin(homes):
Expand Down
2 changes: 1 addition & 1 deletion tests/hermes_cli/test_reasoning_full_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _seed_config(tmp_path, monkeypatch):
# cli captures _hermes_home at import; force it to the temp home.
import cli

monkeypatch.setattr(cli, "_hermes_home", hh, raising=False)
monkeypatch.setattr("cli_config._hermes_home", hh)
return hh


Expand Down
2 changes: 1 addition & 1 deletion tests/hermes_cli/test_timestamps_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def _seed(tmp_path, monkeypatch, value=False):
monkeypatch.setenv("HERMES_HOME", str(hh))
import cli

monkeypatch.setattr(cli, "_hermes_home", hh, raising=False)
monkeypatch.setattr("cli_config._hermes_home", hh)
return hh


Expand Down