feat(release): tag each plugin release as <plugin>-v<version> #234

Merged
Defame1297 merged 12 commits from feat/223-plugin-release-tags into main 2026-11-27 20:36:38 +00:00
Owner

Part of #223. The issue closes after the tags are pushed and the post-merge checks below pass.

What and why

Consumers that pin a plugin by ref have no tag to pin to. Each plugin has its own version:, but the only tags are repo-level v* tags. This PR adds annotated per-plugin release tags, <plugin>-v<version>, and a deterministic tool that cuts them.

  • scripts/tag-plugin-releases.sh and tests/test-tag-plugin-releases.sh (194 assertions).
    • Where a tag goes: on the version's first landing. That is the oldest commit on main's first-parent history in the first run that carries the version, looking across the whole history.
    • Released once: a version is released once. A later revert back to it is reported RELEASED and gets no new tag. A version whose first landing is before the tagged range is also RELEASED.
    • Dry run by default: exit 0 means nothing is missing, 1 means tags are missing, 2 means an error or conflict.
    • --apply: creates the missing tags locally. It is all-or-nothing, and only runs when the ref is on origin/main's first-parent history.
    • Pushing: the script prints an explicit git push origin <tag> … line, never --tags. It never pushes.
    • Existing tags: it never moves or overwrites one. A tag that is lightweight, or not on its version's first landing, is reported as an error.
  • ADR-0033 records:
    • the tag form and target, timing (after merge), and that tags are immutable;
    • why no hook holds this: a pre-push hook on tag pushes can't fire under pre-commit's _pre_push_ns, and a hook on main would block everyone after every merge;
    • the push policy: after --apply, the agent shows the exact tags and pushes them only on the maintainer's explicit yes in the conversation;
    • the maintainer's way out when a version in history is invalid.
  • ADR-0024 gets a forward note on rejected option 2. docs/spec/gates.md gets a section "Plugin release tags are not a gate". README gets the release steps.
  • Root apm.yml: marketplace.build.tagPattern → {name}-v{version}, and the catalogue goes 0.8.0 → 0.8.1 (repo policy requires a patch bump for a build: change). marketplace.json is regenerated.
  • Version mismatch: the root .claude-plugin/plugin.json is gitignored and read 0.4.1.
    • apm pack reads that file back ahead of apm.yml and only rewrites it with --force. So every release bundle shipped 0.4.1, along with the obsidian MCP server that had been removed.
    • It is now regenerated with --force, and the .gitignore comment is corrected.
  • Delivery onboarding: new docs/agents/delivery.md, in the delivery-repo-doc format.
  • AGENTS.md: a one-bullet release-tag rule for agents.
    • It covers fetch, run the script, --apply, and pushing only on an explicit yes.
    • Exit 2 means stop and report.
    • The script's OK means the tag is present locally, not published, so the agent confirms with git ls-remote.

Validation

  • apm outdated (apm 0.28.0): tested against a synthetic monorepo served over git HTTP. A consumer pinned to git-v1.3.8 reports git-v1.3.9, and decoy tags don't leak into the git row.
  • Renovate's apm manager (≥ 44.153.0): it scopes <prefix>-v<x.y.z> tags automatically. This comes from reading Renovate's source and tests; it was not run.
  • Real repo: a dry run against origin/main shows exactly 11 MISSING tags. In a clone, the one-off, then a full --apply, then a dry run gave 12 annotated tags and exit 0.
  • Review: 5 clean-context review rounds. The last one also ran a fuzz test over 60 random histories with reverts, non-bump edits, delete/re-add, and --no-ff merges. A dry run never exited 2 after a successful --apply.
  • Pre-push hooks: all pass, including run-tests, apm audit --ci, apm pack --check-clean and validate-marketplace.

