Compare commits

..
Author SHA1 Message Date
Defame1297andClaude Opus 5.5 45d740eef1 fix(kyberforge): pick the timeout binary first and tidy review-round-2 points
Review round 2 of #270, all non-blocking.

- Resolve `timeout`/`gtimeout` before choosing apm, so a machine with
  neither stays silent on every path, the uv not-synced notice included.
- The uv-path unreadable-version notice also offers `uv sync --frozen`.
- Tests: a `timeout` shim replaces the real binary in the whitelisted PATH
  (and backs `gtimeout`), so the suite runs on macOS without coreutils; add
  a PATH-route case where `apm --version` exits 1, and a no-timeout case on
  the uv path; fix two stale comments.
- ADR-0034: contract item 1 now spells out `--frozen --no-sync --offline`
  and the missing-environment short-circuit; amendment dated 2026-12-02.
- ADR-0019: the 2026-12-02 amendment moves below the 2026-09-16 one.
- docs/hooks.md: rewrap an over-long line.

Refs: #270

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 00:51:25 +00:00
Defame1297andClaude Opus 5.5 367cc1c259 fix(kyberforge): bound the SessionStart hook portably and sharpen its notices
Review round 1 of #270.

- Resolve `timeout`, else `gtimeout`, once after choosing apm, and call it
  through "$to" at all three sites. Stock macOS has neither `timeout` nor a
  GNU coreutils default, so the `--version` call failed there and every
  session printed a false too-old notice. With neither binary the hook exits
  0 silently. The budget test now parses `"$to" N` too.
- Check that the project environment ($UV_PROJECT_ENVIRONMENT, else
  <root>/.venv) exists before taking the uv path. If it is missing, print a
  fixed not-synced notice and never call uv, because `uv run --no-sync`
  would create an empty .venv in the consumer repo.
- Separate "version too old" from "version unreadable or timed out", with a
  fixed literal for each on each path, so a timeout no longer blames an
  unsynced environment.
- Raise the hooks.json timeout from 380 to 400 for the 375s script budget,
  refresh the outdated-timing comment, and note the budget in ADR-0019.
- Tests: no timeout binary, gtimeout only, missing and relocated project
  environment, a failing `uv run`, `--offline` required on every uv call,
  and the hostile-output notice compared to its exact literal.
- ADR-0034: until the #271 cutover, this repo prints the too-old notice and
  auto-refresh is paused.

Refs: #270

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 00:25:14 +00:00
Defame1297andClaude Opus 5.5 1fb8cc797b feat(kyberforge): resolve the repo-pinned apm in the SessionStart hook
The hook now picks one apm and uses it for both the outdated check and the
update (ADR-0034): `uv run --project <root> --frozen --no-sync --offline apm`
when the project pins apm-cli (a quoted apm-cli requirement in pyproject.toml
plus a uv.lock) and uv is on PATH, else the PATH apm, else it exits silently.
uv is only ever called as `uv run`; `--no-sync` keeps a plain run from syncing
the environment, and `--offline` keeps uv off the network.

Before the outdated check it reads `--version`. Below 0.39.2, or when the
version cannot be read, it prints a fixed notice naming the chosen binary and
skips the check, since an older apm refuses a lockfile v4 and would report it
as up to date. All advice strings are fixed literals that name the chosen
binary; no command output is interpolated.

Tests use seam A: a fake uv first on a whitelisted PATH logs every call and
reaches the pinned fake apm only through `uv run`. They cover pin plus uv, pin
without uv, pin without uv.lock, no pin, no apm, too-old and boundary
versions, stale and current output on both paths, and hostile output.
ADR-0034 is amended to record that seam.

Impact: kyberforge 2.2.1 -> 2.3.0, catalog 0.9.0 -> 0.9.1.

