Compare commits

...
35 Commits
Author SHA1 Message Date
Defame1297 8ffff54fbc Merge pull request 'feat(release): tag each plugin release as <plugin>-v<version>' (#234) from feat/223-plugin-release-tags into main
Reviewed-on: #234
2026-11-27 20:36:32 +00:00
Defame1297andClaude Opus 5.5 6dc081793c docs(agents): check the remote before treating a release tag as published
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
2026-11-27 19:53:11 +00:00
Defame1297andClaude Opus 5.5 62650543ec fix(scripts): use one whole-history first landing for release tags
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
2026-11-27 19:25:16 +00:00
Defame1297andClaude Opus 5.5 0a52c8597d docs(adr): let the agent push release tags on explicit approval
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
2026-11-27 18:35:12 +00:00
Defame1297andClaude Opus 5.5 03bacd6e5a fix(scripts): gate --apply on main's first-parent line and reject later-landing tags
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
2026-11-27 18:34:20 +00:00
Defame1297andClaude Opus 5.5 c8853c7a44 docs(agents): stop and report on a release-tag script exit 2
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
2026-11-27 18:14:36 +00:00
Defame1297andClaude Opus 5.5 b3fd1f2f0c fix(scripts): validate every release tag and gate --apply on origin/main
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
2026-11-27 18:14:23 +00:00
Defame1297andClaude Opus 5.5 b3cdcc9bbb docs(adr): align ADR-0033, AGENTS.md and delivery.md on release tags
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
2026-11-27 17:56:27 +00:00
Defame1297andClaude Opus 5.5 f677698887 fix(scripts): release a recurring version once, at its first landing
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
2026-11-27 17:55:47 +00:00
Defame1297andClaude Opus 5.5 8b54a60fc8 docs(agents): add the release-tag rule and delivery onboarding doc
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
2026-11-27 17:41:12 +00:00
Defame1297andClaude Opus 5.5 227d8f09a0 chore(apm): switch tagPattern to {name}-v{version} and bump catalogue to 0.8.1
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
2026-11-27 17:41:02 +00:00
Defame1297andClaude Opus 5.5 32d81b32d2 docs(adr): record ADR-0033 plugin release tags as <plugin>-v<version>
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
2026-11-27 17:40:51 +00:00
Defame1297andClaude Opus 5.5 bc53b98d61 feat(scripts): add tag-plugin-releases.sh to cut per-plugin release tags
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
2026-11-27 17:40:39 +00:00
Defame1297 4722cfc14f Merge pull request 'chore(apm): update lock to Holocron main 92d39ae' (#233) from chore/apm-lock-update-92d39ae into main
Reviewed-on: #233
2026-11-27 16:39:36 +00:00
Defame1297andClaude Opus 5.5 7a3c287c56 chore(apm): update lock to Holocron main 92d39ae
Re-resolve the first-party dependencies to main after #232 so the
deployed skills carry the BOM escape fix and apm audit stops flagging
them.

Refs #208

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-27 16:23:45 +00:00
Defame1297 92d39ae1f9 Merge pull request 'fix(skills): write BOMs as escape sequences so apm audit stops flagging them' (#232) from fix/apm-hidden-chars-208 into main
Reviewed-on: #232
2026-11-27 16:18:46 +00:00
Defame1297andClaude Opus 5.5 7b13285666 test(adr0020): write the BOM fixture as an escape sequence
tests/test-adr0020-frontmatter.sh held a literal U+FEFF in its 'bom'
fixture, which apm audit flags as a hidden character. Write it as the
Python backslash-ufeff escape instead; the test still passes (36/36).

Refs #208

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-27 15:38:12 +00:00
Defame1297andClaude Opus 5.5 644c9d7f08 fix(skills): write BOMs as escape sequences so apm audit stops flagging them
The validate-adapter.bats fixtures and factory-audit's strip_bom held
literal U+FEFF characters, which apm audit reports as hidden characters
on every install. Replace each with the Python backslash-ufeff escape;
behaviour is unchanged (fixtures still emit EF BB BF, all 349 bats tests
pass).

Bump factory-audit to 1.0.7 (ADR-0022); provider-adapter-author's change
is under tests/, which the bump gate ignores.

Refs #208

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-27 14:48:15 +00:00
Defame1297 af2eea2bab Merge pull request 'chore(apm): update lock to Holocron main 6a48774' (#231) from chore/apm-lock-update into main
Reviewed-on: #231
2026-11-27 13:32:24 +00:00
Defame1297andClaude Opus 5.5 3941b109f7 chore(apm): update lock to Holocron main 6a48774
Re-resolve first-party dependencies with apm update; all Holocron
plugins now pin 6a48774 (delivery 0.3.0 -> 0.8.0).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-27 13:15:54 +00:00
Defame1297 6a48774e84 Merge pull request 'fix(hooks): scrub git env before apm pre-push hooks run' (#229) from fix/apm-audit-git-env into main
Reviewed-on: #229
2026-11-27 08:04:30 +00:00
Defame1297 2c6e82747c Merge branch 'main' into fix/apm-audit-git-env 2026-11-27 08:04:05 +00:00
Defame1297 5dc924e0f7 Merge pull request 'fix(scripts): discover agents when the checkout is a Claude worktree' (#228) from fix/worktree-agent-discovery into main
Reviewed-on: #228
2026-11-27 08:03:58 +00:00
Defame1297andClaude Opus 5.5 190d9fb322 fix(hooks): keep git -c overrides when scrubbing apm's git env
Why: the `git rev-parse --local-env-vars` loop in clean-git-env.sh also
unset GIT_CONFIG_PARAMETERS / GIT_CONFIG_COUNT, silently dropping `git -c`
overrides (extraHeader, credentials, safe.directory) that apm's remote
clones may need. Only the repo-locating vars caused #204.

Implementation Notes:
- clean-git-env.sh now unsets an explicit list only: GIT_DIR,
  GIT_WORK_TREE, GIT_INDEX_FILE, GIT_OBJECT_DIRECTORY, GIT_COMMON_DIR,
  GIT_PREFIX, GIT_IMPLICIT_WORK_TREE; gates.md updated to match.
- apm-pack-check-clean.sh points at the real gates.md paragraph.
- run-tests.sh's comment now says git exports GIT_DIR to hooks only from
  a linked worktree, matching LESSONS.md.
- test-apm-hooks-git-env.sh isolates from global/system git config.
- Reflow the "Two of these shell out to apm" paragraph in gates.md.

Refs #204

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-26 23:35:31 +00:00
Defame1297andClaude Opus 5.5 f2c483ca2c fix(hooks): scrub git env before apm pre-push hooks run
Why: git push from a linked worktree exports an absolute
GIT_DIR=<main>/.git/worktrees/<name> to its hooks. apm audit --ci's drift
replay (apm 0.28.0) runs git init / git checkout in a temp dir with an env
copied from os.environ, so the inherited GIT_DIR won: init wrote
core.bare=true into the shared .git/config and checkout moved the worktree's
HEAD to the lock-pinned commit. tests/run-tests.sh already scrubbed these
vars for itself; the apm hooks never pass through it.

Implementation Notes:
- scripts/lib/clean-git-env.sh unsets GIT_DIR, GIT_WORK_TREE,
  GIT_INDEX_FILE, GIT_OBJECT_DIRECTORY, GIT_COMMON_DIR, then everything
  git rev-parse --local-env-vars lists (a superset).
- scripts/apm-audit-ci.sh sources it; apm-pack-check-clean now runs via
  the new scripts/apm-pack-check-clean.sh wrapper, which sources it too.
- tests/test-apm-hooks-git-env.sh runs both hooks from a linked worktree
  of a throwaway repo against a stub apm that runs git init/checkout in a
  temp dir, asserting core.bare stays false, the worktree keeps its
  branch, and apm sees no GIT_DIR.
- LESSONS.md gets the incident entry and a correction to 2026-11-13: git
  exports GIT_DIR to hooks only from a linked worktree. gates.md documents
  the scrubbed env.

Fixes #204

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-26 23:21:41 +00:00
Defame1297andClaude Opus 5.5 bc7673d4f0 fix(scripts): discover agents when the checkout is a Claude worktree
check-apm-agents-valid.sh filtered find output with
`-not -path '*/.claude/worktrees/*'`, matched against absolute paths.
When the checkout itself lives at <repo>/.claude/worktrees/<name>/,
every path contains that segment, so every agent file was excluded
and the gate reported "N of N tracked agent files were not discovered".

The walk starts at $REPO_ROOT/plugins, so a nested worktree is
unreachable and the filter is dropped. The test suite gains a case that
runs the gate from a fixture under .claude/worktrees/, and now unsets
inherited GIT_* variables so its git fixtures never resolve to the
caller's repository.

Fixes #199

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-26 22:31:05 +00:00
Defame1297 bf86679d42 Merge pull request 'feat(delivery): read a failing dry-run-gated check as a human gate' (#226) from feat/delivery-gated-failure into main
Reviewed-on: #226
2026-11-26 18:58:00 +00:00
Defame1297andClaude Opus 5.5 0d53fc6981 chore(marketplace): record delivery 0.8.0
The guard hook is unchanged; the executables.allow key and the
regenerated marketplace.json follow the package version bump.

Refs: #225

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-26 18:40:49 +00:00
Defame1297andClaude Opus 5.5 244f4de1bd feat(delivery): read a failing dry-run-gated check as a human gate
A gated dry run fails on purpose while it awaits its label, and no bot
commit can satisfy a gate that needs a fresh human label per push, so
sending its failure to the implementer loops. delivery-ci-checks now
classifies a failure, error or warning on a dry-run-gated check as
gated-failure: passing, never waited on, with its job link and one-line
log cause. The Awaiting gate line becomes Human gate, carrying each
check's state. The 0.7.0 rule ignoring skipped statuses on a gated
check is unchanged.

qa never fails on a gated-failure and reads dry-run output only on
success; its human-gate line feeds the implement lead's Open questions.
Review check 7 records a gated-failure as a non-blocking finding for
the approver. The format's dry-run-gated definition is loosened to
allow a failing status before the label.

Refs: #225

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-26 18:40:47 +00:00
Defame1297 e3d4219323 Merge pull request 'docs(adr): amend ADR-0032 with the pre-merge Ansible dry run' (#222) from docs/adr-0032-ansible-dry-run into main
Reviewed-on: #222
2026-11-25 16:53:26 +00:00
Defame1297andClaude Opus 5.5 82491b073f docs(adr): amend ADR-0032 with the pre-merge Ansible dry run
The reopened Ansible --check --diff now runs in CI from the base
branch's copy (pull_request_target) with production credentials:
automatic on human-authored PRs, gated on bot PRs by an allowlisted
human's Dry run label, renewed per push. Secrets carries the full
rule; Enforcement layers keeps a short version pointing there.

The gated-run rejection in Considered Options narrows to ungated runs
on bot PRs, and human PRs running PR code against production before
approval becomes an accepted risk.

Refs: #219, #200

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-25 16:35:10 +00:00
Defame1297 1f24556833 Merge pull request 'feat(delivery): add the dry-run-gated role and allow several dry runs' (#221) from feat/delivery-dry-run-gated into main
Reviewed-on: #221
Reviewed-by: Defame1297 <[email protected]>
2026-11-25 11:50:37 +00:00
Defame1297andClaude Opus 5.5 42301cf38e fix(delivery): close the skipped-gate hole in dry-run-gated
A gated workflow whose job-level label condition is unmet posts
skipped, and a later label event on the same SHA posts a newer skipped
that would mask an earlier gated failure. delivery-ci-checks now
ignores skipped statuses for a dry-run-gated check and takes the latest
of the rest, reading none as awaiting-gate. The format exempts
dry-run-gated from the skipped-passes rule and requires the workflow
to run only on its named gate label; the gatherer confirms that filter
and takes a gated check's name from the forge or lists it as open.

The review's awaiting-gate finding links the PR's files view, the
implement lead and delivery-handoff name the gated dry run's label as
human-only, and qa's and the lead's restatements are trimmed.

Refs: #218

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-25 09:22:36 +00:00
Defame1297andClaude Opus 5.5 a96b6134a5 chore(marketplace): record delivery 0.7.0
The guard hook is unchanged; the executables.allow key and the
regenerated marketplace.json follow the package version bump.

Refs: #218

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-25 08:58:13 +00:00
Defame1297andClaude Opus 5.5 6cb27a576d feat(delivery): add the dry-run-gated role and allow several dry runs
A repo's CI checks may now list one or more dry-run checks and any
number of dry-run-gated ones: a dry run that posts its status only
after an allowlisted human adds a label. delivery-ci-checks classifies
a gated check with no status on the pinned SHA as awaiting-gate, which
passes the verdict, is never waited on, and is reported on its own
Awaiting gate line. qa never fails on it, the implement lead notes it
in the Handoff's Open questions, and the review records it as a
non-blocking finding for the approver. No agent sets the gate label.

Refs: #218

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-25 08:58:03 +00:00
39 changed files with 2282 additions and 130 deletions

No files matched your search

+2 -2
View File
@@ -1,7 +1,7 @@
{
"name": "holocron",
"description": "AI development skills for Claude Code, and for GitHub Copilot through apm — factory, design, implement, review, and cross-cutting workflows.",
"version": "0.8.0",
"version": "0.8.1",
"owner": {
"name": "Mortis",
"url": "https://git.rkdr.net/Mortis/"
@@ -59,7 +59,7 @@
{
"name": "delivery",
"description": "Agents and skills for taking a change from spec to a verified merge through tracker-gated stages.",
"version": "0.6.0",
"version": "0.8.0",
"category": "Developer Tools",
"source": "./plugins/delivery"
},
+4 -1
View File
@@ -53,7 +53,10 @@ build/
# `apm pack`'s manifest for the *root* package. Emitted beside the marketplace
# manifest by a bare `apm pack`, and never tracked on any branch — the repo's
# own paths hide it, since the apm-pack-check-clean pre-push hook, the only
# thing that runs pack here, passes --dry-run. Scoped
# thing that runs pack here, passes --dry-run. It is NOT write-only output:
# pack reads an existing copy back in preference to apm.yml and only rewrites
# it with --force, so a stale copy leaks an old version and config into every
# bundle. Pack releases with `apm pack --force`, or delete this file first. Scoped
# to the file, not the directory: the sibling .claude-plugin/marketplace.json is
# compiled output that IS committed and must stay tracked.
/.claude-plugin/plugin.json
+2 -2
View File
@@ -173,8 +173,8 @@ repos:
- id: apm-pack-check-clean
name: apm pack --check-clean
description: Release gate -- verify .claude-plugin/marketplace.json still matches what apm.yml + .apm/ would currently generate, and that per-package versions agree with the per_package versioning strategy. Closes issue #90's deferred item 3 (a check-clean-equivalent gate) using apm's own flag instead of custom drift logic.
entry: apm pack --check-versions --check-clean --dry-run
description: Release gate -- verify .claude-plugin/marketplace.json still matches what apm.yml + .apm/ would currently generate, and that per-package versions agree with the per_package versioning strategy. Closes issue #90's deferred item 3 (a check-clean-equivalent gate) using apm's own flag instead of custom drift logic. Runs via scripts/apm-pack-check-clean.sh so apm gets a scrubbed env (issue #204).
entry: scripts/apm-pack-check-clean.sh
language: system
stages: [pre-push]
pass_filenames: false
+5
View File
@@ -31,6 +31,7 @@ Fall back to raw shell only when no skill covers it.
- **`apm.lock.yaml` turning up modified is expected, not a bug.** kyberforge's `SessionStart` hook keeps the install current on launch and rewrites the lock in the process (ADR-0019). On `main`, commit or discard it deliberately. On a feature branch, discard it (`git checkout -- apm.lock.yaml`, then `apm install`). This keeps unrelated lock churn out of the branch diff and keeps `apm pack --check-clean` consistent with the committed lock. The session then runs the older `main` that the lock records, which is accepted on a branch, and the next session start refreshes again.
- **A `.apm/` edit is not live until it is on the remote's `main`.** Root `apm.yml`'s first-party dependencies resolve from the holocron remote, unpinned against the default branch, so pushing a feature branch does not deploy it (ADR-0019). `apm install` deploys from the lock; `apm update` is what re-resolves refs.
- **No pre-push hook needs the network — once `apm install` has run.** Root `apm.yml`'s marketplace has no remote package entries, so every hook resolves locally. The guarantee is a property of a populated `apm_modules/`, not of the hook set: on a fresh clone `apm-audit-ci`'s `deployed-files-present` fails outright, and its `drift` and `config-consistency` install-replays have no cache to replay from and clone from the remote. Run `apm install` once on a new checkout and the offline guarantee holds from then on (`docs/spec/gates.md`, "Pushing without a network").
- **A plugin `version:` bump that has merged to `main` gets its release tag.** Run `git fetch origin --tags`, then `scripts/tag-plugin-releases.sh`; exit 1 means a tag is missing, and `--apply` creates it locally and prints the push command. The script reads local tags only, so OK means present locally, not published: confirm with `git ls-remote --tags origin '<plugin>-v*'` before calling it done. A tag push is an irreversible publish, not a free Propose-tier push (ADR-0032): show the maintainer the exact tags and that command, and only on their explicit yes in this conversation run exactly it yourself (named tags, never `--tags` or other refs). Agents cut release tags only with the script, which never moves or deletes one; exit 2 means stop and report it to the maintainer, never hand-fix, move or delete a tag (ADR-0033).
- **This repo and Gitea are the only source of truth.** All project state, decisions, and working conventions live here. Do not use an external memory system for this project — cached state diverges from the repo and you get a split brain. Before answering any design or architecture question, check `docs/adr/` for an existing decision.
## Key documents
@@ -63,3 +64,7 @@ Default five roles, mapped onto Gitea's `Status/*` and `Reviewed/*` labels. See
### Domain docs
Single-context: `GLOSSARY.md` and `docs/adr/` at the repo root. See `docs/agents/domain.md`.
### Delivery
- Delivery team facts (checks, test paths, human allowlist, credential boundary): `docs/agents/delivery.md`
+7 -1
View File
@@ -144,8 +144,14 @@ The guard added above (`tests/test-no-pipefail-early-exit-grep.sh`) reported the
## 2026-11-13 — Hook-exported GIT_DIR turned test fixtures loose on the real repo
Under the `run-tests` pre-push hook, git exports `GIT_DIR` to the hook, so a bats fixture's `git -C "$tmp" init/commit/update-ref` hit this repo instead of its temp dir: 84 failures, `core.bare=true` and an emptied index on every push. The 2026-07-05 "repo root is a bare checkout" entry was likely this bug's symptom, not the repo's real shape. Fix: `tests/run-tests.sh` unsets git's repo-locating env vars before any suite runs. Rule: a test that builds its own repo must never inherit the caller's git environment.
Under the `run-tests` pre-push hook, git exported `GIT_DIR` to the hook, so a bats fixture's `git -C "$tmp" init/commit/update-ref` hit this repo instead of its temp dir: 84 failures, `core.bare=true` and an emptied index on every push. The 2026-07-05 "repo root is a bare checkout" entry was likely this bug's symptom, not the repo's real shape. Fix: `tests/run-tests.sh` unsets git's repo-locating env vars before any suite runs. Rule: a test that builds its own repo must never inherit the caller's git environment.
*Corrected 2026-11-26 (#204):* git exports `GIT_DIR` to hooks only when the push runs from a **linked worktree**, where it is the absolute `<main>/.git/worktrees/<name>`. From the main checkout it exports none. So the bug reproduces only on pushes from a worktree.
## 2026-11-22 — A local-path install skips the validation a remote install runs
#205 shipped `ansible` and `k8s` as `apm.yml`-only skeletons after a scratch consumer installed all four new packages from `../pkgs/<name>` with exit 0. Fetched from the remote, the same packages fail: apm accepts a remote subdirectory only when it has `.apm/`, declared dependencies or a `skills/` bundle (`detect_package_type` in `apm_cli/models/validation.py`). `gitops` failed too, through its dependency on `k8s`. So `main` published uninstallable packages until #206 added `.apm/.gitkeep`. A green local-path install says nothing about whether consumers can install. Fix: before merging a new or restructured package, push the branch and install it with `git:`/`path:`/`ref: <branch>`, or run `validate_apm_package` on a `git archive` export. `file://` URLs are rejected in the object form, so they can't stand in for the remote.
## 2026-11-26 — A hook's GIT_DIR leaks through any tool that runs git
#204: pushing from a linked worktree left the shared `.git/config` with `core.bare=true` and the worktree on a detached HEAD at the lock-pinned commit. git exports an absolute `GIT_DIR` to hooks run from a linked worktree. `apm-audit-ci` ran `apm audit --ci`, and its drift replay (apm 0.28.0) runs `git init` and `git checkout` in a temp dir with an env copied from `os.environ`. The inherited `GIT_DIR` won, so both operations hit this repo instead of the temp dir. The 2026-11-13 fix did not cover this: it scrubbed the env only inside `tests/run-tests.sh`, and the apm hooks never pass through that file. Fix: `scripts/lib/clean-git-env.sh` unsets the repo-locating vars, and both `scripts/apm-audit-ci.sh` and the new `scripts/apm-pack-check-clean.sh` source it before calling apm. `tests/test-apm-hooks-git-env.sh` reproduces the leak with a stub `apm`. Rule: any hook that shells out to a tool that runs git must scrub `GIT_*` first. Scrubbing one entry point does not protect the others.
+9
View File
@@ -99,6 +99,15 @@ See [`docs/spec/gates.md`](docs/spec/gates.md) for what each hook enforces and w
Full model, including what's exempt and why: [`docs/spec/architecture.md`](docs/spec/architecture.md).
**After merging a plugin version bump:**
1. Run `git fetch origin --tags`.
2. Run `scripts/tag-plugin-releases.sh` (a dry run) and read the table.
3. Run `scripts/tag-plugin-releases.sh --apply`.
4. Run the `git push origin <tag>…` line it prints.
An agent may run all four steps, but it runs step 4 only after the maintainer explicitly approves those exact tags in the conversation: a pushed tag is an immutable release. Tags are never moved or re-cut. Details are in [ADR-0033](docs/adr/0033-plugin-releases-are-tagged-plugin-v-version.md).
## For external consumers
Consume the packages through apm, the way this repo does — declare them as `dependencies.apm` git+path entries against the holocron remote and run `apm install`. apm is the only supported install path.
+454 -38
View File
@@ -1,11 +1,11 @@
lockfile_version: '1'
generated_at: '2026-11-23T18:19:20.581087+00:00'
generated_at: '2026-11-27T16:22:59.651797+00:00'
apm_version: 0.28.0
dependencies:
- repo_url: Mortis/Holocron
name: ansible
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
resolved_commit: 92d39ae1f92a282de39217af34763c8e237defac
version: 0.1.0
virtual_path: plugins/ansible
is_virtual: true
@@ -15,7 +15,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: bin
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
resolved_commit: 92d39ae1f92a282de39217af34763c8e237defac
version: 3.0.0
virtual_path: plugins/bin
is_virtual: true
@@ -52,7 +52,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: core
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
resolved_commit: 92d39ae1f92a282de39217af34763c8e237defac
version: 1.1.4
virtual_path: plugins/core
is_virtual: true
@@ -101,19 +101,28 @@ dependencies:
.claude/skills/provider-adapter-author/scripts/README.md: sha256:79095c5be4c3abc937053f1a0977fb6cf737111061fde561973c81f8e2192529
.claude/skills/provider-adapter-author/scripts/validate-adapter.sh: sha256:aff693f69b987fe74a5d4c60368118dae7595c087d0de9691f5905e62ae3e1c9
.claude/skills/provider-adapter-author/tests/README.md: sha256:1b9dca7d09a654d6f2701bb20a9ecbd2dc774961eee166e3723f5c72f0435e7a
.claude/skills/provider-adapter-author/tests/validate-adapter.bats: sha256:1f9a3c193a2d1af6e180cdad48d8841c90b82144fbdf47cfa16bb209e771d0e9
content_hash: sha256:ad6e9380c1db6900c8e9d436dcb16b61621292d681e435ba4b47ca3a574d6835
.claude/skills/provider-adapter-author/tests/validate-adapter.bats: sha256:816bd407304abcc876d0bb2923a889bd151bae1403367e05f35659d7a9fa4281
content_hash: sha256:c829bf9d88368f0fe751c8a2163aaca3c80fc74fc1dabe412fd5b1316a54b17d
declared_license: MIT
- repo_url: Mortis/Holocron
name: delivery
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
version: 0.3.0
resolved_commit: 92d39ae1f92a282de39217af34763c8e237defac
version: 0.8.0
virtual_path: plugins/delivery
is_virtual: true
package_type: apm_package
deployed_files:
- .claude/agents/delivery-implement-lead.md
- .claude/agents/delivery-implementer.md
- .claude/agents/delivery-operator.md
- .claude/agents/delivery-qa.md
- .claude/agents/delivery-reviewer.md
- .claude/agents/delivery-test-author.md
- .claude/hooks/delivery/.apm/hooks/guard.py
- .claude/skills/delivery-ci-checks
- .claude/skills/delivery-ci-checks/SKILL.md
- .claude/skills/delivery-ci-checks/references/statuses.md
- .claude/skills/delivery-handoff
- .claude/skills/delivery-handoff/SKILL.md
- .claude/skills/delivery-handoff/references/gates.md
@@ -122,21 +131,64 @@ dependencies:
- .claude/skills/delivery-repo-doc/SKILL.md
- .claude/skills/delivery-repo-doc/references/format.md
- .claude/skills/delivery-repo-doc/references/gathering.md
- .claude/skills/delivery-review
- .claude/skills/delivery-review/SKILL.md
- .claude/skills/delivery-review/references/checklist.md
- .claude/skills/delivery-review/references/review-body.md
- .claude/skills/delivery-test-first
- .claude/skills/delivery-test-first/SKILL.md
- .claude/skills/delivery-test-first/references/dispute.md
- .claude/skills/delivery-test-first/references/first-run.md
- .claude/skills/delivery-test-first/references/output-template.md
- .claude/skills/delivery-verify
- .claude/skills/delivery-verify/SKILL.md
- .claude/skills/delivery-verify/references/already-reverted.md
- .claude/skills/delivery-verify/references/apply-wait.md
- .claude/skills/delivery-verify/references/attribution.md
- .claude/skills/delivery-verify/references/inputs.md
- .claude/skills/delivery-verify/references/post-merge-ci.md
- .claude/skills/delivery-verify/references/report.md
- .claude/skills/delivery-verify/references/revert.md
- .claude/skills/delivery-verify/references/tiers.md
deployed_file_hashes:
.claude/agents/delivery-implement-lead.md: sha256:267a62e34e31162253c12650d89788fb4bdc0f89ed7960a16aa2f6a35619b373
.claude/agents/delivery-implementer.md: sha256:57bddd326f4b9e774d80c75bddf9a7c7bc41d09a0f8b0417454a7298958efe4b
.claude/agents/delivery-operator.md: sha256:64292bfd67db6ef30a645fd7d24961f191c5fe2310157187968d012368e55911
.claude/agents/delivery-qa.md: sha256:0645ea46a448d35f6790824c6a4458d3d7669fb65be017b7708487664a9f554b
.claude/agents/delivery-reviewer.md: sha256:0326cd9722e7fcc970f35416d2229e23761ad4b9b35adb71781e78513f2c33c3
.claude/agents/delivery-test-author.md: sha256:f94967c3057d5e18c465597c37bcaf9f53568a395da4401e2b43902546db5e43
.claude/hooks/delivery/.apm/hooks/guard.py: sha256:2b84958d8d2ab1c3a17e8857d9797e9535b25a8c36b40cc9d34537df0c4a446b
.claude/skills/delivery-handoff/SKILL.md: sha256:b64b4805801e065755ad371d6a7b8e7e9f9a593551e057e5ebc5cc03dd594c41
.claude/skills/delivery-handoff/references/gates.md: sha256:05a45c5c9998cbb53fa3ed3166f83c2600e963a0f7959a0c61b4926342ad2dbf
.claude/skills/delivery-handoff/references/handoff-comment.md: sha256:f51d89d240e482bb4f5bf46cce91bc342e6c04f9ab24d252aa71baa1e6650448
.claude/skills/delivery-repo-doc/SKILL.md: sha256:cc71914171ef77d1d89e701f616bdc27a03429a3c3843eaac141c824423702e7
.claude/skills/delivery-repo-doc/references/format.md: sha256:b8c0913e9e6b2cec59be05cc73caeb01af95bcaba126bf3717b0c2bf6130cb2d
.claude/skills/delivery-repo-doc/references/gathering.md: sha256:91a00a8e4581f218ef15a67f23954b6731540475432127467cb5a4e76ed36dc9
content_hash: sha256:c168bb54e6a0b352a91cd2b76c34f6d814968043993915f08a976ed8f65dd643
.claude/skills/delivery-ci-checks/SKILL.md: sha256:a962a775e958a1f9e8f159592e496358881d38abd0667101c1f70b0874f482d1
.claude/skills/delivery-ci-checks/references/statuses.md: sha256:fa0282259eb662cb199eb1c8647fa55ff76299be03b132d6964ba5b771de8131
.claude/skills/delivery-handoff/SKILL.md: sha256:ce213d24845455eaf1d230fb5d2c932c12a59a1d584b538793b5667704c7c45a
.claude/skills/delivery-handoff/references/gates.md: sha256:31c1616ae9f1fedc30e8077a26f06f25e9dfc65bf0ee3bd09951935f20d78a6c
.claude/skills/delivery-handoff/references/handoff-comment.md: sha256:11cbc8f569663f597a1c09de3b60c0d0b89e9d5c3aacd64567a146f0b3261f17
.claude/skills/delivery-repo-doc/SKILL.md: sha256:5d62bb69b43a60a9a51308629518457b679ecbd0574cb015ade24a6d45978fd6
.claude/skills/delivery-repo-doc/references/format.md: sha256:eceb256a4922f4875c086a1bc2063ee7c8a46e44738865df01faa6e9efbee46a
.claude/skills/delivery-repo-doc/references/gathering.md: sha256:3d830012c11c25b97c10c067277d773ebaa0a4b8c1b1332ea022ff2f9ed9f00e
.claude/skills/delivery-review/SKILL.md: sha256:3e540399fc23bd334e99c03a4a4605de7271c7b739cf66593859f1206dd38895
.claude/skills/delivery-review/references/checklist.md: sha256:da2285d14bc6e284110daf863622f5368cce8f94023b9f49d6ec06416ab15cc5
.claude/skills/delivery-review/references/review-body.md: sha256:a12637fdad4057f7700d2a787edb0fd9b6f9a3b18364786fe845bb387e8998e7
.claude/skills/delivery-test-first/SKILL.md: sha256:b53a3566366545d86387c4becf4b59725fd9918f0feabef033bd0220c58d6984
.claude/skills/delivery-test-first/references/dispute.md: sha256:25dbd7334fac3187009cdbac3c97cf9f6b5be7ae4b7e522b6afdf5594f9dd491
.claude/skills/delivery-test-first/references/first-run.md: sha256:096002542e9c4bc33c770173e88a94c3e8b3e0e9b03d6e503aaf5a1144d84a87
.claude/skills/delivery-test-first/references/output-template.md: sha256:dc9ae943f9aff94532ce65bc0158eced2563ba8399b0e3720e36f5025ffa3b66
.claude/skills/delivery-verify/SKILL.md: sha256:c6a17ac285093060e623214028c46c8c70869da1944708e2161dc978aaa81461
.claude/skills/delivery-verify/references/already-reverted.md: sha256:34dad5ce2f7dd2de0bd7dd889ad86fbf7ae070e59d826a73a6cdd04a46804ca0
.claude/skills/delivery-verify/references/apply-wait.md: sha256:e5746a1d1369cd570db55597b139f82e6001f9e4dab3adfe7d03c3be75a63f94
.claude/skills/delivery-verify/references/attribution.md: sha256:e10b928d976153b41969be2b9d9a29c0ad2979631869528d4de4db11612b52ea
.claude/skills/delivery-verify/references/inputs.md: sha256:3a4619b42b00425eb0c13a34c19e1ccebf41140f564c3ada29307544404e45c7
.claude/skills/delivery-verify/references/post-merge-ci.md: sha256:1f7e387c64c5a61f01bf0ec09ea5e32cbfb34f505b7f2aca70e413cfea92dc84
.claude/skills/delivery-verify/references/report.md: sha256:1bec37e1358d5a56f347e32ca996c693d2f785e7c833f5c6351b6c07380b7e89
.claude/skills/delivery-verify/references/revert.md: sha256:d046d1a8f58ac2c41b084a7e669315ec8a6aebcbf86583355db07dd60260c3bb
.claude/skills/delivery-verify/references/tiers.md: sha256:28193c90454e4c000f8502155de00e974ce1ffa5db81d7315c23aced67594bdc
content_hash: sha256:1fc3a907eb0f008ce770b9e021b52f59d4d27f068ea9246e4033c8d1679af63c
declared_license: MIT
exec_status: deployed
- repo_url: Mortis/Holocron
name: git
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
resolved_commit: 92d39ae1f92a282de39217af34763c8e237defac
version: 1.3.9
virtual_path: plugins/git
is_virtual: true
@@ -251,7 +303,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: gitea
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
resolved_commit: 92d39ae1f92a282de39217af34763c8e237defac
version: 1.3.10
virtual_path: plugins/gitea
is_virtual: true
@@ -336,27 +388,49 @@ dependencies:
- repo_url: Mortis/Holocron
name: gitops
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
version: 0.1.0
resolved_commit: 92d39ae1f92a282de39217af34763c8e237defac
version: 0.2.0
virtual_path: plugins/gitops
is_virtual: true
package_type: apm_package
content_hash: sha256:eef076b31b940b7d57620b9f13500c72b19ad0cee53a87d326179c3915e0b5a4
deployed_files:
- .claude/skills/flux-diagnose
- .claude/skills/flux-diagnose/SKILL.md
- .claude/skills/flux-diagnose/references/applied-check.md
- .claude/skills/flux-diagnose/references/diagnose.md
- .claude/skills/flux-diagnose/references/sources.md
- .claude/skills/flux-diagnose/references/status.md
deployed_file_hashes:
.claude/skills/flux-diagnose/SKILL.md: sha256:01567823494e33ed28a22182ea1fb17e8835ee39d703b292a09c5155d1a82b12
.claude/skills/flux-diagnose/references/applied-check.md: sha256:938c57da30d1d1211402e1b81cb724c2d68aad25cb44c3aeadb4e07511a74bf6
.claude/skills/flux-diagnose/references/diagnose.md: sha256:3a1107f7360c83925e4a0ab2f3716e1eedb3ada8ee8c019f3beac3c37b394fd5
.claude/skills/flux-diagnose/references/sources.md: sha256:f65732f82e8b55176f26820fb82853747b3339d59adbc7bb9e657502ebe8af52
.claude/skills/flux-diagnose/references/status.md: sha256:1fe6b0232259ba77e41da09ed306b1b11ffaffa0dd87609c7b4e047a78c0f27d
content_hash: sha256:2ffbaa38ea892ed7a68227178584c9742c6a81da50c914dc957bb53bad2099f8
declared_license: MIT
- repo_url: Mortis/Holocron
name: k8s
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
version: 0.1.0
resolved_commit: 92d39ae1f92a282de39217af34763c8e237defac
version: 0.2.0
virtual_path: plugins/k8s
is_virtual: true
package_type: apm_package
content_hash: sha256:606f68599dd005ca901e593904401e2ac59975df63d4935bc85ef5be95841ca0
deployed_files:
- .claude/skills/k8s-diagnose
- .claude/skills/k8s-diagnose/SKILL.md
- .claude/skills/k8s-diagnose/references/sources.md
- .claude/skills/k8s-diagnose/references/symptoms.md
deployed_file_hashes:
.claude/skills/k8s-diagnose/SKILL.md: sha256:996186466fa3f50b26e1f203d61662e55f75737b9803e42501d42c0e314c6fc2
.claude/skills/k8s-diagnose/references/sources.md: sha256:080b67d225be56cf49f12ac9f79618554c5e8cb47ab0f48fed7a869c266b94c7
.claude/skills/k8s-diagnose/references/symptoms.md: sha256:c263e72454a5bf284fdd5e0c8407e9f402645ac748fba02feda18a3ed3804730
content_hash: sha256:2f218e3b07e622b4cb09427fcf5715b7424ce088be8f1c95aff9e450e55f6665
declared_license: MIT
- repo_url: Mortis/Holocron
name: kyberforge
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
resolved_commit: 92d39ae1f92a282de39217af34763c8e237defac
version: 2.2.1
virtual_path: plugins/kyberforge
is_virtual: true
@@ -514,7 +588,7 @@ dependencies:
.claude/skills/apm-workflow/references/install.md: sha256:e729386bee5e2b67ce16b4c6c85446ce7b47d3122b68c148a571bd00a8550ad5
.claude/skills/apm-workflow/references/marketplace.md: sha256:1ed67d9a7bb241d2050c7ad4b45799a936ea4df480e8fecbdf69bb1f9eef7211
.claude/skills/apm-workflow/references/sources.md: sha256:4ae44a9e82e8ec3bd4b1a61f32adbd3f3ff5fab21db3b4162765b2c0553e49fd
.claude/skills/factory-audit/SKILL.md: sha256:17846fce016653bb2bc9b204065e5008b59c76f868207807701a5a4fe5592354
.claude/skills/factory-audit/SKILL.md: sha256:9eb6d4bf2bf9483e756e93da0bf3752b0dc86cd641b486bbe5c3fd48948f5c40
.claude/skills/factory-audit/assets/vale/.vale.ini: sha256:74ad1f946bfaa7a73296a9300082269febacc77cc4953296257cd07a93343f29
.claude/skills/factory-audit/assets/vale/styles/Kyberforge/CompositionNote.yml: sha256:0a400ba0f8460dc57fd9dbcc5d9d8a399ca672d9d4e70eb275418769bf680e14
.claude/skills/factory-audit/assets/vale/styles/Kyberforge/DescriptionOpener.yml: sha256:60984e0af965137a151a07875f388c94ea2da93d4ee4f2b92811bd14105527f2
@@ -539,7 +613,7 @@ dependencies:
.claude/skills/factory-audit/references/skill-patterns.md: sha256:b2f4d7d143a710dbb16690a89ffcc668450712f47694a4d139049ad89034403f
.claude/skills/factory-audit/references/skill-validation-scripts.md: sha256:039c4ab1002191f2e86d290e0d68bd2119b203b447676d821f152fa1a5d23376
.claude/skills/factory-audit/references/sources.md: sha256:d28530cf4952409199df15b14086100d1c46387ef1e7ace557f817ec06a0ec42
.claude/skills/factory-audit/scripts/lib-boundary-resolver.sh: sha256:e154ba054c3f0c793be9a16b4edb38e0954bf8c1796e4b915f460e46703d4499
.claude/skills/factory-audit/scripts/lib-boundary-resolver.sh: sha256:c9411ed48f164b2877f9952bde6a3d0ff9c0d43761185e0e9eb7b7f8bb3ab8d4
.claude/skills/factory-audit/scripts/lib-checks-agent.sh: sha256:49684c4cb8943eb907a0e7e9e30e6bbc0a9d5ac3ecdb8183a0aae254b80d2c17
.claude/skills/factory-audit/scripts/lib-checks-skill.sh: sha256:675cdc32938d5156b43658616edb310d8246ab0bbcc3e21063c1b8f9203fbc78
.claude/skills/factory-audit/scripts/lib-contributing-files.sh: sha256:12e3cfc7e5cd90cab4c2dfe000657236c7caac698b45954b78809a2bee9c3ff0
@@ -601,13 +675,13 @@ dependencies:
.claude/skills/skill-author/scripts/new-skill.sh: sha256:a7e99f04da68230372ca8b14da8c5e6a4a035efdd5d10d9c77e2e8c92da85c35
.claude/skills/skill-author/tests/README.md: sha256:81d301b04a489d5340234948188ff96466c3c3ab7f20a88ec2e570d1434a7b8c
.claude/skills/skill-author/tests/new-skill.bats: sha256:105d6fb09203f84a17a040b1fc91a674313c1dafcd4ddd0d267b36795c22d410
content_hash: sha256:d10235694fbb7aaa3051c2f2b143d950473c87620656277f15aab57b8849cb72
content_hash: sha256:05d94e70d24859f1f9cc1cc46529669802372cb8fec65aa64ebecdf8d6c8369a
declared_license: MIT
exec_status: deployed
- repo_url: Mortis/Holocron
name: lint
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
resolved_commit: 92d39ae1f92a282de39217af34763c8e237defac
version: 1.1.9
virtual_path: plugins/lint
is_virtual: true
@@ -635,7 +709,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: mattpocock
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
resolved_commit: 92d39ae1f92a282de39217af34763c8e237defac
version: 0.4.0
virtual_path: plugins/mattpocock
is_virtual: true
@@ -1240,6 +1314,60 @@ deployments:
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
content_hash: sha256:7c4b7efb58ecdd26fea835613d0f7f909706607cac4f002a0df2db2a3a0ee477
- kind: project-relative
target: claude
value: .claude/agents/delivery-implement-lead.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:267a62e34e31162253c12650d89788fb4bdc0f89ed7960a16aa2f6a35619b373
- kind: project-relative
target: claude
value: .claude/agents/delivery-implementer.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:57bddd326f4b9e774d80c75bddf9a7c7bc41d09a0f8b0417454a7298958efe4b
- kind: project-relative
target: claude
value: .claude/agents/delivery-operator.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:64292bfd67db6ef30a645fd7d24961f191c5fe2310157187968d012368e55911
- kind: project-relative
target: claude
value: .claude/agents/delivery-qa.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:0645ea46a448d35f6790824c6a4458d3d7669fb65be017b7708487664a9f554b
- kind: project-relative
target: claude
value: .claude/agents/delivery-reviewer.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:0326cd9722e7fcc970f35416d2229e23761ad4b9b35adb71781e78513f2c33c3
- kind: project-relative
target: claude
value: .claude/agents/delivery-test-author.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:f94967c3057d5e18c465597c37bcaf9f53568a395da4401e2b43902546db5e43
- kind: project-relative
target: claude
value: .claude/agents/git-orchestrate.md
@@ -1771,6 +1899,33 @@ deployments:
- mattpocock/skills/skills/engineering/codebase-design
active_owner: mattpocock/skills/skills/engineering/codebase-design
content_hash: sha256:edebc9e4fcfe102114012575eaa9600b9b5fd08c311664f389c36e7bc717740f
- kind: project-relative
target: claude
value: .claude/skills/delivery-ci-checks
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: null
- kind: project-relative
target: claude
value: .claude/skills/delivery-ci-checks/SKILL.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:a962a775e958a1f9e8f159592e496358881d38abd0667101c1f70b0874f482d1
- kind: project-relative
target: claude
value: .claude/skills/delivery-ci-checks/references/statuses.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:fa0282259eb662cb199eb1c8647fa55ff76299be03b132d6964ba5b771de8131
- kind: project-relative
target: claude
value: .claude/skills/delivery-handoff
@@ -1788,7 +1943,7 @@ deployments:
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:b64b4805801e065755ad371d6a7b8e7e9f9a593551e057e5ebc5cc03dd594c41
content_hash: sha256:ce213d24845455eaf1d230fb5d2c932c12a59a1d584b538793b5667704c7c45a
- kind: project-relative
target: claude
value: .claude/skills/delivery-handoff/references/gates.md
@@ -1797,7 +1952,7 @@ deployments:
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:05a45c5c9998cbb53fa3ed3166f83c2600e963a0f7959a0c61b4926342ad2dbf
content_hash: sha256:31c1616ae9f1fedc30e8077a26f06f25e9dfc65bf0ee3bd09951935f20d78a6c
- kind: project-relative
target: claude
value: .claude/skills/delivery-handoff/references/handoff-comment.md
@@ -1806,7 +1961,7 @@ deployments:
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:f51d89d240e482bb4f5bf46cce91bc342e6c04f9ab24d252aa71baa1e6650448
content_hash: sha256:11cbc8f569663f597a1c09de3b60c0d0b89e9d5c3aacd64567a146f0b3261f17
- kind: project-relative
target: claude
value: .claude/skills/delivery-repo-doc
@@ -1824,7 +1979,7 @@ deployments:
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:cc71914171ef77d1d89e701f616bdc27a03429a3c3843eaac141c824423702e7
content_hash: sha256:5d62bb69b43a60a9a51308629518457b679ecbd0574cb015ade24a6d45978fd6
- kind: project-relative
target: claude
value: .claude/skills/delivery-repo-doc/references/format.md
@@ -1833,7 +1988,7 @@ deployments:
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:b8c0913e9e6b2cec59be05cc73caeb01af95bcaba126bf3717b0c2bf6130cb2d
content_hash: sha256:eceb256a4922f4875c086a1bc2063ee7c8a46e44738865df01faa6e9efbee46a
- kind: project-relative
target: claude
value: .claude/skills/delivery-repo-doc/references/gathering.md
@@ -1842,7 +1997,178 @@ deployments:
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:91a00a8e4581f218ef15a67f23954b6731540475432127467cb5a4e76ed36dc9
content_hash: sha256:3d830012c11c25b97c10c067277d773ebaa0a4b8c1b1332ea022ff2f9ed9f00e
- kind: project-relative
target: claude
value: .claude/skills/delivery-review
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: null
- kind: project-relative
target: claude
value: .claude/skills/delivery-review/SKILL.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:3e540399fc23bd334e99c03a4a4605de7271c7b739cf66593859f1206dd38895
- kind: project-relative
target: claude
value: .claude/skills/delivery-review/references/checklist.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:da2285d14bc6e284110daf863622f5368cce8f94023b9f49d6ec06416ab15cc5
- kind: project-relative
target: claude
value: .claude/skills/delivery-review/references/review-body.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:a12637fdad4057f7700d2a787edb0fd9b6f9a3b18364786fe845bb387e8998e7
- kind: project-relative
target: claude
value: .claude/skills/delivery-test-first
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: null
- kind: project-relative
target: claude
value: .claude/skills/delivery-test-first/SKILL.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:b53a3566366545d86387c4becf4b59725fd9918f0feabef033bd0220c58d6984
- kind: project-relative
target: claude
value: .claude/skills/delivery-test-first/references/dispute.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:25dbd7334fac3187009cdbac3c97cf9f6b5be7ae4b7e522b6afdf5594f9dd491
- kind: project-relative
target: claude
value: .claude/skills/delivery-test-first/references/first-run.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:096002542e9c4bc33c770173e88a94c3e8b3e0e9b03d6e503aaf5a1144d84a87
- kind: project-relative
target: claude
value: .claude/skills/delivery-test-first/references/output-template.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:dc9ae943f9aff94532ce65bc0158eced2563ba8399b0e3720e36f5025ffa3b66
- kind: project-relative
target: claude
value: .claude/skills/delivery-verify
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: null
- kind: project-relative
target: claude
value: .claude/skills/delivery-verify/SKILL.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:c6a17ac285093060e623214028c46c8c70869da1944708e2161dc978aaa81461
- kind: project-relative
target: claude
value: .claude/skills/delivery-verify/references/already-reverted.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:34dad5ce2f7dd2de0bd7dd889ad86fbf7ae070e59d826a73a6cdd04a46804ca0
- kind: project-relative
target: claude
value: .claude/skills/delivery-verify/references/apply-wait.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:e5746a1d1369cd570db55597b139f82e6001f9e4dab3adfe7d03c3be75a63f94
- kind: project-relative
target: claude
value: .claude/skills/delivery-verify/references/attribution.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:e10b928d976153b41969be2b9d9a29c0ad2979631869528d4de4db11612b52ea
- kind: project-relative
target: claude
value: .claude/skills/delivery-verify/references/inputs.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:3a4619b42b00425eb0c13a34c19e1ccebf41140f564c3ada29307544404e45c7
- kind: project-relative
target: claude
value: .claude/skills/delivery-verify/references/post-merge-ci.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:1f7e387c64c5a61f01bf0ec09ea5e32cbfb34f505b7f2aca70e413cfea92dc84
- kind: project-relative
target: claude
value: .claude/skills/delivery-verify/references/report.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:1bec37e1358d5a56f347e32ca996c693d2f785e7c833f5c6351b6c07380b7e89
- kind: project-relative
target: claude
value: .claude/skills/delivery-verify/references/revert.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:d046d1a8f58ac2c41b084a7e669315ec8a6aebcbf86583355db07dd60260c3bb
- kind: project-relative
target: claude
value: .claude/skills/delivery-verify/references/tiers.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/delivery
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
content_hash: sha256:28193c90454e4c000f8502155de00e974ce1ffa5db81d7315c23aced67594bdc
- kind: project-relative
target: claude
value: .claude/skills/diagnose
@@ -1986,7 +2312,7 @@ deployments:
owners:
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
content_hash: sha256:17846fce016653bb2bc9b204065e5008b59c76f868207807701a5a4fe5592354
content_hash: sha256:9eb6d4bf2bf9483e756e93da0bf3752b0dc86cd641b486bbe5c3fd48948f5c40
- kind: project-relative
target: claude
value: .claude/skills/factory-audit/assets/vale/.vale.ini
@@ -2211,7 +2537,7 @@ deployments:
owners:
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
content_hash: sha256:e154ba054c3f0c793be9a16b4edb38e0954bf8c1796e4b915f460e46703d4499
content_hash: sha256:c9411ed48f164b2877f9952bde6a3d0ff9c0d43761185e0e9eb7b7f8bb3ab8d4
- kind: project-relative
target: claude
value: .claude/skills/factory-audit/scripts/lib-checks-agent.sh
@@ -2329,6 +2655,60 @@ deployments:
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
content_hash: sha256:4065195bfe9faf5338e858acc7e97f3a6fe67004f083fbdb0a3717f097b7a4d3
- kind: project-relative
target: claude
value: .claude/skills/flux-diagnose
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/gitops
active_owner: git.rkdr.net/Mortis/Holocron/plugins/gitops
content_hash: null
- kind: project-relative
target: claude
value: .claude/skills/flux-diagnose/SKILL.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/gitops
active_owner: git.rkdr.net/Mortis/Holocron/plugins/gitops
content_hash: sha256:01567823494e33ed28a22182ea1fb17e8835ee39d703b292a09c5155d1a82b12
- kind: project-relative
target: claude
value: .claude/skills/flux-diagnose/references/applied-check.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/gitops
active_owner: git.rkdr.net/Mortis/Holocron/plugins/gitops
content_hash: sha256:938c57da30d1d1211402e1b81cb724c2d68aad25cb44c3aeadb4e07511a74bf6
- kind: project-relative
target: claude
value: .claude/skills/flux-diagnose/references/diagnose.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/gitops
active_owner: git.rkdr.net/Mortis/Holocron/plugins/gitops
content_hash: sha256:3a1107f7360c83925e4a0ab2f3716e1eedb3ada8ee8c019f3beac3c37b394fd5
- kind: project-relative
target: claude
value: .claude/skills/flux-diagnose/references/sources.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/gitops
active_owner: git.rkdr.net/Mortis/Holocron/plugins/gitops
content_hash: sha256:f65732f82e8b55176f26820fb82853747b3339d59adbc7bb9e657502ebe8af52
- kind: project-relative
target: claude
value: .claude/skills/flux-diagnose/references/status.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/gitops
active_owner: git.rkdr.net/Mortis/Holocron/plugins/gitops
content_hash: sha256:1fe6b0232259ba77e41da09ed306b1b11ffaffa0dd87609c7b4e047a78c0f27d
- kind: project-relative
target: claude
value: .claude/skills/forge
@@ -4075,6 +4455,42 @@ deployments:
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
content_hash: sha256:ae34a57d331379990fc0b72396819497f973c3fa0a52016a99e9db4173ff2036
- kind: project-relative
target: claude
value: .claude/skills/k8s-diagnose
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/k8s
active_owner: git.rkdr.net/Mortis/Holocron/plugins/k8s
content_hash: null
- kind: project-relative
target: claude
value: .claude/skills/k8s-diagnose/SKILL.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/k8s
active_owner: git.rkdr.net/Mortis/Holocron/plugins/k8s
content_hash: sha256:996186466fa3f50b26e1f203d61662e55f75737b9803e42501d42c0e314c6fc2
- kind: project-relative
target: claude
value: .claude/skills/k8s-diagnose/references/sources.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/k8s
active_owner: git.rkdr.net/Mortis/Holocron/plugins/k8s
content_hash: sha256:080b67d225be56cf49f12ac9f79618554c5e8cb47ab0f48fed7a869c266b94c7
- kind: project-relative
target: claude
value: .claude/skills/k8s-diagnose/references/symptoms.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/k8s
active_owner: git.rkdr.net/Mortis/Holocron/plugins/k8s
content_hash: sha256:c263e72454a5bf284fdd5e0c8407e9f402645ac748fba02feda18a3ed3804730
- kind: project-relative
target: claude
value: .claude/skills/pc-author
@@ -4443,7 +4859,7 @@ deployments:
owners:
- git.rkdr.net/Mortis/Holocron/plugins/core
active_owner: git.rkdr.net/Mortis/Holocron/plugins/core
content_hash: sha256:1f9a3c193a2d1af6e180cdad48d8841c90b82144fbdf47cfa16bb209e771d0e9
content_hash: sha256:816bd407304abcc876d0bb2923a889bd151bae1403367e05f35659d7a9fa4281
- kind: project-relative
target: claude
value: .claude/skills/research
+7 -4
View File
@@ -1,5 +1,5 @@
name: holocron
version: 0.8.0
version: 0.8.1
description: AI development skills for Claude Code, and for GitHub Copilot through apm — factory, design, implement, review, and cross-cutting workflows.
license: MIT
@@ -73,7 +73,7 @@ executables:
bin: true
# delivery ships the guard hook (ADR-0032 enforcement layer 2). Same
# version-in-key convention as above, kept by the same sync check.
delivery#0.6.0:
delivery#0.8.0:
hooks: true
marketplace:
@@ -82,14 +82,17 @@ marketplace:
# top-level apm.yml description:/version: above are NOT inherited into the
# compiled output despite being used elsewhere (e.g. by `apm audit`).
description: AI development skills for Claude Code, and for GitHub Copilot through apm — factory, design, implement, review, and cross-cutting workflows.
version: 0.8.0
version: 0.8.1
owner:
name: Mortis
url: https://git.rkdr.net/Mortis/
# Default tag pattern used to resolve version ranges for each package.
# Per-plugin tags, <plugin>-v<version> (ADR-0033). Every entry below has a
# local source:, which apm resolves without consulting tags, so this does
# not change the compiled marketplace.json; it applies to remote entries.
build:
tagPattern: "v{version}"
tagPattern: "{name}-v{version}"
# Output targets (map form). Each output writes to its profile default
# path; add 'path:' under a key to override.
@@ -140,6 +140,10 @@ Rejected on three grounds, stacking:
natively and reports zero skills, which is precisely the ADR-0017 defect, reintroduced on the
release path where it is hardest to notice.
> **Forward note (2026-11-27): ground 2 is addressed by ADR-0033.** Every plugin version on `main`
> is now tagged `<plugin>-v<version>`, so the per-package tagging convention exists. This rejection
> still stands on grounds 1 and 3, which are unchanged.
**Also delete the marketplace catalogue (proposed, then rejected on evidence).** The initial shape
of this decision deleted `.claude-plugin/marketplace.json` along with everything else, on the
reasoning that it is a Claude Code artifact. That is wrong. `apm marketplace add` probes
@@ -32,10 +32,19 @@ Every package skill classifies each command it drives into one tier:
Agents never decrypt Ansible Vault or Sealed Secrets and never read the material that would. Stage
sessions use a kubeconfig bound to the built-in `view` ClusterRole (which excludes Secrets) plus a
read-only aggregated role for `SealedSecret` objects. Ansible stage work runs only what succeeds with
a placeholder vault password (`--syntax-check`, `ansible-lint`, inventory reads). A real
`--check --diff` before merge is reopened: check mode still runs PR-controlled code (lookups,
`delegate_to: localhost`, `check_mode: false` tasks, plugins) with the production credentials, so
running it in CI on a bot PR hands the bot those credentials. Decided in
a placeholder vault password (`--syntax-check`, `ansible-lint`, inventory reads).
Ansible's pre-merge `--check --diff` runs in CI from the base branch's copy (`pull_request_target`)
with the production vault password and SSH key. It runs automatically on human-authored PRs. On a
bot-authored PR it runs only after a user on the human allowlist adds the `Dry run` label, and after
every bot push the label must be removed and re-added, because the push leaves the new head without
a status. This is because PR code really executes: `check_mode: false` tasks on production hosts,
and lookups, plugins and `delegate_to: localhost` on the runner with the production credentials.
The gate guards against accidents, not a hostile bot: a bot branch can already reach the secrets
through a workflow of its own (see the same-repo-branch accepted risk). It runs only the Ansible
stages (pve, lxc, vm, services) the change touches, shares the `homelab-provision` concurrency
group, and its required status proves the preview ran on the head commit, not that check mode
passed. Failed tasks are shown in the PR comment for the approver to judge. Decided in
[Pre-merge Ansible dry run without exposing production credentials](https://git.rkdr.net/Mortis/Holocron/issues/200).
## Enforcement layers
@@ -52,8 +61,9 @@ running it in CI on a bot PR hands the bot those credentials. Decided in
- every PR carries the dry run as a required status and a PR comment; apply happens after merge.
Flux's is an offline rendered diff of base and head that holds no cluster credential; a live
`flux diff` needs write RBAC, because Kubernetes authorises dry-run requests like real ones, so
it is not used. Ansible's pre-merge `--check --diff` is reopened (see Secrets); later
`tofu plan`;
it is not used. Ansible's is a CI `--check --diff` from the base branch's copy, gated on bot
PRs by an allowlisted human's `Dry run` label, re-added after every bot push; its status proves the preview ran on
the head commit, not that check mode passed (see Secrets). Later `tofu plan`;
- in step mode (v1) the human launching a stage is the approval, and stage leads check gate
state only: the stage's gate label, if it has one, is present, and for verify the PR is
merged with a non-stale, non-dismissed approval by a user on the human allowlist in
@@ -70,8 +80,16 @@ running it in CI on a bot PR hands the bot those credentials. Decided in
- **Agent drafts odd jobs, human runs them** (no agent ever holds apply credentials): rejected by the
owner in favour of agent-run odd jobs in HITL sessions with per-command ask.
- **Gated vault-touching check runs, or a scoped vault credential for agents**: rejected — moving
`--check --diff` to CI removes the conflict without loosening the read rule.
- **A scoped vault credential for agents**: rejected — running `--check --diff` in CI removes the
conflict without loosening the read rule.
- **A scoped vault or check-only SSH user for the CI dry run**: rejected — a check-only user still
needs `become`, which is root, and a scoped vault drifts from the real one.
- **Ungated vault-touching check runs on bot PRs**: rejected — check mode still executes
PR-controlled code with the production credentials (`check_mode: false` tasks on production
hosts; lookups, plugins and `delegate_to: localhost` on the runner), so an ungated run would let
bot-authored code act on production before any human looks. The bot path is gated instead: the
run starts only on an allowlisted human's `Dry run` label, re-added after every bot push (see
Secrets).
- **Apply before merge** (Atlantis model): rejected — Gitea has no native support; merge-then-apply
with the dry run as a required check is the existing pattern in the reference repo.
- **A deny hook on test paths**: rejected for v1 — a repo-wide hook cannot portably tell the test
@@ -99,12 +117,22 @@ running it in CI on a bot PR hands the bot those credentials. Decided in
- **Accepted risk:** Copilot CLI's TUI auto-approves a hook `ask` (github/copilot-cli#3590, open
since v1.0.53), so on Copilot an odd-job ask may run without a human answer. The owner kept ask
on Copilot rather than deny; Copilot is untested in v1 and the credential boundary still holds.
- **Accepted risk:** human-authored PRs run PR code against production hosts before approval. The
Ansible dry run starts automatically on them, and check mode executes `check_mode: false` tasks on
the hosts, and lookups, plugins and `delegate_to: localhost` on the runner, for real; the owner
accepted this for human authors and gated only the bot.
- The guard hook (`plugins/delivery/.apm/hooks/guard.py`) also checks file-tool paths (Read, Grep,
Edit, Write, Copilot's `view`, Codex's `apply_patch`) against the secret-path globs, not only
shell commands. `kubectl`, `helm`, `flux` and `tofu` are allowlists of subcommands that change no
cluster or state and print no secret: anything not on the list is denied, so an unlisted mutating
subcommand fails safe. Codex cannot ask, so odd jobs are
denied there; an unrecognised runtime is treated the same way.
- *Amended 2026-11-25 ([Pre-merge Ansible dry run without exposing production credentials](https://git.rkdr.net/Mortis/Holocron/issues/200)):
the reopened Ansible `--check --diff` now runs in CI from the base branch's copy with production
credentials — automatic on human-authored PRs, gated on bot PRs by an allowlisted human's
`Dry run` label, re-added after every bot push; the gated-run rejection was narrowed to ungated
runs on bot PRs, a scoped vault or check-only user for CI was rejected, and human-authored PRs
running PR code against production before approval became an accepted risk.*
- *Amended 2026-11-23 ([delivery-handoff skill](https://git.rkdr.net/Mortis/Holocron/issues/191)): stage
leads check gate state only and the who-set-the-label check moved to the run-mode launcher,
because gitea-mcp v1.13.0 has no timeline method, the timeline needs a token on private repos,
@@ -0,0 +1,183 @@
# Every plugin version on `main` is tagged `<plugin>-v<version>`, cut by script after merge
**Status: accepted (2026-11-27).**
## Context
Issue #223. Consumers that pin a holocron package need a git tag per package version. Two consumers
are known, and both read the same tag shape:
- **Renovate's `apm` manager** (≥ 44.153.0) looks up a dependency on a `plugins/<name>` subpath
through the `git-tags` datasource. It considers only tags of the form `<prefix>-v<x.y.z>`.
- **`apm outdated`** matches the tag pattern `{name}-v{version}`. This was verified with apm 0.28.0
against a synthetic repo, and `apm_cli/marketplace/tag_pattern.py` lists `{name}-v{version}`
among its patterns.
The repo's existing tags are repo-level (`v1.0.0`, `v2.0.0`, `v2.0.1`). They match no package,
because the eleven plugins are versioned independently, each in its own `apm.yml`. ADR-0024
rejected a release-time mirror partly on this ground (its rejected option 2, ground 2): "the
tagging convention that would make ref-pinning meaningful would have to be invented first". This
ADR defines that convention.
Two facts limit where enforcement can live:
- **There is no CI.** Every gate here is a git hook on a developer's machine (ADR-0024, option 2,
ground 3).
- **Merges run no hook.** A PR merged with Gitea's merge button runs no local hook at all, so
nothing fires at the moment a version lands on `main`.
## Decision
**Every version a plugin ships on `main` gets an annotated tag `<plugin>-v<version>`.**
- **Name.** `<plugin>` is the directory under `plugins/` and must equal that `apm.yml`'s `name`.
`<version>` is the strict `MAJOR.MINOR.PATCH` from the same file. Example: `git-v1.3.9`. The
repo-level `v*` tags stay as they are. A plugin directory whose name starts with `-`, or whose
`<plugin>-v<version>` `git check-ref-format` rejects (`a..b`, `a*`), can never be tagged, so the
script rejects it before reading any history.
- **Target.** The tag goes on the oldest commit, in `main`'s first-parent history, of the
contiguous run carrying that version. That is the merge or squash commit where the version first
landed on `main`, never a feature-branch commit. An `apm.yml` edit that leaves `version:` alone
does not start a new run.
- **Immutability.** Tags are never moved, overwritten or silently re-cut. A tag that is lightweight,
that peels to no landing of its version, or that peels to a later landing than the version's
first is reported as an error for a human to resolve. Every
reachable `<plugin>-v*` tag is checked this way, not only those of the wanted runs, and an
invalid one never decides where the wanted runs start, so it cannot hide the versions before it.
- **A version is released once, at its first landing.** A version's first landing is the oldest
run carrying it anywhere in `main`'s first-parent history, not only among the wanted runs. The
script uses this one definition both to validate existing tags and to decide which tags to
create. When a version comes back (a reverted bump, or an `apm.yml` deleted and re-added), the
later run is never tagged: the script reports it `RELEASED`, and it blocks nothing. There are
three cases:
- The version's tag exists: it must be on the first landing.
- The version is untagged and its first landing is among the wanted runs: that run is the one
tagged (`MISSING` until then).
- The version is untagged and its first landing lies before the wanted runs: the version shipped
before the tagging start point. It stays untagged, like the rest of the history the backfill
leaves out, and the later run reports `RELEASED` with a note naming the first landing. Tagging
the later run instead would cut a tag the next run reports as an error.
- **Mechanism.** `scripts/tag-plugin-releases.sh` computes the targets from `origin/main`'s
history and cuts the tags after merge. Without arguments it is a dry run: it prints a
`plugin version commit status` table and exits 1 if any tag is missing. `--apply` creates the
missing tags locally, and only when no error exists anywhere (all or nothing) and the commit read
is on `origin/main`'s first-parent history; a commit of a merged feature branch is an ancestor of
`origin/main` but not on that line, so it is refused. It never falls back to the local `main`. It
then prints the exact `git push origin <tag>…` line, naming each tag explicitly and never using
`--tags`. The script never fetches and never pushes. No hook gates any of this.
- **Which versions are wanted.** If a plugin already has a valid `<plugin>-v*` tag reachable from
`main`, the script wants every version run from the newest such tag onward, including a reverted
version's run, which then reports `RELEASED` as above. If it has none, the script wants every run
from the first landing of the current version onward, so the current version is tagged at its
first landing anywhere in history and any later run of it reports `RELEASED`; when the current
version never recurred, that is the current run alone. That second rule is the backfill: older
history is not tagged retroactively.
- **An invalid version blocks `--apply` until a maintainer resolves it.** A run in the wanted range
whose `version:` is not strict `MAJOR.MINOR.PATCH` is an error row, and because `--apply` is all
or nothing it blocks every plugin's tags, not only that plugin's. The script does not skip it,
since silently skipping a run would hide whatever version shipped there. The escape path belongs
to the maintainer: cut by hand the annotated tag of the first valid version after the invalid
run, on that version's first landing. That tag becomes the plugin's start point, the invalid
run is no longer wanted, and the next `--apply` proceeds. Any version between the old start
point and the invalid run is then the maintainer's to tag by hand too, if it is wanted at all.
An agent that hits this stops and reports, like any other exit 2.
- **One deliberate exception to the backfill: git's previous version, `git-v1.3.8`, is also
tagged**, on `32fbe39fb8923854ca8e743a0d2cad81720c736c`, where 1.3.8 first landed on `main`. This
gives a consumer pinned to an older git tag something real to check `apm outdated` against. It is
a one-off, cut with exactly
`scripts/tag-plugin-releases.sh --ref 32fbe39fb8923854ca8e743a0d2cad81720c736c --plugin git --apply`,
which tags git alone; without `--plugin git` that `--ref` would tag every plugin's version at
that commit. After it, the "from the newest tag onward" rule covers git like every other plugin.
- **The agent pushes release tags, each push gated on the maintainer's explicit approval. It is
not a free Propose-tier push under ADR-0032.** ADR-0032's Propose tier ("branch, commit, push,
open a PR, comment") covers pushes that propose a change for review: a human still approves the
change before it merges. A tag push has no review step behind it. It publishes a release that
consumers pin, and because tags are immutable it cannot be quietly taken back: it is an
irreversible publish. So after `--apply`, the agent shows the maintainer the exact tags and the
push command the script printed and asks for approval in the conversation. On an explicit yes it
runs exactly that `git push origin <tag>…` itself: the named tags only, never `--tags`, never
any other ref. Without an explicit yes in the current conversation it does not push.
- **Agents cut release tags only with the script.** Cutting one by hand or with Gitea's
`create_tag` (consequence 4) is a maintainer path.
- **Wiring elsewhere:**
- Root `apm.yml`'s `marketplace.build.tagPattern` is `{name}-v{version}`.
- `docs/agents/delivery.md` points at `AGENTS.md` and this ADR under Conventions. The dry run
does not go under Post-merge checks, because that section accepts only forge status names and
the repo has no CI.
- `AGENTS.md` carries the agent-facing rule and cites this ADR.
## Considered options
**A pre-push hook that fails while any `main` version is untagged (rejected).**
- After every version-bump merge it would block every contributor's next push, on any branch,
until someone tagged.
- It would read `origin/main` as last fetched, so a stale clone would get a stale verdict.
- A tag that exists only locally and was never pushed would satisfy it.
- An agent's only way past it would be `SKIP=` or `--no-verify`, which ADR-0032 puts in the Never
tier.
**A pre-push hook that runs when the tag is pushed (rejected).** pre-commit never invokes hooks for
exactly this push. In pre-commit 4.6.1, `_pre_push_ns` in `pre_commit/commands/hook_impl.py`
(lines 128–174) walks the pushed refs:
- A new tag has an all-zero remote sha, so the remote-sha branch (`:133`) does not apply.
- It then runs `git rev-list <local_sha> --not --remotes=origin` (`:143–146`). A tag on a commit
that is already on the pushed `main` lists nothing, so the ref is skipped (`:147–148`).
- With nothing left, the function returns `None` (`:174`), and `_run_ns`'s caller returns without
running any hook (`:272–273`).
So a hook on tag push would never fire for the one push it exists to check.
**A warn-only hook (rejected).** A warning that appears on every push after a merge, and that the
person pushing usually cannot act on, is noise people learn to ignore.
**A step in the `gitea-releases` skill (rejected).** `gitea-releases` is a generic shipped plugin
skill, used by consumers with their own tagging schemes. This is holocron's release policy, and it
belongs in holocron's own docs and script.
**The maintainer pushes release tags by hand (rejected).** An earlier draft of this ADR made the
tag push maintainer-only. The control that matters is the maintainer's explicit approval of the
exact tags, not who types the command, and an agent running exactly the approved line keeps that
control while removing a manual step.
**The agent pushes release tags as a free Propose-tier push (rejected).** A tag push publishes an
immutable release with no review behind it, so it cannot share the Propose tier's no-approval
rule; each push needs the maintainer's explicit yes.
**A review-held checklist item alone (rejected).** Review happens before merge, but the tag can
only be cut after merge, once the target commit exists on `main`. A checklist in review cannot
check something that does not exist yet.
## Consequences
**1. An untagged window is accepted.** Between a merge and the next approved tagging run, the
new version has no tag. Consumers' pins lag behind, but nothing breaks. Lateness also heals itself:
targets are computed from history rather than taken from the checkout, so a run made days later
cuts the same tags on the same commits.
**2. The root catalogue's version is not tagged per plugin.** Only the `plugins/<name>/apm.yml`
versions get `<plugin>-v*` tags. The marketplace catalogue's own version is out of scope.
**3. Renovate consumers on this Gitea need an `overridePackageName` rule until upstream fixes
it.** On hosts other than GitHub and GitLab, Renovate's apm manager does not strip `/plugins/<name>`
from the package URL (`lib/modules/manager/apm/extract.ts`, `resolveRepoPath`), so its `git-tags`
lookup targets a repo that does not exist. A consumer-side `packageRules` entry along these lines
rewrites it. **It is untested.**
```json
{
"matchManagers": ["apm"],
"matchDatasources": ["git-tags"],
"matchPackageNames": ["/\\/plugins\\/[^/]+$/"],
"overridePackageName": "{{{replace '/plugins/[^/]+$' '' packageName}}}"
}
```
**4. For a maintainer, Gitea's `create_tag` is an equivalent way to cut a tag**, provided
`git cat-file -t <tag>` reports `tag` after fetching. That confirms it is annotated; the script
reports a lightweight tag as an error.
**5. Enforcement is by convention for now.** Nothing fails when a merged version goes untagged. A
`post-merge:` assertion that the verify stage checks on version-bump PRs is the natural next step
and is left as future work.
+40
View File
@@ -0,0 +1,40 @@
# Delivery
## Contents → skills
- `plugins/*/.apm/skills/**`: `skill-author`, `factory-audit`
- `plugins/*/.apm/agents/**`: `agent-author`, `factory-audit`
- `**/apm.yml`: `apm-workflow`
- `AGENTS.md`: `agentsmd-author`, `agentsmd-audit`
- `.pre-commit-config.yaml`: `pc-author`, `pc-run`
## CI checks
- none
## Test paths
- `tests/**`
## Human allowlist
- `Defame1297`
## Credential boundary
- Bot user: `Claude`
- Kubeconfig: none
- Branch protection: in place
- Accepted risks: none
## Conventions
- Repo conventions and session rules: `AGENTS.md`; decisions: `docs/adr/`.
- No forge CI: every check is a local pre-commit or pre-push hook, listed with its reason in
`docs/spec/gates.md`; test commands in `README.md`.
- When an `.apm/` edit goes live: `AGENTS.md`, session rules; ADR-0019.
- Release tags after a `version:` bump merges: `AGENTS.md`; ADR-0033.
## Post-merge checks
- none
+40 -5
View File
@@ -73,7 +73,7 @@ version-blind, so a stale key deploys fine (see [apm gates](#apm-gates)).
| Hook | Guards |
|---|---|
| `apm-audit-ci` | `scripts/apm-audit-ci.sh` — `apm audit --ci` once per manifest, root plus each plugin package under `plugins/`, waiving only a package's `lockfile-exists` (see [below](#apm-audit-ci)) |
| `apm-pack-check-clean` | `apm pack --check-versions --check-clean --dry-run` — the compiled marketplace still matches what `apm.yml` + `.apm/` would generate, and per-package versions agree with the `per_package` strategy |
| `apm-pack-check-clean` | `scripts/apm-pack-check-clean.sh` — `apm pack --check-versions --check-clean --dry-run` with a scrubbed git env (see [`apm-audit-ci`](#apm-audit-ci)) — the compiled marketplace still matches what `apm.yml` + `.apm/` would generate, and per-package versions agree with the `per_package` strategy |
**Host validators** (needs the `claude` CLI on PATH)
@@ -87,10 +87,11 @@ version-blind, so a stale key deploys fine (see [apm gates](#apm-gates)).
|---|---|
| `check-skill-version-bump` | fails if a skill directory changed since the pushed commit's merge-base with `main` without its `metadata.version` rising above both the merge-base's and `main`'s tip's (see [below](#check-skill-version-bump)) |
Two of these shell out to `apm`: `apm-audit-ci` and `apm-pack-check-clean`. The second is a bare
`apm …` entry and the first is `scripts/apm-audit-ci.sh`, which calls `apm` once per manifest, so
without the CLI on PATH the push dies on a "command not found" from inside the hook. Install with `apm-install`, or
`curl -sSL https://aka.ms/apm-unix | sh`; verify with `apm --version`.
Two of these shell out to `apm`: `apm-audit-ci` and `apm-pack-check-clean`. The second is
`scripts/apm-pack-check-clean.sh`, a one-call wrapper, and the first is `scripts/apm-audit-ci.sh`,
which calls `apm` once per manifest, so without the CLI on PATH the push dies on a "command not
found" from inside the hook. Install with `apm-install`, or `curl -sSL https://aka.ms/apm-unix | sh`;
verify with `apm --version`.
### `check-skill-version-bump`
@@ -1163,6 +1164,18 @@ Verified: a malformed dependency entry passes
`apm pack --check-versions --check-clean --dry-run` and fails `apm audit --ci` in that package's
directory. Costs ~0.5s per package.
**apm runs with git's repo-locating env scrubbed.** Both apm hooks source
`scripts/lib/clean-git-env.sh` before calling `apm`, which unsets `GIT_DIR`, `GIT_WORK_TREE`,
`GIT_INDEX_FILE`, `GIT_OBJECT_DIRECTORY`, `GIT_COMMON_DIR`, `GIT_PREFIX` and
`GIT_IMPLICIT_WORK_TREE`. It deliberately keeps the config-passing vars (`GIT_CONFIG_PARAMETERS`,
`GIT_CONFIG_COUNT`), because they carry `git -c` overrides apm's remote clones may need. The reason: `git push` from a **linked worktree** exports an
absolute `GIT_DIR=<main>/.git/worktrees/<name>` to its hooks, and from the main checkout it exports
none. `drift`'s install replay (apm 0.28.0) runs `git init` and `git checkout` in a temp dir with an
env copied from `os.environ`, so the inherited `GIT_DIR` wins. The `init` wrote `core.bare=true` into
the shared `.git/config`, and the `checkout` moved the worktree's HEAD to the lock-pinned commit
(issue #204). Pre-commit runs hooks from the worktree root, so once the vars are gone plain
discovery finds the right repo. `tests/test-apm-hooks-git-env.sh` pins this for both hooks.
**What it actually runs is asymmetric**, and the two manifest classes are not comparable. Verified by
running `apm audit --ci` (apm 0.28.0) at the repo root and in `plugins/lint/`, reading the check
names straight off its own compliance table:
@@ -1327,6 +1340,28 @@ checks fail offline, with `deployed-files-present` already failing for the same
`apm-audit-ci` above). The offline guarantee is a property of a populated `apm_modules/`, not of the
hook set: run `apm install` once on a new checkout and it holds from then on.
## Plugin release tags are not a gate
Every plugin version on `main` gets an annotated `<plugin>-v<version>` tag (ADR-0033). No hook
checks for it, for two reasons:
- **Nothing runs at the right moment.** A version lands on `main` by merge, and Gitea's merge
button runs no local hook. A pre-push hook that failed on untagged versions would instead block
every contributor's next push, and an agent's only way past it would be `SKIP=` or
`--no-verify`, which ADR-0032 forbids.
- **A hook on the tag push never fires.** pre-commit 4.6.1's `_pre_push_ns` skips a pushed ref
whose remote sha is all zeros and that has no commits outside `--remotes=origin`. That is exactly
a new tag on an already-pushed `main` commit, so no hook runs.
Tagging is a step after merge instead. After `git fetch origin --tags`, run
`scripts/tag-plugin-releases.sh` (a dry run; it exits 1 while tags are missing), then `--apply`,
then push the tags it names. An agent may run the push itself, but only the exact printed line and
only after the maintainer explicitly approves those tags in the conversation, because a pushed tag
is an immutable release.
See also: `docs/adr/0033-plugin-releases-are-tagged-plugin-v-version.md`,
`scripts/tag-plugin-releases.sh`.
---
## See also
@@ -298,14 +298,14 @@ EOF
@test "a doubled UTF-8 BOM does not hide the @import line" {
ADAPTER="$TMPDIR/CLAUDE.md"
python3 -c "import sys; open(sys.argv[1], 'wb').write(('@AGENTS.md\n').encode('utf-8'))" "$ADAPTER"
python3 -c "import sys; open(sys.argv[1], 'wb').write(('\ufeff\ufeff@AGENTS.md\n').encode('utf-8'))" "$ADAPTER"
run bash "$SCRIPT" "$ADAPTER" "$AGENTS_MD"
assert_success
}
@test "a BOM in front of a mid-file @import line does not hide it" {
ADAPTER="$TMPDIR/CLAUDE.md"
python3 -c "import sys; open(sys.argv[1], 'wb').write(('# Claude notes\n\n@AGENTS.md\n').encode('utf-8'))" "$ADAPTER"
python3 -c "import sys; open(sys.argv[1], 'wb').write(('# Claude notes\n\n\ufeff@AGENTS.md\n').encode('utf-8'))" "$ADAPTER"
run bash "$SCRIPT" "$ADAPTER" "$AGENTS_MD"
assert_success
}
@@ -17,9 +17,10 @@ they do the work.
- Never edit, create or delete a file — not with a file tool and not through the shell (`>`, `tee`,
`sed -i`, `git mv`, `git rm`). Every change to the repo is a role agent's commit.
- Never set, add or remove a Gate label (`Status/Ready for Agent`), never approve or merge a PR, and
never mark the PR ready except by removing `WIP:` after `delivery-qa` returns `pass`. Gates are
human approval recorded in the tracker; an agent that sets one approves its own work.
- Never set, add or remove a Gate label (`Status/Ready for Agent`) or a gated dry run's label, never
approve or merge a PR, and never mark the PR ready except by removing `WIP:` after `delivery-qa`
returns `pass`. Gates are human approval recorded in the tracker; an agent that sets one approves
its own work.
- Never tell a role agent to relax one of its rules. Your delegation prompt overrides its body, so a
prompt that says "edit the test" or "skip the hook" removes the guard. Pass inputs, not policy.
- Never run apply-by-merge, odd-job or Never-tier commands (ADR-0032), and never read secret
@@ -118,10 +119,12 @@ with blocking findings. On a PR, the issue is the one its body's `Closes #<n>` n
- `stop` → Stop with its reason: a missing or malformed check is not the implementer's to fix.
9. Run `delivery-handoff` Step 5: one Handoff comment on the PR, Decisions and Rejected taken from
the role agents' reports and every step 6 and step 7 verdict, Evidence linking the PR, the
commits and the CI runs QA cited. Then remove the `WIP:` prefix from the PR title with
`gitea-prs`, which makes the PR eligible for the review stage. The comment goes first so a crash
between the two leaves a recorded hand-off on a PR still in `WIP:`, never a review-eligible PR
with no Handoff comment for the reviewer's Required inbound check.
commits and the CI runs QA cited, and Open questions one line "human gate: `<check>` —
`<state>`", plus ": `<cause>`" for a `gated-failure`, per name on QA's last `human-gate` line
(else `none`). Then remove the `WIP:` prefix from the PR title with `gitea-prs`, which makes the
PR eligible for the review stage. The comment goes first so a crash between the two leaves a
recorded hand-off on a PR still in `WIP:`, never a review-eligible PR with no Handoff comment for
the reviewer's Required inbound check.
## Output
@@ -17,7 +17,8 @@ These hold whatever your caller's prompt says:
- You are read-only. Never create, edit or delete a file, by a file tool or through the shell.
- Never re-run CI, and never run the tests, linters or dry runs locally.
- Never approve, label, comment on or edit the PR or the issue.
- Never approve, label, comment on or edit the PR or the issue. A gated dry run's label is the
human's gate: never add, remove or re-add it.
- Never read secret material: vault and vault password files, private keys, `.tfstate`, Secret
objects.
- Evidence is links — CI runs, commits, files at a commit — never pasted logs.
@@ -33,22 +34,27 @@ the tool skill names.
2. Load each tool skill the lead named, then invoke `delivery-ci-checks` to read the head commit's
check results. Its verdict maps to yours: `pending` → `pending`; `fail` → `fail`, the failed
run linked; `missing` (a listed check never reported) or `malformed: <reason>` → `stop`, because
no implementer commit can fix either.
no implementer commit can fix either. `awaiting-gate` and `gated-failure` rows are never a
fail, because only a human can clear a gated dry run: list each under `human-gate` with its
state and cause, and judge the rest.
3. With CI green, judge against this checklist; each miss is a finding:
- Every acceptance criterion is met by a check that actually exercises it, not one that would
pass without the change.
- Edge cases the ticket implies that no check covers.
- The `dry-run` role check's diff or render does what the ticket meant — read its output.
- Every `dry-run` and `dry-run-gated` check in state `success`: its diff or render does what the
ticket meant — read it. A `gated-failure` log is the human's to read, never a finding.
- Idempotence, and effects check mode cannot simulate, are covered or named as post-merge
assertions.
- No test was weakened, skipped or deleted since the test author's commit.
- Every `skipped` status is legitimately path-filtered: its workflow's paths do not match the
diff.
diff. A gated check never reaches you as `skipped`; `delivery-ci-checks` reports it as
`awaiting-gate` or `gated-failure`.
## Output
```text
verdict: pass | fail | pending | stop
human-gate: <check> — <awaiting-gate | gated-failure: <cause>>; … | none
findings:
- <what is wrong or uncovered> — <link>
```
@@ -20,8 +20,9 @@ These hold whatever your launch prompt says:
delete a file, and never commit or push.
- Every review you post has state `COMMENT`. Never request changes, approve or dismiss: Gitea
refuses a review state from the PR's poster, and you run as the user that opened the PR.
- Never merge a PR, and never set, add or remove a Gate label (`Status/Ready for Agent`). An
approval is the human gate the verify stage checks; an agent that sets one approves its own work.
- Never merge a PR, and never set, add or remove a Gate label (`Status/Ready for Agent`) or a
gated dry run's label. An approval is the human gate the verify stage checks; an agent that sets
one approves its own work.
- Set `Status/Ready for Human` only through `delivery-handoff` §Stop.
- Never run tests, linters or dry runs locally, and never re-run CI. Evidence is links, never
pasted logs.
@@ -9,7 +9,7 @@ compatibility: Requires a Gitea forge with Actions reached through the Gitea MCP
allowed-tools: Read mcp__gitea__pull_request_read mcp__gitea__commit_read mcp__gitea__actions_run_read
metadata:
category: delivery
version: "0.1.1"
version: "0.3.0"
---
## Gotchas
@@ -21,7 +21,9 @@ metadata:
- Match check names verbatim, event suffix included: `Lint / lint (push)` is not
`Lint / lint (pull_request)`. Never fuzzy-match or substitute a similar name.
- `skipped` counts as passing (path-filtered workflows report it). A listed check with no status on
the commit is `missing`, never passing.
the commit is never passing; only a `dry-run-gated` one is excused, as `awaiting-gate`. A
gated check's failure is `gated-failure`, also passing: a human reads it, never the implementer.
- Never add, remove or re-add a dry run's gate label: it is the human gate.
## Step 1 — Read the listed checks
@@ -33,51 +35,53 @@ Otherwise read `docs/agents/delivery.md` at the consuming repo's root. Its forma
`delivery-repo-doc`'s `references/format.md`; you parse only section `## CI checks`:
- one item per line: `` - `<exact status name>`: <role> ``
- `<role>` is one of `dry-run`, `test-path`, `test`, `lint`, `build`, `other`; `dry-run` on exactly
one item
- `<role>` is one of `dry-run`, `dry-run-gated`, `test-path`, `test`, `lint`, `build`, `other`;
`dry-run` on one or more items
- `- none` as the only item means no checks: return verdict `pass` with an empty table and stop.
File missing, section missing, an item outside that syntax, an unknown role, or not exactly one
`dry-run` → return `malformed: <reason>` and no verdict. The caller stops with
`Status/Ready for Human` through `delivery-handoff`'s Stop; do not guess the list.
File missing, section missing, an item outside that syntax, an unknown role, or no `dry-run`
item → return `malformed: <reason>` and no verdict; never guess the list.
## Step 2 — Pin the commit
- **PR** → `mcp__gitea__pull_request_read` method `get`; take `head.sha` and the PR's `html_url`.
- **Commit** (e.g. post-merge on `main`) → use the SHA you were given.
Only statuses on this SHA count. A status from an older commit of the PR is stale and is ignored.
Only statuses on this SHA count; an older commit's are stale and ignored.
## Step 3 — Read statuses, with bounded waiting
Read `references/statuses.md` now. Read the pinned SHA's statuses with
`mcp__gitea__commit_read` method `get_status`, `ref` set to the SHA, and classify each listed
check as `success`, `failure`, `skipped`, `pending` or `missing` per its mapping.
check as `success`, `failure`, `skipped`, `pending`, `missing`, `awaiting-gate` or
`gated-failure` per its mapping and §Gated dry runs.
Re-read while any listed check is `pending`, or while no listed check has reported yet. With a
caller-supplied list, also re-read while any is `missing`: workflows on a fresh commit start
late. Each re-read passes `wait_seconds: 45`. For a PR, re-read `head.sha` first; if it moved, go
back to Step 2 with the new SHA. The hard cap, across all SHAs, is **20 reads, about 15
minutes**. A caller's wait cap in minutes replaces it: the caller's minutes, at most
⌈minutes×4/3⌉ reads, whichever comes first. At the cap, report what you have; never wait past it.
Re-read while any listed check is `pending`, or while no ungated listed check has reported yet;
never for an `awaiting-gate` or `gated-failure` check. With a caller-supplied list, also re-read
while any is `missing`: workflows on a fresh commit start late. Each re-read passes
`wait_seconds: 45`. For a PR, re-read `head.sha` first; if it moved, go back to Step 2 with the
new SHA. The hard cap, across all SHAs, is **20 reads, about 15 minutes**. A caller's wait cap in
minutes replaces it: the caller's minutes, at most ⌈minutes×4/3⌉ reads, whichever comes first. At
the cap, report what you have; never wait past it.
## Step 4 — Explain failures
For each `failure`, read the job's log as `references/statuses.md` §Failure cause says and write
the cause in one line. Link the job; never paste log text into the result.
For each `failure` and `gated-failure`, write its one-line cause per `references/statuses.md`
§Failure cause.
## Step 5 — Return the result
Overall verdict, first match wins: any `failure` → `fail`; any `missing` → `missing`; any
`pending` → `pending`; else → `pass`.
`pending` → `pending`; else → `pass`. `awaiting-gate` and `gated-failure` pass like `skipped`.
Output format:
```text
Commit: <full SHA> Verdict: <pass|fail|pending|missing>
Human gate: <name> (<awaiting-gate|gated-failure>), … | none
| Check | Role | State | Run | Cause |
```
One row per listed check, in the doc's or the caller's order. `Run` is the absolute job link, or
`none` for a skipped or missing check. `Cause` is the one-line failure cause, else empty. On `pending` or
`missing` the caller decides what follows; you do not.
`none` for a check with no job. `Cause` is the one-line cause of a `failure` or `gated-failure`,
else empty. On `pending` or `missing` the caller decides what follows; you do not.
@@ -26,11 +26,37 @@
|---|---|
| `success` | `success` |
| `skipped` | `skipped`, passing |
| `failure`, `error`, `warning` | `failure` |
| `failure`, `error`, `warning`, role `dry-run-gated` | `gated-failure`, passing |
| `failure`, `error`, `warning`, any other role | `failure` |
| `pending` (Gitea Actions reports queued and running jobs as this), any other value | `pending` |
| no status whose `context` equals the listed name | `missing` |
| no status whose `context` equals the listed name, role `dry-run-gated` | `awaiting-gate`, passing |
| no status whose `context` equals the listed name, any other role | `missing` |
When two statuses share a `context`, use the one with the latest `updated_at`.
When two statuses share a `context`, use the one with the latest `updated_at`. For role
`dry-run-gated`, ignore its `skipped` statuses first and take the latest of the rest; none left →
`awaiting-gate`. A gated job whose label condition is unmet posts `skipped`, and a later label
event on the same SHA posts a newer `skipped` that would otherwise mask an earlier
`gated-failure`.
## Gated dry runs
- `awaiting-gate` is a `dry-run-gated` check with no non-`skipped` status on the pinned SHA: no
human has added its label yet, and only a human can, so waiting for it is pointless. It is never
`missing`.
- A gated check whose latest non-`skipped` status is `pending` or `success` is classified like any
other check.
- `gated-failure` is a gated check whose latest non-`skipped` status is `failure`, `error` or
`warning`. The workflow may fail on purpose while it awaits its label, or the dry run itself may
have failed; either way a human reads it, never the implementer, and it is never waited on. Its
`Run` is the job link and its `Cause` follows §Failure cause, e.g. "Awaiting the Dry run label
from an allowlisted human" or "Infrastructure error in at least one stage".
- Only the delivery doc gives roles, so a caller-supplied list never yields `awaiting-gate` or
`gated-failure`.
- A gated status on an older commit is stale like any other. The label is needed fresh per push,
so after a push the check is `awaiting-gate` again until a human re-adds it.
- The `Human gate:` line names every `awaiting-gate` and `gated-failure` row with its state, e.g.
`Human gate: Ansible Dry Run / ansible_dry_run (pull_request_target) (gated-failure)`, else
`none`.
## Links
@@ -38,7 +64,7 @@ Build the absolute link from the forge's origin, the scheme and host of the PR's
the API `url` fields, plus `target_url`:
`https://git.example.org` + `/<owner>/<repo>/actions/runs/4872/jobs/5907`.
A skipped or missing check has no job, so its `Run` cell is `none`.
A skipped, missing or `awaiting-gate` check has no job, so its `Run` cell is `none`.
## Failure cause
@@ -9,14 +9,14 @@ compatibility: Requires a Gitea forge reached through the Gitea MCP server (via
allowed-tools: Read mcp__gitea__issue_read mcp__gitea__issue_write mcp__gitea__pull_request_read
metadata:
category: delivery
version: "0.2.1"
version: "0.2.2"
---
## Gotchas
- `Status/Ready for Human` is a stop signal, not a Gate, so you may set it. Every real gate —
`Status/Ready for Agent`, a PR approval — is human-only: never set, add or remove a gate label,
and never approve a PR.
`Status/Ready for Agent`, a gated dry run's label, a PR approval — is human-only: never set, add
or remove a gate label, and never approve a PR.
- Check gate *state*, not who set it: in step mode the human launching your stage is the approval.
Do not read the issue timeline.
- `Status/Ready for Agent` and `Status/Ready for Human` must not share an exclusive label scope:
@@ -9,7 +9,7 @@ compatibility: Requires git and a forge remote. Gitea needs the Gitea MCP server
allowed-tools: Bash Read Write Edit
metadata:
category: delivery
version: "0.2.0"
version: "0.4.0"
---
## Gotchas
@@ -49,11 +49,16 @@ syntax. A format change is an edit here, plus every consumer's restatement.
```
- `<status check name>` is the exact string the forge shows on a PR's head commit.
- `<role>` is exactly one of: `dry-run`, `test-path`, `test`, `lint`, `build`, `other`.
- `dry-run` appears on exactly one item unless the section is `- none`. `test-path` appears on at
- `<role>` is exactly one of: `dry-run`, `dry-run-gated`, `test-path`, `test`, `lint`, `build`,
`other`.
- `dry-run` appears on one or more items unless the section is `- none`. `test-path` appears on at
most one item, and on exactly one when the repo has a test-path check.
- Whatever its role, a consumer treats a check reported as "skipped" (a path-filtered workflow
whose paths did not match) as passing.
- `dry-run-gated` (zero or more items) is a dry run that runs only after a user on the human
allowlist adds its gate label to the PR. Until then its status on the head commit may be absent,
`skipped` or a failure, and other events may post a status that does not reflect a dry run.
Consumers never send its failure to the implementer: a human reads it.
- Whatever its role, except `dry-run-gated`, a consumer treats a check reported as "skipped" (a
path-filtered workflow whose paths did not match) as passing.
### 3. Test paths
@@ -146,6 +151,7 @@ Placement only decides where the line sits; the line itself never changes:
## CI checks
- `ci / render-diff (pull_request)`: dry-run
- `ci / plan (pull_request_target)`: dry-run-gated
- `ci / test-paths (pull_request)`: test-path
- `ci / lint (pull_request)`: lint
@@ -182,8 +188,8 @@ The values in the skeleton are illustrative only; every real value comes from th
- [ ] Sections 1–4 and 7 hold only items in the syntax above, or `- none`.
- [ ] Every skill in section 1 is installed. A listed skill that is not installed makes every
consumer hard-stop on any change matching its glob.
- [ ] Section 2: `dry-run` on exactly one item unless the section is `- none`; one `test-path` if
the repo has that check.
- [ ] Section 2: `dry-run` on one or more items unless the section is `- none`; `dry-run-gated`
only on a dry run the human named as label-gated; one `test-path` if the repo has that check.
- [ ] Section 3 is the `globs file:` pointer whenever a test-path check reads a globs file.
- [ ] Section 4 is non-empty and every name came from the human or a source they named.
- [ ] Section 5 holds paths and markdown links, no secret values.
@@ -18,9 +18,9 @@ repo; facts only a human holds come from the human. A value with no source stays
### CI checks
1. Read every workflow under `.gitea/workflows/` or `.github/workflows/` that runs on
`pull_request`. A path-filtered `pull_request` workflow still counts: Gitea reports it as
"skipped" when its paths don't match. List it, usually with role `test`. Workflows that run only
on push, schedule or dispatch are not PR checks; leave them out.
`pull_request` or `pull_request_target`. A path-filtered `pull_request` workflow still counts:
Gitea reports it as "skipped" when its paths don't match. List it, usually with role `test`.
Workflows that run only on push, schedule or dispatch are not PR checks; leave them out.
2. Derive each candidate name:
- Gitea Actions: `<workflow name> / <job name> (<event>)`. The workflow name is the file's
top-level `name:` (else the file name); the job name is the job's `name:` (else the job id).
@@ -32,7 +32,12 @@ repo; facts only a human holds come from the human. A value with no source stays
forge's string wins over the derived one. With no PR to read, keep the derived name and say so
in the PR body.
4. Assign roles. `test-path` is the check that fails when a commit after the
`Delivery-Stage: test-author` commit touches the test globs. `dry-run` comes from the human.
`Delivery-Stage: test-author` commit touches the test globs. `dry-run` and `dry-run-gated`
come from the human: a dry run whose workflow waits for a label (a `labeled` trigger or a
label condition on the job) is a `dry-run-gated` candidate to confirm, never assigned unasked.
A gated check's name must come from the forge, read on a PR where the gated job ran (step 3).
With no such PR, list it as open in the PR body instead: a wrong name stays `awaiting-gate`
forever and never blocks.
### Test paths
@@ -72,8 +77,10 @@ SKILL.md Step 3 asks for these:
- Bot user the agents act as.
- Read-only kubeconfig path, or "no cluster".
- Branch-protection status: in place, or pending with the tracking link.
- Which CI check is the dry run. A repo with PR checks but no dry-run check is not ready for the
delivery team: say so in the PR body as open and stop.
- Which CI checks are dry runs, and which of those are label-gated: they post a status only after an
allowlisted human adds a label. For each gated one, confirm its workflow runs only on that one
named label (the filter read from the workflow). A repo with PR checks but no ungated dry-run
check is not ready for the delivery team: say so in the PR body as open and stop.
- Test-path globs, when no globs file exists (confirm the derived list).
- Post-merge items for a push workflow with no path filter (confirm the derived directories).
- Accepted risks: the ADR or issue links, or "none".
@@ -9,7 +9,7 @@ compatibility: Requires a Gitea forge with Actions reached through the Gitea MCP
allowed-tools: Read mcp__gitea__pull_request_read mcp__gitea__issue_read mcp__gitea__commit_read mcp__gitea__actions_run_read mcp__gitea__get_file_contents
metadata:
category: delivery
version: "0.1.0"
version: "0.3.0"
---
## Gotchas
@@ -137,9 +137,14 @@ be encrypted and is not is itself the finding.
## 7. Dry run
Take the `dry-run` row from the `delivery-ci-checks` table. No such row (its CI checks are
`- none`) → add nothing. `failure` is already a blocking finding from check 1. `skipped` → no
output to judge; add nothing. `success` → read its job log:
Apply this to every `dry-run` and `dry-run-gated` row in the `delivery-ci-checks` table. No such
row (its CI checks are `- none`) → add nothing. `failure` is already a blocking finding from
check 1. `skipped` → no output to judge; add nothing. `awaiting-gate` → non-blocking, "gated dry
run `<name>` has not run yet; the approver judges its output once it does", linking
`<PR html_url>/files`. `gated-failure` → non-blocking, never sent back to the implementer: "gated
dry run `<name>` did not pass: `<cause>`; the approver reads it before approving", linking its
`Run` job link.
`success` → read its job log:
```text
mcp__gitea__actions_run_read method get_job_log_preview, job_id <id from the Run link>,
+1 -1
View File
@@ -1,5 +1,5 @@
name: delivery
version: 0.6.0
version: 0.8.0
description: Agents and skills for taking a change from spec to a verified merge through tracker-gated stages.
author:
name: Mortis
@@ -7,7 +7,7 @@ description: >
fixes -> agent-author.
allowed-tools: Bash Read
metadata:
version: "1.0.6"
version: "1.0.7"
category: factory
source_keys:
- agentskills-home
@@ -1055,7 +1055,7 @@ FRONTMATTER_RE = re.compile(
def strip_bom(text):
return text[1:] if text.startswith(u'') else text
return text[1:] if text.startswith(u'\ufeff') else text
class FrontmatterError(Exception):
+7
View File
@@ -55,6 +55,13 @@
set -uo pipefail
# Scrub git's repo-locating env before apm runs: pushed from a linked worktree,
# the hook inherits an absolute GIT_DIR, and apm's drift replay runs `git init`
# / `git checkout` in a temp dir with it -- flipping core.bare=true and moving
# the worktree's HEAD (issue #204). See the helper for the full account.
# shellcheck source=scripts/lib/clean-git-env.sh
source "$(dirname "${BASH_SOURCE[0]}")/lib/clean-git-env.sh"
readonly WAIVED_CHECK='declares dependencies but apm.lock.yaml is absent'
readonly SOLE_FAILURE='1 of 1 check(s) failed'
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# apm-pack-check-clean pre-push hook: `apm pack --check-versions --check-clean
# --dry-run`, run with git's repo-locating env scrubbed first. A script rather
# than a bare `apm ...` entry only so it can source that scrub -- see
# scripts/lib/clean-git-env.sh and issue #204, and docs/spec/gates.md,
# "apm-audit-ci", the "apm runs with git's repo-locating env scrubbed" paragraph.
set -euo pipefail
# shellcheck source=scripts/lib/clean-git-env.sh
source "$(dirname "${BASH_SOURCE[0]}")/lib/clean-git-env.sh"
exec apm pack --check-versions --check-clean --dry-run
+6 -3
View File
@@ -58,15 +58,18 @@ if ! command -v python3 >/dev/null 2>&1; then
fi
# --- Discover the agent files ---
# `-not -path` mirrors tests/run-bats.sh: worktrees under .claude/ are other
# checkouts of this same repo, not additional content.
# No `.claude/worktrees` exclusion, unlike tests/run-bats.sh: the walk starts at
# $REPO_ROOT/plugins, so a worktree nested at $REPO_ROOT/.claude/worktrees/ is
# unreachable and there is nothing to exclude. A `-not -path` glob here would
# match against ABSOLUTE paths, and when this checkout is itself a Claude
# worktree (<repo>/.claude/worktrees/<name>/) every path contains that segment,
# so it excluded every agent file and failed the derived check below (#199).
AGENT_FILES=()
while IFS= read -r f; do
[[ -n "$f" ]] && AGENT_FILES+=("$f")
done < <(
find "$REPO_ROOT/plugins" -type f -name '*.agent.md' \
-path '*/.apm/agents/*' \
-not -path '*/.claude/worktrees/*' \
2>/dev/null | sort
)
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Scrubs git's repo-locating environment variables from the current shell, so
# every git process it spawns -- directly or through another tool -- discovers
# its repository from its own working directory. Issue #204.
#
# Why: `git push` from a LINKED worktree exports an absolute
# GIT_DIR=<main>/.git/worktrees/<name> to its hooks (from the main checkout it
# exports none). A hook that runs a tool which itself runs git in a temp dir --
# apm's drift replay does `git init` / `git checkout` there with os.environ --
# hands that GIT_DIR on, and the temp-dir git operates on THIS repo instead:
# core.bare=true in the shared .git/config, and the worktree's HEAD moved to a
# lock-pinned commit. Hooks run from the worktree root, so plain discovery
# finds the right repo once these are gone.
#
# Config-passing vars (GIT_CONFIG_PARAMETERS, GIT_CONFIG_COUNT) are kept on purpose: they carry `git -c` overrides apm's remote clones may need.
#
# Not meant to be executed directly -- source it before any git call.
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY GIT_COMMON_DIR \
GIT_PREFIX GIT_IMPLICIT_WORK_TREE
+557
View File
@@ -0,0 +1,557 @@
#!/usr/bin/env bash
set -euo pipefail
# Cuts the per-plugin release tags ADR-0033 requires: one annotated tag
# `<plugin>-v<version>` per version a plugin ships on main, on the commit where
# that version first landed. Consumers pin these (Renovate's apm manager, `apm
# outdated`); the repo-level v* tags match no plugin.
#
# Usage: scripts/tag-plugin-releases.sh [--apply] [--ref <rev>] [--plugin <name>]...
#
# (no flags) dry run: print the table, create nothing.
# --apply create every MISSING tag locally, then print the exact
# `git push origin <tag>...` line. This script never pushes and
# never fetches; the push runs only on the maintainer's explicit
# yes to that exact line (ADR-0033). Requires origin/main to
# resolve and the ref to be on origin/main's FIRST-PARENT
# history (a commit of a merged feature branch is not);
# otherwise exit 2.
# --ref <rev> the history to read (default origin/main; a dry run falls
# back to the local `main` with a staleness note, --apply
# never does).
# --plugin <n> limit to these plugins (repeatable; default: every plugin).
#
# Run `git fetch origin --tags` first. The script reads only local refs, so a
# stale origin/main hides a merged bump and a missing remote tag reads MISSING.
#
# Everything is read from the ref's git objects (`git ls-tree`, `git show`),
# never the working tree, so a dirty checkout or another branch cannot change
# the answer.
#
# Per plugin (a directory under plugins/ carrying apm.yml at the ref):
# - apm.yml `name` must equal the directory and `version` must be strict
# MAJOR.MINOR.PATCH at the ref, neither containing whitespace; otherwise
# exit 2.
# - Walk the ref's FIRST-PARENT history over commits touching
# plugins/<p>/apm.yml, oldest first, and group contiguous equal-version
# commits into runs. An apm.yml edit that leaves the version alone extends
# the current run; it never starts a new one. A run's target is its oldest
# commit: the merge or squash commit on main where the version first
# landed, never a feature-branch commit.
# - Every `<p>-v<semver>` tag reachable from the ref is validated: it must be
# annotated and peel to the target of the FIRST run carrying its own
# version. Any other such tag (including one on a later run of a recurring
# version) is an ERROR row naming it, and it never serves as the start
# point, so a mis-cut tag can neither hide runs nor go unreported.
# - Wanted runs: every run from the newest validly tagged run onward. With
# no valid tag (the backfill), every run from the FIRST landing of the
# current version onward; when the current version never recurred, that is
# the current run alone. Older history is not tagged retroactively.
# - A version is released once, at its FIRST landing: the oldest valid run
# of that version anywhere in the ref's first-parent history. Validating
# existing tags and choosing what to create use this one definition. When
# a version recurs (a revert, or apm.yml deleted and re-added), the later
# run is never tagged: it reports RELEASED. If the version is untagged and
# its first landing lies before the wanted runs, it shipped before the
# tagging start point: the later run still reports RELEASED (with a note
# naming the first landing) and no tag is created for it.
# - Status per wanted run: MISSING (no tag), OK (annotated, peels to the
# target), RELEASED (a later run of a version whose first landing is
# earlier, tagged or not), ERROR (lightweight, peels to anything but the
# version's first landing, or an invalid version in the wanted runs).
# RELEASED never blocks other rows and never changes the exit code.
# - An INVALID run inside the wanted runs is an ERROR, so --apply creates
# nothing for any plugin until it is resolved. The way out is the
# maintainer's (ADR-0033): cut by hand the annotated tag of the first valid
# version after the invalid run, on that version's first landing; it
# becomes the start point and the invalid run is no longer wanted.
#
# Preflight (exit 2 before any history is read): a selected plugin directory
# whose name starts with `-` (its tag would parse as an option) or whose
# `<p>-v<version>` git check-ref-format rejects (e.g. `a..b`, `a*`): no such
# tag can ever exist, so the plugin can never be released under this scheme.
#
# Tag matching is anchored: `<p>-v` followed by a strict semver and nothing
# else, so git, gitea and gitops never claim each other's tags.
#
# Tags are immutable: this script never moves, deletes or overwrites one.
# --apply is all-or-nothing: any ERROR anywhere creates nothing. If `git tag`
# still fails mid-run, the tags already created are listed with their push
# line and the script exits 2.
#
# Exit: 0 nothing missing (or --apply created all of it); 1 dry run found
# MISSING tags; 2 any ERROR, bad input, shallow clone, unresolvable ref,
# --apply off origin/main's first-parent history, missing python3/PyYAML, or a
# `git tag` failure during --apply.
export LC_ALL=C
# shellcheck source=scripts/lib/clean-git-env.sh
source "$(dirname "${BASH_SOURCE[0]}")/lib/clean-git-env.sh"
usage() {
echo "Usage: $0 [--apply] [--ref <rev>] [--plugin <name>]..." >&2
}
APPLY=false
REF=""
PLUGINS=()
while [[ $# -gt 0 ]]; do
case "$1" in
--apply) APPLY=true; shift ;;
--ref)
[[ $# -ge 2 && -n "$2" ]] || { usage; exit 2; }
REF="$2"; shift 2 ;;
--plugin)
[[ $# -ge 2 && -n "$2" ]] || { usage; exit 2; }
# A repeat would make --apply try to create the same tag twice.
dup=false
for q in ${PLUGINS[@]+"${PLUGINS[@]}"}; do
[[ "$q" == "$2" ]] && { dup=true; break; }
done
$dup || PLUGINS+=("$2")
shift 2 ;;
-h|--help) usage; exit 0 ;;
*) echo "FAIL: unknown argument: $1" >&2; usage; exit 2 ;;
esac
done
if ! REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null)"; then
echo "FAIL: not inside a git work tree." >&2
exit 2
fi
cd "$REPO_ROOT"
if ! command -v python3 > /dev/null 2>&1; then
echo "FAIL: python3 is required to read apm.yml but was not found on PATH." >&2
exit 2
fi
if ! python3 -c 'import yaml' > /dev/null 2>&1; then
echo "FAIL: PyYAML is required to read apm.yml but is not importable by python3." >&2
echo " Fix: python3 -m pip install PyYAML (or your distro's python3-yaml package)." >&2
exit 2
fi
# A shallow clone truncates first-parent history, so the oldest commit of a run
# would be wrong without any error. Fail closed.
if [[ "$(git rev-parse --is-shallow-repository)" == "true" ]]; then
echo "FAIL: shallow clone; run targets cannot be computed from truncated history." >&2
echo " Fix: git fetch --unshallow origin, then retry." >&2
exit 2
fi
is_ancestor() { git merge-base --is-ancestor "$1" "$2" 2>/dev/null; }
if [[ -n "$REF" ]]; then
if ! REF_COMMIT="$(git rev-parse --verify -q "$REF^{commit}")"; then
echo "FAIL: --ref $REF does not resolve to a commit." >&2
exit 2
fi
else
if REF_COMMIT="$(git rev-parse --verify -q "origin/main^{commit}")"; then
REF="origin/main"
elif REF_COMMIT="$(git rev-parse --verify -q "main^{commit}")"; then
REF="main"
echo "NOTE: origin/main does not resolve; reading local main, which may be behind the remote." >&2
else
echo "FAIL: neither origin/main nor main resolves; pass --ref <rev>." >&2
exit 2
fi
fi
# --apply tags only commits on origin/main's FIRST-PARENT history: never a
# feature-branch commit (not even one of a branch already merged, which is an
# ancestor of origin/main but not on its first-parent line), and never the
# local `main`, which may hold unpushed work.
if $APPLY; then
if ! ORIGIN_MAIN="$(git rev-parse --verify -q "origin/main^{commit}")"; then
echo "FAIL: --apply needs origin/main, which does not resolve; run git fetch origin --tags first." >&2
exit 2
fi
# grep reads the whole list from a process substitution, so an early match
# cannot fail the pipeline under pipefail.
if ! grep -qxF "$REF_COMMIT" < <(git rev-list --first-parent "$ORIGIN_MAIN"); then
echo "FAIL: --apply: $REF (${REF_COMMIT:0:7}) is not on origin/main's first-parent history; release tags go only on main's own commits." >&2
exit 2
fi
fi
# Plugin directories at the ref: trees under plugins/ that carry apm.yml.
# NUL-separated, so unusual names are read verbatim, never quoted.
ALL_PLUGINS=()
while IFS= read -r -d '' path; do
p="${path#plugins/}"
if git cat-file -e "$REF_COMMIT:plugins/$p/apm.yml" 2>/dev/null; then
ALL_PLUGINS+=("$p")
fi
done < <(git ls-tree -z -d --name-only "$REF_COMMIT" plugins/)
if [[ ${#PLUGINS[@]} -eq 0 ]]; then
PLUGINS=(${ALL_PLUGINS[@]+"${ALL_PLUGINS[@]}"})
else
for p in ${PLUGINS[@]+"${PLUGINS[@]}"}; do
found=false
for q in ${ALL_PLUGINS[@]+"${ALL_PLUGINS[@]}"}; do
[[ "$p" == "$q" ]] && { found=true; break; }
done
if ! $found; then
echo "FAIL: --plugin $p: no plugins/$p/apm.yml at $REF." >&2
exit 2
fi
done
fi
if [[ ${#PLUGINS[@]} -eq 0 ]]; then
echo "FAIL: no plugins/<name>/apm.yml found at $REF." >&2
exit 2
fi
# A leading dash would make the tag name `-x-v1.0.0` parse as an option. A
# name git rejects as a ref (`..`, `*`, `[`, `?`, `\`, ...) can never be
# tagged. Both are rejected before any history is read, so such a name never
# reaches a pathspec or a ref pattern. The version part is strict semver
# (digits and single dots), so the name alone decides validity.
for p in ${PLUGINS[@]+"${PLUGINS[@]}"}; do
if [[ "$p" == -* ]]; then
echo "ERROR: plugins/$p: a plugin name must not start with '-' (its tag would parse as an option)." >&2
exit 2
fi
if ! git check-ref-format "refs/tags/$p-v0.0.0"; then
echo "ERROR: plugins/$p: '$p-v<version>' is not a valid tag name (git check-ref-format); rename the plugin directory." >&2
exit 2
fi
done
# Every tag, listed once. A plugin's tags are picked out below by an exact
# string prefix in the shell, never by a for-each-ref pattern, so nothing in a
# plugin name is ever read as a glob.
if ! tag_list="$(git for-each-ref --format='%(refname:strip=2)' refs/tags/)"; then
echo "FAIL: git for-each-ref could not list tags." >&2
exit 2
fi
ALL_TAGS=()
if [[ -n "$tag_list" ]]; then
while IFS= read -r t; do ALL_TAGS+=("$t"); done <<< "$tag_list"
fi
# Reads "<commit>" lines on stdin and, for plugin path $1, prints one line per
# commit: "<commit> OK <name> <version>", "<commit> INVALID <name|-> -" when
# the version is not strict semver or the YAML does not parse, or
# "<commit> ABSENT - -" when the commit has no such file. A name containing
# whitespace prints as "<whitespace>", which never equals a directory name; a
# version containing whitespace is INVALID. Blobs come from one
# `git cat-file --batch`, so the cost is one python3 start per plugin, not per
# commit. A crash prints nothing for the remaining commits; the caller checks
# the count.
read_versions() {
python3 -c '
import re, subprocess, sys, yaml
path = sys.argv[1]
commits = [l.strip() for l in sys.stdin if l.strip()]
p = subprocess.Popen(["git", "cat-file", "--batch"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
SEMVER = re.compile(r"(0|[1-9][0-9]{0,8})\.(0|[1-9][0-9]{0,8})\.(0|[1-9][0-9]{0,8})")
for c in commits:
p.stdin.write(("%s:%s\n" % (c, path)).encode()); p.stdin.flush()
header = p.stdout.readline().decode().split()
if len(header) < 3 or header[-1] == "missing":
print(c, "ABSENT - -"); continue
if header[1] != "blob":
p.stdout.read(int(header[2])); p.stdout.readline()
print(c, "ABSENT - -"); continue
data = p.stdout.read(int(header[2])); p.stdout.readline()
try:
doc = yaml.safe_load(data.decode("utf-8-sig", errors="replace"))
except yaml.YAMLError:
doc = None
name = doc.get("name") if isinstance(doc, dict) else None
ver = doc.get("version") if isinstance(doc, dict) else None
name = "-" if name is None else (str(name) or "-")
if re.search(r"\s", name):
name = "<whitespace>"
ver = None if ver is None else str(ver)
if ver is not None and SEMVER.fullmatch(ver):
print(c, "OK", name, ver)
else:
print(c, "INVALID", name, "-")
p.stdin.close(); p.wait()
' "$1"
}
SEMVER_RE='^(0|[1-9][0-9]{0,8})\.(0|[1-9][0-9]{0,8})\.(0|[1-9][0-9]{0,8})$'
# Result rows, index-matched (bash 3.2 has no declare -A).
ROW_PLUGIN=(); ROW_VERSION=(); ROW_COMMIT=(); ROW_STATUS=(); ROW_DETAIL=()
add_row() {
ROW_PLUGIN+=("$1"); ROW_VERSION+=("$2"); ROW_COMMIT+=("$3"); ROW_STATUS+=("$4"); ROW_DETAIL+=("$5")
}
# first_run <version> <run index>: over ALL the current plugin's runs (the
# whole first-parent history, not only the wanted ones), print the index of the
# first valid run of <version> before <run index> and succeed, or fail when
# there is none (that run is itself the version's first landing). Every "where
# did this version first land" question, whether validating a tag or deciding
# what to create, goes through this one function.
first_run() {
local j
for ((j = 0; j < $2; j++)); do
if [[ "${RUN_VALID[j]}" == true && "${RUN_VER[j]}" == "$1" ]]; then echo "$j"; return 0; fi
done
return 1
}
for p in ${PLUGINS[@]+"${PLUGINS[@]}"}; do
apm="plugins/$p/apm.yml"
# Literal pathspec: a plugin name is never read as a glob or pathspec magic.
apm_spec=":(literal)$apm"
# Oldest first. --first-parent with a path keeps each first-parent commit
# whose apm.yml differs from its first parent's: on main that is the merge
# or squash commit that brought the change in.
# Captured first, so a git failure is caught rather than read as no history.
if ! revs="$(git rev-list --first-parent --reverse "$REF_COMMIT" -- "$apm_spec")"; then
echo "FAIL: git rev-list could not read $apm history at $REF (see error above)." >&2
exit 2
fi
COMMITS=()
if [[ -n "$revs" ]]; then
while IFS= read -r c; do COMMITS+=("$c"); done <<< "$revs"
fi
LINES=()
while IFS= read -r l; do LINES+=("$l"); done \
< <(printf '%s\n' ${COMMITS[@]+"${COMMITS[@]}"} | read_versions "$apm")
if [[ ${#LINES[@]} -ne ${#COMMITS[@]} ]]; then
echo "FAIL: could not read $apm across $REF history (see error above)." >&2
exit 2
fi
# The ref's own copy is authoritative for name and current version.
read -r _ cur_status cur_name _ <<< "$(printf '%s\n' "$REF_COMMIT" | read_versions "$apm")"
if [[ "$cur_name" == "<whitespace>" ]]; then
echo "FAIL: $apm at $REF has whitespace in its name; it must equal the directory name '$p'." >&2
exit 2
fi
if [[ "$cur_name" != "$p" ]]; then
echo "FAIL: $apm at $REF has name '$cur_name'; it must equal the directory name '$p' (the tag is '$p-v<version>')." >&2
exit 2
fi
if [[ "$cur_status" != "OK" ]]; then
echo "FAIL: $apm at $REF has no strict MAJOR.MINOR.PATCH version (no whitespace allowed)." >&2
exit 2
fi
# Group into runs. A commit where the file is absent breaks contiguity.
RUN_VER=(); RUN_TARGET=(); RUN_VALID=()
prev=""
for l in ${LINES[@]+"${LINES[@]}"}; do
read -r c st _ v <<< "$l"
case "$st" in
ABSENT) prev=""; continue ;;
INVALID) key="INVALID" ;;
*) key="$v" ;;
esac
if [[ "$key" != "$prev" ]]; then
RUN_VER+=("$v"); RUN_TARGET+=("$c")
if [[ "$st" == OK ]]; then RUN_VALID+=(true); else RUN_VALID+=(false); fi
prev="$key"
fi
done
nruns=${#RUN_VER[@]}
# apm.yml exists at the ref, so its history has at least one run; none means
# the history read is wrong, and every rule below would be meaningless.
if [[ $nruns -eq 0 ]]; then
echo "FAIL: $apm exists at $REF but no commit on its first-parent history carries it; cannot compute release targets." >&2
exit 2
fi
# Start point: the newest run a VALID reachable <p>-v<semver> tag peels to.
# Every such tag is validated first: annotated, and peeling to the target of
# the FIRST run carrying its own version (a version is released once, at its
# first landing). Any other is recorded as bad: it is reported and never
# serves as the start point, so it cannot hide the runs before it.
anchor=-1
BAD_TAG=(); BAD_VER=(); BAD_COMMIT=(); BAD_DETAIL=()
for tagname in ${ALL_TAGS[@]+"${ALL_TAGS[@]}"}; do
[[ "$tagname" == "$p-v"* ]] || continue
tv="${tagname#"$p-v"}"
[[ "$tv" =~ $SEMVER_RE ]] || continue
if ! peeled="$(git rev-parse --verify -q "refs/tags/$tagname^{commit}")"; then
BAD_TAG+=("$tagname"); BAD_VER+=("$tv"); BAD_COMMIT+=("-")
BAD_DETAIL+=("$tagname does not peel to a commit")
continue
fi
is_ancestor "$peeled" "$REF_COMMIT" || continue
if [[ "$(git cat-file -t "refs/tags/$tagname")" != "tag" ]]; then
BAD_TAG+=("$tagname"); BAD_VER+=("$tv"); BAD_COMMIT+=("$peeled")
BAD_DETAIL+=("$tagname is a lightweight tag; it must be annotated")
continue
fi
pos=-1
for ((i = 0; i < nruns; i++)); do
if [[ "${RUN_TARGET[i]}" == "$peeled" && "${RUN_VALID[i]}" == true && "${RUN_VER[i]}" == "$tv" ]]; then pos=$i; fi
done
if [[ $pos -lt 0 ]]; then
BAD_TAG+=("$tagname"); BAD_VER+=("$tv"); BAD_COMMIT+=("$peeled")
BAD_DETAIL+=("$tagname peels to ${peeled:0:7}, which is no landing of $tv on the first-parent history")
continue
fi
if fj="$(first_run "$tv" "$pos")"; then
fl="${RUN_TARGET[fj]}"
BAD_TAG+=("$tagname"); BAD_VER+=("$tv"); BAD_COMMIT+=("$peeled")
BAD_DETAIL+=("$tagname peels to ${peeled:0:7}, a later landing of $tv; it first landed at ${fl:0:7}")
continue
fi
[[ $pos -gt $anchor ]] && anchor=$pos
done
if [[ $anchor -ge 0 ]]; then
first=$anchor
else
# Backfill: start at the current version's first landing, so it is
# released once, there; a later run of it then reports RELEASED.
cur_ver="${RUN_VER[nruns - 1]}"
first=$((nruns - 1))
if fj="$(first_run "$cur_ver" "$nruns")"; then first=$fj; fi
fi
# Tags the run loop below reports itself, so the bad-tag rows skip them.
REPORTED=()
for ((i = first; i < nruns; i++)); do
v="${RUN_VER[i]}"; target="${RUN_TARGET[i]}"
if [[ "${RUN_VALID[i]}" != true ]]; then
add_row "$p" "INVALID" "$target" ERROR "$apm version at ${target:0:7} is not MAJOR.MINOR.PATCH"
continue
fi
tag="$p-v$v"
if ! git rev-parse --verify -q "refs/tags/$tag" > /dev/null; then
# Untagged. Only the version's first landing anywhere in history is
# ever tagged. Inside the wanted runs, that run is MISSING and this later
# one is RELEASED. Before them, the version shipped before the tagging
# start point: it stays untagged like the rest of that history, and
# tagging this later run would only be reported as a later landing.
if fj="$(first_run "$v" "$i")"; then
fl="${RUN_TARGET[fj]}"
if [[ $fj -lt $first ]]; then
add_row "$p" "$v" "$target" RELEASED "$v first landed at ${fl:0:7}, before the tagged range; not tagged"
else
add_row "$p" "$v" "$target" RELEASED "$v is released at its first landing ${fl:0:7}"
fi
continue
fi
add_row "$p" "$v" "$target" MISSING ""
continue
fi
if [[ "$(git cat-file -t "refs/tags/$tag")" != "tag" ]]; then
add_row "$p" "$v" "$target" ERROR "$tag is a lightweight tag; it must be annotated"
REPORTED+=("$tag")
continue
fi
peeled="$(git rev-parse --verify -q "refs/tags/$tag^{commit}" || true)"
if [[ "$peeled" == "$target" ]]; then
if fj="$(first_run "$v" "$i")"; then
fl="${RUN_TARGET[fj]}"
add_row "$p" "$v" "$target" ERROR "$tag peels to ${target:0:7}, a later landing of $v; it first landed at ${fl:0:7}"
REPORTED+=("$tag")
continue
fi
add_row "$p" "$v" "$target" OK ""
continue
fi
# Tagged elsewhere: fine only if it peels to the version's FIRST landing
# (e.g. before a revert brought $v back).
if fj="$(first_run "$v" "$i")" && [[ "${RUN_TARGET[fj]}" == "$peeled" ]]; then
add_row "$p" "$v" "$target" RELEASED "$tag already released at ${peeled:0:7}"
continue
fi
add_row "$p" "$v" "$target" ERROR "$tag peels to ${peeled:0:7}, which is not the first landing of $v"
REPORTED+=("$tag")
done
# Bad tags no wanted run reported: one ERROR row each, naming the tag.
for ((k = 0; k < ${#BAD_TAG[@]}; k++)); do
seen=false
for r in ${REPORTED[@]+"${REPORTED[@]}"}; do
[[ "$r" == "${BAD_TAG[k]}" ]] && { seen=true; break; }
done
$seen || add_row "$p" "${BAD_VER[k]}" "${BAD_COMMIT[k]}" ERROR "${BAD_DETAIL[k]}"
done
done
print_table() {
local i
printf '%-12s %-10s %-8s %s\n' PLUGIN VERSION COMMIT STATUS
for ((i = 0; i < ${#ROW_PLUGIN[@]}; i++)); do
printf '%-12s %-10s %-8s %s\n' "${ROW_PLUGIN[i]}" "${ROW_VERSION[i]}" "${ROW_COMMIT[i]:0:7}" "${ROW_STATUS[i]}"
done
}
ERRORS=0; MISSING=0
for ((i = 0; i < ${#ROW_STATUS[@]}; i++)); do
case "${ROW_STATUS[i]}" in
ERROR) ERRORS=$((ERRORS + 1)) ;;
MISSING) MISSING=$((MISSING + 1)) ;;
esac
done
report_released() {
local i
for ((i = 0; i < ${#ROW_STATUS[@]}; i++)); do
[[ "${ROW_STATUS[i]}" == RELEASED ]] && echo "NOTE: ${ROW_PLUGIN[i]}: ${ROW_DETAIL[i]}; nothing to tag at ${ROW_COMMIT[i]:0:7}." >&2
done
return 0
}
report_errors() {
local i
for ((i = 0; i < ${#ROW_STATUS[@]}; i++)); do
[[ "${ROW_STATUS[i]}" == ERROR ]] && echo "ERROR: ${ROW_PLUGIN[i]}: ${ROW_DETAIL[i]}" >&2
done
echo "Agents: stop and report this to the maintainer; never hand-fix, move or delete a tag (AGENTS.md)." >&2
echo "Maintainer: tags are immutable; fix by hand only after deciding which commit each version belongs to (ADR-0033)." >&2
}
if ! $APPLY; then
print_table
report_released
if [[ $ERRORS -gt 0 ]]; then report_errors; exit 2; fi
if [[ $MISSING -gt 0 ]]; then
echo "$MISSING tag(s) missing at $REF. Re-run with --apply to create them." >&2
exit 1
fi
exit 0
fi
if [[ $ERRORS -gt 0 ]]; then
print_table
report_released
report_errors
echo "Nothing created: --apply is all-or-nothing." >&2
exit 2
fi
CREATED=()
print_push() {
[[ ${#CREATED[@]} -gt 0 ]] || return 0
echo "Created ${#CREATED[@]} tag(s) locally. Push them with exactly this line, only on the maintainer's explicit yes (ADR-0033):"
echo "git push origin ${CREATED[*]}"
}
for ((i = 0; i < ${#ROW_STATUS[@]}; i++)); do
[[ "${ROW_STATUS[i]}" == MISSING ]] || continue
tag="${ROW_PLUGIN[i]}-v${ROW_VERSION[i]}"
if ! git tag -a "$tag" -m "${ROW_PLUGIN[i]} ${ROW_VERSION[i]}" "${ROW_COMMIT[i]}"; then
ROW_STATUS[i]=ERROR
print_table
echo "ERROR: git tag $tag failed (see above); stopped there." >&2
print_push
exit 2
fi
ROW_STATUS[i]=CREATED
CREATED+=("$tag")
done
print_table
report_released
print_push
exit 0
+4 -2
View File
@@ -33,8 +33,10 @@
# TEST_DIR — override root to search for test-*.sh (default: REPO_ROOT); used by tests.
set -euo pipefail
# Git exports GIT_DIR (and can export GIT_WORK_TREE / GIT_INDEX_FILE) to the
# hooks it runs, so under the run-tests pre-push hook every `git -C "$tmp" ...`
# When the push runs from a linked worktree, git exports an absolute GIT_DIR
# (and can export GIT_WORK_TREE / GIT_INDEX_FILE) to the hooks it runs (#204;
# from the main checkout it exports none), so under the run-tests pre-push
# hook every `git -C "$tmp" ...`
# a fixture runs resolves to THIS repo, not the temp one -- the
# validate-provenance-skill.bats commit_as_base helper flipped core.bare=true and
# emptied the index here on every push. Suites build their own throwaway repos;
+1 -1
View File
@@ -741,7 +741,7 @@ EXPECTED = {
'check-apm-agents-valid': (
'bash scripts/check-apm-agents-valid.sh', ['pre-push']),
'apm-pack-check-clean': (
'apm pack --check-versions --check-clean --dry-run', ['pre-push']),
'scripts/apm-pack-check-clean.sh', ['pre-push']),
'check-scope-walkup-sync': (
'bash scripts/check-scope-walkup-sync.sh', ['pre-push']),
'check-provenance-corpus': (
+1 -1
View File
@@ -85,7 +85,7 @@ fm_lines = ['name: ' + name, 'description: ' + desc]
if kind == 'plain':
pass
elif kind == 'bom':
prefix = ''
prefix = '\ufeff'
elif kind == 'leading-blanks':
prefix = '\n\n \n'
elif kind == 'trailing-ws':
+122
View File
@@ -0,0 +1,122 @@
#!/usr/bin/env bash
# Regression test for issue #204: the apm pre-push hooks must not hand a
# hook-exported GIT_DIR to apm.
#
# `git push` from a LINKED worktree exports GIT_DIR=<main>/.git/worktrees/<name>
# (absolute) to its hooks; from the main checkout it exports none. apm 0.28.0's
# drift replay runs `git init` / `git checkout` in a temp dir with an env copied
# from os.environ, so the inherited GIT_DIR wins: `git init` wrote
# core.bare=true into the shared .git/config, and a later checkout moved the
# worktree's HEAD to the lock-pinned commit.
#
# The stub `apm` below reproduces that pattern -- record GIT_DIR, then `git init`
# and `git checkout` inside a fresh `mktemp -d` -- and each hook script is run
# from a linked worktree of a throwaway repo with GIT_DIR exported the way git
# exports it. Nothing here touches the repo this suite lives in.
set -euo pipefail
# This suite builds its own repos; it must never inherit the caller's.
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY GIT_COMMON_DIR
export GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_NOSYSTEM=1
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
PASS=0
FAIL=0
pass() { echo " PASS: $1"; PASS=$((PASS + 1)); }
fail() { echo " FAIL: $1"; FAIL=$((FAIL + 1)); }
FIXTURES=()
cleanup() { [[ ${#FIXTURES[@]} -eq 0 ]] || rm -rf "${FIXTURES[@]}"; }
trap cleanup EXIT
g() { git -c user.name=fixture -c user.email=[email protected] "$@"; }
# Builds <dir>/main (two commits on `main`) and <dir>/wt, a linked worktree on
# branch `feature`, with a plugins/demo/ package dir so the audit script's
# per-package loop has something to iterate. Also writes <dir>/bin/apm, the stub.
make_fixture() {
local dir="$1"
mkdir -p "$dir/bin"
g init -q -b main "$dir/main"
echo one > "$dir/main/f"
g -C "$dir/main" add f
g -C "$dir/main" commit -q -m one
echo two > "$dir/main/f"
g -C "$dir/main" commit -q -am two
g -C "$dir/main" worktree add -q -b feature "$dir/wt"
mkdir -p "$dir/wt/plugins/demo"
# The "locked sha" the replay checks out: the first commit.
local locked
locked="$(g -C "$dir/main" rev-parse HEAD~1)"
cat > "$dir/bin/apm" <<EOF
#!/usr/bin/env bash
printf '%s\n' "\${GIT_DIR-<unset>}" >> "$dir/apm-saw-git-dir"
tmp="\$(mktemp -d)"
( cd "\$tmp" && git init -q . >/dev/null 2>&1; git checkout -q --detach $locked >/dev/null 2>&1 ) || true
rm -rf "\$tmp"
exit 0
EOF
chmod +x "$dir/bin/apm"
}
# check_hook <label> <script>
check_hook() {
local label="$1" script="$2" dir rc=0
dir="$(mktemp -d)"
FIXTURES+=("$dir")
make_fixture "$dir"
echo ""
echo "--- $label: run from a linked worktree with GIT_DIR exported ---"
if [[ ! -f "$script" ]]; then
fail "$label: $script does not exist"
return
fi
(
cd "$dir/wt"
export GIT_DIR="$dir/main/.git/worktrees/wt"
export PATH="$dir/bin:$PATH"
bash "$script"
) > "$dir/out" 2>&1 || rc=$?
if [[ "$rc" -eq 0 ]]; then
pass "$label: exits 0 when apm passes"
else
fail "$label: exited $rc; output: $(cat "$dir/out")"
fi
local bare
bare="$(git -C "$dir/main" config --get core.bare || true)"
if [[ "$bare" == "false" ]]; then
pass "$label: main repo core.bare is still false"
else
fail "$label: main repo core.bare is '$bare', expected false"
fi
local branch
branch="$(git -C "$dir/wt" symbolic-ref -q --short HEAD || echo '<detached>')"
if [[ "$branch" == "feature" ]]; then
pass "$label: worktree still on its branch"
else
fail "$label: worktree HEAD is '$branch', expected feature"
fi
if [[ ! -s "$dir/apm-saw-git-dir" ]]; then
fail "$label: stub apm never ran"
elif grep -qvxF '<unset>' "$dir/apm-saw-git-dir"; then
fail "$label: apm inherited GIT_DIR: $(sort -u "$dir/apm-saw-git-dir" | tr '\n' ' ')"
else
pass "$label: apm saw no GIT_DIR"
fi
}
check_hook apm-audit-ci "$REPO_ROOT/scripts/apm-audit-ci.sh"
check_hook apm-pack-check-clean "$REPO_ROOT/scripts/apm-pack-check-clean.sh"
echo ""
echo "Results: $PASS passed, $FAIL failed"
[[ "$FAIL" -eq 0 ]]
+34
View File
@@ -17,6 +17,12 @@ set -euo pipefail
# defect it exists to close — so the clean run's own count is asserted against
# the index rather than taken on trust.
# Fixtures below run `git init`/`git commit` in temp dirs. Under a git hook,
# git exports GIT_DIR (and can export GIT_WORK_TREE / GIT_INDEX_FILE), which
# would point every `git -C "$fixture"` at THIS repo instead (see
# tests/run-tests.sh). Never inherit the caller's repository.
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY GIT_COMMON_DIR
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SCRIPT="$REPO_ROOT/scripts/check-apm-agents-valid.sh"
PASS=0
@@ -277,6 +283,34 @@ else
pass "a missing validate.sh exits 1 and names the stale path"
fi
# --- 8. A checkout that itself sits under .claude/worktrees/ discovers its agents ---
# A Claude Code worktree lives at <repo>/.claude/worktrees/<name>/, so every
# absolute path the script sees contains /.claude/worktrees/. A filter matched
# against that absolute path excluded every agent file and the gate reported
# "N of N tracked agent file(s) were not discovered" (#199).
echo ""
echo "--- a checkout under .claude/worktrees/ discovers its own agent files ---"
FIX8_PARENT="$(make_fixture)"
FIXTURES+=("$FIX8_PARENT")
FIX8="$FIX8_PARENT/.claude/worktrees/agent-x"
mkdir -p "$FIX8"
mv "$FIX8_PARENT/plugins" "$FIX8/plugins"
git -C "$FIX8" init -q
git -C "$FIX8" add -A
git -C "$FIX8" -c user.email=[email protected] -c user.name=t commit -qm "fixture"
if ! bash "$SCRIPT" "$FIX8" > "$RUN_TMP/worktree.out" 2>&1; then
fail "a checkout under .claude/worktrees/ failed — its own agent files were excluded"
sed 's/^/ /' "$RUN_TMP/worktree.out"
elif grep -q 'not a git worktree root' "$RUN_TMP/worktree.out"; then
fail "the fixture did not resolve as its own git worktree root, so the derived check never ran"
sed 's/^/ /' "$RUN_TMP/worktree.out"
elif ! grep -q 'APM agent validation passed: 1 plugin-scope' "$RUN_TMP/worktree.out"; then
fail "a checkout under .claude/worktrees/ passed but did not validate its one agent file"
sed 's/^/ /' "$RUN_TMP/worktree.out"
else
pass "a checkout under .claude/worktrees/ discovers and validates its own agent file"
fi
echo ""
echo "Results: $PASS passed, $FAIL failed"
[[ $FAIL -eq 0 ]]
+605
View File
@@ -0,0 +1,605 @@
#!/usr/bin/env bash
set -euo pipefail
# Tests for scripts/tag-plugin-releases.sh (ADR-0033). Every case builds its
# own throwaway repo; none touches this repo's tags.
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SCRIPT="$REPO_ROOT/scripts/tag-plugin-releases.sh"
PASS=0
FAIL=0
pass() { echo " PASS: $1"; PASS=$((PASS + 1)); }
fail() { echo " FAIL: $1"; FAIL=$((FAIL + 1)); }
if ! python3 -c 'import yaml' 2>/dev/null; then
echo "SKIP: python3 with PyYAML is required" >&2
exit 77
fi
# Fixtures must not inherit the caller's repo (see tests/run-tests.sh, #204).
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY GIT_COMMON_DIR
# Output assertions use here-strings, never `echo | grep -q` (pipefail race;
# see docs/spec/gates.md, Tests).
CLEANUP_DIRS=()
trap 'rm -rf ${CLEANUP_DIRS[@]+"${CLEANUP_DIRS[@]}"}' EXIT
new_repo() {
local dir
dir="$(mktemp -d)"
CLEANUP_DIRS+=("$dir")
(cd "$dir" && git init -q -b main && git config user.email [email protected] && git config user.name t \
&& git config tag.gpgSign false && git config commit.gpgSign false)
echo "$dir"
}
# write_apm <repo> <dir> <version> [name] [description]
write_apm() {
local repo="$1" dir="$2" ver="$3" name="${4:-$2}" desc="${5:-A plugin.}"
mkdir -p "$repo/plugins/$dir"
printf 'name: %s\nversion: %s\ndescription: %s\n' "$name" "$ver" "$desc" > "$repo/plugins/$dir/apm.yml"
}
commit() { (cd "$1" && git add -A && git commit -q -m "${2:-change}"); }
head_sha() { git -C "$1" rev-parse HEAD; }
# --apply needs origin/main; point it at local main (no remote needed).
sync_origin() { git -C "$1" update-ref refs/remotes/origin/main refs/heads/main; }
# run <repo> [args...]: stdout+stderr, exit code in RC.
run() {
local dir="$1"; shift
RC=0
OUT="$(cd "$dir" && bash "$SCRIPT" "$@" 2>&1)" || RC=$?
}
expect_rc() {
local desc="$1" want="$2"
if [[ "$RC" -eq "$want" ]]; then pass "$desc (exit $want)"; else fail "$desc: exit $RC, want $want"; echo "$OUT" | sed 's/^/ /'; fi
}
# ERE-escape $1 so a version's dots match only dots.
ere_quote() { sed 's/[][\\.*^$+?(){}|/]/\\&/g' <<< "$1"; }
# expect_row <desc> <plugin> <version> <sha> <status>
expect_row() {
local desc="$1" re
re="^$(ere_quote "$2") +$(ere_quote "$3") +${4:0:7} +$5\$"
if grep -Eq "$re" <<< "$OUT"; then pass "$desc"; else fail "$desc: no row '$2 $3 ${4:0:7} $5'"; echo "$OUT" | sed 's/^/ /'; fi
}
# expect_rows <desc> <plugin> <count>
expect_rows() {
local n
n="$(grep -Ec "^$2 " <<< "$OUT" || true)"
if [[ "$n" -eq "$3" ]]; then pass "$1"; else fail "$1: $n rows for $2, want $3"; echo "$OUT" | sed 's/^/ /'; fi
}
echo "Case 1: merge commit vs squash -- target is the commit on main's first-parent line"
R="$(new_repo)"
write_apm "$R" alpha 1.0.0; write_apm "$R" beta 1.0.0; commit "$R" init
(cd "$R" && git checkout -q -b feat-a)
write_apm "$R" alpha 1.1.0; commit "$R" "bump alpha"
BRANCH_A="$(head_sha "$R")"
(cd "$R" && git checkout -q main && git merge -q --no-ff -m "merge a" feat-a)
MERGE_A="$(head_sha "$R")"
(cd "$R" && git checkout -q -b feat-b)
write_apm "$R" beta 1.1.0; commit "$R" "bump beta"
(cd "$R" && git checkout -q main && git merge -q --squash feat-b > /dev/null && git commit -q -m "squash b")
SQUASH_B="$(head_sha "$R")"
run "$R"
expect_rc "dry run with missing tags" 1
expect_row "merge: alpha 1.1.0 targets the merge commit" alpha 1.1.0 "$MERGE_A" MISSING
expect_row "squash: beta 1.1.0 targets the squash commit" beta 1.1.0 "$SQUASH_B" MISSING
if ! grep -q "${BRANCH_A:0:7}" <<< "$OUT"; then pass "feature-branch commit is never a target"; else fail "feature-branch commit named"; fi
if grep -q "reading local main" <<< "$OUT"; then pass "falls back to local main with a staleness note"; else fail "no staleness note"; fi
(cd "$R" && git checkout -q -b elsewhere && git checkout -q main)
write_apm "$R" alpha 9.9.9 > /dev/null; # working-tree edit must not count
run "$R" --ref main
expect_row "reads the ref, not the working tree" alpha 1.1.0 "$MERGE_A" MISSING
(cd "$R" && git checkout -q -- .)
echo "Case 2: version goes X -> Y -> X with no tags -- backfill starts at X's first landing"
R="$(new_repo)"
write_apm "$R" gamma 0.9.0; commit "$R" z; ZERO="$(head_sha "$R")"
write_apm "$R" gamma 1.0.0; commit "$R" a; FIRST="$(head_sha "$R")"
write_apm "$R" gamma 1.1.0; commit "$R" b; SECOND="$(head_sha "$R")"
write_apm "$R" gamma 1.0.0; commit "$R" c; THIRD="$(head_sha "$R")"
run "$R" --ref main
expect_rc "X->Y->X dry run" 1
expect_row "X is MISSING at its first landing" gamma 1.0.0 "$FIRST" MISSING
expect_row "Y after it is MISSING" gamma 1.1.0 "$SECOND" MISSING
expect_row "X's later run is RELEASED" gamma 1.0.0 "$THIRD" RELEASED
expect_rows "three wanted rows" gamma 3
if ! grep -q "${ZERO:0:7}" <<< "$OUT"; then pass "history before X's first landing not named"; else fail "older run named"; fi
sync_origin "$R"
run "$R" --ref main --apply
expect_rc "backfill --apply" 0
if [[ "$(git -C "$R" rev-parse "gamma-v1.0.0^{commit}" 2>/dev/null)" == "$FIRST" ]]; then pass "gamma-v1.0.0 on the first landing"; else fail "gamma-v1.0.0 misplaced"; fi
run "$R" --ref main
expect_rc "dry run after backfill is clean (idempotent)" 0
echo "Case 3: non-bump edit to apm.yml does not start a new run"
R="$(new_repo)"
write_apm "$R" delta 2.0.0; commit "$R" a; BUMP="$(head_sha "$R")"
write_apm "$R" delta 2.0.0 delta "Reworded."; commit "$R" b; EDIT="$(head_sha "$R")"
run "$R" --ref main
expect_row "target stays on the bump commit" delta 2.0.0 "$BUMP" MISSING
expect_rows "one row only" delta 1
if ! grep -q "${EDIT:0:7}" <<< "$OUT"; then pass "edit commit not a target"; else fail "edit commit named"; fi
echo "Case 4: existing lightweight tag is an ERROR"
(cd "$R" && git tag delta-v2.0.0 "$BUMP")
run "$R" --ref main
expect_rc "lightweight tag" 2
expect_row "row is ERROR" delta 2.0.0 "$BUMP" ERROR
if grep -q "lightweight" <<< "$OUT"; then pass "message names lightweight"; else fail "no lightweight message"; fi
if grep -q "^Agents: stop and report this to the maintainer" <<< "$OUT"; then pass "footer tells agents to stop and report"; else fail "no agent footer"; fi
if grep -q "^Maintainer: tags are immutable" <<< "$OUT"; then pass "footer addresses the maintainer"; else fail "no maintainer footer"; fi
echo "Case 5: annotated tag on the wrong commit is an ERROR"
(cd "$R" && git tag -d delta-v2.0.0 > /dev/null && git tag -a delta-v2.0.0 -m x "$EDIT")
run "$R" --ref main
expect_rc "tag on a later commit" 2
expect_row "row is ERROR" delta 2.0.0 "$BUMP" ERROR
if grep -q "peels to ${EDIT:0:7}" <<< "$OUT"; then pass "message names where it peels"; else fail "no peel message"; fi
(cd "$R" && git tag -d delta-v2.0.0 > /dev/null && git tag -a delta-v2.0.0 -m x "$BUMP")
run "$R" --ref main
expect_rc "same tag on the right commit" 0
expect_row "row is OK" delta 2.0.0 "$BUMP" OK
echo "Case 6: shallow clone exits 2"
S="$(mktemp -d)"; CLEANUP_DIRS+=("$S")
git clone -q --depth 1 "file://$R" "$S/c" 2>/dev/null
run "$S/c"
expect_rc "shallow clone" 2
if grep -q "shallow" <<< "$OUT"; then pass "message names shallow"; else fail "no shallow message"; fi
echo "Case 7: apm.yml name differs from directory exits 2"
R="$(new_repo)"
write_apm "$R" eps 1.0.0 epsilon; commit "$R" a
run "$R" --ref main
expect_rc "name != dir" 2
if grep -q "must equal the directory" <<< "$OUT"; then pass "message names the mismatch"; else fail "no mismatch message"; fi
echo "Case 7b: non-semver current version exits 2"
R="$(new_repo)"
write_apm "$R" zeta 1.0; commit "$R" a
run "$R" --ref main
expect_rc "version 1.0" 2
echo "Case 8: prefix-sharing names (git, gitea) never claim each other's tags"
R="$(new_repo)"
write_apm "$R" git 0.1.0; write_apm "$R" gitea 1.0.0; commit "$R" a; C1="$(head_sha "$R")"
write_apm "$R" git 0.2.0; write_apm "$R" gitea 1.1.0; commit "$R" b; C2="$(head_sha "$R")"
(cd "$R" && git tag -a gitea-v1.0.0 -m x "$C1")
run "$R" --ref main
expect_rows "git: gitea's tag is not its anchor -- current run only" git 1
expect_row "git 0.2.0 MISSING" git 0.2.0 "$C2" MISSING
expect_rows "gitea: anchored at its own tag" gitea 2
expect_row "gitea 1.0.0 OK" gitea 1.0.0 "$C1" OK
expect_row "gitea 1.1.0 MISSING" gitea 1.1.0 "$C2" MISSING
run "$R" --ref main --plugin git
expect_rows "--plugin git lists no gitea row" gitea 0
expect_rows "--plugin git lists git" git 1
echo "Case 9: every run after the newest tag is wanted"
R="$(new_repo)"
write_apm "$R" eta 1.0.0; commit "$R" a; V10="$(head_sha "$R")"
write_apm "$R" eta 1.1.0; commit "$R" b; V11="$(head_sha "$R")"
write_apm "$R" eta 1.2.0; commit "$R" c; V12="$(head_sha "$R")"
write_apm "$R" eta 1.3.0; commit "$R" d; V13="$(head_sha "$R")"
(cd "$R" && git tag -a eta-v1.1.0 -m x "$V11")
run "$R" --ref main
expect_rc "later runs missing" 1
expect_row "anchor 1.1.0 OK" eta 1.1.0 "$V11" OK
expect_row "1.2.0 MISSING" eta 1.2.0 "$V12" MISSING
expect_row "1.3.0 MISSING" eta 1.3.0 "$V13" MISSING
expect_rows "older 1.0.0 not wanted" eta 3
if ! grep -q "${V10:0:7}" <<< "$OUT"; then pass "1.0.0 commit not named"; else fail "1.0.0 named"; fi
echo "Case 10: --apply creates annotated tags, prints explicit push line, is idempotent"
sync_origin "$R"
run "$R" --ref main --apply
expect_rc "--apply" 0
for pair in "1.2.0:$V12" "1.3.0:$V13"; do
v="${pair%%:*}"; sha="${pair#*:}"
if [[ "$(git -C "$R" cat-file -t "refs/tags/eta-v$v" 2>/dev/null)" == tag ]]; then pass "eta-v$v is annotated"; else fail "eta-v$v not annotated"; fi
if [[ "$(git -C "$R" rev-parse "eta-v$v^{commit}" 2>/dev/null)" == "$sha" ]]; then pass "eta-v$v peels to its target"; else fail "eta-v$v wrong target"; fi
done
if [[ "$(git -C "$R" tag -l --format='%(contents:subject)' eta-v1.3.0)" == "eta 1.3.0" ]]; then pass "tag message is '<p> <v>'"; else fail "tag message wrong"; fi
if grep -qx "git push origin eta-v1.2.0 eta-v1.3.0" <<< "$OUT"; then pass "push line names each tag"; else fail "push line wrong"; echo "$OUT" | sed 's/^/ /'; fi
if ! grep -q -- "--tags" <<< "$OUT"; then pass "push line never uses --tags"; else fail "--tags printed"; fi
run "$R" --ref main --apply
expect_rc "second --apply" 0
if ! grep -q "git push" <<< "$OUT"; then pass "second --apply creates nothing"; else fail "second --apply printed a push line"; fi
run "$R" --ref main
expect_rc "dry run after --apply" 0
echo "Case 11: --apply is all-or-nothing"
R="$(new_repo)"
write_apm "$R" theta 1.0.0; write_apm "$R" iota 1.0.0; commit "$R" a; A="$(head_sha "$R")"
write_apm "$R" iota 1.0.0 iota "Reworded."; commit "$R" b
(cd "$R" && git tag iota-v1.0.0 "$A")
sync_origin "$R"
run "$R" --ref main --apply
expect_rc "ERROR blocks --apply" 2
if [[ -z "$(git -C "$R" tag -l 'theta-v*')" ]]; then pass "nothing created for the clean plugin"; else fail "theta tag created despite ERROR"; fi
echo "Case 12: untagged version recurring inside the wanted set is tagged at its first landing"
R="$(new_repo)"
write_apm "$R" kappa 0.9.0; commit "$R" a; K0="$(head_sha "$R")"
write_apm "$R" kappa 1.0.0; commit "$R" b; KB="$(head_sha "$R")"
write_apm "$R" kappa 1.1.0; commit "$R" c; KC="$(head_sha "$R")"
write_apm "$R" kappa 1.0.0; commit "$R" d; KD="$(head_sha "$R")"
(cd "$R" && git tag -a kappa-v0.9.0 -m x "$K0")
run "$R" --ref main
expect_rc "recurring version is not an error" 1
expect_row "first landing of 1.0.0 is MISSING" kappa 1.0.0 "$KB" MISSING
expect_row "later landing of 1.0.0 is RELEASED" kappa 1.0.0 "$KD" RELEASED
expect_row "1.1.0 MISSING" kappa 1.1.0 "$KC" MISSING
if grep -q "first landing ${KB:0:7}" <<< "$OUT"; then pass "note names the first landing"; else fail "no first-landing note"; fi
sync_origin "$R"
run "$R" --ref main --apply
expect_rc "--apply with a recurring version" 0
if [[ "$(git -C "$R" rev-parse "kappa-v1.0.0^{commit}" 2>/dev/null)" == "$KB" ]]; then pass "kappa-v1.0.0 cut at the first landing"; else fail "kappa-v1.0.0 not on the first landing"; fi
run "$R" --ref main
expect_rc "dry run after --apply" 0
expect_row "later landing RELEASED via the tag" kappa 1.0.0 "$KD" RELEASED
if grep -q "already released at ${KB:0:7}" <<< "$OUT"; then pass "note names where it was released"; else fail "no already-released note"; fi
echo "Case 12b: a revert after tagging does not wedge other plugins"
R="$(new_repo)"
write_apm "$R" aa 1.0.0; write_apm "$R" bb 1.0.0; commit "$R" a; A1="$(head_sha "$R")"
write_apm "$R" aa 1.1.0; commit "$R" b; A2="$(head_sha "$R")"
(cd "$R" && git tag -a aa-v1.0.0 -m x "$A1" && git tag -a aa-v1.1.0 -m x "$A2" && git tag -a bb-v1.0.0 -m x "$A1")
write_apm "$R" aa 1.0.0; commit "$R" revert; A3="$(head_sha "$R")"
write_apm "$R" bb 1.2.0; commit "$R" c; B2="$(head_sha "$R")"
run "$R" --ref main
expect_rc "dry run: only bb is missing" 1
expect_row "aa 1.1.0 OK" aa 1.1.0 "$A2" OK
expect_row "reverted aa 1.0.0 is RELEASED" aa 1.0.0 "$A3" RELEASED
expect_row "bb 1.2.0 MISSING" bb 1.2.0 "$B2" MISSING
sync_origin "$R"
run "$R" --ref main --apply
expect_rc "--apply after a revert" 0
if [[ "$(git -C "$R" rev-parse "bb-v1.2.0^{commit}" 2>/dev/null)" == "$B2" ]]; then pass "bb-v1.2.0 created"; else fail "bb-v1.2.0 not created"; fi
if [[ "$(git -C "$R" rev-parse "aa-v1.0.0^{commit}")" == "$A1" ]]; then pass "aa-v1.0.0 left where it was"; else fail "aa-v1.0.0 moved"; fi
if grep -qx "git push origin bb-v1.2.0" <<< "$OUT"; then pass "push line names only bb-v1.2.0"; else fail "push line wrong"; echo "$OUT" | sed 's/^/ /'; fi
echo "Case 12c: a tag on no landing of its version stays an ERROR"
(cd "$R" && git tag -d aa-v1.0.0 > /dev/null && git tag -a aa-v1.0.0 -m x "$A2")
run "$R" --ref main
expect_rc "tag on another version's landing" 2
expect_row "row is ERROR" aa 1.0.0 "$A3" ERROR
echo "Case 12d: apm.yml deleted and re-added starts a new run"
R="$(new_repo)"
write_apm "$R" nu 1.0.0; write_apm "$R" xi 1.0.0; commit "$R" a; N1="$(head_sha "$R")"
rm -r "$R/plugins/nu"; commit "$R" delete
write_apm "$R" nu 1.0.0; commit "$R" readd; N3="$(head_sha "$R")"
run "$R" --ref main --plugin nu
expect_rows "untagged: two wanted rows" nu 2
expect_row "untagged: first landing is MISSING" nu 1.0.0 "$N1" MISSING
expect_row "untagged: re-add is RELEASED" nu 1.0.0 "$N3" RELEASED
(cd "$R" && git tag -a nu-v1.0.0 -m x "$N1")
run "$R" --ref main --plugin nu
expect_rc "tagged before the delete" 0
expect_row "original landing OK" nu 1.0.0 "$N1" OK
expect_row "re-added landing RELEASED" nu 1.0.0 "$N3" RELEASED
echo "Case 12e: invalid version inside the wanted set is an ERROR"
R="$(new_repo)"
write_apm "$R" omi 1.0.0; commit "$R" a; O1="$(head_sha "$R")"
write_apm "$R" omi 1.1; commit "$R" b; O2="$(head_sha "$R")"
write_apm "$R" omi 1.2.0; commit "$R" c
(cd "$R" && git tag -a omi-v1.0.0 -m x "$O1")
run "$R" --ref main
expect_rc "invalid version in history" 2
expect_row "row is ERROR" omi INVALID "$O2" ERROR
echo "Case 12f: a tag outside the ref's history is not an anchor"
R="$(new_repo)"
write_apm "$R" pi 1.0.0; commit "$R" a; P1="$(head_sha "$R")"
write_apm "$R" pi 1.1.0; commit "$R" b; P2="$(head_sha "$R")"
(cd "$R" && git checkout -q -b side "$P1" && git commit -q --allow-empty -m side && git tag -a pi-v1.0.0 -m x HEAD && git checkout -q main)
run "$R" --ref main
expect_rc "off-history tag ignored" 1
expect_rows "only the current run is wanted" pi 1
expect_row "pi 1.1.0 MISSING" pi 1.1.0 "$P2" MISSING
(cd "$R" && git tag -a pi-v1.1.0 -m x side)
run "$R" --ref main
expect_rc "current version tagged off-history" 2
expect_row "row is ERROR" pi 1.1.0 "$P2" ERROR
echo "Case 12g: whitespace in name or version exits 2"
R="$(new_repo)"
mkdir -p "$R/plugins/mu"; printf 'name: "mu\\t"\nversion: 1.0.0\n' > "$R/plugins/mu/apm.yml"; commit "$R" a
run "$R" --ref main
expect_rc "tab in name" 2
if grep -q "whitespace" <<< "$OUT"; then pass "message names whitespace"; else fail "no whitespace message"; fi
printf 'name: mu\nversion: "1.0.0 "\n' > "$R/plugins/mu/apm.yml"; commit "$R" b
run "$R" --ref main
expect_rc "trailing space in version" 2
printf "name: mu\nversion: \"'1.0.0'\"\n" > "$R/plugins/mu/apm.yml"; commit "$R" c
run "$R" --ref main
expect_rc "literal quotes in version are invalid, not stripped" 2
if grep -q "no strict MAJOR.MINOR.PATCH" <<< "$OUT"; then pass "message names the invalid version"; else fail "no invalid-version message"; fi
echo "Case 12h: a tag name git rejects is an ERROR and nothing is created"
R="$(new_repo)"
write_apm "$R" rho 1.0.0; write_apm "$R" "a..b" 1.0.0; commit "$R" a
sync_origin "$R"
run "$R" --ref main --apply
expect_rc "invalid ref name blocks --apply" 2
if grep -q "check-ref-format" <<< "$OUT"; then pass "message names check-ref-format"; else fail "no check-ref-format message"; fi
if [[ -z "$(git -C "$R" tag -l)" ]]; then pass "nothing created"; else fail "tags created despite invalid name"; fi
echo "Case 12i: a git tag failure mid --apply reports what was created"
R="$(new_repo)"
write_apm "$R" sa 1.0.0; write_apm "$R" sb 1.0.0; commit "$R" a
mkdir -p "$R/.git/refs/tags" && : > "$R/.git/refs/tags/sb-v1.0.0.lock"
sync_origin "$R"
run "$R" --ref main --apply
expect_rc "mid-run git tag failure" 2
if [[ -n "$(git -C "$R" tag -l sa-v1.0.0)" ]]; then pass "sa-v1.0.0 was created first"; else fail "sa-v1.0.0 missing"; fi
if grep -qx "git push origin sa-v1.0.0" <<< "$OUT"; then pass "push line names what was created"; else fail "no push line for created tags"; echo "$OUT" | sed 's/^/ /'; fi
echo "Case 12j: --apply with --plugin creates only that plugin's tag"
R="$(new_repo)"
write_apm "$R" ta 1.0.0; write_apm "$R" tb 1.0.0; commit "$R" a
sync_origin "$R"
run "$R" --ref main --plugin ta --apply
expect_rc "--apply --plugin ta" 0
if [[ -n "$(git -C "$R" tag -l ta-v1.0.0)" && -z "$(git -C "$R" tag -l 'tb-v*')" ]]; then pass "only ta tagged"; else fail "wrong tags: $(git -C "$R" tag -l | tr '\n' ' ')"; fi
echo "Case 12k: --ref <older> --plugin <p> --apply tags that plugin's older version only"
R="$(new_repo)"
write_apm "$R" ua 1.0.0; write_apm "$R" ub 1.0.0; commit "$R" a; U1="$(head_sha "$R")"
write_apm "$R" ua 1.1.0; write_apm "$R" ub 1.1.0; commit "$R" b; U2="$(head_sha "$R")"
sync_origin "$R"
run "$R" --ref "$U1" --plugin ua --apply
expect_rc "one-off older tag" 0
if [[ "$(git -C "$R" tag -l)" == "ua-v1.0.0" ]]; then pass "only ua-v1.0.0 created"; else fail "wrong tags: $(git -C "$R" tag -l | tr '\n' ' ')"; fi
if [[ "$(git -C "$R" rev-parse "ua-v1.0.0^{commit}")" == "$U1" ]]; then pass "ua-v1.0.0 on the older commit"; else fail "ua-v1.0.0 misplaced"; fi
run "$R" --ref main
expect_rows "ua anchored at the one-off tag" ua 2
expect_row "ua 1.1.0 MISSING after the one-off" ua 1.1.0 "$U2" MISSING
echo "Case 12l: default ref is origin/main, not local main"
R="$(new_repo)"
write_apm "$R" va 1.0.0; commit "$R" a; V1="$(head_sha "$R")"
B="$(mktemp -d)"; CLEANUP_DIRS+=("$B")
git init -q --bare "$B/r.git"
(cd "$R" && git remote add origin "$B/r.git" && git push -q origin main 2>/dev/null)
write_apm "$R" va 2.0.0; commit "$R" local-only
run "$R"
expect_rc "default ref" 1
expect_row "reads origin/main's version" va 1.0.0 "$V1" MISSING
if ! grep -q "reading local main" <<< "$OUT"; then pass "no staleness note when origin/main resolves"; else fail "staleness note printed"; fi
echo "Case 12m: an invalid tag is never the start point and is reported"
R="$(new_repo)"
write_apm "$R" x 1.0.0; commit "$R" a; X10="$(head_sha "$R")"
write_apm "$R" x 1.1.0; commit "$R" b; X11="$(head_sha "$R")"
write_apm "$R" x 1.2.0; commit "$R" c; X12="$(head_sha "$R")"
write_apm "$R" x 1.3.0; commit "$R" d
(cd "$R" && git tag -a x-v1.0.0 -m x "$X10" && git tag -a x-v9.9.9 -m x "$X12")
sync_origin "$R"
run "$R" --ref main
expect_rc "wrong-version tag on a later landing" 2
expect_row "row names the wrong-version tag" x 9.9.9 "$X12" ERROR
if grep -q "x-v9.9.9 peels to ${X12:0:7}" <<< "$OUT"; then pass "message names x-v9.9.9"; else fail "x-v9.9.9 not named"; fi
expect_row "1.1.0 is still wanted (start point is x-v1.0.0)" x 1.1.0 "$X11" MISSING
run "$R" --ref main --apply
expect_rc "--apply blocked by the wrong-version tag" 2
if [[ "$(git -C "$R" tag -l | tr '\n' ' ')" == "x-v1.0.0 x-v9.9.9 " ]]; then pass "nothing created"; else fail "tags created: $(git -C "$R" tag -l | tr '\n' ' ')"; fi
(cd "$R" && git tag -d x-v9.9.9 > /dev/null && git tag x-v1.0.1 "$X12")
run "$R" --ref main
expect_rc "lightweight tag as start point" 2
expect_row "row names the lightweight tag" x 1.0.1 "$X12" ERROR
if grep -q "x-v1.0.1 is a lightweight tag" <<< "$OUT"; then pass "message names x-v1.0.1"; else fail "x-v1.0.1 not named"; fi
expect_row "1.1.0 is still wanted" x 1.1.0 "$X11" MISSING
run "$R" --ref main --apply
expect_rc "--apply blocked by the lightweight tag" 2
echo "Case 12n: --apply only tags history on origin/main"
R="$(new_repo)"
write_apm "$R" wa 1.0.0; commit "$R" a
(cd "$R" && git checkout -q -b feat)
write_apm "$R" wa 1.1.0; commit "$R" b; FEAT="$(head_sha "$R")"
(cd "$R" && git checkout -q main)
run "$R" --ref "$FEAT" --apply
expect_rc "--apply with no origin/main" 2
if [[ -z "$(git -C "$R" tag -l)" ]]; then pass "no tag without origin/main"; else fail "tag created without origin/main"; fi
run "$R" --apply
expect_rc "--apply refuses the local-main fallback" 2
sync_origin "$R"
run "$R" --ref "$FEAT" --apply
expect_rc "--apply --ref <feature-branch commit>" 2
if grep -q "not on origin/main's first-parent history" <<< "$OUT"; then pass "message names origin/main's first-parent history"; else fail "no origin/main message"; fi
if [[ -z "$(git -C "$R" tag -l)" ]]; then pass "no tag on a feature-branch commit"; else fail "tag created off main"; fi
run "$R" --ref "$FEAT"
expect_rc "dry run may still read a feature-branch ref" 1
echo "Case 12o: a plugin name starting with '-' exits 2"
R="$(new_repo)"
write_apm "$R" ok 1.0.0; write_apm "$R" "-x" 1.0.0; commit "$R" a
sync_origin "$R"
run "$R" --ref main --apply
expect_rc "leading-dash plugin" 2
if grep -q "must not start with '-'" <<< "$OUT"; then pass "message names the leading dash"; else fail "no leading-dash message"; fi
if [[ -z "$(git -C "$R" tag -l)" ]]; then pass "nothing created"; else fail "tags created"; fi
echo "Case 12q: --apply refuses a commit of an already-merged feature branch"
R="$(new_repo)"
write_apm "$R" ya 1.0.0; commit "$R" a
(cd "$R" && git checkout -q -b feat)
write_apm "$R" ya 1.1.0; commit "$R" b; FEAT="$(head_sha "$R")"
(cd "$R" && git checkout -q main && git merge -q --no-ff -m "merge feat" feat)
MERGED="$(head_sha "$R")"
sync_origin "$R"
run "$R" --ref "$FEAT" --apply
expect_rc "--apply --ref <merged feature commit>" 2
if grep -q "not on origin/main's first-parent history" <<< "$OUT"; then pass "message names the first-parent history"; else fail "no first-parent message"; fi
if [[ -z "$(git -C "$R" tag -l)" ]]; then pass "no tag on the merged feature commit"; else fail "tags created: $(git -C "$R" tag -l | tr '\n' ' ')"; fi
run "$R" --ref "$MERGED" --apply
expect_rc "--apply --ref <the merge commit>" 0
if [[ "$(git -C "$R" rev-parse "ya-v1.1.0^{commit}" 2>/dev/null)" == "$MERGED" ]]; then pass "ya-v1.1.0 on the merge commit"; else fail "ya-v1.1.0 misplaced"; fi
echo "Case 12r: a tag on a later run of a recurring version is an ERROR, not a start point"
R="$(new_repo)"
write_apm "$R" za 1.0.0; commit "$R" a; Z1="$(head_sha "$R")"
write_apm "$R" za 1.1.0; commit "$R" b; Z2="$(head_sha "$R")"
write_apm "$R" za 1.0.0; commit "$R" revert; Z3="$(head_sha "$R")"
write_apm "$R" za 1.2.0; commit "$R" c
(cd "$R" && git tag -a za-v1.0.0 -m x "$Z3")
sync_origin "$R"
run "$R" --ref main
expect_rc "tag on a later landing" 2
expect_row "row names the later-landing tag" za 1.0.0 "$Z3" ERROR
if grep -q "za-v1.0.0 peels to ${Z3:0:7}, a later landing of 1.0.0; it first landed at ${Z1:0:7}" <<< "$OUT"; then pass "message names the first landing"; else fail "no later-landing message"; fi
if ! grep -q "${Z2:0:7}.*OK" <<< "$OUT"; then pass "1.1.0 is not hidden behind the bad tag as OK"; else fail "1.1.0 reported OK"; fi
run "$R" --ref main --apply
expect_rc "--apply blocked by the later-landing tag" 2
if [[ "$(git -C "$R" tag -l)" == "za-v1.0.0" ]]; then pass "nothing created"; else fail "tags created: $(git -C "$R" tag -l | tr '\n' ' ')"; fi
(cd "$R" && git tag -d za-v1.0.0 > /dev/null && git tag -a za-v1.0.0 -m x "$Z1")
run "$R" --ref main
expect_rc "tag moved to the first landing" 1
expect_row "first landing OK" za 1.0.0 "$Z1" OK
expect_row "1.1.0 wanted again" za 1.1.0 "$Z2" MISSING
expect_row "later landing RELEASED" za 1.0.0 "$Z3" RELEASED
echo "Case 12s: a repeated --plugin is de-duplicated"
R="$(new_repo)"
write_apm "$R" git 1.0.0; write_apm "$R" gitea 1.0.0; commit "$R" a
sync_origin "$R"
run "$R" --ref main --plugin git --plugin git --apply
expect_rc "--plugin git --plugin git --apply" 0
if [[ "$(git -C "$R" tag -l)" == "git-v1.0.0" ]]; then pass "one tag created"; else fail "wrong tags: $(git -C "$R" tag -l | tr '\n' ' ')"; fi
if grep -qx "git push origin git-v1.0.0" <<< "$OUT"; then pass "push line names the tag once"; else fail "push line wrong"; echo "$OUT" | sed 's/^/ /'; fi
echo "Case 12t: a revert to a version from before the tagged range is RELEASED, never tagged"
R="$(new_repo)"
write_apm "$R" rv 1.0.0; commit "$R" a; RV1="$(head_sha "$R")"
write_apm "$R" rv 1.1.0; commit "$R" b; RV2="$(head_sha "$R")"
sync_origin "$R"
run "$R" --ref main --apply
expect_rc "backfill --apply tags the current version only" 0
if [[ "$(git -C "$R" tag -l)" == "rv-v1.1.0" ]]; then pass "only rv-v1.1.0 backfilled"; else fail "wrong tags: $(git -C "$R" tag -l | tr '\n' ' ')"; fi
write_apm "$R" rv 1.0.0; commit "$R" revert; RV3="$(head_sha "$R")"
write_apm "$R" rv 1.2.0; commit "$R" c; RV4="$(head_sha "$R")"
sync_origin "$R"
run "$R" --ref main
expect_rc "dry run: only the new bump is missing" 1
expect_row "backfilled 1.1.0 OK" rv 1.1.0 "$RV2" OK
expect_row "revert to pre-backfill 1.0.0 is RELEASED" rv 1.0.0 "$RV3" RELEASED
expect_row "new bump 1.2.0 MISSING" rv 1.2.0 "$RV4" MISSING
if grep -q "first landed at ${RV1:0:7}, before the tagged range; not tagged" <<< "$OUT"; then pass "note names the pre-range first landing"; else fail "no pre-range note"; echo "$OUT" | sed 's/^/ /'; fi
run "$R" --ref main --apply
expect_rc "--apply after the revert" 0
if [[ "$(git -C "$R" tag -l | tr '\n' ' ')" == "rv-v1.1.0 rv-v1.2.0 " ]]; then pass "rv-v1.2.0 created, no rv-v1.0.0"; else fail "wrong tags: $(git -C "$R" tag -l | tr '\n' ' ')"; fi
run "$R" --ref main
expect_rc "dry run after --apply is clean, never 2" 0
echo "Case 12t2: backfill whose range holds a version that first landed before it"
R="$(new_repo)"
write_apm "$R" rw 1.0.0; commit "$R" a; RW1="$(head_sha "$R")"
write_apm "$R" rw 1.1.0; commit "$R" b; RW2="$(head_sha "$R")"
write_apm "$R" rw 1.0.0; commit "$R" c; RW3="$(head_sha "$R")"
write_apm "$R" rw 1.1.0; commit "$R" d; RW4="$(head_sha "$R")"
sync_origin "$R"
run "$R" --ref main
expect_rc "backfill dry run" 1
expect_row "current version MISSING at its first landing" rw 1.1.0 "$RW2" MISSING
expect_row "1.0.0 inside the range is RELEASED" rw 1.0.0 "$RW3" RELEASED
expect_row "current version's later run RELEASED" rw 1.1.0 "$RW4" RELEASED
if ! grep -q "${RW1:0:7} " <<< "$(grep '^rw ' <<< "$OUT")"; then pass "pre-range landing is not a row"; else fail "pre-range landing listed"; fi
run "$R" --ref main --apply
expect_rc "backfill --apply" 0
if [[ "$(git -C "$R" tag -l)" == "rw-v1.1.0" ]]; then pass "only rw-v1.1.0 created"; else fail "wrong tags: $(git -C "$R" tag -l | tr '\n' ' ')"; fi
run "$R" --ref main
expect_rc "dry run after backfill" 0
echo "Case 12e2: the escape from an INVALID run is a hand-cut tag on the next valid version"
R="$(new_repo)"
write_apm "$R" om 1.0.0; commit "$R" a; OM1="$(head_sha "$R")"
write_apm "$R" om 1.1; commit "$R" b
write_apm "$R" om 1.2.0; commit "$R" c; OM3="$(head_sha "$R")"
write_apm "$R" om 1.3.0; commit "$R" d; OM4="$(head_sha "$R")"
write_apm "$R" op 1.0.0; commit "$R" e
(cd "$R" && git tag -a om-v1.0.0 -m x "$OM1")
sync_origin "$R"
run "$R" --ref main --apply
expect_rc "INVALID run blocks --apply for every plugin" 2
if [[ "$(git -C "$R" tag -l)" == "om-v1.0.0" ]]; then pass "nothing created, not even the other plugin's tag"; else fail "tags created: $(git -C "$R" tag -l | tr '\n' ' ')"; fi
(cd "$R" && git tag -a om-v1.2.0 -m "om 1.2.0" "$OM3")
run "$R" --ref main
expect_rc "after the hand-cut tag, only missing tags remain" 1
expect_rows "invalid run no longer wanted" om 2
expect_row "hand-cut start point OK" om 1.2.0 "$OM3" OK
expect_row "next version MISSING" om 1.3.0 "$OM4" MISSING
echo "Case 12u: a git rev-list failure or an empty history exits 2, not a crash"
R="$(new_repo)"
write_apm "$R" rl 1.0.0; commit "$R" a
W="$(mktemp -d)"; CLEANUP_DIRS+=("$W")
REAL_GIT="$(command -v git)"
cat > "$W/git" <<EOF
#!/usr/bin/env bash
if [[ "\$1" == rev-list && " \$* " == *" --reverse "* ]]; then
case "\${FAKE_REVLIST:-}" in
fail) echo "fatal: simulated rev-list failure" >&2; exit 128 ;;
empty) exit 0 ;;
esac
fi
exec "$REAL_GIT" "\$@"
EOF
chmod +x "$W/git"
RC=0; OUT="$(cd "$R" && PATH="$W:$PATH" FAKE_REVLIST=fail bash "$SCRIPT" --ref main 2>&1)" || RC=$?
expect_rc "rev-list failure" 2
if grep -q "git rev-list could not read plugins/rl/apm.yml" <<< "$OUT"; then pass "message names the rev-list failure"; else fail "no rev-list message"; echo "$OUT" | sed 's/^/ /'; fi
RC=0; OUT="$(cd "$R" && PATH="$W:$PATH" FAKE_REVLIST=empty bash "$SCRIPT" --ref main 2>&1)" || RC=$?
expect_rc "no commit carries apm.yml" 2
if grep -q "no commit on its first-parent history carries it" <<< "$OUT"; then pass "message names the empty history"; else fail "no empty-history message"; echo "$OUT" | sed 's/^/ /'; fi
if ! grep -q "unbound\|bad array subscript" <<< "$OUT"; then pass "no shell crash"; else fail "shell crashed"; fi
echo "Case 12v: a glob character in a plugin name is rejected before any pathspec or ref pattern"
R="$(new_repo)"
write_apm "$R" ab 1.0.0; commit "$R" a; AB1="$(head_sha "$R")"
write_apm "$R" "a*" 1.0.0; commit "$R" b
write_apm "$R" ab 1.1.0; commit "$R" c; AB3="$(head_sha "$R")"
(cd "$R" && git tag -a ab-v1.0.0 -m x "$AB1")
sync_origin "$R"
run "$R" --ref main --apply
expect_rc "plugin 'a*' is rejected" 2
if grep -q "plugins/a\*: 'a\*-v<version>' is not a valid tag name (git check-ref-format)" <<< "$OUT"; then pass "message names a* and check-ref-format"; else fail "no preflight message"; echo "$OUT" | sed 's/^/ /'; fi
if ! grep -q "^PLUGIN " <<< "$OUT"; then pass "rejected before any history is read (no table)"; else fail "table printed"; fi
if [[ "$(git -C "$R" tag -l)" == "ab-v1.0.0" ]]; then pass "nothing created"; else fail "tags created: $(git -C "$R" tag -l | tr '\n' ' ')"; fi
run "$R" --ref main --plugin ab
expect_rc "ab alone is unaffected by its glob-named neighbour" 1
expect_rows "ab rows only" ab 2
expect_row "ab 1.0.0 OK" ab 1.0.0 "$AB1" OK
expect_row "ab 1.1.0 MISSING" ab 1.1.0 "$AB3" MISSING
echo "Case 12p: expect_row matches a version's dots literally"
OUT="zz 1x0x0 abcdef0 OK"
if ! grep -Eq "^zz +$(ere_quote 1.0.0) +abcdef0 +OK\$" <<< "$OUT"; then pass "1.0.0 does not match 1x0x0"; else fail "unescaped dots"; fi
echo "Case 13: bad input exits 2"
run "$R" --ref no-such-ref
expect_rc "unresolvable --ref" 2
run "$R" --ref main --plugin nope
expect_rc "unknown --plugin" 2
run "$R" --bogus
expect_rc "unknown flag" 2
R="$(new_repo)"
write_apm "$R" lam 1.0.0; commit "$R" a
(cd "$R" && git branch -q -m trunk)
run "$R"
expect_rc "no origin/main or main" 2
echo
echo "Results: $PASS passed, $FAIL failed"
[[ $FAIL -eq 0 ]]