Non-blocking notes

  • Duplicate error rows: one misplaced tag inside the wanted range shows two ERROR rows. Cosmetic.
  • Dry run on a feature-branch ref: this can report ERROR for a tag that isn't reachable from it. Only origin/main is a documented ref.
  • Older git: merge-commit targets rely on rev-list --first-parent -- <path> keeping merges whose change came in from the second parent. Tested here (Case 1), but older git versions are unverified.
  • Commit trailers: commit b3fd1f2 has a blank line inside its trailer block.
  • docs/agents/delivery.md values need the maintainer's confirmation:
    • human allowlist Defame1297, taken from main's branch-protection approvals allowlist;
    • bot user Claude, inferred from who opens issues;
    • "Branch protection: in place";
    • "Accepted risks: none".

After merge

  1. git fetch origin --tags.
  2. One-off, so apm outdated can be verified: scripts/tag-plugin-releases.sh --ref 32fbe39fb8923854ca8e743a0d2cad81720c736c --plugin git --apply. This creates git-v1.3.8 on the PR #135 merge.
  3. scripts/tag-plugin-releases.sh (dry run). Expect these 11 MISSING: ansible-v0.1.0, bin-v3.0.0, core-v1.1.4, delivery-v0.8.0, git-v1.3.9, gitea-v1.3.10, gitops-v0.2.0, k8s-v0.2.0, kyberforge-v2.2.1, lint-v1.1.9, mattpocock-v0.4.0.
  4. scripts/tag-plugin-releases.sh --apply. Then, on the maintainer's explicit yes, push the exact printed tags.
  5. Verify:
    • git ls-remote --tags origin shows all 12 tags.
    • apm outdated on a consumer pinned to git-v1.3.8 reports git-v1.3.9. Also try the host/…/plugins/git#ref shorthand and record the apm version.

Follow-ups (separate issues)

  • Renovate on this Gitea: for hosts other than GitHub and GitLab, Renovate doesn't strip /plugins/<name>, so lookups against this Gitea will fail. Consumers need the overridePackageName packageRule in ADR-0033, which is untested. The real fix is an upstream Renovate PR.
  • Tag pushes and the delivery guard: plugins/delivery/.apm/hooks/guard.py doesn't gate tag pushes, so the approval requirement is enforced by instructions only.
  • apm bug to report upstream: over a static file-server git, apm installed the default branch while recording the pinned tag in the lock.
  • Verify stage: check release tags through a post-merge: assertion on PRs that bump a version.

🤖 Generated with Claude Code

https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi

