The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(website): plugin pages render the README from the pinned commit by default
teknium12463550c9728
diff --git a/hermes_cli/plugin_catalog.py b/hermes_cli/plugin_catalog.pyindex d4ee875ab2d..0000471ed4b 100644--- a/hermes_cli/plugin_catalog.py+++ b/hermes_cli/plugin_catalog.py@@ -159,7 +159,7 @@ def entry_from_mapping(data: Any, label: str) -> Optional[PluginCatalogEntry]:maintainer=str(data.get("maintainer") or "").strip(), tier=tier, category=category,requires_hermes=str(data.get("requires_hermes") or "").strip(),subdir=str(data.get("subdir") or "").strip(), docs_url=str(data.get("docs_url") or "").strip(),- version=version, image=image, screenshots=screenshots, readme=data.get("readme") is True,+ version=version, image=image, screenshots=screenshots, readme=data.get("readme") is not False,platforms=_str_list(data.get("platforms")),capabilities=CatalogCapabilities(provides_tools=_str_list(caps.get("provides_tools")), provides_hooks=_str_list(caps.get("provides_hooks")),diff --git a/plugin-catalog/README.md b/plugin-catalog/README.mdindex fd850de6409..1165c348bd0 100644--- a/plugin-catalog/README.md+++ b/plugin-catalog/README.md@@ -73,7 +73,7 @@ version: "1.4.0" # optional human label for the sha (quote it); shownimage: "" # optional https image on a GitHub host, 2:1 (e.g. 1200x600), e.g.# https://raw.githubusercontent.com/owner/repo/<sha>/docs/banner.pngscreenshots: [] # optional, up to 6 https images on a GitHub host; gallery on /docs/plugins/<name>-readme: false # optional; true renders the README FROM THE PINNED SHA on /docs/plugins/<name>+readme: true # optional, default true; the README at the PINNED SHA renders on /docs/plugins/<name>platforms: [] # optional, e.g. [linux, macos]; empty = allcapabilities:provides_tools: []@@ -93,8 +93,8 @@ code.Every entry gets a page at `https://hermes-agent.nousresearch.com/docs/plugins/<name>`and every maintainer a page at `/docs/plugins/by/<maintainer>`, both generatedfrom these files at docs build time. `screenshots:` fills the page's gallery;-`readme: true` makes the build fetch `README.md` (from `subdir` if set, else the-repo root) **at the pinned sha** — GitHub and GitLab repos — and render it+the build fetches the README (from `subdir` if set, else the repo root) **at the+pinned sha** — GitHub and GitLab repos, on by default, `readme: false` opts out — and renders itthrough an allowlist (raw HTML dropped, links and images resolved against thepinned tree). The page therefore shows the README the reviewer read, and itchanges only when a reviewed re-pin lands.diff --git a/scripts/validate_plugin_catalog.py b/scripts/validate_plugin_catalog.pyindex a4fa0233af8..cd537e9cc0e 100644--- a/scripts/validate_plugin_catalog.py+++ b/scripts/validate_plugin_catalog.py@@ -102,7 +102,7 @@ def _repo_host(repo: object) -> str:def _check_page_fields(data: dict, errors: list[str]) -> None:- """``screenshots`` and ``readme`` feed the entry's page at /docs/plugins/<name>; both optional."""+ """``screenshots`` and ``readme`` feed the entry's page at /docs/plugins/<name>; both optional (README on by default)."""shots = data.get("screenshots")if shots is not None:if not isinstance(shots, list) or not all(isinstance(s, str) and _is_allowed_image_url(s) for s in shots):@@ -116,7 +116,7 @@ def _check_page_fields(data: dict, errors: list[str]) -> None:if not isinstance(readme, bool):errors.append(f"readme must be true or false, got {readme!r}")elif readme and _repo_host(data.get("repo")) not in README_REPO_HOSTS:- errors.append(f"readme: true needs a repo on {list(README_REPO_HOSTS)} (the site fetches it from the pinned commit)")+ errors.append(f"readme: true needs a repo on {list(README_REPO_HOSTS)} (the site fetches it from the pinned commit); omit it for other forges")def _check_requires_hermes(spec: object, errors: list[str]) -> None:diff --git a/tests/hermes_cli/test_plugin_catalog.py b/tests/hermes_cli/test_plugin_catalog.pyindex 38a7bc15cdb..6a8f4587aa3 100644--- a/tests/hermes_cli/test_plugin_catalog.py+++ b/tests/hermes_cli/test_plugin_catalog.py@@ -55,13 +55,15 @@ def test_version_and_image_are_cosmetic_and_offhost_images_are_dropped(tmp_path)assert entries["labelled"].to_dict()["version"] == "1.4.0"-def test_screenshots_and_readme_are_parsed_and_default_off(tmp_path):+def test_screenshots_and_readme_are_parsed_and_readme_defaults_on(tmp_path):shot = "https://raw.githubusercontent.com/owner/repo/38fe0fb53eff98d477f807432e965429e665ca33/docs/1.png"(tmp_path / "a.yaml").write_text(yaml.safe_dump(_entry("paged", screenshots=[shot, "https://evil.example/x.png"], readme=True)))- (tmp_path / "b.yaml").write_text(yaml.safe_dump(_entry("plain", readme="yes")))+ (tmp_path / "b.yaml").write_text(yaml.safe_dump(_entry("plain", readme=False)))+ (tmp_path / "c.yaml").write_text(yaml.safe_dump(_entry("bare")))entries = {e.name: e for e in pc.load_catalog(tmp_path)}assert entries["paged"].screenshots == [shot] and entries["paged"].readme is Trueassert entries["plain"].screenshots == [] and entries["plain"].readme is False+ assert entries["bare"].readme is Trueassert entries["paged"].to_dict()["screenshots"] == [shot] and entries["paged"].to_dict()["readme"] is Truediff --git a/tests/website/test_extract_plugins.py b/tests/website/test_extract_plugins.pyindex 8dd0a32a02e..f31584591d9 100644--- a/tests/website/test_extract_plugins.py+++ b/tests/website/test_extract_plugins.py@@ -146,8 +146,8 @@ def test_version_and_image_are_emitted_and_offhost_image_is_dropped_not_fatal(modef test_page_fields_screenshots_readme_url_and_maintainer_slug(mod, tmp_path):"""Detail-page inputs: screenshots follow the image host rule (off-host dropped, never fatal), readme- resolves to the raw README at the PINNED sha (GitHub and GitLab, subdir-aware) and is off for other- forges, and the maintainer slug is what /docs/plugins/by/<slug> is generated from."""+ resolves to the raw README at the PINNED sha (GitHub and GitLab, subdir-aware) BY DEFAULT, is off for+ other forges or `readme: false`, and the maintainer slug is what /docs/plugins/by/<slug> is generated from."""catalog = tmp_path / "plugin-catalog"catalog.mkdir()shot = "https://raw.githubusercontent.com/owner/repo/38fe0fb53eff98d477f807432e965429e665ca33/docs/1.png"@@ -156,6 +156,7 @@ def test_page_fields_screenshots_readme_url_and_maintainer_slug(mod, tmp_path):_write_entry(catalog, "gl", repo="https://gitlab.com/group/proj", readme=True)_write_entry(catalog, "other", repo="https://codeberg.org/o/r", readme=True)_write_entry(catalog, "plain")+ _write_entry(catalog, "optout", readme=False)entries = {e["name"]: e for e in mod.load_catalog_entries(catalog)}assert entries["gh"]["screenshots"] == [shot]@@ -165,7 +166,9 @@ def test_page_fields_screenshots_readme_url_and_maintainer_slug(mod, tmp_path):assert entries["gh"]["maintainerSlug"] == "nous-research"assert entries["gl"]["readmeUrl"] == "https://gitlab.com/group/proj/-/raw/38fe0fb53eff98d477f807432e965429e665ca33/README.md"assert entries["other"]["readme"] is False and entries["other"]["readmeUrl"] == ""- assert entries["plain"]["readme"] is False and entries["plain"]["screenshots"] == [] and entries["plain"]["maintainerSlug"] == "example"+ assert entries["plain"]["readme"] is True and entries["plain"]["readmeUrl"].endswith("/README.md")+ assert entries["plain"]["screenshots"] == [] and entries["plain"]["maintainerSlug"] == "example"+ assert entries["optout"]["readme"] is False and entries["optout"]["readmeUrl"] == ""# --------------------------------------------------------------------------diff --git a/website/docs/user-guide/features/plugin-catalog.md b/website/docs/user-guide/features/plugin-catalog.mdindex 353c3619541..bbef86dd1a3 100644--- a/website/docs/user-guide/features/plugin-catalog.md+++ b/website/docs/user-guide/features/plugin-catalog.md@@ -53,7 +53,7 @@ directory of the hermes-agent repository, declaring:| `version` | Human-readable label for the pinned sha, e.g. `"1.4.0"`; shown as `1.4.0 @ abcd1234` in the CLI, on the catalog card and on the Desktop **Update to** button (optional, cosmetic) || `image` | Banner image for the catalog card and the plugin page hero, shown at 2:1 (1200×600 works; other shapes are centre-cropped); an `https` URL on `raw.githubusercontent.com`, `github.com` or `*.githubusercontent.com` (optional). Pin it to the entry's commit (`raw.githubusercontent.com/owner/repo/<sha>/...`) so it never changes under the review || `screenshots` | Up to 6 images shown as a gallery on the plugin page, same host rule as `image` (optional). Pin them to the entry's commit too |-| `readme` | `true` renders the repository README (the entry's `subdir` first, else the repo root) on the plugin page. It is fetched **from the pinned commit** at docs build time — never from a branch — so the page shows the README the reviewer read and changes only when the pin does. GitHub and GitLab repos (optional, default `false`) |+| `readme` | The plugin page renders the repository README (the entry's `subdir` first, else the repo root) by default. It is fetched **from the pinned commit** at docs build time — never from a branch — so the page shows the README the reviewer read and changes only when the pin does. Set `false` to hide it. GitHub and GitLab repos (optional, default `true`) |## Trust model@@ -190,7 +190,7 @@ Pin updates (bumping `sha` to a newer commit) follow the same PR + reviewprocess; bump `version` in the same PR so the label users see matches thecode, and re-pin any `image` / `screenshots` URLs that embed the sha. Yourplugin page (`/docs/plugins/<name>`) is built from the same file: add-`screenshots:` and `readme: true` there to fill it out — there is no separate+`screenshots:` there to fill it out (the README renders by default) — there is no separatelisting to maintain. Installed plugins compare their recorded sha against the live pin:`hermes plugins list --json` reports `update_available`, the Desktop Pluginstab shows an **Update to 1.4.0** button, and `hermes plugins update <name>`diff --git a/website/plugins/plugin-catalog-pages/index.js b/website/plugins/plugin-catalog-pages/index.jsindex 6712aeed3b4..11f2c41829a 100644--- a/website/plugins/plugin-catalog-pages/index.js+++ b/website/plugins/plugin-catalog-pages/index.js@@ -5,8 +5,8 @@//// Both are generated at build time from the same plugins.json the catalog grid fetches, so// there is no second data source: a merged catalog PR is the only way a page appears,-// changes or disappears. Entries that opt in with `readme: true` get their README fetched-// from the pinned commit and rendered through the allowlist in ./readme.js.+// changes or disappears. Every entry's README is fetched from the pinned commit and rendered+// through the allowlist in ./readme.js unless the entry sets `readme: false`.//// The site degrades, never fails: a missing plugins.json (extract-plugins.py did not run)// generates zero pages with a warning, and a README that cannot be fetched leaves that@@ -18,7 +18,7 @@ const { fetchReadme, renderReadme } = require("./readme.js");const PLUGINS_JSON = path.join("static", "api", "plugins.json");const META_JSON = path.join("static", "api", "plugins-meta.json");-const README_CONCURRENCY = 6;+const README_CONCURRENCY = 12;function log(msg) {console.warn(`[plugin-catalog-pages] ${msg}`);@@ -88,7 +88,7 @@ module.exports = function pluginCatalogPages(context) {});const readmes = Object.fromEntries(wantReadme.map((entry, i) => [entry.name, rendered[i]]));if (wantReadme.length) {- log(`rendered ${rendered.filter(Boolean).length}/${wantReadme.length} opted-in READMEs from pinned commits`);+ log(`rendered ${rendered.filter(Boolean).length}/${wantReadme.length} READMEs from pinned commits`);}return { entries, meta, readmes };},diff --git a/website/plugins/plugin-catalog-pages/readme.js b/website/plugins/plugin-catalog-pages/readme.jsindex b9aaa8c6eb4..06f5a2f3290 100644--- a/website/plugins/plugin-catalog-pages/readme.js+++ b/website/plugins/plugin-catalog-pages/readme.js@@ -1,6 +1,6 @@// README rendering for the per-plugin pages (/docs/plugins/<name>).//-// An entry that opts in with `readme: true` gets its README rendered on its page. The+// Every entry gets its README rendered on its page (opt out with `readme: false`). The// build fetches it from the PINNED commit (extract-plugins.py emits `readmeUrl` as a// raw.githubusercontent.com / gitlab.com raw URL at <sha>) — never a branch tip — so the// page shows exactly the README the catalog reviewer read, and it only changes when the@@ -148,9 +148,11 @@ async function renderReadme(markdown, readmeUrl) {/** README.md candidates at the pinned commit: the entry's subdir first, then the repo root* (a monorepo plugin often documents itself in the root README), each in both casings. */function readmeCandidates(readmeUrl) {+ // subdir README first, then the repo root; common casings and a docs/ README as fallbacks.const root = readmeUrl.replace(/(\/[0-9a-f]{40}\/).+$/, "$1README.md");const paths = root === readmeUrl ? [readmeUrl] : [readmeUrl, root];- return paths.flatMap((p) => [p, p.replace(/README\.md$/, "readme.md")]);+ const names = ["README.md", "readme.md", "Readme.md", "README.MD", "README", "docs/README.md"];+ return paths.flatMap((p) => names.map((n) => p.replace(/README\.md$/, n)));}/** Resolve the README at the pinned commit → `{ markdown, url }` (url = the file that answered), or null. */diff --git a/website/scripts/extract-plugins.py b/website/scripts/extract-plugins.pyindex 6d8c88dc7a1..aa60ca97c02 100644--- a/website/scripts/extract-plugins.py+++ b/website/scripts/extract-plugins.py@@ -260,8 +260,9 @@ def load_catalog_entries(catalog_dir: Path, stars: dict[str, int] | None = None,"version": _cosmetic(raw.get("version"), VERSION_RE.match, path.name, name, "version"),"image": _cosmetic(raw.get("image"), _is_allowed_image_url, path.name, name, "image"),"screenshots": _screenshots(raw.get("screenshots"), path.name, name),- "readme": raw.get("readme") is True and bool(readme_url(repo, sha, subdir)),- "readmeUrl": readme_url(repo, sha, subdir) if raw.get("readme") is True else "",+ # README renders by default from the pinned commit; `readme: false` opts an entry out.+ "readme": raw.get("readme") is not False and bool(readme_url(repo, sha, subdir)),+ "readmeUrl": readme_url(repo, sha, subdir) if raw.get("readme") is not False else "","maintainerSlug": maintainer_slug(str(raw.get("maintainer") or "")),"installCommand": f"hermes plugins install {name}","stars": _repo_stars(repo, stars),