Repository navigation
feat(index): publish a generated discovery index - #18
Conversation
Adds index.json — the manifest `spawn plugin search` and `spawn plugin info` read — plus the CI that keeps it current. Registry half of spore-host/spawn#448; the commands themselves are spore-host/spawn#451. The index is derived from the specs by `spawn plugin gen-index`, never hand-edited, so it cannot describe a plugin differently from its plugin.yaml. As with lint.yml, spawn is the single source of truth for spec rules and this workflow reimplements none of them. index.yml regenerates on any push touching plugins/*/plugin.yaml and commits the result back to main. On a pull request it checks the committed index instead of pushing — a fork can't push, and a spec change should be reviewed together with the index entry it produces. generatedAt is stamped from the last commit to a SPEC, not from HEAD or from "now". HEAD would be circular: committing the index moves HEAD, which changes the stamp, so the index could never be current with itself and every run would commit a no-op diff. Keying off the specs makes generation idempotent — verified here by regenerating twice for byte-identical output, and the committed index carries the stamp the workflow will compute, so its first run finds nothing to do. Docs: README gains a "Finding a plugin" section pointing at the commands, since its hand-kept table lists 4 of the 12 plugins here and that drift is what a generated index removes. AUTHORING gains the mapping from spec fields to what discovery shows, because description, config types/required, and permissions.instance.{root,ports} are now user-facing before install — and a spec that omits permissions shows nothing rather than "needs nothing", so declaring them accurately is how users get an honest picture.
`gen-index --help` is not a usable capability probe: on a spawn that lacks the subcommand, cobra falls through to `plugin --help` and exits 0, so the guard passed against a binary that then failed on `unknown flag: --source`. Grep the parent help instead, as lint.yml already does for `validate --strict`. Verified against the currently released spawn (v0.36.12): the probe correctly reports no support and fails fast with the actionable message.
|
The That's the guard working. Worth noting it initially didn't: my first version probed Two useful things the failing run did confirm: the spec-keyed stamp resolves correctly on a real runner ( Merge order: spawn#451 → a spawn release → this PR. |
Registry half of spore-host/spawn#448. The commands that consume this are spore-host/spawn#451.
What this adds
index.json— a generated manifest of this registry's 12 plugins: name, version, description, spec path, config keys (with required marked), and declaredpermissions.instance.{root,ports}..github/workflows/index.yml— regenerates it withspawn plugin gen-indexwhenever aplugin.yamlchanges, and commits it back on push tomain.The index is derived, never hand-edited, so it cannot describe a plugin differently from its
plugin.yaml. As withlint.yml, spawn is the single source of truth for spec rules and this workflow reimplements none of them.Why the PR path only checks
On a pull request the workflow regenerates and diffs rather than pushing. A PR from a fork can't push anyway, and a bot commit appearing on a contributor's branch is surprising — but more usefully, it keeps a spec change and the index entry it produces visible in the same review. The error message prints the exact regeneration command.
The stamp is keyed to the specs, not to HEAD
generatedAtcomes from the last commit that touched aplugin.yaml:git log -1 --format=%cI -- 'plugins/*/plugin.yaml'Not HEAD, which would be circular — committing the index moves HEAD, which changes the stamp, so the index could never be current with itself and every run would commit a no-op diff. Not "now" either, for the same reason. Keying off the specs makes generation idempotent.
Two consequences worth noting:
index.jsonalready carries the stamp this workflow will compute (2026-07-20T21:01:01-07:00→2026-07-21T04:01:01Z), so its first run on main finds nothing to commit.fetch-depth: 0on checkout, since a depth-1 clone can't see the spec history the stamp is read from.Docs
spawn plugin search/info. Worth noting the motivation: the hand-kept plugin table lists 4 of the 12 plugins actually in this repo. That drift is precisely what a generated index removes, so the table is now scoped to "plugins with a written walkthrough" and search is presented as the authoritative list.description, configtype/required, andpermissions.instance.{root,ports}are now user-facing before anyone installs. Declaringpermissionsis what lets discovery flag a plugin that needs root; a spec that omits the block shows nothing — reported as "not declared" rather than "needs nothing" — so declaring it accurately is how users get an honest picture.Verification
permissions: contents: writeconfirmed.Merge order
Merge spawn#451 and release a spawn that includes
plugin gen-indexfirst. This workflow downloads the latest released spawn, likelint.ymldoes, so until then it fails fast with a clear message (the released spawn has no 'plugin gen-index') rather than producing a broken index. The committedindex.jsonis already correct in the meantime, sospawn plugin searchworks for anyone on a new enough spawn as soon as this merges.