Part of #223. The issue closes after the tags are pushed and the post-merge checks below pass. ## What and why Consumers that pin a plugin by ref have no tag to pin to. Each plugin has its own `version:`, but the only tags are repo-level `v*` tags. This PR adds annotated per-plugin release tags, `<plugin>-v<version>`, and a deterministic tool that cuts them. - **`scripts/tag-plugin-releases.sh`** and `tests/test-tag-plugin-releases.sh` (194 assertions). - **Where a tag goes:** on the version's *first landing*. That is the oldest commit on `main`'s first-parent history in the first run that carries the version, looking across the whole history. - **Released once:** a version is released once. A later revert back to it is reported `RELEASED` and gets no new tag. A version whose first landing is before the tagged range is also `RELEASED`. - **Dry run by default:** exit 0 means nothing is missing, 1 means tags are missing, 2 means an error or conflict. - **`--apply`:** creates the missing tags locally. It is all-or-nothing, and only runs when the ref is on `origin/main`'s first-parent history. - **Pushing:** the script prints an explicit `git push origin <tag> …` line, never `--tags`. It never pushes. - **Existing tags:** it never moves or overwrites one. A tag that is lightweight, or not on its version's first landing, is reported as an error. - **ADR-0033** records: - the tag form and target, timing (after merge), and that tags are immutable; - why no hook holds this: a pre-push hook on tag pushes can't fire under pre-commit's `_pre_push_ns`, and a hook on `main` would block everyone after every merge; - the push policy: after `--apply`, the agent shows the exact tags and pushes them only on the maintainer's explicit yes in the conversation; - the maintainer's way out when a version in history is invalid. - **ADR-0024** gets a forward note on rejected option 2. **`docs/spec/gates.md`** gets a section "Plugin release tags are not a gate". **README** gets the release steps. - **Root `apm.yml`:** `marketplace.build.tagPattern` → `{name}-v{version}`, and the catalogue goes 0.8.0 → 0.8.1 (repo policy requires a patch bump for a `build:` change). `marketplace.json` is regenerated. - **Version mismatch:** the root `.claude-plugin/plugin.json` is gitignored and read 0.4.1. - `apm pack` reads that file back ahead of `apm.yml` and only rewrites it with `--force`. So every release bundle shipped 0.4.1, along with the obsidian MCP server that had been removed. - It is now regenerated with `--force`, and the `.gitignore` comment is corrected. - **Delivery onboarding:** new `docs/agents/delivery.md`, in the delivery-repo-doc format. - **AGENTS.md:** a one-bullet release-tag rule for agents. - It covers fetch, run the script, `--apply`, and pushing only on an explicit yes. - Exit 2 means stop and report. - The script's OK means the tag is present locally, not published, so the agent confirms with `git ls-remote`. ## Validation - **`apm outdated` (apm 0.28.0):** tested against a synthetic monorepo served over git HTTP. A consumer pinned to `git-v1.3.8` reports `git-v1.3.9`, and decoy tags don't leak into the git row. - **Renovate's `apm` manager (≥ 44.153.0):** it scopes `<prefix>-v<x.y.z>` tags automatically. This comes from reading Renovate's source and tests; it was not run. - **Real repo:** a dry run against `origin/main` shows exactly 11 MISSING tags. In a clone, the one-off, then a full `--apply`, then a dry run gave 12 annotated tags and exit 0. - **Review:** 5 clean-context review rounds. The last one also ran a fuzz test over 60 random histories with reverts, non-bump edits, delete/re-add, and `--no-ff` merges. A dry run never exited 2 after a successful `--apply`. - **Pre-push hooks:** all pass, including run-tests, apm audit --ci, apm pack --check-clean and validate-marketplace. ## Non-blocking notes - **Duplicate error rows:** one misplaced tag inside the wanted range shows two ERROR rows. Cosmetic. - **Dry run on a feature-branch ref:** this can report ERROR for a tag that isn't reachable from it. Only `origin/main` is a documented ref. - **Older git:** merge-commit targets rely on `rev-list --first-parent -- <path>` keeping merges whose change came in from the second parent. Tested here (Case 1), but older git versions are unverified. - **Commit trailers:** commit `b3fd1f2` has a blank line inside its trailer block. - **`docs/agents/delivery.md` values need the maintainer's confirmation:** - human allowlist `Defame1297`, taken from `main`'s branch-protection approvals allowlist; - bot user `Claude`, inferred from who opens issues; - "Branch protection: in place"; - "Accepted risks: none". ## After merge 1. `git fetch origin --tags`. 2. One-off, so `apm outdated` can be verified: `scripts/tag-plugin-releases.sh --ref 32fbe39fb8923854ca8e743a0d2cad81720c736c --plugin git --apply`. This creates `git-v1.3.8` on the PR #135 merge. 3. `scripts/tag-plugin-releases.sh` (dry run). Expect these 11 MISSING: ansible-v0.1.0, bin-v3.0.0, core-v1.1.4, delivery-v0.8.0, git-v1.3.9, gitea-v1.3.10, gitops-v0.2.0, k8s-v0.2.0, kyberforge-v2.2.1, lint-v1.1.9, mattpocock-v0.4.0. 4. `scripts/tag-plugin-releases.sh --apply`. Then, on the maintainer's explicit yes, push the exact printed tags. 5. Verify: - `git ls-remote --tags origin` shows all 12 tags. - `apm outdated` on a consumer pinned to `git-v1.3.8` reports `git-v1.3.9`. Also try the `host/…/plugins/git#ref` shorthand and record the apm version. ## Follow-ups (separate issues) - **Renovate on this Gitea:** for hosts other than GitHub and GitLab, Renovate doesn't strip `/plugins/<name>`, so lookups against this Gitea will fail. Consumers need the `overridePackageName` packageRule in ADR-0033, which is untested. The real fix is an upstream Renovate PR. - **Tag pushes and the delivery guard:** `plugins/delivery/.apm/hooks/guard.py` doesn't gate tag pushes, so the approval requirement is enforced by instructions only. - **apm bug to report upstream:** over a static file-server git, apm installed the default branch while recording the pinned tag in the lock. - **Verify stage:** check release tags through a `post-merge:` assertion on PRs that bump a version. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
Claude added 10 commits 2026-11-27 19:08:59 +00:00
Consumers pinning a holocron package (Renovate's apm manager, apm
outdated) need a <plugin>-v<version> tag per plugin version; the
repo-level v* tags match no plugin. The script derives each wanted tag
from the ref's first-parent history of plugins/<p>/apm.yml, targeting the
commit where the version first landed on main.

