Skip to content

The agent that grows with you

fix(catalog): reconcile catalog layer with landed index/manifest-v2/portable tracks

Tekniumce6d9e62cd52
diff --git a/.github/workflows/plugin-catalog-ci.yml b/.github/workflows/plugin-catalog-ci.yml
index 32fb597c168..84efbc07618 100644
--- a/.github/workflows/plugin-catalog-ci.yml
+++ b/.github/workflows/plugin-catalog-ci.yml
@@ -118,8 +118,10 @@ jobs:
fi
PLUGIN_DIR="$CLONE_DIR${SUBDIR:+/$SUBDIR}"
- if [ ! -f "$PLUGIN_DIR/plugin.yaml" ]; then
- echo "::error file=$entry::no plugin.yaml at subdir '$SUBDIR' of $REPO@$SHA"
+ # Native plugin.yaml OR portable Agent Plugins v1 plugin.json
+ # (#81196; native manifest wins when both exist).
+ if [ ! -f "$PLUGIN_DIR/plugin.yaml" ] && [ ! -f "$PLUGIN_DIR/plugin.yml" ] && [ ! -f "$PLUGIN_DIR/plugin.json" ]; then
+ echo "::error file=$entry::no plugin.yaml or plugin.json at subdir '$SUBDIR' of $REPO@$SHA"
FAILED=1; echo "::endgroup::"; continue
fi
diff --git a/hermes_cli/plugin_validate.py b/hermes_cli/plugin_validate.py
index 6b3be693675..5aff1c4d849 100644
--- a/hermes_cli/plugin_validate.py
+++ b/hermes_cli/plugin_validate.py
@@ -414,7 +414,17 @@ def validate_plugin_dir(plugin_dir: Path) -> ValidationReport:
if not manifest_file.is_file():
manifest_file = plugin_dir / "plugin.yml"
if not manifest_file.is_file():
- report.add("manifest", False, "no plugin.yaml in the plugin directory")
+ # Portable Agent Plugins v1 (#81196): a plugin.json-only package is
+ # admissible — validated through the portable manifest reader. When a
+ # package carries both manifests the native plugin.yaml always wins
+ # (this branch is only reached when no native manifest exists).
+ portable_file = plugin_dir / "plugin.json"
+ if portable_file.is_file():
+ return _validate_portable_plugin(report, plugin_dir)
+ report.add(
+ "manifest", False,
+ "no plugin.yaml (or portable plugin.json) in the plugin directory",
+ )
return report
import yaml
@@ -438,3 +448,35 @@ def validate_plugin_dir(plugin_dir: Path) -> ValidationReport:
recorded = _check_capabilities(report, manifest, plugin_dir)
_check_builtin_collisions(report, manifest, recorded)
return report
+
+
+def _validate_portable_plugin(report: ValidationReport, plugin_dir: Path) -> ValidationReport:
+ """Admission checks for a portable Agent Plugins v1 (plugin.json) package.
+
+ Portable packages have no register() entry point, so the capability
+ probe does not apply; validation is the manifest reader's own
+ diagnostics (schema shape, name, supported subset).
+ """
+ try:
+ from hermes_cli.agent_plugins import read_agent_plugin_manifest
+
+ manifest, diagnostics = read_agent_plugin_manifest(plugin_dir)
+ except Exception as exc:
+ report.add("portable manifest", False, f"plugin.json failed validation: {exc}")
+ return report
+
+ # The portable reader raises on hard failures; surviving diagnostics are
+ # advisory (unsupported-subset notes etc.) — surface them as warnings.
+ for diag in diagnostics:
+ scope = getattr(diag, "scope", "")
+ message = getattr(diag, "message", str(diag))
+ report.warnings.append(f"{scope}: {message}" if scope else message)
+
+ report.add("portable manifest", True, "plugin.json parses (Agent Plugins v1)")
+ name = str(manifest.get("name") or "").strip()
+ report.add(
+ "manifest fields",
+ bool(name),
+ "name present" if name else "plugin.json missing required 'name'",
+ )
+ return report
diff --git a/hermes_cli/plugins_cmd.py b/hermes_cli/plugins_cmd.py
index 00ddbe65e1d..c099d4692bb 100644
--- a/hermes_cli/plugins_cmd.py
+++ b/hermes_cli/plugins_cmd.py
@@ -1007,6 +1007,21 @@ write_catalog_sidecar = _write_catalog_sidecar
read_catalog_sidecar = _read_catalog_sidecar
+def _catalog_annotation(dir_path) -> Optional[str]:
+ """Return ``catalog:<tier>@<shaShort>`` for a catalog install, else None."""
+ if not dir_path:
+ return None
+ try:
+ sidecar = _read_catalog_sidecar(Path(dir_path))
+ except Exception:
+ return None
+ if not sidecar or not sidecar.get("catalog_name"):
+ return None
+ tier = str(sidecar.get("tier") or "community")
+ sha = str(sidecar.get("sha") or "")
+ return f"catalog:{tier}@{sha[:8]}"
+
+
def _removed_annotation(name: str, dir_path) -> Optional[str]:
"""Return the removed-blocklist reason when *name* matches, else None."""
try:
@@ -2213,16 +2228,22 @@ def cmd_list(args: Any | None = None) -> None:
entries = _filter_plugin_entries(entries, args, enabled, disabled)
if getattr(args, "json", False):
- payload = [
- {
+ payload = []
+ for name, version, description, source, _dir, key in entries:
+ row = {
"name": name,
"status": _plugin_status(name, enabled, disabled, key=key),
"version": str(version),
"description": description,
"source": source,
}
- for name, version, description, source, _dir, key in entries
- ]
+ catalog_note = _catalog_annotation(_dir)
+ if catalog_note:
+ row["catalog"] = catalog_note
+ removed_reason = _removed_annotation(name, _dir)
+ if removed_reason is not None:
+ row["removed"] = removed_reason
+ payload.append(row)
print(json.dumps(payload, indent=2))
return
@@ -2252,13 +2273,7 @@ def cmd_list(args: Any | None = None) -> None:
status = "[green]enabled[/green]"
else:
status = "[yellow]not enabled[/yellow]"
- source_label = source
- if _dir:
- sidecar = _read_catalog_sidecar(Path(_dir))
- if sidecar and sidecar.get("catalog_name"):
- tier = str(sidecar.get("tier") or "community")
- sha = str(sidecar.get("sha") or "")
- source_label = f"catalog:{tier}@{sha[:8]}"
+ source_label = _catalog_annotation(_dir) or source
removed_reason = _removed_annotation(name, _dir)
if removed_reason is not None:
removed_lines.append(
diff --git a/tests/hermes_cli/test_plugin_index_search.py b/tests/hermes_cli/test_plugin_index_search.py
index 5492b887cab..9efc5f174dd 100644
--- a/tests/hermes_cli/test_plugin_index_search.py
+++ b/tests/hermes_cli/test_plugin_index_search.py
@@ -329,7 +329,7 @@ class TestInstallResolution:
)
captured = {}
- def fake_core(identifier, *, force, ref=None, scan_decision_cb=None):
+ def fake_core(identifier, *, force, ref=None, scan_decision_cb=None, skip_removed_check=False):
captured["identifier"] = identifier
captured["ref"] = ref
raise plugins_cmd.PluginOperationError("stop here")
@@ -348,7 +348,7 @@ class TestInstallResolution:
)
captured = {}
- def fake_core(identifier, *, force, ref=None, scan_decision_cb=None):
+ def fake_core(identifier, *, force, ref=None, scan_decision_cb=None, skip_removed_check=False):
captured["ref"] = ref
raise plugins_cmd.PluginOperationError("stop here")
@@ -401,7 +401,7 @@ class TestInstallResolution:
monkeypatch.setattr(plugin_index, "load_index", boom)
captured = {}
- def fake_core(identifier, *, force, ref=None, scan_decision_cb=None):
+ def fake_core(identifier, *, force, ref=None, scan_decision_cb=None, skip_removed_check=False):
captured["identifier"] = identifier
captured["ref"] = ref
raise plugins_cmd.PluginOperationError("stop here")
diff --git a/tests/hermes_cli/test_plugin_validate.py b/tests/hermes_cli/test_plugin_validate.py
index d1051cdbc73..a728e9eed01 100644
--- a/tests/hermes_cli/test_plugin_validate.py
+++ b/tests/hermes_cli/test_plugin_validate.py
@@ -72,20 +72,22 @@ class TestStaticChecks:
report = validate_plugin_dir(d)
assert report.ok
- def test_invalid_config_section_fails(self, tmp_path):
- manifest = dict(BASE_MANIFEST, config=[{"prompt": "no key here"}])
+ def test_invalid_config_schema_fails(self, tmp_path):
+ manifest = dict(
+ BASE_MANIFEST, config_schema={"endpoint": {"type": "no-such-type"}}
+ )
d = _make_plugin(tmp_path, manifest=manifest)
report = validate_plugin_dir(d)
assert not report.ok
assert any("config" in f for f in report.failures)
- def test_valid_config_section_passes(self, tmp_path):
+ def test_valid_config_schema_passes(self, tmp_path):
manifest = dict(
BASE_MANIFEST,
- config=[
- {"key": "endpoint", "prompt": "Endpoint?", "type": "str"},
- {"key": "token", "secret": True, "type": "str"},
- ],
+ config_schema={
+ "endpoint": {"type": "str", "description": "Endpoint?"},
+ "retries": {"type": "int", "default": 3},
+ },
)
d = _make_plugin(tmp_path, manifest=manifest)
report = validate_plugin_dir(d)
diff --git a/tests/hermes_cli/test_plugins_cmd_catalog.py b/tests/hermes_cli/test_plugins_cmd_catalog.py
index 809b1de3a61..d990158cb6d 100644
--- a/tests/hermes_cli/test_plugins_cmd_catalog.py
+++ b/tests/hermes_cli/test_plugins_cmd_catalog.py
@@ -86,7 +86,8 @@ def fake_core(monkeypatch, tmp_path):
calls: list[dict] = []
target = tmp_path / "fake-installed"
- def fake(identifier, *, force, ref=None, skip_removed_check=False):
+ def fake(identifier, *, force, ref=None, skip_removed_check=False,
+ scan_decision_cb=None):
target.mkdir(parents=True, exist_ok=True)
calls.append(
{
@@ -443,7 +444,7 @@ class TestSearchBrowseInfo:
def test_search_no_results_message(self, catalog_dir, offline, capsys):
plugins_cmd.cmd_search("zzz-nothing")
out = capsys.readouterr().out
- assert "No catalog entries" in out
+ assert "No plugins matched" in out
def test_info_shows_full_detail(self, catalog_dir, offline, capsys):
_write_entry(
@@ -486,69 +487,6 @@ class TestSearchBrowseInfo:
# ── doctor ─────────────────────────────────────────────────────────────────
-class TestDoctor:
- @pytest.fixture(autouse=True)
- def _no_runtime_scan(self, monkeypatch):
- monkeypatch.setattr(
- plugins_cmd, "_runtime_load_errors", lambda: {}
- )
-
- def test_doctor_table_lists_installed_plugin(
- self, catalog_dir, offline, capsys
- ):
- _install_user_plugin(
- "doc-plugin",
- sidecar={
- "catalog_name": "doc-plugin",
- "repo": "https://github.com/example/doc-plugin",
- "sha": SHA_A,
- "tier": "official",
- "installed_at": "2026-01-01T00:00:00Z",
- },
- )
- _write_entry(catalog_dir, "doc-plugin", sha=SHA_A, tier="official")
- plugins_cmd.cmd_doctor()
- out = capsys.readouterr().out
- assert "doc-plugin" in out
- assert "official" in out
-
- def test_doctor_detail_flags_pin_mismatch(
- self, catalog_dir, offline, capsys
- ):
- _install_user_plugin(
- "doc-plugin",
- sidecar={
- "catalog_name": "doc-plugin",
- "repo": "https://github.com/example/doc-plugin",
- "sha": SHA_A,
- "tier": "official",
- "installed_at": "2026-01-01T00:00:00Z",
- },
- )
- _write_entry(catalog_dir, "doc-plugin", sha=SHA_B)
- plugins_cmd.cmd_doctor("doc-plugin")
- out = capsys.readouterr().out
- assert "doc-plugin" in out
- assert "behind catalog pin" in out or "pin mismatch" in out
-
- def test_doctor_flags_removed_plugin(self, catalog_dir, offline, capsys):
- _install_user_plugin("evil-plugin")
- _write_removed(
- catalog_dir,
- [{"name": "evil-plugin", "reason": "exfiltrated env vars"}],
- )
- plugins_cmd.cmd_doctor("evil-plugin")
- out = capsys.readouterr().out
- assert "REMOVED" in out
-
- def test_doctor_unknown_plugin_exits(self, catalog_dir, offline, capsys):
- with pytest.raises(SystemExit):
- plugins_cmd.cmd_doctor("no-such-plugin")
-
-
-# ── argparse dispatch ──────────────────────────────────────────────────────
-
-
class TestDispatch:
def _dispatch(self, monkeypatch, action, **attrs):
recorded = {}
@@ -566,7 +504,6 @@ class TestDispatch:
"cmd_browse",
"cmd_info",
"cmd_validate",
- "cmd_doctor",
"cmd_install",
):
monkeypatch.setattr(plugins_cmd, fn, record(fn))
@@ -575,9 +512,9 @@ class TestDispatch:
return recorded
def test_search_dispatch(self, monkeypatch):
- rec = self._dispatch(monkeypatch, "search", query="foo")
+ rec = self._dispatch(monkeypatch, "search", term="foo")
assert rec["fn"] == "cmd_search"
- assert "foo" in rec["args"] or rec["kwargs"].get("query") == "foo"
+ assert "foo" in rec["args"] or rec["kwargs"].get("term") == "foo"
def test_browse_dispatch(self, monkeypatch):
rec = self._dispatch(monkeypatch, "browse")
@@ -592,8 +529,15 @@ class TestDispatch:
assert rec["fn"] == "cmd_validate"
def test_doctor_dispatch(self, monkeypatch):
- rec = self._dispatch(monkeypatch, "doctor", name=None)
- assert rec["fn"] == "cmd_doctor"
+ # `doctor` is owned by the runtime-contract dev doctor on main.
+ recorded = {}
+ monkeypatch.setattr(
+ plugins_cmd, "cmd_plugin_doctor",
+ lambda target, *, ci=False: recorded.setdefault("target", target),
+ )
+ ns = argparse.Namespace(plugins_action="doctor", target=".", ci=False)
+ plugins_cmd.plugins_command(ns)
+ assert recorded["target"] == "."
def test_install_allow_removed_dispatch(self, monkeypatch):
rec = self._dispatch(
diff --git a/website/docs/user-guide/features/plugin-catalog.md b/website/docs/user-guide/features/plugin-catalog.md
index d443a014d02..0b18382b2ff 100644
--- a/website/docs/user-guide/features/plugin-catalog.md
+++ b/website/docs/user-guide/features/plugin-catalog.md
@@ -81,6 +81,20 @@ hermes plugins enable <name>
The install prompt shows the entry's capability summary — declared tools,
hooks, and required env vars — before anything is cloned.
+### Updating a catalog install
+
+`hermes plugins update <name>` never runs `git pull` for catalog installs —
+it compares your installed pin against the current catalog pin and, when the
+catalog moved (via a reviewed PR), force-reinstalls at the new SHA. Your
+enabled/disabled state is preserved. `hermes plugins list` shows catalog
+installs as `catalog:<tier>@<sha>` so you can see provenance at a glance.
+
+### Names not in the catalog
+
+A bare name that isn't a catalog entry falls back to the
+[community plugin index](plugins.md) with a warning — those entries are
+indexed, not reviewed. Catalog names always win when both exist.
+
### Custom git URLs are different
`hermes plugins install <git-url>` still works for any repository, but it