feat(marketplace): distribute Magpie 0.2.0 via agent marketplaces + auto-upgrade hook - #907
feat(marketplace): distribute Magpie 0.2.0 via agent marketplaces + auto-upgrade hook#907potiuk wants to merge 18 commits into
Conversation
4864c08 to
1ecaade
Compare
Resolves the 3 CodeQL 'file is not always closed' alerts (35/36/37) flagged on apache#907. Rewrite the family-plugin validator with pathlib — Path.read_text / write_text open-and-close by construction, so no dangling handles — and the same read/write/symlink logic reads cleaner. Behaviour unchanged (check/--fix verified: passes, idempotent, catches drift).
|
Looking for reviews :) |
choo121600
left a comment
There was a problem hiding this comment.
looks good to me :)
let's go 0.2.0!
|
Thanks — reproduced exactly: 20 warnings, Worth noting why it wasn't just a ten-file edit: those manifests are generated by Your nit also surfaced a real latent bug next to it: Verified:
Also documented the bump flow in the release config's Thanks for the local-replica install test too — good to have confirmation the family plugins enable and pick up 0.2.0 from the marketplace entry. |
|
I need committer approval on that (I address @choo121600 ) comments. |
|
This needs a fresh approving review to move, and the reason is a slightly awkward one: the existing approval was dismissed by my own follow-up commits. @choo121600 approved at What changed since that review, all of it downstream of the nit:
Verified: So: a re-approval from @choo121600, or a first look from any other maintainer, is all that is outstanding. Happy to walk through any part of the above — and sorry for the churn, the dismissal was an unintended side effect of acting on the review. |
|
Ran the magpie PR review on this: Solid, well-documented packaging change — but two issues in the new Upgrade prompt is written to stderr on a zero exit (
|
Package the framework as a single 'magpie' plugin (skills: ./skills, all 70) and add the manifests each agent marketplace needs, referencing the existing skills tree with no vendored copies: - Claude Code: .claude-plugin/marketplace.json + plugin.json - Codex CLI: .codex-plugin/plugin.json + .agents/plugins/marketplace.json - Copilot: marketplace.json (repo root) - Gemini CLI: gemini-extension.json (skills auto-discovered) - microsoft/apm: apm.yml (type: skill; multiplexes to Claude/Cursor/Codex/Copilot/Gemini) Adds docs/setup/marketplaces.md (per-agent install, incl. Kiro/OpenCode git-install and the Windsurf/Goose non-mappings), positions the marketplace path as a discovery/trial channel alongside /magpie-setup, keeps the ASF source release canonical, and wires the version-bearing manifests into version_manifest_files so release-prepare keeps them in sync. Refs apache#518.
Add a Claude Code SessionStart hook (hooks/check-upgrade.sh, wired via the plugin's hooks block) that detects when the marketplace has updated the Magpie plugin to a new version and prompts the user to run `/magpie-setup upgrade` to reconcile the snapshot, agentic overrides, and drift. Detect-and-prompt, not auto-run: Claude Code hooks cannot invoke a slash command, and Magpie never mutates an adopter repo without the guided skill's confirmation, so the trigger is automatic while the changes stay confirmed. Claude Code-only; Codex/Gemini have no equivalent lifecycle hook.
Extend the update-detection prompt beyond Claude Code: - Make hooks/check-upgrade.sh agent-neutral (resolves CLAUDE_/CODEX_ plugin root+data env vars; reads version from whichever plugin manifest is present). - Codex CLI: wire the same script via the plugin's hooks block (schema best-effort, flagged for verification before publish). - Gemini CLI: ship GEMINI.md extension context (contextFileName) instructing the agent to compare the extension version to a recorded marker and prompt for /magpie-setup upgrade on change — Gemini has no lifecycle hook. Documented per-agent in docs/setup/marketplaces.md.
…l (adopt alias) Folds the top-level README simplification from apache#901 (by @meonkeys) into the 0.2.0 marketplace work, and shifts the primary term to 'install' now that marketplace installation exists: - Keeps Adam's simplified Install / Usage / Update / Skill-families structure. - Install section covers both paths: agent marketplace (easiest, nothing committed) and the committed snapshot via /magpie-setup. - 'install' is the primary verb/command; '/magpie-setup adopt' stays an alias; 'Adopt a Magpie' remains the landing-page slogan; 'adopter'/'adopter repo' kept as the ecosystem noun. - Repoints inbound doc links from the removed README#adopting-the-framework anchor to README#install and updates their labels. Supersedes the standalone apache#901 (its Fix apache#899 goal already merged via apache#905). Credit to @meonkeys for the simplification.
Keep 'adopt' for the project relationship and 'install/installation' for the process, per the terminology model: a project adopts Magpie into its source; /magpie-setup installs the snapshot.
…e Install section
…marketplace Expand docs/setup/marketplaces.md from a one-line-per-agent table into step-by-step instructions for installing Magpie from the apache/magpie GitHub repo-as-marketplace: add marketplace, install, verify, invoke, update — for Claude Code, Codex, Copilot, Gemini, Cursor, apm, Kiro, OpenCode. States plainly that the GitHub repo is the marketplace (no vendor official directory needed) and how to pin a tag vs track main. Verify-flagged the still-evolving CLIs (Codex/Copilot/apm/Cursor).
…en cost Live-tested that Claude Code's plugin 'skills' field rejects paths outside the plugin dir, so per-family plugins reference the shared skills/ tree via single-hop symlinks (no copies, single source of truth). - Add 10 family plugins under plugins/magpie-<family>/ (security, release- management, setup, pr-management, issue, repo-health, contributor-growth, utilities, mentoring, pairing), each a .claude-plugin/plugin.json + a skills/ dir of symlinks into ../../../skills/<skill>. - marketplace.json now lists the all-in-one 'magpie' plugin plus the 10 families. Family plugin.jsons omit version and inherit it from the marketplace entry (centralised versioning). - Verified via real installs: e.g. magpie-security = 12 skills / ~3.9k always-on, magpie-pairing = 2 / ~0.6k, vs the all-in-one 70 / ~21.7k. - Namespacing confirmed clean: /magpie-<family>:<skill> (dir name, no magpie- frontmatter double-prefix). Docs: docs/setup/marketplaces.md gains the all-in-one-vs-per-family guidance and per-family token costs.
…caveat - tools/dev/check-family-plugins.py: validates that plugins/magpie-<family>/ match the skills' family: frontmatter (each family's skills present as single-hop symlinks into skills/, and listed in marketplace.json). Catches a new skill, a changed family, or a stale symlink. --fix regenerates them. - Wire it as a local prek hook (runs when a SKILL.md, a family plugin, or the marketplace manifest changes). - docs/setup/marketplaces.md: document that per-family plugins rely on git symlinks — on Windows enable core.symlinks + Developer Mode, or use the all-in-one magpie plugin (no symlinks). Verified symlinks survive a GitHub clone on macOS.
Spell out that you can install either the all-in-one magpie plugin or any number of per-family plugins (and mix families), with the pros/cons of each: simplicity + Windows-safe (no symlinks) vs proportional always-on token cost.
…o the portable non-marketplace install Add a WARNING callout: plugin/marketplace mechanisms across the agentic CLIs (Claude Code, Codex, Copilot, Gemini, apm) are experimental and change between releases. The non-marketplace /magpie-setup install from the signed SVN release or the GitHub repo is always available, harness-neutral, and portable — it works on every agentic CLI via the universal .agents/skills/ layout, not just the ones with a marketplace.
…hods Same skill, different invocation name: portable /magpie-setup install bakes a magpie- prefix into each skill (invoked /magpie-<name>), whereas a marketplace plugin namespaces with plugin:skill and keeps the bare name (/magpie:<name> for the all-in-one, /magpie-<family>:<name> for a family plugin). Adds a comparison table + examples and notes that repo cross-references use the portable form.
Resolves the 3 CodeQL 'file is not always closed' alerts (35/36/37) flagged on apache#907. Rewrite the family-plugin validator with pathlib — Path.read_text / write_text open-and-close by construction, so no dangling handles — and the same read/write/symlink logic reads cleaner. Behaviour unchanged (check/--fix verified: passes, idempotent, catches drift).
Extend check-family-plugins to confirm every plugin is properly defined: - all-in-one 'magpie' manifest names itself, declares skills: ./skills, and wires the hooks/check-upgrade.sh SessionStart hook (which must exist); - every marketplace.json entry resolves to a matching, uniquely-named plugin.json (catches dangling sources, name mismatches, duplicates); - each per-family manifest is well-formed (name/skills/description) in addition to the existing symlink-vs-frontmatter check. Also trigger the hook on .claude-plugin/plugin.json and hooks/check-upgrade.sh changes.
`claude plugin validate . --strict` reported 20 warnings — each of the ten per-family plugin manifests was missing `version` and `author`. Nothing was broken (a family plugin installs and enables fine), but --strict treats the warnings as errors, so the repo root failed validation. Rather than hand-edit ten generated files, make the shared metadata inherited: `tools/dev/check-family-plugins.py` now copies `version`, `author`, `homepage`, `repository`, and `license` from the all-in-one `.claude-plugin/plugin.json` into every family manifest, and `check` fails if any of them — or a marketplace entry version — drifts from the root. This also removes the hardcoded `"version": "0.2.0"` in `--fix`, which would have silently reset the family marketplace entries to 0.2.0 after a release bump. A bump now has one edit point (the root manifest) plus `python3 tools/dev/check-family-plugins.py --fix` to propagate; the prek hook catches a missed propagation. Documented in the release config's `version_manifest_files` notes and docs/setup/marketplaces.md. `claude plugin validate . --strict` now passes with 0 warnings.
Every plugin manifest claimed version `0.2.0` while `pyproject.toml` sits at `0.2.0.dev0` (the post-0.1.0 bump, apache#906). Only `0.1.0` is tagged, so the manifests were advertising a release that does not exist yet — and the docs claimed they were "kept in sync with pyproject.toml", which they were not. Make `pyproject.toml`'s `project.version` the single authority and mirror it verbatim, `.devN` suffix included. The version now flows outward in two hops, neither hand-edited: pyproject.toml -> .claude-plugin/plugin.json, .codex-plugin/plugin.json, gemini-extension.json, apm.yml -> the 10 generated family manifests + 11 marketplace entries `check` fails on drift at either hop; `--fix` propagates both. A release bump is now one edit plus one command. Mirroring the PEP 440 string rather than translating it to a semver prerelease (`0.2.0-dev.0`) is deliberate: `release-prepare` step 2a bumps `version_manifest_files` by literal search/replace, which only works if every manifest carries the identical string — and dev versions are never published to a marketplace, so the suffix never reaches a consumer. `claude plugin validate --strict` accepts it, and hooks/check-upgrade.sh compares versions as opaque strings. Version rewrites are textual substitutions, not json.dumps() round-trips, so bumping does not reformat these hand-authored manifests (escaping em-dashes, expanding inline objects); each write is verified by re-parsing. Verified: `claude plugin validate . --strict` passes; simulating a bump to 0.3.0 propagates to all 25 version sites and is idempotent; prek passes (end-of-file-fixer skipped locally — sandbox denies it a write to an unrelated file).
…ifests
Agent Plugins 1.0.0 was published on 2026-08-06 — a vendor-neutral
standard for packaging Agent Skills and MCP servers, from a TSC drawn
from Amazon, Cursor, Microsoft, OpenAI and Vercel, with Google since
joined. Support is GA in VS Code, Copilot CLI, the Copilot app and the
Copilot SDK as of 2026-08-12. This PR predates it, so it packaged for
five client-specific formats and none of the standard.
Add the AP1 manifest without disturbing any of them:
- New root `plugin.json` — the AP1 manifest, pinning the canonical
`$schema`. VS Code auto-detects the plugin format from the root
manifest and reads that field as the AP1 marker; without it the same
file is treated as a legacy Copilot manifest. Conformance needed no
file moves: AP1 fixes skills at `skills/<name>/SKILL.md`, which is
already the layout, and its schema is closed, so it carries metadata
only — no `skills` path, no `hooks` block.
- `check-family-plugins.py` validates the new manifest (pinned
`$schema`, name pattern, the closed ten-field set, `author` sub-keys,
metadata inherited from the Claude manifest) and adds it to the
version-mirroring set, so a bump stays one edit plus `--fix`.
- Wire it into the prek hook's `files:` pattern and
`version_manifest_files`.
Verified: validates clean against the published `plugin.schema.json`;
70 skills resolve under the AP1 discovery rule; no symlink under
`skills/` escapes the plugin root; `claude plugin validate . --strict`
still passes; all 23 prek hooks green.
Also fixes three defects found while checking each manifest against its
vendor's current documentation:
- `hooks/check-upgrade.sh` wrote its upgrade prompt to **stderr** and
exited 0. For a `SessionStart` hook exiting 0 it is stdout that is
added to the session context; stderr only reaches the debug log. Since
the version marker was written first, the next session saw no change
and stayed silent too — so the prompt was delivered exactly zero
times. Now on stdout, and tested across all three transitions.
- The marker's fallback directory was `$root/.magpie-state`, inside a
git working tree that nothing ignores and that a plugin update can
replace wholesale. `CLAUDE_PLUGIN_DATA` is real and documented, but
`CODEX_PLUGIN_DATA` is not; fall back to `$XDG_STATE_HOME/magpie`
instead, never into the checkout.
- `.codex-plugin/plugin.json` invoked the hook via `${CODEX_PLUGIN_ROOT}`,
which Codex does not export. It exports `PLUGIN_ROOT`/`PLUGIN_DATA`
and the `CLAUDE_*` pair for compatibility.
Docs: `marketplaces.md` gains a section on the two manifest families and
which client reads which, an install path for VS Code/Copilot, a
per-manifest verification table replacing the prose "best-effort" note,
and the recorded limitation that the per-family plugins cannot be AP1
packages — their skill symlinks deliberately escape the family root, and
materialising them would mean vendored copies that PRINCIPLES §13 rules
out. AP1 clients install the all-in-one plugin, whose `skills/` is the
real tree. Also notes openai/codex#16430, under which Codex may not fire
plugin-local hooks yet, and drops a duplicated SPDX header.
Four findings from Justin's review, plus the one they turned up. `--fix` destroyed anything it did not generate. It ran `shutil.rmtree()` over every `plugins/magpie-*` before regenerating. That is safe only while those directories hold nothing but a generated manifest and symlinks; the first time a family grows a `commands/`, an `agents/`, or a README, the next `--fix` would delete it without a word. It now enumerates what regeneration owns — `.claude-plugin/plugin.json` and symlinks under `skills/` — and refuses, naming the file, on anything else. The scan runs over all ten families *before* the first delete, so a stray file in the last one cannot leave the first nine destroyed. `--fix` could write a marketplace with only the family entries. The all-in-one entry is carried over rather than regenerated, so `[p | ... for p in market["plugins"] if p["name"] == "magpie"]` silently yielded `[]` if that entry was ever absent or renamed — and the destructive rewrite landed before `check` could catch it on the next run. It now bails with a message that says what to restore. The same line raised a bare `KeyError` on a malformed catalog instead of the tidy error the rest of the script produces; both lookups are guarded. The Codex and Copilot catalogs were covered by nothing. Neither `.agents/plugins/marketplace.json` nor the root `marketplace.json` was read by `check`, by `--fix`, or by the prek hook's `files:` pattern. `check` now verifies both list the all-in-one plugin and *only* that, and both are in the hook pattern. Only-that is the right rule rather than an omission to fix: the family plugins reach their skills through symlinks that resolve outside the family's own root, which Agent Plugins 1.0 forbids, so offering them to Codex or Copilot would advertise something those clients cannot install. `marketplaces.md` says so in both install sections. `uv.lock` was listed under `version_manifest_files` beside manifests that `--fix` propagates, though `ECOSYSTEM_MANIFESTS` does not include it and neither `--fix` nor the prek check touches it. Noted as refreshed by `uv lock`, which the Step 2a bump already runs. The `<tracker>` placeholder in a skill description is conformant, and this is the one finding that needed checking rather than fixing. It is not one skill: 41 of the 70 descriptions carry the framework's `<placeholder>` syntax, so "rewrite it" would mean unpicking the convention in AGENTS.md. The Agent Skills specification — which AP1 defers to for skill validity — constrains `description` on length alone (1–1024 characters, non-empty) and says nothing about angle brackets; the character-class rules apply to `name`, which every skill satisfies. Longest description is 953 characters. Recorded in `marketplaces.md` so the question does not get re-opened from scratch. Verified: each of the three destructive paths aborts with the tree intact (ten families still present, marketplace byte-identical); the catalog rule fires on a planted family entry; `--fix` stays idempotent; all 23 prek hooks green.
657382f to
bc52210
Compare
Rebased onto
|

Prepares Apache Magpie 0.2.0 for release through existing agent-skill marketplaces and the Agent Plugins 1.0 open standard, and wires automatic upgrade detection. Refs #518.
Approach
Package the whole framework as a single
magpieplugin whose skills are the existing./skillstree — no file moves, no vendored copies, no symlinks (PRINCIPLES §13 intact). The marketplace path is positioned as a discovery/trial channel alongside/magpie-setupfull adoption; the canonical release stays the signed ASF source artefact ondist.apache.org.Two manifest families
As of 2026-08 no single manifest is read by every client, so Magpie ships both shapes. They do not conflict — different paths, each client reads the one it documents, all pointing at the same single
skills/tree.plugin.json.claude-plugin/marketplace.json,.claude-plugin/plugin.json.codex-plugin/plugin.json,.agents/plugins/marketplace.jsonmarketplace.json(repo root)gemini-extension.jsonapm.yml(type: skill)SKILL.mdgit-installWindsurf/GooseSKILL.mdpath (documented)AP1 conformance needed no file moves: the spec fixes skills at
skills/<name>/SKILL.md, already the layout here. Its schema is closed at ten fields, so the root manifest carries metadata only — component paths and thehooksblock stay in the client-specific manifests.Plus
docs/setup/marketplaces.md(per-agent install, the two-manifest-family model, the non-mappings, a per-manifest verification table) andversion_manifest_fileswiring sorelease-preparekeeps every manifest version in sync withpyproject.toml.Auto-upgrade detection
A
SessionStarthook (hooks/check-upgrade.sh) detects when the marketplace updated the plugin and prompts/magpie-setup upgrade. Detect-and-prompt, not auto-run — a plugin hook cannot invoke a slash command, and Magpie never mutates an adopter repo without the guided skill's confirmation. Claude Code and Codex share the event schema; AP1 defines no hook component, so AP1-only clients re-run the upgrade manually.Reviewer notes