It is a dry run by default (exit 1 when tags are missing); --apply
creates the missing tags locally and prints the push command. It never
pushes, fetches, moves, or deletes a tag.

Refs: #223

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
Every plugin version on main gets an annotated <plugin>-v<version> tag,
cut by scripts/tag-plugin-releases.sh after merge. No hook can enforce
it: merges via Gitea run no local hook, and pre-commit skips a pushed
tag on an already-pushed commit, so tagging is a maintainer step.

ADR-0024 gains a forward note that its rejected option 2, ground 2, is
now addressed; gates.md explains why tagging is not a gate, and README
lists the maintainer's post-merge steps.

Refs: #223

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
The marketplace build tagPattern now matches the per-plugin tags of
ADR-0033. Every entry has a local source:, so the compiled
marketplace.json is unchanged apart from the catalogue version bump.

The .gitignore comment for the root plugin.json now warns that apm pack
reads an existing copy back in preference to apm.yml, so releases must
be packed with --force.

Refs: #223

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
AGENTS.md gains a session rule: a merged plugin version bump gets its
release tag via scripts/tag-plugin-releases.sh, and pushing the tag is
the maintainer's action (ADR-0032, ADR-0033). docs/agents/delivery.md
onboards the repo to the delivery team: checks, test paths, human
allowlist, and credential boundary.

Refs: #223

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
A reverted bump left a run whose tag peeled to an earlier landing, which the
script reported as ERROR. Because --apply is all-or-nothing, that ERROR stayed
in the wanted set forever and blocked every other plugin's tag.

A version is now released once, at its first landing. A run whose tag peels to
an earlier run of the same version, or whose untagged version already appears
earlier in the wanted set, reports RELEASED with a note and never blocks other
rows. A tag on no landing of its version remains ERROR.

Also: preflight every new tag name with git check-ref-format; report the tags
already created, with their push line, and exit 2 if git tag fails mid-run;
reject whitespace in apm.yml name and version. New tests cover the revert,
in-set repeats, delete and re-add, an off-history tag, an invalid version in the
wanted set, origin/main default resolution, and --apply with --plugin and --ref.

Refs: #223

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
ADR-0033 said the git-v1.3.8 one-off could be cut "with --ref", which without
--plugin tags every plugin at that commit, and said an agent may run --apply
only when asked, contradicting AGENTS.md. It also did not cover a reverted
version, which the script now reports as RELEASED.

- ADR-0033: a version is released once, at its first landing (revert case);
  the one-off is the exact --ref <sha> --plugin git --apply command; agents run
  --apply locally after a bump merges and the maintainer pushes; hand or Gitea
  create_tag cuts are a maintainer path.
- AGENTS.md: agents cut release tags only with the script.
- delivery.md: Conventions bullets reduced to pointers, per the
  delivery-repo-doc format (section 6, no restating).

Refs: #223

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
A mis-cut tag could serve as the start point and silently drop the runs
before it: x-v9.9.9 or a lightweight x-v1.0.1 on a later landing hid an
untagged 1.1.0 and --apply succeeded. Every reachable <p>-v<semver> tag is
now validated (annotated, peels to a landing of its own version); an
invalid one is an ERROR row naming it, blocks --apply, and is never the
start point.

Also from review:
- --apply needs origin/main and a ref on it; no local-main fallback.
- A version with literal quotes is invalid, not stripped.
- Plugin dirs are listed NUL-separated; a leading-dash name exits 2.
- With no tags, the backfill starts at the current version's first
  landing, so a recurring version is released once, there (Case 2, 12d).
