Skip to content

The agent that grows with you

feat(website): plugin catalog shows when each entry was added/updated and can sort by it

teknium14c2c20f6e7c3
diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml
index 83e95c0b6a8..f820d685dfe 100644
--- a/.github/workflows/deploy-site.yml
+++ b/.github/workflows/deploy-site.yml
@@ -58,6 +58,8 @@ jobs:
url: ${{ steps.deploy.outputs.page_url }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ fetch-depth: 0 # extract-plugins.py derives each catalog entry's added/updated dates from git log
- name: Get GitHub App token
id: app-token
diff --git a/tests/website/test_extract_plugins.py b/tests/website/test_extract_plugins.py
index d38021b1b97..bc59e0c5215 100644
--- a/tests/website/test_extract_plugins.py
+++ b/tests/website/test_extract_plugins.py
@@ -219,3 +219,51 @@ def test_script_exits_zero_as_subprocess_when_catalog_missing(tmp_path):
assert result.returncode == 0, result.stderr
assert (out_dir / "plugins.json").exists()
assert (out_dir / "plugins-meta.json").exists()
+
+
+# --------------------------------------------------------------------------
+# addedAt / updatedAt from git history
+# --------------------------------------------------------------------------
+
+def _git(repo: Path, *args: str, date: str) -> None:
+ env = {
+ "GIT_AUTHOR_NAME": "t", "GIT_AUTHOR_EMAIL": "[email protected]", "GIT_AUTHOR_DATE": date,
+ "GIT_COMMITTER_NAME": "t", "GIT_COMMITTER_EMAIL": "[email protected]", "GIT_COMMITTER_DATE": date,
+ "HOME": str(repo), "PATH": __import__("os").environ["PATH"],
+ }
+ subprocess.run(["git", *args], cwd=repo, env=env, check=True, capture_output=True)
+
+
+def test_git_dates_added_is_first_commit_updated_is_last_and_renames_keep_added(mod, tmp_path):
+ repo = tmp_path / "repo"
+ catalog = repo / "plugin-catalog"
+ catalog.mkdir(parents=True)
+ _git(repo, "init", "-q", "-b", "main", date="2026-01-01T00:00:00+00:00")
+ _write_entry(catalog, "alpha")
+ _write_entry(catalog, "old-name")
+ _git(repo, "add", ".", date="2026-01-01T00:00:00+00:00")
+ _git(repo, "commit", "-q", "-m", "add", date="2026-01-01T00:00:00+00:00")
+ # Pin bump on alpha only.
+ _write_entry(catalog, "alpha", sha="a" * 40)
+ _git(repo, "commit", "-q", "-am", "bump alpha", date="2026-02-01T00:00:00+00:00")
+ # Rename old-name → new-name (content unchanged so git detects the rename).
+ _git(repo, "mv", "plugin-catalog/old-name.yaml", "plugin-catalog/new-name.yaml", date="2026-03-01T00:00:00+00:00")
+ _git(repo, "commit", "-q", "-m", "rename", date="2026-03-01T00:00:00+00:00")
+
+ dates = mod.load_git_dates(catalog)
+
+ assert dates["alpha.yaml"] == {"addedAt": "2026-01-01T00:00:00Z", "updatedAt": "2026-02-01T00:00:00Z"}
+ assert dates["new-name.yaml"] == {"addedAt": "2026-01-01T00:00:00Z", "updatedAt": "2026-03-01T00:00:00Z"}
+ entries = mod.load_catalog_entries(catalog, dates=dates)
+ by_name = {e["name"]: e for e in entries}
+ assert by_name["alpha"]["addedAt"] == "2026-01-01T00:00:00Z"
+ assert by_name["alpha"]["updatedAt"] == "2026-02-01T00:00:00Z"
+
+
+def test_git_dates_are_null_outside_a_repository(mod, tmp_path):
+ catalog = tmp_path / "plugin-catalog"
+ catalog.mkdir()
+ _write_entry(catalog, "alpha")
+ assert mod.load_git_dates(catalog) == {}
+ entries = mod.load_catalog_entries(catalog)
+ assert entries[0]["addedAt"] is None and entries[0]["updatedAt"] is None
diff --git a/website/scripts/extract-plugins.py b/website/scripts/extract-plugins.py
index 957de98a06e..aa1337d7802 100644
--- a/website/scripts/extract-plugins.py
+++ b/website/scripts/extract-plugins.py
@@ -28,6 +28,7 @@ from __future__ import annotations
import argparse
import json
import re
+import subprocess
import sys
from collections import Counter
from datetime import datetime, timezone
@@ -104,14 +105,76 @@ def _repo_stars(repo: str, stars: dict[str, int]) -> int | None:
return stars.get(f"{m.group(1)}/{m.group(2)}") if m else None
-def load_catalog_entries(catalog_dir: Path, stars: dict[str, int] | None = None) -> list[dict]:
+def load_git_dates(catalog_dir: Path) -> dict[str, dict[str, str]]:
+ """``{"<file>.yaml": {"addedAt": iso, "updatedAt": iso}}`` from the catalog's git history.
+
+ One ``git log`` over the directory, newest first: the first commit seen touching a file is
+ its last update, the last one is when it entered the catalog. Renames (``R``) carry the
+ old path's history onto the new name so a renamed entry keeps its original addedAt.
+ Committer dates, not author dates: rebase-merged PRs are stamped when they LAND on main,
+ which is when the entry actually became installable.
+
+ Empty when git is unavailable or the checkout is shallow — a depth-1 clone would report
+ every entry as added in the tip commit, which is worse than no dates (deploy-site.yml
+ checks out with ``fetch-depth: 0`` for this reason).
+ """
+ if not catalog_dir.is_dir():
+ return {}
+ try:
+ shallow = subprocess.run(
+ ["git", "rev-parse", "--is-shallow-repository"],
+ cwd=catalog_dir, capture_output=True, text=True, check=True, timeout=30,
+ ).stdout.strip()
+ if shallow == "true":
+ _log("shallow checkout: skipping addedAt/updatedAt (need fetch-depth: 0)")
+ return {}
+ log = subprocess.run(
+ ["git", "log", "--format=%x00%cI", "--name-status", "--relative", "-M", "--", "."],
+ cwd=catalog_dir, capture_output=True, text=True, check=True, timeout=120,
+ ).stdout
+ except (OSError, subprocess.SubprocessError) as e:
+ _log(f"git history unavailable, skipping addedAt/updatedAt ({e})")
+ return {}
+
+ dates: dict[str, dict[str, str]] = {}
+ alias: dict[str, str] = {} # old file name → current name, for renamed entries
+
+ def touch(name: str, when: str) -> None:
+ if "/" in name or not name.endswith(".yaml"):
+ return
+ while name in alias:
+ name = alias[name]
+ rec = dates.setdefault(name, {"addedAt": when, "updatedAt": when})
+ rec["addedAt"] = when # newest-first walk: the last write wins = oldest commit
+
+ when = ""
+ for line in log.splitlines():
+ if line.startswith("\x00"):
+ when = line[1:].strip()
+ continue
+ parts = line.split("\t")
+ if len(parts) < 2 or not when:
+ continue
+ if parts[0].startswith("R") and len(parts) == 3:
+ old, new = parts[1], parts[2]
+ touch(new, when)
+ alias[old] = new
+ continue
+ touch(parts[-1], when)
+ return dates
+
+
+def load_catalog_entries(catalog_dir: Path, stars: dict[str, int] | None = None,
+ dates: dict[str, dict[str, str]] | None = None) -> list[dict]:
"""Parse all ``*.yaml`` files (except removed.yaml) into page entries.
Entries missing any of name/repo/sha are skipped with a stderr log —
a malformed community entry must never break the docs deploy.
+ ``dates`` is ``load_git_dates()`` output keyed by file name; absent → null addedAt/updatedAt.
"""
entries: list[dict] = []
stars = stars or {}
+ dates = dates or {}
if not catalog_dir.is_dir():
return entries
@@ -169,6 +232,8 @@ def load_catalog_entries(catalog_dir: Path, stars: dict[str, int] | None = None)
"image": _cosmetic(raw.get("image"), _is_allowed_image_url, path.name, name, "image"),
"installCommand": f"hermes plugins install {name}",
"stars": _repo_stars(repo, stars),
+ "addedAt": dates.get(path.name, {}).get("addedAt"),
+ "updatedAt": dates.get(path.name, {}).get("updatedAt"),
})
# Most-starred first (unknown = 0), then name so the order is stable; tier does not rank.
@@ -229,7 +294,7 @@ def main(catalog_dir: Path = DEFAULT_CATALOG_DIR, output_dir: Path = DEFAULT_OUT
stars_path = stars_file if stars_file is not None else output_dir / "plugin-stars.json"
stars = load_stars(stars_path)
- entries = load_catalog_entries(catalog_dir, stars)
+ entries = load_catalog_entries(catalog_dir, stars, load_git_dates(catalog_dir))
removed_count = count_removed(catalog_dir)
by_tier = Counter(e["tier"] for e in entries)
diff --git a/website/src/pages/plugins/index.tsx b/website/src/pages/plugins/index.tsx
index 73621cd489b..63a2f15c51b 100644
--- a/website/src/pages/plugins/index.tsx
+++ b/website/src/pages/plugins/index.tsx
@@ -31,6 +31,10 @@ interface CatalogPlugin {
installCommand: string;
/** GitHub stargazers at the last daily probe; null when the repo is not on GitHub or unprobed. */
stars?: number | null;
+ /** ISO committer date of the commit that added the entry to plugin-catalog/ (null: no git history at build). */
+ addedAt?: string | null;
+ /** ISO committer date of the last commit touching the entry (pin bumps, metadata edits). */
+ updatedAt?: string | null;
/** Lowercase pre-joined haystack for the search filter (built at load). */
_search?: string;
}
@@ -80,6 +84,29 @@ const TIER_CONFIG: Record<
const TIER_ORDER = ["all", "official", "community"];
+// Sort orders. "stars" is the extractor's own order (stars desc, name), so it
+// needs no client-side work; the two date sorts read the git-derived
+// addedAt/updatedAt fields and push undated entries last.
+type SortKey = "stars" | "newest" | "updated";
+const SORT_OPTIONS: { key: SortKey; label: string; title: string }[] = [
+ { key: "stars", label: "Most starred", title: "GitHub stars, most first" },
+ { key: "newest", label: "Newest", title: "Most recently added to the catalog first" },
+ { key: "updated", label: "Recently updated", title: "Most recently re-pinned or edited first" },
+];
+
+function dateMs(iso?: string | null): number {
+ const t = iso ? new Date(iso).getTime() : NaN;
+ return Number.isFinite(t) ? t : -Infinity;
+}
+
+function sortPlugins(list: CatalogPlugin[], sort: SortKey): CatalogPlugin[] {
+ if (sort === "stars") return list;
+ const field = sort === "newest" ? "addedAt" : "updatedAt";
+ return [...list].sort(
+ (a, b) => dateMs(b[field]) - dateMs(a[field]) || a.name.localeCompare(b.name),
+ );
+}
+
// Browse taxonomy. Order here is the order of the filter pills and of the
// grouped sections; keep it in sync with CATALOG_CATEGORIES in
// hermes_cli/plugin_catalog.py and website/scripts/extract-plugins.py.
@@ -113,6 +140,13 @@ function formatRelativeTime(iso?: string): string | null {
return `${months} month${months === 1 ? "" : "s"} ago`;
}
+function formatDate(iso?: string | null): string {
+ const d = iso ? new Date(iso) : null;
+ return d && Number.isFinite(d.getTime())
+ ? d.toLocaleDateString(undefined, { year: "numeric", month: "short", day: "numeric" })
+ : "";
+}
+
function formatStars(n: number): string {
return n >= 1000 ? `${(n / 1000).toFixed(n >= 10_000 ? 0 : 1)}k` : String(n);
}
@@ -294,6 +328,23 @@ function PluginCard({
))}
</div>
+ {/* Updated is omitted while it equals Added: a fresh entry has nothing to say yet. */}
+ {plugin.addedAt && (
+ <div className={styles.cardDates}>
+ <span title={`Added to the catalog ${formatDate(plugin.addedAt)}`}>
+ Added {formatRelativeTime(plugin.addedAt) ?? formatDate(plugin.addedAt)}
+ </span>
+ {plugin.updatedAt && plugin.updatedAt !== plugin.addedAt && (
+ <>
+ <span aria-hidden="true" className={styles.cardDatesSep}>·</span>
+ <span title={`Last catalog change ${formatDate(plugin.updatedAt)}`}>
+ Updated {formatRelativeTime(plugin.updatedAt) ?? formatDate(plugin.updatedAt)}
+ </span>
+ </>
+ )}
+ </div>
+ )}
+
{onPick ? (
<button
className={styles.pickBtn}
@@ -446,6 +497,7 @@ export default function PluginCatalogPage() {
const [search, setSearch] = useState("");
const [tierFilter, setTierFilter] = useState("all");
const [categoryFilter, setCategoryFilter] = useState("all");
+ const [sort, setSort] = useState<SortKey>("stars");
const [expandedCard, setExpandedCard] = useState<string | null>(null);
const searchRef = useRef<HTMLInputElement>(null);
@@ -494,13 +546,14 @@ export default function PluginCatalogPage() {
const filtered = useMemo(() => {
const q = search.toLowerCase().trim();
- return allPlugins.filter((p) => {
+ const matching = allPlugins.filter((p) => {
if (tierFilter !== "all" && p.tier !== tierFilter) return false;
if (categoryFilter !== "all" && p.category !== categoryFilter) return false;
if (q) return (p._search || "").includes(q);
return true;
});
- }, [search, tierFilter, categoryFilter, allPlugins]);
+ return sortPlugins(matching, sort);
+ }, [search, tierFilter, categoryFilter, sort, allPlugins]);
// Browse mode (no search, no category picked): render one section per
// category so Memory, Desktop, Platforms… read as distinct shelves rather
@@ -680,6 +733,25 @@ export default function PluginCatalogPage() {
})}
</div>
+ <div className={styles.sortPills} role="radiogroup" aria-label="Sort plugins">
+ <span className={styles.sortLabel}>Sort</span>
+ {SORT_OPTIONS.map((opt) => {
+ const active = sort === opt.key;
+ return (
+ <button
+ key={opt.key}
+ className={`${styles.tierBtn} ${active ? styles.sortBtnActive : ""}`}
+ onClick={() => setSort(opt.key)}
+ role="radio"
+ aria-checked={active}
+ title={opt.title}
+ >
+ {opt.label}
+ </button>
+ );
+ })}
+ </div>
+
<div className={styles.categoryPills} role="tablist" aria-label="Plugin categories">
<button
className={`${styles.categoryBtn} ${categoryFilter === "all" ? styles.categoryBtnActive : ""}`}
diff --git a/website/src/pages/plugins/styles.module.css b/website/src/pages/plugins/styles.module.css
index af08d39cc93..29610c4c551 100644
--- a/website/src/pages/plugins/styles.module.css
+++ b/website/src/pages/plugins/styles.module.css
@@ -250,6 +250,29 @@
background: rgba(255, 255, 255, 0.08);
}
+/* Sort control: Most starred / Newest / Recently updated, same pill shape as the tier tabs. */
+.sortPills {
+ display: flex;
+ gap: 0.4rem;
+ flex-wrap: wrap;
+ justify-content: center;
+ align-items: center;
+}
+
+.sortLabel {
+ font-size: 0.72rem;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: var(--ifm-color-emphasis-500);
+ margin-right: 0.15rem;
+}
+
+.sortBtnActive {
+ border-color: rgba(255, 215, 0, 0.3);
+ background: rgba(255, 215, 0, 0.06);
+ color: #ffd700;
+}
+
/* ── Category pills + grouped sections ─────────────────────────────────── */
.categoryPills {
display: flex;
@@ -567,6 +590,20 @@
flex-wrap: wrap;
}
+/* Added / Updated line from the catalog's git history. */
+.cardDates {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.35rem;
+ margin-top: 0.5rem;
+ font-size: 0.7rem;
+ color: var(--ifm-color-emphasis-500);
+}
+
+.cardDatesSep {
+ opacity: 0.5;
+}
+
/* Capability chips: tools/hooks/middleware counts. */
.capChip {
font-family: "JetBrains Mono", monospace;