fix(config): remove obsolete cwd warning parameter

This commit is contained in:
fangliquanflq
2026-08-16 07:54:37 +08:00
committed by Teknium
parent 2cc83543bb
commit cfc55d3487
2 changed files with 12 additions and 7 deletions

View File

@@ -2223,7 +2223,7 @@ def print_config_warnings(config: Optional[Dict[str, Any]] = None) -> None:
sys.stderr.write("\n".join(lines) + "\n\n")
def warn_deprecated_cwd_env_vars(config: Optional[Dict[str, Any]] = None) -> None:
def warn_deprecated_cwd_env_vars() -> None:
"""Warn if MESSAGING_CWD or TERMINAL_CWD is set in .env instead of config.yaml.
These env vars are deprecated — the canonical setting is terminal.cwd

View File

@@ -21,7 +21,7 @@ class TestDeprecatedCwdWarning:
from hermes_cli.config import warn_deprecated_cwd_env_vars
warn_deprecated_cwd_env_vars(config={})
warn_deprecated_cwd_env_vars()
assert capsys.readouterr().err == ""
@@ -38,7 +38,7 @@ class TestDeprecatedCwdWarning:
from hermes_cli.config import warn_deprecated_cwd_env_vars
warn_deprecated_cwd_env_vars(config={})
warn_deprecated_cwd_env_vars()
captured = capsys.readouterr()
assert "MESSAGING_CWD" in captured.err
@@ -49,11 +49,16 @@ class TestDeprecatedCwdWarning:
def test_dotenv_terminal_cwd_warns_with_explicit_config(
self, monkeypatch, tmp_path, capsys
):
_write_env(monkeypatch, tmp_path, "TERMINAL_CWD=/legacy/path\n")
hermes_home = _write_env(
monkeypatch, tmp_path, "TERMINAL_CWD=/legacy/path\n"
)
(hermes_home / "config.yaml").write_text(
"terminal:\n cwd: /current/path\n", encoding="utf-8"
)
from hermes_cli.config import warn_deprecated_cwd_env_vars
warn_deprecated_cwd_env_vars(config={"terminal": {"cwd": "/current/path"}})
warn_deprecated_cwd_env_vars()
assert "TERMINAL_CWD=/legacy/path" in capsys.readouterr().err
@@ -69,7 +74,7 @@ class TestDeprecatedCwdWarning:
from hermes_cli.config import warn_deprecated_cwd_env_vars
warn_deprecated_cwd_env_vars(config={})
warn_deprecated_cwd_env_vars()
assert capsys.readouterr().err == ""
@@ -81,6 +86,6 @@ class TestDeprecatedCwdWarning:
monkeypatch.setattr(config_module, "load_env", raise_read_error)
config_module.warn_deprecated_cwd_env_vars(config={})
config_module.warn_deprecated_cwd_env_vars()
assert capsys.readouterr().err == ""