Skip to content

feat(index): publish a generated discovery index - #18

Merged
scttfrdmn merged 2 commits into
mainfrom
feat/plugin-discovery-index
Jul 29, 2026
Merged

scttfrdmn merged 2 commits into
mainfrom
feat/plugin-discovery-index

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

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 declared permissions.instance.{root,ports}.
  • .github/workflows/index.yml — regenerates it with spawn plugin gen-index whenever a plugin.yaml changes, and commits it back on push to main.

The index is derived, 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.

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

generatedAt comes from the last commit that touched a plugin.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:

  • The committed index.json already 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: 0 on checkout, since a depth-1 clone can't see the spec history the stamp is read from.

Docs

  • README gains a Finding a plugin section pointing at 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.
  • AUTHORING gains the mapping from spec fields to what discovery shows, because description, config type/required, and permissions.instance.{root,ports} are now user-facing before anyone installs. Declaring permissions is 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

  • Generated against all 12 plugins; regenerated twice with the workflow's own stamp for byte-identical output, confirming CI won't commit churn.
  • Workflow YAML parses; steps and permissions: contents: write confirmed.
  • Every field documented in the AUTHORING table is populated in the real generated index (12/12 descriptions, 11/12 with config params, 12/12 declaring root, 3 declaring ports, 5 with required keys) — the table describes actual behavior, not intent.
  • No AWS resources involved; this is registry metadata only.

Merge order

Merge spawn#451 and release a spawn that includes plugin gen-index first. This workflow downloads the latest released spawn, like lint.yml does, 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 committed index.json is already correct in the meantime, so spawn plugin search works for anyone on a new enough spawn as soon as this merges.

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.
@scttfrdmn

Copy link
Copy Markdown
Contributor Author

The Generate index.json check on this PR fails by design until a spawn release includes plugin gen-index — it downloads the latest released spawn, as lint.yml does. Current output:

::error::the released spawn has no 'plugin gen-index'; a spawn release
including spore-host/spawn#451 is required

That's the guard working. Worth noting it initially didn't: my first version probed spawn plugin gen-index --help, which cobra answers with plugin --help and exit 0 when the subcommand is missing, so the guard passed against a v0.36.12 binary and then failed on unknown flag: --source. Now fixed to grep the parent command's help (the same technique lint.yml uses for validate --strict), verified against the released spawn. gen-index is also no longer hidden in spawn#451, partly so this probe has something to find.

Two useful things the failing run did confirm: the spec-keyed stamp resolves correctly on a real runner (Stamping generatedAt=2026-07-20T21:01:01-07:00 — matching the committed index exactly, so the first run on main will find nothing to commit), and Validate plugin specs passes, so the specs themselves are unaffected.

Merge order: spawn#451 → a spawn release → this PR.

@scttfrdmn
scttfrdmn merged commit c6229f4 into main Jul 29, 2026
2 of 3 checks passed
@scttfrdmn
scttfrdmn deleted the feat/plugin-discovery-index branch July 29, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant