Skip to content

The agent that grows with you

fix(config): an enabled project plugin's config_keys are recognized too

Teknium6df187b4f8fd
diff --git a/hermes_cli/config_runtime_keys.py b/hermes_cli/config_runtime_keys.py
index 23e52aa8cea..4581d0b24d0 100644
--- a/hermes_cli/config_runtime_keys.py
+++ b/hermes_cli/config_runtime_keys.py
@@ -53,11 +53,15 @@ def _declared_keys_under(roots: tuple[str, ...]) -> frozenset[str]:
def plugin_declared_config_keys() -> frozenset[str]:
- """``config_keys`` declared by bundled and the active profile's user-installed plugins."""
- from hermes_cli.plugins import get_bundled_plugins_dir
+ """``config_keys`` declared by bundled, the active profile's user-installed and (opt-in) project plugins."""
+ from hermes_cli import plugins as _plugins
from hermes_constants import get_hermes_home
- return _declared_keys_under((str(get_bundled_plugins_dir()), str(get_hermes_home() / "plugins")))
+ roots = [str(_plugins.get_bundled_plugins_dir()), str(get_hermes_home() / "plugins")]
+ # Same opt-in gate and directory as plugins_discovery.collect_directory_manifests.
+ if _plugins._env_enabled("HERMES_ENABLE_PROJECT_PLUGINS"):
+ roots.append(str(Path.cwd() / ".hermes" / "plugins"))
+ return _declared_keys_under(tuple(roots))
def is_runtime_read_key(key: str) -> bool:
diff --git a/tests/hermes_cli/test_config_runtime_keys.py b/tests/hermes_cli/test_config_runtime_keys.py
index 8565974da23..7b94430a61d 100644
--- a/tests/hermes_cli/test_config_runtime_keys.py
+++ b/tests/hermes_cli/test_config_runtime_keys.py
@@ -67,3 +67,16 @@ def test_user_plugin_declares_its_config_keys_in_plugin_yaml(hermes_home, capsys
assert NOTICE in capsys.readouterr().out
set_config_value("browser.cloud_providr", "browserbase")
assert NOTICE in capsys.readouterr().out
+
+
+def test_enabled_project_plugin_declares_its_config_keys(hermes_home, tmp_path, monkeypatch, capsys):
+ plugin = tmp_path / "proj" / ".hermes" / "plugins" / "widget-plugin"
+ plugin.mkdir(parents=True)
+ (plugin / "plugin.yaml").write_text(json.dumps({"name": "widget-plugin", "config_keys": ["display.widget"]}))
+ monkeypatch.chdir(tmp_path / "proj")
+
+ set_config_value("display.widget.size", "3")
+ assert NOTICE in capsys.readouterr().out # project plugins are opt-in
+ monkeypatch.setenv("HERMES_ENABLE_PROJECT_PLUGINS", "1")
+ set_config_value("display.widget.size", "4")
+ assert NOTICE not in capsys.readouterr().out