- expect_row ERE-escapes plugin and version.

ADR-0033 updated to match.

Refs: #223

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
An exit 2 from scripts/tag-plugin-releases.sh means a mis-cut tag or bad
input that only the maintainer may resolve; tags are immutable, so an
agent must never hand-fix, move or delete one.

Refs: #223
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
Why: a commit of an already-merged feature branch is an ancestor of
origin/main, so the ancestor check let --apply walk that branch's
first-parent history and tag a feature commit (git-v1.3.9 on 025ad4a).
A valid annotated tag on a later run of a recurring version was also
accepted as the start point, hiding the versions between its first
landing and that run.

Implementation Notes:
- --apply now requires the ref on origin/main's first-parent list;
  otherwise exit 2 and no tags.
- A tag must peel to the FIRST run of its version; one on a later run
  is an ERROR row and never the start point.
- apm.yml pathspecs use :(literal), so a plugin name is never a glob.
- Repeated --plugin values are de-duplicated (bash 3.2-safe).
- The printed push hint says the push runs only on the maintainer's
  explicit yes to that exact line.

Impact: tests cover all but the literal pathspec, which has no
observable effect on run grouping today and is defensive.

Refs: #223
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
Why: the maintainer decided the agent pushes release tags itself. A
pushed tag is an immutable release (an irreversible publish), so each
push still needs the maintainer's explicit yes in the conversation; the
approval, not who types the command, is the control.

Implementation Notes:
- ADR-0033 Decision: after --apply the agent shows the exact tags and
  the printed push line, and on an explicit yes runs exactly that
  `git push origin <tag>...` (never --tags, never other refs). The
  maintainer-only and free Propose-tier variants are recorded as
  rejected options.
- ADR-0033: --apply requires origin/main's first-parent history, and a
  tag on a later landing of its version is an error.
- AGENTS.md, README.md and gates.md state the same rule; exit 2 still
  means stop and report, never hand-fix, move or delete a tag.

Refs: #223
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
Defame1297 added 2 commits 2026-11-27 20:24:43 +00:00
Why: the untagged-run branch looked for an earlier run of a version only
from the start of the wanted range, while tag validation used the first
landing across all history. After a backfill, a revert to a pre-backfill
version was tagged on the revert commit, and the next dry run reported
that tag as a later landing: exit 2, blocking --apply for every plugin.

Implementation Notes:
- first_run() returns the first valid run of a version over the whole
  first-parent history; tag validation, the tagged-elsewhere check, the
  backfill start and the untagged-run check all use it.
- An untagged version whose first landing lies before the wanted range
  reports RELEASED with a "before the tagged range; not tagged" note; no
  tag is created and the exit code is unaffected.
- Preflight rejects a plugin name whose tag git check-ref-format refuses
  (e.g. a..b, a*) before any history is read, so a glob character never
  reaches a pathspec or ref pattern; tags are listed once and filtered by
  exact prefix instead of a for-each-ref glob.
- git rev-list failure and an empty run list now exit 2 with a FAIL
  message instead of being read as no history or crashing.
- The error footer addresses agents (stop and report, AGENTS.md) and the
  maintainer (fix by hand, ADR-0033) separately.

Impact: ADR-0033 defines first landing precisely, documents the preflight,
and documents the maintainer escape from an INVALID run (hand-cut tag on
the next valid version; --apply stays all-or-nothing). New tests cover the
revert repro, a backfill range holding a pre-range version, the INVALID
escape, rev-list failure/empty history, a glob plugin name, and the footer.

Refs: #223
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
tag-plugin-releases.sh reads local tags only, so a tag that --apply created
but nobody pushed reports OK and exit 0. Tell agents to confirm with
git ls-remote before calling the release done.

Refs: #223
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
Claude marked the pull request as ready for review 2026-11-27 20:25:14 +00:00
Defame1297 merged commit 8ffff54fbc into main 2026-11-27 20:36:38 +00:00
Defame1297 deleted branch feat/223-plugin-release-tags 2026-11-27 20:36:48 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Holocron#234