Compare commits
30
Commits
No files matched your search
@@ -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.9.3",
|
||||
"version": "0.9.4",
|
||||
"owner": {
|
||||
"name": "Mortis",
|
||||
"url": "https://git.rkdr.net/Mortis/"
|
||||
@@ -10,7 +10,7 @@
|
||||
{
|
||||
"name": "kyberforge",
|
||||
"description": "Skills and agents for creating, maintaining, and managing an apm plugin marketplace for Claude Code and GitHub Copilot.",
|
||||
"version": "2.3.1",
|
||||
"version": "2.3.2",
|
||||
"category": "Developer Tools",
|
||||
"source": "./plugins/kyberforge"
|
||||
},
|
||||
@@ -24,21 +24,21 @@
|
||||
{
|
||||
"name": "git",
|
||||
"description": "Skills and agents for working with a local Git clone over the git wire protocol, and for authoring and running the pre-commit hooks that guard it.",
|
||||
"version": "1.4.0",
|
||||
"version": "1.4.1",
|
||||
"category": "Version Control",
|
||||
"source": "./plugins/git"
|
||||
},
|
||||
{
|
||||
"name": "gitea",
|
||||
"description": "Skills and agents for working with a Gitea forge through its HTTP API — the forge's own objects, as distinct from the local git clone.",
|
||||
"version": "1.3.10",
|
||||
"version": "1.3.11",
|
||||
"category": "Version Control",
|
||||
"source": "./plugins/gitea"
|
||||
},
|
||||
{
|
||||
"name": "core",
|
||||
"description": "Skills for authoring and auditing a repo's AGENTS.md and the provider adapter files that defer to it.",
|
||||
"version": "1.1.4",
|
||||
"version": "1.1.5",
|
||||
"category": "Productivity",
|
||||
"source": "./plugins/core"
|
||||
},
|
||||
@@ -59,7 +59,7 @@
|
||||
{
|
||||
"name": "delivery",
|
||||
"description": "Agents and skills for taking a change from spec to a verified merge through tracker-gated stages.",
|
||||
"version": "0.8.1",
|
||||
"version": "0.8.2",
|
||||
"category": "Developer Tools",
|
||||
"source": "./plugins/delivery"
|
||||
},
|
||||
@@ -90,6 +90,13 @@
|
||||
"version": "0.5.0",
|
||||
"category": "Productivity",
|
||||
"source": "./plugins/plan"
|
||||
},
|
||||
{
|
||||
"name": "rtk",
|
||||
"description": "A Claude Code hook that routes Bash tool calls through rtk, the token-saving command wrapper, when rtk is installed.",
|
||||
"version": "0.1.0",
|
||||
"category": "Developer Tools",
|
||||
"source": "./plugins/rtk"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -11,6 +11,28 @@
|
||||
}
|
||||
],
|
||||
"_apm_source": "Mortis/Holocron/plugins/delivery"
|
||||
},
|
||||
{
|
||||
"matcher": "Bash",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "\"${CLAUDE_PROJECT_DIR}/.claude/hooks/git/.apm/hooks/refuse-push-to-main.py\"",
|
||||
"timeout": 10
|
||||
}
|
||||
],
|
||||
"_apm_source": "Mortis/Holocron/plugins/git"
|
||||
},
|
||||
{
|
||||
"matcher": "Bash",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "\"${CLAUDE_PROJECT_DIR}/.claude/hooks/rtk/.apm/hooks/route-through-rtk.sh\"",
|
||||
"timeout": 10
|
||||
}
|
||||
],
|
||||
"_apm_source": "Mortis/Holocron/plugins/rtk"
|
||||
}
|
||||
],
|
||||
"SessionStart": [
|
||||
|
||||
@@ -11,6 +11,26 @@
|
||||
"timeout": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": "Bash",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "\"${CLAUDE_PROJECT_DIR}/.claude/hooks/git/.apm/hooks/refuse-push-to-main.py\"",
|
||||
"timeout": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": "Bash",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "\"${CLAUDE_PROJECT_DIR}/.claude/hooks/rtk/.apm/hooks/route-through-rtk.sh\"",
|
||||
"timeout": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"SessionStart": [
|
||||
|
||||
@@ -273,8 +273,8 @@ repos:
|
||||
|
||||
- id: check-rtk-prefix
|
||||
stages: ['pre-commit']
|
||||
name: ADR-0023 rtk prefix on executable git commands
|
||||
description: Enforce ADR-0023 clause 1 -- an executable, instructed git command in a shell code fence or a dispatch-table Run cell is written `rtk git`. Clauses 2 and 3 are not machine-decidable; a deliberately bare command opts out with the literal string ADR-0023 on its own line
|
||||
name: rtk prefix on executable git commands (ADR-0023)
|
||||
description: Enforce ADR-0023 clause 1 -- an executable, instructed git command in a shell code fence or a dispatch-table Run cell is written `rtk git`. Clauses 2 and 3 are not machine-decidable; a deliberately bare command opts out with the rtk-bare marker and its reason on the same line
|
||||
entry: scripts/check-rtk-prefix.sh
|
||||
language: script
|
||||
files: '^plugins/[^/]+/\.apm/(skills/.*\.md|agents/.*\.agent\.md)$'
|
||||
|
||||
@@ -155,3 +155,7 @@ Under the `run-tests` pre-push hook, git exported `GIT_DIR` to the hook, so a ba
|
||||
## 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. *2026-12-02 (#272):* apm 0.39.3's `apm_cli/utils/git_env.py` provides `git_subprocess_env`, which strips `GIT_DIR` and the other repo-locating vars. The leak was not re-tested on 0.39.3, and the scrub stays, because the rule is about the hook, not about one tool version.
|
||||
|
||||
## 2026-12-06 — Two correct gates can make a first landing unpushable
|
||||
|
||||
#179: `check-executables-allow-sync` requires a new hook-shipping plugin's git+path entry in root `apm.yml`, while root deps resolve from the remote's `main` (ADR-0019), so `apm-audit-ci`'s `ref-consistency` fails until the plugin lands — no state of the branch passes both. Fix: a narrow, self-expiring waiver in `scripts/apm-audit-ci.sh` keyed on the plugin being absent from local `origin/main`. Rule: when adding a gate that reads the remote's `main`, check what a first landing of the thing it guards looks like.
|
||||
@@ -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`, `plan` — 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`, `rtk` — 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 |
|
||||
|
||||
+57
-15
@@ -1,5 +1,5 @@
|
||||
lockfile_version: '4'
|
||||
generated_at: '2026-12-03T08:21:35.467239+00:00'
|
||||
generated_at: '2026-12-06T15:33:54.945486+00:00'
|
||||
apm_version: 0.39.3
|
||||
manifest_targets:
|
||||
- claude
|
||||
@@ -7,7 +7,7 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: ansible
|
||||
host: git.rkdr.net
|
||||
resolved_commit: 5db1eb1435de3a35f7b6bde9c1afe5b45100ce27
|
||||
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
|
||||
version: 0.1.0
|
||||
virtual_path: plugins/ansible
|
||||
is_virtual: true
|
||||
@@ -25,7 +25,7 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: bin
|
||||
host: git.rkdr.net
|
||||
resolved_commit: 5db1eb1435de3a35f7b6bde9c1afe5b45100ce27
|
||||
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
|
||||
version: 5.0.0
|
||||
virtual_path: plugins/bin
|
||||
is_virtual: true
|
||||
@@ -75,7 +75,7 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: core
|
||||
host: git.rkdr.net
|
||||
resolved_commit: 5db1eb1435de3a35f7b6bde9c1afe5b45100ce27
|
||||
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
|
||||
version: 1.1.4
|
||||
virtual_path: plugins/core
|
||||
is_virtual: true
|
||||
@@ -153,7 +153,7 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: delivery
|
||||
host: git.rkdr.net
|
||||
resolved_commit: 5db1eb1435de3a35f7b6bde9c1afe5b45100ce27
|
||||
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
|
||||
version: 0.8.1
|
||||
virtual_path: plugins/delivery
|
||||
is_virtual: true
|
||||
@@ -272,13 +272,14 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: git
|
||||
host: git.rkdr.net
|
||||
resolved_commit: 5db1eb1435de3a35f7b6bde9c1afe5b45100ce27
|
||||
version: 1.3.9
|
||||
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
|
||||
version: 1.4.0
|
||||
virtual_path: plugins/git
|
||||
is_virtual: true
|
||||
package_type: apm_package
|
||||
deployed_files:
|
||||
- .claude/agents/git-orchestrate.md
|
||||
- .claude/hooks/git/.apm/hooks/refuse-push-to-main.py
|
||||
- .claude/skills/git-branches
|
||||
- .claude/skills/git-branches/LICENSE
|
||||
- .claude/skills/git-branches/SKILL.md
|
||||
@@ -345,6 +346,7 @@ dependencies:
|
||||
- .claude/skills/pc-run/references/sources.md
|
||||
deployed_file_hashes:
|
||||
.claude/agents/git-orchestrate.md: sha256:c9122bac28dc079efb041acc720dd097c62fdb49d9b1d9a62b15ac5ee6c47032
|
||||
.claude/hooks/git/.apm/hooks/refuse-push-to-main.py: sha256:2a8b9c3e53e1c1d388c254aa65f66632315eb4a289b25e8ef1a3008bf08513f9
|
||||
.claude/skills/git-branches/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
|
||||
.claude/skills/git-branches/SKILL.md: sha256:61de940e705c463a6947fa1b2b4946fe3793d521fad0074d824ede742a948a78
|
||||
.claude/skills/git-branches/references/branch-operations.md: sha256:4406d74f819ee48209213b7160a0ead96cafeb1bc7f520134b1b720c2612e19d
|
||||
@@ -400,7 +402,7 @@ dependencies:
|
||||
.claude/skills/pc-run/references/failure-patterns.md: sha256:c760a933a937d5c33206f918089a49afd8335de3854093f5c32494e71019378c
|
||||
.claude/skills/pc-run/references/install.md: sha256:71ec08d58b8797b09574a827ea06d2c9656e3394d40534860fdaf333f5c19070
|
||||
.claude/skills/pc-run/references/sources.md: sha256:ed47302b3fa003ca203cf6677905032f687ff5e07e3d551593865116d9ce11f1
|
||||
content_hash: sha256:e2b1ba4a5767a1355926347fb0771f1c0a175c19331fd959deb88696eb7e7a1d
|
||||
content_hash: sha256:3a10096fdd99fc2c8cbe962bbff0679c0998f09bef8fb19cf961fef01fdc4e9c
|
||||
package_targets:
|
||||
- claude
|
||||
- codex
|
||||
@@ -437,10 +439,11 @@ dependencies:
|
||||
- path: LICENSE
|
||||
source: LICENSE
|
||||
hash: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
|
||||
exec_status: deployed
|
||||
- repo_url: Mortis/Holocron
|
||||
name: gitea
|
||||
host: git.rkdr.net
|
||||
resolved_commit: 5db1eb1435de3a35f7b6bde9c1afe5b45100ce27
|
||||
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
|
||||
version: 1.3.10
|
||||
virtual_path: plugins/gitea
|
||||
is_virtual: true
|
||||
@@ -568,7 +571,7 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: gitops
|
||||
host: git.rkdr.net
|
||||
resolved_commit: 5db1eb1435de3a35f7b6bde9c1afe5b45100ce27
|
||||
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
|
||||
version: 0.2.0
|
||||
virtual_path: plugins/gitops
|
||||
is_virtual: true
|
||||
@@ -604,7 +607,7 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: k8s
|
||||
host: git.rkdr.net
|
||||
resolved_commit: 5db1eb1435de3a35f7b6bde9c1afe5b45100ce27
|
||||
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
|
||||
version: 0.2.0
|
||||
virtual_path: plugins/k8s
|
||||
is_virtual: true
|
||||
@@ -636,7 +639,7 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: kyberforge
|
||||
host: git.rkdr.net
|
||||
resolved_commit: 5db1eb1435de3a35f7b6bde9c1afe5b45100ce27
|
||||
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
|
||||
version: 2.3.1
|
||||
virtual_path: plugins/kyberforge
|
||||
is_virtual: true
|
||||
@@ -945,7 +948,7 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: lint
|
||||
host: git.rkdr.net
|
||||
resolved_commit: 5db1eb1435de3a35f7b6bde9c1afe5b45100ce27
|
||||
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
|
||||
version: 1.1.9
|
||||
virtual_path: plugins/lint
|
||||
is_virtual: true
|
||||
@@ -991,7 +994,7 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: mattpocock
|
||||
host: git.rkdr.net
|
||||
resolved_commit: 5db1eb1435de3a35f7b6bde9c1afe5b45100ce27
|
||||
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
|
||||
version: 0.5.0
|
||||
virtual_path: plugins/mattpocock
|
||||
is_virtual: true
|
||||
@@ -1009,7 +1012,7 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: plan
|
||||
host: git.rkdr.net
|
||||
resolved_commit: 5db1eb1435de3a35f7b6bde9c1afe5b45100ce27
|
||||
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
|
||||
version: 0.5.0
|
||||
virtual_path: plugins/plan
|
||||
is_virtual: true
|
||||
@@ -1068,6 +1071,27 @@ dependencies:
|
||||
- path: LICENSE
|
||||
source: LICENSE
|
||||
hash: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
|
||||
- repo_url: Mortis/Holocron
|
||||
name: rtk
|
||||
host: git.rkdr.net
|
||||
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
|
||||
version: 0.1.0
|
||||
virtual_path: plugins/rtk
|
||||
is_virtual: true
|
||||
package_type: apm_package
|
||||
deployed_files:
|
||||
- .claude/hooks/rtk/.apm/hooks/route-through-rtk.sh
|
||||
deployed_file_hashes:
|
||||
.claude/hooks/rtk/.apm/hooks/route-through-rtk.sh: sha256:55f323f2349748e0d99051d5a6e592ea5c6e9b1e48ca2e8a6377885ab665f562
|
||||
content_hash: sha256:0f258821b61a9d6712a65bcbeeabade2bf899c3dfd82bf695586f7b82d88eae1
|
||||
package_targets:
|
||||
- claude
|
||||
declared_license: MIT
|
||||
carried_licenses:
|
||||
- path: LICENSE
|
||||
source: LICENSE
|
||||
hash: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
|
||||
exec_status: deployed
|
||||
- repo_url: fluxcd/agent-skills
|
||||
name: gitops-knowledge
|
||||
host: github.com
|
||||
@@ -1951,6 +1975,15 @@ deployments:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/delivery
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/delivery
|
||||
content_hash: sha256:2b84958d8d2ab1c3a17e8857d9797e9535b25a8c36b40cc9d34537df0c4a446b
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/hooks/git/.apm/hooks/refuse-push-to-main.py
|
||||
runtime: null
|
||||
scope: project
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/git
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/git
|
||||
content_hash: sha256:2a8b9c3e53e1c1d388c254aa65f66632315eb4a289b25e8ef1a3008bf08513f9
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/hooks/kyberforge/.apm/hooks/check-apm-current.sh
|
||||
@@ -1960,6 +1993,15 @@ deployments:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:30d9160d25eb712fe7a4d206d12c3779cf13725ccba2f09843713a6f3ebe9ca4
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/hooks/rtk/.apm/hooks/route-through-rtk.sh
|
||||
runtime: null
|
||||
scope: project
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/rtk
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/rtk
|
||||
content_hash: sha256:55f323f2349748e0d99051d5a6e592ea5c6e9b1e48ca2e8a6377885ab665f562
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/agent-author
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: holocron
|
||||
version: 0.9.3
|
||||
version: 0.9.4
|
||||
description: AI development skills for Claude Code, and for GitHub Copilot through apm — factory, design, implement, review, and cross-cutting workflows.
|
||||
license: MIT
|
||||
|
||||
@@ -51,6 +51,9 @@ dependencies:
|
||||
# Ticket and idea planning, up to an agent-ready spec and breakdown.
|
||||
- git: https://git.rkdr.net/Mortis/Holocron.git
|
||||
path: plugins/plan
|
||||
# Routes Bash tool calls through rtk when it is installed (#179).
|
||||
- git: https://git.rkdr.net/Mortis/Holocron.git
|
||||
path: plugins/rtk
|
||||
mcp: []
|
||||
|
||||
# Turns apm's executable-trust gate ON. Without this block the gate is disabled
|
||||
@@ -79,15 +82,18 @@ dependencies:
|
||||
# remote (ADR-0019).
|
||||
executables:
|
||||
allow:
|
||||
git.rkdr.net/Mortis/Holocron/plugins/kyberforge#2.3.1:
|
||||
git.rkdr.net/Mortis/Holocron/plugins/kyberforge#2.3.2:
|
||||
hooks: true
|
||||
bin: true
|
||||
# delivery ships the guard hook (ADR-0032 enforcement layer 2). Same
|
||||
# full-identity, version-in-key convention as above, kept by the same check.
|
||||
git.rkdr.net/Mortis/Holocron/plugins/delivery#0.8.1:
|
||||
git.rkdr.net/Mortis/Holocron/plugins/delivery#0.8.2:
|
||||
hooks: true
|
||||
# git ships the hook that refuses a push to main.
|
||||
git.rkdr.net/Mortis/Holocron/plugins/git#1.4.0:
|
||||
git.rkdr.net/Mortis/Holocron/plugins/git#1.4.1:
|
||||
hooks: true
|
||||
# rtk ships the hook that routes Bash tool calls through rtk.
|
||||
git.rkdr.net/Mortis/Holocron/plugins/rtk#0.1.0:
|
||||
hooks: true
|
||||
|
||||
marketplace:
|
||||
@@ -96,7 +102,7 @@ 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.9.3
|
||||
version: 0.9.4
|
||||
owner:
|
||||
name: Mortis
|
||||
url: https://git.rkdr.net/Mortis/
|
||||
@@ -167,3 +173,7 @@ marketplace:
|
||||
- name: plan
|
||||
source: ./plugins/plan
|
||||
category: Productivity
|
||||
|
||||
- name: rtk
|
||||
source: ./plugins/rtk
|
||||
category: Developer Tools
|
||||
@@ -166,3 +166,12 @@ that was false about the `gitea-*` skills and a citation to a file that does not
|
||||
A `check-rtk-prefix` pre-commit hook and `tests/test-check-rtk-prefix.sh` land with it; the test runs
|
||||
the gate against the pre-sweep corpus on `main` and asserts it fails there, because a gate that only
|
||||
passes on the fixed tree proves nothing about the drift it was written for.
|
||||
|
||||
## Addendum (2026-12-06): the opt-out marker is `rtk-bare:`
|
||||
|
||||
The clause-3 opt-out marker that `check-rtk-prefix` accepts is now `rtk-bare:`, written on the same
|
||||
line as the bare command and followed by its reason (`# rtk-bare: the output is parsed`). It replaces
|
||||
the literal string `ADR-0023`, which the gate no longer accepts. The cause is issue #177: plugin
|
||||
content is consumed by other repos, and a marker that cites this repo's ADR leaks a reference those
|
||||
consumers cannot follow. The decision itself is unchanged — the three clauses, the per-line scope and
|
||||
the inline-reason requirement all stand; only the marker string moved.
|
||||
@@ -2,6 +2,22 @@
|
||||
|
||||
**Status:** Accepted (2026-09-20)
|
||||
|
||||
*Amended 2026-12-06 ([rtk routing hook](https://git.rkdr.net/Mortis/Holocron/issues/179)): "the root
|
||||
manifest is never waived" below now holds for `lockfile-exists` only. The root has one narrow
|
||||
waiver: `ref-consistency` for a plugin not yet on `origin/main`. Root `apm.yml`'s first-party
|
||||
dependencies resolve from the remote's `main` (ADR-0019), so the lock cannot record a plugin before it
|
||||
lands. `check-executables-allow-sync` meanwhile requires a hook- or bin-shipping plugin's git+path
|
||||
entry before it can be pushed, so without the waiver such a plugin could never land. The waiver applies
|
||||
only when all of these hold: the output reads `1 of 3 check(s) failed` and its one failing row is
|
||||
`ref-consistency`; the details block appears exactly once and every line in it is `<identity>/plugins/<name>: not found
|
||||
in lockfile`, for root `apm.yml`'s own entry and a name that starts alphanumeric and holds no `..`;
|
||||
`plugins/<name>/apm.yml` is in the working tree and absent from the local `origin/main`, which must
|
||||
resolve. On apm 0.39.3 a failing `ref-consistency` stops the root run after three checks, so the hook then
|
||||
re-runs `apm audit --ci` on a scratch copy of the tree with those plugins' `dependencies.apm` entries
|
||||
removed, and the push passes only if that run reports `All 15 check(s) passed`. The working tree is
|
||||
never written. The waiver lapses for each plugin once it is on `origin/main`, when the follow-up PR that
|
||||
records it in the lock is required.*
|
||||
|
||||
*Amended 2026-12-02 (holocron#272): re-verified on apm 0.39.3 in a scratch copy of
|
||||
`plugins/mattpocock`. Without a package lock, the same line and `1 of 1 check(s) failed` appear, so
|
||||
the waiver is unchanged. With one from `apm lock`, the rest of the root set arms (fourteen more
|
||||
|
||||
@@ -127,6 +127,11 @@ passed. Failed tasks are shown in the PR comment for the approver to judge. Deci
|
||||
cluster or state and print no secret: anything not on the list is denied, so an unlisted mutating
|
||||
subcommand fails safe. Codex cannot ask, so odd jobs are
|
||||
denied there; an unrecognised runtime is treated the same way.
|
||||
- *Amended 2026-12-05 ([rtk routing hook](https://git.rkdr.net/Mortis/Holocron/issues/179)): the
|
||||
opt-in `rtk` plugin ships a Claude Code hook that rewrites Bash commands through `rtk hook claude`
|
||||
and may return `permissionDecision: allow`, skipping the permission prompt. Accepted, because hooks
|
||||
are guardrails, not the boundary; `git`'s push guard still sees `rtk git push`, as `rtk` is one of
|
||||
its wrappers.*
|
||||
- *Amended 2026-12-04 ([git push-to-main hook](https://git.rkdr.net/Mortis/Holocron/issues/178)): `git`
|
||||
ships its own guardrail hook beside `delivery`'s, refusing a `git push` to `main` on Claude Code
|
||||
only. It fails open and has an opt-out; branch protection stays the real control.*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Bundled Claude Code skills are turned off with one user-level switch
|
||||
# Bundled Claude Code skills are turned off at user level
|
||||
|
||||
**Status: accepted (2026-12-03).**
|
||||
**Status: accepted (2026-12-03), amended 2026-12-06 (#286).**
|
||||
|
||||
## Context
|
||||
|
||||
@@ -10,27 +10,40 @@ from `skillOverrides` is on, and `Skill(x)` allow rules do not restrict other sk
|
||||
wanted a setting that also covers bundled skills added later. A custom `/ship` is also not loaded
|
||||
where the built-in one is available.
|
||||
|
||||
On Claude Code 2.1.337 the switch does not cover built-in plugins (`cc-plugin-*@builtin`). Their
|
||||
skills `design`, `doctor` and `plugin-authoring` still load, and so do their tools (#286).
|
||||
|
||||
## Decision
|
||||
|
||||
**Bundled skills are turned off with one switch, not a per-name list.** The settings live at user
|
||||
level in `providers/claude-code/settings.json`, which `scripts/install.sh` deploys to
|
||||
**Bundled skills are turned off with one switch; built-in plugin skills need a per-name list.** The
|
||||
settings live at user level in `providers/claude-code/settings.json`, which `scripts/install.sh` deploys to
|
||||
`~/.claude/settings.json`:
|
||||
|
||||
- `disableBundledSkills: true`
|
||||
- `syncClaudeAiSkills: false`
|
||||
- `env.CLAUDE_CODE_DISABLE_SHIP: "1"`, the documented fix for the custom `/ship`.
|
||||
- `skillOverrides.init: "off"`
|
||||
- `skillOverrides` `design`, `doctor` and `plugin-authoring`: `"off"`, for the built-in plugin skills.
|
||||
- `enabledPlugins`: `cc-plugin-easel@builtin` and `cc-plugin-plugin-authoring@builtin` set to `false`.
|
||||
`cc-plugin-privacy`, `-agents-md`, `-telemetry` and `-verbs` stay on: they add no skills and their
|
||||
behaviour has not been checked.
|
||||
- `syncClaudeAiPlugins: false`, the plugin counterpart of `syncClaudeAiSkills`.
|
||||
|
||||
**A per-name `skillOverrides` blocklist is accepted for built-in plugin skills only**, because the
|
||||
single switch does not reach them. Bundled skills stay under the switch. `enabledPlugins` lives in
|
||||
this user-level file, so ADR-0018's ban on it in the project `.claude/settings.json` does not apply.
|
||||
|
||||
Holocron does not distribute these settings to consumer repos. User-level settings already apply to
|
||||
every repo on the machine, and another machine needs its own `install.sh` run.
|
||||
|
||||
**`install.sh` must merge into an existing `~/.claude/settings.json` before these settings are
|
||||
deployed.** Today it copies the file over, which would drop 11 of the operator's 13 top-level keys.
|
||||
The merge is a separate implementation ticket, not part of this ADR's PR.
|
||||
deployed.** It used to copy the file over, which would have dropped 11 of the operator's 13 top-level
|
||||
keys. Done since: `scripts/merge-json.py` merges the file, and `tests/test-install.sh` covers it.
|
||||
|
||||
## Considered options
|
||||
|
||||
**A `skillOverrides` blocklist (rejected).** It needs a new entry for each unwanted skill that ships.
|
||||
**A `skillOverrides` blocklist (rejected as the general mechanism).** It needs a new entry for each unwanted skill that ships.
|
||||
It is now used for built-in plugin skills (#286), but is still rejected as the general mechanism.
|
||||
|
||||
**`skillOverrides` in the committed `.claude/settings.json`, as #266 proposed (rejected).** apm owns
|
||||
that file and `apm audit --ci` fails on hand-added keys (AGENTS.md, ADR-0018, ADR-0019). apm 0.39.3
|
||||
@@ -49,6 +62,9 @@ operator chose to turn off all syncing.
|
||||
2. All synced `anthropic-skills:*` are lost, including `pdf`, `docx`, `xlsx` and
|
||||
`satisfactory-helper`. Claude Code moves the synced copies to `.trash`.
|
||||
3. New built-in commands, as opposed to bundled skills, are not covered.
|
||||
4. Each new built-in plugin skill needs its own `skillOverrides` entry.
|
||||
5. The `cc-plugin-easel` chart tool and the `cc-plugin-plugin-authoring` `scan_secrets` MCP server are
|
||||
lost.
|
||||
|
||||
## Evidence
|
||||
|
||||
@@ -57,6 +73,11 @@ operator chose to turn off all syncing.
|
||||
- **Documented, not tested:** that the custom `/ship` loads in an interactive session with
|
||||
`CLAUDE_CODE_DISABLE_SHIP=1`.
|
||||
- **From the docs only:** the `syncClaudeAiSkills` behaviour.
|
||||
- **Tested** in headless mode on Claude Code 2.1.337, from the `init` event of
|
||||
`claude -p … --output-format stream-json --verbose`: `skillOverrides` for `design`, `doctor` and
|
||||
`plugin-authoring`, and `enabledPlugins` for the two plugins. Confirmed after `scripts/install.sh`:
|
||||
the `init` event lists none of the three skills and only the four plugins kept on.
|
||||
- **From the setting's description in the binary only:** the `syncClaudeAiPlugins` behaviour.
|
||||
- Sources: code.claude.com/docs/en/settings-reference, `/skills` and `/ship-command-troubleshooting`.
|
||||
|
||||
Related: ADR-0018, ADR-0019; #266.
|
||||
Related: ADR-0018, ADR-0019; #266, #286.
|
||||
+51
-8
@@ -72,7 +72,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-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` and the root's `ref-consistency` for a plugin not yet on `origin/main` (see [below](#apm-audit-ci)) |
|
||||
| `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)
|
||||
@@ -498,7 +498,7 @@ directory (the self-contained constraint in `docs/spec/architecture.md`, "Plugin
|
||||
so drift fails CI rather than silently letting an audit bless a skill the commit hook then rejects.
|
||||
|
||||
**The shared boundary resolver is one copy** (ADR-0025, then 2026-09-16). It lives between the
|
||||
`BEGIN`/`END ADR-0020 SHARED BOUNDARY RESOLVER` markers in `factory-audit/scripts/lib-boundary-resolver.sh`.
|
||||
`BEGIN`/`END SHARED BOUNDARY RESOLVER` markers in `factory-audit/scripts/lib-boundary-resolver.sh`.
|
||||
ADR-0025 collapsed the two copies inside `skill-audit`'s and `agent-audit`'s `validate.sh` into that
|
||||
file. `scripts/skill-size-check.sh` kept an embedded, byte-identical third copy while it was also
|
||||
exported through `.pre-commit-hooks.yaml`, whose consumers could not reach a file inside the plugin.
|
||||
@@ -734,16 +734,18 @@ checking only a leading span flags neither, and still catches the ordinary
|
||||
### The clause-3 opt-out
|
||||
|
||||
A command that is deliberately bare — because rtk rewrites the output the skill parses, or because
|
||||
the command is interactive — is exempted by putting the literal string `ADR-0023` **on the same
|
||||
line**: in a shell comment for a code line, in the cell text for a table row.
|
||||
the command is interactive — is exempted by putting the marker `rtk-bare:` and its reason **on the
|
||||
same line**: in a shell comment for a code line, in the cell text for a table row. The marker was
|
||||
`ADR-0023` until issue #177; it is neutral because plugin content is consumed by other repos and must
|
||||
not cite this repo's ADRs. The old string no longer exempts a line.
|
||||
|
||||
Per line, never per block. A fenced procedure routinely mixes `rtk git` steps with one deliberately
|
||||
bare command (`git-remotes/references/push.md` does exactly that), and a block-level marker would
|
||||
silently disarm every checked line around the marked one. The cost is a repeated `# bare per
|
||||
ADR-0023` in the three blocks of `git-log-format.md` where every line is deliberately bare; that
|
||||
silently disarm every checked line around the marked one. The cost is a repeated `# rtk-bare:` in
|
||||
the three blocks of `git-log-format.md` where every line is deliberately bare; that
|
||||
repetition is the price of the marked line being the only line the marker speaks for.
|
||||
|
||||
The marker is a plain substring match, so a line that mentions `ADR-0023` for an unrelated reason is
|
||||
The marker is a plain substring match, so a line that mentions `rtk-bare:` for an unrelated reason is
|
||||
also exempt. Accepted deliberately: the marker records an author's opt-out, it is not a security
|
||||
boundary, and a stricter form would only move the same trust to a different string.
|
||||
|
||||
@@ -1232,7 +1234,48 @@ The cause is that apm treats any directory holding both `apm.yml` and `apm.lock.
|
||||
root**, and a plugin package is not one. `scripts/apm-audit-ci.sh` therefore waives `lockfile-exists`
|
||||
and nothing else, and only for a non-root manifest: it asserts the string `1 of 1 check(s) failed`,
|
||||
so any second failing check changes the count and the run fails normally, and output it does not
|
||||
recognise fails closed. The root manifest is never waived. Recorded as ADR-0026.
|
||||
recognise fails closed. The root manifest is never waived for `lockfile-exists`. Recorded as ADR-0026.
|
||||
|
||||
**The root has one waiver of its own: `ref-consistency` for a plugin not yet on `origin/main`.**
|
||||
Root `apm.yml`'s first-party dependencies resolve from the remote's `main` (ADR-0019), so the lock
|
||||
cannot record a plugin before it lands, while `check-executables-allow-sync` refuses a push of a
|
||||
hook- or bin-shipping plugin whose git+path entry is missing from root `apm.yml`. Without a waiver a
|
||||
first-landing executable-shipping plugin is unpushable: root `ref-consistency` fails with
|
||||
`<identity>/plugins/<name>: not found in lockfile`. On apm 0.39.3 a failing `ref-consistency` cuts
|
||||
the root run to three checks (holocron#179), so the hook waives it only when the output reads `1 of
|
||||
3 check(s) failed`, the one failing row is `ref-consistency`, and every line of its details block is
|
||||
that `not found in lockfile` form for an identity equal to root `apm.yml`'s own git+path entry for
|
||||
`plugins/<name>` (derived by `check-executables-allow-sync`'s rule). Each `plugins/<name>/apm.yml`
|
||||
must also exist in the working tree and be absent from the **local** `origin/main`, which must
|
||||
resolve; nothing is fetched. A plugin name must start with a letter or digit and may not contain
|
||||
`..`. Any other output fails closed. The waiver lapses for a plugin by itself: once it is on
|
||||
`origin/main`, the follow-up PR that records it in the lock is required. Because the hook reads
|
||||
only the local `origin/main` ref, a stale or unfetched one keeps the waiver alive after the plugin
|
||||
has landed. That fails safe: the waiver still requires the full 15-check re-run below to pass, so
|
||||
it waives only the `not found in lockfile` rows. `git fetch` refreshes the ref and ends the waiver.
|
||||
|
||||
**The waiver re-runs the full root check set before it passes.** The cut-short run never reaches the
|
||||
other twelve root checks (`content-integrity`, `hook-approval-pins`, `local-bundle-hooks`,
|
||||
`exec-status-current`, `deployed-files-present` and the rest), so the three-check result alone
|
||||
would let a defect in any of them through. Once the conditions above hold, the hook copies the working
|
||||
tree (minus `.git`, `.venv` and `.claude/worktrees`) into a `mktemp -d` directory with `tar`. In the
|
||||
copy it drops only the `dependencies:` > `apm:` items whose `path:` names a waived plugin, checks
|
||||
that the reduced `apm.yml` differs from the original by those deletions alone and that no entry for
|
||||
a waived plugin survived, and runs `git init`. It gives that repo the git state apm reads: the
|
||||
same `origin` URL, for org-policy discovery, and a copy of the real repo's `info/exclude` (from
|
||||
`git rev-parse --git-path info/exclude`, so a linked worktree's shared one), which
|
||||
`deployed-files-present` consults through `git check-ignore`. It then runs `apm audit --ci` there. The push passes only
|
||||
if that run exits 0 and prints `All 15 check(s) passed`. On this branch (holocron#179, apm 0.39.3) it
|
||||
does, and the hook prints `root re-run without the unlanded plugins: All 15 check(s) passed`. A copy
|
||||
was chosen over swapping `apm.yml` in place under a `trap`: the copy never writes the working tree, so
|
||||
the tree stays byte-identical even after `SIGKILL`, and a concurrent apm never sees a reduced
|
||||
manifest. `.git` is not copied because in a linked worktree it points into the shared gitdir. `.venv`
|
||||
is not copied because apm runs from the real one via `uv run --project`. `.claude/worktrees` is not
|
||||
copied because each worktree there is a full checkout that can carry its own `.venv`. Leaving it out
|
||||
hides nothing: it is ignored through `info/exclude`, and the root checks look only at lock-recorded
|
||||
deployed paths, none of which is under it. The scratch directory is
|
||||
removed on exit, including on `INT`, `TERM` and `HUP`. The script header records the full reasoning.
|
||||
`tests/test-apm-audit-ci-waiver.sh` covers the waiver, the re-run, and each of its guards.
|
||||
|
||||
**Dropping `--ci` for package directories was considered and rejected.** It is the smaller change
|
||||
and it is wrong. Verified on apm 0.28.0, and again on 0.39.3 (holocron#272), against a scratch
|
||||
|
||||
@@ -11,7 +11,7 @@ metadata:
|
||||
category: docs
|
||||
source_keys:
|
||||
- adr-0002-0003-two-tier-claude-md
|
||||
version: "0.1.3"
|
||||
version: "0.1.4"
|
||||
---
|
||||
|
||||
## Gotchas
|
||||
|
||||
@@ -202,7 +202,7 @@ def read_text(path):
|
||||
byte is the complete signal and is checked first: no plausible markdown
|
||||
adapter contains one, and every UTF-16/32 encoding of ASCII is full of
|
||||
them. A file this gate cannot read gets an encoding diagnostic and exit 2,
|
||||
the same policy the ADR-0020 validators' read_text() uses.
|
||||
the same policy factory-audit's validators' read_text() uses.
|
||||
|
||||
A file that exists but cannot be read at all is neither a pass nor a FAIL —
|
||||
nothing was graded — so it exits 3 rather than 1. Exit 1 sends the skill's
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: core
|
||||
version: 1.1.4
|
||||
version: 1.1.5
|
||||
description: Skills for authoring and auditing a repo's AGENTS.md and the provider adapter files that defer to it.
|
||||
author:
|
||||
name: Mortis
|
||||
|
||||
@@ -9,7 +9,7 @@ compatibility: Requires git with push access to the work branch, and a consuming
|
||||
allowed-tools: Read Write Edit Bash
|
||||
metadata:
|
||||
category: delivery
|
||||
version: "0.2.0"
|
||||
version: "0.2.1"
|
||||
---
|
||||
|
||||
## Gotchas
|
||||
@@ -58,7 +58,7 @@ Read only the matched flow's reference — each is self-contained.
|
||||
Stage only files under the test paths, then check the staged set before committing:
|
||||
|
||||
```bash
|
||||
git diff --cached --name-only # bare: the path list is parsed (ADR-0023)
|
||||
git diff --cached --name-only # rtk-bare: the path list is parsed
|
||||
```
|
||||
|
||||
Any path outside the test paths → unstage it. Commit exactly once per run, with a Conventional
|
||||
|
||||
@@ -9,7 +9,7 @@ compatibility: Requires git, a Gitea forge with Actions reached through the Gite
|
||||
allowed-tools: Read Bash mcp__gitea__pull_request_read mcp__gitea__list_pull_requests mcp__gitea__commit_read mcp__gitea__actions_run_read mcp__gitea__get_file_contents
|
||||
metadata:
|
||||
category: delivery
|
||||
version: "0.1.0"
|
||||
version: "0.1.1"
|
||||
---
|
||||
|
||||
## Gotchas
|
||||
|
||||
@@ -13,10 +13,10 @@ in Step 1, before any waiting, and again where `references/apply-wait.md` and
|
||||
the merge commit whose message reverts it, oldest first:
|
||||
|
||||
```bash
|
||||
git log --reverse --format=%H -F --grep='Reverts merge commit <merge commit>' --grep='This reverts commit <merge commit>' <merge commit>..origin/<base> # ADR-0023: parsed
|
||||
git log --reverse --format=%H -F --grep='Reverts merge commit <merge commit>' --grep='This reverts commit <merge commit>' <merge commit>..origin/<base> # rtk-bare: the output is parsed
|
||||
```
|
||||
|
||||
Bare `git`, per ADR-0023: rtk filters `git log` and this output is parsed. Full 40-character
|
||||
Bare `git`, not `rtk git`: rtk filters `git log` and this output is parsed. Full 40-character
|
||||
SHA in both patterns. Not `--first-parent`: a revert PR merged with a merge commit puts the
|
||||
revert on the second parent. The first SHA listed is the **revert commit**.
|
||||
|
||||
|
||||
@@ -36,10 +36,10 @@ Otherwise tied when both hold:
|
||||
ancestor carrying a status with the same name:
|
||||
|
||||
```bash
|
||||
git log --first-parent --format=%H -n 50 <merge commit>^1 # ADR-0023: parsed
|
||||
git log --first-parent --format=%H -n 50 <merge commit>^1 # rtk-bare: the output is parsed
|
||||
```
|
||||
|
||||
Bare `git`, per ADR-0023: rtk filters `git log` and this output is parsed. Read each SHA's
|
||||
Bare `git`, not `rtk git`: rtk filters `git log` and this output is parsed. Read each SHA's
|
||||
statuses with `mcp__gitea__commit_read` `get_status`, newest first. A `skipped` status ran
|
||||
nothing, so pass over it, but only when every row of its workflow (the status name's prefix
|
||||
before ` / `) on that commit is `success` or `skipped`; otherwise a failure there may have
|
||||
|
||||
@@ -32,10 +32,10 @@ For each such workflow, run `references/already-reverted.md` again (a revert →
|
||||
the default branch's first-parent commits after the merge commit, oldest first:
|
||||
|
||||
```bash
|
||||
git log --first-parent --reverse --format=%H <merge commit>..origin/<default branch> # ADR-0023: parsed
|
||||
git log --first-parent --reverse --format=%H <merge commit>..origin/<default branch> # rtk-bare: the output is parsed
|
||||
```
|
||||
|
||||
Bare `git`, per ADR-0023: rtk filters `git log` and this output is parsed. That check's fetch
|
||||
Bare `git`, not `rtk git`: rtk filters `git log` and this output is parsed. That check's fetch
|
||||
found no revert, so none of these is at or after one. Read each SHA's statuses with
|
||||
`mcp__gitea__commit_read` `get_status`:
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: delivery
|
||||
version: 0.8.1
|
||||
version: 0.8.2
|
||||
description: Agents and skills for taking a change from spec to a verified merge through tracker-gated stages.
|
||||
author:
|
||||
name: Mortis
|
||||
|
||||
@@ -8,7 +8,7 @@ description: >
|
||||
Not branch lifecycle -> `git-branches`.
|
||||
|
||||
metadata:
|
||||
version: "0.1.8"
|
||||
version: "0.1.9"
|
||||
category: git
|
||||
source_keys:
|
||||
- conventional-commits-spec
|
||||
@@ -65,7 +65,7 @@ For an agent caller, return:
|
||||
"scope": "api",
|
||||
"description": "add user authentication",
|
||||
"body": "optional body text, or null",
|
||||
"footers": ["Fixes: #123", "Refs: #456", "Co-authored-by: Bob <bob@example.com>"]
|
||||
"footers": ["Fixes: #123", "Refs: #456", "Signed-off-by: Bob <bob@example.com>"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -59,8 +59,10 @@ Refs:
|
||||
ADR:
|
||||
RFC:
|
||||
Design:
|
||||
Co-authored-by:
|
||||
Reviewed-by:
|
||||
Signed-off-by:
|
||||
BREAKING CHANGE:
|
||||
```
|
||||
|
||||
Add an AI-attribution or co-author trailer only when the repo's AGENTS.md or CONTRIBUTING, or the
|
||||
session instructions, ask for one, and use exactly the form they give.
|
||||
@@ -90,7 +90,7 @@ Rules:
|
||||
<token> #<value> # for issue references
|
||||
```
|
||||
|
||||
- Tokens use hyphens for word separation: `Reviewed-by`, `Co-authored-by`, `Refs`.
|
||||
- Tokens use hyphens for word separation: `Reviewed-by`, `Signed-off-by`, `Refs`.
|
||||
- Exception: `BREAKING CHANGE` (space allowed, uppercase).
|
||||
- Multiple footers allowed, one per line.
|
||||
- Blank line required before the footer block.
|
||||
@@ -99,7 +99,7 @@ Valid footer examples:
|
||||
```text
|
||||
Reviewed-by: Z
|
||||
Refs: #123
|
||||
Co-authored-by: Alice <alice@example.com>
|
||||
Signed-off-by: Alice <alice@example.com>
|
||||
BREAKING CHANGE: the `--format` flag now requires a value
|
||||
```
|
||||
|
||||
|
||||
@@ -12,6 +12,6 @@ source_keys:
|
||||
3. **Determine the scope** — infer it from the files changed (`api`, `db`, `cli`, `config`). Scope is optional, but it identifies which part of the system moved and is worth setting.
|
||||
4. **Write the description** — imperative mood, no trailing period: "add user authentication", "fix race condition in cache". Neither source spec sets a target below the 100-character header maximum, but convention favours roughly 50 characters so `git log --oneline` stays readable.
|
||||
5. **Add a body when the change is non-trivial** — blank line first, wrapped at 100 characters. Explain *why*, not what: the diff already shows what changed, and the message's job is the context the diff cannot carry — motivation, root cause, tradeoffs. Follow the Why / Implementation Notes / Impact structure in `references/commit-template.md`.
|
||||
6. **Add footers where they apply** — `Fixes: #123`, `Refs: #123`, `ADR: 0012`, `Co-authored-by: Name <email>`, `BREAKING CHANGE: description`. For the full trailer list, read `references/commit-template.md`.
|
||||
6. **Add footers where they apply** — `Fixes: #123`, `Refs: #123`, `ADR: 0012`, `Signed-off-by: Name <email>`, `BREAKING CHANGE: description`. For the full trailer list, read `references/commit-template.md`.
|
||||
7. **Signal a breaking change with `!` before the colon** — `feat!: drop Node 6` is visible in `git log --oneline`, where the `BREAKING CHANGE:` footer alone is machine-readable but hidden. Use both when the break needs describing.
|
||||
8. **Validate, confirm, execute** — check header length, type, lowercase subject and trailing period against commitlint, show the message, and commit only once the caller has approved. Never add `--no-verify`.
|
||||
@@ -8,7 +8,7 @@ description: >
|
||||
`git-commits`. Not a Gitea server's history -> `gitea-branches`.
|
||||
|
||||
metadata:
|
||||
version: "1.0.3"
|
||||
version: "1.0.4"
|
||||
category: git
|
||||
source_keys:
|
||||
- git-scm-bisect-docs
|
||||
|
||||
@@ -166,10 +166,10 @@ line at roughly 72 characters with an ellipsis, on the one query whose whole poi
|
||||
is showing line content.
|
||||
|
||||
```bash
|
||||
git log -L 10,20:file.txt # bare (ADR-0023)
|
||||
git log -L /start_pattern/,/end_pattern/:file.txt # bare (ADR-0023)
|
||||
git log -L :myfunction:src/app.c # bare (ADR-0023)
|
||||
git log -L /init/,+15:config.py # bare (ADR-0023); 15 lines after first /init/ match
|
||||
git log -L 10,20:file.txt # rtk-bare: rtk truncates diff lines
|
||||
git log -L /start_pattern/,/end_pattern/:file.txt # rtk-bare: rtk truncates diff lines
|
||||
git log -L :myfunction:src/app.c # rtk-bare: rtk truncates diff lines
|
||||
git log -L /init/,+15:config.py # rtk-bare: rtk truncates diff lines; 15 lines after first /init/ match
|
||||
```
|
||||
|
||||
Range formats:
|
||||
@@ -213,8 +213,8 @@ Bare `git`, not `rtk git`: rtk appends a blank line and a `Changes:` trailer, so
|
||||
the output is no longer one record per line.
|
||||
|
||||
```bash
|
||||
git diff --name-only # bare (ADR-0023); only filenames, one per line
|
||||
git diff --name-status # bare (ADR-0023); status letter + filename per line
|
||||
git diff --name-only # rtk-bare: rtk adds a trailer; only filenames, one per line
|
||||
git diff --name-status # rtk-bare: rtk adds a trailer; status letter + filename per line
|
||||
```
|
||||
|
||||
`--name-status` uses the same status letters as `--diff-filter`.
|
||||
@@ -225,10 +225,10 @@ Bare `git`, not `rtk git`: rtk replaces the word-diff with its own diffstat
|
||||
renderer and emits none of the `[-removed-] {+added+}` markers.
|
||||
|
||||
```bash
|
||||
git diff --word-diff # bare (ADR-0023); inline word-level diff, [-removed-] {+added+} markers
|
||||
git diff --word-diff=color # bare (ADR-0023); color only, no markers
|
||||
git diff --word-diff=porcelain # bare (ADR-0023); machine-readable: +/- prefixed lines, ~ for newlines
|
||||
git diff --word-diff-regex=<re> # bare (ADR-0023); define what counts as a "word"
|
||||
git diff --word-diff # rtk-bare: rtk drops the word-diff; inline word-level diff, [-removed-] {+added+} markers
|
||||
git diff --word-diff=color # rtk-bare: rtk drops the word-diff; color only, no markers
|
||||
git diff --word-diff=porcelain # rtk-bare: rtk drops the word-diff; machine-readable: +/- prefixed lines, ~ for newlines
|
||||
git diff --word-diff-regex=<re> # rtk-bare: rtk drops the word-diff; define what counts as a "word"
|
||||
```
|
||||
|
||||
### Whitespace Flags
|
||||
|
||||
@@ -10,7 +10,7 @@ description: >
|
||||
Not submodule pointers -> `git-submodules`.
|
||||
|
||||
metadata:
|
||||
version: "1.0.4"
|
||||
version: "1.0.5"
|
||||
category: git
|
||||
source_keys:
|
||||
- git-scm-remote-docs
|
||||
|
||||
@@ -50,13 +50,13 @@ Two mitigations:
|
||||
# poisoned by an unrelated fetch.
|
||||
# The inner `git config` is bare: its stdout becomes a remote URL, so any
|
||||
# output rewriting would poison the remote silently.
|
||||
rtk git remote add origin-push $(git config remote.origin.url) # inner bare (ADR-0023)
|
||||
rtk git remote add origin-push $(git config remote.origin.url) # rtk-bare: inner command; rewritten output would corrupt the URL
|
||||
rtk git push --force-with-lease origin-push
|
||||
|
||||
# Option 2 — explicit SHA via a local tag, unaffected by tracking-branch state
|
||||
rtk git fetch
|
||||
rtk git tag base master
|
||||
git rebase -i master # bare, not `rtk` (ADR-0023): interactive sequence editor
|
||||
git rebase -i master # rtk-bare: interactive sequence editor
|
||||
rtk git push --force-with-lease=master:base master:master
|
||||
```
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ description: >
|
||||
Not interactive multi-step git guidance -> `git-workflow`.
|
||||
|
||||
metadata:
|
||||
version: "1.0.3"
|
||||
version: "1.0.4"
|
||||
category: git
|
||||
source_keys:
|
||||
- git-scm-worktree-docs
|
||||
@@ -32,7 +32,7 @@ metadata:
|
||||
| Create a local branch tracking a remote one | `rtk git worktree add --track -b <branch> <path> <remote>/<branch>` — always correct. `git worktree add <path> <branch>` expands to exactly this, but **only** under the conditions in `references/worktrees.md` |
|
||||
| Throwaway experiment, no branch | `rtk git worktree add -d <path>` — detached HEAD |
|
||||
| **Never** `git worktree add <path> <remote>/<branch>` | That ref resolves, so the shortcut never fires and you get **a detached HEAD, no branch, no upstream**. Commits there go unreachable once HEAD moves, and `git push` needs an explicit refspec. Use the tracking row above |
|
||||
| List | `git worktree list -v` to read, or `git worktree list --porcelain -z` to parse — both bare (ADR-0023): rtk re-renders the output and drops the porcelain flags |
|
||||
| List | `git worktree list -v` to read, or `git worktree list --porcelain -z` to parse — rtk-bare: rtk re-renders the output and drops the porcelain flags |
|
||||
| Lock or unlock | `rtk git worktree lock [--reason <str>] <path>` / `rtk git worktree unlock <path>` |
|
||||
| Move | `rtk git worktree move <from> <to>` |
|
||||
| Remove | `rtk git worktree remove <path>` |
|
||||
|
||||
@@ -25,7 +25,7 @@ The entry above is unpinned and tracks the remote's default branch. To pin a rel
|
||||
|
||||
## Conventions
|
||||
|
||||
Skills here run local git commands through the org's `rtk` wrapper. **When a command is prefixed, when it stays bare, and why some executable commands must stay bare are all decided by ADR-0023** (`docs/adr/0023-rtk-prefix-marks-executable-commands-only.md`), which is repo-wide and not specific to this plugin. `check-rtk-prefix` enforces the part of it that is machine-decidable.
|
||||
Skills here run local git commands through the org's `rtk` wrapper. **When a command is prefixed, when it stays bare, and why some executable commands must stay bare are all decided by ADR-0023** (`docs/adr/0023-rtk-prefix-marks-executable-commands-only.md`), which is repo-wide and not specific to this plugin. `check-rtk-prefix` enforces the part of it that is machine-decidable. A command that must stay bare carries `rtk-bare: <reason>` on the same line as the command (in a trailing comment or the same table cell), which is the gate's opt-out marker.
|
||||
|
||||
Installing this plugin without `rtk`? Every prefixed command is a plain `git` invocation with a word in front of it — drop the `rtk ` and it is correct.
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
name: git
|
||||
version: 1.4.0
|
||||
version: 1.4.1
|
||||
description: Skills and agents for working with a local Git clone over the git wire protocol, and for authoring and running the pre-commit hooks that guard it.
|
||||
author:
|
||||
name: Mortis
|
||||
|
||||
@@ -12,7 +12,7 @@ compatibility: Requires Gitea MCP server configured with a token with write:repo
|
||||
|
||||
metadata:
|
||||
category: integration
|
||||
version: "0.1.4"
|
||||
version: "0.1.5"
|
||||
source_keys:
|
||||
- gitea-mcp-repo
|
||||
- gitea-mcp-slim-go
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Sources
|
||||
|
||||
**Note on call signatures:** per `docs/adr/0011-gitea-skill-deep-modules.md`, the tool parameter
|
||||
signatures in `references/branches.md` and `references/commits.md` were re-verified live via
|
||||
`ToolSearch` against the deployed `gitea-mcp` server — **last verified against v1.7.0**, as reported
|
||||
by `get_gitea_mcp_server_version` — rather than copied verbatim from `api-reference.md` below. This resolves issue #6 comment #849's root-cause finding
|
||||
that a prior skill was authored from API docs that had drifted from the actual MCP tool schema.
|
||||
**Note on call signatures:** the tool parameter signatures in `references/branches.md` and
|
||||
`references/commits.md` were re-verified live via `ToolSearch` against the deployed `gitea-mcp`
|
||||
server — **last verified against v1.7.0**, as reported by `get_gitea_mcp_server_version` — rather
|
||||
than copied verbatim from `api-reference.md` below, because API docs can drift from the actual MCP
|
||||
tool schema, and a skill authored from them once shipped a wrong parameter.
|
||||
The research docs cited here informed gotchas, response shapes, and workflow context, not the
|
||||
parameter lists themselves.
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ compatibility: Requires Gitea MCP server configured with write:issue and write:r
|
||||
|
||||
metadata:
|
||||
category: integration
|
||||
version: "0.1.5"
|
||||
version: "0.1.6"
|
||||
source_keys:
|
||||
- gitea-mcp-repo
|
||||
- gitea-mcp-slim-go
|
||||
|
||||
@@ -8,7 +8,7 @@ source_keys:
|
||||
|
||||
# Create-flow enrichments
|
||||
|
||||
Closes out the four enrichments deferred from issue #6 comment #848. Run in this order before the
|
||||
Four enrichments to the create flow. Run them in this order before the
|
||||
`issue_write method: "create"` call in SKILL.md's create dispatch: **labels → milestone →
|
||||
assignee → dependency link**. Each step is independent and skippable on its own — a missing
|
||||
milestone fit doesn't block label inference, and so on — but this is the order that lets later
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
# Sources
|
||||
|
||||
**Note on call signatures:** per `docs/adr/0011-gitea-skill-deep-modules.md`, the tool parameter
|
||||
signatures in `references/issues.md` and `references/search.md` are re-verified live via
|
||||
`ToolSearch` against the deployed `gitea-mcp` server — they are not copied verbatim from
|
||||
`api-reference.md`. This resolves issue #6 comment #849's root-cause finding that a prior skill was
|
||||
authored from API docs that had drifted from the actual MCP tool schema. That re-verification is
|
||||
**Note on call signatures:** the tool parameter signatures in `references/issues.md` and
|
||||
`references/search.md` are re-verified live via `ToolSearch` against the deployed `gitea-mcp`
|
||||
server — they are not copied verbatim from `api-reference.md`, because API docs can drift from the
|
||||
actual MCP tool schema, and a skill authored from them once shipped a wrong parameter. That re-verification is
|
||||
ongoing, not one-off: an earlier live check recorded `list_issues` as lacking the `type` and
|
||||
`milestones` parameters `api-reference.md` documents, and both are present on the deployed
|
||||
gitea-mcp **v1.7.0**, which is the version these signatures are current as of.
|
||||
|
||||
@@ -16,7 +16,7 @@ metadata:
|
||||
- gitea-mcp-slim-go
|
||||
- context7-websites-gitea
|
||||
- context7-gitea-tea-cli
|
||||
version: "0.1.7"
|
||||
version: "0.1.8"
|
||||
|
||||
allowed-tools: Bash mcp__gitea__label_read mcp__gitea__label_write mcp__gitea__milestone_read mcp__gitea__milestone_write
|
||||
---
|
||||
|
||||
@@ -61,7 +61,7 @@ per repo label. That does not contradict `label_write`'s schema, which annotates
|
||||
server-side; where it is `false` labels in that scope stack legitimately. Read the field — never
|
||||
infer exclusivity from the `/` in a name, and never carry another repo's map over.
|
||||
|
||||
On the instance this skill was authored against (`Mortis/Holocron`) the split ran: every
|
||||
On the repo this skill was authored against the split ran: every
|
||||
`Priority/*`, `Reviewed/*` and `Status/*` label `exclusive: true`, every `Kind/*` label and
|
||||
`Compat/Breaking` `exclusive: false`. That is one repo's configuration at one point in time, recorded
|
||||
as a worked example of what the field looks like in practice — it is not a property of the taxonomy
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: gitea
|
||||
version: 1.3.10
|
||||
version: 1.3.11
|
||||
description: Skills and agents for working with a Gitea forge through its HTTP API — the forge's own objects, as distinct from the local git clone.
|
||||
author:
|
||||
name: Mortis
|
||||
|
||||
@@ -6,7 +6,7 @@ description: >
|
||||
Not read-only review -> `factory-audit`. Not skills -> `skill-author`.
|
||||
allowed-tools: Bash Read Write Edit
|
||||
metadata:
|
||||
version: "1.0.4"
|
||||
version: "1.0.5"
|
||||
category: factory
|
||||
source_keys:
|
||||
- context7-websites-code-claude
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
## templates/
|
||||
|
||||
Annotated agent definition templates copied by `scripts/new-agent.sh` when scaffolding a new agent.
|
||||
All three scaffold the `description` in the three-part ADR-0020 shape — a `Use when` trigger clause, at most one capability clause, and a boundary clause — rather than the deleted action-verb opener, and each carries a delegate-don't-restate note in the body.
|
||||
All three scaffold the `description` in the three-part context-budget shape — a `Use when` trigger clause, at most one capability clause, and a boundary clause — rather than the deleted action-verb opener, and each carries a delegate-don't-restate note in the body.
|
||||
|
||||
- **`claude-code.md`** — Claude Code agent definition template (project/user scope). Includes all supported frontmatter fields (required and optional) with inline guidance comments and `FILL IN:` placeholders.
|
||||
- **`copilot.agent.md.template`** — Copilot CLI agent definition template (CLI format, project/user scope). Excludes cloud/IDE-only fields (`target`, `user-invocable`, `disable-model-invocation`, `mcp-servers`) and Claude Code-only fields. Uses Copilot tool aliases (`execute`, `read`, `edit`, `search`, `agent`, `web`).
|
||||
|
||||
@@ -32,7 +32,7 @@ description: FILL IN: Use when <trigger>. <One capability clause.> Not <thing> -
|
||||
session whether or not this agent is ever used. Three parts, nothing else:
|
||||
a trigger clause opening "Use when", at most one capability clause, and a
|
||||
boundary clause naming a real sibling skill or agent.
|
||||
250 characters is the target, 400 the hard ceiling (ADR-0020).
|
||||
250 characters is the target, 400 the hard ceiling (context budget).
|
||||
Do not open with an action verb ("Reviews...", "Analyzes...") — that rule was
|
||||
deleted.
|
||||
Never write "Use proactively" here. It steers the Claude Code runtime and does
|
||||
|
||||
@@ -12,7 +12,7 @@ description: FILL IN: Use when <trigger>. <One capability clause.> Not <thing> -
|
||||
session whether or not this agent is ever used. Three parts, nothing else:
|
||||
a trigger clause opening "Use when", at most one capability clause, and a
|
||||
boundary clause naming a real sibling skill or agent.
|
||||
250 characters is the target, 400 the hard ceiling (ADR-0020).
|
||||
250 characters is the target, 400 the hard ceiling (context budget).
|
||||
Do not open with an action verb ("Reviews...", "Analyzes...") — that rule was
|
||||
deleted.
|
||||
"Use proactively" is valid HERE and only here: it steers the Claude Code runtime
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ description: FILL IN: Use when <trigger>. <One capability clause.> Not <thing> -
|
||||
every session whether or not this agent is ever used. Three parts, nothing else:
|
||||
a trigger clause opening "Use when", at most one capability clause, and a
|
||||
boundary clause naming a real sibling skill or agent.
|
||||
250 characters is the target, 400 the hard ceiling (ADR-0020).
|
||||
250 characters is the target, 400 the hard ceiling (context budget).
|
||||
Do not open with an action verb ("Reviews...", "Analyzes...") — that rule was deleted.
|
||||
Never write "Use proactively" here. It steers the Claude Code runtime and does nothing
|
||||
in Copilot, and factory-audit's KyberforgeCopilot.ProactivePhrase grades it a hard FAIL.
|
||||
|
||||
@@ -285,7 +285,7 @@ else
|
||||
if [[ "$SCOPE" == "plugin" ]]; then
|
||||
echo " 1. Fill in $APM_FILE — replace every FILL IN: placeholder. Optional fields are" >&2
|
||||
echo " scaffolded there as commented blocks; uncomment the ones that apply." >&2
|
||||
echo " Description: 250 chars target / 400 ceiling (ADR-0020). The body has no" >&2
|
||||
echo " Description: 250 chars target / 400 ceiling (context budget). The body has no" >&2
|
||||
echo " word gate — delegate to a skill instead of restating what it does." >&2
|
||||
echo " 2. Populate $SOURCES_DIR/sources.md with research sources, or delete it" >&2
|
||||
echo " 3. Validate: $VALIDATE_HINT $APM_FILE" >&2
|
||||
@@ -294,7 +294,7 @@ else
|
||||
else
|
||||
echo " 1. Fill in $CC_FILE — replace every FILL IN: placeholder. Optional fields are" >&2
|
||||
echo " scaffolded there as commented blocks; uncomment the ones that apply." >&2
|
||||
echo " Description: 250 chars target / 400 ceiling (ADR-0020). The body has no" >&2
|
||||
echo " Description: 250 chars target / 400 ceiling (context budget). The body has no" >&2
|
||||
echo " word gate — delegate to a skill instead of restating what it does." >&2
|
||||
echo " 2. Fill in $CP_FILE — same, and heed its closing comment: the Claude Code-only" >&2
|
||||
echo " fields it names must not cross over from the file above." >&2
|
||||
|
||||
@@ -7,7 +7,7 @@ description: >
|
||||
fixes -> agent-author.
|
||||
allowed-tools: Bash Read
|
||||
metadata:
|
||||
version: "1.0.7"
|
||||
version: "1.0.8"
|
||||
category: factory
|
||||
source_keys:
|
||||
- agentskills-home
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# lib-boundary-resolver.sh — SOURCED, never executed.
|
||||
#
|
||||
# The ADR-0020 shared boundary resolver — the ONE copy in the repo. Both of
|
||||
# The shared boundary resolver — the ONE copy in the repo. Both of
|
||||
# validate.sh's modes compose it into the Python program they run, and so does
|
||||
# the repo-root hook scripts/skill-size-check.sh, so the audit and the commit
|
||||
# hook resolve boundary targets through the same code rather than through
|
||||
@@ -40,8 +40,8 @@
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2034
|
||||
|
||||
IFS='' read -r -d '' KYBERFORGE_RESOLVER_PY <<'KYBERFORGE_ADR0020_RESOLVER_PY' || true
|
||||
# ===== BEGIN ADR-0020 SHARED BOUNDARY RESOLVER =====
|
||||
IFS='' read -r -d '' KYBERFORGE_RESOLVER_PY <<'KYBERFORGE_RESOLVER_PY_END' || true
|
||||
# ===== BEGIN SHARED BOUNDARY RESOLVER =====
|
||||
# ONE resolver, and this is its only copy. Sourced from this file by:
|
||||
# plugins/kyberforge/.apm/skills/factory-audit/scripts/validate.sh (both modes)
|
||||
# scripts/skill-size-check.sh (the repo-root commit hook)
|
||||
@@ -357,7 +357,7 @@ def known_targets(start_dir):
|
||||
# already added, so a one-plugin monorepo shows a delta of zero and would
|
||||
# wrongly reach for the deployed trees — including the user's global
|
||||
# ~/.claude/skills, making the verdict depend on what happens to be
|
||||
# installed (ADR-0020 lines 118-127).
|
||||
# installed.
|
||||
root, root_has_plugins = _authoring_root(start)
|
||||
if root:
|
||||
_collect_authoring_root(root, names)
|
||||
@@ -373,7 +373,7 @@ def known_targets(start_dir):
|
||||
# carrying "do not"/"instead"/"rather than"/"not for"). Without the second
|
||||
# condition, pc-run's "run pre-commit hooks" reads as a route to a
|
||||
# non-existent `pre-commit` skill.
|
||||
# * A BARE arrow target counts only in ADR-0020's compressed boundary form,
|
||||
# * A BARE arrow target counts only in the compressed boundary form,
|
||||
# `Not <thing> -> <skill-name>`. The example that motivated it is gone:
|
||||
# diagnose's process chain "fix -> regression-test", which without the
|
||||
# gate read as a route to a non-existent `regression-test` skill, was cut
|
||||
@@ -456,7 +456,7 @@ def known_targets(start_dir):
|
||||
# that had no escape hatch.
|
||||
#
|
||||
# EXPLICIT ROUTE NOTATION is exempt from corroboration and always blocks:
|
||||
# ADR-0020's compressed arrow (`Not <thing> -> <name>`) and Claude Code's
|
||||
# the compressed arrow (`Not <thing> -> <name>`) and Claude Code's
|
||||
# invocation form (`/<name>`). Neither is ever how English cites a tool — nobody
|
||||
# writes `-> pre-commit` or `/pre-commit` to mean the hook — so there is no
|
||||
# ambiguity to resolve, and an author who wants a route checked unconditionally
|
||||
@@ -486,7 +486,7 @@ def known_targets(start_dir):
|
||||
#
|
||||
# THE TWO SWEEPS ARE GATED DIFFERENTLY, and the asymmetry is the whole point.
|
||||
# `/name` is Claude Code's invocation syntax and nothing else — no English
|
||||
# sentence contains one by accident — so the ADR-0020 amendment and
|
||||
# sentence contains one by accident — so the boundary-target contract and
|
||||
# docs/spec/gates.md both promise it blocks UNCONDITIONALLY, for any name. So
|
||||
# NOTATION_SLASH is swept over every sentence, boundary marker or not. Gating it
|
||||
# on BOUNDARY_MARKER made that promise false for the last sentence of
|
||||
@@ -590,7 +590,7 @@ ARROW_BOUNDARY = re.compile(
|
||||
r"\bnot\b%s*?(?:->|→)\s*(%s)\b" % (CLAUSE_BODY, NAME_HYPH), re.I)
|
||||
BACKTICK = re.compile(r"`(%s)`" % NAME_HYPH, re.I)
|
||||
# A boundary clause takes two shapes and BOTH count: the prose markers, and
|
||||
# ADR-0020's compressed arrow form `Not <thing> -> <name>`.
|
||||
# the compressed arrow form `Not <thing> -> <name>`.
|
||||
BOUNDARY_MARKER = re.compile(r"\b(?:do\s+not|instead|rather\s+than|not\s+for)\b", re.I)
|
||||
BOUNDARY_ARROW = re.compile(r"\bnot\b%s*?(?:->|→)" % CLAUSE_BODY, re.I)
|
||||
# Sentence boundaries decide the CORROBORATION scope above, so getting one wrong
|
||||
@@ -672,7 +672,7 @@ def _notation(text, start, arrow):
|
||||
"""True if the name is written in route NOTATION rather than in prose.
|
||||
|
||||
Two forms qualify: `/name` (Claude Code's invocation syntax, detected from
|
||||
the character before the name) and `-> name` (ADR-0020's compressed boundary
|
||||
the character before the name) and `-> name` (the compressed boundary
|
||||
form, passed in by the caller that matched the arrow). A backticked name
|
||||
does NOT qualify — a code span is how a tool, a file and a skill are all
|
||||
cited, so it carries no intent the follower test hasn't already read.
|
||||
@@ -690,7 +690,7 @@ def _add(out, text, name, start, end, strict=None, arrow=False):
|
||||
_terminal() and a follower outside FOLLOWER_OK set may_dangle=False. The
|
||||
target then reached unresolved_targets() unblockable — and, before the
|
||||
companion fix there, unreported as well. `... use /no-such-skill
|
||||
afterwards.` exited 0 in total silence, on the one form ADR-0020 offers an
|
||||
afterwards.` exited 0 in total silence, on the one form the contract offers an
|
||||
author who wants a route checked unconditionally.
|
||||
"""
|
||||
if not name:
|
||||
@@ -788,7 +788,7 @@ def _clause_end(description, pos):
|
||||
|
||||
|
||||
def _arrow_clause_spans(description):
|
||||
"""(start, end) for EACH ADR-0020 arrow clause, one span per clause.
|
||||
"""(start, end) for EACH compressed arrow clause, one span per clause.
|
||||
|
||||
A clause runs from its `Not` to whichever comes first: the start of the
|
||||
NEXT arrow clause, or the end of the clause body. Bounding on the next
|
||||
@@ -808,7 +808,7 @@ def _arrow_clause_parses(clause):
|
||||
"""True when either arrow extractor reads a target out of ONE clause.
|
||||
|
||||
Kept apart from boundary_targets() because the arrow form is the one shape
|
||||
that ALWAYS names a target: ADR-0020's `Not <thing> -> <name>`. A clause
|
||||
that ALWAYS names a target: the compressed `Not <thing> -> <name>`. A clause
|
||||
written that way from which nothing could be extracted is a parse failure
|
||||
that deserves its own message, and telling it apart needs the arrow targets
|
||||
alone rather than every target in the description.
|
||||
@@ -828,7 +828,7 @@ def boundary_clause_status(description):
|
||||
the second sends the author hunting for a problem that is not there, and
|
||||
three of them reworded a correct clause to satisfy a regex instead.
|
||||
|
||||
'unparsed' is the narrow, certain case: an ADR-0020 arrow clause was
|
||||
'unparsed' is the narrow, certain case: a compressed arrow clause was
|
||||
detected and NO target came out of IT. The arrow form always names one, so
|
||||
zero targets means the name is written in a shape the extractor cannot see
|
||||
— a single-word bare target (`Not X -> forge`, which has to be written
|
||||
@@ -865,7 +865,7 @@ def multi_target_arrow_clauses(description):
|
||||
never to arrows, so `Not X -> a or b` resolved `a`, left `b` neither
|
||||
resolved nor reported, and then printed "1 of 1 boundary target(s) resolve"
|
||||
on a clause naming two — a gate under-reporting its own coverage, which is
|
||||
the one failure mode ADR-0020 says a gate must not have.
|
||||
the one failure mode a gate must never have.
|
||||
|
||||
The clause is REJECTED rather than the arrow scan extended. Extending it
|
||||
would widen the resolver's deliberately conservative false-positive tuning
|
||||
@@ -1037,7 +1037,7 @@ def unresolved_body_targets(body, known):
|
||||
# --- Frontmatter ----------------------------------------------------------
|
||||
# Tolerant on the way in, HARD-FAILING on the way out. A UTF-8 BOM, a leading
|
||||
# blank line, trailing whitespace after either `---`, or CRLF line endings all
|
||||
# defeated the old `^---\n(.*?)\n---`, and the miss was SILENT: every ADR-0020
|
||||
# defeated the old `^---\n(.*?)\n---`, and the miss was SILENT: every context-budget
|
||||
# check was skipped and the file reported green (measured: a 550-character
|
||||
# description with a 1,000-word body exited 0 behind a BOM). A file that cannot
|
||||
# be measured must never report green, so every caller of these two ERRORs on a
|
||||
@@ -1076,7 +1076,7 @@ def description_value(fm_text):
|
||||
description is present. A line regex cannot: `description:` with no value
|
||||
followed by `model: sonnet` lets `\\s*` cross the newline and captures the
|
||||
NEXT key, which reads as a non-empty description, skips the "missing or
|
||||
empty" failure, and then early-returns out of every ADR-0020 gate on the
|
||||
empty" failure, and then early-returns out of every context-budget gate on the
|
||||
genuinely empty folded value. That combination exited 0 with zero output on
|
||||
a BLOCKING pre-push gate.
|
||||
"""
|
||||
@@ -1111,7 +1111,7 @@ def hand_invoked(fm_text):
|
||||
|
||||
`disable-model-invocation: true` removes a skill from the model-visible
|
||||
listing entirely — it is not preloaded, and the Skill tool refuses to call
|
||||
it — so its description is never matched against user intent. ADR-0020 and
|
||||
it — so its description is never matched against user intent. The context budget and
|
||||
skill-author's contract give such a skill ONE plain human-facing sentence:
|
||||
no trigger list, no boundary clause. No validator knew the field existed
|
||||
(issue #108), so the boundary-clause SUGGESTION fired on exactly the shape
|
||||
@@ -1276,6 +1276,6 @@ def missing_reference_pointers(body, skill_dir):
|
||||
if not os.path.isfile(os.path.join(skill_dir, 'references', match.group(1))):
|
||||
missing.add('references/' + match.group(1))
|
||||
return sorted(missing)
|
||||
# ===== END ADR-0020 SHARED BOUNDARY RESOLVER =====
|
||||
KYBERFORGE_ADR0020_RESOLVER_PY
|
||||
# ===== END SHARED BOUNDARY RESOLVER =====
|
||||
KYBERFORGE_RESOLVER_PY_END
|
||||
KYBERFORGE_RESOLVER_PY="${KYBERFORGE_RESOLVER_PY%$'\n'}"
|
||||
@@ -2,7 +2,7 @@
|
||||
# lib-checks-agent.sh — SOURCED, never executed.
|
||||
#
|
||||
# agent-audit's structural check suite: everything in its validate.sh that is
|
||||
# NOT the ADR-0020 shared boundary resolver, lifted verbatim and split at the
|
||||
# NOT the shared boundary resolver, lifted verbatim and split at the
|
||||
# resolver's markers. validate.sh reassembles
|
||||
#
|
||||
# $KYBERFORGE_AGENT_PREAMBLE_PY
|
||||
@@ -17,8 +17,8 @@
|
||||
#
|
||||
# The dimension vocabulary and the tiers here are agent-audit's and are
|
||||
# deliberately NOT reconciled with lib-checks-skill.sh's. Agents take the
|
||||
# ADR-0020 description gates and no body word gate at all; adding one would
|
||||
# contradict the ADR.
|
||||
# context-budget description gates and no body word gate at all; adding one would
|
||||
# be wrong (see the body-gate note below).
|
||||
#
|
||||
# Consumed by: validate.sh, agent mode.
|
||||
# shellcheck shell=bash
|
||||
@@ -36,7 +36,7 @@ kyberforge_agent_preflight() {
|
||||
# dependency sends the reader to install the wrong thing.
|
||||
if ! command -v python3 > /dev/null 2>&1; then
|
||||
echo "Error: python3 is required but was not found on PATH." >&2
|
||||
echo " Why: skipping the ADR-0020 description and boundary-target gates would be a vacuous pass." >&2
|
||||
echo " Why: skipping the description and boundary-target gates would be a vacuous pass." >&2
|
||||
echo " Fix: install python3 (pre-commit itself is a Python application, so it is almost certainly already present)." >&2
|
||||
# Exit 2, the never-ran tier: no check ran, so this is not a findings result.
|
||||
# lib-provenance-*.sh has always exited 2 here; this matches it.
|
||||
@@ -45,7 +45,7 @@ kyberforge_agent_preflight() {
|
||||
|
||||
if ! python3 -c 'import yaml' > /dev/null 2>&1; then
|
||||
echo "Error: PyYAML is required but is not importable by python3." >&2
|
||||
echo " Why: skipping the ADR-0020 description and boundary-target gates would be a vacuous pass." >&2
|
||||
echo " Why: skipping the description and boundary-target gates would be a vacuous pass." >&2
|
||||
echo " Fix: python3 -m pip install PyYAML (or your distro's python3-yaml package)." >&2
|
||||
# Exit 2, the never-ran tier: a missing hard dependency is not a findings result.
|
||||
exit 2
|
||||
@@ -62,13 +62,13 @@ import yaml
|
||||
|
||||
# Output is UTF-8 for the same reason input is: under LC_ALL=C the streams
|
||||
# default to ASCII, and this script's own message text carries em dashes (the
|
||||
# ADR-0020 boundary SUGGESTION is one). Pinning only the reads moved the crash
|
||||
# boundary-clause SUGGESTION is one). Pinning only the reads moved the crash
|
||||
# from the read to the write — a UnicodeEncodeError raised while PRINTING, after
|
||||
# every check has already run, which loses the whole report and (here) flips a
|
||||
# clean exit 0 into a traceback and an exit 1. read_text() in the shared
|
||||
# resolver block below pins the reads; this pins the writes.
|
||||
#
|
||||
# Deliberately OUTSIDE the ADR-0020 shared boundary resolver block: the two
|
||||
# Deliberately OUTSIDE the shared boundary resolver block: the two
|
||||
# validate.sh modes print findings, skill-size-check.sh has its own top-level
|
||||
# equivalent, and the block is one sourced copy all three share, so each
|
||||
# consumer's own startup stays in its own preamble.
|
||||
@@ -141,7 +141,7 @@ SUBAGENT_UNAVAILABLE_TOOLS = {
|
||||
# Copilot body length limit (chars) — content beyond this is silently truncated
|
||||
COPILOT_BODY_LIMIT = 30000
|
||||
|
||||
# ADR-0020 description budget. An agent's name + description is preloaded into
|
||||
# Context-budget description limit. An agent's name + description is preloaded into
|
||||
# every session exactly like a skill's, so agents take the SAME description
|
||||
# gates. These two constants are DUPLICATED in three places:
|
||||
# scripts/skill-size-check.sh, lib-checks-skill.sh beside this file, and here.
|
||||
@@ -157,7 +157,7 @@ COPILOT_BODY_LIMIT = 30000
|
||||
# rather than silently diverging.
|
||||
#
|
||||
# Agents deliberately take NO body word gate, and adding one here would
|
||||
# contradict ADR-0020: a skill body is loaded into the caller's context and
|
||||
# be wrong: a skill body is loaded into the caller's context and
|
||||
# competes with the live conversation, while an agent body becomes the system
|
||||
# prompt of a fresh context. The rationale for the 900-word skill ceiling does
|
||||
# not transfer. Agent body length falls out of the delegation rule instead.
|
||||
@@ -170,7 +170,7 @@ suggestions = []
|
||||
|
||||
def fail(msg):
|
||||
# stderr, matching scripts/skill-size-check.sh's ERROR routing. All three
|
||||
# scripts in the ADR-0020 family now agree: findings that fail the run go to
|
||||
# scripts that run the context-budget gates now agree: findings that fail the run go to
|
||||
# stderr, everything advisory (SUGGESTION / INFO) goes to stdout. Both repo
|
||||
# callers (check-apm-agents-valid.sh, check-scope-walkup-sync.sh) capture
|
||||
# `2>&1`, so nothing a human reads moves.
|
||||
@@ -208,7 +208,7 @@ def extract_field(fm, field):
|
||||
`\\s*` after the colon crosses the newline, so `description:` with no value
|
||||
followed by `model: sonnet` captured `model: sonnet` as the description.
|
||||
That made the value look present, skipped the "missing or empty" failure,
|
||||
and then every ADR-0020 gate early-returned on the genuinely empty folded
|
||||
and then every context-budget gate early-returned on the genuinely empty folded
|
||||
value — a valueless description exited 0 with zero output on a BLOCKING
|
||||
pre-push gate. This function is now used only for fields with no folding
|
||||
semantics (name, tools); description goes through description_value(), the
|
||||
@@ -234,14 +234,14 @@ def agent_description(fm, local_fname):
|
||||
# `exc` carries the whole clause — invalid YAML, a non-mapping block, or
|
||||
# a description of the wrong type. Do not prefix a diagnosis here; the
|
||||
# last one named a syntax error for two failures that have none.
|
||||
fail(f"{exc} — the ADR-0020 description and boundary-target gates could "
|
||||
fail(f"{exc} — the description and boundary-target gates could "
|
||||
f"not run — {local_fname}")
|
||||
return None
|
||||
|
||||
def check_description_budget(value, local_fname, by_hand=False):
|
||||
"""ADR-0020 description gates — identical for every scope.
|
||||
"""context-budget description gates — identical for every scope.
|
||||
|
||||
`by_hand` is ADR-0020's hand-invocation carve-out (issue #108): an agent
|
||||
`by_hand` is the hand-invocation carve-out (issue #108): an agent
|
||||
carrying `disable-model-invocation: true` is absent from the model-visible
|
||||
listing, so the 250-character SUGGESTION — a routing-quality budget — has
|
||||
no listing to apply to. The 400-character ceiling is unaffected.
|
||||
@@ -251,18 +251,18 @@ def check_description_budget(value, local_fname, by_hand=False):
|
||||
dlen = len(value)
|
||||
if dlen > DESC_MAX_CHARS:
|
||||
fail(f"description is {dlen} chars — exceeds the {DESC_MAX_CHARS}-character "
|
||||
f"ADR-0020 ceiling. It is preloaded into every session whether or not the "
|
||||
f"context-budget ceiling. It is preloaded into every session whether or not the "
|
||||
f"agent is invoked. Keep a trigger clause, at most one capability clause, "
|
||||
f"and a boundary clause; move capability enumeration, output-format detail, "
|
||||
f"composition notes and implementation detail to the body — {local_fname}")
|
||||
elif dlen > DESC_SUGGEST_CHARS and not by_hand:
|
||||
suggest(f"description is {dlen} chars — over the {DESC_SUGGEST_CHARS}-character "
|
||||
f"ADR-0020 target (hard fail at {DESC_MAX_CHARS}). The SUGGESTION tier is "
|
||||
f"context-budget target (hard fail at {DESC_MAX_CHARS}). The SUGGESTION tier is "
|
||||
f"what moves the corpus average; the FAIL tier only stops outliers "
|
||||
f"— {local_fname}")
|
||||
|
||||
def check_boundary(value, fpath, local_fname, by_hand=False):
|
||||
"""ADR-0020 boundary clause + resolvable boundary targets.
|
||||
"""Boundary clause + resolvable boundary targets.
|
||||
|
||||
agent-author's SKILL.md states that an agent's boundary targets must
|
||||
resolve, but until this ran no script checked it — the contract was
|
||||
@@ -287,7 +287,7 @@ def check_boundary(value, fpath, local_fname, by_hand=False):
|
||||
status = boundary_clause_status(value) if not by_hand else 'present'
|
||||
if status == 'absent':
|
||||
suggest(f"description has no boundary clause — add the prose form (\"Do not use "
|
||||
f"for X — use `y` instead\") or ADR-0020's compressed form (\"Not X -> y\") "
|
||||
f"for X — use `y` instead\") or the compressed form (\"Not X -> y\") "
|
||||
f"so the router knows where NOT to send this agent — {local_fname}")
|
||||
elif status == 'unparsed':
|
||||
suggest(f"description has an arrow boundary clause (\"Not X -> y\") from which no "
|
||||
@@ -527,7 +527,7 @@ def check_apm_agent_file(fpath, allowlist, stem):
|
||||
# Presence is decided on the FOLDED value, never on a line regex. Deciding
|
||||
# it on extract_field's raw capture is what let `description:` with no value
|
||||
# pass this gate in total silence: the capture picked up the next key, so
|
||||
# "missing or empty" never fired, and every ADR-0020 check below then
|
||||
# "missing or empty" never fired, and every context-budget check below then
|
||||
# early-returned on the empty folded value. Exit 0, zero output, no gate run.
|
||||
folded = agent_description(fm, local_fname)
|
||||
if folded is None:
|
||||
@@ -624,7 +624,7 @@ def check_file(fpath, file_provider):
|
||||
# Presence is decided on the FOLDED value, never on a line regex. Deciding
|
||||
# it on extract_field's raw capture is what let `description:` with no value
|
||||
# pass this gate in total silence: the capture picked up the next key, so
|
||||
# "missing or empty" never fired, and every ADR-0020 check below then
|
||||
# "missing or empty" never fired, and every context-budget check below then
|
||||
# early-returned on the empty folded value. Exit 0, zero output, no gate run.
|
||||
folded = agent_description(fm, local_fname)
|
||||
if folded is None:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# lib-checks-skill.sh — SOURCED, never executed.
|
||||
#
|
||||
# skill-audit's structural check suite: everything in its validate.sh that is
|
||||
# NOT the ADR-0020 shared boundary resolver, lifted verbatim and split at the
|
||||
# NOT the shared boundary resolver, lifted verbatim and split at the
|
||||
# resolver's markers. validate.sh reassembles
|
||||
#
|
||||
# $KYBERFORGE_SKILL_PREAMBLE_PY
|
||||
@@ -17,7 +17,7 @@
|
||||
# INFO tiers here are skill-audit's and are deliberately NOT reconciled with
|
||||
# lib-checks-agent.sh's. The two suites disagree on purpose: a skill body is
|
||||
# loaded into the caller's context, an agent body becomes the system prompt of
|
||||
# a fresh one, so ADR-0020 gives skills a body word budget and agents none.
|
||||
# a fresh one, so the context budget gives skills a body word budget and agents none.
|
||||
#
|
||||
# Consumed by: validate.sh, skill mode.
|
||||
# shellcheck shell=bash
|
||||
@@ -35,7 +35,7 @@ kyberforge_skill_preflight() {
|
||||
# dependency sends the reader to install the wrong thing.
|
||||
if ! command -v python3 > /dev/null 2>&1; then
|
||||
echo "Error: python3 is required but was not found on PATH." >&2
|
||||
echo " Why: skipping the ADR-0020 description, body and boundary-target gates would be a vacuous pass." >&2
|
||||
echo " Why: skipping the description, body and boundary-target gates would be a vacuous pass." >&2
|
||||
echo " Fix: install python3 (pre-commit itself is a Python application, so it is almost certainly already present)." >&2
|
||||
# Exit 2, the never-ran tier: no check ran, so this is not a findings result.
|
||||
# lib-provenance-*.sh has always exited 2 here; this matches it.
|
||||
@@ -44,7 +44,7 @@ kyberforge_skill_preflight() {
|
||||
|
||||
if ! python3 -c 'import yaml' > /dev/null 2>&1; then
|
||||
echo "Error: PyYAML is required but is not importable by python3." >&2
|
||||
echo " Why: skipping the ADR-0020 description, body and boundary-target gates would be a vacuous pass." >&2
|
||||
echo " Why: skipping the description, body and boundary-target gates would be a vacuous pass." >&2
|
||||
echo " Fix: python3 -m pip install PyYAML (or your distro's python3-yaml package)." >&2
|
||||
# Exit 2, the never-ran tier: a missing hard dependency is not a findings result.
|
||||
exit 2
|
||||
@@ -61,13 +61,13 @@ import yaml
|
||||
|
||||
# Output is UTF-8 for the same reason input is: under LC_ALL=C the streams
|
||||
# default to ASCII, and this script's own message text carries em dashes (the
|
||||
# ADR-0020 boundary SUGGESTION is one). Pinning only the reads moved the crash
|
||||
# boundary-clause SUGGESTION is one). Pinning only the reads moved the crash
|
||||
# from the read to the write — a UnicodeEncodeError raised while PRINTING, after
|
||||
# every check has already run, which loses the whole report and (here) flips a
|
||||
# clean exit 0 into a traceback and an exit 1. read_text() in the shared
|
||||
# resolver block below pins the reads; this pins the writes.
|
||||
#
|
||||
# Deliberately OUTSIDE the ADR-0020 shared boundary resolver block: the two
|
||||
# Deliberately OUTSIDE the shared boundary resolver block: the two
|
||||
# validate.sh modes print findings, skill-size-check.sh has its own top-level
|
||||
# equivalent, and the block is one sourced copy all three share, so each
|
||||
# consumer's own startup stays in its own preamble.
|
||||
@@ -92,7 +92,7 @@ def ok(msg):
|
||||
|
||||
def fail(msg):
|
||||
# stderr, matching scripts/skill-size-check.sh's ERROR routing. All three
|
||||
# scripts in the ADR-0020 family now agree: findings that fail the run go to
|
||||
# scripts that run the context-budget gates now agree: findings that fail the run go to
|
||||
# stderr, everything advisory (PASS / SUGGESTION / INFO) goes to stdout.
|
||||
# Both repo callers capture `2>&1`, so nothing a human reads moves.
|
||||
global failed
|
||||
@@ -102,7 +102,7 @@ def fail(msg):
|
||||
def suggest(msg):
|
||||
# SUGGESTIONs are printed after every check and NEVER touch the exit code.
|
||||
# factory-audit's SKILL.md Step 4 report counts them into its
|
||||
# `PASS (N suggestions)` result line, which is what makes the ADR-0020 SUGGESTION tier visible
|
||||
# `PASS (N suggestions)` result line, which is what makes the context-budget SUGGESTION tier visible
|
||||
# rather than another silently-ignored warning (ADR-0013).
|
||||
suggestions.append(msg)
|
||||
|
||||
@@ -167,7 +167,7 @@ except FrontmatterError as exc:
|
||||
|
||||
dir_name = os.path.basename(skill_dir)
|
||||
|
||||
# ADR-0020's hand-invocation carve-out (issue #108). `disable-model-invocation:
|
||||
# the hand-invocation carve-out (issue #108). `disable-model-invocation:
|
||||
# true` takes the skill out of the model-visible listing entirely, so the
|
||||
# trigger/capability/boundary rules and the 250-character routing target do not
|
||||
# apply to it — the audit's own references/skill-description-quality.md Step 0 says
|
||||
@@ -211,8 +211,8 @@ if desc:
|
||||
else:
|
||||
fail("description field is missing or empty")
|
||||
|
||||
# description length — agentskills.io spec backstop. UNCHANGED by ADR-0020:
|
||||
# 1024 is the specification's hard limit, and the ADR-0020 budget gate below
|
||||
# description length — agentskills.io spec backstop. UNCHANGED by the context budget:
|
||||
# 1024 is the specification's hard limit, and the context-budget gate below
|
||||
# sits underneath it rather than replacing it.
|
||||
if desc:
|
||||
dlen = len(desc)
|
||||
@@ -295,12 +295,12 @@ MAX_LINES = 500
|
||||
# for the full measurement.
|
||||
MAX_WORDS = 2770
|
||||
|
||||
# ADR-0020 context-budget gates. DUPLICATED from scripts/skill-size-check.sh
|
||||
# Context-budget gates. DUPLICATED from scripts/skill-size-check.sh
|
||||
# for exactly the same cache-isolation reason as MAX_LINES/MAX_WORDS above, and
|
||||
# carrying the same warning — tests/test-skill-size-check.sh asserts the copies
|
||||
# agree, so drift fails CI instead of shipping an audit that disagrees with the
|
||||
# commit hook. lib-checks-agent.sh, beside this file, holds a third copy of the
|
||||
# two description constants; per ADR-0020 agents take the description gates and
|
||||
# two description constants; agents take the description gates and
|
||||
# deliberately take NO body word gate, because an agent body becomes the system
|
||||
# prompt of a fresh context rather than competing with a live conversation.
|
||||
#
|
||||
@@ -331,33 +331,33 @@ else:
|
||||
|
||||
body = content[body_start:]
|
||||
|
||||
# --- ADR-0020: description budget -----------------------------------------
|
||||
# --- context budget: description budget ------------------------------------
|
||||
if desc:
|
||||
dlen = len(desc)
|
||||
if dlen > DESC_MAX_CHARS:
|
||||
fail(f"description is {dlen} chars — exceeds the {DESC_MAX_CHARS}-character "
|
||||
f"ADR-0020 ceiling. It is preloaded into every session whether or not the "
|
||||
f"context-budget ceiling. It is preloaded into every session whether or not the "
|
||||
f"skill is invoked. Keep a trigger clause, at most one capability clause, "
|
||||
f"and a boundary clause; move capability enumeration, output-format detail, "
|
||||
f"composition notes and implementation detail to the body or a references/ file")
|
||||
elif dlen > DESC_SUGGEST_CHARS and not by_hand:
|
||||
suggest(f"description is {dlen} chars — over the {DESC_SUGGEST_CHARS}-character "
|
||||
f"ADR-0020 target (hard fail at {DESC_MAX_CHARS}). The SUGGESTION tier is "
|
||||
f"context-budget target (hard fail at {DESC_MAX_CHARS}). The SUGGESTION tier is "
|
||||
f"what moves the corpus average; the FAIL tier only stops outliers")
|
||||
elif by_hand:
|
||||
ok(f"description length {dlen} chars (hand-invoked: the {DESC_SUGGEST_CHARS}-character "
|
||||
f"routing target does not apply, the {DESC_MAX_CHARS}-character ceiling still does)")
|
||||
else:
|
||||
ok(f"description length {dlen} chars (ADR-0020 target: {DESC_SUGGEST_CHARS})")
|
||||
ok(f"description length {dlen} chars (context-budget target: {DESC_SUGGEST_CHARS})")
|
||||
|
||||
# --- ADR-0020: body budget -------------------------------------------------
|
||||
# --- context budget: body budget -------------------------------------------
|
||||
# Counts the BODY ONLY — everything after the closing --- of the frontmatter.
|
||||
# This is a different measurement from MAX_WORDS above, which counts the whole
|
||||
# file including frontmatter as a spec-conformance backstop. Both are reported.
|
||||
body_word_count = len(body.split())
|
||||
if body_word_count > BODY_MAX_WORDS:
|
||||
fail(f"SKILL.md body is {body_word_count} words — exceeds the {BODY_MAX_WORDS}-word "
|
||||
f"ADR-0020 ceiling (body only; separate from the {MAX_WORDS}-word whole-file "
|
||||
f"context-budget ceiling (body only; separate from the {MAX_WORDS}-word whole-file "
|
||||
f"limit above). Move lookup tables, spec restatements, output schemas, templates "
|
||||
f"and rationale prose to references/ behind an explicit "
|
||||
f"\"If X, read `references/file.md`\" trigger. At two or more mutually exclusive "
|
||||
@@ -365,9 +365,9 @@ if body_word_count > BODY_MAX_WORDS:
|
||||
f"common to every branch, each flow gets its own self-contained references/ file")
|
||||
elif body_word_count > BODY_SUGGEST_WORDS:
|
||||
suggest(f"SKILL.md body is {body_word_count} words — over the {BODY_SUGGEST_WORDS}-word "
|
||||
f"ADR-0020 target (hard fail at {BODY_MAX_WORDS})")
|
||||
f"context-budget target (hard fail at {BODY_MAX_WORDS})")
|
||||
else:
|
||||
ok(f"SKILL.md body word count {body_word_count} (ADR-0020 target: {BODY_SUGGEST_WORDS})")
|
||||
ok(f"SKILL.md body word count {body_word_count} (context-budget target: {BODY_SUGGEST_WORDS})")
|
||||
|
||||
# --- Reference pointers must exist -----------------------------------------
|
||||
# FAIL, not SUGGESTION: a dispatch table naming a references/ file that is not
|
||||
@@ -396,7 +396,7 @@ if gotchas is not None:
|
||||
f"{round(100.0 * GOTCHA_MAX_BODY_FRACTION)}% guideline. Move the durable "
|
||||
f"parts to references/ and keep the section for live traps")
|
||||
|
||||
# --- ADR-0020: boundary clause present -------------------------------------
|
||||
# --- boundary clause present -----------------------------------------------
|
||||
# SUGGESTION, not FAIL: detecting the absence is deterministic, but whether
|
||||
# this particular skill warrants a boundary clause is judgment. Both accepted
|
||||
# shapes count — the prose markers and the compressed `Not <thing> -> <name>`.
|
||||
@@ -417,7 +417,7 @@ elif desc:
|
||||
ok("description has a boundary clause")
|
||||
elif status == 'absent':
|
||||
suggest("description has no boundary clause — add the prose form (\"Do not use "
|
||||
"for X — use `y` instead\") or ADR-0020's compressed form (\"Not X -> y\") "
|
||||
"for X — use `y` instead\") or the compressed form (\"Not X -> y\") "
|
||||
"so the router knows where NOT to send this skill")
|
||||
else:
|
||||
suggest("description has an arrow boundary clause (\"Not X -> y\") from which no "
|
||||
@@ -436,7 +436,7 @@ elif desc:
|
||||
f"nothing. Split it into one arrow per target: \"Not X -> {first}. "
|
||||
f"Not Y -> {second}.\"")
|
||||
|
||||
# --- ADR-0020: resolvable boundary targets ---------------------------------
|
||||
# --- resolvable boundary targets -------------------------------------------
|
||||
# The resolution universe comes from the SKILL's own location: the authoring
|
||||
# root above it (every sibling plugin in the monorepo), its own apm package, and
|
||||
# the packages that package declares in apm.yml dependencies.apm. It is never
|
||||
|
||||
@@ -5,7 +5,7 @@ set -euo pipefail
|
||||
# target is a skill directory or an agent definition file and runs the matching
|
||||
# check suite; the two suites live in lib-checks-skill.sh and lib-checks-agent.sh
|
||||
# and are unchanged from the skill-audit / agent-audit scripts they came from.
|
||||
# The ADR-0020 boundary resolver both of them need is sourced once, from
|
||||
# The shared boundary resolver both of them need is sourced once, from
|
||||
# lib-boundary-resolver.sh, instead of being embedded twice.
|
||||
#
|
||||
# Detection never guesses. A target that matches neither shape is a hard exit 2
|
||||
|
||||
@@ -36,7 +36,7 @@ EOF
|
||||
}
|
||||
|
||||
# Helper: a description of EXACTLY <n> characters that carries a boundary
|
||||
# clause and names no routing target. ADR-0020's missing-boundary-clause
|
||||
# clause and names no routing target. The missing-boundary-clause
|
||||
# SUGGESTION fires on any description without one, so a fixture that omits it
|
||||
# is never "otherwise clean" and a test refuting SUGGESTION would be asserting
|
||||
# the boundary check's absence instead of the thing it names. The clause is
|
||||
@@ -54,7 +54,7 @@ PY
|
||||
}
|
||||
|
||||
# Helper: same shape as make_apm_agent, but the description is supplied
|
||||
# verbatim — used by the ADR-0020 description-budget tests.
|
||||
# verbatim — used by the description-budget tests.
|
||||
make_apm_agent_with_desc() {
|
||||
local root="$1" name="$2" desc="$3"
|
||||
mkdir -p "$root/.apm/agents"
|
||||
@@ -670,14 +670,14 @@ EOF
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ADR-0020 — description budget (250 SUGGESTION / 400 FAIL)
|
||||
# Context budget — description (250 SUGGESTION / 400 FAIL)
|
||||
#
|
||||
# Agents take the SAME description gates as skills: name + description is
|
||||
# preloaded into every session identically. Agents take NO body word gate — see
|
||||
# the final test in this block, which pins that asymmetry.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "ADR-0020: agent description of exactly 250 chars raises no suggestion" {
|
||||
@test "context budget: agent description of exactly 250 chars raises no suggestion" {
|
||||
local root="$TMPDIR/pkg"
|
||||
make_apm_agent_with_desc "$root" "my-agent" "$(desc_of_length 250)"
|
||||
run bash "$SCRIPT" "$root/.apm/agents/my-agent.agent.md"
|
||||
@@ -685,7 +685,7 @@ EOF
|
||||
refute_output --partial "SUGGESTION"
|
||||
}
|
||||
|
||||
@test "ADR-0020: agent description of 251 chars raises a SUGGESTION and still exits 0" {
|
||||
@test "context budget: agent description of 251 chars raises a SUGGESTION and still exits 0" {
|
||||
local root="$TMPDIR/pkg"
|
||||
make_apm_agent_with_desc "$root" "my-agent" "$(desc_of_length 251)"
|
||||
run bash "$SCRIPT" "$root/.apm/agents/my-agent.agent.md"
|
||||
@@ -694,7 +694,7 @@ EOF
|
||||
assert_output --partial "description is 251 chars"
|
||||
}
|
||||
|
||||
@test "ADR-0020: agent description of exactly 400 chars is a SUGGESTION, not a FAIL" {
|
||||
@test "context budget: agent description of exactly 400 chars is a SUGGESTION, not a FAIL" {
|
||||
local root="$TMPDIR/pkg"
|
||||
make_apm_agent_with_desc "$root" "my-agent" "$(desc_of_length 400)"
|
||||
run bash "$SCRIPT" "$root/.apm/agents/my-agent.agent.md"
|
||||
@@ -702,16 +702,16 @@ EOF
|
||||
assert_output --partial "SUGGESTION"
|
||||
}
|
||||
|
||||
@test "ADR-0020: agent description of 401 chars FAILs and exits non-zero" {
|
||||
@test "context budget: agent description of 401 chars FAILs and exits non-zero" {
|
||||
local root="$TMPDIR/pkg"
|
||||
make_apm_agent_with_desc "$root" "my-agent" "$(desc_of_length 401)"
|
||||
run bash "$SCRIPT" "$root/.apm/agents/my-agent.agent.md"
|
||||
assert_failure
|
||||
assert_output --partial "description is 401 chars"
|
||||
assert_output --partial "400-character ADR-0020 ceiling"
|
||||
assert_output --partial "400-character context-budget ceiling"
|
||||
}
|
||||
|
||||
@test "ADR-0020: agent description length is measured after YAML folding is resolved" {
|
||||
@test "context budget: agent description length is measured after YAML folding is resolved" {
|
||||
local root="$TMPDIR/pkg"
|
||||
mkdir -p "$root/.apm/agents"
|
||||
cat > "$root/apm.yml" <<EOF
|
||||
@@ -735,7 +735,7 @@ EOF
|
||||
assert_output --partial "description is 450 chars"
|
||||
}
|
||||
|
||||
@test "ADR-0020: the description gate applies at project scope too" {
|
||||
@test "context budget: the description gate applies at project scope too" {
|
||||
local root="$TMPDIR/project"
|
||||
local desc
|
||||
desc="$(python3 -c "print('x' * 401)")"
|
||||
@@ -758,10 +758,10 @@ You are a test agent. When invoked, do the thing.
|
||||
EOF
|
||||
run bash "$SCRIPT" "$root/.claude/agents/my-agent.md"
|
||||
assert_failure
|
||||
assert_output --partial "400-character ADR-0020 ceiling"
|
||||
assert_output --partial "400-character context-budget ceiling"
|
||||
}
|
||||
|
||||
@test "ADR-0020: agents take NO body word gate — a body far over the 900-word skill ceiling passes" {
|
||||
@test "context budget: agents take NO body word gate — a body far over the 900-word skill ceiling passes" {
|
||||
local root="$TMPDIR/pkg"
|
||||
mkdir -p "$root/.apm/agents"
|
||||
cat > "$root/apm.yml" <<EOF
|
||||
@@ -771,9 +771,9 @@ type: skill
|
||||
EOF
|
||||
# Deliberate asymmetry, not an oversight: a skill body is loaded into the
|
||||
# caller's context and competes with the live conversation, while an agent
|
||||
# body becomes the system prompt of a fresh context. ADR-0020 gates the
|
||||
# body becomes the system prompt of a fresh context. The context budget gates the
|
||||
# former at 900 words and explicitly declines to gate the latter. If a body
|
||||
# word gate is ever added here, it contradicts the ADR.
|
||||
# word gate is ever added here, it contradicts that rule.
|
||||
#
|
||||
# The description carries a boundary clause so the ONLY thing this test can
|
||||
# go red on is a body finding. Without one, the missing-boundary-clause
|
||||
@@ -1026,7 +1026,7 @@ EOF
|
||||
#
|
||||
# read_text() in the shared resolver block pins the READS to UTF-8. That moved
|
||||
# the LC_ALL=C crash to the WRITE: this script's own message text carries em
|
||||
# dashes (the ADR-0020 boundary SUGGESTION is one), so the streams' ASCII
|
||||
# dashes (the boundary-clause SUGGESTION is one), so the streams' ASCII
|
||||
# default raised UnicodeEncodeError while PRINTING — after every check had
|
||||
# already run. Here it also flipped a clean exit 0 into a traceback and exit 1.
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -1061,8 +1061,8 @@ EOF
|
||||
# exported Vale hook matches with `(^|/)agents/[^/]+\.md$`)
|
||||
#
|
||||
# A misclassification here is silent and total — the skill rubric would run
|
||||
# against an agent file, so ADR-0022's metadata.version and ADR-0020's 900-word
|
||||
# body ceiling would both be applied to an artifact that ADR-0020 explicitly
|
||||
# against an agent file, so ADR-0022's metadata.version and the 900-word
|
||||
# body ceiling would both be applied to an artifact that the context budget explicitly
|
||||
# exempts from the latter (see the 1,500-word body test above, which AGENTS.md
|
||||
# cites as the pin for that asymmetry).
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -10,7 +10,7 @@ setup() {
|
||||
|
||||
# Helper: create a minimal valid skill directory.
|
||||
#
|
||||
# The description carries a boundary clause deliberately. ADR-0020's
|
||||
# The description carries a boundary clause deliberately. The
|
||||
# missing-boundary-clause SUGGESTION fires on any description without one, so
|
||||
# a fixture that omits it is never "otherwise clean" — every test asserting
|
||||
# SUGGESTION-freedom would be asserting the boundary check's absence instead
|
||||
@@ -55,7 +55,7 @@ PY
|
||||
|
||||
# Helper: create a skill directory with an exact description length and an
|
||||
# exact body word count. <desc> is used verbatim; <body_words> "word"
|
||||
# tokens follow the frontmatter. Used by the ADR-0020 boundary tests.
|
||||
# tokens follow the frontmatter. Used by the boundary tests.
|
||||
make_sized_skill() {
|
||||
local dir="$1" desc="$2" body_words="$3"
|
||||
local name
|
||||
@@ -136,7 +136,7 @@ teardown() {
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "the 1024-char agentskills.io spec backstop is unchanged and separate from the ADR-0020 ceiling" {
|
||||
@test "the 1024-char agentskills.io spec backstop is unchanged and separate from the context-budget ceiling" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
local name
|
||||
name="$(basename "$skill")"
|
||||
@@ -155,10 +155,10 @@ Do the thing.
|
||||
EOF
|
||||
run bash "$SCRIPT" "$skill"
|
||||
# Two independent gates on one value: the spec limit still PASSES at
|
||||
# exactly 1024 (its own boundary is unmoved), while ADR-0020's 400-char
|
||||
# exactly 1024 (its own boundary is unmoved), while the 400-char
|
||||
# ceiling FAILs. The run fails on the second, not the first.
|
||||
assert_output --partial "description length 1024 chars (agentskills.io spec limit: 1024)"
|
||||
assert_output --partial "400-character ADR-0020 ceiling"
|
||||
assert_output --partial "400-character context-budget ceiling"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@@ -521,14 +521,14 @@ PY
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ADR-0020 — description budget (250 SUGGESTION / 400 FAIL)
|
||||
# Context budget — description (250 SUGGESTION / 400 FAIL)
|
||||
#
|
||||
# These sit UNDER the agentskills.io 1024-character spec backstop above, which
|
||||
# is unchanged. Both ceilings are inclusive: exactly at the number passes that
|
||||
# tier, one past it trips.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "ADR-0020: description of exactly 250 chars raises no suggestion" {
|
||||
@test "context budget: description of exactly 250 chars raises no suggestion" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
make_sized_skill "$skill" "$(desc_of_length 250)" 10
|
||||
run bash "$SCRIPT" "$skill"
|
||||
@@ -536,7 +536,7 @@ PY
|
||||
refute_output --partial "SUGGESTION"
|
||||
}
|
||||
|
||||
@test "ADR-0020: description of 251 chars raises a SUGGESTION and still exits 0" {
|
||||
@test "context budget: description of 251 chars raises a SUGGESTION and still exits 0" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
make_sized_skill "$skill" "$(desc_of_length 251)" 10
|
||||
run bash "$SCRIPT" "$skill"
|
||||
@@ -546,7 +546,7 @@ PY
|
||||
assert_output --partial "All checks passed (1 suggestion(s))."
|
||||
}
|
||||
|
||||
@test "ADR-0020: description of exactly 400 chars is a SUGGESTION, not a FAIL" {
|
||||
@test "context budget: description of exactly 400 chars is a SUGGESTION, not a FAIL" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
make_sized_skill "$skill" "$(desc_of_length 400)" 10
|
||||
run bash "$SCRIPT" "$skill"
|
||||
@@ -554,16 +554,16 @@ PY
|
||||
assert_output --partial "SUGGESTION"
|
||||
}
|
||||
|
||||
@test "ADR-0020: description of 401 chars FAILs and exits non-zero" {
|
||||
@test "context budget: description of 401 chars FAILs and exits non-zero" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
make_sized_skill "$skill" "$(desc_of_length 401)" 10
|
||||
run bash "$SCRIPT" "$skill"
|
||||
assert_failure
|
||||
assert_output --partial "description is 401 chars"
|
||||
assert_output --partial "400-character ADR-0020 ceiling"
|
||||
assert_output --partial "400-character context-budget ceiling"
|
||||
}
|
||||
|
||||
@test "ADR-0020: description length is measured after YAML folding is resolved" {
|
||||
@test "context budget: description length is measured after YAML folding is resolved" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
mkdir -p "$skill"
|
||||
# A >-folded block scalar: 11 lines of 40 chars folded with 10 joining
|
||||
@@ -582,17 +582,17 @@ PY
|
||||
run bash "$SCRIPT" "$skill"
|
||||
assert_failure
|
||||
assert_output --partial "description is 450 chars"
|
||||
assert_output --partial "400-character ADR-0020 ceiling"
|
||||
assert_output --partial "400-character context-budget ceiling"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ADR-0020 — body budget (600 SUGGESTION / 900 FAIL), body ONLY
|
||||
# Context budget — body (600 SUGGESTION / 900 FAIL), body ONLY
|
||||
#
|
||||
# Distinct from the 2,770-word whole-file spec ceiling above, which counts
|
||||
# frontmatter too and is unchanged. Do not unify them.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "ADR-0020: body of exactly 600 words raises no suggestion" {
|
||||
@test "context budget: body of exactly 600 words raises no suggestion" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
make_sized_skill "$skill" "A short valid description. Do not use for anything else." 600
|
||||
run bash "$SCRIPT" "$skill"
|
||||
@@ -600,7 +600,7 @@ PY
|
||||
refute_output --partial "SUGGESTION"
|
||||
}
|
||||
|
||||
@test "ADR-0020: body of 601 words raises a SUGGESTION and still exits 0" {
|
||||
@test "context budget: body of 601 words raises a SUGGESTION and still exits 0" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
make_sized_skill "$skill" "A short valid description. Do not use for anything else." 601
|
||||
run bash "$SCRIPT" "$skill"
|
||||
@@ -609,7 +609,7 @@ PY
|
||||
assert_output --partial "All checks passed (1 suggestion(s))."
|
||||
}
|
||||
|
||||
@test "ADR-0020: body of exactly 900 words is a SUGGESTION, not a FAIL" {
|
||||
@test "context budget: body of exactly 900 words is a SUGGESTION, not a FAIL" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
make_sized_skill "$skill" "A short valid description. Do not use for anything else." 900
|
||||
run bash "$SCRIPT" "$skill"
|
||||
@@ -617,16 +617,16 @@ PY
|
||||
assert_output --partial "body is 900 words"
|
||||
}
|
||||
|
||||
@test "ADR-0020: body of 901 words FAILs and exits non-zero" {
|
||||
@test "context budget: body of 901 words FAILs and exits non-zero" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
make_sized_skill "$skill" "A short valid description. Do not use for anything else." 901
|
||||
run bash "$SCRIPT" "$skill"
|
||||
assert_failure
|
||||
assert_output --partial "body is 901 words"
|
||||
assert_output --partial "900-word ADR-0020 ceiling"
|
||||
assert_output --partial "900-word context-budget ceiling"
|
||||
}
|
||||
|
||||
@test "ADR-0020: the body gate counts the body only — frontmatter words do not count toward it" {
|
||||
@test "context budget: the body gate counts the body only — frontmatter words do not count toward it" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
# 895 body words plus a description long enough that the WHOLE FILE is well
|
||||
# over 900 words. The body gate must stay silent; the 2,770-word whole-file
|
||||
@@ -634,11 +634,11 @@ PY
|
||||
make_sized_skill "$skill" "$(python3 -c "print(' '.join(['w'] * 100))")" 895
|
||||
run bash "$SCRIPT" "$skill"
|
||||
assert_success
|
||||
refute_output --partial "900-word ADR-0020 ceiling"
|
||||
refute_output --partial "900-word context-budget ceiling"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ADR-0020 — resolvable boundary targets
|
||||
# resolvable boundary targets
|
||||
#
|
||||
# Resolved against the AUTHORING SOURCE (plugins/*/.apm/skills/ and
|
||||
# plugins/*/.apm/agents/), never .claude/skills/, so the check works offline and
|
||||
@@ -646,7 +646,7 @@ PY
|
||||
# than leaning on this repo's live skills.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "ADR-0020: a boundary target naming an existing sibling skill resolves" {
|
||||
@test "boundary: a boundary target naming an existing sibling skill resolves" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
make_sized_skill "$skill" "Use when doing the thing. Do not use for the other thing — use fixture-sibling-skill instead." 10
|
||||
@@ -655,7 +655,7 @@ PY
|
||||
assert_output --partial "boundary target(s) resolve"
|
||||
}
|
||||
|
||||
@test "ADR-0020: a boundary target naming a non-existent skill FAILs when its sentence names one that resolves" {
|
||||
@test "boundary: a boundary target naming a non-existent skill FAILs when its sentence names one that resolves" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
# `fixture-sibling-skill` is the corroborator: a prose-form target only earns
|
||||
@@ -667,7 +667,7 @@ PY
|
||||
assert_output --partial "routes to 'fixture-missing-skill'"
|
||||
}
|
||||
|
||||
@test "ADR-0020: a LONE boundary target naming a non-existent skill is a SUGGESTION, not a FAIL" {
|
||||
@test "boundary: a LONE boundary target naming a non-existent skill is a SUGGESTION, not a FAIL" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
# Same grammar as the case above and as "run \`pre-commit\` instead" — a
|
||||
@@ -682,7 +682,7 @@ PY
|
||||
refute_output --partial "FAIL description routes to"
|
||||
}
|
||||
|
||||
@test "ADR-0020: a boundary target naming an AGENT file resolves (agents are valid routing targets)" {
|
||||
@test "boundary: a boundary target naming an AGENT file resolves (agents are valid routing targets)" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
make_sized_skill "$skill" "Use when doing the thing. Do not use when the caller is an agent — invoke fixture-sibling-agent instead." 10
|
||||
@@ -691,7 +691,7 @@ PY
|
||||
assert_output --partial "boundary target(s) resolve"
|
||||
}
|
||||
|
||||
@test "ADR-0020: a /slash-command boundary target that does not resolve FAILs" {
|
||||
@test "boundary: a /slash-command boundary target that does not resolve FAILs" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
make_sized_skill "$skill" "Use when doing the thing. Do not use when improvements are wanted — use /fixture-missing-improve instead." 10
|
||||
@@ -700,7 +700,7 @@ PY
|
||||
assert_output --partial "routes to 'fixture-missing-improve'"
|
||||
}
|
||||
|
||||
@test "ADR-0020: a backticked name that does not resolve FAILs when its sentence names one that resolves" {
|
||||
@test "boundary: a backticked name that does not resolve FAILs when its sentence names one that resolves" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
make_sized_skill "$skill" "Use when doing the thing. Composes \`fixture-sibling-skill\` and \`fixture-missing-helper\` for the shared part." 10
|
||||
@@ -709,7 +709,7 @@ PY
|
||||
assert_output --partial "routes to 'fixture-missing-helper'"
|
||||
}
|
||||
|
||||
@test "ADR-0020: a /slash-command target is route NOTATION and FAILs on its own, uncorroborated" {
|
||||
@test "boundary: a /slash-command target is route NOTATION and FAILs on its own, uncorroborated" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
# The escape hatch from the SUGGESTION tier: `/name` and `-> name` are never
|
||||
@@ -721,7 +721,7 @@ PY
|
||||
assert_output --partial "routes to 'fixture-missing-notation'"
|
||||
}
|
||||
|
||||
@test "ADR-0020: a bare hyphenated word outside a boundary sentence is not read as a routing target" {
|
||||
@test "boundary: a bare hyphenated word outside a boundary sentence is not read as a routing target" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
# "run pre-commit hooks" is pc-run's real phrasing. A naive extractor reads
|
||||
@@ -732,10 +732,10 @@ PY
|
||||
refute_output --partial "pre-commit"
|
||||
}
|
||||
|
||||
@test "ADR-0020: an arrow chain outside a boundary clause is not read as a routing target" {
|
||||
@test "boundary: an arrow chain outside a boundary clause is not read as a routing target" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
# diagnose's real process chain. Only ADR-0020's `Not <thing> -> <skill>`
|
||||
# diagnose's real process chain. Only the compressed `Not <thing> -> <skill>`
|
||||
# form makes a bare arrow target a route.
|
||||
make_sized_skill "$skill" "Reproduce → minimise → instrument → fix → regression-test. Use when a bug is reported." 10
|
||||
run bash "$SCRIPT" "$skill"
|
||||
@@ -743,7 +743,7 @@ PY
|
||||
refute_output --partial "regression-test"
|
||||
}
|
||||
|
||||
@test "ADR-0020: MCP tool names and capitalised tool names are not read as routing targets" {
|
||||
@test "boundary: MCP tool names and capitalised tool names are not read as routing targets" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
make_sized_skill "$skill" "Use when writing issues. Do not use for local files (use Read/Write/Edit) — that write goes through \`issue_write\`/\`pull_request_write\` instead." 10
|
||||
@@ -752,7 +752,7 @@ PY
|
||||
refute_output --partial "routes to"
|
||||
}
|
||||
|
||||
@test "ADR-0020: ADR's compressed boundary form (Not <thing> -> <skill>) is checked" {
|
||||
@test "boundary: the compressed boundary form (Not <thing> -> <skill>) is checked" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
make_sized_skill "$skill" "Use when doing the thing. Not the other thing → fixture-missing-target." 10
|
||||
@@ -761,7 +761,7 @@ PY
|
||||
assert_output --partial "routes to 'fixture-missing-target'"
|
||||
}
|
||||
|
||||
@test "ADR-0020: the boundary check declines rather than false-FAILs when no authoring source is found" {
|
||||
@test "boundary: the boundary check declines rather than false-FAILs when no authoring source is found" {
|
||||
# Deliberately NOT built with make_fixture_tree: this skill sits in a bare
|
||||
# temp directory with no plugins/*/.apm/ above it and no .git, so the resolver
|
||||
# legitimately has no universe. That is a real path (a skill being drafted
|
||||
@@ -779,7 +779,7 @@ PY
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ADR-0020 — the hand-invocation carve-out (issue #108)
|
||||
# the hand-invocation carve-out (issue #108)
|
||||
#
|
||||
# A skill carrying `disable-model-invocation: true` is absent from the
|
||||
# model-visible listing entirely: not preloaded, and the Skill tool refuses to
|
||||
@@ -815,7 +815,7 @@ make_hand_invoked_skill() {
|
||||
} > "$dir/SKILL.md"
|
||||
}
|
||||
|
||||
@test "ADR-0020: a hand-invoked skill is not asked for a boundary clause" {
|
||||
@test "hand-invoked: a hand-invoked skill is not asked for a boundary clause" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
make_hand_invoked_skill "$skill" \
|
||||
"Tell the agent to zoom out and give broader context or a higher level perspective." 10
|
||||
@@ -825,7 +825,7 @@ make_hand_invoked_skill() {
|
||||
assert_output --partial "hand-invoked"
|
||||
}
|
||||
|
||||
@test "ADR-0020: the SAME description without the flag IS asked for a boundary clause" {
|
||||
@test "hand-invoked: the SAME description without the flag IS asked for a boundary clause" {
|
||||
# The control. Without it the case above is satisfied by an audit that
|
||||
# stopped checking boundary clauses altogether.
|
||||
local skill="$TMPDIR/my-skill"
|
||||
@@ -836,7 +836,7 @@ make_hand_invoked_skill() {
|
||||
assert_output --partial "has no boundary clause"
|
||||
}
|
||||
|
||||
@test "ADR-0020: a hand-invoked skill is exempt from the 250-character description target" {
|
||||
@test "hand-invoked: a hand-invoked skill is exempt from the 250-character description target" {
|
||||
local skill="$TMPDIR/my-skill"
|
||||
make_hand_invoked_skill "$skill" \
|
||||
"$(python3 -c "print('Tell the agent to zoom out. ' + 'x' * 273)")" 10
|
||||
@@ -845,7 +845,7 @@ make_hand_invoked_skill() {
|
||||
refute_output --partial "over the 250-character"
|
||||
}
|
||||
|
||||
@test "ADR-0020: a hand-invoked description over 400 chars still FAILS" {
|
||||
@test "hand-invoked: a hand-invoked description over 400 chars still FAILS" {
|
||||
# The half the carve-out does NOT lift. 400 is an outlier stop, not a
|
||||
# routing-quality target: a hand-invoked description is still the one line
|
||||
# the user reads when choosing from the `/` menu.
|
||||
@@ -857,7 +857,7 @@ make_hand_invoked_skill() {
|
||||
assert_output --partial "400-character"
|
||||
}
|
||||
|
||||
@test "ADR-0020: a hand-invoked body over 900 words still FAILS" {
|
||||
@test "hand-invoked: a hand-invoked body over 900 words still FAILS" {
|
||||
# The body is loaded on invocation exactly like any other body and competes
|
||||
# with the caller's live conversation the same way, so no body tier moves.
|
||||
local skill="$TMPDIR/my-skill"
|
||||
@@ -868,7 +868,7 @@ make_hand_invoked_skill() {
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ADR-0020 — one arrow, one target (issue #107)
|
||||
# one arrow, one target (issue #107)
|
||||
#
|
||||
# Only the FIRST target after an arrow was resolved: the conjunction
|
||||
# continuation is wired to the prose route verbs and never to arrows. So this
|
||||
@@ -878,7 +878,7 @@ make_hand_invoked_skill() {
|
||||
# extractor widened.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "ADR-0020: an arrow clause naming two targets is reported, not silently half-checked" {
|
||||
@test "boundary: an arrow clause naming two targets is reported, not silently half-checked" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
# A bare `Not ... ->` sentence carries no BOUNDARY_MARKER, so the backtick
|
||||
@@ -890,7 +890,7 @@ make_hand_invoked_skill() {
|
||||
assert_output --partial "names more than one target"
|
||||
}
|
||||
|
||||
@test "ADR-0020: one arrow per target — the convention the suggestion asks for — is silent" {
|
||||
@test "boundary: one arrow per target — the convention the suggestion asks for — is silent" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
make_sized_skill "$skill" "Use when doing the thing. Not the other thing -> \`fixture-sibling-skill\`." 10
|
||||
@@ -900,7 +900,7 @@ make_hand_invoked_skill() {
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ADR-0020 — a dotted filename in a boundary clause (issue #110)
|
||||
# a dotted filename in a boundary clause (issue #110)
|
||||
#
|
||||
# `[^.;]` could not cross the `.` in `AGENTS.md`, so a clause naming a dotted
|
||||
# file between "Not" and the arrow was invisible. With a backticked target that
|
||||
@@ -909,7 +909,7 @@ make_hand_invoked_skill() {
|
||||
# extracted, so the dangling check silently did not run on it.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "ADR-0020: a boundary clause naming a dotted filename is not reported as missing" {
|
||||
@test "boundary: a boundary clause naming a dotted filename is not reported as missing" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
make_sized_skill "$skill" "Use when doing the thing. Not AGENTS.md -> \`fixture-sibling-skill\`." 10
|
||||
@@ -919,7 +919,7 @@ make_hand_invoked_skill() {
|
||||
assert_output --partial "description has a boundary clause"
|
||||
}
|
||||
|
||||
@test "ADR-0020: a BARE target after a dotted filename is extracted and checked" {
|
||||
@test "boundary: a BARE target after a dotted filename is extracted and checked" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
# The silent half of #110: this clause produced no target at all, so it was
|
||||
@@ -931,7 +931,7 @@ make_hand_invoked_skill() {
|
||||
assert_output --partial "routes to 'fixture-missing-dotted'"
|
||||
}
|
||||
|
||||
@test "ADR-0020: an arrow clause yielding no target is reported as unparsed, not as missing" {
|
||||
@test "boundary: an arrow clause yielding no target is reported as unparsed, not as missing" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
# A single-word target is deliberately not matchable bare, because
|
||||
@@ -946,7 +946,7 @@ make_hand_invoked_skill() {
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# ADR-0020 — the unparsed diagnostic is PER CLAUSE, not per description
|
||||
# the unparsed diagnostic is PER CLAUSE, not per description
|
||||
#
|
||||
# boundary_clause_status() used to test `BOUNDARY_ARROW.search(description) and
|
||||
# not _arrow_targets(description)`. Both operands took the WHOLE description,
|
||||
@@ -962,7 +962,7 @@ make_hand_invoked_skill() {
|
||||
# class: no ERROR, no SUGGESTION, exit 0.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "ADR-0020: an unparsed arrow clause is reported even when a sibling clause parses" {
|
||||
@test "boundary: an unparsed arrow clause is reported even when a sibling clause parses" {
|
||||
local skill
|
||||
skill="$(make_fixture_tree "$TMPDIR/tree" "my-skill")"
|
||||
# Written by hand rather than through make_sized_skill: the `>` folded
|
||||
@@ -992,7 +992,7 @@ EOF
|
||||
#
|
||||
# read_text() in the shared resolver block pins the READS to UTF-8. That moved
|
||||
# the LC_ALL=C crash to the WRITE: this script's own message text carries em
|
||||
# dashes (the ADR-0020 boundary SUGGESTION is one), so the streams' ASCII
|
||||
# dashes (the boundary-clause SUGGESTION is one), so the streams' ASCII
|
||||
# default raised UnicodeEncodeError while PRINTING — after every check had
|
||||
# already run, losing the whole report at the last step.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@ description: >
|
||||
Not read-only review -> `factory-audit`. Not agent files -> `agent-author`.
|
||||
allowed-tools: Bash Read Write Edit
|
||||
metadata:
|
||||
version: "1.0.7"
|
||||
version: "1.0.8"
|
||||
category: factory
|
||||
source_keys:
|
||||
- agentskills-home
|
||||
@@ -55,6 +55,6 @@ Gates `/factory-audit` enforces in both flows:
|
||||
|
||||
## Step 4 — Validate and close
|
||||
|
||||
Run `/factory-audit` on the resolved skill directory; resolve every FAIL before reporting done. It checks name-to-directory match, placeholders, both size budgets, boundary-target resolution and script hygiene — do not hand-check those. Hand-check the one thing it misses: an empty body reports `PASS SKILL.md body word count 0 (ADR-0020 target: 600)`, so confirm at least one non-empty section exists.
|
||||
Run `/factory-audit` on the resolved skill directory; resolve every FAIL before reporting done. It checks name-to-directory match, placeholders, both size budgets, boundary-target resolution and script hygiene — do not hand-check those. Hand-check the one thing it misses: an empty body reports `PASS SKILL.md body word count 0 (context-budget target: 600)`, so confirm at least one non-empty section exists.
|
||||
|
||||
Bump `metadata.version`: the **minor** version on create (new skills start at `0.1.0`) and the **patch** version on improve.
|
||||
@@ -1,5 +1,5 @@
|
||||
name: kyberforge
|
||||
version: 2.3.1
|
||||
version: 2.3.2
|
||||
description: Skills and agents for creating, maintaining, and managing an apm plugin marketplace for Claude Code and GitHub Copilot.
|
||||
author:
|
||||
name: Mortis
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"hooks": {
|
||||
"PreToolUse": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"command": "${CLAUDE_PLUGIN_ROOT}/.apm/hooks/route-through-rtk.sh",
|
||||
"timeout": 10,
|
||||
"type": "command"
|
||||
}
|
||||
],
|
||||
"matcher": "Bash"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# PreToolUse hook: route a Bash tool call through `rtk hook claude`, which may
|
||||
# rewrite the command to its rtk-prefixed form. rtk's output is passed through
|
||||
# when rtk succeeds. The hook always exits 0: a PreToolUse exit 2 blocks the tool
|
||||
# call, and rtk exits 2 on a usage error (e.g. an rtk without `hook claude`), so
|
||||
# any rtk failure is swallowed and the call proceeds unchanged. Without rtk on
|
||||
# PATH it does nothing. Limits: the rtk plugin's README.
|
||||
set -euo pipefail
|
||||
|
||||
# apm could deploy this file to other runtimes, where it must do nothing.
|
||||
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/"
|
||||
case "$here" in
|
||||
*/.claude/hooks/*) ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
|
||||
command -v rtk > /dev/null 2>&1 || exit 0
|
||||
|
||||
# stdin (the hook payload) is inherited by rtk inside the substitution.
|
||||
out="$(rtk hook claude)" || exit 0
|
||||
[[ -z "$out" ]] || printf '%s\n' "$out"
|
||||
exit 0
|
||||
@@ -0,0 +1,84 @@
|
||||
# rtk
|
||||
|
||||
A Claude Code hook that routes Bash tool calls through rtk, the token-saving command wrapper, when rtk is installed.
|
||||
|
||||
## Install
|
||||
|
||||
apm is the only supported install path (ADR-0024). Declare this package in the consuming project's `apm.yml`:
|
||||
|
||||
```yaml
|
||||
dependencies:
|
||||
apm:
|
||||
- git: https://git.rkdr.net/Mortis/Holocron.git
|
||||
path: plugins/rtk
|
||||
```
|
||||
|
||||
Then:
|
||||
|
||||
```bash
|
||||
apm install
|
||||
```
|
||||
|
||||
The entry above is unpinned and tracks the remote's default branch. To pin a release, add `ref: rtk-v<x.y.z>` after `path:`; see [Pinning a plugin to a release](../../README.md#pinning-a-plugin-to-a-release).
|
||||
|
||||
The plugin is opt-in: nothing else in the marketplace depends on it. It does not run `rtk init` and changes no rtk configuration.
|
||||
|
||||
**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 nothing — and Claude Code raises no error while doing it (ADR-0024).
|
||||
|
||||
## Contents
|
||||
|
||||
| Component | Path | Description |
|
||||
|---|---|---|
|
||||
| Hooks | `.apm/hooks/` | `route-through-rtk.sh`, see [Routing hook](#routing-hook) |
|
||||
|
||||
`.apm/` is the authoring source and the only thing apm deploys (ADR-0024).
|
||||
|
||||
## Routing hook
|
||||
|
||||
On Claude Code, a `PreToolUse` hook on the Bash tool passes each call to `rtk hook claude`. rtk decides whether to rewrite the command, for example `git status` to `rtk git status`, and the hook passes rtk's answer back to Claude Code unchanged. A command rtk does not handle runs as written.
|
||||
|
||||
- **Without rtk on `PATH`,** the hook exits 0 and prints nothing, so the command runs as written.
|
||||
- **Claude Code only.** The package targets `claude`, and the script does nothing unless it runs from a `.claude/hooks/` path.
|
||||
- **Tested with rtk 0.42.4.** Older versions may lack `rtk hook claude`.
|
||||
|
||||
### Rewritten commands may come back pre-approved
|
||||
|
||||
rtk's answer can carry `permissionDecision: allow`, which skips Claude Code's permission prompt for the rewritten command. The hook passes that through. Hooks here are guardrails, not the safety boundary (ADR-0032); if you rely on the permission prompt for Bash, do not install this plugin.
|
||||
|
||||
### Overlap with a global rtk hook
|
||||
|
||||
`rtk init -g` installs rtk's own hook into `~/.claude/settings.json`. Check for one with:
|
||||
|
||||
```bash
|
||||
rtk init --show
|
||||
```
|
||||
|
||||
Running both is harmless: rtk leaves a command that already starts with `rtk` alone, so the second hook does nothing. It still runs rtk twice per Bash call, so keep one of the two — this plugin for a per-project install that apm keeps up to date, or the global hook for every project on the machine.
|
||||
|
||||
### Approval
|
||||
|
||||
The hook is an executable primitive, so whether it deploys depends on the `executables:` block in the consuming project's `apm.yml`:
|
||||
|
||||
- **No `executables:` block:** hooks deploy without approval.
|
||||
- **With an `executables:` block:** the hook is parked until it is granted. Grant it in one of two ways, then run `apm install` and commit the `executables` entry:
|
||||
- `apm approve` writes the entry and pins it to the hook's content, so a later change to the script needs approval again.
|
||||
- A hand-written entry under the full package identity is not pinned:
|
||||
|
||||
```yaml
|
||||
executables:
|
||||
allow:
|
||||
git.rkdr.net/Mortis/Holocron/plugins/rtk:
|
||||
hooks: true
|
||||
```
|
||||
|
||||
The first `apm approve` in a project creates the block and so turns the gate on. The next install then parks every other package's unapproved executables.
|
||||
|
||||
This repo hand-writes its grant in the root `apm.yml` and does not run `apm approve`.
|
||||
|
||||
### "ambiguous duplicate APM-owned hook entry"
|
||||
|
||||
`apm audit` raises this error, with or without `--ci`, unless drift checking is off with `--no-drift`. It reports it as a drift finding on `.claude/settings.json`. `apm export-patch` runs the same check. `apm install --frozen` runs it too, but reports only that an APM-managed hook entry was edited or removed. The cause is `.claude/settings.json` holding more byte-identical copies of an APM-owned hook entry than `.claude/apm-hooks.json` records. It happens when the same hook entry is pasted in by hand or merged in twice. To fix it, remove the duplicate entries from `.claude/settings.json`, keeping none of the hand-added copies, then run `apm install` again.
|
||||
|
||||
## Author
|
||||
|
||||
Defame1297
|
||||
@@ -0,0 +1,29 @@
|
||||
name: rtk
|
||||
version: 0.1.0
|
||||
description: A Claude Code hook that routes Bash tool calls through rtk, the token-saving command wrapper, when rtk is installed.
|
||||
author:
|
||||
name: Mortis
|
||||
url: https://git.rkdr.net/Mortis/
|
||||
license: MIT
|
||||
homepage: https://git.rkdr.net/Mortis/Holocron/src/branch/main/plugins/rtk
|
||||
repository: https://git.rkdr.net/Mortis/Holocron/src/branch/main/plugins/rtk
|
||||
keywords:
|
||||
- rtk
|
||||
- hooks
|
||||
- tokens
|
||||
# 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
|
||||
# Claude only: the hook speaks `rtk hook claude`. The script also refuses to act
|
||||
# outside .claude/hooks/, in case a consumer forces another target.
|
||||
targets:
|
||||
- claude
|
||||
type: hybrid
|
||||
|
||||
dependencies:
|
||||
apm: []
|
||||
mcp: []
|
||||
includes: auto
|
||||
devDependencies:
|
||||
apm: []
|
||||
scripts: {}
|
||||
@@ -1,15 +1,23 @@
|
||||
{
|
||||
"disableBundledSkills": true,
|
||||
"enabledPlugins": {
|
||||
"cc-plugin-easel@builtin": false,
|
||||
"cc-plugin-plugin-authoring@builtin": false
|
||||
},
|
||||
"env": {
|
||||
"CLAUDE_CODE_DISABLE_SHIP": "1"
|
||||
},
|
||||
"skillOverrides": {
|
||||
"init": "off"
|
||||
"design": "off",
|
||||
"doctor": "off",
|
||||
"init": "off",
|
||||
"plugin-authoring": "off"
|
||||
},
|
||||
"statusLine": {
|
||||
"command": "bash ~/.claude/statusline-command.sh",
|
||||
"type": "command"
|
||||
},
|
||||
"syncClaudeAiPlugins": false,
|
||||
"syncClaudeAiSkills": false,
|
||||
"theme": "dark"
|
||||
}
|
||||
+283
-2
@@ -47,7 +47,8 @@
|
||||
# discarded precisely where it earns its keep.
|
||||
#
|
||||
# The waiver is therefore narrow on three axes, and fails closed on each:
|
||||
# 1. the root manifest is never waived, whatever it reports
|
||||
# 1. the root manifest is never waived for it (the root's own, separate
|
||||
# waiver is described below)
|
||||
# 2. the failing check must be `lockfile-exists` and no other -- the
|
||||
# "1 of 1 check(s) failed" assertion is what makes that true, since any
|
||||
# second failing check changes the count and the run fails normally
|
||||
@@ -57,6 +58,86 @@
|
||||
# line silently turns the waiver off, which fails the push rather than hiding a
|
||||
# defect. If that happens, re-verify against the new output and update the two
|
||||
# patterns below rather than widening them.
|
||||
#
|
||||
# THE SECOND WAIVER: A PLUGIN NOT YET ON origin/main (ROOT MANIFEST ONLY)
|
||||
#
|
||||
# Root apm.yml's first-party dependencies resolve from the remote's `main`
|
||||
# (ADR-0019), so the lock cannot record a plugin until that plugin has landed.
|
||||
# check-executables-allow-sync.sh meanwhile requires a hook- or bin-shipping
|
||||
# plugin to have its git+path entry in root apm.yml before it can be pushed at
|
||||
# all. Together they make a first-landing executable-shipping plugin
|
||||
# unpushable: the entry is mandatory, and the root `ref-consistency` check then
|
||||
# fails it as `<identity>/plugins/<name>: not found in lockfile`. Verified on
|
||||
# apm 0.39.3 (#179): a failing ref-consistency cuts the root run short at three
|
||||
# checks (lockfile-exists, ref-consistency, drift), so the sole-failure line is
|
||||
# `1 of 3 check(s) failed`.
|
||||
#
|
||||
# So the root manifest's audit is waived when, and only when, ALL of these hold:
|
||||
# 1. the failure count is exactly "1 of 3 check(s) failed" and the one
|
||||
# failing row is ref-consistency -- any second failure changes the count
|
||||
# 2. the ref-consistency details block exists and EVERY line in it reads
|
||||
# `<identity>/plugins/<name>: not found in lockfile`, where <identity> is
|
||||
# the one root apm.yml's own git+path entry for plugins/<name> yields,
|
||||
# derived by check-executables-allow-sync.sh's rule
|
||||
# 3. plugins/<name>/apm.yml exists in the working tree
|
||||
# 4. plugins/<name>/apm.yml is absent from the LOCAL origin/main ref -- no
|
||||
# fetch, the hook stays offline -- and origin/main must resolve
|
||||
# 5. a re-run of `apm audit --ci` against the root with those plugins'
|
||||
# `dependencies.apm` entries removed passes with "All 15 check(s) passed"
|
||||
# Anything else, including output in a shape not recognised here, fails the
|
||||
# push. The waiver lapses for a plugin by itself: once it is on origin/main,
|
||||
# condition 4 is false and the follow-up lock PR has to record it.
|
||||
#
|
||||
# WHY THE RE-RUN (CONDITION 5)
|
||||
#
|
||||
# The cut-short run is exactly the problem: while ref-consistency fails, apm
|
||||
# never runs the other twelve root checks (content-integrity,
|
||||
# hook-approval-pins, local-bundle-hooks, exec-status-current,
|
||||
# deployed-files-present, ...), so waiving the three-check run alone would let
|
||||
# a defect in any of them through. Removing the unlanded plugins' entries is
|
||||
# the one change that makes ref-consistency pass, and apm then runs the full
|
||||
# set. Verified on apm 0.39.3 (#179): this branch's root, so reduced, prints
|
||||
# "All 15 check(s) passed". The count is asserted, not just the exit code, so
|
||||
# an apm that runs fewer checks, or adds one, fails closed until re-verified.
|
||||
#
|
||||
# The re-run happens in a SCRATCH COPY, never in place. The working tree minus
|
||||
# .git and .venv is copied with tar into a mktemp -d dir, apm.yml is reduced
|
||||
# there, and apm runs there. An in-place swap of apm.yml guarded by a trap was
|
||||
# the alternative and is weaker: no trap survives SIGKILL or a power cut, and
|
||||
# for the swap's duration a concurrent apm (the SessionStart hook, another
|
||||
# shell) would read the reduced manifest. The copy never writes the working
|
||||
# tree at all, so it is byte-identical afterwards whatever happens; at worst a
|
||||
# killed run leaks a temp dir. What the copy holds, and why:
|
||||
# * everything apm reads for the root audit -- apm.yml, apm.lock.yaml,
|
||||
# apm_modules/ (the cache-only replay's source), .claude/ and every other
|
||||
# deployed tree (deployed-files-present, content-integrity, drift), and
|
||||
# the plugins/ sources the marketplace and local entries name. Copying the
|
||||
# whole tree rather than a hand-picked list means a check that starts
|
||||
# reading another path cannot silently see an empty one.
|
||||
# * NOT .git: from a linked worktree it is a pointer file into the shared
|
||||
# gitdir, and a git command run in the copy could then refresh that
|
||||
# worktree's real index. A fresh `git init` stands in for it, carrying the
|
||||
# two pieces of git state apm reads: the origin remote's URL (org-policy
|
||||
# discovery; the copy prints the same policy line the real root does) and
|
||||
# the repo's info/exclude, copied from `git rev-parse --git-path
|
||||
# info/exclude` (which resolves to the shared gitdir in a linked worktree)
|
||||
# when it exists. deployed-files-present runs `git check-ignore` on each
|
||||
# lock-recorded path that is absent, and an absent path ignored only
|
||||
# through info/exclude must not count as missing in the copy either.
|
||||
# .gitignore files travel with the tree, and core.excludesFile is the same
|
||||
# user-level config for both runs.
|
||||
# * NOT .venv: apm runs through `uv run --project <repo root>`, so the
|
||||
# environment is the real one; .venv is no apm input and most of the size.
|
||||
# * NOT .claude/worktrees: Claude Code's linked worktrees, each a full
|
||||
# checkout that can carry its own .venv. They are ignored through
|
||||
# info/exclude, and no root check reads them: deployed-files-present and
|
||||
# content-integrity look up lock-recorded paths, none of which is under
|
||||
# .claude/worktrees, and drift compares the replay's deployed files
|
||||
# against the same paths in the tree. Leaving them out hides nothing the
|
||||
# real audit would see.
|
||||
# Only list items under `dependencies:` > `apm:` whose `path:` names a waived
|
||||
# plugin are removed (comments and every other line kept), and the result is
|
||||
# checked to differ from the original by deletions only, each waived entry gone.
|
||||
|
||||
set -uo pipefail
|
||||
|
||||
@@ -74,6 +155,194 @@ require_apm_version || exit 1
|
||||
|
||||
readonly WAIVED_CHECK='declares dependencies but apm.lock.yaml is absent'
|
||||
readonly SOLE_FAILURE='1 of 1 check(s) failed'
|
||||
readonly REF_SOLE_FAILURE='1 of 3 check(s) failed'
|
||||
readonly REF_FAILED_ROW='^\| \[x\] +\| ref-consistency +\|'
|
||||
readonly REF_DETAILS_HEADER=' ref-consistency details:'
|
||||
# The name must start alphanumeric, which rules out `.` and `..`; `..`
|
||||
# anywhere else is rejected separately in ref_waivable.
|
||||
readonly REF_DETAIL='^ - (.+)/plugins/([A-Za-z0-9][A-Za-z0-9._-]*): not found in lockfile$'
|
||||
readonly ROOT_FULL_PASS='All 15 check(s) passed'
|
||||
|
||||
# dep_identity <plugin dir name> -- the identity root apm.yml's git+path entry
|
||||
# for plugins/<name> yields: <host>/<owner>/<repo>/plugins/<name>. The URL rule
|
||||
# is check-executables-allow-sync.sh's identity(): drop the scheme (or turn an
|
||||
# scp-like host:path into host/path), any user@, a trailing / and .git. Empty
|
||||
# when there is no such entry. A line scan of the one shape root apm.yml uses
|
||||
# (`dependencies:` > `apm:` > `- git:` / `path:` items), not a YAML parse: an
|
||||
# entry in any other shape yields nothing, and so fails closed.
|
||||
dep_identity() {
|
||||
local want="plugins/$1" url
|
||||
url="$(awk -v want="$want" '
|
||||
function unq(v) {
|
||||
sub(/^[ \t]+/, "", v); sub(/[ \t]+$/, "", v)
|
||||
if (v ~ /^".*"$/ || v ~ /^\047.*\047$/) v = substr(v, 2, length(v) - 2)
|
||||
return v
|
||||
}
|
||||
function flush() { if (g != "" && p == want) print g; g = ""; p = "" }
|
||||
/^[ \t]*(#|$)/ { next }
|
||||
/^[^ ]/ { flush(); in_deps = ($0 ~ /^dependencies:/); in_apm = 0; next }
|
||||
!in_deps { next }
|
||||
/^ [^ ]/ { flush(); in_apm = ($0 ~ /^ apm:/); next }
|
||||
!in_apm { next }
|
||||
/^ - / { flush(); sub(/^ - /, " ") }
|
||||
/^ git:/ { v = $0; sub(/^ git:/, "", v); g = unq(v); next }
|
||||
/^ path:/ { v = $0; sub(/^ path:/, "", v); p = unq(v); sub(/^\.\//, "", p); sub(/\/$/, "", p); next }
|
||||
END { flush() }
|
||||
' apm.yml 2>/dev/null | head -n 1)"
|
||||
[ -n "$url" ] || return 0
|
||||
if [[ "$url" == *://* ]]; then
|
||||
url="${url#*://}"
|
||||
elif [[ "$url" == *:* ]]; then
|
||||
url="${url/://}"
|
||||
fi
|
||||
url="${url#*@}"
|
||||
url="${url%/}"
|
||||
url="${url%.git}"
|
||||
printf '%s/%s' "$url" "$want"
|
||||
}
|
||||
|
||||
# ref_waivable <audit output> -- succeeds, printing each waived plugin dir name
|
||||
# on its own line, only when the root output is exactly the unlanded-plugin
|
||||
# ref-consistency failure described in the header. Otherwise prints why on
|
||||
# stderr and fails.
|
||||
ref_waivable() {
|
||||
local output="$1" details line identity name names=""
|
||||
grep -qF "$REF_SOLE_FAILURE" <<<"$output" || return 1
|
||||
grep -qE "$REF_FAILED_ROW" <<<"$output" || return 1
|
||||
[ "$(grep -cxF "$REF_DETAILS_HEADER" <<<"$output")" -eq 1 ] || return 1
|
||||
# The details block: every line after the header up to the first blank one.
|
||||
details="$(awk -v h="$REF_DETAILS_HEADER" '
|
||||
$0 == h { on = 1; next }
|
||||
on && /^[ \t]*$/ { exit }
|
||||
on { print }
|
||||
' <<<"$output")"
|
||||
[ -n "$details" ] || return 1
|
||||
if ! git rev-parse --verify --quiet 'origin/main^{commit}' >/dev/null; then
|
||||
echo 'apm audit --ci: ref-consistency not waived: origin/main does not resolve locally, so whether a plugin has landed is unknown' >&2
|
||||
return 1
|
||||
fi
|
||||
while IFS= read -r line; do
|
||||
if [[ ! "$line" =~ $REF_DETAIL ]]; then
|
||||
echo "apm audit --ci: ref-consistency not waived: unrecognised detail line: $line" >&2
|
||||
return 1
|
||||
fi
|
||||
identity="${BASH_REMATCH[1]}"
|
||||
name="${BASH_REMATCH[2]}"
|
||||
if [[ "$name" == *..* ]]; then
|
||||
echo "apm audit --ci: ref-consistency not waived: plugin name '$name' contains '..'" >&2
|
||||
return 1
|
||||
fi
|
||||
if [ "$identity/plugins/$name" != "$(dep_identity "$name")" ]; then
|
||||
echo "apm audit --ci: ref-consistency not waived: $identity/plugins/$name is not root apm.yml's git+path entry for plugins/$name" >&2
|
||||
return 1
|
||||
fi
|
||||
if [ ! -f "plugins/$name/apm.yml" ]; then
|
||||
echo "apm audit --ci: ref-consistency not waived: plugins/$name/apm.yml is not in the working tree" >&2
|
||||
return 1
|
||||
fi
|
||||
if git cat-file -e "origin/main:plugins/$name/apm.yml" 2>/dev/null; then
|
||||
echo "apm audit --ci: ref-consistency not waived: plugins/$name is already on origin/main, so the lock must record it" >&2
|
||||
return 1
|
||||
fi
|
||||
names+="$name"$'\n'
|
||||
done <<<"$details"
|
||||
printf '%s' "$names"
|
||||
}
|
||||
|
||||
# reduce_manifest <names, one per line> -- prints apm.yml (cwd) with every
|
||||
# `dependencies:` > `apm:` list item whose `path:` is plugins/<name> for a
|
||||
# listed name removed, and every other line unchanged. Same line scan, and the
|
||||
# same one shape, as dep_identity.
|
||||
reduce_manifest() {
|
||||
REDUCE_NAMES="$1" awk '
|
||||
BEGIN { n = split(ENVIRON["REDUCE_NAMES"], a, "\n"); for (i = 1; i <= n; i++) if (a[i] != "") drop["plugins/" a[i]] = 1 }
|
||||
function flush() { if (buf != "" && !(p in drop)) printf "%s", buf; buf = ""; p = ""; in_item = 0 }
|
||||
/^[^ \t#]/ && $0 !~ /^$/ { flush(); in_deps = ($0 ~ /^dependencies:/); in_apm = 0; print; next }
|
||||
!in_deps { print; next }
|
||||
/^ [^ #]/ { flush(); in_apm = ($0 ~ /^ apm:/); print; next }
|
||||
!in_apm { print; next }
|
||||
/^ - / { flush(); in_item = 1; buf = $0 "\n"
|
||||
v = $0; sub(/^ - /, "", v)
|
||||
if (v ~ /^path:/) { sub(/^path:/, "", v); setp(v) }
|
||||
next }
|
||||
in_item && /^ / {
|
||||
if ($0 ~ /^ path:/) { v = $0; sub(/^ path:/, "", v); setp(v) }
|
||||
buf = buf $0 "\n"; next }
|
||||
{ flush(); print }
|
||||
function setp(v) {
|
||||
sub(/^[ \t]+/, "", v); sub(/[ \t]+$/, "", v)
|
||||
if (v ~ /^".*"$/ || v ~ /^\047.*\047$/) v = substr(v, 2, length(v) - 2)
|
||||
sub(/^\.\//, "", v); sub(/\/$/, "", v); p = v
|
||||
}
|
||||
END { flush() }
|
||||
' apm.yml
|
||||
}
|
||||
|
||||
SCRATCH=""
|
||||
cleanup() { [ -z "$SCRATCH" ] || rm -rf "$SCRATCH"; }
|
||||
trap cleanup EXIT
|
||||
trap 'exit 130' INT
|
||||
trap 'exit 143' TERM HUP
|
||||
|
||||
# reduced_root_audit <names, one per line> -- condition 5 of the second waiver:
|
||||
# re-runs the root audit in a scratch copy with the named plugins' dependency
|
||||
# entries removed (header, "WHY THE RE-RUN"). Succeeds only when that run exits
|
||||
# 0 and reports the full root check set passing; otherwise prints why, and
|
||||
# apm's output, on stderr and fails.
|
||||
reduced_root_audit() {
|
||||
local names="$1" origin exclude name rerun rc delta
|
||||
SCRATCH="$(mktemp -d "${TMPDIR:-/tmp}/apm-audit-ci.XXXXXX")" || return 1
|
||||
if ! tar -C . --exclude=./.git --exclude=./.venv --exclude=./.claude/worktrees -cf - . |
|
||||
tar -C "$SCRATCH" -xf -; then
|
||||
echo 'apm audit --ci: ref-consistency not waived: could not copy the tree for the re-run' >&2
|
||||
return 1
|
||||
fi
|
||||
if ! reduce_manifest "$names" >"$SCRATCH/apm.yml"; then
|
||||
echo 'apm audit --ci: ref-consistency not waived: could not reduce apm.yml for the re-run' >&2
|
||||
return 1
|
||||
fi
|
||||
# Deletions only: diff's normal format prints a `NdM` / `N,MdK` header and
|
||||
# `< ` lines for each deleted range, and anything else is an addition or a
|
||||
# change. A here-string, not a pipe into grep -q (see the axis-1 comment
|
||||
# below), and an empty delta fails too: something must have been removed.
|
||||
delta="$(diff apm.yml "$SCRATCH/apm.yml")"
|
||||
if grep -qvE '^([0-9]+(,[0-9]+)?d[0-9]+|< .*|<)$' <<<"$delta"; then
|
||||
echo 'apm audit --ci: ref-consistency not waived: reducing apm.yml changed more than the waived entries' >&2
|
||||
return 1
|
||||
fi
|
||||
while IFS= read -r name; do
|
||||
[ -n "$name" ] || continue
|
||||
if [ -n "$(cd "$SCRATCH" && dep_identity "$name")" ]; then
|
||||
echo "apm audit --ci: ref-consistency not waived: could not remove plugins/$name's entry for the re-run" >&2
|
||||
return 1
|
||||
fi
|
||||
done <<<"$names"
|
||||
if ! git init -q "$SCRATCH"; then
|
||||
echo 'apm audit --ci: ref-consistency not waived: could not git init the re-run copy' >&2
|
||||
return 1
|
||||
fi
|
||||
if origin="$(git remote get-url origin 2>/dev/null)"; then
|
||||
git -C "$SCRATCH" remote add origin "$origin" || return 1
|
||||
fi
|
||||
# The real repo's ignore rules for deployed-files-present (header, "NOT
|
||||
# .git"). --git-path resolves to the shared gitdir from a linked worktree.
|
||||
exclude="$(git rev-parse --path-format=absolute --git-path info/exclude 2>/dev/null)" || exclude=""
|
||||
if [ -n "$exclude" ] && [ -f "$exclude" ]; then
|
||||
if ! mkdir -p "$SCRATCH/.git/info" || ! cp "$exclude" "$SCRATCH/.git/info/exclude"; then
|
||||
echo 'apm audit --ci: ref-consistency not waived: could not copy info/exclude into the re-run copy' >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
rc=0
|
||||
rerun="$(cd "$SCRATCH" && run_apm audit --ci 2>&1)" || rc=$?
|
||||
if [ "$rc" -ne 0 ] || ! grep -qF "$ROOT_FULL_PASS" <<<"$rerun"; then
|
||||
printf '%s\n' "$rerun" >&2
|
||||
echo "apm audit --ci: ref-consistency not waived: the root re-run without the unlanded plugins did not report '$ROOT_FULL_PASS' (exit $rc)" >&2
|
||||
return 1
|
||||
fi
|
||||
rm -rf "$SCRATCH"
|
||||
SCRATCH=""
|
||||
}
|
||||
|
||||
status=0
|
||||
|
||||
@@ -85,7 +354,19 @@ for manifest_dir in . plugins/*/; do
|
||||
continue
|
||||
fi
|
||||
|
||||
# Axis 1: the root is never waived.
|
||||
# The root's one waiver: plugins not yet on origin/main (header, second
|
||||
# waiver).
|
||||
if [ "$manifest_dir" = "." ] && waived="$(ref_waivable "$output")" &&
|
||||
reduced_root_audit "$waived"; then
|
||||
printf 'apm audit --ci: root re-run without the unlanded plugins: %s\n' "$ROOT_FULL_PASS"
|
||||
while IFS= read -r name; do
|
||||
printf 'apm audit --ci: waived ref-consistency for plugins/%s (not yet on origin/main; ADR-0019)\n' \
|
||||
"$name"
|
||||
done <<<"$waived"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Axis 1: the root is never waived for lockfile-exists.
|
||||
# Here-strings, not `printf ... | grep -q`: under `set -o pipefail` grep -q
|
||||
# exits on its first match, SIGPIPEs the writer, and the writer's death
|
||||
# becomes the pipeline's status -- a race tests/test-no-pipefail-early-exit-grep.sh
|
||||
|
||||
+16
-13
@@ -1,11 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# ADR-0023 clause 1, and ONLY clause 1: an executable, instructed local git
|
||||
# command in plugin skill or agent content is written `rtk git`, never bare
|
||||
# `git`.
|
||||
# Clause 1, and ONLY clause 1, of the rtk-prefix rule: an executable, instructed
|
||||
# local git command in plugin skill or agent content is written `rtk git`, never
|
||||
# bare `git`. The rule and its rationale are in
|
||||
# docs/adr/0023-rtk-prefix-marks-executable-commands-only.md.
|
||||
#
|
||||
# WHY THIS IS NARROW ON PURPOSE. ADR-0023 has three clauses, and only the first
|
||||
# WHY THIS IS NARROW ON PURPOSE. The rule has three clauses, and only the first
|
||||
# is machine-decidable:
|
||||
#
|
||||
# 1. executable + instructed -> `rtk git` <- this hook
|
||||
@@ -39,14 +40,16 @@ set -euo pipefail
|
||||
#
|
||||
# CLAUSE-3 OPT-OUT. A site that is deliberately bare because rtk rewrites the
|
||||
# output the skill parses, or because the command is interactive, is exempted by
|
||||
# putting the literal string `ADR-0023` on the SAME LINE — in a shell comment for
|
||||
# a code line, in the cell text for a table row. Per-line, never per-block: a
|
||||
# putting the literal marker `rtk-bare:` on the SAME LINE, followed by the reason
|
||||
# — in a shell comment for a code line, in the cell text for a table row. The
|
||||
# marker is neutral on purpose: plugin content is consumed by other repos, so it
|
||||
# must not cite this repo's ADRs. Per-line, never per-block: a
|
||||
# fenced block routinely mixes `rtk git` steps with one deliberately-bare
|
||||
# command (references/push.md does exactly that), and a block-level marker would
|
||||
# silently disarm the checked lines around the marked one.
|
||||
#
|
||||
# The marker is a bare substring match, so a line that merely *mentions*
|
||||
# ADR-0023 for an unrelated reason is also exempt. That is accepted: the marker
|
||||
# `rtk-bare:` for an unrelated reason is also exempt. That is accepted: the marker
|
||||
# is an author's deliberate opt-out, not a security boundary, and a stricter
|
||||
# form would only move the same trust to a different string.
|
||||
|
||||
@@ -55,7 +58,7 @@ if [[ $# -eq 0 ]]; then
|
||||
fi
|
||||
|
||||
if ! command -v python3 > /dev/null 2>&1; then
|
||||
echo "ERROR: python3 is required for the ADR-0023 rtk-prefix gate but was not found on PATH." >&2
|
||||
echo "ERROR: python3 is required for the rtk-prefix gate but was not found on PATH." >&2
|
||||
echo " Fix: install python3 (pre-commit itself is a Python application, so it is almost certainly already present)." >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -66,7 +69,7 @@ exec python3 -u - "$@" <<'PY'
|
||||
import re
|
||||
import sys
|
||||
|
||||
MARKER = "ADR-0023"
|
||||
MARKER = "rtk-bare:"
|
||||
SHELL_INFO = {"bash", "sh", "shell", "zsh", "console", "shell-session"}
|
||||
|
||||
FENCE_OPEN = re.compile(r"^\s*(?P<f>`{3,}|~{3,})\s*(?P<info>[^\s`]*)")
|
||||
@@ -182,16 +185,16 @@ for path in sys.argv[1:]:
|
||||
for line_no, text in check(path):
|
||||
failed = True
|
||||
print(
|
||||
f"ADR-0023: {path}:{line_no}: executable git command is not prefixed with `rtk`: {text}",
|
||||
f"check-rtk-prefix: {path}:{line_no}: executable git command is not prefixed with `rtk`: {text}",
|
||||
file=sys.stderr,
|
||||
)
|
||||
|
||||
if failed:
|
||||
print("", file=sys.stderr)
|
||||
print(
|
||||
"Fix: write `rtk git <subcommand>` (ADR-0023 clause 1). If this command must stay bare\n"
|
||||
"because rtk rewrites output the skill parses, or because it is interactive (clause 3),\n"
|
||||
"say so inline and put the literal string ADR-0023 on the same line to record the opt-out.",
|
||||
"Fix: write `rtk git <subcommand>`. If this command must stay bare because rtk rewrites\n"
|
||||
"output the skill parses, or because it is interactive, record the opt-out on the same\n"
|
||||
"line as `rtk-bare: <reason>` (e.g. `# rtk-bare: the output is parsed`).",
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
@@ -502,7 +502,7 @@ fi
|
||||
KYBERFORGE_RESOLVER_PY=''
|
||||
# shellcheck source=../plugins/kyberforge/.apm/skills/factory-audit/scripts/lib-boundary-resolver.sh
|
||||
. "$RESOLVER_LIB"
|
||||
if [[ "$KYBERFORGE_RESOLVER_PY" != *'BEGIN ADR-0020 SHARED BOUNDARY RESOLVER'* ]]; then
|
||||
if [[ "$KYBERFORGE_RESOLVER_PY" != *'BEGIN SHARED BOUNDARY RESOLVER'* ]]; then
|
||||
echo "ERROR: $RESOLVER_LIB did not define the ADR-0020 boundary resolver (KYBERFORGE_RESOLVER_PY is empty or has lost its BEGIN marker)." >&2
|
||||
echo " Why: running the gates without it would either crash on an undefined name or, worse, pass having resolved nothing." >&2
|
||||
echo " Fix: restore the resolver here-doc in lib-boundary-resolver.sh." >&2
|
||||
|
||||
@@ -66,8 +66,8 @@ fail() { echo " FAIL: $1"; FAIL=$((FAIL + 1)); }
|
||||
TMPDIR_T="$(mktemp -d)"
|
||||
trap 'rm -rf "$TMPDIR_T"' EXIT
|
||||
|
||||
BEGIN_MARKER='# ===== BEGIN ADR-0020 SHARED BOUNDARY RESOLVER ====='
|
||||
END_MARKER='# ===== END ADR-0020 SHARED BOUNDARY RESOLVER ====='
|
||||
BEGIN_MARKER='# ===== BEGIN SHARED BOUNDARY RESOLVER ====='
|
||||
END_MARKER='# ===== END SHARED BOUNDARY RESOLVER ====='
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 1. The resolver has one copy, and the root hook runs it
|
||||
|
||||
Executable
+329
@@ -0,0 +1,329 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tests scripts/apm-audit-ci.sh's root ref-consistency waiver: a plugin whose
|
||||
# git+path entry is in root apm.yml but which is not yet on origin/main (#179,
|
||||
# ADR-0019). See docs/spec/gates.md, "apm-audit-ci".
|
||||
#
|
||||
# Same seam as tests/test-apm-gate-invocation.sh: a stub `apm`, reached through
|
||||
# the APM override so no uv or real apm runs. The stub prints canned `audit
|
||||
# --ci` output for the root manifest ($STUB_ROOT_OUTPUT, exit 1) and passes in
|
||||
# every plugin directory. The waiver's re-run is told apart by where it runs:
|
||||
# under $TMPDIR, the script's mktemp scratch copy, where the stub saves the manifest it was given ($STUB_RERUN_LOG) and prints
|
||||
# $STUB_RERUN_OUTPUT (default: the full root pass) with exit $STUB_RERUN_RC
|
||||
# (default 0). With $STUB_GIT_LOG set it also saves the copy's
|
||||
# .git/info/exclude and notes whether .claude/worktrees was copied. The fixture
|
||||
# is a throwaway git repo whose
|
||||
# refs/remotes/origin/main is set with update-ref -- nothing is fetched.
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
AUDIT="$REPO_ROOT/scripts/apm-audit-ci.sh"
|
||||
PASS=0
|
||||
FAIL=0
|
||||
|
||||
pass() { echo " PASS: $1"; PASS=$((PASS + 1)); }
|
||||
fail() { echo " FAIL: $1"; FAIL=$((FAIL + 1)); }
|
||||
|
||||
unset APM GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY GIT_COMMON_DIR
|
||||
|
||||
TMP="$(mktemp -d)"
|
||||
trap 'rm -rf "$TMP"' EXIT
|
||||
|
||||
BIN="$TMP/bin"
|
||||
mkdir -p "$BIN"
|
||||
cat > "$BIN/apm" << 'EOF'
|
||||
#!/usr/bin/env bash
|
||||
if [[ "${1:-}" == --version ]]; then
|
||||
echo "Agent Package Manager (APM) CLI version 0.39.3"
|
||||
exit 0
|
||||
fi
|
||||
if [[ -f apm.lock.yaml.root-marker ]]; then
|
||||
if [[ "$PWD" != "$TMPDIR"/* ]]; then
|
||||
printf '%s\n' "$STUB_ROOT_OUTPUT"
|
||||
exit 1
|
||||
fi
|
||||
[[ -z "${STUB_RERUN_LOG:-}" ]] || cp apm.yml "$STUB_RERUN_LOG"
|
||||
if [[ -n "${STUB_GIT_LOG:-}" ]]; then
|
||||
cp .git/info/exclude "$STUB_GIT_LOG.exclude" 2> /dev/null || true
|
||||
[[ ! -e .claude/worktrees ]] || touch "$STUB_GIT_LOG.worktrees"
|
||||
fi
|
||||
printf '%s\n' "${STUB_RERUN_OUTPUT-[*] All 15 check(s) passed}"
|
||||
exit "${STUB_RERUN_RC:-0}"
|
||||
fi
|
||||
exit 0
|
||||
EOF
|
||||
chmod +x "$BIN/apm"
|
||||
|
||||
IDENTITY="git.rkdr.net/Mortis/Holocron"
|
||||
|
||||
# The output apm 0.39.3 printed for this branch's root manifest (#179).
|
||||
root_output() { # <failing count line> <extra failing row> <detail lines...>
|
||||
local count="$1" extra="$2"
|
||||
shift 2
|
||||
printf '%s\n' \
|
||||
'[+] No drift detected' \
|
||||
'+------------------------------------------------------------------------------+' \
|
||||
'| Status | Check | Message |' \
|
||||
'|----------+-----------------+-------------------------------------------------|' \
|
||||
'| [+] | lockfile-exists | Lockfile present |' \
|
||||
"| [x] | ref-consistency | $# ref mismatch -- run 'apm install' to update |" \
|
||||
'| | | lockfile |'
|
||||
if [[ -n "$extra" ]]; then printf '%s\n' "$extra"; else
|
||||
printf '%s\n' '| [+] | drift | no drift detected against lockfile |'
|
||||
fi
|
||||
printf '%s\n' \
|
||||
'+------------------------------------------------------------------------------+' \
|
||||
'' \
|
||||
' ref-consistency details:'
|
||||
local d
|
||||
for d in "$@"; do printf ' - %s\n' "$d"; done
|
||||
printf '%s\n' '' "$count"
|
||||
}
|
||||
|
||||
# make_fixture <dir> — a repo with root apm.yml naming plugins/core and
|
||||
# plugins/rtk, both plugin dirs present, origin/main at a commit holding
|
||||
# plugins/core only.
|
||||
make_fixture() {
|
||||
local dir="$1"
|
||||
mkdir -p "$dir/plugins/core" "$dir/plugins/rtk"
|
||||
cat > "$dir/apm.yml" << EOF
|
||||
name: fixture
|
||||
dependencies:
|
||||
apm:
|
||||
- git: https://$IDENTITY.git
|
||||
path: plugins/core
|
||||
# Routes Bash tool calls through rtk.
|
||||
- git: https://$IDENTITY.git
|
||||
path: plugins/rtk
|
||||
mcp: []
|
||||
EOF
|
||||
printf 'name: core\nversion: 1.0.0\n' > "$dir/plugins/core/apm.yml"
|
||||
touch "$dir/apm.lock.yaml.root-marker"
|
||||
git -C "$dir" init -q
|
||||
git -C "$dir" add apm.yml plugins/core/apm.yml
|
||||
git -C "$dir" -c user.name=t -c user.email=t@t commit -qm base
|
||||
git -C "$dir" update-ref refs/remotes/origin/main HEAD
|
||||
printf 'name: rtk\nversion: 0.1.0\n' > "$dir/plugins/rtk/apm.yml"
|
||||
}
|
||||
|
||||
RC=0
|
||||
OUT=""
|
||||
# TMPDIR is a fresh per-run dir, so the re-run's scratch copy can be checked
|
||||
# for cleanup.
|
||||
TMPD="$TMP/tmpdir"
|
||||
run_audit() { # <dir> <root output> [VAR=value ...]
|
||||
local dir="$1" root="$2"
|
||||
shift 2
|
||||
RC=0
|
||||
rm -rf "$TMPD"
|
||||
mkdir -p "$TMPD"
|
||||
OUT="$(cd "$dir" && env APM="$BIN/apm" STUB_ROOT_OUTPUT="$root" TMPDIR="$TMPD" "$@" \
|
||||
bash "$AUDIT" 2>&1)" || RC=$?
|
||||
}
|
||||
tmp_clean() { [[ -z "$(ls -A "$TMPD")" ]]; }
|
||||
|
||||
WAIVER_LINE='apm audit --ci: waived ref-consistency for plugins/rtk (not yet on origin/main; ADR-0019)'
|
||||
SOLE='[x] 1 of 3 check(s) failed'
|
||||
RTK_DETAIL="$IDENTITY/plugins/rtk: not found in lockfile"
|
||||
|
||||
echo "--- waived: one plugin not yet on origin/main ---"
|
||||
F="$TMP/waived"
|
||||
make_fixture "$F"
|
||||
cp "$F/apm.yml" "$TMP/apm.yml.orig"
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")" STUB_RERUN_LOG="$TMP/rerun.yml"
|
||||
[[ $RC -eq 0 ]] && pass "exits 0" || fail "exited $RC: $OUT"
|
||||
grep -qxF "$WAIVER_LINE" <<< "$OUT" && pass "prints the waiver line" || fail "no waiver line: $OUT"
|
||||
grep -qxF 'apm audit --ci: root re-run without the unlanded plugins: All 15 check(s) passed' <<< "$OUT" \
|
||||
&& pass "reports the full-set re-run" || fail "no re-run line: $OUT"
|
||||
# The re-run's manifest is the original minus exactly the rtk item.
|
||||
if [[ -f "$TMP/rerun.yml" ]] && diff "$TMP/apm.yml.orig" "$TMP/rerun.yml" > "$TMP/rerun.diff"; then
|
||||
fail "the re-run saw an unreduced apm.yml"
|
||||
elif [[ "$(cat "$TMP/rerun.diff" 2>/dev/null)" == "$(printf '%s\n' '7,8d6' \
|
||||
"< - git: https://$IDENTITY.git" '< path: plugins/rtk')" ]]; then
|
||||
pass "the re-run's apm.yml drops only the plugins/rtk entry"
|
||||
else
|
||||
fail "unexpected re-run manifest: $(cat "$TMP/rerun.diff" 2>/dev/null)"
|
||||
fi
|
||||
cmp -s "$TMP/apm.yml.orig" "$F/apm.yml" && [[ -z "$(git -C "$F" status --porcelain -- apm.yml)" ]] \
|
||||
&& pass "leaves the working tree's apm.yml byte-identical" || fail "apm.yml changed"
|
||||
tmp_clean && pass "removes the scratch copy" || fail "scratch left behind: $(ls -A "$TMPD")"
|
||||
|
||||
echo ""
|
||||
echo "--- the re-run copy: carries info/exclude, leaves out .claude/worktrees ---"
|
||||
F="$TMP/excl"
|
||||
make_fixture "$F"
|
||||
printf '%s\n' '# fixture marker' '**/.claude/worktrees/' >> "$F/.git/info/exclude"
|
||||
mkdir -p "$F/.claude/worktrees/wt/.venv"
|
||||
touch "$F/.claude/worktrees/wt/.venv/big"
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")" STUB_GIT_LOG="$TMP/gitlog"
|
||||
[[ $RC -eq 0 ]] && pass "still waived" || fail "exited $RC: $OUT"
|
||||
cmp -s "$F/.git/info/exclude" "$TMP/gitlog.exclude" \
|
||||
&& pass "the copy's .git/info/exclude is the repo's" || fail "info/exclude not carried into the copy"
|
||||
[[ ! -e "$TMP/gitlog.worktrees" ]] && pass ".claude/worktrees is not copied" || fail ".claude/worktrees was copied"
|
||||
|
||||
echo ""
|
||||
echo "--- not waived: the reduction changes a line, not only deletes (deletions-only guard) ---"
|
||||
F="$TMP/nonl"
|
||||
make_fixture "$F"
|
||||
# No trailing newline: awk prints one back, so the reduced manifest's last
|
||||
# line differs from the original's, a change rather than a deletion.
|
||||
printf '%s' "$(cat "$F/apm.yml")" > "$F/apm.yml.new" && mv "$F/apm.yml.new" "$F/apm.yml"
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")"
|
||||
[[ $RC -ne 0 ]] && ! grep -qF "waived ref-consistency" <<< "$OUT" \
|
||||
&& grep -qF "changed more than the waived entries" <<< "$OUT" \
|
||||
&& pass "fails when the reduced apm.yml differs by more than deletions" || fail "must fail (rc=$RC): $OUT"
|
||||
|
||||
echo ""
|
||||
echo "--- not waived: the reduction leaves an rtk entry in place ---"
|
||||
F="$TMP/blank"
|
||||
make_fixture "$F"
|
||||
# A blank line inside the rtk item: dep_identity skips it and still finds the
|
||||
# entry, but reduce_manifest ends the item there and keeps it whole.
|
||||
sed -i '/# Routes Bash/{n;s|$|\n|}' "$F/apm.yml"
|
||||
grep -qx '' "$F/apm.yml" || fail "fixture: no blank line in the rtk item"
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")"
|
||||
[[ $RC -ne 0 ]] && ! grep -qF "waived ref-consistency" <<< "$OUT" \
|
||||
&& pass "fails when nothing was removed" || fail "must fail (rc=$RC): $OUT"
|
||||
# A second, blank-split rtk item after a normal one: the normal one is
|
||||
# removed, a pure deletion, so only the post-reduce dep_identity guard sees the
|
||||
# entry that survived.
|
||||
F="$TMP/dup"
|
||||
make_fixture "$F"
|
||||
awk -v e=" - git: https://$IDENTITY.git"$'\n\n'" path: plugins/rtk" \
|
||||
'/^ mcp:/ { print e } { print }' "$F/apm.yml" > "$F/apm.yml.new"
|
||||
mv "$F/apm.yml.new" "$F/apm.yml"
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")"
|
||||
[[ $RC -ne 0 ]] && ! grep -qF "waived ref-consistency" <<< "$OUT" \
|
||||
&& grep -qF "could not remove plugins/rtk's entry" <<< "$OUT" \
|
||||
&& pass "fails when an rtk entry survives a deletions-only reduction" || fail "must fail (rc=$RC): $OUT"
|
||||
|
||||
echo ""
|
||||
echo "--- not waived: the full-set re-run fails ---"
|
||||
F="$TMP/waived"
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")" STUB_RERUN_RC=1 \
|
||||
STUB_RERUN_OUTPUT="$(printf '%s\n' '| [x] | content-integrity | hidden Unicode |' '[x] 1 of 15 check(s) failed')"
|
||||
[[ $RC -ne 0 ]] && ! grep -qF "waived ref-consistency" <<< "$OUT" \
|
||||
&& grep -qF "content-integrity" <<< "$OUT" \
|
||||
&& pass "fails, showing the re-run's failing check" || fail "must fail (rc=$RC): $OUT"
|
||||
cmp -s "$TMP/apm.yml.orig" "$F/apm.yml" && pass "apm.yml still byte-identical" || fail "apm.yml changed"
|
||||
tmp_clean && pass "removes the scratch copy on failure too" || fail "scratch left behind: $(ls -A "$TMPD")"
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")" STUB_RERUN_RC=1
|
||||
[[ $RC -ne 0 ]] && ! grep -qF "waived ref-consistency" <<< "$OUT" \
|
||||
&& pass "fails when the re-run exits non-zero despite a passing summary" || fail "must fail (rc=$RC): $OUT"
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")" STUB_RERUN_OUTPUT='[*] All 14 check(s) passed'
|
||||
[[ $RC -ne 0 ]] && ! grep -qF "waived ref-consistency" <<< "$OUT" \
|
||||
&& pass "fails when the re-run runs fewer than the full set" || fail "must fail (rc=$RC): $OUT"
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")" STUB_RERUN_OUTPUT=''
|
||||
[[ $RC -ne 0 ]] && ! grep -qF "waived ref-consistency" <<< "$OUT" \
|
||||
&& pass "fails when the re-run prints no summary" || fail "must fail (rc=$RC): $OUT"
|
||||
|
||||
echo ""
|
||||
echo "--- not waived: the plugin is already on origin/main ---"
|
||||
F="$TMP/landed"
|
||||
make_fixture "$F"
|
||||
git -C "$F" add plugins/rtk/apm.yml
|
||||
git -C "$F" -c user.name=t -c user.email=t@t commit -qm landed
|
||||
git -C "$F" update-ref refs/remotes/origin/main HEAD
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")"
|
||||
[[ $RC -ne 0 ]] && grep -qF "plugins/rtk is already on origin/main" <<< "$OUT" \
|
||||
&& pass "fails, naming the landed plugin" || fail "must fail (rc=$RC): $OUT"
|
||||
|
||||
echo ""
|
||||
echo "--- not waived: a second check also fails ---"
|
||||
F="$TMP/second"
|
||||
make_fixture "$F"
|
||||
run_audit "$F" "$(root_output '[x] 2 of 3 check(s) failed' \
|
||||
'| [x] | drift | 1 file(s) differ |' "$RTK_DETAIL")"
|
||||
[[ $RC -ne 0 ]] && ! grep -qF "waived ref-consistency" <<< "$OUT" \
|
||||
&& pass "fails when drift fails too" || fail "must fail (rc=$RC): $OUT"
|
||||
|
||||
echo ""
|
||||
echo "--- not waived: one of three fails, but it is not ref-consistency ---"
|
||||
F="$TMP/otherrow"
|
||||
make_fixture "$F"
|
||||
run_audit "$F" "$(root_output "$SOLE" \
|
||||
'| [x] | drift | 1 file(s) differ |' "$RTK_DETAIL" |
|
||||
sed 's/^| \[x\] | ref-consistency/| [+] | ref-consistency/')"
|
||||
[[ $RC -ne 0 ]] && ! grep -qF "waived ref-consistency" <<< "$OUT" \
|
||||
&& pass "fails when the sole failing row is drift" || fail "must fail (rc=$RC): $OUT"
|
||||
|
||||
echo ""
|
||||
echo "--- not waived: a duplicated details header ---"
|
||||
F="$TMP/duphdr"
|
||||
make_fixture "$F"
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL"
|
||||
printf '%s\n' '' ' ref-consistency details:' ' - github.com/acme/skills: not found in lockfile')"
|
||||
[[ $RC -ne 0 ]] && ! grep -qF "waived ref-consistency" <<< "$OUT" \
|
||||
&& pass "fails when a second details block could hide a detail" || fail "must fail (rc=$RC): $OUT"
|
||||
|
||||
echo ""
|
||||
echo "--- not waived: a plugin name that is . or .., or holds .. ---"
|
||||
F="$TMP/dotnames"
|
||||
make_fixture "$F"
|
||||
# Each entry goes inside the apm: list, above ` mcp: []`, so dep_identity
|
||||
# finds it and only the name guards stand between it and a waiver.
|
||||
for n in .. . .hidden a..b; do
|
||||
awk -v e=" - git: https://$IDENTITY.git"$'\n'" path: plugins/$n" \
|
||||
'/^ mcp:/ { print e } { print }' "$F/apm.yml" > "$F/apm.yml.new"
|
||||
mv "$F/apm.yml.new" "$F/apm.yml"
|
||||
mkdir -p "$F/plugins/$n"
|
||||
[[ -f "$F/plugins/$n/apm.yml" ]] || printf 'name: x\n' > "$F/plugins/$n/apm.yml"
|
||||
done
|
||||
for n in .. . .hidden; do
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$IDENTITY/plugins/$n: not found in lockfile")"
|
||||
[[ $RC -ne 0 ]] && grep -qF "unrecognised detail line" <<< "$OUT" \
|
||||
&& pass "fails on plugins/$n" || fail "must fail on plugins/$n (rc=$RC): $OUT"
|
||||
done
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$IDENTITY/plugins/a..b: not found in lockfile")"
|
||||
[[ $RC -ne 0 ]] && grep -qF "contains '..'" <<< "$OUT" \
|
||||
&& pass "fails on plugins/a..b" || fail "must fail on plugins/a..b (rc=$RC): $OUT"
|
||||
|
||||
echo ""
|
||||
echo "--- not waived: a mismatch outside plugins/ ---"
|
||||
F="$TMP/nonplugin"
|
||||
make_fixture "$F"
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "github.com/acme/skills: not found in lockfile")"
|
||||
[[ $RC -ne 0 ]] && grep -qF "unrecognised detail line" <<< "$OUT" \
|
||||
&& pass "fails on a non-plugins detail" || fail "must fail (rc=$RC): $OUT"
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL" "github.com/acme/skills: not found in lockfile")"
|
||||
[[ $RC -ne 0 ]] && ! grep -qF "waived ref-consistency" <<< "$OUT" \
|
||||
&& pass "fails when an unlanded plugin is mixed with a non-plugins detail" \
|
||||
|| fail "must fail on a mixed block (rc=$RC): $OUT"
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$IDENTITY/plugins/rtk: ref main != abc123")"
|
||||
[[ $RC -ne 0 ]] && pass "fails on a plugins/ detail of another kind" || fail "must fail (rc=$RC): $OUT"
|
||||
|
||||
echo ""
|
||||
echo "--- not waived: the identity is not root apm.yml's entry ---"
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "git.example.com/Other/Repo/plugins/rtk: not found in lockfile")"
|
||||
[[ $RC -ne 0 ]] && grep -qF "is not root apm.yml's git+path entry" <<< "$OUT" \
|
||||
&& pass "fails on a foreign identity" || fail "must fail (rc=$RC): $OUT"
|
||||
|
||||
echo ""
|
||||
echo "--- not waived: plugins/<name>/apm.yml is absent ---"
|
||||
F="$TMP/absent"
|
||||
make_fixture "$F"
|
||||
rm "$F/plugins/rtk/apm.yml"
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")"
|
||||
[[ $RC -ne 0 ]] && grep -qF "plugins/rtk/apm.yml is not in the working tree" <<< "$OUT" \
|
||||
&& pass "fails when the plugin manifest is missing" || fail "must fail (rc=$RC): $OUT"
|
||||
|
||||
echo ""
|
||||
echo "--- fails closed: origin/main does not resolve ---"
|
||||
F="$TMP/noorigin"
|
||||
make_fixture "$F"
|
||||
git -C "$F" update-ref -d refs/remotes/origin/main
|
||||
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")"
|
||||
[[ $RC -ne 0 ]] && grep -qF "origin/main does not resolve locally" <<< "$OUT" \
|
||||
&& pass "fails without origin/main" || fail "must fail (rc=$RC): $OUT"
|
||||
|
||||
echo ""
|
||||
echo "--- fails closed: unrecognised output ---"
|
||||
F="$TMP/garbled"
|
||||
make_fixture "$F"
|
||||
run_audit "$F" "something apm never printed"
|
||||
[[ $RC -ne 0 ]] && pass "fails on output of an unknown shape" || fail "must fail (rc=$RC): $OUT"
|
||||
run_audit "$F" "$(root_output "$SOLE" "")"
|
||||
[[ $RC -ne 0 ]] && pass "fails on an empty details block" || fail "must fail (rc=$RC): $OUT"
|
||||
|
||||
echo ""
|
||||
echo "Results: $PASS passed, $FAIL failed"
|
||||
[[ "$FAIL" -eq 0 ]]
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Tests for scripts/check-rtk-prefix.sh — ADR-0023 clause 1.
|
||||
# Tests for scripts/check-rtk-prefix.sh — clause 1 of the rtk-prefix rule (ADR-0023).
|
||||
#
|
||||
# Case 1 is the one that earns the rest: it runs the gate against the corpus as
|
||||
# it stood BEFORE the #113 sweep, and asserts it fails there. A gate that only
|
||||
@@ -91,7 +91,7 @@ else
|
||||
if bash "$SCRIPT" ${PRE_PATHS[@]+"${PRE_PATHS[@]}"} > "$RUN_TMP/pre.out" 2>&1; then
|
||||
fail "the pre-sweep corpus passed — the gate would not have caught the #113 drift"
|
||||
else
|
||||
hits="$(grep -c '^ADR-0023: ' "$RUN_TMP/pre.out" || true)"
|
||||
hits="$(grep -c '^check-rtk-prefix: ' "$RUN_TMP/pre.out" || true)"
|
||||
if [[ "$hits" -lt 20 ]]; then
|
||||
fail "the pre-sweep corpus produced only $hits findings — too few to be the known drift"
|
||||
elif ! grep -q 'gitea-issues/SKILL.md.*git remote get-url origin' "$RUN_TMP/pre.out"; then
|
||||
@@ -135,8 +135,12 @@ rtk git push
|
||||
```' "prefixed commands"
|
||||
|
||||
expect clean '```bash
|
||||
git stash list # rtk-bare: rtk prints "No stashes" where git prints nothing
|
||||
```' "a bare command carrying the rtk-bare: opt-out marker"
|
||||
|
||||
expect dirty '```bash
|
||||
git stash list # bare per ADR-0023: rtk prints "No stashes" where git prints nothing
|
||||
```' "a bare command carrying the ADR-0023 opt-out marker"
|
||||
```' "the retired ADR-0023 marker no longer exempts a bare command"
|
||||
|
||||
expect clean '```text
|
||||
git worktree list --porcelain -z
|
||||
@@ -167,7 +171,7 @@ expect clean '| Operation | Run |
|
||||
|
||||
expect clean '| Operation | Run |
|
||||
|---|---|
|
||||
| List | `git worktree list -v` — bare per ADR-0023 |' \
|
||||
| List | `git worktree list -v` — rtk-bare: the output is parsed |' \
|
||||
"a bare Run cell carrying the opt-out marker"
|
||||
|
||||
# The clause-2 shapes that made an every-span check unusable. Both are real rows
|
||||
@@ -225,7 +229,7 @@ if [[ ${#LIVE[@]} -eq 0 ]]; then
|
||||
elif (cd "$REPO_ROOT" && bash "$SCRIPT" ${LIVE[@]+"${LIVE[@]}"} > "$RUN_TMP/live.out" 2>&1); then
|
||||
pass "the ${#LIVE[@]} in-scope corpus files pass"
|
||||
else
|
||||
fail "the live corpus has ADR-0023 clause-1 violations"
|
||||
fail "the live corpus has clause-1 violations"
|
||||
sed 's/^/ /' "$RUN_TMP/live.out"
|
||||
fi
|
||||
|
||||
|
||||
+13
-1
@@ -109,6 +109,9 @@ check_json() {
|
||||
check_json "$SETTINGS_SRC" \
|
||||
's["disableBundledSkills"] is True and s["syncClaudeAiSkills"] is False and s["env"]["CLAUDE_CODE_DISABLE_SHIP"] == "1" and s["skillOverrides"]["init"] == "off"' \
|
||||
"repo settings turn off bundled and synced skills"
|
||||
check_json "$SETTINGS_SRC" \
|
||||
'all(s["skillOverrides"][k] == "off" for k in ("design", "doctor", "plugin-authoring")) and s["enabledPlugins"]["cc-plugin-easel@builtin"] is False and s["enabledPlugins"]["cc-plugin-plugin-authoring@builtin"] is False and s["syncClaudeAiPlugins"] is False' \
|
||||
"repo settings turn off built-in plugin skills and synced plugins"
|
||||
|
||||
MERGE_HOME="$(new_home)"
|
||||
MERGED="$MERGE_HOME/.claude/settings.json"
|
||||
@@ -118,7 +121,8 @@ cat > "$MERGED" << 'EOF'
|
||||
"theme": "light",
|
||||
"permissions": {"allow": ["Bash(ls:*)"]},
|
||||
"env": {"MY_VAR": "kept", "CLAUDE_CODE_DISABLE_SHIP": "0"},
|
||||
"skillOverrides": {"other": "off", "init": "on"}
|
||||
"skillOverrides": {"other": "off", "init": "on"},
|
||||
"enabledPlugins": {"operator-plugin@x": true, "cc-plugin-easel@builtin": true}
|
||||
}
|
||||
EOF
|
||||
chmod 640 "$MERGED"
|
||||
@@ -132,6 +136,14 @@ check_json "$MERGED" 's["theme"] == "dark" and s["env"]["CLAUDE_CODE_DISABLE_SHI
|
||||
"the repo's value wins where both set one"
|
||||
check_json "$MERGED" 's["disableBundledSkills"] is True and s["syncClaudeAiSkills"] is False' \
|
||||
"settings only the repo has are added"
|
||||
check_json "$MERGED" 's["enabledPlugins"]["operator-plugin@x"] is True' \
|
||||
"the operator's own plugin entries are kept"
|
||||
check_json "$MERGED" 's["enabledPlugins"]["cc-plugin-easel@builtin"] is False and s["enabledPlugins"]["cc-plugin-plugin-authoring@builtin"] is False' \
|
||||
"the repo turns off built-in plugins the operator had enabled"
|
||||
check_json "$MERGED" 's["skillOverrides"]["other"] == "off" and all(s["skillOverrides"][k] == "off" for k in ("design", "doctor", "plugin-authoring"))' \
|
||||
"new skill overrides are added beside the operator's own"
|
||||
check_json "$MERGED" 's["syncClaudeAiPlugins"] is False' \
|
||||
"plugin sync is turned off in merged settings"
|
||||
|
||||
if [[ "$(find "$MERGED" -perm 640)" == "$MERGED" ]]; then
|
||||
pass "the existing file's permissions are kept"
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Acceptance test for issue #177: deployed plugin content must not carry this
|
||||
# repo's internal references, because it ships into consumer repos where those
|
||||
# references point nowhere.
|
||||
#
|
||||
# * git and gitea `.apm/` content: no Co-authored-by trailer examples (any
|
||||
# case), no ADR citations (`ADR-0`, `docs/adr`), no `Mortis/Holocron` slug.
|
||||
# * git, gitea, delivery, core and kyberforge `.apm/` content: no ADR-0023
|
||||
# (now the `rtk-bare:` marker) and no ADR-0020 (the rule is stated inline).
|
||||
#
|
||||
# Other ADR citations in delivery, core and kyberforge are out of #177's scope
|
||||
# and deliberately not asserted here. Every hit is printed as file:line.
|
||||
|
||||
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)); }
|
||||
|
||||
# assert_absent <label> <grep flags> <pattern> <plugin>...
|
||||
# Fails, printing file:line:text for every hit, when <pattern> occurs in any
|
||||
# named plugin's .apm/ tree. A missing .apm/ dir fails too: a renamed plugin
|
||||
# must not turn the check vacuous.
|
||||
assert_absent() {
|
||||
local label="$1" flags="$2" pattern="$3"
|
||||
shift 3
|
||||
local dirs=() plugin hits
|
||||
for plugin in "$@"; do
|
||||
if [[ ! -d "$REPO_ROOT/plugins/$plugin/.apm" ]]; then
|
||||
fail "$label: plugins/$plugin/.apm does not exist"
|
||||
return
|
||||
fi
|
||||
dirs+=("plugins/$plugin/.apm")
|
||||
done
|
||||
# grep exits 1 on no match, which is the passing case here. The guarded
|
||||
# expansion keeps bash 3.2 happy under `set -u`.
|
||||
hits="$(cd "$REPO_ROOT" && grep -rnI $flags -e "$pattern" -- ${dirs[@]+"${dirs[@]}"} || true)"
|
||||
if [[ -z "$hits" ]]; then
|
||||
pass "$label"
|
||||
else
|
||||
fail "$label"
|
||||
printf '%s\n' "$hits" | sed 's/^/ /'
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Plugin content is consumer-neutral (#177)"
|
||||
|
||||
assert_absent "git/gitea: no Co-authored-by" "-i" "Co-authored-by" git gitea
|
||||
assert_absent "git/gitea: no ADR-0 citation" "" "ADR-0" git gitea
|
||||
assert_absent "git/gitea: no docs/adr path" "" "docs/adr" git gitea
|
||||
assert_absent "git/gitea: no Mortis/Holocron slug" "" "Mortis/Holocron" git gitea
|
||||
assert_absent "no ADR-0023 citation" "" "ADR-0023" git gitea delivery core kyberforge
|
||||
assert_absent "no ADR-0020 citation" "" "ADR-0020" git gitea delivery core kyberforge
|
||||
|
||||
echo ""
|
||||
echo "Results: $PASS passed, $FAIL failed"
|
||||
[[ $FAIL -eq 0 ]]
|
||||
Executable
+127
@@ -0,0 +1,127 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tests for plugins/rtk/.apm/hooks/route-through-rtk.sh, the PreToolUse hook
|
||||
# that routes a Bash tool call through `rtk hook claude` (#179).
|
||||
#
|
||||
# The hook acts only when run from a .claude/hooks/ path, so it is copied to the
|
||||
# path apm deploys it to and driven with real payloads, against a stub rtk, no
|
||||
# rtk at all, and the real rtk when one is installed.
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
HOOKS_DIR="$REPO_ROOT/plugins/rtk/.apm/hooks"
|
||||
SRC="$HOOKS_DIR/route-through-rtk.sh"
|
||||
PASS=0
|
||||
FAIL=0
|
||||
|
||||
pass() { PASS=$((PASS + 1)); }
|
||||
fail() { echo " FAIL: $1"; FAIL=$((FAIL + 1)); }
|
||||
|
||||
[[ -f "$SRC" ]] || { echo "FAIL: $SRC does not exist"; exit 1; }
|
||||
REAL_RTK="$(command -v rtk || true)"
|
||||
TIMEOUT="$(command -v timeout || true)"
|
||||
[[ -n "$TIMEOUT" ]] || { echo "FAIL: timeout(1) is not on PATH; install coreutils to run these tests"; exit 1; }
|
||||
|
||||
WORK="$(mktemp -d)"
|
||||
trap 'rm -rf "$WORK"' EXIT
|
||||
|
||||
for d in .claude/hooks/rtk/.apm/hooks elsewhere; do
|
||||
mkdir -p "$WORK/$d"
|
||||
cp "$SRC" "$WORK/$d/"
|
||||
done
|
||||
HOOK="$WORK/.claude/hooks/rtk/.apm/hooks/route-through-rtk.sh"
|
||||
|
||||
# A PATH with only what the hook and the stub need: no rtk on it.
|
||||
mkdir -p "$WORK/base-bin"
|
||||
for tool in bash cat dirname; do
|
||||
ln -s "$(command -v "$tool")" "$WORK/base-bin/$tool"
|
||||
done
|
||||
|
||||
# A stub rtk that records its arguments and stdin and prints a marker.
|
||||
mkdir -p "$WORK/stub-bin"
|
||||
cat > "$WORK/stub-bin/rtk" << STUB
|
||||
#!/usr/bin/env bash
|
||||
printf '%s\n' "\$*" > "$WORK/stub-args"
|
||||
cat > "$WORK/stub-stdin"
|
||||
echo stub-output
|
||||
STUB
|
||||
chmod +x "$WORK/stub-bin/rtk"
|
||||
|
||||
payload() {
|
||||
printf '{"tool_name":"Bash","tool_input":{"command":"%s"}}' "$1"
|
||||
}
|
||||
|
||||
# run <hook> <PATH> <command>: sets OUT and RC.
|
||||
run() {
|
||||
RC=0
|
||||
OUT="$(payload "$3" | PATH="$2" "$TIMEOUT" 10 "$1" 2> "$WORK/stderr")" || RC=$?
|
||||
}
|
||||
|
||||
echo "== Stub rtk receives 'hook claude' and the payload"
|
||||
rm -f "$WORK/stub-args" "$WORK/stub-stdin"
|
||||
run "$HOOK" "$WORK/stub-bin:$WORK/base-bin" "git status"
|
||||
if [[ $RC -eq 0 && "$OUT" == stub-output ]]; then pass; else fail "want rc 0 and stub output, got $RC: $OUT"; fi
|
||||
if [[ "$(cat "$WORK/stub-args" 2> /dev/null)" == "hook claude" ]]; then pass; else fail "stub args: $(cat "$WORK/stub-args" 2> /dev/null)"; fi
|
||||
if [[ "$(cat "$WORK/stub-stdin" 2> /dev/null)" == "$(payload "git status")" ]]; then pass; else fail "stub stdin: $(cat "$WORK/stub-stdin" 2> /dev/null)"; fi
|
||||
|
||||
# stub_rtk <name> <body>: writes a stub rtk with <body> to $WORK/<name>/rtk.
|
||||
stub_rtk() {
|
||||
mkdir -p "$WORK/$1"
|
||||
printf '#!/usr/bin/env bash\ncat > /dev/null\n%s\n' "$2" > "$WORK/$1/rtk"
|
||||
chmod +x "$WORK/$1/rtk"
|
||||
}
|
||||
stub_rtk fail2-bin "echo 'error: unrecognized subcommand' >&2; exit 2"
|
||||
stub_rtk fail1-bin "exit 1"
|
||||
stub_rtk silent-bin "exit 0"
|
||||
|
||||
echo "== rtk exits 2 (usage error): exit 0, no stdout, never blocks"
|
||||
run "$HOOK" "$WORK/fail2-bin:$WORK/base-bin" "git status"
|
||||
if [[ $RC -eq 0 && -z "$OUT" ]]; then pass; else fail "rtk exit 2: want exit 0 and no stdout, got $RC: $OUT"; fi
|
||||
|
||||
echo "== rtk exits 1: exit 0, no stdout"
|
||||
run "$HOOK" "$WORK/fail1-bin:$WORK/base-bin" "git status"
|
||||
if [[ $RC -eq 0 && -z "$OUT" ]]; then pass; else fail "rtk exit 1: want exit 0 and no stdout, got $RC: $OUT"; fi
|
||||
|
||||
echo "== rtk prints nothing: exit 0, no stdout at all (not even a newline)"
|
||||
RC=0
|
||||
payload "git status" | PATH="$WORK/silent-bin:$WORK/base-bin" "$TIMEOUT" 10 "$HOOK" > "$WORK/raw-out" 2> "$WORK/stderr" || RC=$?
|
||||
if [[ $RC -eq 0 && ! -s "$WORK/raw-out" ]]; then pass; else fail "silent rtk: want exit 0 and zero-byte stdout, got $RC: $(od -c "$WORK/raw-out")"; fi
|
||||
|
||||
echo "== rtk absent: exit 0, no output"
|
||||
run "$HOOK" "$WORK/base-bin" "git status"
|
||||
if [[ $RC -eq 0 && -z "$OUT" && ! -s "$WORK/stderr" ]]; then pass; else fail "want silent exit 0, got $RC: $OUT $(cat "$WORK/stderr")"; fi
|
||||
|
||||
echo "== Runtime: acts only from .claude/hooks/"
|
||||
rm -f "$WORK/stub-args"
|
||||
run "$WORK/elsewhere/route-through-rtk.sh" "$WORK/stub-bin:$WORK/base-bin" "git status"
|
||||
if [[ $RC -eq 0 && -z "$OUT" && ! -e "$WORK/stub-args" ]]; then pass; else fail "elsewhere: want silent exit 0, got $RC: $OUT"; fi
|
||||
|
||||
echo "== Real rtk"
|
||||
if [[ -z "$REAL_RTK" ]]; then
|
||||
echo " SKIP: rtk is not installed; the real-rtk cases did not run"
|
||||
else
|
||||
REAL_PATH="$(dirname "$REAL_RTK"):$WORK/base-bin"
|
||||
run "$HOOK" "$REAL_PATH" "git status"
|
||||
if [[ $RC -eq 0 && "$OUT" == *'"command":"rtk git status"'* ]]; then pass; else fail "git status: want rewrite, got $RC: $OUT"; fi
|
||||
# Depends on rtk's built-in rules as of 0.42.4: `echo` has no rewrite rule,
|
||||
# so rtk passes it through with no output. A later rtk may add one.
|
||||
run "$HOOK" "$REAL_PATH" "echo hello"
|
||||
if [[ $RC -eq 0 && -z "$OUT" ]]; then pass; else fail "echo hello: want no output, got $RC: $OUT"; fi
|
||||
# Backs the README's "running both hooks is harmless": rtk leaves a command
|
||||
# that already starts with rtk alone, so a second hook adds nothing.
|
||||
run "$HOOK" "$REAL_PATH" "rtk git status"
|
||||
if [[ $RC -eq 0 && -z "$OUT" ]]; then pass; else fail "rtk git status: want no output, got $RC: $OUT"; fi
|
||||
fi
|
||||
|
||||
echo "== hooks.json"
|
||||
if python3 - "$HOOKS_DIR/hooks.json" << 'PY'
|
||||
import json, sys
|
||||
(entry,) = json.load(open(sys.argv[1]))["hooks"]["PreToolUse"]
|
||||
(hook,) = entry["hooks"]
|
||||
assert entry["matcher"] == "Bash"
|
||||
assert hook["command"] == "${CLAUDE_PLUGIN_ROOT}/.apm/hooks/route-through-rtk.sh"
|
||||
PY
|
||||
then pass; else fail "hooks.json does not wire the script as expected"; fi
|
||||
|
||||
echo
|
||||
echo "Passed: $PASS Failed: $FAIL"
|
||||
[[ $FAIL -eq 0 && $PASS -gt 0 ]]
|
||||
Reference in new issue
Block a user