Refs: #270

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-02 00:05:03 +00:00
Defame1297 0ad15c80bc Merge pull request 'docs(adr): pin apm per repo with uv (#265)' (#267) from docs/plan-pin-apm-per-repo into main
Reviewed-on: #267
2026-12-01 22:40:31 +00:00
Defame1297andClaude Opus 5.5 5ca2056046 docs(research): refresh apm reference set to 0.39.3 (#265)
Add lockfile-and-compatibility, approvals-and-executables and
migration-0-28-to-0-39 topics; update installation, cli-reference, the
prompt, hooks and instructions topics for 0.39.x behaviour; label the
remaining 0.28.0 observations by version. Sources: the v0.39.3 source,
CHANGELOG and docs; Context7 was unavailable.

Refs #265

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-01 21:46:06 +00:00
Defame1297andClaude Opus 5.5 a0997cbcf7 docs(adr): pin apm per repo with uv (ADR-0034)
Record that apm is pinned per repo with uv (minimum 0.39.2, pinned
0.39.3), shipped hook-first, with the consumer hook fallback contract.
Add forward notes on ADR-0019 and ADR-0033 for their 0.28.0 claims,
pending re-verification on 0.39.3.

Refs #265, #245

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-01 21:14:27 +00:00
Defame1297 e17237a9e2 Merge pull request 'docs(readme): document consumer pinning with the object form (#235, #236)' (#259) from docs/consumer-pinning-readme into main
Reviewed-on: #259
Reviewed-by: Defame1297 <[email protected]>
2026-12-01 20:08:16 +00:00
Defame1297andClaude Opus 5.5 389b5cc425 docs(readme): document consumer pinning with the object form
Expand README "For external consumers" with how to pin a plugin at
<plugin>-v<x.y.z> using apm's object form, why the shorthand form fails
on this host, and that Renovate updates are planned but untested
(ADR-0033 consequence 3). Point the ref: line in the bin, core, git and
kyberforge READMEs at that section.

Refs #235, #236

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-29 19:54:37 +00:00
Defame1297 276fd1f099 Merge pull request 'docs(adr): amend ADR-0033 for object-form pins (#235, #236)' (#258) from docs/adr-0033-consumer-pin-amendment into main
Reviewed-on: #258
Reviewed-by: Defame1297 <[email protected]>
2026-11-29 19:20:59 +00:00
Defame1297andClaude Opus 5.5 b4a452b690 docs(adr): amend ADR-0033 — withdraw apm-manager packageRule
Renovate's apm manager reads only the shorthand form, which apm cannot
install for a Gitea subpath, so the overridePackageName rule cannot work.
Record the object-form consumer pin and the planned, untested customManagers
route. The tag shape decision is unchanged.

Refs #235, #236

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-29 18:51:20 +00:00
Defame1297 0abe97270b Merge pull request 'chore(apm): lock plan 0.5.0' (#257) from chore/lock-plan-0.5.0 into main
Reviewed-on: #257
2026-11-29 18:32:21 +00:00
Defame1297andClaude Opus 5.5 1e1c2c1ce2 chore(apm): lock plan 0.5.0
Refresh the lock after #256: write-docs is now deployed from plan, not bin.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-29 18:12:28 +00:00
Defame1297 3b0dcc32d4 Merge pull request 'feat(plan)!: wire existing skills into /plan and move write-docs into plan' (#256) from feat/plan-skill-wiring into main
Reviewed-on: #256
Reviewed-by: Defame1297 <[email protected]>
2026-11-29 18:05:55 +00:00
Defame1297andClaude Opus 5.5 c4bee9e3b9 docs(plan): make outline step 7 docs commands conditional
Match the prompt: the write-docs and research-docs commands are given
only when step 5 listed docs, and the output path is asked only for
research-docs topics.

Refs: #255

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-29 17:34:25 +00:00
Defame1297andClaude Opus 5.5 fe0e297f98 fix(plan): tighten /plan hand-offs after review
Ask researchers to flag reference-doc needs, add the wayfinder "no"
branch, name the docs branch and give only applicable doc commands,
resolve the label ID before stripping Ready for Agent from the spec,
point the /to-spec rerun at step 8's block, and call /write-docs and
/research-docs user-run.

Refs: #255
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-29 17:33:24 +00:00
Defame1297 99054c8cd2 feat(plan)!: move write-docs from bin into plan
Why: write-docs belongs next to research-docs in plan, the plugin that owns
turning work into documented specs and tickets (ADR-0031 amendment, !251).

Implementation notes:
- write-docs moves from bin to plan as a pure rename; SKILL.md is
  byte-for-byte unchanged (it already sits at ADR-0020's body-size budget).
- Versions: bin 4.0.0 -> 5.0.0, plan 0.4.0 -> 0.5.0 (the single plan bump
  for spec #252). plan gains the documentation keyword.
- README plugin bullets move documentation from bin to plan; plan's outline
  now says write-docs ships in plan.
- marketplace.json regenerated with apm pack.

BREAKING CHANGE: bin no longer ships write-docs; install plan for it.
Refs: #253
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-29 17:17:48 +00:00
Defame1297andClaude Opus 5.5 6638385a51 feat(plan): wire existing skills into /plan
Step 2 grills with grilling plus domain-modeling (no GLOSSARY.md or ADR
edits; candidates go to step 7) and exits early on the wayfinder track
with a copyable /wayfinder command. Step 5 uses codebase-design only on
module or interface changes and lists the docs needed downstream. Step 7
hands out /write-docs and /research-docs commands for the docs PR. Steps
8-10 show /to-spec and /to-tickets as code blocks, strip Ready for Agent
via gitea-labels-milestones, and group tickets under a Spec: milestone.
The outline moves these items into "What ships today".

Refs: #255

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-29 17:09:32 +00:00
Defame1297andClaude Opus 5.5 bc04eaaed5 feat(plan): add wayfinder track to plan-track
Work too large for one agent session, or with decisions that cannot be settled yet, needs a
third track. /wayfinder is hand-invoked, so plan-track names it only as a command for the user
to run. Wayfinder is checked before spec-and-tickets because it ends the /plan flow early.

Refs: #254
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-29 16:13:55 +00:00
Defame1297 0d99a41a57 Merge pull request 'docs(plan): record skill wiring decisions for /plan' (#251) from docs/plan-skill-wiring into main
Reviewed-on: #251
2026-11-29 16:05:39 +00:00
Defame1297andClaude Opus 5.5 bfe096b64d docs(plan): record skill wiring decisions for /plan
Add the Spec: milestone convention to the issue-tracker doc, update the
plan outline for three tracks (wayfinder), skill wiring and the agreed
not-yet-built items, and amend ADR-0031 for write-docs moving to plan.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-29 14:08:11 +00:00
Defame1297 43a42ce9f6 Merge pull request 'chore(apm): lock plan 0.4.0' (#250) from chore/lock-plan-0.4.0 into main
Reviewed-on: #250
2026-11-29 13:55:50 +00:00
Defame1297andClaude Opus 5.5 3414c039a8 chore(apm): lock plan 0.4.0
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-29 13:04:26 +00:00
Defame1297 219a084c25 Merge pull request 'feat(plan): bare-bones /plan MVP with gate, research, validate and record agents' (#249) from feat/plan-mvp into main
Reviewed-on: #249
Reviewed-by: Defame1297 <[email protected]>
2026-11-29 11:49:58 +00:00
Defame1297andClaude Opus 5.5 e31e8686b9 docs(plan): tighten /plan approval wording and outline notes
/plan is hand-invoked like /ship, step 6 states that agreeing also
approves the docs PR, and the outline's agent notes are corrected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-29 11:20:50 +00:00
Defame1297andClaude Opus 5.5 cf875e6e1a fix(plan): unroute agent descriptions and regenerate marketplace
Agent descriptions named the /plan prompt in slash form, which the
agent validator reads as an unresolved routing target. Regenerate
marketplace.json for plan 0.4.0. /plan now strips the ready label from
filed tickets without acceptance criteria, and the outline notes the
packages plan assumes are installed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-29 10:51:44 +00:00
Defame1297andClaude Opus 5.5 b7747d27b6 feat(plan): add bare-bones /plan MVP with gate, research, validate and record agents
Add the /plan orchestrator prompt for outline steps 0-10, four stub
agents (plan-gate, plan-researcher, plan-validator, plan-recorder) and
the plan-track skill. Steps 8-10 hand off to the hand-invoked /to-spec
and /to-tickets, which the user runs as their approval. /next now
offers /plan as a handoff. Bump plan to 0.4.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-29 10:48:44 +00:00
Defame1297 b98340d432 Merge pull request 'docs(plan): add sequence diagram to outline' (#248) from docs/plan-outline-sequence-diagram into main
Reviewed-on: #248
2026-11-29 10:39:36 +00:00
Defame1297andClaude Opus 5.5 1a887a750e docs(plan): add sequence diagram to outline
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-29 10:04:57 +00:00
Defame1297 1a2b63e2cb Merge pull request 'chore(apm): lock plan 0.3.0' (#247) from chore/lock-plan-0.3.0 into main
Reviewed-on: #247
2026-11-29 09:41:57 +00:00
Defame1297andClaude Opus 5.5 ffaf1678da chore(apm): lock plan 0.3.0
Records the apm update after #246: every Holocron package resolves to
9ae0c8c, so research-docs and the planning skills deploy from plan, and
codebase-design deploys from plan instead of mattpocock.

Refs: #246
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-29 09:29:20 +00:00
Defame1297 9ae0c8ce09 Merge pull request 'feat(plan)!: pull planning skills and research-docs into plan' (#246) from feat/plan-primitives into main
Reviewed-on: #246
2026-11-29 07:38:58 +00:00
Defame1297 7661d14b43 feat(plan)!: move codebase-design into plan and amend ADR-0031
Why: codebase-design is the deep-module vocabulary that planning relies on
when it shapes a spec or ticket breakdown, so it belongs beside the other
planning skills. ADR-0031 still said the thinking tools live in mattpocock,
which this PR makes untrue.

Implementation notes:
- The codebase-design v1.3.2 pin moves from plugins/mattpocock to plugins/plan.
  mattpocock's tdd and improve-codebase-architecture now reach it through plan.
- mattpocock's description says "architecture review" instead of "codebase
  design"; marketplace.json is regenerated to match.
- ADR-0031 gets a dated amendment listing what moved to plan, why
  setup-matt-pocock-skills is pinned in both packages, and why delivery
  does not need to depend on plan.

BREAKING CHANGE: mattpocock no longer ships codebase-design; install plan
for it.
Refs: #246
ADR: 0031
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-28 23:15:23 +00:00
Defame1297 9dad7fa71c feat(plan)!: pull planning skills and research-docs into plan
Why: plan owns turning a ticket or idea into a spec and tickets, but the skills
that do that work lived elsewhere: Matt Pocock's planning skills in the
mattpocock wrapper and research-docs in bin. Pulling them into plan is the
first step to growing the plugin from what already exists.

Implementation notes:
- The upstream pins for wayfinder, grilling, grill-me, grill-with-docs,
  domain-modeling, research, prototype, triage, to-spec and to-tickets move
  from plugins/mattpocock to plugins/plan, still at v1.3.2.
- setup-matt-pocock-skills is pinned in both packages: it writes the tracker
  doc that plan's wayfinder, to-spec, to-tickets and triage read, and that
  mattpocock's code-review and implement-spec read. apm dedupes the pin.
- research-docs and its evals move from bin to plan unchanged. It may be
  split out again later.
- Cross-package routes (improve-codebase-architecture -> grilling,
  implement-spec -> to-spec) still resolve under ADR-0029's corpus-wide walk.
- Versions: plan 0.2.0 -> 0.3.0, mattpocock 0.4.0 -> 0.5.0, bin 3.0.0 -> 4.0.0.
  marketplace.json regenerated with apm pack.

Impact: a consumer that installs only mattpocock or only bin no longer gets
these skills and must add plan.

BREAKING CHANGE: mattpocock no longer ships the planning skills and bin no
longer ships research-docs; install plan for them.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-28 20:20:32 +00:00
Defame1297 8cc8667bb3 Merge pull request 'feat(plan): refine outline and ship /ship temporarily' (#244) from feat/install-plan into main
Reviewed-on: #244
Reviewed-by: Defame1297 <[email protected]>
2026-11-28 19:46:05 +00:00
Defame1297 a84ce90694 Merge branch 'main' into feat/install-plan 2026-11-28 19:45:55 +00:00
Defame1297andClaude Opus 5.5 f5cbaa78e2 feat(plan): refine outline and ship /ship temporarily
Why: a grilling round on the outline settled its general shape. The outline
now has two tracks (spec and tickets, or tickets only), three entry points
that all start at one gate, a validation split between a cheap gate before
grilling and a deep check after research, named loop-backs with a two-loop
park cap, a docs PR that records decisions before the spec, and a single
approval to file tickets and set Ready for Agent. Undecided points are
listed under "Open for later".

/ship moves into the plugin unchanged from the personal command, so the
/ship that /next hands off to ships with the package rather than living
only in one maintainer's ~/.claude. It is marked temporary: implementation
does not belong in plan long term.

Impact: the description in apm.yml, marketplace.json and architecture.md
no longer claims the plugin stops before implementation. plan goes to
0.2.0 because it ships a new prompt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-28 19:12:29 +00:00
Defame1297 e4abbd06df Merge pull request 'feat(apm): install plan in this repo' (#243) from feat/install-plan into main
Reviewed-on: #243
2026-11-28 18:27:23 +00:00
Defame1297andClaude Opus 5.5 d782239d19 feat(apm): install plan in this repo
This repo installs what it ships (ADR-0018), so root apm.yml now consumes
the plan package added in #241. It could not be wired in that PR because
root dependencies resolve from remote main (ADR-0019). apm.lock.yaml
records plan 0.1.0 and its one deployed file, .claude/commands/next.md.

plan is the first package to ship a prompt, so .claude/commands/ is apm
install output for the first time. It joins .claude/skills/ and
.claude/agents/ in .gitignore for the same reason: committing a deployed
copy would add a mirror of plugins/<name>/.apm/ to drift against.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-28 17:55:44 +00:00
Defame1297 5920287122 Merge pull request 'feat(marketplace): add plan skeleton package' (#241) from feat/plan-plugin-scaffold into main
Reviewed-on: #241
Reviewed-by: Defame1297 <[email protected]>
2026-11-28 17:52:12 +00:00
Defame1297 a489b1c536 Merge branch 'main' into feat/plan-plugin-scaffold 2026-11-28 17:51:59 +00:00
Defame1297 4380dd03ce Merge pull request 'fix(tests): stop fixture helpers leaking temp dirs into /tmp' (#242) from fix/test-fixture-tmp-leak into main
Reviewed-on: #242
Reviewed-by: Defame1297 <[email protected]>
2026-11-28 17:37:10 +00:00
Defame1297andClaude Opus 5.5 b1b6deeac9 feat(marketplace): add plan skeleton package
Why: add a home for turning a ticket or idea into a validated, researched
spec and agent-ready tickets, stopping before implementation (that is
delivery's job).

- New `plan` package at 0.1.0 (hybrid; claude, copilot, codex).
- docs/outline.md records the maintainer's intended flow (validate, grill
  if needed, research repo + online, plan with options, agree, write
  epic/feature spec, propose ticket breakdown) as intent only; nothing is
  built yet beyond the prompt.
- Ships the existing personal `/next` command as
  .apm/prompts/next.prompt.md with its body unchanged.
  `disable-model-invocation` is dropped because apm prompt files do not
  support it (verified by a throwaway apm install: clean, body identical).
- Root apm.yml does not consume it yet: its dependencies resolve from
  remote main (ADR-0019), so wiring it in is a follow-up after merge, the
  same two-step as ansible/k8s.

Impact: the catalog gains a package; marketplace version 0.8.1 -> 0.9.0
(minor).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-11-28 16:07:12 +00:00
Defame1297 da88cd8d32 fix(tests): stop fixture helpers leaking temp dirs into /tmp
Why: new_repo/make_fixture/make_repo created a mktemp dir and appended
it to the cleanup array, but every caller runs them as R="$(helper)".
The append happens in that command-substitution subshell and is lost,
so the EXIT trap removed nothing. Each run leaked one dir per call:
31, 54, 22 and 9 for the four suites, about 1,700 dirs on one day.

Implementation Notes:
- Each suite creates one RUN_TMP root up front with a single
  `trap 'rm -rf "$RUN_TMP"' EXIT`; every fixture is `mktemp -d` under
  it, so cleanup no longer depends on where the helper runs.
- The CLEANUP_DIRS / FIXTURES arrays are gone from these four suites.
- test-check-scope-walkup-sync.sh and test-check-apm-agents-valid.sh
  already register fixtures in the caller and are unchanged.

Assisted-by: Claude Code
2026-11-28 14:40:47 +00:00
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
72 changed files with 4514 additions and 272 deletions

No files matched your search

+12 -5
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.9.1",
"owner": {
"name": "Mortis",
"url": "https://git.rkdr.net/Mortis/"
@@ -10,14 +10,14 @@
{
"name": "kyberforge",
"description": "Skills and agents for creating, maintaining, and managing an apm plugin marketplace for Claude Code and GitHub Copilot.",
"version": "2.2.1",
"version": "2.3.0",
"category": "Developer Tools",
"source": "./plugins/kyberforge"
},
{
"name": "bin",
"description": "Skills for everyday AI-assisted development work that is not tied to a single tool, forge or language, and has not yet been split into a focused plugin.",
"version": "3.0.0",
"version": "5.0.0",
"category": "Utilities",
"source": "./plugins/bin"
},
@@ -44,8 +44,8 @@
},
{
"name": "mattpocock",
"description": "Matt Pocock's agent skills — planning, grilling, test-first development, triage and bug diagnosis — redistributed from upstream at a pinned release.",
"version": "0.4.0",
"description": "Matt Pocock's build-side agent skills — test-first development, architecture review, code review, implementation and bug diagnosis — redistributed from upstream at a pinned release.",
"version": "0.5.0",
"category": "Productivity",
"source": "./plugins/mattpocock"
},
@@ -83,6 +83,13 @@
"version": "0.2.0",
"category": "Infrastructure",
"source": "./plugins/k8s"
},
{
"name": "plan",
"description": "Turning a ticket or idea into a validated, researched spec and agent-ready tickets, with the user in the loop; temporarily also ships /ship to execute a plan.",
"version": "0.5.0",
"category": "Productivity",
"source": "./plugins/plan"
}
]
}
+5 -1
View File
@@ -33,6 +33,7 @@ apm_modules/
# deployed copy would add a third mirror of the same skills to drift against.
.claude/skills/
.claude/agents/
.claude/commands/
# APM MCP deployment output — `apm install` writes the repo-root .mcp.json from
# the MCP servers its dependencies declare, and regenerates it on every install.
@@ -53,7 +54,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.
+45 -4
View File
@@ -8,7 +8,7 @@ Content ships as installable plugins, each an apm (Agent Package Manager) packag
| Path | What it holds |
| --- | --- |
| `plugins/` | The apm packages — `bin`, `core`, `git`, `gitea`, `kyberforge`, `lint`, `mattpocock`, `delivery`, `ansible`, `gitops`, `k8s` — each carrying skills, and where relevant agents, hooks, and bundled assets |
| `plugins/` | The apm packages — `bin`, `core`, `git`, `gitea`, `kyberforge`, `lint`, `mattpocock`, `delivery`, `ansible`, `gitops`, `k8s`, `plan` — each carrying skills, and where relevant agents, hooks, and bundled assets |
| `providers/claude-code/` | Claude Code adapter, deployed to `~/.claude/` via `scripts/install.sh` |
| `core/` | Provider-agnostic always-on content — `core/AGENTS.md` and `core/instructions/` |
| `docs/` | Specs (`docs/spec/`), architectural decisions (`docs/adr/`), governance, research, and notes |
@@ -22,12 +22,13 @@ The plugins:
- **gitea** — issues, pull requests, labels, milestones, releases, branches, files, and an interactive router (`gitea-workflow`)
- **core** — authoring and auditing a repo's `AGENTS.md` and the provider adapter files that defer to it
- **lint** — configuring and running linters
- **mattpocock** — Matt Pocock's agent skills — planning, grilling, test-first development, triage and bug diagnosis — redistributed from upstream at a pinned release
- **mattpocock** — Matt Pocock's build-side agent skills — test-first development, architecture review, code review, implementation and bug diagnosis — redistributed from upstream at a pinned release
- **delivery** — agents and skills for taking a change from spec to a verified merge through tracker-gated stages
- **ansible** — authoring, testing and dry-running Ansible playbooks, roles and collections
- **gitops** — authoring, auditing and diagnosing a Flux GitOps repository, including the secrets sealed into it
- **k8s** — read-only diagnosis of workloads on a Kubernetes cluster
- **bin** — cross-cutting workflow skills not yet split into a focused plugin: research, documentation, TDD, prototyping, triage, diagnosis, architecture review, requirement grilling, compressed output (`caveman`), and re-orienting mid-task (`zoom-out`)
- **plan** — turning a ticket or idea into a validated, researched spec and agent-ready tickets; ships the `/plan`, `/next` and `/ship` prompts, the `plan-*` agents, `plan-track`, `research-docs` and `write-docs` (documentation), and Matt Pocock's planning skills (grilling, research, domain modelling, codebase design, wayfinder, spec, tickets, triage) at a pinned release
- **bin** — cross-cutting workflow skills not yet split into a focused plugin: diagnosis, compressed output (`caveman`), and re-orienting mid-task (`zoom-out`)
## Prerequisites
@@ -99,9 +100,49 @@ 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.
Consume the packages through apm, the way this repo does. apm is the only supported install path.
### Pinning a plugin to a release
Each plugin is released as a git tag `<plugin>-v<x.y.z>`, for example `git-v1.3.9`
([ADR-0033](docs/adr/0033-plugin-releases-are-tagged-plugin-v-version.md)). Pin one with apm's
object form, keys in this order (the planned Renovate rule matches only this order):
```yaml
dependencies:
apm:
- git: https://git.rkdr.net/Mortis/Holocron.git
path: plugins/git
ref: git-v1.3.9
```
Then run `apm install`. Without `ref:`, the entry tracks the default branch. To list a plugin's
releases, run `git ls-remote --tags https://git.rkdr.net/Mortis/Holocron.git '<plugin>-v*'`;
`apm outdated` also reports newer `<plugin>-v<x.y.z>` tags.
### Do not use the shorthand form
The shorthand `git.rkdr.net/Mortis/Holocron/plugins/<name>#<plugin>-v<x.y.z>` does not work on this
host. apm reads `plugins/<name>` as part of the repository path, so a real install tries to clone
`.../Holocron/plugins/<name>.git` and fails with "Not found". `apm install --dry-run` does not catch
this. Use the object form.
### Automated updates
Renovate's `apm` manager cannot update these pins: it reads only the shorthand form and drops
object-form entries. A Renovate regex manager on the `ref:` line is planned but untested, so bump
`ref:` by hand until a verified rule is published here. See ADR-0033 consequence 3.
## Where to go next
+590 -64
View File
@@ -1,11 +1,11 @@
lockfile_version: '1'
generated_at: '2026-11-23T18:19:20.581087+00:00'
generated_at: '2026-11-29T18:12:07.565691+00:00'
apm_version: 0.28.0
dependencies:
- repo_url: Mortis/Holocron
name: ansible
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
resolved_commit: 3b0dcc32d4009e10be98be7c167bb72bd7b001bd
version: 0.1.0
virtual_path: plugins/ansible
is_virtual: true
@@ -15,8 +15,8 @@ dependencies:
- repo_url: Mortis/Holocron
name: bin
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
version: 3.0.0
resolved_commit: 3b0dcc32d4009e10be98be7c167bb72bd7b001bd
version: 5.0.0
virtual_path: plugins/bin
is_virtual: true
package_type: apm_package
@@ -28,12 +28,6 @@ dependencies:
- .claude/skills/diagnose/assets/hitl-loop.template.sh
- .claude/skills/diagnose/references/feedback-loops.md
- .claude/skills/diagnose/references/regression-seams.md
- .claude/skills/research-docs
- .claude/skills/research-docs/SKILL.md
- .claude/skills/research-docs/references/file-format.md
- .claude/skills/research-docs/references/topics.md
- .claude/skills/write-docs
- .claude/skills/write-docs/SKILL.md
- .claude/skills/zoom-out
- .claude/skills/zoom-out/SKILL.md
deployed_file_hashes:
@@ -42,17 +36,13 @@ dependencies:
.claude/skills/diagnose/assets/hitl-loop.template.sh: sha256:b2932630950e5210075bcd6f850e5accf30c101c5367b29eac3a29b4dd8084c8
.claude/skills/diagnose/references/feedback-loops.md: sha256:5ed81b331fcf7dfc229b92be7250fd786064f8363dbf55bf6b6e5e9b5f5e1daf
.claude/skills/diagnose/references/regression-seams.md: sha256:fdb24c383628d239e54424f72258860612d6fe8a1fc5d0057ab5073628cc71f4
.claude/skills/research-docs/SKILL.md: sha256:93023786f71dac5a77e60eca0be09e6510dfd45509f5e8cbc755395fe8774539
.claude/skills/research-docs/references/file-format.md: sha256:29d5583beaa531d26895c54def112039730490c312401648a6bdb7dd5278fb3c
.claude/skills/research-docs/references/topics.md: sha256:757abb7b6be44c3d3c0dd1f4818a344e08877810d36bf8be60ea7189cba8d12f
.claude/skills/write-docs/SKILL.md: sha256:861bfa52ec1f7f5c2bc335da4e8d92880259c02c2edacb1ad79cca3a3c557d08
.claude/skills/zoom-out/SKILL.md: sha256:35a81f26d8867ad063c5b8d50b4e7ffee9f6c0afa260b52137083fc7392ffe90
content_hash: sha256:1380157484be45c83144b488abd04174d0d08201f53f38303f4e7df40420c7f0
content_hash: sha256:62c4b42e4ea52a09b123e81fe28a69b29d5f2402c9ac8289934acdea8d4f63a7
declared_license: MIT
- repo_url: Mortis/Holocron
name: core
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
resolved_commit: 3b0dcc32d4009e10be98be7c167bb72bd7b001bd
version: 1.1.4
virtual_path: plugins/core
is_virtual: true
@@ -101,19 +91,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: 3b0dcc32d4009e10be98be7c167bb72bd7b001bd
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 +121,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: 3b0dcc32d4009e10be98be7c167bb72bd7b001bd
version: 1.3.9
virtual_path: plugins/git
is_virtual: true
@@ -251,7 +293,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: gitea
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
resolved_commit: 3b0dcc32d4009e10be98be7c167bb72bd7b001bd
version: 1.3.10
virtual_path: plugins/gitea
is_virtual: true
@@ -336,27 +378,49 @@ dependencies:
- repo_url: Mortis/Holocron
name: gitops
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
version: 0.1.0
resolved_commit: 3b0dcc32d4009e10be98be7c167bb72bd7b001bd
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: 3b0dcc32d4009e10be98be7c167bb72bd7b001bd
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: 3b0dcc32d4009e10be98be7c167bb72bd7b001bd
version: 2.2.1
virtual_path: plugins/kyberforge
is_virtual: true
@@ -514,7 +578,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 +603,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 +665,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: 3b0dcc32d4009e10be98be7c167bb72bd7b001bd
version: 1.1.9
virtual_path: plugins/lint
is_virtual: true
@@ -635,12 +699,51 @@ dependencies:
- repo_url: Mortis/Holocron
name: mattpocock
host: git.rkdr.net
resolved_commit: cbd6033ee494d3a05b8e6b068b9ce622c78df9c4
version: 0.4.0
resolved_commit: 3b0dcc32d4009e10be98be7c167bb72bd7b001bd
version: 0.5.0
virtual_path: plugins/mattpocock
is_virtual: true
package_type: apm_package
content_hash: sha256:91649428cf594bd911beb982282f92f7b732908db649d484e420c0ba1d6b6b7b
content_hash: sha256:ba0aeb2518f4e5d09049ea96b4452e07fd274a84a45a6be02f5e7daac7679dfb
declared_license: MIT
- repo_url: Mortis/Holocron
name: plan
host: git.rkdr.net
resolved_commit: 3b0dcc32d4009e10be98be7c167bb72bd7b001bd
version: 0.5.0
virtual_path: plugins/plan
is_virtual: true
package_type: apm_package
deployed_files:
- .claude/agents/plan-gate.md
- .claude/agents/plan-recorder.md
- .claude/agents/plan-researcher.md
- .claude/agents/plan-validator.md
- .claude/commands/next.md
- .claude/commands/plan.md
- .claude/commands/ship.md
- .claude/skills/plan-track
- .claude/skills/plan-track/SKILL.md
- .claude/skills/research-docs
- .claude/skills/research-docs/SKILL.md
- .claude/skills/research-docs/references/file-format.md
- .claude/skills/research-docs/references/topics.md
- .claude/skills/write-docs
- .claude/skills/write-docs/SKILL.md
deployed_file_hashes:
.claude/agents/plan-gate.md: sha256:c1c89bae5dd59de122603c2caf1907e8eaf38244cf007dd1942df8cea616a8ca
.claude/agents/plan-recorder.md: sha256:a5283798a574900d4b78dbbbcdf78b9ae0997e8496f5971f0085cfad87c1fea0
.claude/agents/plan-researcher.md: sha256:eda0457d2007cf0c6cb4745383a0369d03a26ed252d7251a1f5250003a89ef85
.claude/agents/plan-validator.md: sha256:a56e7a710fd9e7a9dd9e2601f1f2701b98fd229f3e014bba4bda4dfe5977ecae
.claude/commands/next.md: sha256:8e16330ec0f16dbbc86d44fca94699e33e393c9a8af76f45d3f3bd2b9c8bfa1f
.claude/commands/plan.md: sha256:0b02a8014a916cce6c8cd972b47c4997e7f0b630eaa03b7bb80aa04ae6f0c604
.claude/commands/ship.md: sha256:f108f73e60a884f46285955027fba47d6309fed6a89812948f577e27be180af8
.claude/skills/plan-track/SKILL.md: sha256:a6eb123f518f77172d98ebe80c227f4658b3721a07282a8c6430244ed087f59f
.claude/skills/research-docs/SKILL.md: sha256:93023786f71dac5a77e60eca0be09e6510dfd45509f5e8cbc755395fe8774539
.claude/skills/research-docs/references/file-format.md: sha256:29d5583beaa531d26895c54def112039730490c312401648a6bdb7dd5278fb3c
.claude/skills/research-docs/references/topics.md: sha256:757abb7b6be44c3d3c0dd1f4818a344e08877810d36bf8be60ea7189cba8d12f
.claude/skills/write-docs/SKILL.md: sha256:861bfa52ec1f7f5c2bc335da4e8d92880259c02c2edacb1ad79cca3a3c557d08
content_hash: sha256:0128e9357a9fc96983967b994b8bcccd3da80c3021fac49f7ffd10ac818144ff
declared_license: MIT
- repo_url: fluxcd/agent-skills
name: gitops-knowledge
@@ -1240,6 +1343,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
@@ -1267,6 +1424,69 @@ deployments:
- git.rkdr.net/Mortis/Holocron/plugins/lint
active_owner: git.rkdr.net/Mortis/Holocron/plugins/lint
content_hash: sha256:efeee4fb01c27b9177239f059851cf1b736ca50a12793b94d5d65d30ab98bcd4
- kind: project-relative
target: claude
value: .claude/agents/plan-gate.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: sha256:c1c89bae5dd59de122603c2caf1907e8eaf38244cf007dd1942df8cea616a8ca
- kind: project-relative
target: claude
value: .claude/agents/plan-recorder.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: sha256:a5283798a574900d4b78dbbbcdf78b9ae0997e8496f5971f0085cfad87c1fea0
- kind: project-relative
target: claude
value: .claude/agents/plan-researcher.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: sha256:eda0457d2007cf0c6cb4745383a0369d03a26ed252d7251a1f5250003a89ef85
- kind: project-relative
target: claude
value: .claude/agents/plan-validator.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: sha256:a56e7a710fd9e7a9dd9e2601f1f2701b98fd229f3e014bba4bda4dfe5977ecae
- kind: project-relative
target: claude
value: .claude/commands/next.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: sha256:8e16330ec0f16dbbc86d44fca94699e33e393c9a8af76f45d3f3bd2b9c8bfa1f
- kind: project-relative
target: claude
value: .claude/commands/plan.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: sha256:0b02a8014a916cce6c8cd972b47c4997e7f0b630eaa03b7bb80aa04ae6f0c604
- kind: project-relative
target: claude
value: .claude/commands/ship.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: sha256:f108f73e60a884f46285955027fba47d6309fed6a89812948f577e27be180af8
- kind: project-relative
target: claude
value: .claude/hooks/delivery/.apm/hooks/guard.py
@@ -1771,6 +1991,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 +2035,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 +2044,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 +2053,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 +2071,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 +2080,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 +2089,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 +2404,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 +2629,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 +2747,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 +4547,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
@@ -4192,6 +4700,24 @@ deployments:
- git.rkdr.net/Mortis/Holocron/plugins/git
active_owner: git.rkdr.net/Mortis/Holocron/plugins/git
content_hash: sha256:ed47302b3fa003ca203cf6677905032f687ff5e07e3d551593865116d9ce11f1
- kind: project-relative
target: claude
value: .claude/skills/plan-track
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: null
- kind: project-relative
target: claude
value: .claude/skills/plan-track/SKILL.md
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: sha256:a6eb123f518f77172d98ebe80c227f4658b3721a07282a8c6430244ed087f59f
- kind: project-relative
target: claude
value: .claude/skills/prompt-author
@@ -4443,7 +4969,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
@@ -4459,8 +4985,8 @@ deployments:
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/bin
active_owner: git.rkdr.net/Mortis/Holocron/plugins/bin
- git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: null
- kind: project-relative
target: claude
@@ -4468,8 +4994,8 @@ deployments:
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/bin
active_owner: git.rkdr.net/Mortis/Holocron/plugins/bin
- git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: sha256:93023786f71dac5a77e60eca0be09e6510dfd45509f5e8cbc755395fe8774539
- kind: project-relative
target: claude
@@ -4477,8 +5003,8 @@ deployments:
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/bin
active_owner: git.rkdr.net/Mortis/Holocron/plugins/bin
- git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: sha256:29d5583beaa531d26895c54def112039730490c312401648a6bdb7dd5278fb3c
- kind: project-relative
target: claude
@@ -4486,8 +5012,8 @@ deployments:
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/bin
active_owner: git.rkdr.net/Mortis/Holocron/plugins/bin
- git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: sha256:757abb7b6be44c3d3c0dd1f4818a344e08877810d36bf8be60ea7189cba8d12f
- kind: project-relative
target: claude
@@ -4999,8 +5525,8 @@ deployments:
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/bin
active_owner: git.rkdr.net/Mortis/Holocron/plugins/bin
- git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: null
- kind: project-relative
target: claude
@@ -5008,8 +5534,8 @@ deployments:
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/bin
active_owner: git.rkdr.net/Mortis/Holocron/plugins/bin
- git.rkdr.net/Mortis/Holocron/plugins/plan
active_owner: git.rkdr.net/Mortis/Holocron/plugins/plan
content_hash: sha256:861bfa52ec1f7f5c2bc335da4e8d92880259c02c2edacb1ad79cca3a3c557d08
- kind: project-relative
target: claude
+16 -5
View File
@@ -1,5 +1,5 @@
name: holocron
version: 0.8.0
version: 0.9.1
description: AI development skills for Claude Code, and for GitHub Copilot through apm — factory, design, implement, review, and cross-cutting workflows.
license: MIT
@@ -30,7 +30,8 @@ dependencies:
path: plugins/lint
# Third-party skills (Matt Pocock's) arrive transitively through this
# wrapper rather than as direct entries, so the marketplace and this repo
# consume them by the same path. The pins live in plugins/mattpocock/apm.yml:
# consume them by the same path. The pins live in plugins/mattpocock/apm.yml
# and, for the planning skills, plugins/plan/apm.yml:
# third-party content is pinned, unlike the first-party entries above,
# which stay unpinned for default-branch parity. The same rule holds for the
# fluxcd skills gitops pins in plugins/gitops/apm.yml.
@@ -47,6 +48,9 @@ dependencies:
path: plugins/gitops
- git: https://git.rkdr.net/Mortis/Holocron.git
path: plugins/k8s
# Ticket and idea planning, up to an agent-ready spec and breakdown.
- git: https://git.rkdr.net/Mortis/Holocron.git
path: plugins/plan
mcp: []
# Turns apm's executable-trust gate ON. Without this block the gate is disabled
@@ -68,7 +72,7 @@ dependencies:
# an apm mechanic.
executables:
allow:
kyberforge#2.2.1:
kyberforge#2.3.0:
hooks: true
bin: true
# delivery ships the guard hook (ADR-0032 enforcement layer 2). Same
@@ -82,14 +86,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.9.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.
@@ -146,3 +153,7 @@ marketplace:
- name: k8s
source: ./plugins/k8s
category: Infrastructure
- name: plan
source: ./plugins/plan
category: Productivity
@@ -7,6 +7,11 @@ and nothing detects it.
**Status: accepted (2026-08-14).**
*Amended 2026-12-01 (holocron#265): the hook resolves apm through the contract in ADR-0034 (a
repo-pinned `uv run --frozen` apm, else `PATH` apm, else exit 0) instead of a bare `command -v apm`.
The "0.28.0" claims below (the correction near line 80, the `apm outdated` prose at about line 143,
and the sidecar reproduction at about line 217) are pending re-verification on 0.39.3 under #265.*
## Context
The pre-existing answer was `scripts/git-hooks/post-push`, which pulled the marketplace clone and
@@ -139,6 +144,11 @@ value to be larger — so changing either side without the other fails the suite
> Re-measured: ~24–26 s for the same six-behind refresh, warm, on a LAN remote — well inside the
> 380 s above.
> **Amendment (2026-12-02, holocron#270) — the budget is now 375 s and the host timeout 400 s.** The
> hook also reads `apm --version` under a 15 s bound before the outdated check (ADR-0034), and calls
> `timeout` or `gtimeout` through a variable, which the budget test parses too. The current numbers
> and their breakdown live in `plugins/kyberforge/docs/hooks.md`.
**Reading a human-readable CLI for a control decision cost a silent failure, again.** `apm outdated`
has no `--json` or other machine-readable flag (confirmed against 0.28.0), so the hook must match
its prose. The first attempt matched `outdated dependencies found` — plural only. apm emits
@@ -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
@@ -39,5 +39,12 @@ approved) are human-set tracker state. `mattpocock`'s thinking tools (`wayfinder
until an account exists; other runtimes are best effort.
- *Amended 2026-11-22 (holocron#173): Copilot CLI was a tested target; with no account to test on,
it is supported from its documentation only.*
- *Amended 2026-11-28 (holocron#246): the thinking tools no longer live in `mattpocock`. `wayfinder`,
`grilling`, `grill-me`, `grill-with-docs`, `domain-modeling`, `research`, `prototype`,
`codebase-design`, `triage`, `to-spec` and `to-tickets` are now pinned in `plan`, and bin's
`research-docs` moved there too. `setup-matt-pocock-skills` is pinned in both packages, at one
upstream tag that is bumped in both together. `delivery` keeps its `mattpocock` dependency, but
references none of the moved skills, so it does not depend on `plan`.*
- *Amended 2026-11-29: bin's `write-docs` moves to `plan` too, alongside `research-docs`.*
- Infra applies happen by merge (GitOps for Flux, Ansible and OpenTofu alike), so the PR gate is the
apply gate; the operator verifies and opens revert PRs, never reverting on its own.
@@ -0,0 +1,199 @@
# Every plugin version on `main` is tagged `<plugin>-v<version>`, cut by script after merge
**Status: accepted (2026-11-27).**
*Amended 2026-12-01 (holocron#265): the 0.28.0 claims in this ADR (the `apm outdated` tag-pattern
check in Context and the apm behaviour in consequence 3) are pending re-verification on 0.39.3 under
#265, once apm is pinned per repo (ADR-0034). The Decision is unchanged.*
## 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>`.
*Amended 2026-11-29 (holocron#235, #236): this is wrong for Holocron consumers. The manager reads
only the shorthand form, which apm cannot install for a Gitea subpath, so it does not serve them
today. See consequence 3.*
- **`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. Consumers pin with the object form; the `apm` manager does not update them.** *Amended
2026-11-29 (holocron#235, #236); this replaces the original consequence 3, an `overridePackageName`
`packageRules` entry, which is withdrawn.* It was untested and cannot work, for any form:
- On a generic git host such as this Gitea, apm (0.28.0, and still on `main` at 0.39.1) cannot
resolve a plugin subdirectory from the shorthand form. `<host>/Mortis/Holocron/plugins/<name>#ref`
folds `plugins/<name>` into the repo path, and an install clones `.../plugins/<name>.git` and
fails with "Not found". The separate `rstrip(".git")` parse bug (0.28.0) is already fixed upstream
(microsoft/apm#3715, PR #3767).
- The object form (`git:` + `path:` + `ref:`) is the only working way to pin a Holocron plugin.
Consumers set `ref: <plugin>-v<x.y.z>`.
- Renovate's `apm` manager (schema `apm: LooseArray(z.string())`) extracts only shorthand strings and
silently drops object-form entries. No `apm.yml` entry is both installable by apm and updatable by
that manager for a Gitea subpath, so no `packageRules` entry can fix it.
The planned route is a Renovate `customManagers` regex manager on the object-form `ref:` line: the
`git-tags` datasource, a `currentValue` capturing only the version after `<plugin>-v`, an
`extractVersion` scoped to that plugin's own prefix, and automerge off. **This is planned and
untested, and no snippet is given.** The verified rule goes in a later amendment, after a live
consumer proof. Two upstream reports are to be filed: an apm issue for generic-host subpath folding,
and a Renovate Discussion for object-form extraction.
The Decision, the tag shape `<plugin>-v<version>`, is unchanged by this amendment.
**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.
@@ -0,0 +1,97 @@
# apm is pinned per repo with uv
**Status: accepted (2026-12-01).**
*Amended 2026-12-02 (holocron#270): the hook's test seam is a `PATH` stub of `uv`, not an `APM`
environment override. `tests/test-apm-current-hook.sh` puts a fake `uv` first on a `PATH` that
excludes the machine's real `uv` and `apm`. The fake records every invocation and reaches the pinned
fake apm only through `uv run`, so the shipped hook carries no test-only override. The `APM` variable
under Invocation still applies to repo scripts, not to the hook. The hook also passes `--no-sync` and
`--offline` to `uv run`. A plain `uv run --frozen` syncs the environment before running, which is the
uv sync and the network access this contract forbids.*
## Context
Issue #265. apm is installed once per machine with pipx, at 0.28.0, and every repo and the
`SessionStart` hook (ADR-0019) call whatever `apm` is on `PATH`. Three things now fail against that:
- **Lockfile format.** apm 0.37 and later write lockfile v4, and apm 0.36.1 and earlier refuse it. A
lock written by 0.39.2 is in turn refused by 0.37.0 through 0.39.1.
- **Command keys.** apm 0.39.0 and later keep Claude command keys such as `disable-model-invocation`
(#245). Earlier versions drop them, so a deployed command silently loses the setting.
- **Machine-global drift.** One shared binary means every checkout's behaviour depends on what was
last installed on that machine. apm has no minimum-version field in `apm.yml`, and upstream's advice
is to pin a minimum in CI. This repo has no CI (ADR-0024), so the pin has to live in the repo.
## Decision
**Each repo pins its own apm with uv. This repo needs apm 0.39.2 or later and is pinned to 0.39.3.**
- **Pin.** The root `pyproject.toml` has no build system, sets `[tool.uv] package = false` and
`requires-python = ">=3.11"`, and declares `[dependency-groups] dev = ["apm-cli==0.39.3"]`. A
committed `uv.lock` fixes the transitive dependencies. `.venv/` is gitignored.
- **Invocation.** Repo scripts run apm as `uv run --project <repo root> --frozen apm`. An `APM`
environment variable overrides the command, as a seam for tests.
- **Minimum version, 0.39.2.** It is the lowest version that reads and writes lockfile v4 and is
read back by later versions, and it is at or above 0.39.0, which keeps the Claude command keys.
Inside this repo the `==` pin enforces it. Where apm comes from `PATH` (a consumer repo that does
not pin), an explicit version check enforces it.
- **uv only pins apm itself.** ADR-0024 stands: apm is the only supported install path for plugin
content. uv installs the tool, never plugins, skills or agents.
- **Hook first.** The kyberforge `SessionStart` hook change ships first, with a kyberforge version
bump and its release tag (ADR-0033). The cutover (the v4 lock, `pyproject.toml`, `uv.lock`, the
scripts and their tests) follows as one PR. The order matters because the deployed hook comes from
the `main` commit that `apm.lock.yaml` records. If the v4 lock landed first, the old hook would run
`PATH` apm 0.28.0, which refuses the lock, and staleness detection would be lost with no error.
The cost of this order: between the hook landing and the cutover, this repo has no pin, so the hook
runs `PATH` apm 0.28.0 and prints the fixed too-old notice at every session start. Auto-refresh
is paused here until the #271 cutover adds the pin.
- **The cutover PR commits a lock rewrite (v1 to v4) on purpose.** It is the one sanctioned exception
to the rule that `apm.lock.yaml` churn is discarded on feature branches (ADR-0019).
- **Consumer hook contract.** The shipped hook (`check-apm-current.sh`) resolves apm in this order:
1. `uv run --frozen --no-sync --offline`, when the project pins `apm-cli` (a quoted `apm-cli`
requirement in `pyproject.toml` plus a `uv.lock`) and uv exists. If the project environment
(`$UV_PROJECT_ENVIRONMENT`, else `<root>/.venv`) does not exist, the hook prints a fixed "not
synced, run `uv sync --frozen`" notice and never calls uv, because even `--no-sync` creates an
empty `.venv`.
2. `apm` on `PATH`.
3. Neither: exit 0. So does a machine with no `timeout` or `gtimeout`, on every path.
It never triggers a uv sync, and on a cold cache it must not touch the network inside the
`SessionStart` timeout. It never reports "up to date" when it ran on an apm older than 0.39.2. Its
advice strings are fixed and name the chosen binary, with no interpolation of command output.
- **Global apm 0.28.0 stays.** It stays installed and on `PATH`, because ansible still uses it
(Defame1297/ansible-homelab-mono#1078). It is not upgraded. Whichever of that issue and
Mortis/Kamino#499 lands last uninstalls it: the last mover deletes.
- **New setup step.** The offline pre-push guarantee of ADR-0019 now needs `uv sync --frozen` once
and `apm install` once per checkout. The first apm 0.39 install also needs the network, to record
commit verdicts.
## Considered options
**Global pipx apm, as today (rejected).** It is the drift described above, and it cannot enforce a
minimum version.
**Upgrade the global apm (rejected).** It would fix this repo and break ansible, which still depends
on 0.28.0 behaviour, and it would leave the next repo with the same shared-binary problem.
**`uvx` (rejected).** It has no lock, so apm's transitive dependencies float between runs and the
pin only covers the top-level package.
**`uv tool install` (rejected).** It is machine-global state, the same drift as pipx under a
different name.
## Consequences
1. **A bare `apm` instruction fails closed.** Any leftover `apm` call in this repo that resolves to
the global 0.28.0 refuses the v4 lock instead of rewriting it. That is the intended failure, but it
will surprise whoever hits it; the fix is the `uv run` form.
2. **The network is needed on first sync.** A fresh checkout needs it for `uv sync --frozen` and again
for the first `apm install`. After both, the offline guarantee holds.
3. **uv becomes a prerequisite** of working in this repo. A consumer without uv falls back to `PATH`
apm and the version check.
4. **Re-verification is pending.** ADR-0019 and ADR-0033 state facts verified against apm 0.28.0.
They are re-checked on 0.39.3 under #265, and each carries a note saying so.
Related: ADR-0019, ADR-0024, ADR-0033; #245, #265; Defame1297/ansible-homelab-mono#1078;
Mortis/Kamino#499.
+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
+4
View File
@@ -28,6 +28,10 @@ How the `wayfinder` skill's map and tickets map onto Gitea, which has native iss
- **Frontier query**: open issues in the map's milestone with no assignee, then drop any whose `get_blocked_by` lists an open issue.
- **Research findings**: committed on a `research/<name>` branch that is pushed but never merged; the ticket's resolution comment links it.
## Spec milestones
On `/plan`'s spec-and-tickets track, `/plan` creates one milestone titled `Spec: <spec issue title>` and assigns every ticket filed from that spec to it. The milestone is created through `gitea-labels-milestones` and the assignment is made through `gitea-issues`. This sits beside the `Map: <name>` milestone above and follows the same one-milestone-per-parent shape. Spec tickets that carry acceptance criteria get `Status/Ready for Agent`; ones without do not.
## PRs as a request surface
Off. Only issues feed the triage queue; PRs are not triaged as requests.
+1
View File
@@ -47,6 +47,7 @@ These are routing boundaries, not inventories — they answer "where does a new
| `ansible` | Authoring, testing and dry-running Ansible playbooks, roles and collections |
| `gitops` | Authoring, auditing and diagnosing a Flux GitOps repository, including the secrets sealed into it; pod-level problems hand off to `k8s` |
| `k8s` | Read-only diagnosis of workloads on a Kubernetes cluster |
| `plan` | Turning a ticket or idea into a validated, researched spec and agent-ready tickets, with the user in the loop; temporarily also ships `/ship` to execute a plan, until implementation moves elsewhere |
| `bin` | Unsorted skills that have not earned a home yet |
One compiler produces the generated content in the tree:
+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
+1 -1
View File
@@ -19,7 +19,7 @@ Then:
apm install
```
The entry above is unpinned and tracks the remote's default branch — add `ref: <tag>` to pin a release. Registering the catalogue instead (`apm marketplace add https://git.rkdr.net/Mortis/Holocron.git --name holocron`) gets you the `bin@holocron` short name, but writes to `~/.apm/marketplaces.json` at user scope; the git+path object needs nothing beyond the manifest.
The entry above is unpinned and tracks the remote's default branch. To pin a release, add `ref: bin-v<x.y.z>` after `path:`; see [Pinning a plugin to a release](../../README.md#pinning-a-plugin-to-a-release). Registering the catalogue instead (`apm marketplace add https://git.rkdr.net/Mortis/Holocron.git --name holocron`) gets you the `bin@holocron` short name, but writes to `~/.apm/marketplaces.json` at user scope; the git+path object needs nothing beyond the manifest.
**Native plugin installs do not work.** This package ships no per-plugin manifest and no flat content directories, so a host that installs it natively gets zero skills — and Claude Code raises no error while doing it (ADR-0024).
+1 -2
View File
@@ -1,5 +1,5 @@
name: bin
version: 3.0.0
version: 5.0.0
description: Skills for everyday AI-assisted development work that is not tied to a single tool, forge or language, and has not yet been split into a focused plugin.
author:
name: Mortis
@@ -10,7 +10,6 @@ repository: https://git.rkdr.net/Mortis/Holocron/src/branch/main/plugins/bin
keywords:
- utility
- diagnostics
- research
# Constrains what .apm/ may contain: instructions, skill, hybrid, or prompts
type: skill
@@ -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
}
+1 -1
View File
@@ -19,7 +19,7 @@ Then:
apm install
```
The entry above is unpinned and tracks the remote's default branch — add `ref: <tag>` to pin a release. Registering the catalogue instead (`apm marketplace add https://git.rkdr.net/Mortis/Holocron.git --name holocron`) gets you the `core@holocron` short name, but writes to `~/.apm/marketplaces.json` at user scope; the git+path object needs nothing beyond the manifest.
The entry above is unpinned and tracks the remote's default branch. To pin a release, add `ref: core-v<x.y.z>` after `path:`; see [Pinning a plugin to a release](../../README.md#pinning-a-plugin-to-a-release). Registering the catalogue instead (`apm marketplace add https://git.rkdr.net/Mortis/Holocron.git --name holocron`) gets you the `core@holocron` short name, but writes to `~/.apm/marketplaces.json` at user scope; the git+path object needs nothing beyond the manifest.
**Native plugin installs do not work.** This package ships no per-plugin manifest and no flat content directories, so a host that installs it natively gets zero skills — and Claude Code raises no error while doing it (ADR-0024).
+1 -1
View File
@@ -19,7 +19,7 @@ Then:
apm install
```
The entry above is unpinned and tracks the remote's default branch — add `ref: <tag>` to pin a release. Registering the catalogue instead (`apm marketplace add https://git.rkdr.net/Mortis/Holocron.git --name holocron`) gets you the `git@holocron` short name, but writes to `~/.apm/marketplaces.json` at user scope; the git+path object needs nothing beyond the manifest.
The entry above is unpinned and tracks the remote's default branch. To pin a release, add `ref: git-v<x.y.z>` after `path:`; see [Pinning a plugin to a release](../../README.md#pinning-a-plugin-to-a-release). Registering the catalogue instead (`apm marketplace add https://git.rkdr.net/Mortis/Holocron.git --name holocron`) gets you the `git@holocron` short name, but writes to `~/.apm/marketplaces.json` at user scope; the git+path object needs nothing beyond the manifest.
**Native plugin installs do not work.** This package ships no per-plugin manifest and no flat content directories, so a host that installs it natively gets zero skills and zero agents — and Claude Code raises no error while doing it (ADR-0024).
@@ -24,26 +24,49 @@ project_dir="${CLAUDE_PROJECT_DIR:-$PWD}"
# No lockfile means nothing was installed through apm here — e.g. a host that
# installed this plugin natively. Say nothing and cost nothing.
[[ -f "$project_dir/apm.lock.yaml" ]] || exit 0
command -v apm > /dev/null 2>&1 || exit 0
# Every apm call below must see the same directory the guard just checked —
# `apm outdated` and `apm update` both resolve the lockfile from the cwd.
cd "$project_dir" || exit 0
# Every apm call below is bounded, and stock macOS ships no `timeout`; Homebrew
# coreutils installs it as `gtimeout`. Without either, nothing can be bounded,
# so the hook stays silent on every path rather than risk holding the session
# open — or misreporting an apm whose version it could not read. It is chosen
# before the apm, so no notice is printed either. The budget test in
# tests/test-apm-current-hook.sh sums every `"$to" N` and `timeout N` here.
if command -v timeout > /dev/null 2>&1; then
to=timeout
elif command -v gtimeout > /dev/null 2>&1; then
to=gtimeout
else
exit 0
fi
# `apm outdated` exits 0 whether or not anything is stale, so the answer has to
# come from its output. ~0.7s against six remote refs; a hung remote must not
# hold the session open.
# Choose the apm once, and use it for every call below (ADR-0034):
# 1. the repo's own pin, run as `uv run`, when the project pins apm-cli AND
# uv is on PATH;
# 2. otherwise the `apm` on PATH;
# 3. otherwise nothing: exit silently.
#
# There is no --json/machine-readable flag on `apm outdated` (verified against
# apm 0.28.0), so the phrase match is forced rather than chosen. Note the
# singular: apm prints "1 outdated dependency found" when exactly one package is
# behind, so matching only "dependencies" would silently miss a one-package
# drift. tests/test-apm-current-hook.sh pins both spellings against the real apm.
outdated_output="$(timeout 60 apm outdated 2>&1)" || exit 0
grep -qE 'outdated dependenc(y|ies) found' <<< "$outdated_output" || exit 0
stale_count="$(grep -oE '[0-9]+ outdated dependenc(y|ies) found' <<< "$outdated_output" | grep -oE '^[0-9]+' || true)"
[[ "$stale_count" =~ ^[0-9]+$ ]] || stale_count="some"
# "Pins apm-cli" means a pyproject.toml whose text carries a quoted apm-cli
# requirement (`"apm-cli==0.39.3"`, `'apm_cli>=0.39'`, ...) AND a uv.lock next
# to it. It is a text match, not a TOML parse: the hook must not depend on a
# Python being on PATH, and a quoted `apm-cli` requirement string has no other
# plausible meaning in a pyproject.toml. The uv.lock is required because
# `--frozen` runs from the lock and has nothing to run without one; a pin with
# no lock falls through to PATH apm and its version check.
#
# uv is only ever invoked as `uv run`, and with `--no-sync`: a plain `uv run`
# syncs the environment first, which installs packages and can reach the
# network, and a SessionStart hook must do neither. `--offline` closes the
# remaining gap (uv fetching a Python). Even `--no-sync` creates an empty
# .venv when none exists, so a project environment that is missing altogether
# (`$UV_PROJECT_ENVIRONMENT`, else <root>/.venv) gets a fixed "not synced"
# notice and uv is never called. One that exists but was never synced has no
# apm of its own, so `uv run` falls through to whatever apm is on PATH, and the
# version check below catches an old one and tells the reader to sync.
#
# apm_label names the chosen binary in advice text. It selects between fixed
# literals and is never built from command output. apm_cmd is never seeded
# empty: every branch below either sets it or exits, which keeps its expansions
# safe under `set -u` on bash 3.2 (tests/test-vale-wrap.sh scans for this).
# Only ever emit fixed text plus a digit-checked count — never interpolate
# command output into the JSON, which would need escaping this cannot do safely.
@@ -51,6 +74,83 @@ emit() {
printf '{"hookSpecificOutput":{"hookEventName":"SessionStart","reloadSkills":%s,"additionalContext":"%s"}}\n' "$1" "$2"
}
apm_label=""
if [[ -f "$project_dir/pyproject.toml" && -f "$project_dir/uv.lock" ]] \
&& grep -qiE "[\"']apm[-_.]cli[^a-z0-9_.-]" "$project_dir/pyproject.toml" 2> /dev/null \
&& command -v uv > /dev/null 2>&1; then
uv_env="${UV_PROJECT_ENVIRONMENT:-$project_dir/.venv}"
[[ "$uv_env" == /* ]] || uv_env="$project_dir/$uv_env"
if [[ ! -d "$uv_env" ]]; then
emit false "This project pins apm with uv but its environment has not been synced, so the apm install was not checked for staleness. Run: uv sync --frozen"
exit 0
fi
apm_cmd=(uv run --project "$project_dir" --frozen --no-sync --offline apm)
apm_label="uv"
elif command -v apm > /dev/null 2>&1; then
apm_cmd=(apm)
apm_label="path"
else
exit 0
fi
# Every apm call below must see the same directory the guard just checked —
# `apm outdated` and `apm update` both resolve the lockfile from the cwd.
cd "$project_dir" || exit 0
# apm older than 0.39.2 refuses a lockfile v4 and would then report it as up to
# date, so its `outdated` verdict is worthless (ADR-0034). Below the minimum, or
# when the version cannot be read at all, say so in a fixed line and skip the
# check: a silent pass here is exactly the false "up to date" to avoid. Only the
# first dotted triple is taken, and only its digits are compared.
#
# Returns 0 when new enough, 1 when the version was read and is too old, and 2
# when it could not be read (the call failed or timed out, or printed no
# version), so the notice can say which.
version_ok() {
local version_output version
version_output="$("$to" 15 "${apm_cmd[@]}" --version 2> /dev/null)" || return 2
version="$(grep -oE '[0-9]+\.[0-9]+\.[0-9]+' <<< "$version_output" | head -n 1)"
[[ "$version" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]] || return 2
local -a have=("${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}" "${BASH_REMATCH[3]}") need=(0 39 2)
local i
for i in 0 1 2; do
((10#${have[i]} > need[i])) && return 0
((10#${have[i]} < need[i])) && return 1
done
return 0
}
version_ok
version_status=$?
if [[ $version_status -ne 0 ]]; then
if [[ "$apm_label" == "uv" && $version_status -eq 1 ]]; then
emit false "\`uv run apm\` is older than apm 0.39.2, so the apm install was not checked for staleness (older apm refuses lockfile v4 and would report it as up to date). The project environment is probably not synced to its pin. Run: uv sync --frozen"
elif [[ "$apm_label" == "uv" ]]; then
emit false "Could not read the version of \`uv run apm\` (it failed or timed out), so the apm install was not checked for staleness. Check that this works: uv run apm --version, or run: uv sync --frozen"
elif [[ $version_status -eq 1 ]]; then
emit false "\`apm\` on PATH is older than apm 0.39.2, so the apm install was not checked for staleness (older apm refuses lockfile v4 and would report it as up to date). Upgrade the apm on PATH to 0.39.2 or later, or pin apm-cli in this project with uv."
else
emit false "Could not read the version of \`apm\` on PATH (it failed or timed out), so the apm install was not checked for staleness. Check that this works: apm --version"
fi
exit 0
fi
# `apm outdated` exits 0 whether or not anything is stale, so the answer has to
# come from its output. Measured ~0.7s against six remote refs on apm 0.28.0
# from PATH, and ~3.6s through `uv run` on 0.39.3; a hung remote must not hold
# the session open.
#
# There is no --json/machine-readable flag on `apm outdated` (verified against
# apm 0.28.0 and 0.39.3), so the phrase match is forced rather than chosen. Note the
# singular: apm prints "1 outdated dependency found" when exactly one package is
# behind, so matching only "dependencies" would silently miss a one-package
# drift. tests/test-apm-current-hook.sh pins both spellings against the real apm.
outdated_output="$("$to" 60 "${apm_cmd[@]}" outdated 2>&1)" || exit 0
grep -qE 'outdated dependenc(y|ies) found' <<< "$outdated_output" || exit 0
stale_count="$(grep -oE '[0-9]+ outdated dependenc(y|ies) found' <<< "$outdated_output" | grep -oE '^[0-9]+' || true)"
[[ "$stale_count" =~ ^[0-9]+$ ]] || stale_count="some"
# What to do with the rewritten lock depends on the branch (ADR-0019): on the
# default branch it is a real update to commit or discard; on a feature branch it
# is churn unrelated to the branch and should be discarded. The branch name only
@@ -73,14 +173,21 @@ if [[ -n "$current_branch" && -n "$default_branch" ]]; then
if [[ "$current_branch" == "$default_branch" ]]; then
lock_advice="this is the default branch, so commit it or discard it deliberately."
else
lock_advice="this is a feature branch, so discard it: git checkout -- apm.lock.yaml && apm install"
if [[ "$apm_label" == "uv" ]]; then
lock_advice="this is a feature branch, so discard it: git checkout -- apm.lock.yaml && uv run apm install"
else
lock_advice="this is a feature branch, so discard it: git checkout -- apm.lock.yaml && apm install"
fi
fi
fi
if timeout 300 apm update --yes > /dev/null 2>&1; then
manual_update="apm update --yes"
[[ "$apm_label" == "uv" ]] && manual_update="uv run apm update --yes"
if "$to" 300 "${apm_cmd[@]}" update --yes > /dev/null 2>&1; then
emit true "apm install was ${stale_count} package(s) behind the remote default branch and has been refreshed automatically; skills and agents were redeployed and re-scanned. apm.lock.yaml has been rewritten and is now a modified file in the working tree - ${lock_advice}"
else
emit false "apm install is ${stale_count} package(s) behind the remote default branch and the automatic refresh failed. Deployed skills and agents may be stale. Run: apm update --yes"
emit false "apm install is ${stale_count} package(s) behind the remote default branch and the automatic refresh failed. Deployed skills and agents may be stale. Run: ${manual_update}"
fi
exit 0
+1 -1
View File
@@ -5,7 +5,7 @@
"hooks": [
{
"command": "${CLAUDE_PLUGIN_ROOT}/.apm/hooks/check-apm-current.sh",
"timeout": 380,
"timeout": 400,
"type": "command"
}
],
@@ -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):
+1 -1
View File
@@ -19,7 +19,7 @@ Then:
apm install
```
The entry above is unpinned and tracks the remote's default branch — add `ref: <tag>` to pin a release. Registering the catalogue instead (`apm marketplace add https://git.rkdr.net/Mortis/Holocron.git --name holocron`) gets you the `kyberforge@holocron` short name, but writes to `~/.apm/marketplaces.json` at user scope; the git+path object needs nothing beyond the manifest.
The entry above is unpinned and tracks the remote's default branch. To pin a release, add `ref: kyberforge-v<x.y.z>` after `path:`; see [Pinning a plugin to a release](../../README.md#pinning-a-plugin-to-a-release). Registering the catalogue instead (`apm marketplace add https://git.rkdr.net/Mortis/Holocron.git --name holocron`) gets you the `kyberforge@holocron` short name, but writes to `~/.apm/marketplaces.json` at user scope; the git+path object needs nothing beyond the manifest.
**Native plugin installs do not work.** This package ships no per-plugin manifest and no flat content directories, so a host that installs it natively gets zero skills, agents and hooks — and Claude Code raises no error while doing it (ADR-0024).
+1 -1
View File
@@ -1,5 +1,5 @@
name: kyberforge
version: 2.2.1
version: 2.3.0
description: Skills and agents for creating, maintaining, and managing an apm plugin marketplace for Claude Code and GitHub Copilot.
author:
name: Mortis
+38 -5
View File
@@ -87,6 +87,39 @@ and if anything is behind, runs `apm update --yes` and returns `reloadSkills: tr
session picks up the redeployed content. Rationale, measurements, and the failure modes are in
ADR-0019.
**Which apm it runs.** The hook picks one apm and uses it for every call (ADR-0034):
1. `uv run --project <root> --frozen --no-sync --offline apm`, when the project pins apm and `uv` is
on `PATH`. A pin is a `pyproject.toml` carrying a quoted `apm-cli` requirement plus a `uv.lock`
beside it. It is matched as text so the hook needs no Python.
2. Otherwise the `apm` on `PATH`.
3. Otherwise nothing: it exits 0 silently.
uv is only ever called as `uv run`, with `--no-sync`, so the hook never installs into the environment
and never reaches the network through uv. Even `--no-sync` creates an empty `.venv` when none exists,
so before taking the uv path the hook checks that the project environment exists. That is
`$UV_PROJECT_ENVIRONMENT` when set, else `<root>/.venv`. If it is missing, the hook prints a fixed
"not synced, run `uv sync --frozen`" notice and never calls uv. An environment that exists but was
never synced has no apm of its own. `uv run` then falls through to the `PATH` apm, and the version
check below catches an old one.
**It needs `timeout` or `gtimeout`.** Every apm call is bounded. Stock macOS ships no `timeout`, and
Homebrew coreutils installs it as `gtimeout`, so the hook uses whichever exists. With neither, it
exits 0 silently on every path, before choosing an apm, rather than run an unbounded call.
**apm older than 0.39.2 is not trusted.** Before the outdated check the hook reads `--version`. If the
chosen apm is older than 0.39.2, or its version cannot be read, the hook prints a fixed notice that
names the chosen binary and skips the check. The reason is that an older apm refuses a lockfile v4 and
would then report the install as up to date. "Too old" and "could not read the version" are separate
notices. On the uv path, too old says to run `uv sync --frozen`, and unreadable (the call failed or
timed out) says to check `uv run apm --version` or to run `uv sync --frozen`. On the `PATH` path, too old says to upgrade or pin
apm, and unreadable says to check `apm --version`.
**Advice text is fixed.** Every notice is a literal string, and the only variable part is a
digit-checked package count. The commands it names follow the chosen binary: `uv run apm install` or
`apm install`, and `uv run apm update --yes` or `apm update --yes`. No command output is ever
interpolated.
**Where it looks for the lockfile.** The hook resolves a project directory as `${CLAUDE_PROJECT_DIR}`
when the host exports it (Claude Code does, for SessionStart hooks) and the current directory
otherwise, then exits silently unless that directory holds an `apm.lock.yaml` — which is what makes
@@ -97,14 +130,14 @@ Keep the cwd fallback: a host that sets no `CLAUDE_PROJECT_DIR` must still get i
behaviour, not an unset-variable error.
**The `timeout` in `hooks.json` must exceed the script's own budget.** The script spends at most
`timeout 60 apm outdated` plus `timeout 300 apm update`; the hook entry declares `timeout: 380`, the
sum plus a buffer. Set it lower and a slow remote gets the hook SIGKILLed mid-`apm update`, leaving a
partially redeployed `.claude/skills/` and emitting no notice — precisely the silent failure the hook
exists to prevent. `tests/test-apm-current-hook.sh` pins the relationship (host timeout > sum of the
15s on `apm --version`, 60s on `apm outdated` and 300s on `apm update`, 375s in all. The hook entry
declares `timeout: 400`, the sum plus a buffer. Set it lower and a slow remote gets the hook
SIGKILLed mid-`apm update`, leaving a partially redeployed `.claude/skills/` and emitting no notice —
precisely the silent failure the hook exists to prevent. `tests/test-apm-current-hook.sh` pins the relationship (host timeout > sum of the
script's internal timeouts) rather than the literal, so raising either side alone fails the suite.
**Staleness is detected by matching apm's summary line, and both spellings count.** `apm outdated`
has no `--json` or otherwise machine-readable output (verified against apm 0.28.0), so the hook
has no `--json` or otherwise machine-readable output (verified against apm 0.28.0 and 0.39.3), so the hook
greps its text. apm prints `1 outdated dependency found` in the singular when exactly one package is
behind and `N outdated dependencies found` otherwise; matching only the plural silently misses a
one-package drift. Because a mocked `apm` would keep a reworded release invisible, the test suite
@@ -0,0 +1,86 @@
---
topic: approvals-and-executables
source_keys:
- apm-v0-39-3-source
- apm-v0-39-3-changelog
- apm-v0-39-3-docs
---
How apm 0.39.3 decides whether a package's executables may be deployed. Executables means hooks, MCP servers, `bin`, LSP servers, canvas extensions and native plugins. This also covers what `apm approve` writes and which `apm audit --ci` checks enforce it. Read from the v0.39.3 source, CHANGELOG and docs, and not run. Claims are marked **source** or **doc**.
## The gate and its opt-in
- **Source:** the executables gate is on when the project `apm.yml` has an `executables:` block (even `{}`) or the deprecated `allowExecutables:` block. **Doc:** a non-empty `executables:` block in org policy also turns it on.
- **Doc:** without an opt-in, executables deploy unconditionally. The first project approval prompts that it turns the gate on. A `--user` approval never turns it on.
- **Source:** `allowExecutables:` is still read as an alias of `executables.allow`, warned once per run, and migrated on the next approve or deny write.
## Store shape
`apm approve` writes the project `apm.yml` under `executables: {allow, deny}` by default. `--user` writes `$APM_HOME/config.json` instead.
```yaml
executables:
allow:
acme/agent-kit:
hooks: { .apm/hooks/lint-on-save.json: sha256:<64 hex> }
mcp: { kit-docs: sha256:<64 hex> }
acme/tools: { bin: true }
deny:
evil/pkg: { hooks: true, mcp: true, bin: true, canvas: true, lsp: true }
```
- **Source:** each package key is a version-blind identity, such as `owner/repo`, `./pkgs/x` or `local:pkgs/leaf`.
- **Source:** values by type:
- `hooks` and `mcp` are maps of `item: sha256:<64 hex>`. The item is the package-relative hook file path, or the MCP server name.
- `bin`, `lsp` and `canvas` are `true`.
- A native plugin gets a single `plugin: sha256:<hex>`.
- **Source:** deny entries stay booleans.
- **Source:** malformed pins are rejected. A pinned item set to `true`, or a short digest, fails with `expected 'sha256:<64 hex>'`.
## Grants are version-blind
- **Source:** an ordinary grant key has its `#version` suffix stripped before matching. So `owner/repo#1.2.0` matches any installed version of `owner/repo`, and `apm approve` folds such keys into the bare identity. This was already true in 0.28.0.
- **Source:** the one exception is content-bound local-bundle keys of the form `name#version@sha256:<digest>`, which match only exactly.
## Type-level versus content-pinned grants
- **Source/doc:** type-level `hooks: true` and `mcp: true` still deploy any content. Each install warns once: `N executable approval(s) not pinned to content: <pkg> (<type>) ... Upstream changes deploy without review.`
- **Source/doc:** `mcp: true` never admits a transitive MCP server.
- **Source/doc:** re-running `apm approve <pkg>` converts a type-level grant to pins.
- **Source:** a pinned item whose bytes change is parked as `definition-changed` and not deployed. A project pin decides alone; a user pin applies only when the project has none for that item.
- **Source (0.38.0, #4688):** a hook pin covers everything the hook deploys:
- the hook JSON;
- every script it references;
- every file the hook-bundle copier deploys from those script roots, such as helpers and nested `package.json`;
- the Node module type.
It does not cover code the hook downloads at run time. Pins written before 0.38 show as changed once, so re-run `apm approve <pkg>`.
- **Source:** pinned approvals need apm 0.37 or later on every machine. The first pinned approval prints `Teammates need APM 0.37 or later to read pinned approvals.`, and older clients reject the item form and fail closed.
- **Doc (0.39.3):** re-run `apm approve <package>` after reinstalling a package.
## Transitive MCP servers
- **Source:** `--trust-transitive-mcp` still exists in 0.39.3 as a per-run install flag that is never saved. **Doc:** it never overrides a deny or a mismatched pin.
- **Doc (0.37.0, #3918):** the durable replacement is `apm approve <pkg>`, with `apm.yml` committed.
- **Doc (0.39.0):** a server trusted in 0.38 only via the flag is parked and removed on the first plain 0.39 install. Approve it to keep it.
## Audit checks that enforce approvals (doc)
| Check | Fails when |
|---|---|
| `config-consistency` | The lock admits an MCP server that `apm.yml` does not approve: `admitted in apm.lock.yaml but not approved in apm.yml (<reason>); run 'apm approve <pkg>' and re-run 'apm install'`. Admission is re-evaluated from `apm.yml` and org policy only, never from the lock or the user store. |
| `hook-approval-pins` | A recorded deployed hook file no longer matches its pin; or an unrecorded file sits at a withheld package's hook path; or a merged-config entry matches such a package's hook with no ownership record. |
| `exec-status-current` | A recorded `exec_status` differs from the current gate decision. Claude `settings.json` hooks are included. Not evaluated under `--no-policy`. |
| `local-bundle-hooks` | A local-bundle hook entry was edited or is unrecorded. Needs the `.claude/apm-hooks.json` record. |
`apm install --frozen` fails on the same pin mismatches.
## `apm approve` and `apm deny`
- **Doc:** flags are `--pending`, `--all`, `--recommended`, `--list`, `--user`/`-g`.
- **Doc:** it exits 1 when:
- a requested package is not installed or is refused;
- the first-approval prompt is declined;
- a blocking org policy applies;
- installed files differ from `apm.lock.yaml`.
- **Source:** `apm deny [PACKAGES] --user/-g` writes deny entries.
@@ -2,35 +2,151 @@
topic: cli-reference
source_keys:
- context7-microsoft-apm
- apm-v0-39-3-source
- apm-v0-39-3-docs
---
The command surface as of apm 0.39.3, read from source (`cli.py` and `commands/`) and the reference docs. Version-specific changes are summarized in `migration-0-28-to-0-39.md`.
## Command list (0.39.3, source)
`approve`, `audit`, `auth`, `cache`, `compile`, `config`, `deny`, `deps`, `doctor`, `experimental`, `export-patch`, `find`, `init`, `install`, `lifecycle`, `list`, `lock`, `marketplace`, `mcp`, `outdated`, `pack`, `plugin`, `policy`, `preview`, `prune`, `publish`, `run`, `runtime`, `search`, `self-update`, `targets`, `uninstall`, `unpack`, `update`, `view`.
There are also two hidden entries: `discover` (use the documented `apm init --discover` form) and `info`, an alias of `view`.
## Install
```bash
apm install [PACKAGE_REF...] [OPTIONS]
```
With no arguments, resolves and installs everything declared in `apm.yml` against `apm.lock.yaml`. Explicit `PACKAGE_REF` arguments (e.g. `acme/internal-tools#^1.0.0`) install and add that dependency. `apm install --update` re-resolves and accepts new upstream content even when it doesn't match the recorded lockfile hash (see troubleshooting). `apm install --target agent-skills` generates a vendor-neutral output directory for IDE-agnostic tool support instead of a harness-specific one.
- With no arguments, apm installs everything declared in `apm.yml` against `apm.lock.yaml`.
- Naming a `PACKAGE_REF` installs that package and adds it as a dependency.
- `--update` re-resolves the dependencies and accepts new upstream content.
- `--target agent-skills` produces a vendor-neutral output directory.
Frozen-install behaviour is in `lockfile-and-compatibility.md`.
Options (doc):
| Group | Options |
|---|---|
| Resolution and lockfile | `--update`, `--frozen/--no-frozen`, `--refresh`, `--accept-ref-change` |
| Run control | `--dry-run`, `--force`, `-v`, `--dev` |
| Scope and targets | `--root DIR`, `-t/--target`, `--runtime`, `--exclude`, `--only apm\|mcp`, `-g/--global`, `--legacy-skill-paths` |
| Policy and security | `--policy SOURCE`, `--no-policy`, `--audit off\|warn\|block`, `--no-audit` |
| Trust | `--trust-transitive-mcp`, `--trust-bin/--no-trust-bin` |
| Network and transport | `--allow-insecure`, `--allow-insecure-host`, `--parallel-downloads N`, `--ssh`, `--https`, `--allow-protocol-fallback`, `--auth-first` |
| Skill selection | `--skill`, `--as` |
| MCP | `--mcp`, `--transport`, `--url`, `--env`, `--header`, `--mcp-version`, `--registry` |
Exit codes (doc):
| Code | Meaning |
|---|---|
| 0 | Success or preview |
| 1 | Install failure. This includes frozen violations, and any reported error even with `--force`. |
| 2 | Usage error: no target detectable, `--ssh` with `--https`, `--frozen` with `--update`, or `--root` with `--global`. |
## Update and outdated
```bash
apm update [PACKAGES] [--yes] [--dry-run] [--verbose] [--global] [--force] [--target ...]
apm outdated [-g] [-v] [-j N]
```
**`apm update`** (source):
- `--check` is deprecated (doc). Use `--dry-run`, or `self-update --check` instead.
- Run outside an `apm.yml` project, bare `apm update` forwards to `self-update` with a warning (doc).
- `apm deps update` is deprecated in favour of `apm update`.
**`apm outdated`** (source):
- Options are `--global`, `--verbose` and `--parallel-checks/-j N` (default 4; 0 means sequential).
- There is no `--json` and no package filter.
- **Output:** a "Dependency Status" table with columns Package, Current, Wanted (only when registry rows exist), Latest, Status and Source.
- The summary line is `<N> outdated dependency found` or `<N> outdated dependencies found`, or `Some dependencies could not be checked`.
- Statuses in code are `up-to-date`, `outdated`, `unknown`, `origin-conflict`, `access-denied` and `not-comparable`.
- With `-v`, the table adds the newer tags.
- **Exit codes:** 1 on `origin-conflict` or `access-denied` (source); the docs also give 1 for no lockfile in scope. Outdated or unknown rows still exit 0.
- Local and Artifactory dependencies are skipped, and the command is read-only.
## Audit
```bash
apm audit # scan deployed files for hidden Unicode
apm audit --ci # CI gate: lockfile consistency, approvals, drift replay, policy
apm audit --file <path> # scan an arbitrary file
apm audit --ci -f json -o r.json
```
- **Options:** `--file`, `--strip`, `--dry-run`, `--no-drift`, `-v`, `--ci`, `--policy`, `--no-policy`, `--no-cache`, `--no-fail-fast`, `-f/--format text|json|sarif|markdown`, `-o/--output PATH`.
- When `-o` is given without `-f`, the format is inferred from the file extension.
- `markdown` is not allowed with `--ci`.
- **Exit codes in content-scan mode** (source docstring): 0 clean, 1 critical, 2 warnings only. The docs add 3 for configuration or infrastructure errors.
- **Exit codes in `--ci` mode:** 0 when every check passes, 1 when any fails.
- **Text output in `--ci` mode** (source):
- On success: `All <M> check(s) passed`.
- On failure: `<N> of <M> check(s) failed`, with each failure as `<check>: <message>` followed by detail lines.
- M varies with which checks apply; the list is in `migration-0-28-to-0-39.md`.
- **Lockfile message** (source): when `apm.yml` declares dependencies but there is no lock, the detail reads `apm.yml declares dependencies but apm.lock.yaml is absent`.
- Fail-fast is the default.
See `testing-and-validation.md` for CI wiring.
## Approve, deny and export-patch
```bash
apm approve [PACKAGES] [--pending|--all|--recommended|--list] [--user|-g]
apm deny [PACKAGES] [--user|-g]
apm export-patch [--out DIR] [--dry-run] [-v]
```
- Approvals are covered in `approvals-and-executables.md`.
- **`export-patch` (doc):**
- It writes one `patches/<pkg>@<ref>.patch` per package, ready for `git apply`, covering only files that were deployed verbatim.
- It needs a lockfile and a populated `apm_modules/`, and it runs cache-only.
- It exits 0 on success, including when there is nothing to export. It exits 1 on a missing manifest or lock, a cold cache, or an invalid `--out`.
## Compile
```bash
apm compile
apm compile [-t TARGET|--all] [--root DIR] [-o PATH] [--clean] [--validate] [--dry-run] [--watch] [-g]
```
Generates per-target output (Claude, Copilot, etc.) from the vendor-neutral `.apm/` primitive source tree, per the `compilation:` block in `apm.yml`.
- `apm compile` generates root context files (`AGENTS.md`, `CLAUDE.md`, `GEMINI.md`) from instructions.
- Other options: `--single-agents`, `--chatmode`, `--no-links`, `--with-constitution/--no-constitution`, `--local-only`, `--force-instructions` (alias `--no-dedup`) and `--legacy-skill-paths`.
- It exits 1 when org policy blocks a recorded package.
- A hand-authored root `CLAUDE.md` or `AGENTS.md` is never overwritten (source). For the 0.38/0.39 Claude layout, see `instructions-target-mapping.md`.
## Pack
```bash
apm pack --dry-run # resolve and print; do not write
apm pack --offline # cached refs only
apm pack --include-prerelease # allow pre-release tags
apm pack -v # per-entry resolution detail
apm pack --marketplace=claude --json # JSON output for CI pipelines
apm pack --dry-run # resolve and print; do not write
apm pack --check-versions --check-clean --dry-run
apm pack --format plugin # Claude Code plugin bundle (alias)
apm pack --marketplace=claude --json
```
Bundles a producer package into a distributable artifact.
- **Options (source):**
- `--claude-plugin`
- `--format plugin|agent-plugin|claude|claude-plugin|apm`. With no flag the default is `claude-plugin`. `plugin` is an alias for the Claude Code plugin bundle.
- `--target/-t`, which is deprecated and informational only.
- `--archive` (default `.zip`) with `--archive-format zip|tar.gz`.
- `-o`, `--dry-run`, `--force`, `-v`, `--offline`, `--include-prerelease`.
- `--check-versions`, `--check-clean`, `--strict-metadata`.
- `-m/--marketplace`, `--marketplace-path FORMAT=PATH`, `--json`, `--legacy-skill-paths`.
- **Exit codes (source):**
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Build or runtime error |
| 2 | Usage error |
| 3 | `--check-versions` misalignment |
| 4 | `--check-clean` drift |
| 5 | `--strict-metadata` failure |
- `--check-clean` is read-only.
## Publish
@@ -39,17 +155,17 @@ apm publish --package acme/my-skill --dry-run -v
apm publish --package acme/my-skill
```
Publishes a producer package (root containing `apm.yml`, `.apm/`, and optionally a `registries:` block) to a registry. Always dry-run with `-v` first to see resolution detail before publishing for real.
`apm publish` sends a producer package to a registry. Always dry-run with `-v` first.
## Runtime management
```bash
apm runtime setup copilot # install with APM defaults
apm runtime setup codex --version 0.20.0 # pinned version
apm runtime setup llm --vanilla # skip APM-managed config
apm runtime list # what's installed
apm runtime status # which runtime `apm run` will pick
apm runtime remove gemini -y # uninstall without prompting
apm runtime setup copilot
apm runtime setup codex --version 0.20.0
apm runtime setup llm --vanilla
apm runtime list
apm runtime status
apm runtime remove gemini -y
```
## Run
@@ -58,42 +174,28 @@ apm runtime remove gemini -y # uninstall without prompting
apm run <script> [--param key=value]
```
Executes a named script defined under `scripts:` in `apm.yml`, with `--param` substituting values into the script's parameters (used, for example, when the script wraps a Gemini CLI invocation).
`apm run` executes a named script from `scripts:` in `apm.yml`. It is experimental.
## Audit (validation)
```bash
apm audit # local: scan deployed files for hidden Unicode
apm audit --ci # CI gate: lockfile consistency + drift replay + policy
apm audit --file <path> # standalone: scan an arbitrary file
```
See `testing-and-validation.md` for CI wiring and exit-code behavior.
## Marketplace
```bash
apm marketplace init # add the marketplace: block to apm.yml
apm marketplace check # validate every listed package ref resolves
apm marketplace package add <path> --name <n> # register a local package into the marketplace
apm marketplace add <source> [--name <n>] # register a marketplace as a consumer (see marketplace-and-registries.md for source forms)
```
## Plugin scaffolding
## Marketplace and plugin scaffolding
```bash
apm marketplace init
apm marketplace check
apm marketplace package add <path> --name <n>
apm marketplace add <source> [--name <n>]
apm plugin init <name> --yes
```
Scaffolds a new package's `apm.yml` + `.apm/` skeleton in the current directory.
- Marketplace subcommands (source): `add`, `list`, `browse`, `update`, `remove`, `validate`, `init`, `migrate`, `check`, `audit`, `outdated`, and `package add|set|remove`.
- `plugin` has only `init`.
- `apm init --plugin` and `apm init --marketplace` were removed in 0.37 and exit 2.
## Config
```bash
apm config set <key> <value>
apm config get <key>
apm config list
apm config unset <key>
apm experimental enable registries # required before registry.* config takes effect
apm experimental enable registries
```
Used for workstation-level settings such as private registry URLs/tokens (see `marketplace-and-registries.md`).
@@ -3,6 +3,9 @@ topic: hooks-primitive-schema
source_keys:
- context7-microsoft-apm
- apm-github-repo
- apm-v0-39-3-source
- apm-v0-39-3-changelog
- apm-v0-39-3-docs
---
## File location, naming, and format — confirmed `.json`, not assumed
@@ -57,3 +60,25 @@ Differences from the Claude/source shape: flat arrays (no nested matcher-group w
- **Dropping a target from `apm.yml`'s `targets:` list does not auto-clean its merged hook entries** unless `apm install`/reconcile logic explicitly walks the complement set (`reconcile_dropped_targets`) — a real, documented gap the code works around rather than a design guarantee; relying on "just remove the target and hooks disappear" is not safe without a fresh `apm install`.
- **Event-casing mismatches are warnings, not errors** — a hook authored with the wrong casing for a target and no applicable rename mapping will silently not fire at runtime; APM only logs a warning at install time, it does not block the install or refuse to deploy the file.
- **No dedicated `Hook`/`HookPrimitive` validation dataclass** exists comparable to `Instruction.validate()` — validation is distributed across `_validate_copilot_payload` (Copilot-shape-specific) and general JSON-parseability checks, not a single primitive-level contract. This mirrors the same "no independent validation model" gap already documented for the agent primitive.
## Changes through 0.39.3 (source, CHANGELOG and docs; not run)
The sections above were written against 0.28.0. The merge into `.claude/settings.json` is still the mechanism in 0.39.3. The following changed:
- **Filename routing is gone (0.36.0, #3613).** Filenames such as `*-<target>-hooks.json` and `hooks-<target>.json` no longer send a hook to one target only, so every hook file reaches every targeted harness.
- To limit a hook to Claude, ship it in a package whose `apm.yml` sets `targets: [claude]`, or narrow the dependency with object-form `targets:`.
- If dropping the routing would hand a target a file the old name kept from it, install fails for that package and names the file.
- **Event names.** `SessionStart` and `sessionStart` both map to `SessionStart` for Claude. Copilot events that have a Claude equivalent are written to `.claude/settings.json` under the Claude name. For Copilot, `SessionStart` becomes `sessionStart`.
- **Where ownership is recorded.** apm marks its entries with `_apm_source` while it works. On write, it moves those markers into a sidecar, `.claude/apm-hooks.json`, so `settings.json` itself carries no apm markers. On reinstall the markers are read back from the sidecar.
- **Edited entries are kept (0.38.1, 0.39.0).**
- When a user edits a deployed entry, apm keeps the edited copy and writes the deployed entry beside it, with a warning. A byte-identical user copy does not count as an edit.
- Install exits 1 when an edited hook file or script blocks new content.
- Uninstall refuses when a package's entry was edited or its sidecar record is missing.
- **Ordering.** Entries merge in full-install order. Do not rely on order across packages. Your own entries never move.
- **Approval.** When the executables gate is on, a hook deploys only under a grant: type-level `hooks: true`, or a per-file content pin. A pin covers the hook JSON and every file deployed with it. See `approvals-and-executables.md`.
- **Command safety (0.39.0, #5600).** Only hook commands that stay inside the package and use no shell expansion are deployed. Shell expansion means `$(...)`, backticks, `eval`, here-docs and subshells.
- **Settings-file lifecycle.**
- A `.claude/settings.json` that apm created is deleted once its last entry leaves.
- An emptied one that apm has no creation record for is kept, with a warning.
- A hook config that is not valid JSON is never rewritten. A merge into it exits 1; a cleanup-only run warns and exits 0.
- **Audit.** These checks cover merged Claude hook entries: `hook-approval-pins`, `exec-status-current`, `local-bundle-hooks`, `content-integrity` and `drift`. `drift` compares only apm-owned entries. `apm install --frozen` also fails when an apm-managed merged entry was edited.
@@ -2,32 +2,85 @@
topic: installation
source_keys:
- context7-microsoft-apm
- apm-v0-39-3-docs
- apm-v0-39-3-source
- pypi-apm-cli
- apm-cli-0-39-3-uv-experiments
---
## Quick install (recommended)
## Install methods (0.39.3 docs)
A one-line install script auto-detects the platform, downloads the latest binary, and configures the system `PATH`:
- Quick install script. It auto-detects the platform, downloads the release binary and configures `PATH`:
```bash
curl -sSL https://aka.ms/apm-unix | sh
```bash
curl -sSL https://aka.ms/apm-unix | sh
```
On Windows use `irm https://aka.ms/apm-windows | iex`.
- Homebrew: `brew install apm`, from the core formula. The old `microsoft/apm` tap is migrated.
- WinGet: `winget install --id Microsoft.APM --exact --source winget`.
- Scoop: `scoop install apm`.
- pip: `python3 -m pip install apm-cli`. Since 0.36.0 this needs Python 3.11 or later, and the same floor applies to any Python-based install.
- Manual binary: download the release archive and put the binary on `PATH`. Prebuilt binaries cover macOS, Linux and Windows on x86_64 and ARM64.
The installation doc mentions neither pipx nor uv. If no prebuilt binary fits, the installer script falls back to `pip install --user apm-cli`.
`apm self-update` upgrades a script install. The installer refuses to overwrite a copy owned by Homebrew or pip.
The docs give glibc 2.28 as the Linux minimum for the binary, but the 0.32.0 installer notes say 2.38. This conflict is unresolved; use pip if in doubt.
## Package facts (PyPI and source)
- The package is `apm-cli`, and its console entry point is `apm = apm_cli.entrypoint:main`. It needs Python 3.11 or later.
- 0.39.3 was released 2026-12-01 as a wheel and an sdist, and 0.39.2 on 2026-11-30. Neither is yanked.
- Runtime dependencies:
- click, colorama, pyyaml, requests, truststore
- python-frontmatter, llm, llm-github-models
- toml, tomlkit, rich, rich-click
- watchdog, GitPython, ruamel.yaml, filelock
- websockets (below 17)
A full resolve came to about 63 packages.
## Pinning a version
- Script: `curl -sSL https://aka.ms/apm-unix | sh -s -- @v1.2.3`, or set `VERSION=v1.2.3`. On Windows, set `$env:VERSION` before the `irm` line.
- pip: `pip install apm-cli==0.39.3`.
- GitHub Action: `microsoft/apm-action@v1` with `setup-only: 'true'` and `apm-version: '<version>'`.
- The docs give no pinning method for Homebrew, WinGet or Scoop.
- Upstream advice: pin a **minimum** apm in CI rather than an exact one. Choose a release that reads your lockfile format, which means 0.39.2 or later for v4 locks rewritten by 0.39.2. apm has no manifest field that enforces a minimum. See `lockfile-and-compatibility.md`.
## Per-project pin with uv (tested, not upstream-documented)
apm's docs do not cover this. It was tested with uv 0.11.24 in a throwaway project outside any repo.
```toml
[project]
name = "<project>"
version = "0.0.0"
requires-python = ">=3.11"
dependencies = []
[tool.uv]
package = false
[dependency-groups]
dev = ["apm-cli==0.39.3"]
```
On Windows, the installer adds both the current directory and the bin directory to `PATH`, so it works from native shells, Git Bash, and process APIs alike.
## Customizing the install
- **Pin a specific version**: append `@vX.Y.Z` to the piped script arguments, e.g. `curl -sSL https://aka.ms/apm-unix | sh -s -- @v1.2.3`.
- **Custom install directory**: set `APM_INSTALL_DIR` on the piped script's command, e.g. `curl -sSL https://aka.ms/apm-unix | APM_INSTALL_DIR=$HOME/.local/bin sh`.
- **Air-gapped / GitHub Enterprise mirror**: set `GITHUB_URL` and `VERSION` env vars against a local `install.sh`, e.g. `GITHUB_URL=https://github.corp.com VERSION=v1.2.3 sh install.sh`.
## Alternative install methods
- **pip**: `pip install apm-cli` — requires Python 3.10 or higher.
- **Manual binary**: download the platform-specific archive from the GitHub releases page, extract it, move the binary to a permanent directory, and add that directory to `PATH`.
- With no `[build-system]`, uv installs only the dependencies and never builds the project. `package = false` keeps it that way even if a build system is added later. `uv sync` installs the `dev` group by default.
- `uv run apm --version` reported 0.39.3. The committed `uv.lock` hashes apm-cli and every transitive dependency.
- **Offline behaviour:**
- `uv run --frozen --offline apm ...` worked once the uv cache was warm, even with no `.venv`.
- It failed with an empty cache, because wheels cannot be downloaded offline.
- So the first sync on a machine needs the network.
- **Rejected alternatives:**
- `uvx apm-cli@<v>` pins only apm-cli: transitive dependencies float and nothing is locked. A cache warmed by `uv add` also did not satisfy `uvx --offline`.
- `uv tool install` is machine-global, the same drift problem as pipx.
## Installing agent runtimes
APM itself doesn't execute agents, but it can install and manage the runtimes that do, via `apm runtime setup <name>`:
apm does not run agents itself, but it can install and manage the runtimes that do:
```bash
apm runtime setup copilot # recommended default
@@ -36,4 +89,4 @@ apm runtime setup gemini
apm runtime setup llm
```
Installing GitHub Copilot CLI through APM pulls it from the public npm registry and requires Node.js v22+ and npm v10+; no authentication is needed for the install step itself. Use `apm runtime list` to see which runtimes are currently installed and which one `apm run` will pick by default.
Installing the GitHub Copilot CLI through apm pulls it from the public npm registry. It needs Node.js 22 or later and npm 10 or later. `apm runtime list` shows which runtimes are installed and which one `apm run` picks.
@@ -6,6 +6,7 @@ source_keys:
- claude-code-memory-docs
- cursor-rules-docs
- github-copilot-custom-instructions-docs
- apm-v0-39-3-changelog
---
Surprising behaviours and source contradictions for the instructions primitive. "Verified" means observed with the installed apm 0.28.0 in a throwaway directory outside the repo. Everything else is stated as sourced or inferred.
@@ -78,7 +79,7 @@ An earlier version of this topic's schema file described missing `description` a
- Runtime behaviour of Windsurf, Kiro and Antigravity on the emitted frontmatter; no downstream docs were fetched.
- Windsurf user-scope global rules.
- The Context7 step was unavailable (invalid API key), so the registry carries no fresh Context7 pull. Doc pages were summarised by a smaller model before reaching this file and can be lossy.
- Apm versions other than 0.28.0 were not tested.
- Apm versions other than 0.28.0 were not tested. 0.38.0 and 0.39.0 changed the Claude layout, moving `**`- and directory-scoped rules into `AGENTS.md` once compiled. The `.claude/rules/` items above may therefore not hold on 0.39.x. See `instructions-target-mapping.md`, "Claude layout in 0.38 and later", and `migration-0-28-to-0-39.md`.
## What belongs in an instruction body
@@ -6,10 +6,27 @@ source_keys:
- claude-code-memory-docs
- github-copilot-custom-instructions-docs
- cursor-rules-docs
- apm-v0-39-3-source
- apm-v0-39-3-changelog
- apm-v0-39-3-docs
---
What each target receives from an instruction file, at install time (native per-file deploy) and at compile time (folded into a root context file). Verified against apm 0.28.0 source and throwaway installs unless marked otherwise. Field syntax of the source file is in `instructions-primitive-schema.md`.
## Claude layout in 0.38 and later (source and CHANGELOG; not run)
The install table below is the 0.28.0 behaviour, where every Claude instruction went to `.claude/rules/`. Two later releases changed that.
- **0.38.0:** Claude instructions scoped to `**`, unscoped, scoped to `**/*`, or scoped to exactly one literal `dir/**` glob move into `AGENTS.md`, which `CLAUDE.md` imports. Run `apm install` and then `apm compile`. Any other glob stays a path-scoped rule in `.claude/rules/`, including file-type globs, wildcard directories and lists.
- **0.39.0 (#5394):** install-only projects keep the 0.37 `.claude/rules/` layout. A routed instruction is dropped from `.claude/rules/` only once a compiled `AGENTS.md` that Claude loads already carries its exact scope and body. Until then, install keeps the rule and asks for `apm compile`.
- **Blockers.** These keep every instruction in `.claude/rules/`, with a warning:
- a hand-authored root `CLAUDE.md` without an `@AGENTS.md` (or `@./AGENTS.md`) import;
- a hand-authored root `AGENTS.md` without `compilation.agents_md.mode: managed_section` and a single pair of `<!-- apm:start -->`/`<!-- apm:end -->` markers;
- a symlinked root `AGENTS.md`.
- **Hand-authored files are protected.** A root `AGENTS.md`, `CLAUDE.md` or `GEMINI.md` without the apm-generated marker near the top is never overwritten. `--clean` never deletes an unmarked `CLAUDE.md`, and a compile with no primitives writes nothing. The one opt-in exception is `managed_section` mode, which writes only between the markers. If the user's `CLAUDE.md` already imports `@AGENTS.md`, compile leaves it untouched.
- **Scope limits.** User scope (`-g`) and a home-rooted project never route to `AGENTS.md`.
- **Claude Code version.** The source notes that Claude Code 2.1.277 and later read `AGENTS.md` natively, but only while no `CLAUDE.md` exists or the `CLAUDE.md` imports `@AGENTS.md`.
## Two separate output paths
`apm install` writes native files, one per instruction, into each target's own rules directory. `apm compile` writes root context files (`CLAUDE.md`, `AGENTS.md`, `GEMINI.md`) that concatenate instruction bodies. The two overlap, which is why compile has a dedup rule (below). A skill author should treat install as the primary path for Claude Code and Copilot, and compile as the path for targets that have no native instructions directory.
@@ -80,4 +97,4 @@ Keys: `target`, `strategy` (`distributed` or `single-file`), `single_file`, `out
### Relevant compile flags
`--validate` (parse only; see schema file for why it is a weak check), `--dry-run`, `--clean` (removes orphaned generated files, never hand-authored ones), `--target`, `--all`, `--root`, `-g`, `--local-only`, `--single-agents`, `--no-links`, `--with-constitution`, `--force-instructions`. Documented exit codes: 0 success, 1 error, 2 conflicting flags. A compile with no instruction primitives at all exits 0 in 0.28.0.
`--validate` (parse only; see schema file for why it is a weak check), `--dry-run`, `--clean` (removes orphaned generated files, never hand-authored ones), `--target`, `--all`, `--root`, `-g`, `--local-only`, `--single-agents`, `--no-links`, `--with-constitution`, `--force-instructions`. Documented exit codes: 0 success, 1 error, 2 conflicting flags. A compile with no instruction primitives at all exits 0 in 0.28.0. In 0.39.3 it also exits 1 when org policy blocks a recorded package.
@@ -0,0 +1,97 @@
---
topic: lockfile-and-compatibility
source_keys:
- apm-v0-39-3-source
- apm-v0-39-3-changelog
- apm-v0-39-3-docs
---
Lockfile format, cross-version compatibility, frozen installs and ref resolution as of apm 0.39.3. Read from the v0.39.3 source, its CHANGELOG and its docs. Nothing here was run against a real project. Each claim is marked **source** (read in code) or **doc** (docs or CHANGELOG only).
## Lockfile versions
- **Source:** the supported versions are `"1"` to `"4"`. Anything else is refused before any file changes, with `Unsupported lockfile version '<v>'; supported versions: 1, 2, 3, 4` plus a `apm self-update` hint.
- **Doc:** the bump depends on content:
- `"4"` when any package records a `content_hash`;
- else `"3"` when a root `replacements` table exists;
- else `"2"` for registry or semver evidence;
- else `"1"`.
- **Doc:** v4 adds no fields. It only changes how `content_hash` is computed. Each file, in sorted path order, contributes its path, a NUL byte and the SHA-256 of its raw bytes; v1-v3 keep the older stream. **Source:** both digests exist and are selected per lock version.
- **Doc:** 0.37+ verifies a v1-v3 lock as written:
- A writable `apm install` promotes the lock to `"4"` once every package re-hashes from verified bytes.
- `apm install --frozen`, `apm audit` and other read-only commands never promote or rewrite it.
- **Doc:** a lockfile with invalid YAML, a non-mapping root or malformed rows fails closed.
- **Doc (0.39.0):** the lock is parsed with libyaml, so a hand-edited lockfile with nonstandard YAML may now be rejected. Regenerate it with `apm install`.
## Which apm reads which lock
| Lock | Refused by | Read by |
|---|---|---|
| v1-v3 written by 0.28.0 | nothing current | 0.37+ reads as written; a writable install promotes to v4 |
| v4 written by 0.37.0-0.39.1 | 0.36.1 and older | 0.37.0+ |
| v4 rewritten by 0.39.2+ | 0.36.1 and older, and 0.37.0-0.39.1 (they refuse any lock from a newer apm) | 0.39.2+ |
Practical rule: once a lock written by 0.39.2 or later is committed, every machine that runs install or audit on it needs 0.39.2 or later. Upgrade CI and update bots first.
## The 0.39.2 compatibility promise (doc, warning text confirmed in source)
From 0.39.2, the `lockfile_version` decides compatibility, not `apm_version`.
- A lock written by a newer apm in a format this apm reads runs normally. The only difference is one `[!]` line on stderr per process: `apm.lock.yaml was written by APM <x>, newer than this APM <y>. Its format (lockfile_version 4) is supported, so APM continues and keeps fields it does not know.`
- Unknown fields survive a rewrite, with exceptions:
- A dependency row's unknown fields are dropped when its commit, hash, version, `content_hash` or `source_digest` changed.
- A deployment row's unknown fields are dropped when its `content_hash` or owner changed.
- Top-level unknown fields are dropped when any dependency changed.
- `x-*` top-level keys are always kept.
- Refused with exit 1 before any change:
- an unsupported `lockfile_version`;
- an unknown deployment `kind`;
- an unknown value in a known enum field (`exec_status`, `host_type`);
- a duplicated `apm_version` or `lockfile_version` key.
- No-op runs leave the lockfile byte-identical, and apm never switches its own version.
- Read support for a new format ships at least eight weeks before any release writes it.
**`apm audit --ci` is stricter than install.** It fails with exit 1 when the lock records fields this apm does not know (other than `x-` keys): `'apm audit --ci' cannot certify apm.lock.yaml: it was written by APM <x>, newer than this APM <y>, and it records fields this APM does not know: <names>. Nothing was changed.` In JSON or SARIF output this is a failed check named `lockfile-fields-certifiable`. Plain `apm audit` only warns. Consequence: the apm that runs `audit --ci` must be at least as new as the newest apm that writes the lock.
## Minimum-version advice (doc)
apm has no manifest field for a required or minimum apm version. The upstream advice is to "pin a minimum APM in CI, not an exact one". The minimum should be a release that reads the lock format: 0.39.2 or later in the docs' own example. Version pinning therefore lives outside `apm.yml`, in whatever installs apm.
## `apm install --frozen`
- **Doc:** requires `apm.lock.yaml`, replays its pins, and never writes the lock (since 0.34.0).
- **Doc:** in CI (env `CI` set to anything but empty, `0` or `false`), `apm install` with a committed lock behaves like `--frozen` (0.37.0). `--no-frozen` opts out, and is the recommended form for update bots.
- **Doc:** mutually exclusive with `--update`, positional package additions and `--mcp`. Passing `--frozen --update` is a usage error (exit 2).
- **Doc:** fails (exit 1) before the pipeline on:
- a missing lock (a no-op when nothing is declared);
- a direct dependency missing from the lock;
- changed refs or commit pins;
- a host, provider or transport mismatch;
- MCP declaration mismatches;
- an MCP server the lock admits but `apm.yml` does not approve;
- hook approval pin mismatches.
- **Doc:** hash enforcement:
- Since 0.36.0, every deployed file is compared with its locked hash, and since 0.37.0 this happens before anything deploys. A mismatch exits 1.
- Since 0.39.x, it also fails when an apm-managed entry inside a merged hook config, such as `.claude/settings.json`, was edited.
- Recovery: restore or delete the edited file or entry, run `apm install` without `--frozen`, and commit. To keep edits made to a dependency's files, export them first with `apm export-patch`.
- **Doc:** after the pipeline, `--frozen` also checks for unrecorded files, missing files, a stale executables decision, and hash drift. `generated_at` and `apm_version` are excluded from the comparison.
## Exact dependency refs (0.39.0, #4970)
- **Source:** a dependency `ref` resolves only to `refs/heads/<ref>` or `refs/tags/<ref>`, or to itself when spelled out in full under one of those. There is no tail match and no fallback, so a ref that only partly matches a branch or tag name is refused.
- When a ref names both a branch and a tag, the error says it is ambiguous; spell it as `refs/heads/<name>` or `refs/tags/<name>`.
- When it names neither: `it is not a branch or tag of the origin`.
- An abbreviated SHA the host cannot expand is refused. Use the full 40 characters.
- **Source:** a pinned commit, whether a `#sha` ref or a locked commit, is admitted only if an origin branch or tag reaches it. A commit reachable only from a PR or a fork is refused.
- The fast path is a branch or tag tip, found with one `ls-remote`. Otherwise apm does a commits-only fetch of heads and tags.
- The verdict is cached in local state, never in the lockfile, so later replays work offline.
- **Source/doc:** the first install of a pinned commit needs the network. Offline, it fails closed with `the first install of a pinned commit needs network access once`.
- **Source:** Artifactory routes are exempt and resolve by name.
## Commit verdicts after an upgrade (0.39.0, #5173)
**Source:** reachability verdicts live in a new cache namespace (`verified-v2`), and verdicts recorded by earlier builds are never read. After upgrading, run each install online once before relying on offline or locked replays.
## Helper tools resolve from PATH (0.39.0)
**Doc:** apm's helper tools (`git`, `az`, `npm` and others) and the setup scripts it runs resolve programs only from PATH entries outside the project. This does not affect your own scripts.
@@ -0,0 +1,88 @@
---
topic: migration-0-28-to-0-39
source_keys:
- apm-v0-39-3-changelog
- apm-v0-39-3-source
- apm-v0-39-3-docs
---
This page lists the breaking and behaviour-changing items between apm 0.28.0, the version the rest of this reference set was first verified on, and 0.39.3. Use it to decide which "verified on 0.28.0" claims elsewhere need re-checking. Every item comes from the CHANGELOG, with source confirmation where it says **source**. None of it was run against a real project.
## Versions and runtime
- **0.36.0:** pip, pipx and uv installs need Python 3.11 or later. Standalone binaries are unaffected.
- **0.37.0:** the lockfile moves to format v4. 0.36.1 and older refuse it. See `lockfile-and-compatibility.md`.
- **0.39.2:** 0.37.0-0.39.1 refuse a lock that 0.39.2 rewrites. From 0.39.2, a lock written by a newer apm in a supported format only warns. 0.39.2 is therefore the practical minimum.
## Manifest and targets
- **0.29.0:** a plugin's `skills` declaration exclusively controls which skills deploy. `"skills": []` deploys none, and removing the key keeps conventional `skills/` discovery.
- **0.31.0:** a non-dry-run `apm install` exits 1 when Agent Plugins v1 target exclusion leaves no package deployed.
- **0.32.0:** `apm install` rejects bare `.` or `..` aliases and unsafe symlink destinations.
- **0.37.0:**
- The `vscode` target is deprecated in favour of `copilot`.
- The singular `target:` key is replaced by `targets:`, and `compilation.target` is ignored. Both still work, with warnings.
- Copilot project MCP servers move to a root `.mcp.json`.
- The `auto-integrate` config key is removed.
- With `default_host:` set, shorthand dependencies resolve against it.
- **Source:** `KNOWN_TARGETS` has 17 keys: agent-skills, antigravity, claude, codex, copilot, copilot-app, copilot-cowork, cursor, gemini, grok-bot, grok-build, grok-cloud, hermes, kiro, openclaw, opencode and windsurf. `vscode` is not among them.
- **0.39.0 (#4970):** a dependency `ref` must exactly name an origin branch or tag, and pinned commits must be reachable from one. See `lockfile-and-compatibility.md`.
## Install, lockfile and audit
- **0.34.0:** `apm install --frozen` no longer writes the lock.
- **0.36.0 (#3654):** `--frozen` verifies every deployed file against its locked hash. Before reinstalling, export your edits with `apm export-patch`.
- **0.37.0:**
- In CI, `apm install` with a committed lock verifies like `--frozen`. Use `--no-frozen` to opt out.
- `--frozen` fails before deploying on any edited deployed file.
- **0.38.0:** a failed or interrupted install restores every file it wrote. Install refuses managed files that lack deployment evidence.
- **0.39.0:**
- The lock is parsed with libyaml.
- Reachability verdicts are recorded anew, so run one online install after upgrading.
- Helper tools resolve only from PATH entries outside the project.
- **0.39.2:** `apm audit --ci` fails on lock fields this apm does not know.
- **0.39.3:** outside CI, the first `apm install --frozen` after an `apm install` takes a verified fast path.
- **Audit checks:** the baseline set has grown, so the total behind `N of M check(s) failed` is not fixed (**source**).
- Baseline: `manifest-parse`, `manifest-missing`, `lockfile-exists`, `ref-consistency`, `deployment-ledger-owners`, `deployed-files-present`, `exec-status-current`, `no-orphaned-packages`, `lockfile-targets-current`, `skill-subset-consistency`, `config-consistency`, `native-mcp-ownership`.
- Conditional: `native-mcp-drift` and `kept-mcp-entries`.
- Always on: `content-integrity`, `local-bundle-hooks`, `hook-approval-pins`, `includes-consent` (advisory), and `drift`.
## Executables and approvals
- **0.37.0 (#3918):** `apm audit --ci` fails MCP servers the lock admits but `apm.yml` does not approve. Use `apm approve <pkg>` instead of `--trust-transitive-mcp`.
- **0.37.0:** approvals can be pinned to content. Older clients reject pinned approvals.
- **0.38.0 (#4688):** a hook pin covers every file deployed with the hook. Re-approve hook packages once.
- **0.38.1:** `apm audit --ci` fails on merged hook entries that match a denied or unapproved package's hook and have no ownership evidence.
- **Ordinary grants stay version-blind (source).** A `hooks: true` grant keyed `pkg#1.2.3` still matches any version. See `approvals-and-executables.md`.
## Hooks
- **0.36.0 (#3613):** hook filenames no longer route hooks to targets, so every hook file reaches every targeted harness. To limit a hook to one target, declare `targets:` in the package `apm.yml`, or narrow the dependency with object-form `targets:`. When the old routing kept a target from a file, install fails for that package and names the file.
- **0.36.0:** Copilot hook events that have a Claude equivalent are written to `.claude/settings.json` under the Claude name.
- **0.38.1 and 0.39.0:**
- Edited hook entries and scripts are kept. Install exits 1 when an edited one blocks new content.
- A `.claude/settings.json` that apm created is deleted when its last entry leaves. One that apm did not create is kept, with a warning.
- Hooks merge in full-install order.
- **0.39.0 (#5600):** only hook commands that stay inside the package and use no shell expansion are deployed. Shell expansion means `$(...)`, backticks, `eval`, here-docs and subshells.
## Prompts and commands
- **0.39.0 (#4910 and others):** on the Claude target, apm keeps Claude Code command keys:
- `when_to_use`, `disable-model-invocation`, `user-invocable`, `disallowed-tools`, `effort`;
- `context`, `agent`, `background`, `shell`.
`hooks` is still withheld, with a warning. In 0.28.0 only `description`, `allowed-tools`, `model`, `argument-hint` and `input` survived. See `prompt-primitive-schema.md`.
- **0.39.0:** the dropped-keys message is shown only with `--verbose`. It is an info message, not a warning.
## Instructions and root context files
- **0.38.0:** Claude instructions scoped to `**` or to a directory move from `.claude/rules/` into `AGENTS.md`, which `CLAUDE.md` imports. A hand-authored `CLAUDE.md` needs `@AGENTS.md`.
- **0.39.0 (#5394):** install-only projects keep the 0.37 `.claude/rules/` layout. A hand-authored root `CLAUDE.md` without the import, or a hand-authored `AGENTS.md` without managed-section markers, keeps every instruction in `.claude/rules/`, with a warning. See `instructions-target-mapping.md`.
## CLI
- **0.36.0:** `apm export-patch` is added.
- **0.37.0:** `apm init --plugin` and `apm init --marketplace` exit 2. Use `apm plugin init` or `apm marketplace init` instead.
- **0.37.0:** approvals are pinned to content, and `apm approve` and `apm deny` manage them.
- **`apm outdated`:** still has no `--json`. Its summary line `<N> outdated dependency/dependencies found` is unchanged in source. Its columns are Package, Current, Wanted (registry rows only), Latest, Status and Source.
- **`apm audit`:** supports `-f text|json|sarif|markdown` and `-o PATH`. JSON is the stable machine format. `markdown` is not allowed with `--ci`.
@@ -7,11 +7,13 @@ source_keys:
- apm-docs-cli-run
- apm-docs-cli-compile
- apm-cli-0-28-0-prompt-experiments
- apm-v0-39-3-source
- apm-v0-39-3-changelog
---
## What this covers
Constraints that surprise a prompt author. Items are marked **observed** when they were reproduced on the installed apm 0.28.0 in a throwaway project with local-path packages, and **doc** when they come only from the published docs. Where an observation disagrees with a doc statement, the observation wins and the disagreement is noted. Claude Code, Cursor and Gemini runtime behaviour on the emitted files was not tested.
Constraints that surprise a prompt author. **Version note:** every **observed** item below was observed on apm 0.28.0 and has not been re-run on 0.39.x. The changes known from the 0.39.3 source and CHANGELOG are listed under "Changed in 0.39.x" at the end. Items are marked **observed** when they were reproduced on the installed apm 0.28.0 in a throwaway project with local-path packages, and **doc** when they come only from the published docs. Where an observation disagrees with a doc statement, the observation wins and the disagreement is noted. Claude Code, Cursor and Gemini runtime behaviour on the emitted files was not tested.
## Discovery
@@ -72,3 +74,15 @@ Parameters are interpolated into any `.prompt.md` the script references and are
## Not tested
The experimental targets (hermes, openclaw, copilot-cowork, grok-cloud, copilot-app), because enabling them writes global config. Claude Code, Cursor and Gemini runtime handling of the emitted files.
## Changed in 0.39.x (from source and CHANGELOG, not observed)
- On the `claude` target the Claude-native command keys are kept rather than dropped:
- `when_to_use`, `disable-model-invocation`, `user-invocable`, `disallowed-tools`, `effort`;
- `context`, `agent`, `background`, `shell`.
So the 0.28.0 drop list above (which named `agent`) no longer holds for Claude. Cursor, OpenCode, Windsurf and grok-build still drop these keys. See `prompt-primitive-schema.md`.
- The dropped-keys message is an info line shown only with `--verbose`, so a default install no longer reports dropped keys at all.
- Frontmatter `hooks` on a command is withheld with a warning.
- A non-string frontmatter key (for example `1:`) skips that one command with a warning, and the other commands still install.
- Hidden-Unicode, collision and stale-cleanup behaviour were not re-checked. 0.38 and 0.39 changed how edited deployed files are kept (see `migration-0-28-to-0-39.md`), so the "hand-edited file is silently overwritten" item above is likely stale.
@@ -5,9 +5,26 @@ source_keys:
- apm-github-repo
- apm-docs-author-prompts
- apm-docs-llms-full
- apm-v0-39-3-source
- apm-v0-39-3-changelog
---
Per-target output, key survival and the doc inconsistencies are in `prompt-target-mapping.md` and `prompt-gotchas.md`. The published "Author a prompt" page lists five preserved keys: `description`, `input`, `allowed-tools`, `model`, `argument-hint`. Where the section below says four keys are preserved, read that as four plus `input`, which is consumed into `arguments:` on Claude. Both the page and the installed 0.28.0 source agree on this set.
Per-target output, key survival and the doc inconsistencies are in `prompt-target-mapping.md` and `prompt-gotchas.md`.
**Version note.** This file was first verified on apm 0.28.0. The Claude key set changed in 0.39.0; the section "Claude command keys in 0.39.x" below is the current behaviour, read from the v0.39.3 source. In 0.28.0 the shared set was five keys: `description`, `input`, `allowed-tools`, `model`, `argument-hint`, where `input` is consumed into `arguments:` on Claude. Every other key was dropped on every Claude-family target.
## Claude command keys in 0.39.x
- **Shared keys, kept on every Claude-family target:** `description`, `allowed-tools` (alias `allowedTools`), `model`, `argument-hint` (alias `argumentHint`), `input`.
- **Claude-native keys, kept only when the target is `claude`:**
- `when_to_use`, `disable-model-invocation`, `user-invocable`, `disallowed-tools`, `effort`;
- `context`, `agent`, `background`, `shell`.
Cursor, OpenCode, Windsurf and the other targets that reuse the command transformer still drop them.
- **`arguments`:** an authored `arguments` is kept verbatim only on Claude, and only when the file has no `input` key at all. An `input` key always wins, even when it is empty or every name in it was rejected.
- **`hooks`:** withheld on purpose. The command is deployed without its hooks, and install warns `frontmatter hooks withheld`. apm does not yet run command hooks through its executable-approval gate.
- **Other keys:** still dropped. The dropped-keys message is now an info line shown only with `--verbose`, no longer an always-on warning.
- **Consequence:** a prompt with `disable-model-invocation: true` deploys with that key to `.claude/commands/<name>.md` on 0.39.0 and later. 0.28.0 silently stripped it.
## File location, naming, and frontmatter
@@ -33,7 +50,7 @@ There is no single closed frontmatter schema — APM's P1 "no invented primitive
**Claude Code target — real reconstruction into a slash command, with field-dropping.** There is no `prompts:` key at all in Claude's `TargetProfile.primitives` dict; instead prompts route through the shared `CommandIntegrator`, which transforms `.prompt.md` → Claude custom slash command markdown. `CommandIntegrator._transform_prompt_to_command()`:
- Strips the `.prompt.md` suffix from the filename to derive `command_name`.
- Builds an entirely new frontmatter object containing **only** these preserved keys: `description`, `allowed-tools` (accepts `allowedTools` alias), `model`, `argument-hint` (accepts `argumentHint` alias).
- Builds an entirely new frontmatter object containing **only** the preserved keys. In 0.28.0 these were `description`, `allowed-tools` (alias `allowedTools`), `model` and `argument-hint` (alias `argumentHint`). From 0.39.0 the `claude` target also keeps the Claude-native keys listed above.
- Maps APM's `input:` list to Claude's `arguments:` list, and synthesizes `argument-hint` from it if not already set.
- Rewrites body placeholders `${input:name}` / `${{input:name}}` to Claude's native `$name` syntax via regex substitution.
- Computes `dropped_keys = source_frontmatter_keys - preserved_keys` and surfaces it as an install-time diagnostic warning — so `author`, `mcp`, `parameters`, and any other non-listed key are silently dropped from the compiled output but *not* silently dropped from the user's awareness (a warning fires).
@@ -44,7 +61,7 @@ There is no single closed frontmatter schema — APM's P1 "no invented primitive
| Target | Output path | Transform |
|---|---|---|
| Copilot CLI | `.github/prompts/<name>.prompt.md` | Verbatim byte copy (links resolved) |
| Claude Code | `.claude/commands/<name>.md` | Reconstructed: only `description`/`allowed-tools`/`model`/`argument-hint`/`arguments` survive; `input:` → `arguments:`; `${input:x}` → `$x` |
| Claude Code | `.claude/commands/<name>.md` | Reconstructed. In 0.28.0 only `description`/`allowed-tools`/`model`/`argument-hint`/`arguments` survive; from 0.39.0 the Claude-native keys survive too. `input:` → `arguments:`; `${input:x}` → `$x` |
Invocation surface differs correspondingly: Copilot exposes it via the prompts picker UI (select by name); Claude exposes it as `/<name> <args>` (same pattern Cursor, OpenCode, Gemini CLI, and Windsurf's workflows menu use for their own compiled copies).
@@ -52,6 +69,6 @@ Invocation surface differs correspondingly: Copilot exposes it via the prompts p
- **Input-name validation is real, not just documentation.** `_extract_input_names()` enforces `[A-Za-z][\w-]{0,63}` on every name pulled from `input:`; anything that fails is dropped from `arguments:` and reported as a warning listing up to 5 rejected names (`input: rejected N invalid name(s) ... `). A malformed `input:` entry does not fail the install — it silently loses that one argument.
- **Filename-derived identity is security-checked.** `integrate_commands_for_target` calls `validate_path_segments(base_name, context="command filename")` specifically to reject a package shipping a `.prompt.md` file with a manipulated relative name (e.g. `../../evil.prompt.md`) that would otherwise escape the target commands directory.
- **The dropped-key warning is the only signal a Claude-only author gets** that Cursor-specific frontmatter (`author`, `mcp`, `parameters`) never reached the deployed file — there is no error, no hard failure, and no config flag to preserve those keys for Claude; the shared transformer's preserved-key list is fixed in code (`_PRESERVED_COMMAND_KEYS`), not configurable per package.
- **The dropped-key message is the only signal a Claude-only author gets** that Cursor-specific frontmatter (`author`, `mcp`, `parameters`) never reached the deployed file. There is no error, no hard failure, and no config flag to preserve those keys. The preserved-key lists are fixed in code (`_PRESERVED_COMMAND_KEYS`, and `_CLAUDE_NATIVE_COMMAND_KEYS` from 0.39.0); a package cannot configure them. From 0.39.0 the message appears only with `--verbose`.
- **No dedicated `Prompt`/`PromptPrimitive` validation class exists** in `apm_cli/models/validation.py` or `apm_cli/primitives/models.py` — same gap pattern documented for the agent primitive. `apm.yml`'s `type: prompts` package-content-type ("Commands/prompts only, no instructions or skills") is validated at the package-type-detection level, not the individual-prompt level.
- Slash commands and prompts share one source directory and one glob (`.apm/prompts/*.prompt.md`) — there is no separate `.apm/commands/` primitive; "command" is purely a per-target compiled *name* for the same source file, not a distinct authoring primitive.
@@ -6,12 +6,15 @@ source_keys:
- apm-docs-producer-ramp
- apm-github-repo
- apm-cli-0-28-0-prompt-experiments
- apm-v0-39-3-source
---
## Scope and confidence
This file maps one `.apm/prompts/<name>.prompt.md` source to what each apm target receives. The paths and transforms below were **observed** on apm 0.28.0 using local-path packages in a throwaway project, and cross-checked against the published docs and the installer source. Where docs and observation disagree, the observation is used and `prompt-gotchas.md` records the disagreement. Runtime behaviour in the receiving tools was not tested.
**Version note:** the output paths below are unchanged in the 0.39.3 source. What changed is which frontmatter keys the `claude` row keeps. From 0.39.0 it keeps the Claude-native command keys, `disable-model-invocation` among them. See `prompt-primitive-schema.md`.
## Output per target
| Target | Output path | Form |
@@ -92,3 +92,63 @@ Note: `releasing.md`'s `--check-clean`/`--check-versions` scope, `apm pack` exit
- **Description:** The installed apm-cli 0.28.0 exercised with local-path throwaway packages in a scratchpad outside the repo: root-level and nested prompt discovery, manifest `type:` values, compile on prompts-only packages, per-target install output and dropped-key warnings, input-name and YAML edge cases, collision, stale-cleanup and hand-edit behaviour, hidden-Unicode scanning and audit, and `apm pack --format plugin`. Source files `command_integrator.py`, `prompt_integrator.py` and `plugin_exporter.py` were read to cross-check. Experimental targets and `apm run` were not exercised.
- **Contributing files:** prompt-target-mapping.md, prompt-gotchas.md
- **Status:** `extracted`
## apm-v0-39-3-source
- **URL:** https://github.com/microsoft/apm/tree/v0.39.3/src/apm_cli
- **Description:** apm source at tag v0.39.3. Read from a local clone that `git describe` confirmed as v0.39.3, covering:
- **lockfile and audit:** lockfile versions and hashing, the compatibility warning and `audit --ci` certification, `exact_branch_or_tag_sha`, commit reachability, libyaml loading, the audit baseline checks and output strings, and `apm outdated` options and output;
- **approvals:** executables grants and pins, trust, and the hook fingerprint;
- **integrators:** hook, command, agent and skill;
- **instructions:** `claude_agents_md` and root-context protection;
- **CLI:** the command table, init, pack, update, approve and export-patch;
- **package metadata:** `pyproject.toml`.
- **Contributing files:** lockfile-and-compatibility.md, approvals-and-executables.md, migration-0-28-to-0-39.md, cli-reference.md, installation.md, prompt-primitive-schema.md, prompt-gotchas.md, prompt-target-mapping.md, hooks-primitive-schema.md, instructions-target-mapping.md
- **Status:** `extracted`
## apm-v0-39-3-changelog
- **URL:** https://github.com/microsoft/apm/blob/v0.39.3/CHANGELOG.md
- **Description:** CHANGELOG entries from 0.29.0 to 0.39.3. They cover breaking changes and upgrade notes on lockfile v4, the 0.39.2 lock refusal, `--frozen` hashes, exact refs, commit verdicts, approvals and hook pins, hook filename routing, the Claude command keys, the AGENTS.md instruction layout, targets and CLI removals.
- **Contributing files:** lockfile-and-compatibility.md, approvals-and-executables.md, migration-0-28-to-0-39.md, prompt-primitive-schema.md, prompt-gotchas.md, hooks-primitive-schema.md, instructions-target-mapping.md, instructions-gotchas.md
- **Status:** `extracted`
## apm-v0-39-3-docs
- **URL:** https://github.com/microsoft/apm/tree/v0.39.3/docs/src/content/docs
- **Description:** the docs source behind https://microsoft.github.io/apm/, read at tag v0.39.3 from the same clone. Pages used:
- **reference:** lockfile-spec, compatibility and baseline-checks;
- **CLI reference:** install, audit, outdated, approve, export-patch, compile, pack, marketplace and uninstall;
- **consumer:** run-in-ci and update-and-refresh;
- **producer:** write-primitives;
- **getting started:** installation;
- **spec:** the OpenAPM spec.
The published installation page was also fetched, and it matched.
- **Contributing files:** lockfile-and-compatibility.md, approvals-and-executables.md, migration-0-28-to-0-39.md, cli-reference.md, installation.md, hooks-primitive-schema.md, instructions-target-mapping.md
- **Status:** `extracted`
## pypi-apm-cli
- **URL:** https://pypi.org/pypi/apm-cli/json
- **Description:** PyPI metadata for apm-cli: the 0.39.2 and 0.39.3 release dates, wheel and sdist availability, yank status, `requires_python >=3.11` and `requires_dist`.
- **Contributing files:** installation.md
- **Status:** `extracted`
## apm-cli-0-39-3-uv-experiments
- **URL:** https://pypi.org/project/apm-cli/0.39.3/
- **Description:** throwaway uv projects built in a scratchpad outside any repo with uv 0.11.24. They tested:
- `uv add --dev apm-cli==0.39.3` and `uv run apm --version`;
- the `[tool.uv] package = false` form;
- `uv run --frozen --offline` with a warm cache and with a cold cache;
- `uvx --offline` against a cache warmed by `uv add`.
- **Contributing files:** installation.md
- **Status:** `extracted`
## context7-microsoft-apm-0-39-3
- **URL:** context7:/microsoft/apm
- **Description:** a Context7 query for apm 0.39.3 made during this refresh. It returned "Invalid API key", so no Context7 content informs the 0.39.3 material.
- **Contributing files:** none
- **Status:** `no content extracted`
+26 -42
View File
@@ -1,6 +1,6 @@
name: mattpocock
version: 0.4.0
description: Matt Pocock's agent skills — planning, grilling, test-first development, triage and bug diagnosis — redistributed from upstream at a pinned release.
version: 0.5.0
description: Matt Pocock's build-side agent skills — test-first development, architecture review, code review, implementation and bug diagnosis — redistributed from upstream at a pinned release.
author:
name: Mortis
url: https://git.rkdr.net/Mortis/
@@ -8,13 +8,11 @@ license: MIT
homepage: https://git.rkdr.net/Mortis/Holocron/src/branch/main/plugins/mattpocock
repository: https://git.rkdr.net/Mortis/Holocron/src/branch/main/plugins/mattpocock
keywords:
- wayfinder
- planning
- grilling
- domain-modeling
- tdd
- triage
- architecture
- code-review
- implementation
- diagnostics
# Constrains what .apm/ may contain: instructions, skill, hybrid, or prompts
type: hybrid
@@ -34,54 +32,40 @@ includes: auto
# repo cannot be listed directly (same constraint and mechanism as
# the since-removed plugins/onedev, ADR-0026).
#
# Why these skills, not the whole upstream set:
# - `wayfinder` is hand-invoked upstream (`disable-model-invocation: true`) and
# its body calls `grilling`, `domain-modeling`, `research` and `prototype`,
# and reads the tracker doc written by `setup-matt-pocock-skills`.
# - `grill-me`, `grill-with-docs`, `tdd`, `prototype`, `improve-codebase-architecture`,
# `triage` and `diagnosing-bugs` replace hand-maintained copies that used to
# live in plugins/bin. Upstream's `grill-me`, `grill-with-docs`, `triage` and
# `improve-codebase-architecture` are hand-invoked, so another skill cannot
# route to them through the Skill tool.
# - `codebase-design` is called through the Skill tool by `improve-codebase-architecture`
# and `tdd`, and `code-review` is where `tdd` sends refactoring; without them
# those calls dangle.
# - `to-tickets` and `to-spec` publish to the tracker doc that
# `setup-matt-pocock-skills` writes, which names them as its consumers.
# - `implement` and `implement-spec` take that spec and ticket graph to code;
# `retro` calls `writing-for-agents`. `writing-for-agents` is model-invoked
# and overlaps the triggers of kyberforge's `skill-author` and core's
# `agentsmd-author`.
# - `research` is the skill `wayfinder` calls to resolve a research ticket: one
# question answered in one cited findings note. bin's reference-tree skill
# was renamed `research-docs` to free the name (ADR-0030). bin's `diagnose`,
# `write-docs`, `caveman` and `zoom-out` are first-party and kept.
# The planning skills (wayfinder, grilling, grill-me, grill-with-docs,
# domain-modeling, research, prototype, codebase-design, triage, to-spec,
# to-tickets) moved to plugins/plan (ADR-0031). What stays here is the
# build-side set:
# - `tdd`, `improve-codebase-architecture` and `diagnosing-bugs` replace
# hand-maintained copies that used to live in plugins/bin. Upstream's
# `improve-codebase-architecture` is hand-invoked, so another skill cannot
# route to it through the Skill tool. It calls `grilling` and
# `domain-modeling`, which now come from plugins/plan.
# - `code-review` is where `tdd` sends refactoring; without it that call
# dangles. `tdd` and `improve-codebase-architecture` also call
# `codebase-design` through the Skill tool, which now comes from plugins/plan.
# - `implement` and `implement-spec` take a spec and ticket graph to code.
# `implement-spec` reads what plan's `to-spec`, `to-tickets` and `research`
# produce. `retro` calls `writing-for-agents`. `writing-for-agents` is
# model-invoked and overlaps the triggers of kyberforge's `skill-author` and
# core's `agentsmd-author`.
# - `setup-matt-pocock-skills` writes the tracker doc that `code-review` and
# `implement-spec` read. plugins/plan pins it as well, at the same tag.
#
# Pinned on purpose: tracking a third-party `main` would import someone else's
# drift. Bump every tag together, deliberately, so the skills stay at one
# upstream revision.
# drift. Bump every tag together, here and in plugins/plan/apm.yml, so the
# skills stay at one upstream revision.
dependencies:
apm:
- mattpocock/skills/skills/engineering/wayfinder#v1.3.2
- mattpocock/skills/skills/productivity/grilling#v1.3.2
- mattpocock/skills/skills/engineering/domain-modeling#v1.3.2
- mattpocock/skills/skills/engineering/setup-matt-pocock-skills#v1.3.2
- mattpocock/skills/skills/productivity/grill-me#v1.3.2
- mattpocock/skills/skills/engineering/grill-with-docs#v1.3.2
- mattpocock/skills/skills/engineering/tdd#v1.3.2
- mattpocock/skills/skills/engineering/prototype#v1.3.2
- mattpocock/skills/skills/engineering/improve-codebase-architecture#v1.3.2
- mattpocock/skills/skills/engineering/triage#v1.3.2
- mattpocock/skills/skills/engineering/diagnosing-bugs#v1.3.2
- mattpocock/skills/skills/engineering/codebase-design#v1.3.2
- mattpocock/skills/skills/engineering/code-review#v1.3.2
- mattpocock/skills/skills/engineering/to-tickets#v1.3.2
- mattpocock/skills/skills/engineering/to-spec#v1.3.2
- mattpocock/skills/skills/engineering/implement#v1.3.2
- mattpocock/skills/skills/engineering/implement-spec#v1.3.2
- mattpocock/skills/skills/engineering/retro#v1.3.2
- mattpocock/skills/skills/productivity/writing-for-agents#v1.3.2
- mattpocock/skills/skills/engineering/research#v1.3.2
mcp: []
devDependencies:
apm: []
@@ -0,0 +1,26 @@
---
name: plan-gate
description: >
Use when the plan prompt needs the step-1 gate run on a ticket or idea: duplicate, already done, contradicts
an ADR, or out of scope. Read-only. Not deep feasibility validation -> `plan-validator`.
model: sonnet
disallowedTools: Edit, Write, NotebookEdit
---
You run the cheap gate before any grilling. You are read-only: never call a write tool.
## Input
A ticket number or the idea as free text.
## Checks
1. **Duplicate**: an open issue or PR covers the same thing (`gitea-issues`, `gitea-prs`).
2. **Already done**: the repo already does it.
3. **Contradicts an ADR**: a decision in `docs/adr/` rules it out.
4. **Out of scope**: it falls outside `docs/VISION.md`.
## Output
One line per check: `<check> | pass/hit | evidence (link or file:line)`, then `verdict: go` or
`verdict: stop: <reason>`.
@@ -0,0 +1,25 @@
---
name: plan-recorder
description: >
Use when the plan prompt has an agreed plan and needs step 7: the decisions recorded in a docs PR
(AGENTS.md, GLOSSARY.md, ADRs). Not writing the spec or tickets -> `to-spec`.
model: sonnet
---
You record agreed decisions in the repo's docs and open one docs PR. You change docs only, never
code.
## Input
The agreed plan and the list of decisions it made.
## Process
1. Create a branch `docs/plan-<slug>` from the default branch.
2. Record each decision where it belongs: an ADR or glossary term with `domain-modeling`, an
AGENTS.md change with `agentsmd-author`.
3. Commit with `git-commits`, push, and open the PR with `gitea-prs`.
## Output
The PR link and one line per decision naming the file it landed in.
@@ -0,0 +1,27 @@
---
name: plan-researcher
description: >
Use when the plan prompt needs step-3 research on an agreed intent and track, in the repo or online.
Read-only; returns cited findings. Not a findings file in the repo -> `research`.
model: sonnet
disallowedTools: Edit, NotebookEdit
---
You research one question for `/plan`. Never edit repo files; the only place you may write is the
session scratchpad.
## Input
The intent, the recommended track, and a scope: `repo` or `web`.
## Process
- **repo**: current practices, rules, patterns and conventions — AGENTS.md, `GLOSSARY.md`,
`docs/adr/`, `docs/spec/` and the code the intent touches.
- **web**: tools, documentation, best practices, examples and standards. Use Context7 for library
docs; prefer primary sources.
## Output
Findings as bullets, each with its source (file:line or URL) and marked `verified` or `inferred`.
End with open questions, if any.
@@ -0,0 +1,25 @@
---
name: plan-validator
description: >
Use when the plan prompt needs step-4 deep validation: is the researched intent feasible and does it fit
the repo as it is now. Read-only. Not the cheap pre-grilling gate -> `plan-gate`.
model: opus
disallowedTools: Edit, Write, NotebookEdit
---
You validate one intent against the repo as it is now. You are read-only: never call a write tool.
## Input
The intent, the track, and the research findings.
## Checks
- Feasible with the repo's current structure, tools and conventions.
- Consistent with ADRs, AGENTS.md and `GLOSSARY.md`.
- Nothing it relies on is missing.
## Output
Each finding tagged `contradiction`, `missing`, `infeasible` or `risk`, with evidence, then
`verdict: fits`, `verdict: regrill: <point>` or `verdict: stop: <reason>`.
+210
View File
@@ -0,0 +1,210 @@
---
description: Rank this repo's open issues by a metric, let me pick one, then validate it and present a plan with subagents
argument-hint: "[easiest|security|important|unblocking|quick-win] [milestone:\"<name>\"] [label:\"<name>\"[,\"<name>\"...]]"
---
Arguments (raw, verbatim):
$ARGUMENTS
This command is read-only from start to finish. It makes no edits, branches, commits, assignments,
labels, comments, or issue closures. Building happens only through `/ship`.
You are the orchestrator. Delegate the heavy reading to subagents and take back only their
conclusions, in the return formats below. Every subagent brief starts with:
> READ-ONLY. Read the repo, its issues and PRs. Do not call any write tool. The only place you may
> write is the session scratchpad.
## 1. Resolve the forge, the arguments, and me (you, not a subagent)
**Forge**
- **Gitea**: the gitea MCP server answers for this owner/repo. Take owner/repo from
`git remote get-url origin`.
- **GitHub**: the host is github.com and `gh auth status` passes.
- **Otherwise**: if there is no `origin`, or the tool you need is missing, stop and say which.
**Arguments**
Parse them with shell-style quoting.
- `milestone:` and `label:` values may be quoted.
- An unquoted `label:` value also takes the words after it, until the next flag or until the
value matches one of the repo's labels. `label:Status/Needs Triage` is therefore one label, and
`/` is part of the name.
- Commas separate labels. An issue must carry all of them.
- Every other word is the metric.
- Aliases: "most important" and "importance" mean `important`; "quick win" means `quick-win`.
- If two known metrics are given, rank by the first and break ties with the second.
- Any other text is a free-text priority: state how you read it.
- No metric means `important`.
**Resolve the filters against the repo**
- **Milestone**: match the name against **open** milestones only, case-insensitive and partial.
- No match: list the open milestones and stop.
- Several matches: ask me with AskUserQuestion.
- Filter by the matched milestone's ID. A partial name passed to the issue list is silently
ignored there.
- **Labels**: match each name case-insensitively against the repo's label list. If one doesn't
exist, say so, list the close matches, and stop.
**Me**
Use gitea `get_me` or `gh api user`. If that fails, use `git config user.name` and say you did.
State the result in one line:
`forge=… repo=… metric=… milestone=… labels=… me=… ignored=…`
## 2. Find the candidates (one subagent)
Brief the subagent with the resolved filters and the rules below.
**Listing**
- Use issues only (Gitea `type=issues`, `state=open`), and page through all of them. On Gitea,
issues and PRs share one number space.
- Fetch the list of open PRs once.
**Exclude** (the reason goes in the exclusion list):
- An issue assigned to anyone other than me. Name the assignee in the reason.
- An issue carrying a label that means blocked, needing more info, abandoned, won't fix, duplicate,
invalid, or ready for a human. Map these to the repo's own label scheme, and read
`docs/agents/triage-labels.md` or the equivalent if it exists.
- **Never** exclude an issue for a label I filtered on.
- Map, epic, or index issues that only track other issues.
- An issue with an **open** blocker. That is either an open entry in the forge's dependency list
(closed blockers don't count), or an open issue named as "blocked by", "depends on", or "after
#N" in its body or comments.
- An issue an open PR already addresses: the PR's title or body says Closes, Fixes, or Refs #N, or
its head branch contains the number.
Anything uncertain is **flagged**, not excluded. Examples: an issue whose body says only a human
can do it, or one that is a pending decision.
**Cost**
Run the metadata filters on the list result first. Call get, comments, and dependencies only for
issues that survive them.
**Return**, one line per issue:
- candidates: `#N | title | labels | milestone | blocks: #… | blocked_by(open): #… | flags | summary`,
with the summary at most 50 words and folding in amendments from comments;
- excluded: `#N | excluded: reason`.
If there are no candidates, show the exclusion list and stop. If the filters removed everything
because the repo has no such labels or milestones, say that.
## 3. Score the candidates (subagents in parallel)
**`unblocking`**
You compute it yourself from the blocks/blocked_by edges, transitively. No subagents are needed.
Skip to step 4.
**Every other metric**
Batch the candidates, about 5 per subagent, with at most 6 subagents. Scoring is routine, so use a
smaller model for these subagents.
If there are more than 30 candidates, pre-rank them on metadata and score only the top 30. Say how
many you dropped. Pre-rank in this order:
1. A priority label.
2. A kind label that fits the metric (e.g. security, bug).
3. The milestone.
4. Age, oldest first.
**Brief each scorer with:**
- the metric and its rubric below;
- the paths to AGENTS.md / CLAUDE.md and `docs/adr/`. Don't send their contents. The scorer reads
an ADR only when the issue touches its subject.
The scorer judges against the repository as it is now, not the issue text alone.
**Rubric** (1–10, higher is better for the metric):
- `easiest`:
- 9–10: at most 2 files, follows an existing pattern, acceptance criteria are explicit and
testable locally.
- 5: 3–6 files, or one open question.
- 1–3: a new subsystem, an undecided design, or work outside the repo.
- `security`:
- 9–10: exploitable now, or secrets or credentials are exposed.
- 5: a hardening or defence-in-depth gap.
- 1–3: tangential to security.
- `important`:
- 9–10: high priority, or blocks several issues, or on the active milestone, or user-facing.
- 5: useful, with no dependents.
- 1–3: nice to have.
- If the repo has no priority labels or milestones, say so and score on the other factors.
- `quick-win`: the `important` score, adjusted up for effort S and down for effort L.
- Free-text priority: state your own 1/5/10 anchors in the brief and use the same ones in every
batch.
**Caps**
- Score at most 4 for an issue that is only a decision, can only be done by a human, or whose
acceptance needs an action outside the repo. Flag it as well.
- Score at most 3 for an issue that is stale (no longer matches the code).
**Return**, one block per issue:
`#N | score | evidence (≤3 bullets, file:line) | effort S/M/L | files | risks | status valid/stale/partial | flags`
Merge the results. Sort by score and break ties on effort. If one batch's scores look uniformly
off-scale compared with the others, re-check two of its issues against the rubric before
trusting it.
## 4. Present the shortlist and let me pick
**Table**: the top 5.
| Rank | Issue | Score | Effort | Why | Risks / flags |
|---|---|---|---|---|---|
**Below the table**
- Your top pick, with two sentences of rationale.
- Any stale or partly done issues you found. Only list them; do not close or comment on them.
**Ask me** with AskUserQuestion. "Other" lets me name any number.
- 4 or more candidates: offer the top 4, the recommended one first and marked "(Recommended)".
- 2–3 candidates: offer them all.
- 1 candidate: ask yes or no.
Stop until I answer.
**If I name something outside the shortlist**
- A PR, a closed issue, or a number that doesn't exist: say so and ask again.
- An issue that was excluded or not scored: say why first, then go on to step 5 with it.
## 5. Validate the pick and plan (subagents in parallel)
Brief these subagents with the issue number and the relevant paths, not your conclusions.
- **Validation**
- Does the issue still match the repo?
- Do its body and comments agree with each other and with the linked decisions or ADRs?
- Is anything it relies on missing?
- Can each acceptance criterion be tested locally?
- Return each finding tagged `contradiction`, `stale`, `missing`, or `untestable`.
- **Solution options**
- Give 2–3 concrete approaches that follow the repo's conventions and existing patterns.
- Return each as `approach | files | tradeoff | fit`.
- **External facts** (only if the issue depends on a library, tool, or API)
- Verify the behaviour from primary sources, using Context7 for library docs.
- Experiments are allowed only inside the scratchpad, and must not install anything globally.
- Mark each claim as verified or inferred.
**Stop instead of planning** if:
- the issue contradicts a recorded decision, or
- no viable approach exists without a design decision that was never made.
Say which applies. A choice *between* viable approaches is not a reason to stop: put it under open
decisions instead.
**The plan** is written so `/ship` can run it as is:
1. `Issue: #N <title>`. The PR must close it.
2. What the issue asks, and what validation found.
3. The recommended approach and its main tradeoff. Give each alternative in one line.
4. The steps: the files to change, in order.
5. Verification: the tests and checks, and what can't be verified locally.
6. Human steps: acceptance criteria that need an action outside the repo (e.g. filing an upstream
issue, pushing tags, or setting up infrastructure).
7. Open decisions that need me. Do not decide these yourself.
End with: "Run `/ship` to build this, or `/plan` to spec it first." If I reply go, tell me
to run `/ship`: it cannot be invoked for me. Do not build inline.
+103
View File
@@ -0,0 +1,103 @@
---
description: Turn a ticket or idea into a validated plan, a spec and agent-ready tickets, with me in the loop
argument-hint: "[#N | idea as free text] (empty: the issue picked by /next in this conversation)"
disable-model-invocation: true
---
Input (raw, verbatim):
$ARGUMENTS
You are the orchestrator. Delegate the reading to subagents and keep only their conclusions. Speak
to me only to ask, to present, or to report. Every command you ask me to run goes in a code block
I can copy.
## 0. Entry
- `#N`: read the issue and its comments with `gitea-issues`.
- Free text: that is the idea.
- Empty: use the issue picked by `/next` earlier in this conversation. None → ask me for one.
## 1. Gate
Dispatch `plan-gate`. `verdict: stop` → tell me why and stop.
## 2–6. Discovery loop
Repeat until I agree. Count loops per point; after two loops on the same point, ask me whether to
park the idea instead.
2. **Grill** with `grilling`, only if the intent is unclear, and load `domain-modeling` to challenge
terms. Override: make no `GLOSSARY.md` or ADR edits during grilling; collect candidate terms and
ADRs for step 7 instead. This equals `grill-with-docs` minus the writing during grilling. Then
recommend a track with `plan-track`. `track: wayfinder` → ask me with AskUserQuestion to
confirm. On yes, give me this, filled in, and stop:
```
/wayfinder <intent> — <grilling answers>
```
On no, ask me which of the other two tracks to take, then continue to step 3.
3. **Research**: dispatch `plan-researcher` twice in parallel, scope `repo` and scope `web`. Ask
each to flag when lasting reference docs for an external tool or library are needed. Nothing is
written.
4. **Validate**: dispatch `plan-validator` with the findings. `regrill` → back to 2. `stop` → tell
me why and stop.
5. **Offer a plan**: options, considerations, recommendation, impact, expected results, and the
track. Use `codebase-design` only when the options change module or interface shape. List the
repo docs downstream agents need: `write-docs` targets and `research-docs` topics.
6. **Agreement**: ask me with AskUserQuestion to agree and confirm the track, or send it back to
grilling or research. Say in the question that agreeing also approves step 7's docs branch,
push and PR.
## 7. Record decisions
Dispatch `plan-recorder` with the agreed plan, its decisions, and the candidate terms and ADRs from
step 2. My agreement in step 6 authorizes its branch, commit, push and docs PR. Keep the PR link.
If step 5 listed docs: if it listed `research-docs` topics, ask me for the `research-docs` output
path. Then tell me the docs branch name (from the PR) and to run these on it, only the lines that
apply, and push to the same PR:
```
/write-docs <target>
/research-docs <topic> <path>
```
Wait for me.
## 8. Spec (spec and tickets track only)
`to-spec` is hand-invoked, so you cannot call it. Tell me to run:
```
/to-spec <agreed plan summary> — link the docs PR <link>
```
My running it is my approval of the spec. Wait for it. `to-spec` sets `Status/Ready for Agent` on
the spec issue; if present, resolve its label ID with `gitea-labels-milestones` and remove it with
`gitea-issues`.
## 9–10. Tickets
`to-tickets` is hand-invoked, so you cannot call it. Tell me to run it on the spec (or on this
conversation, on the tickets-only track):
```
/to-tickets <spec issue link | this conversation> — docs PR <link>
```
It proposes the breakdown, and my approval inside it covers the whole batch. It files the tickets
and sets `Status/Ready for Agent`; a ticket without acceptance criteria must not carry it. If the
breakdown shows a gap in the spec, tell me to rerun step 8's `/to-spec` block first.
After it files them, read each filed ticket with `gitea-issues`. Resolve the label IDs with
`gitea-labels-milestones`, remove `Status/Ready for Agent` from any ticket with no acceptance
criteria, and list those tickets for me.
Spec track: create one milestone `Spec: <spec issue title>` with `gitea-labels-milestones`, and
assign every filed ticket to it with `gitea-issues`.
## Report
Links to the docs PR, the spec, the milestone and the tickets.
+45
View File
@@ -0,0 +1,45 @@
---
description: Execute the plan in context with subagents — implement, clean-context review, push, PR, watch CI, report
disable-model-invocation: true
---
Execute the plan already in this conversation. If there is no plan in context, stop and ask for one.
You are the orchestrator. Delegate the work to subagents and keep your own context lean: give each
subagent a tight brief and take back only its conclusion. Do not narrate to the user between steps.
Speak to the user only to stop and ask (see below) or to give the final report.
## Loop
1. **Implement** — dispatch subagents for the plan's steps. Run them in parallel when they touch
different files and sequentially when they depend on each other or share files. Tell them to use
the repo's relevant skills (for example `git-commits`) and to follow its AGENTS.md. If you are on
the default branch, create a feature branch first.
2. **Review** — dispatch a fresh subagent with no inherited context. Give it the plan and the
diff against the base branch, not the implementers' summaries. Ask it for blocking and
non-blocking findings.
3. Blocking findings → send them to implementer subagents, then review again with a new
clean-context subagent. Cap: 3 implement→review rounds, then stop and ask.
4. **Push and PR** — push the feature branch and open a PR (use the `gitea-prs` skill on Gitea
remotes). Invoking `/ship` authorizes these: creating the branch, commits, normal pushes to it,
and opening or updating the PR.
5. **Watch CI** — without filling your context: either run a background poll you write on the spot
(every 120 s, exits when CI finishes, never saved to the repo or committed) or dispatch a
subagent to do the polling. If CI fails, a fix subagent diagnoses and fixes it, you push, and you
watch again. Cap: 3 CI fix rounds, then stop and ask.
6. **Finish** — when CI is green, update the PR title and description if they no longer match the
change.
## Stop and ask when
- the plan is ambiguous or the work would go outside the plan's scope
- a finding needs a design decision
- a secret or credential turns up
- a round cap is hit
- an action is irreversible beyond the authorization above: force-push, push to the default branch,
merge, or delete. Never merge.
## Final report
Short: PR link, what changed, number of review rounds, CI result, and open notes or non-blocking
findings.
@@ -0,0 +1,38 @@
---
name: plan-track
description: >-
Use when planning must recommend or confirm a track for a ticket or idea: spec and tickets,
ticket(s) only, or wayfinder. Not writing the spec -> `to-spec`. Not breaking work into
tickets -> `to-tickets`.
metadata:
version: "0.2.0"
category: planning
---
# Plan track
Recommend one track, with a one-sentence reason.
## Tracks
- **Spec and tickets**: a spec issue in the tracker, broken down into tickets.
- **Ticket(s) only**: one or more tickets with no spec.
- **Wayfinder**: a map of the work, explored ticket by ticket. The user runs `/wayfinder`
themselves; never invoke it.
## Pick wayfinder when any holds
- The work is too large for one agent session.
- It has decisions that cannot be settled yet.
## Otherwise, pick spec and tickets when any holds
- The work needs more than one ticket that depends on another.
- It makes a decision that downstream tickets must share.
- It touches more than one plugin or subsystem.
Otherwise pick ticket(s) only.
## Output
`track: <spec-and-tickets|tickets-only|wayfinder> | reason: <one sentence>`
+61
View File
@@ -0,0 +1,61 @@
name: plan
version: 0.5.0
description: Turning a ticket or idea into a validated, researched spec and agent-ready tickets, with the user in the loop; temporarily also ships /ship to execute a plan.
author:
name: Mortis
url: https://git.rkdr.net/Mortis/
license: MIT
homepage: https://git.rkdr.net/Mortis/Holocron/src/branch/main/plugins/plan
repository: https://git.rkdr.net/Mortis/Holocron/src/branch/main/plugins/plan
keywords:
- planning
- spec
- tickets
- research
- grilling
- documentation
# Constrains what .apm/ may contain: instructions, skill, hybrid, or prompts
type: hybrid
# Which agent platforms to deploy to.
# Resolution order: --target flag > this field > auto-detect from filesystem.
# Accepted values: agent-skills, antigravity, claude, codex, copilot, cursor, gemini, grok-build, kiro, opencode, windsurf
targets:
- claude
- copilot
- codex
includes: auto
# Upstream planning skills from github.com/mattpocock/skills (MIT), moved here
# from plugins/mattpocock: grilling, research, domain modelling, prototyping,
# codebase design, wayfinder, and the spec, ticket and triage skills. They are
# string pins because a third-party repo cannot be listed in the marketplace
# directly (ADR-0026), and the boundary resolver reads them as routing targets
# (ADR-0029, ADR-0031).
#
# Pinned on purpose, at the same tag as plugins/mattpocock: both packages pull
# from one upstream revision, so bump every tag in both files together.
#
# `setup-matt-pocock-skills` is pinned in both packages. It writes the tracker
# doc that wayfinder, to-spec, to-tickets and triage read here, and that
# code-review and implement-spec read there. apm dedupes the identical pin.
dependencies:
apm:
- mattpocock/skills/skills/engineering/wayfinder#v1.3.2
- mattpocock/skills/skills/productivity/grilling#v1.3.2
- mattpocock/skills/skills/productivity/grill-me#v1.3.2
- mattpocock/skills/skills/engineering/grill-with-docs#v1.3.2
- mattpocock/skills/skills/engineering/domain-modeling#v1.3.2
- mattpocock/skills/skills/engineering/research#v1.3.2
- mattpocock/skills/skills/engineering/prototype#v1.3.2
- mattpocock/skills/skills/engineering/codebase-design#v1.3.2
- mattpocock/skills/skills/engineering/triage#v1.3.2
- mattpocock/skills/skills/engineering/to-spec#v1.3.2
- mattpocock/skills/skills/engineering/to-tickets#v1.3.2
- mattpocock/skills/skills/engineering/setup-matt-pocock-skills#v1.3.2
mcp: []
devDependencies:
apm: []
scripts: {}
+223
View File
@@ -0,0 +1,223 @@
# plan plugin — outline
Status: outline, refined in a first grilling round, with a bare-bones MVP built (see "What ships
today"). This is the maintainer's intent for the plugin.
The plugin is set up on its own, separate from `delivery`, and is meant to grow on its own first.
How the two connect is deliberately left open (see "Open for later").
## Purpose
Cover picking up a new ticket or idea and turning it into a spec and a ticket breakdown that
agents further down the chain (planning or implementation) can act on with the least extra
context gathering.
The goal is to optimise:
- the ticket creation process;
- context management and agent instructions for downstream agents, including the context and
instructions written into issues;
- reuse of the context that already exists (repo, tracker, docs) and of online sources.
## Sources to consult
- **The repo and its context**: current practices, rules, functionality, patterns and
conventions.
- **The internet and other sources**: tools, documentation, best practices, examples and
standards.
## Tracks
The work takes one of three tracks:
- **Spec and tickets**: a spec issue in the tracker, broken down into tickets.
- **Ticket(s) only**: one or more tickets with no spec.
- **Wayfinder**: work too large for one agent session, or with decisions that cannot be settled
yet.
The plugin recommends a track, with its reason, after the initial grilling (step 2). For the first
two tracks the user confirms it at agreement (step 6), because the plan can change the size of the
work. Wayfinder is different: it is confirmed right after step 2. `/plan` then gives the user a
copyable `/wayfinder` command (hand-invoked) carrying the intent and the grilling answers, and
stops. Steps 3-10 are skipped.
## Interaction flow
0. **Entry.** There are three ways in, and all of them continue at step 1:
- an existing ticket;
- a new idea, as free text;
- a ticket picked through `/next`.
1. **Gate.** A cheap check before any grilling: is it a duplicate of an open issue or PR, is it
already done, does it contradict an ADR, or is it outside the repo's scope (`docs/VISION.md`)?
If any of these is true, stop.
2. **Initial grilling**, only if required, to explore the ticket's or idea's intention. It uses
`grilling`, plus `domain-modeling` to challenge terms only. GLOSSARY.md and the ADRs are not
edited during grilling: candidates are collected and written in step 7. This equals
`grill-with-docs` minus the writing during grilling (`grill-me` and `grill-with-docs` are
hand-invoked wrappers). It ends with a recommended track.
3. **Research** in the repo and online, scoped to the recommended track. Researchers flag when
lasting reference docs for an external tool or library are needed. Nothing is written in this
step.
4. **Deep validation.** Check that the work is feasible and fits the repo as it is now. If it does
not, go back to grilling (step 2) or stop.
5. **Offer a plan** with options, considerations, recommendations, impact, expected results and
the track. `codebase-design` is used only when the options change module or interface shape.
The plan also lists the repo docs needed for downstream context.
6. **Agreement.** The user agrees and confirms the track, or the flow goes back to grilling or
research.
7. **Record decisions.** Open a docs PR that updates AGENTS.md, GLOSSARY.md, the ADRs and any
other relevant docs with what was decided. The spec links to it, so tickets point at decisions
that are already written down rather than pending. After `plan-recorder` opens the docs PR,
if step 5 listed docs, `/plan` gives copyable `/write-docs` and `/research-docs` commands,
only the ones that apply, for the user to run on the docs branch and push to the same PR. When
`research-docs` topics were listed, `/plan` first asks the user for its output path. Both need
the user in the loop, so they cannot run inside a subagent.
8. **Write the spec** as an issue in the tracker (Gitea included). This step runs on the spec and
tickets track only. The spec issue never carries `Status/Ready for Agent`; `/plan` strips the
one `/to-spec` sets.
9. **Propose a breakdown** into tickets. If the breakdown shows a gap in the spec, go back to
step 8.
10. **Approval and filing.** One explicit approval covers the whole batch. The plugin files the
tickets and sets `Status/Ready for Agent` on the ones that carry acceptance criteria. A
ticket without acceptance criteria is never set ready. `gitea-labels-milestones` resolves the
label IDs for the Ready-for-Agent strip. On the spec track it also creates the
`Spec: <title>` milestone, and `gitea-issues` assigns the filed tickets to it.
Every command `/plan` asks the user to run is presented as a copyable code block.
### Loops
The flow is a loop, not a straight line. The named loop-backs are:
- research → grilling (step 3 or 4 back to 2);
- disagreement → grilling or research (step 6 back to 2 or 3);
- breakdown → spec (step 9 back to 8).
Wayfinder is an early exit rather than a loop: it ends the flow after step 2.
After two loops on the same point, the plugin asks whether to park the idea instead of
circling.
### Sequence diagram
```mermaid
sequenceDiagram
autonumber
actor U as User
participant P as plan (orchestrator)
participant R as Repo<br/>(AGENTS.md, ADRs, VISION, code)
participant W as Web / docs
participant T as Tracker (Gitea)
%% Step 0 — Entry
alt existing ticket
U->>P: ticket #N
P->>T: read issue
else new idea
U->>P: free text
else via /next
U->>P: /next [metric]
P->>T: rank open issues
P-->>U: ranked list
U->>P: pick one
end
%% Step 1 — Gate
P->>T: duplicate open issue/PR? already done?
P->>R: contradicts an ADR? outside VISION scope?
opt any gate hit
P-->>U: stop, with reason
end
%% Steps 2–6 — the discovery loop
loop until agreed (after 2 loops on one point, offer to park)
opt intent unclear
P->>U: grilling questions (step 2)
U-->>P: answers
end
P-->>U: recommended track + reason
opt track = wayfinder (confirmed here, not at step 6)
U->>P: confirm wayfinder
P-->>U: copyable /wayfinder command (intent + grilling answers)
Note over P,U: stop, steps 3-10 skipped
end
par Research (step 3), scoped to track
P->>R: practices, patterns, conventions
and
P->>W: tools, docs, standards, examples
end
P->>R: deep validation: feasible, fits repo now? (step 4)
alt doesn't fit
P-->>U: back to grilling, or stop
else fits
P-->>U: plan: options, impact, results, track (step 5)
alt user agrees and confirms track (step 6)
U->>P: agree + track
else disagreement
U->>P: back to grilling or research
end
end
end
%% Step 7 — Record decisions
P->>T: open docs PR (AGENTS.md, GLOSSARY, ADRs)
P-->>U: copyable /write-docs and /research-docs commands
U->>T: run on the docs branch, push to the same PR
%% Steps 8–9 — Spec and breakdown
loop until breakdown shows no spec gap
opt track = spec + tickets
P->>T: write/update spec issue, link docs PR (step 8)
end
P-->>U: proposed ticket breakdown (step 9)
end
%% Step 10 — Approval and filing
U->>P: one approval for the whole batch
opt track = spec + tickets
P->>T: create milestone "Spec: <title>"
end
P->>T: file tickets (assigned to the milestone on the spec track)
P->>T: set Status/Ready for Agent<br/>(only tickets with acceptance criteria)
P-->>U: links to spec, tickets, docs PR
```
## What ships today
- `.apm/prompts/next.prompt.md`: the `/next` command. It ranks open issues by a metric, lets the
user pick one, validates it and presents a plan. It is read-only. Building happens through
`/ship`.
- `.apm/prompts/ship.prompt.md`: the `/ship` command. It executes the plan in context with
subagents: implement, review with a clean context, push, open a PR, watch CI. **This is
temporary.** Implementation does not belong in this plugin long term. It ships here so `/next`
has a working handoff until implementation has a home.
- `.apm/prompts/plan.prompt.md`: the `/plan` command, the MVP orchestrator for steps 0–10. It
dispatches the agents below and wires in existing skills at the step where each fits: `grilling`
with `domain-modeling` (no edits during grilling) and `plan-track` in step 2, including the
wayfinder early exit; `codebase-design` in step 5; and `gitea-labels-milestones` and
`gitea-issues` in steps 8–10 for the Ready-for-Agent strip and the `Spec:` milestone with ticket
assignment. Hand-invoked commands (`/wayfinder`, `/to-spec`, `/to-tickets`) and user-run ones
(`/write-docs`, `/research-docs`) are given to the user as copyable code blocks, and the user
running them is the approval.
- `.apm/agents/`: `plan-gate` (step 1), `plan-researcher` (step 3), `plan-validator` (step 4),
read-only (the researcher may write only to the scratchpad), and `plan-recorder` (step 7, the docs PR).
- `.apm/skills/plan-track/`: the track criteria for all three tracks, `wayfinder` included.
All of these are minimal stubs, to be built out. The prompt and agents route to `gitea-issues`,
`gitea-labels-milestones`, `gitea-prs`, `git-commits` and `agentsmd-author`, which `plan` does not
declare as dependencies: it assumes the `gitea`, `git` and `core` packages are installed.
`research-docs` and `write-docs` both ship in `plan`. `write-docs` moved from `bin` in `plan`
0.5.0 (`bin` 4.0.0 to 5.0.0).
## Open for later
- How plan hands off to `delivery`, and how the two plugins relate. Today `delivery` says only a
human sets `Status/Ready for Agent`, while plan may set it (step 10). When the two meet, one
of those rules has to change.
- Templates for the spec and tickets. Plan will own them.
- Where research output goes: folded into the spec, or kept as findings files.
- Whether the tracker issue carries the session's state, so planning can be resumed across
sessions.
+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':
+425 -10
View File
@@ -2,9 +2,11 @@
# Tests for plugins/kyberforge/.apm/hooks/check-apm-current.sh — the SessionStart
# hook that keeps an apm-consumed install level with its remote.
#
# `apm` is mocked throughout: the hook's contract is "read `apm outdated`, decide,
# emit SessionStart JSON", and that is testable without a network or a real
# install.
# `apm` and `uv` are mocked throughout (seam A: fake binaries first on PATH,
# asserting on exit code and stdout, plus the fakes' own call logs): the hook's
# contract is "pick the apm, read `apm outdated`, decide, emit SessionStart
# JSON", and that is testable without a network or a real install. The real
# apm appears once, at the end, to pin the phrase the hook greps for.
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -31,12 +33,15 @@ GIT_CEILING_DIRECTORIES="$(dirname "$WORK")"
# `apm update`. Sentinel files record whether update was actually invoked and
# which directory the calls ran in — the hook must run them against the same
# directory its lockfile guard checked, not the session's cwd.
# `apm --version` answers 0.39.3 unless $3 says otherwise: the hook skips the
# outdated check on anything older than 0.39.2 (ADR-0034).
make_apm() {
local outdated_line="$1" update_exit="$2"
local outdated_line="$1" update_exit="$2" version="${3:-0.39.3}"
cat > "$FAKE_BIN/apm" << EOF
#!/usr/bin/env bash
pwd > "$WORK/apm-cwd"
case "\$1" in
--version) echo "Agent Package Manager (APM) CLI version $version"; exit 0 ;;
outdated) echo "$outdated_line"; exit 0 ;;
update) touch "$WORK/update-was-called"; exit $update_exit ;;
esac
@@ -291,6 +296,414 @@ out="$(run_hook_in "$ELSEWHERE" "$ELSEWHERE")"; rc=$?
&& pass "does not run apm update when there is no lockfile anywhere" \
|| fail "must not touch a project that does not use apm"
# ---------------------------------------------------------------------------
echo ""
echo "--- which apm: repo-pinned uv, else PATH, else nothing (ADR-0034) ---"
# ---------------------------------------------------------------------------
# Seam A: every binary the hook may call is a fake first on a PATH that holds
# nothing else of interest. The machine's real uv and apm must not leak into
# these cases — a real uv would make "pin but no uv" untestable — so PATH is
# built from a whitelist of the system tools the hook and the fakes need.
TOOLS="$(mktemp -d)"
UV_BIN="$(mktemp -d)"
PIN_BIN="$(mktemp -d)"
PATH_APM_BIN="$(mktemp -d)"
PINNED="$(mktemp -d)"
trap 'rm -rf "$FAKE_BIN" "$WORK" "$TOOLS" "$UV_BIN" "$PIN_BIN" "$PATH_APM_BIN" "$PINNED" "${PROBE:-}"' EXIT
for tool in bash grep git cat touch head; do
src="$(command -v "$tool" || true)"
[[ -n "$src" ]] && ln -s "$src" "$TOOLS/$tool"
done
# A fake `timeout` that drops its duration and runs the command unbounded, so
# the suite does not need coreutils (stock macOS has no `timeout`). The real
# bound is the hook's business; these cases only need it to resolve one.
TIMEOUT_SHIM="$TOOLS/timeout"
printf '#!/usr/bin/env bash\nshift\nexec "$@"\n' > "$TIMEOUT_SHIM"
chmod +x "$TIMEOUT_SHIM"
# A fake apm at $1 that records, under $2, which phases ran. $3 is the
# `apm outdated` line, $4 the `apm update` exit code, $5 the version string.
make_fake_apm() {
local bin_dir="$1" tag="$2" outdated_line="$3" update_exit="$4" version="$5"
cat > "$bin_dir/apm" << EOF
#!/usr/bin/env bash
echo "\$*" >> "$WORK/$tag-calls"
case "\$1" in
--version) printf '%s\n' "$version"; exit 0 ;;
outdated) cat "$WORK/$tag-outdated.txt"; exit 0 ;;
update) exit $update_exit ;;
esac
exit 0
EOF
printf '%s\n' "$outdated_line" > "$WORK/$tag-outdated.txt"
chmod +x "$bin_dir/apm"
}
# The fake uv logs every invocation verbatim and only knows `run`: anything
# else exits 2. For `run` it skips uv's own options up to the `apm` argument
# and execs the pinned fake apm, which is NOT on PATH — so the pinned apm is
# reachable only through `uv run`.
cat > "$UV_BIN/uv" << EOF
#!/usr/bin/env bash
printf '%s\n' "\$*" >> "$WORK/uv-calls"
[[ "\${1:-}" == run ]] || exit 2
[[ -f "$WORK/uv-run-fails" ]] && exit 1
shift
while [[ \$# -gt 0 && "\$1" != apm ]]; do
case "\$1" in --project) shift 2 ;; *) shift ;; esac
done
[[ "\${1:-}" == apm ]] || exit 2
shift
exec "$PIN_BIN/apm" "\$@"
EOF
chmod +x "$UV_BIN/uv"
# The pin: a pyproject.toml naming apm-cli plus a uv.lock, as ADR-0034 lays out.
cat > "$PINNED/pyproject.toml" << 'EOF'
[project]
name = "consumer"
version = "0"
requires-python = ">=3.11"
[tool.uv]
package = false
[dependency-groups]
dev = ["apm-cli==0.39.3"]
EOF
touch "$PINNED/uv.lock" "$PINNED/apm.lock.yaml"
# A synced project environment. Without one the hook must not call uv at all.
mkdir -p "$PINNED/.venv"
STALE="[!] 4 outdated dependencies found"
CURRENT="[*] All dependencies are up-to-date"
V_NEW="Agent Package Manager (APM) CLI version 0.39.3"
reset_calls() { rm -f "$WORK"/uv-calls "$WORK"/pin-calls "$WORK"/path-calls; }
calls_of() { cat "$WORK/$1-calls" 2>/dev/null || true; }
# $1: space-separated PATH components drawn from uv, apm. Always ends in TOOLS.
run_pinned() {
local p="" part
for part in $1; do
case "$part" in
uv) p+="$UV_BIN:" ;;
apm) p+="$PATH_APM_BIN:" ;;
esac
done
(cd "$PINNED" && env -u CLAUDE_PROJECT_DIR -u UV_PROJECT_ENVIRONMENT PATH="${p}${RUN_TOOLS:-$TOOLS}" bash "$HOOK" 2>/dev/null)
}
ctx_of() { json_field additionalContext <<< "$1" 2>/dev/null || true; }
# Every recorded uv call must be `uv run` against the project, frozen, and with
# syncing off: a SessionStart hook must never install into the environment.
assert_uv_calls_run_only() {
local label="$1" n=0 bad=0 line
while IFS= read -r line; do
[[ -n "$line" ]] || continue
n=$((n + 1))
[[ "$line" == "run "* ]] || bad=1
[[ " $line " == *" sync "* ]] && bad=1
[[ " $line " == *" --frozen "* && " $line " == *" --no-sync "* && " $line " == *" --offline "* ]] || bad=1
[[ " $line " == *" --project $PINNED "* ]] || bad=1
done < <(calls_of uv)
if [[ $n -eq 0 ]]; then
fail "$label: expected uv to be called at least once, it was not"
elif [[ $bad -eq 0 ]]; then
pass "$label: all $n uv call(s) are \`uv run --project <root> --frozen --no-sync --offline\`, none is a sync"
else
fail "$label: uv was called with something other than a frozen no-sync \`run\`: $(tr '\n' '|' <<< "$(calls_of uv)")"
fi
}
# --- pin plus uv: uses `uv run`, for both the check and the update ---
make_fake_apm "$PIN_BIN" pin "$STALE" 1 "$V_NEW"
make_fake_apm "$PATH_APM_BIN" path "$STALE" 1 "$V_NEW"
reset_calls
out="$(run_pinned "uv apm")"; rc=$?
[[ $rc -eq 0 ]] && pass "pin + uv: exits 0" || fail "pin + uv: exit $rc"
grep -q "^outdated" <<< "$(calls_of pin)" && grep -q "^update" <<< "$(calls_of pin)" \
&& pass "pin + uv: runs the outdated check and the update through \`uv run\`" \
|| fail "pin + uv: the pinned apm should see outdated and update, saw: $(calls_of pin | tr '\n' '|')"
[[ -z "$(calls_of path)" ]] && pass "pin + uv: never touches the PATH apm" \
|| fail "pin + uv: PATH apm was called: $(calls_of path | tr '\n' '|')"
grep -qF "Run: uv run apm update --yes" <<< "$(ctx_of "$out")" \
&& pass "pin + uv: the failed-refresh advice names \`uv run apm\`" \
|| fail "pin + uv: advice should name uv run apm: $(ctx_of "$out")"
assert_uv_calls_run_only "pin + uv, stale"
# --- stale and current on the uv path ---
make_fake_apm "$PIN_BIN" pin "$STALE" 0 "$V_NEW"
reset_calls
out="$(run_pinned "uv")"
[[ "$(json_field reloadSkills <<< "$out" 2>/dev/null)" == "True" ]] \
&& grep -q "4 package" <<< "$(ctx_of "$out")" \
&& pass "uv path, stale: refreshes and reports the count" \
|| fail "uv path, stale: expected a successful-refresh notice, got: $out"
assert_uv_calls_run_only "uv path, stale"
make_fake_apm "$PIN_BIN" pin "$CURRENT" 0 "$V_NEW"
reset_calls
out="$(run_pinned "uv")"; rc=$?
[[ $rc -eq 0 && -z "$out" ]] && pass "uv path, current: silent, exit 0" \
|| fail "uv path, current: expected silence, got rc=$rc: $out"
grep -q "^update" <<< "$(calls_of pin)" && fail "uv path, current: must not update" \
|| pass "uv path, current: does not update"
assert_uv_calls_run_only "uv path, current"
# A feature branch's discard advice names the binary that will reinstall.
git -C "$PINNED" init -q -b main
git -C "$PINNED" -c user.email=[email protected] -c user.name=probe commit -q --allow-empty -m init
git -C "$PINNED" update-ref refs/remotes/origin/main HEAD
git -C "$PINNED" symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
git -C "$PINNED" checkout -q -b feature/y
make_fake_apm "$PIN_BIN" pin "$STALE" 0 "$V_NEW"
reset_calls
out="$(run_pinned "uv")"
grep -qF "git checkout -- apm.lock.yaml && uv run apm install" <<< "$(ctx_of "$out")" \
&& pass "uv path, feature branch: the discard advice names \`uv run apm install\`" \
|| fail "uv path, feature branch: advice should name uv run apm install: $(ctx_of "$out")"
rm -rf "$PINNED/.git"
# --- pinned apm too old (an unsynced env falls through to an old apm) ---
make_fake_apm "$PIN_BIN" pin "$CURRENT" 0 "Agent Package Manager (APM) CLI version 0.28.0"
reset_calls
out="$(run_pinned "uv")"; rc=$?
[[ $rc -eq 0 ]] && pass "uv path, apm 0.28.0: exits 0" || fail "uv path, apm 0.28.0: exit $rc"
grep -q "^outdated" <<< "$(calls_of pin)" && fail "uv path, apm 0.28.0: ran the outdated check on a too-old apm" \
|| pass "uv path, apm 0.28.0: runs no outdated check"
grep -qF "\`uv run apm\` is older than apm 0.39.2" <<< "$(ctx_of "$out")" \
&& grep -qF "Run: uv sync --frozen" <<< "$(ctx_of "$out")" \
&& pass "uv path, apm 0.28.0: prints the fixed too-old line naming \`uv run apm\`" \
|| fail "uv path, apm 0.28.0: expected the uv too-old line, got: $out"
assert_uv_calls_run_only "uv path, too old"
# --- pin but no uv: falls back to the PATH apm ---
make_fake_apm "$PIN_BIN" pin "$STALE" 0 "$V_NEW"
make_fake_apm "$PATH_APM_BIN" path "$STALE" 1 "$V_NEW"
reset_calls
out="$(run_pinned "apm")"; rc=$?
[[ $rc -eq 0 ]] && pass "pin, no uv: exits 0" || fail "pin, no uv: exit $rc"
grep -q "^outdated" <<< "$(calls_of path)" && grep -q "^update" <<< "$(calls_of path)" \
&& pass "pin, no uv: falls back to the PATH apm for the check and the update" \
|| fail "pin, no uv: PATH apm should run, saw: $(calls_of path | tr '\n' '|')"
[[ -z "$(calls_of pin)" ]] && pass "pin, no uv: the pinned apm is not reached" \
|| fail "pin, no uv: pinned apm ran without uv"
ctx="$(ctx_of "$out")"
grep -qF "Run: apm update --yes" <<< "$ctx" && ! grep -qF "uv run" <<< "$ctx" \
&& pass "pin, no uv: advice names the bare \`apm\`, not \`uv run apm\`" \
|| fail "pin, no uv: advice should name apm only: $ctx"
# --- pin declared but no uv.lock: `--frozen` has nothing to run from ---
rm -f "$PINNED/uv.lock"
reset_calls
out="$(run_pinned "uv apm")"
[[ -z "$(calls_of uv)" ]] && grep -q "^outdated" <<< "$(calls_of path)" \
&& pass "pin without uv.lock: does not call uv, uses the PATH apm" \
|| fail "pin without uv.lock: expected PATH apm only, uv saw: $(calls_of uv | tr '\n' '|')"
touch "$PINNED/uv.lock"
# --- no pin, with a PATH apm: uv on PATH is ignored ---
mv "$PINNED/pyproject.toml" "$PINNED/pyproject.toml.off"
make_fake_apm "$PATH_APM_BIN" path "$STALE" 0 "$V_NEW"
reset_calls
out="$(run_pinned "uv apm")"
[[ -z "$(calls_of uv)" ]] && pass "no pin: never calls uv even when it is on PATH" \
|| fail "no pin: uv was called: $(calls_of uv | tr '\n' '|')"
grep -q "^update" <<< "$(calls_of path)" && [[ "$(json_field reloadSkills <<< "$out" 2>/dev/null)" == "True" ]] \
&& pass "no pin, PATH path, stale: refreshes through the PATH apm" \
|| fail "no pin, PATH path, stale: expected a refresh via PATH apm, got: $out"
make_fake_apm "$PATH_APM_BIN" path "$CURRENT" 0 "$V_NEW"
reset_calls
out="$(run_pinned "uv apm")"; rc=$?
[[ $rc -eq 0 && -z "$out" ]] && ! grep -q "^update" <<< "$(calls_of path)" \
&& pass "no pin, PATH path, current: silent, no update" \
|| fail "no pin, PATH path, current: expected silence, got rc=$rc: $out"
# A pyproject.toml that does not mention apm-cli is not a pin.
printf '[project]\nname = "other"\ndependencies = ["apm-client-lib>=1"]\n' > "$PINNED/pyproject.toml"
make_fake_apm "$PATH_APM_BIN" path "$CURRENT" 0 "$V_NEW"
reset_calls
run_pinned "uv apm" > /dev/null
[[ -z "$(calls_of uv)" ]] && pass "a pyproject.toml without apm-cli is not read as a pin" \
|| fail "apm-client-lib was mistaken for an apm-cli pin"
rm -f "$PINNED/pyproject.toml"
mv "$PINNED/pyproject.toml.off" "$PINNED/pyproject.toml"
# --- no apm at all (the pin is present, uv and apm are not): silent, exit 0 ---
reset_calls
out="$(run_pinned "")"; rc=$?
[[ $rc -eq 0 && -z "$out" ]] && pass "no uv, no apm: silent, exit 0" \
|| fail "no uv, no apm: expected silence, got rc=$rc: $out"
# --- PATH apm below 0.39.2: fixed too-old line, no outdated check ---
for v in 0.28.0 0.39.1 "no version here"; do
make_fake_apm "$PATH_APM_BIN" path "$STALE" 0 "Agent Package Manager (APM) CLI version $v"
want="\`apm\` on PATH is older than apm 0.39.2"
if [[ "$v" == "no version here" ]]; then
make_fake_apm "$PATH_APM_BIN" path "$STALE" 0 "$v"
want="Could not read the version of \`apm\` on PATH"
fi
reset_calls
out="$(run_pinned "apm")"; rc=$?
ctx="$(ctx_of "$out")"
if [[ $rc -eq 0 ]] && ! grep -qE "^(outdated|update)" <<< "$(calls_of path)" \
&& grep -qF "$want" <<< "$ctx" \
&& [[ "$(json_field reloadSkills <<< "$out" 2>/dev/null)" == "False" ]]; then
pass "PATH apm reporting '$v': fixed notice ($want), no outdated check, no update"
else
fail "PATH apm reporting '$v': expected the too-old line and no outdated call; rc=$rc calls=$(calls_of path | tr '\n' '|') out=$out"
fi
done
grep -qF "uv run" <<< "$ctx" && fail "PATH too-old line must not name uv run: $ctx" \
|| pass "PATH too-old line names the bare apm only"
# The boundary is inclusive: 0.39.2 is new enough, and so is a later minor.
for v in 0.39.2 0.40.0 1.0.0; do
make_fake_apm "$PATH_APM_BIN" path "$STALE" 0 "Agent Package Manager (APM) CLI version $v"
reset_calls
run_pinned "apm" > /dev/null
grep -q "^outdated" <<< "$(calls_of path)" \
&& pass "PATH apm $v: new enough, runs the outdated check" \
|| fail "PATH apm $v: should be accepted as new enough"
done
# --- pin and uv, but no project environment: never call uv ---
# `uv run --no-sync` would create an empty .venv in the consumer's repo.
rm -rf "$PINNED/.venv"
make_fake_apm "$PIN_BIN" pin "$STALE" 0 "$V_NEW"
make_fake_apm "$PATH_APM_BIN" path "$STALE" 0 "$V_NEW"
reset_calls
out="$(run_pinned "uv apm")"; rc=$?
[[ $rc -eq 0 ]] && grep -qF "its environment has not been synced" <<< "$(ctx_of "$out")" \
&& grep -qF "Run: uv sync --frozen" <<< "$(ctx_of "$out")" \
&& pass "pin + uv, no .venv: prints the fixed not-synced notice" \
|| fail "pin + uv, no .venv: expected the not-synced notice, got rc=$rc: $out"
[[ -z "$(calls_of uv)" && -z "$(calls_of path)" ]] \
&& pass "pin + uv, no .venv: calls neither uv nor the PATH apm" \
|| fail "pin + uv, no .venv: uv saw '$(calls_of uv | tr '\n' '|')', PATH apm saw '$(calls_of path | tr '\n' '|')'"
[[ ! -e "$PINNED/.venv" ]] && pass "pin + uv, no .venv: creates no .venv" \
|| fail "pin + uv, no .venv: a .venv appeared in the project"
# UV_PROJECT_ENVIRONMENT relocates the environment; an existing one there counts.
ALT_ENV="$WORK/alt-env"
mkdir -p "$ALT_ENV"
reset_calls
out="$(cd "$PINNED" && env -u CLAUDE_PROJECT_DIR UV_PROJECT_ENVIRONMENT="$ALT_ENV" PATH="$UV_BIN:$TOOLS" bash "$HOOK" 2>/dev/null)"
grep -q "^outdated" <<< "$(calls_of pin)" \
&& pass "UV_PROJECT_ENVIRONMENT pointing at an existing env: takes the uv path" \
|| fail "UV_PROJECT_ENVIRONMENT should satisfy the environment check, got: $out"
reset_calls
out="$(cd "$PINNED" && env -u CLAUDE_PROJECT_DIR UV_PROJECT_ENVIRONMENT="$WORK/no-such-env" PATH="$UV_BIN:$TOOLS" bash "$HOOK" 2>/dev/null)"
[[ -z "$(calls_of uv)" ]] && grep -qF "has not been synced" <<< "$(ctx_of "$out")" \
&& pass "UV_PROJECT_ENVIRONMENT pointing at nothing: not-synced notice, no uv call" \
|| fail "UV_PROJECT_ENVIRONMENT pointing at nothing should not call uv, got: $out"
mkdir -p "$PINNED/.venv"
# --- pin and uv, but `uv run` itself fails ---
for how in "uv run exits non-zero" "no pinned apm to exec"; do
make_fake_apm "$PIN_BIN" pin "$STALE" 0 "$V_NEW"
if [[ "$how" == "uv run exits non-zero" ]]; then touch "$WORK/uv-run-fails"; else rm -f "$PIN_BIN/apm"; fi
reset_calls
out="$(run_pinned "uv")"; rc=$?
ctx="$(ctx_of "$out")"
[[ $rc -eq 0 ]] && grep -qF "Could not read the version of \`uv run apm\` (it failed or timed out)" <<< "$ctx" \
&& grep -qF "or run: uv sync --frozen" <<< "$ctx" \
&& ! grep -qF "not synced" <<< "$ctx" \
&& pass "pin + uv, $how: exits 0 with the fixed unreadable-version notice, not the not-synced one" \
|| fail "pin + uv, $how: expected the unreadable-version notice, got rc=$rc: $out"
assert_uv_calls_run_only "pin + uv, $how"
rm -f "$WORK/uv-run-fails"
done
# --- no timeout binary: nothing can be bounded, so stay silent ---
NO_TO="$WORK/tools-no-timeout"
G_TO="$WORK/tools-gtimeout"
mkdir -p "$NO_TO" "$G_TO"
for tool in bash grep git cat touch head; do
[[ -e "$TOOLS/$tool" ]] && ln -s "$(readlink "$TOOLS/$tool")" "$NO_TO/$tool" && ln -s "$(readlink "$TOOLS/$tool")" "$G_TO/$tool"
done
ln -s "$TIMEOUT_SHIM" "$G_TO/gtimeout"
make_fake_apm "$PATH_APM_BIN" path "$STALE" 0 "$V_NEW"
reset_calls
out="$(RUN_TOOLS="$NO_TO" run_pinned "apm")"; rc=$?
[[ $rc -eq 0 && -z "$out" && -z "$(calls_of path)" ]] \
&& pass "no timeout or gtimeout on PATH: silent, exit 0, apm not called" \
|| fail "no timeout binary: expected silence and no apm call, got rc=$rc calls=$(calls_of path | tr '\n' '|') out=$out"
# Chosen before the apm, so the uv path stays silent too: a pin with uv and no
# project environment would otherwise print its not-synced notice.
rm -rf "$PINNED/.venv"
reset_calls
out="$(RUN_TOOLS="$NO_TO" run_pinned "uv apm")"; rc=$?
[[ $rc -eq 0 && -z "$out" && -z "$(calls_of uv)" ]] \
&& pass "no timeout or gtimeout, pin + uv without .venv: still silent, uv not called" \
|| fail "no timeout binary on the uv path: expected silence, got rc=$rc out=$out"
mkdir -p "$PINNED/.venv"
reset_calls
out="$(RUN_TOOLS="$G_TO" run_pinned "apm")"
grep -q "^update" <<< "$(calls_of path)" && [[ "$(json_field reloadSkills <<< "$out" 2>/dev/null)" == "True" ]] \
&& pass "only gtimeout on PATH (Homebrew coreutils on macOS): uses it and refreshes" \
|| fail "gtimeout should stand in for timeout, got calls=$(calls_of path | tr '\n' '|') out=$out"
# --- PATH apm whose `--version` exits non-zero: unreadable, not too old ---
make_fake_apm "$PATH_APM_BIN" path "$STALE" 0 "$V_NEW"
cat > "$PATH_APM_BIN/apm" << EOF
#!/usr/bin/env bash
echo "\$*" >> "$WORK/path-calls"
case "\$1" in
--version) echo "$V_NEW"; exit 1 ;;
outdated) cat "$WORK/path-outdated.txt"; exit 0 ;;
esac
exit 0
EOF
reset_calls
mv "$PINNED/pyproject.toml" "$PINNED/pyproject.toml.off"
out="$(run_pinned "apm")"; rc=$?
ctx="$(ctx_of "$out")"
[[ $rc -eq 0 ]] && grep -qF "Could not read the version of \`apm\` on PATH (it failed or timed out)" <<< "$ctx" \
&& ! grep -qF "older than" <<< "$ctx" && ! grep -q "^outdated" <<< "$(calls_of path)" \
&& pass "PATH apm --version exits 1: unreadable-version notice, no outdated check" \
|| fail "PATH apm --version exits 1: expected the unreadable notice, got rc=$rc calls=$(calls_of path | tr '\n' '|') out=$out"
mv "$PINNED/pyproject.toml.off" "$PINNED/pyproject.toml"
# --- hostile command output never reaches the advice text ---
# Every advice string is a fixed literal; only a digit-checked count is
# spliced in. Output stuffed with ANSI escapes, command substitutions,
# backticks, separators and quotes must leave no trace in what is emitted.
HOSTILE=$'\e[31m[!] 7 outdated dependencies found\e[0m $(touch '"$WORK"'/pwned) `touch '"$WORK"'/pwned2`; rm -rf / ; "}]}\\ \x01'
for route in uv apm; do
if [[ "$route" == uv ]]; then
make_fake_apm "$PIN_BIN" pin "$HOSTILE" 1 "$V_NEW"$'\n\e[0m$(id) `id`;'
else
mv "$PINNED/pyproject.toml" "$PINNED/pyproject.toml.off"
make_fake_apm "$PATH_APM_BIN" path "$HOSTILE" 1 "$V_NEW"$'\n\e[0m$(id) `id`;'
fi
reset_calls
out="$(run_pinned "$route")"; rc=$?
ctx="$(ctx_of "$out")"
if [[ $rc -eq 0 ]] && echo "$out" | python3 -m json.tool > /dev/null 2>&1 && [[ -n "$ctx" ]]; then
pass "hostile output via $route: still exits 0 with valid JSON"
else
fail "hostile output via $route: rc=$rc, output not valid JSON: $(cat -v <<< "$out")"
fi
leaked=""
for needle in $'\e' '$(' 'pwned' 'rm -rf' '\\' $'\x01' '}]}' 'id`'; do
grep -qF -- "$needle" <<< "$out" && leaked+="[$needle]"
done
[[ -z "$leaked" ]] && pass "hostile output via $route: none of it reaches the emitted text" \
|| fail "hostile output via $route: leaked $(cat -v <<< "$leaked") into: $(cat -v <<< "$out")"
[[ ! -e "$WORK/pwned" && ! -e "$WORK/pwned2" ]] && pass "hostile output via $route: nothing in it was executed" \
|| fail "hostile output via $route: a substitution in apm's output was executed"
expected="apm install is 7 package(s) behind the remote default branch and the automatic refresh failed. Deployed skills and agents may be stale. Run: apm update --yes"
[[ "$route" == uv ]] && expected="${expected%apm update --yes}uv run apm update --yes"
[[ "$ctx" == "$expected" ]] \
&& pass "hostile output via $route: the notice is exactly the fixed literal plus the digit-checked count" \
|| fail "hostile output via $route: notice differs from the fixed literal: $(cat -v <<< "$ctx")"
[[ -f "$PINNED/pyproject.toml.off" ]] && mv "$PINNED/pyproject.toml.off" "$PINNED/pyproject.toml"
done
# ---------------------------------------------------------------------------
echo ""
echo "--- hooks.json wiring ---"
@@ -317,7 +730,8 @@ matcher="$(python3 -c 'import json,sys; d=json.load(open(sys.argv[1])); print(d[
# literal, so raising either internal `timeout` without raising the host budget
# fails here instead of reintroducing the gap quietly.
#
# Every `timeout N` in the script counts, comments included: a stray "timeout
# Every `timeout N` or `"$to" N` in the script counts (the hook resolves
# `timeout` or `gtimeout` into $to), comments included: a stray "timeout
# 300" in prose only makes this stricter, which is the safe direction.
script_budget=0
timeout_count=0
@@ -325,12 +739,12 @@ while read -r n; do
[[ -n "$n" ]] || continue
script_budget=$((script_budget + n))
timeout_count=$((timeout_count + 1))
done < <(grep -oE '\btimeout [0-9]+\b' "$HOOK" | grep -oE '[0-9]+')
done < <(grep -oE '(\btimeout|"\$to") [0-9]+\b' "$HOOK" | grep -oE '[0-9]+$')
hook_timeout="$(python3 -c 'import json,sys; d=json.load(open(sys.argv[1])); print(d["hooks"]["SessionStart"][0]["hooks"][0]["timeout"])' "$HOOKS_JSON")"
if [[ $timeout_count -eq 0 ]]; then
fail "found no 'timeout N' in $HOOK — the budget assertion below would be vacuous"
fail "found no 'timeout N' or '\"\$to\" N' in $HOOK — the budget assertion below would be vacuous"
else
pass "parsed $timeout_count internal timeout(s) totalling ${script_budget}s from the hook script"
[[ $hook_timeout -gt $script_budget ]] \
@@ -345,8 +759,8 @@ echo "--- the greped phrase, against the real apm ---"
# Everything above mocks `apm`, so an apm release that reworded its summary line
# would revert this hook to its pre-fix behaviour with a fully green suite.
# `apm outdated` has no --json/machine-readable flag (verified against 0.28.0),
# so the phrase match cannot be replaced — it can only be pinned.
# `apm outdated` has no --json/machine-readable flag (verified against 0.28.0
# and 0.39.3), so the phrase match cannot be replaced — it can only be pinned.
#
# The probe stages a genuinely outdated dependency with no network: a local git
# repo stands in for the upstream, reached through `url.<path>.insteadOf`
@@ -365,7 +779,7 @@ if ! command -v apm > /dev/null 2>&1 || ! command -v git > /dev/null 2>&1; then
echo " $SKIP_REASON"
else
PROBE="$(mktemp -d)"
trap 'rm -rf "$FAKE_BIN" "$WORK" "$PROBE"' EXIT
trap 'rm -rf "$FAKE_BIN" "$WORK" "$TOOLS" "$UV_BIN" "$PIN_BIN" "$PATH_APM_BIN" "$PINNED" "$PROBE"' EXIT
UPSTREAM="$PROBE/upstream.git"
git init -q "$UPSTREAM"
@@ -431,6 +845,7 @@ else
#!/usr/bin/env bash
pwd > "$WORK/apm-cwd"
case "\$1" in
--version) echo "Agent Package Manager (APM) CLI version 0.39.3"; exit 0 ;;
outdated) cat "$PROBE/genuine-$want.txt"; exit 0 ;;
update) touch "$WORK/update-was-called"; exit 0 ;;
esac
+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 ]]
+7 -7
View File
@@ -26,17 +26,17 @@ fail() { echo " FAIL: $1"; FAIL=$((FAIL + 1)); }
command -v python3 > /dev/null 2>&1 || { echo "SKIP: python3 is required to exercise the PyYAML reader"; exit 77; }
python3 -c 'import yaml' > /dev/null 2>&1 || { echo "SKIP: PyYAML is required to exercise the PyYAML reader"; exit 77; }
FIXTURES=()
cleanup() { [[ ${#FIXTURES[@]} -eq 0 ]] || rm -rf "${FIXTURES[@]}"; }
trap cleanup EXIT
# One root per run: fixture helpers run inside $(...) subshells, where an
# array append never reaches the parent's trap, so register the root instead.
RUN_TMP="$(mktemp -d)"
trap 'rm -rf "$RUN_TMP"' EXIT
# make_fixture <plugin-version-line> <root-executables-block>
# The executables block is passed verbatim (may be empty) so a fixture can omit
# it entirely, which is one of the failure modes under test.
make_fixture() {
local version_line="$1" executables_block="$2" dir
dir="$(mktemp -d)"
FIXTURES+=("$dir")
dir="$(mktemp -d "$RUN_TMP/fx.XXXXXX")"
# kyberforge ships both hooks and bin, which is what makes the gate check it.
mkdir -p "$dir/plugins/kyberforge/.apm/hooks" "$dir/plugins/kyberforge/bin"
@@ -196,7 +196,7 @@ run_gate "$REPO_ROOT/definitely-not-a-directory"
|| fail "a bad path must not exit 0 — that reads as 'checked, in sync'"
# No executable-shipping plugin at all is the one legitimate no-op: nothing to pin.
NO_PLUGIN="$(mktemp -d)"; FIXTURES+=("$NO_PLUGIN")
NO_PLUGIN="$(mktemp -d "$RUN_TMP/fx.XXXXXX")"
echo "name: someone-else" > "$NO_PLUGIN/apm.yml"
run_gate "$NO_PLUGIN"
[[ $GATE_RC -eq 0 ]] && pass "no-ops in a repo with no executable-shipping plugin" \
@@ -290,7 +290,7 @@ echo "--- the fallback reader agrees with the PyYAML reader ---"
# hook needs it), so the shape-scan fallback carries the same verdicts. Masking
# is done with a python3 stub whose `import yaml` fails, which is the exact
# condition on a machine that has python3 without PyYAML.
NO_YAML_BIN="$(mktemp -d)"; FIXTURES+=("$NO_YAML_BIN")
NO_YAML_BIN="$(mktemp -d "$RUN_TMP/fx.XXXXXX")"
printf '#!/usr/bin/env bash\nexit 1\n' > "$NO_YAML_BIN/python3"
chmod +x "$NO_YAML_BIN/python3"
+6 -9
View File
@@ -10,14 +10,12 @@ 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
# Per-run scratch for captured output, for the reason check-scope-walkup-sync's
# test gives: tests/run-tests.sh fans test scripts out concurrently.
# Per-run scratch for output and fixtures, for the reason check-scope-walkup-sync's
# test gives: tests/run-tests.sh fans test scripts out concurrently. Fixtures live
# under it because make_repo runs in a $(...) subshell, where an array append never
# reaches the parent's trap.
RUN_TMP="$(mktemp -d)"
FIXTURES+=("$RUN_TMP")
trap 'rm -rf "$RUN_TMP"' EXIT
# A minimal REPO_ROOT: a .git entry (the validator's find_repo_root stops at
# it), a copy of the real validator at its real relative path, and one plugin
@@ -25,8 +23,7 @@ FIXTURES+=("$RUN_TMP")
# exercise the actual FAIL/INFO/exit contract rather than a stub of it.
make_repo() {
local dir
dir="$(mktemp -d)"
FIXTURES+=("$dir")
dir="$(mktemp -d "$RUN_TMP/fx.XXXXXX")"
mkdir -p "$dir/.git" "$dir/$VALIDATOR_DIR" "$dir/plugins/p/docs/research/docs/t"
cp -R "$REPO_ROOT/$VALIDATOR_DIR/." "$dir/$VALIDATOR_DIR/"
cat > "$dir/plugins/p/docs/research/docs/t/sources.md" <<'EOF'
+8 -7
View File
@@ -20,8 +20,10 @@ fi
# 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
# One root per run: fixture helpers run inside $(...) subshells, where an
# array append never reaches the parent's trap, so register the root instead.
RUN_TMP="$(mktemp -d)"
trap 'rm -rf "$RUN_TMP"' EXIT
# write_skill <repo> <plugin> <skill> <version-line|""> [body]
# An empty version line writes a SKILL.md with no metadata block at all.
@@ -48,8 +50,7 @@ commit() { (cd "$1" && git add -A && git commit -q -m "${2:-change}"); }
# onto a feature branch.
make_fixture() {
local dir
dir="$(mktemp -d)"
CLEANUP_DIRS+=("$dir")
dir="$(mktemp -d "$RUN_TMP/fx.XXXXXX")"
(cd "$dir" && git init -q -b main && git config user.email [email protected] && git config user.name t)
write_skill "$dir" demo alpha 'version: "1.0.0"'
write_skill "$dir" demo beta "version: 1.0.9"
@@ -255,7 +256,7 @@ expect_fail "the report names alpha and the versions read from origin/main's mer
echo ""
echo "--- 19. no main ref fails closed ---"
F="$(mktemp -d)"; CLEANUP_DIRS+=("$F")
F="$(mktemp -d "$RUN_TMP/fx.XXXXXX")"
(cd "$F" && git init -q -b trunk && git config user.email [email protected] && git config user.name t)
write_skill "$F" demo alpha 'version: "1.0.0"'; commit "$F"
expect_fail "missing main fails with a clear message" "neither origin/main nor main resolves" "$F"
@@ -323,7 +324,7 @@ expect_pass "a zero inside a part (1.0.10) is not a leading zero" "$F"
echo ""
echo "--- 24. python3 / PyYAML failures are never reported as a missing version ---"
REAL_PYTHON="$(command -v python3)"
SHIM_ROOT="$(mktemp -d)"; CLEANUP_DIRS+=("$SHIM_ROOT")
SHIM_ROOT="$(mktemp -d "$RUN_TMP/fx.XXXXXX")"
mkdir -p "$SHIM_ROOT/shadow" "$SHIM_ROOT/noyaml" "$SHIM_ROOT/crash"
printf 'raise ImportError("PyYAML deliberately unavailable in this fixture")\n' \
> "$SHIM_ROOT/shadow/yaml.py"
@@ -602,7 +603,7 @@ echo "--- 40. a criss-cross history is judged against EVERY merge-base ---"
# +-- feature: F1 bumps alpha to 1.0.1
# +-- main: M1 unrelated, then M2 merges F1
# feature: F2 merges M1 -> merge bases {M1, F1}
F="$(mktemp -d)"; CLEANUP_DIRS+=("$F")
F="$(mktemp -d "$RUN_TMP/fx.XXXXXX")"
(cd "$F" && git init -q -b main && git config user.email [email protected] && git config user.name t)
write_skill "$F" demo alpha 'version: "1.0.0"'; commit "$F" C0
(cd "$F" && git checkout -q -b feature)
+606
View File
@@ -0,0 +1,606 @@
#!/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).
# One root per run: fixture helpers run inside $(...) subshells, where an
# array append never reaches the parent's trap, so register the root instead.
RUN_TMP="$(mktemp -d)"
trap 'rm -rf "$RUN_TMP"' EXIT
new_repo() {
local dir
dir="$(mktemp -d "$RUN_TMP/fx.XXXXXX")"
(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 "$RUN_TMP/fx.XXXXXX")"
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 "$RUN_TMP/fx.XXXXXX")"
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 "$RUN_TMP/fx.XXXXXX")"
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 ]]