Compare commits
23
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b04fa1e66 | ||
|
|
27f08af9b3 | ||
|
|
e14fca123d | ||
|
|
aaa73dddd3 | ||
|
|
cc1d396d47 | ||
|
|
fe7184f4f3 | ||
|
|
91481a5ae7 | ||
|
|
c5f09a22d0 | ||
|
|
de9de7c226 | ||
|
|
a77079e67e | ||
|
|
49e8ebdc7d | ||
|
|
78cfbe2f32 | ||
|
|
1ccf246598 | ||
|
|
a988275347 | ||
|
|
038da3014e | ||
|
|
77642183c2 | ||
|
|
55da336298 | ||
|
|
f0aac594c3 | ||
|
|
aa8319a1db | ||
|
|
0f2d9ede68 | ||
|
|
bb678ff441 | ||
|
|
0965c007ba | ||
|
|
012ccce2a9 |
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.2",
|
||||
"version": "0.9.3",
|
||||
"owner": {
|
||||
"name": "Mortis",
|
||||
"url": "https://git.rkdr.net/Mortis/"
|
||||
@@ -24,7 +24,7 @@
|
||||
{
|
||||
"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.3.9",
|
||||
"version": "1.4.0",
|
||||
"category": "Version Control",
|
||||
"source": "./plugins/git"
|
||||
},
|
||||
@@ -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,17 @@
|
||||
}
|
||||
],
|
||||
"_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"
|
||||
}
|
||||
],
|
||||
"SessionStart": [
|
||||
|
||||
@@ -11,6 +11,16 @@
|
||||
"timeout": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": "Bash",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "\"${CLAUDE_PROJECT_DIR}/.claude/hooks/git/.apm/hooks/refuse-push-to-main.py\"",
|
||||
"timeout": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"SessionStart": [
|
||||
|
||||
@@ -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 |
|
||||
@@ -37,7 +37,7 @@ Install all of these before setting up. Each one is a hard dependency of a git h
|
||||
| Tool | Why | Install |
|
||||
| --- | --- | --- |
|
||||
| `uv` | Runs this repo's pinned apm. The root `pyproject.toml` pins `apm-cli==0.39.3` and `uv.lock` locks it (ADR-0034); the `apm-audit-ci` and `apm-pack-check-clean` pre-push hooks run it as `uv run --frozen apm` through `scripts/lib/apm.sh`, and fail below apm 0.39.2 | https://docs.astral.sh/uv/getting-started/installation/. A global `apm` is not needed and not used: a bare `apm` here may be an older one that refuses the v4 `apm.lock.yaml` |
|
||||
| `python3` + PyYAML | Required by `scripts/skill-size-check.sh` (the `skill-size-check` pre-commit hook) and `scripts/check-skill-version-bump.sh` (the `check-skill-version-bump` pre-push hook), which both parse YAML frontmatter | `python3` is usually present — pre-commit is itself a Python application. `pip install pyyaml` if the hook reports PyYAML missing |
|
||||
| `python3` + PyYAML | Required by `scripts/skill-size-check.sh` (the `skill-size-check` pre-commit hook) and `scripts/check-skill-version-bump.sh` (the `check-skill-version-bump` pre-push hook), which both parse YAML frontmatter. `scripts/install.sh` needs `python3` (not PyYAML) to merge the Claude Code settings | `python3` is usually present — pre-commit is itself a Python application. `pip install pyyaml` if the hook reports PyYAML missing |
|
||||
| `vale` | Required by the `vale-audit-prefilter-skill` / `-agent` pre-commit hooks, and by the `test-vale-wrap.sh` suite that `run-tests --strict` runs at pre-push | `brew install vale` (macOS), `snap install vale` (Linux), `choco install vale` (Windows), or https://vale.sh/docs/vale-cli/installation/ |
|
||||
| `claude` CLI | Required by the `validate-marketplace` pre-push hook | Claude Code |
|
||||
|
||||
|
||||
+102
-79
@@ -1,5 +1,5 @@
|
||||
lockfile_version: '4'
|
||||
generated_at: '2026-12-02T11:24:59.920648+00:00'
|
||||
generated_at: '2026-12-05T20:41:35.317702+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: feef6d8307362ebe6bbd8a42f26aa5e8ae955e09
|
||||
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
|
||||
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: feef6d8307362ebe6bbd8a42f26aa5e8ae955e09
|
||||
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
|
||||
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: feef6d8307362ebe6bbd8a42f26aa5e8ae955e09
|
||||
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
|
||||
version: 1.1.4
|
||||
virtual_path: plugins/core
|
||||
is_virtual: true
|
||||
@@ -153,8 +153,8 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: delivery
|
||||
host: git.rkdr.net
|
||||
resolved_commit: feef6d8307362ebe6bbd8a42f26aa5e8ae955e09
|
||||
version: 0.8.0
|
||||
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
|
||||
version: 0.8.1
|
||||
virtual_path: plugins/delivery
|
||||
is_virtual: true
|
||||
package_type: apm_package
|
||||
@@ -240,7 +240,7 @@ dependencies:
|
||||
.claude/skills/delivery-verify/references/report.md: sha256:1bec37e1358d5a56f347e32ca996c693d2f785e7c833f5c6351b6c07380b7e89
|
||||
.claude/skills/delivery-verify/references/revert.md: sha256:d046d1a8f58ac2c41b084a7e669315ec8a6aebcbf86583355db07dd60260c3bb
|
||||
.claude/skills/delivery-verify/references/tiers.md: sha256:28193c90454e4c000f8502155de00e974ce1ffa5db81d7315c23aced67594bdc
|
||||
content_hash: sha256:aa6b3fc8d874c6744121fb5d08b613e830d5b95670b659e67e1c49a569d1d042
|
||||
content_hash: sha256:baa8dc9cf894db4f43df6a07ef7058b32358038b032b712821bce03313bfc925
|
||||
package_targets:
|
||||
- claude
|
||||
- codex
|
||||
@@ -272,13 +272,14 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: git
|
||||
host: git.rkdr.net
|
||||
resolved_commit: feef6d8307362ebe6bbd8a42f26aa5e8ae955e09
|
||||
version: 1.3.9
|
||||
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
|
||||
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: feef6d8307362ebe6bbd8a42f26aa5e8ae955e09
|
||||
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
|
||||
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: feef6d8307362ebe6bbd8a42f26aa5e8ae955e09
|
||||
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
|
||||
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: feef6d8307362ebe6bbd8a42f26aa5e8ae955e09
|
||||
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
|
||||
version: 0.2.0
|
||||
virtual_path: plugins/k8s
|
||||
is_virtual: true
|
||||
@@ -636,8 +639,8 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: kyberforge
|
||||
host: git.rkdr.net
|
||||
resolved_commit: feef6d8307362ebe6bbd8a42f26aa5e8ae955e09
|
||||
version: 2.3.0
|
||||
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
|
||||
version: 2.3.1
|
||||
virtual_path: plugins/kyberforge
|
||||
is_virtual: true
|
||||
package_type: apm_package
|
||||
@@ -667,6 +670,7 @@ dependencies:
|
||||
- .claude/skills/apm-install/LICENSE
|
||||
- .claude/skills/apm-install/SKILL.md
|
||||
- .claude/skills/apm-install/references/sources.md
|
||||
- .claude/skills/apm-install/references/uv-pin.md
|
||||
- .claude/skills/apm-workflow
|
||||
- .claude/skills/apm-workflow/LICENSE
|
||||
- .claude/skills/apm-workflow/SKILL.md
|
||||
@@ -775,7 +779,7 @@ dependencies:
|
||||
- .claude/skills/skill-author/tests/README.md
|
||||
- .claude/skills/skill-author/tests/new-skill.bats
|
||||
deployed_file_hashes:
|
||||
.claude/agents/apm-orchestrate.md: sha256:7c4b7efb58ecdd26fea835613d0f7f909706607cac4f002a0df2db2a3a0ee477
|
||||
.claude/agents/apm-orchestrate.md: sha256:89e9a5332907e8c32d0c903dfab5bcf5408aac985c98627cf5247b2a24c924a7
|
||||
.claude/hooks/kyberforge/.apm/hooks/check-apm-current.sh: sha256:30d9160d25eb712fe7a4d206d12c3779cf13725ccba2f09843713a6f3ebe9ca4
|
||||
.claude/skills/agent-author/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
|
||||
.claude/skills/agent-author/SKILL.md: sha256:7b4ac3c654912459752af14674d8690261e009cfbe022228f14f957150e9b85e
|
||||
@@ -796,16 +800,17 @@ dependencies:
|
||||
.claude/skills/agent-author/tests/README.md: sha256:c844e519db989f64ca5ddfe8b9f3f81c70d71434bd9720136c1a1498aed88808
|
||||
.claude/skills/agent-author/tests/new-agent.bats: sha256:1bd8c4a9bb404b4e189e4eaac65c17f831d9905a9afa6879c162712cadcce6ef
|
||||
.claude/skills/apm-install/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
|
||||
.claude/skills/apm-install/SKILL.md: sha256:2d4c1ac4a7f68f79ba4c84b7be94addd4452827c71dda3f465a4454f36047c74
|
||||
.claude/skills/apm-install/references/sources.md: sha256:b80245ff8ae179d458572cb9b03621d00bf7e2f052f0cd71b88112c0ea8a91ce
|
||||
.claude/skills/apm-install/SKILL.md: sha256:a007ebb9c6e5526aec9b8278987d6863b4fee9a16ab62f64bc7d45965251eac0
|
||||
.claude/skills/apm-install/references/sources.md: sha256:4010e5711cbc502e5059f502c6f607d2726a1a1183a280321f42352b2b279fa8
|
||||
.claude/skills/apm-install/references/uv-pin.md: sha256:9c8c936dfa275d584ef3749ad7d98d46a3553fda8e7356fa6cb74baa76ee4054
|
||||
.claude/skills/apm-workflow/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
|
||||
.claude/skills/apm-workflow/SKILL.md: sha256:96c90f05891a669b05ccb5d33638d0bee6231d7251cddfedc84ea337617c530e
|
||||
.claude/skills/apm-workflow/references/audit.md: sha256:9b3fe128cbe133c8f2880a968b4cd6e875cc0eb79ef6738a9bfdabdf28446fe2
|
||||
.claude/skills/apm-workflow/references/compile.md: sha256:9c7b50645c7da1b442263eb7fd45eb11da09a6356f0f8be65a5b1eb1510f4b53
|
||||
.claude/skills/apm-workflow/references/configure.md: sha256:7633f1cbdaa01d2e889ff114ea67d4e7f0d7d9f41ef77aa21156a6226a04ffc7
|
||||
.claude/skills/apm-workflow/SKILL.md: sha256:f9f2023185e9ca846835d66b91a3f8777de2f0a186e3db51922bae70ce2b9233
|
||||
.claude/skills/apm-workflow/references/audit.md: sha256:fbe286392114c3a34ad59b9da13099176c97ff04184834408755791697c1c9c4
|
||||
.claude/skills/apm-workflow/references/compile.md: sha256:ef2827e42ab2573b87dbf01a0e6ce0b6993ab03f97ce8d9ebcec53d1af66841e
|
||||
.claude/skills/apm-workflow/references/configure.md: sha256:bbb2d903ff1e7dc353c7bc100472010d8c1c0ee41326c46f1002ccc531b4ecd8
|
||||
.claude/skills/apm-workflow/references/install.md: sha256:e729386bee5e2b67ce16b4c6c85446ce7b47d3122b68c148a571bd00a8550ad5
|
||||
.claude/skills/apm-workflow/references/marketplace.md: sha256:1ed67d9a7bb241d2050c7ad4b45799a936ea4df480e8fecbdf69bb1f9eef7211
|
||||
.claude/skills/apm-workflow/references/sources.md: sha256:4ae44a9e82e8ec3bd4b1a61f32adbd3f3ff5fab21db3b4162765b2c0553e49fd
|
||||
.claude/skills/apm-workflow/references/marketplace.md: sha256:23be8060f3831f91c1e30e7ac3f36fabfd9faf9cd991f3fa665000a7c2348e77
|
||||
.claude/skills/apm-workflow/references/sources.md: sha256:05f8c11cd75d3c4a0949be19c63f23389fbe10e89015ce16dc9e7225964e4d12
|
||||
.claude/skills/factory-audit/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
|
||||
.claude/skills/factory-audit/SKILL.md: sha256:9eb6d4bf2bf9483e756e93da0bf3752b0dc86cd641b486bbe5c3fd48948f5c40
|
||||
.claude/skills/factory-audit/assets/vale/.vale.ini: sha256:74ad1f946bfaa7a73296a9300082269febacc77cc4953296257cd07a93343f29
|
||||
@@ -847,37 +852,37 @@ dependencies:
|
||||
.claude/skills/factory-audit/tests/validate-provenance-skill.bats: sha256:0ca63a4790035fce3d3907179a6c3831b681bdba5f7ae099183c86a65cb581cc
|
||||
.claude/skills/factory-audit/tests/validate-skill.bats: sha256:4065195bfe9faf5338e858acc7e97f3a6fe67004f083fbdb0a3717f097b7a4d3
|
||||
.claude/skills/forge/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
|
||||
.claude/skills/forge/SKILL.md: sha256:562249dd1a0a2632e2b5bdeac864a6cdc6ab33a2d05a59ed1fb1fb919a42ee98
|
||||
.claude/skills/forge/SKILL.md: sha256:cac9e59ddb27305698c946d7859a8d34dc331b0edba8a63f10c93595bfdc6e80
|
||||
.claude/skills/forge/references/apm-routes.md: sha256:b7d74d12ff34648be968db3e9db66c1be2efa420cad0eceea20374aa100659aa
|
||||
.claude/skills/forge/references/author-routes.md: sha256:cfbc0502a60d1f444c2e5e76a392329cfa92b1ec51d1f365cc0772312e064a4d
|
||||
.claude/skills/forge/references/sources.md: sha256:77b03bb128d339b056958fbe91c00bd16020ab89c5c0aca297eb1c3494874df8
|
||||
.claude/skills/forge/references/author-routes.md: sha256:110bae34e6046430bfa6f89aa25afa5fba4046f2786f9a5eb4a844406198fc0e
|
||||
.claude/skills/forge/references/sources.md: sha256:bf287c9070c2092bc328ae5c92ed3605901847a6aa8711cb804f9243cb567209
|
||||
.claude/skills/forge/references/version-bump.md: sha256:8e6275fd5bc7f9ee1bfeea8b9cdecdd43eb1c838e9e499bba9a35b2a581885ec
|
||||
.claude/skills/instructions-author/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
|
||||
.claude/skills/instructions-author/SKILL.md: sha256:c3b00c42b0831ff292bd6616935bc3f0e7d6ec7be24961ccd52cc5a21d6a2145
|
||||
.claude/skills/instructions-author/SKILL.md: sha256:cc0f06e9adf7f3610559d809d2709a17fcbe5ad08afd1b4a2abab3921c6ba273
|
||||
.claude/skills/instructions-author/assets/README.md: sha256:f661694f81755f0a839434569edbcb28c544dc9f32bdec6f8db622e2f19b8e1e
|
||||
.claude/skills/instructions-author/assets/templates/instructions.md: sha256:bd34264c24288ce4f8baac8febb41aff379f1141a41cca7c71a527fac28dea07
|
||||
.claude/skills/instructions-author/assets/templates/instructions.md: sha256:808c494bc9e39e11919ac06276a76b9e6b470f174e1d0c1e5ae99cdb10773891
|
||||
.claude/skills/instructions-author/references/content.md: sha256:62e9ad15c5e78d96b8f11dfe9c6e700d8032a13f855c4eca3ef3f4ba92c16fd8
|
||||
.claude/skills/instructions-author/references/create.md: sha256:ac1ca52ea450f58b7245830e8367fa1a89401963024b3a4d80b4dde169a0ef31
|
||||
.claude/skills/instructions-author/references/improve.md: sha256:0bbeef069056ae2be02bb87e22a112f20e195b0736f7c1d80c106726e1942252
|
||||
.claude/skills/instructions-author/references/schema.md: sha256:6cc0c7cee226ae0a794d65093f4dd9e2e19c9cea14be616ba252bcc957e04b9b
|
||||
.claude/skills/instructions-author/references/sources.md: sha256:ce16c0e62de3c99f74cfc259a2d8d7d99fde0f9f4830cf07ed2bfb2e520889c2
|
||||
.claude/skills/instructions-author/references/target-mapping.md: sha256:cc2b132ef7d72cac3f6abd2b8aa1feb48edda7c7bbb219b8abc953995b21877b
|
||||
.claude/skills/instructions-author/references/verify.md: sha256:4314b25d7b7ff036684f2ab3ceb96c1b13bd0705be04f3e888d15b2e0690f02c
|
||||
.claude/skills/instructions-author/references/create.md: sha256:2d5575b992ee2d20c4c9172c4211bef513343833b677ab6ffa435dc4c054c572
|
||||
.claude/skills/instructions-author/references/improve.md: sha256:a202d998e8919f7904c80f7e8ff48849bc382b6273edeebb54ac2d43d40f2f1d
|
||||
.claude/skills/instructions-author/references/schema.md: sha256:70baea540110336b232cf7246f6642eae2e245eb5b778495ea1c81e64cd089a8
|
||||
.claude/skills/instructions-author/references/sources.md: sha256:8698626b025ad01eb25dbdd99700397750774aac19185d41318210b55f68023d
|
||||
.claude/skills/instructions-author/references/target-mapping.md: sha256:70248f44d19ed5a566af1fd6262ab0378483f9f7da7795f89f81203b37f602c8
|
||||
.claude/skills/instructions-author/references/verify.md: sha256:42ee7a18494f0690a191edf86a5769f77414ecd3cede5477d56d2ae603ddb3de
|
||||
.claude/skills/instructions-author/scripts/README.md: sha256:c407aa61e93451956d0d6ee00a5dcca51f301ae9cdfa6d7d0ec63e89e8219874
|
||||
.claude/skills/instructions-author/scripts/new-instructions.sh: sha256:d914dc304fbb8f56cf71375e631ffdc868b2d2f5a91b566a11e1aa79a23c97e1
|
||||
.claude/skills/instructions-author/tests/README.md: sha256:4637a0a171cf515e5bc9163682e1951b54fd41fd37927b19c3b8e0e464752885
|
||||
.claude/skills/instructions-author/tests/new-instructions.bats: sha256:ae34a57d331379990fc0b72396819497f973c3fa0a52016a99e9db4173ff2036
|
||||
.claude/skills/instructions-author/tests/README.md: sha256:4ed182558fde1dec432f80f38e9d9810f5e6857731b24c7166bfbfd59c0c0aa8
|
||||
.claude/skills/instructions-author/tests/new-instructions.bats: sha256:be168768d1f2abd62f4c810e0592f86d3bf2c1533d7cd56588fb2b1b876ecbda
|
||||
.claude/skills/prompt-author/LICENSE: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
|
||||
.claude/skills/prompt-author/SKILL.md: sha256:9d772ba7e35451eb8602f11a79ab9042582ae2514082193deb26161bdbe51ff0
|
||||
.claude/skills/prompt-author/SKILL.md: sha256:c3cd5ebce0d364150c85b71ba7b848e4e5d710e0872fe2a31bb48e368c28dde8
|
||||
.claude/skills/prompt-author/assets/README.md: sha256:8825773a7c8c388774fa4fc94d275bebada649cbc1c23af00477b02c5d07e48a
|
||||
.claude/skills/prompt-author/assets/templates/prompt.md: sha256:f2ec5fafcde549e503f497af7a64f1aee2d82ea842995a7e1ec5400ec6c105c8
|
||||
.claude/skills/prompt-author/assets/templates/prompt.md: sha256:25449e1bbda461503295ffc0b19cdf5f7d7971c162b03e78368b92177749368b
|
||||
.claude/skills/prompt-author/references/content.md: sha256:caee9c72f3ad61d933190b770983187689c3cffca7700c2fa27666178f59e43a
|
||||
.claude/skills/prompt-author/references/create.md: sha256:e552bcf8347d599c80603680fa39aeecc63c806c2df38a81a0647ea6ecea0512
|
||||
.claude/skills/prompt-author/references/improve.md: sha256:fb830bdd8af6f99ff1cb946bb83888a4afdbdc3810e8cbc88437599b1bc313fb
|
||||
.claude/skills/prompt-author/references/schema.md: sha256:6bdf4311878583b869b7d4b164c1e9cc8f8c7a2a578a30dabfd33a0afbf88ac5
|
||||
.claude/skills/prompt-author/references/sources.md: sha256:f465df6f1a7cb548f1c313bdddf237c8dd993374253286af53c42d86b98918c5
|
||||
.claude/skills/prompt-author/references/target-mapping.md: sha256:a1b30f19f565ef701c680b11bd94c7a813dd1899acf17ce109bd35279e5ff204
|
||||
.claude/skills/prompt-author/references/verify.md: sha256:11175c3cecbd11f9a940de62c646c54234789c4e46ebd69ecd20a9d6bd9b4874
|
||||
.claude/skills/prompt-author/references/create.md: sha256:090aac699825ff41b8fd017140b271134900b29a358bb1608f600df0bd6a117f
|
||||
.claude/skills/prompt-author/references/improve.md: sha256:f3c8b5e0f010bc952cc2d64e908327302a79b09ba0452943569a2d836466b10a
|
||||
.claude/skills/prompt-author/references/schema.md: sha256:e578e5e747e1adad70fe5d4cf330d1c6b86dc2616715b79f6c1730cb6ea0955f
|
||||
.claude/skills/prompt-author/references/sources.md: sha256:8bec78b627a1d490e27a65c289f612fb108d3d1bac2ed53bcd4152b29a4c303d
|
||||
.claude/skills/prompt-author/references/target-mapping.md: sha256:e535f2e166b87798dbaf353f7a3076b736b195f94b9c7969409dfea2a7e531fd
|
||||
.claude/skills/prompt-author/references/verify.md: sha256:da80855b36ff07003ffe5cda6a6e3a3be7fe75f92480a597fd921261675ba834
|
||||
.claude/skills/prompt-author/scripts/README.md: sha256:9f6bdbf2ea24ba764cd8791d128e2593e4c2eb96802faa667ea9d6af018fadf7
|
||||
.claude/skills/prompt-author/scripts/new-prompt.sh: sha256:f5f0fc5cc3dedf23ea754b2620b56a808cd65f1714144ec04ea797bd25340dcd
|
||||
.claude/skills/prompt-author/tests/README.md: sha256:975f6940b83a8f9650656a7acdab870289031d91db74d4ab74da298b3df01bbd
|
||||
@@ -899,7 +904,7 @@ dependencies:
|
||||
.claude/skills/skill-author/scripts/new-skill.sh: sha256:a7e99f04da68230372ca8b14da8c5e6a4a035efdd5d10d9c77e2e8c92da85c35
|
||||
.claude/skills/skill-author/tests/README.md: sha256:81d301b04a489d5340234948188ff96466c3c3ab7f20a88ec2e570d1434a7b8c
|
||||
.claude/skills/skill-author/tests/new-skill.bats: sha256:105d6fb09203f84a17a040b1fc91a674313c1dafcd4ddd0d267b36795c22d410
|
||||
content_hash: sha256:06daf8d14852025eca1bb528105d8cbd5b1ec091f8040754a5afcc91ca66763c
|
||||
content_hash: sha256:afd91f772288434d07511463f36877daf63e4240929c28a33bba727fcb3aaddc
|
||||
package_targets:
|
||||
- claude
|
||||
- codex
|
||||
@@ -943,7 +948,7 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: lint
|
||||
host: git.rkdr.net
|
||||
resolved_commit: feef6d8307362ebe6bbd8a42f26aa5e8ae955e09
|
||||
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
|
||||
version: 1.1.9
|
||||
virtual_path: plugins/lint
|
||||
is_virtual: true
|
||||
@@ -989,7 +994,7 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: mattpocock
|
||||
host: git.rkdr.net
|
||||
resolved_commit: feef6d8307362ebe6bbd8a42f26aa5e8ae955e09
|
||||
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
|
||||
version: 0.5.0
|
||||
virtual_path: plugins/mattpocock
|
||||
is_virtual: true
|
||||
@@ -1007,7 +1012,7 @@ dependencies:
|
||||
- repo_url: Mortis/Holocron
|
||||
name: plan
|
||||
host: git.rkdr.net
|
||||
resolved_commit: feef6d8307362ebe6bbd8a42f26aa5e8ae955e09
|
||||
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
|
||||
version: 0.5.0
|
||||
virtual_path: plugins/plan
|
||||
is_virtual: true
|
||||
@@ -1795,7 +1800,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:7c4b7efb58ecdd26fea835613d0f7f909706607cac4f002a0df2db2a3a0ee477
|
||||
content_hash: sha256:89e9a5332907e8c32d0c903dfab5bcf5408aac985c98627cf5247b2a24c924a7
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/agents/delivery-implement-lead.md
|
||||
@@ -1949,6 +1954,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
|
||||
@@ -2308,7 +2322,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:2d4c1ac4a7f68f79ba4c84b7be94addd4452827c71dda3f465a4454f36047c74
|
||||
content_hash: sha256:a007ebb9c6e5526aec9b8278987d6863b4fee9a16ab62f64bc7d45965251eac0
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/apm-install/references/sources.md
|
||||
@@ -2317,7 +2331,16 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:b80245ff8ae179d458572cb9b03621d00bf7e2f052f0cd71b88112c0ea8a91ce
|
||||
content_hash: sha256:4010e5711cbc502e5059f502c6f607d2726a1a1183a280321f42352b2b279fa8
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/apm-install/references/uv-pin.md
|
||||
runtime: null
|
||||
scope: project
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:9c8c936dfa275d584ef3749ad7d98d46a3553fda8e7356fa6cb74baa76ee4054
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/apm-workflow
|
||||
@@ -2344,7 +2367,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:96c90f05891a669b05ccb5d33638d0bee6231d7251cddfedc84ea337617c530e
|
||||
content_hash: sha256:f9f2023185e9ca846835d66b91a3f8777de2f0a186e3db51922bae70ce2b9233
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/apm-workflow/references/audit.md
|
||||
@@ -2353,7 +2376,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:9b3fe128cbe133c8f2880a968b4cd6e875cc0eb79ef6738a9bfdabdf28446fe2
|
||||
content_hash: sha256:fbe286392114c3a34ad59b9da13099176c97ff04184834408755791697c1c9c4
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/apm-workflow/references/compile.md
|
||||
@@ -2362,7 +2385,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:9c7b50645c7da1b442263eb7fd45eb11da09a6356f0f8be65a5b1eb1510f4b53
|
||||
content_hash: sha256:ef2827e42ab2573b87dbf01a0e6ce0b6993ab03f97ce8d9ebcec53d1af66841e
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/apm-workflow/references/configure.md
|
||||
@@ -2371,7 +2394,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:7633f1cbdaa01d2e889ff114ea67d4e7f0d7d9f41ef77aa21156a6226a04ffc7
|
||||
content_hash: sha256:bbb2d903ff1e7dc353c7bc100472010d8c1c0ee41326c46f1002ccc531b4ecd8
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/apm-workflow/references/install.md
|
||||
@@ -2389,7 +2412,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:1ed67d9a7bb241d2050c7ad4b45799a936ea4df480e8fecbdf69bb1f9eef7211
|
||||
content_hash: sha256:23be8060f3831f91c1e30e7ac3f36fabfd9faf9cd991f3fa665000a7c2348e77
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/apm-workflow/references/sources.md
|
||||
@@ -2398,7 +2421,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:4ae44a9e82e8ec3bd4b1a61f32adbd3f3ff5fab21db3b4162765b2c0553e49fd
|
||||
content_hash: sha256:05f8c11cd75d3c4a0949be19c63f23389fbe10e89015ce16dc9e7225964e4d12
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/caveman
|
||||
@@ -3451,7 +3474,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:562249dd1a0a2632e2b5bdeac864a6cdc6ab33a2d05a59ed1fb1fb919a42ee98
|
||||
content_hash: sha256:cac9e59ddb27305698c946d7859a8d34dc331b0edba8a63f10c93595bfdc6e80
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/forge/references/apm-routes.md
|
||||
@@ -3469,7 +3492,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:cfbc0502a60d1f444c2e5e76a392329cfa92b1ec51d1f365cc0772312e064a4d
|
||||
content_hash: sha256:110bae34e6046430bfa6f89aa25afa5fba4046f2786f9a5eb4a844406198fc0e
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/forge/references/sources.md
|
||||
@@ -3478,7 +3501,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:77b03bb128d339b056958fbe91c00bd16020ab89c5c0aca297eb1c3494874df8
|
||||
content_hash: sha256:bf287c9070c2092bc328ae5c92ed3605901847a6aa8711cb804f9243cb567209
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/forge/references/version-bump.md
|
||||
@@ -5269,7 +5292,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:c3b00c42b0831ff292bd6616935bc3f0e7d6ec7be24961ccd52cc5a21d6a2145
|
||||
content_hash: sha256:cc0f06e9adf7f3610559d809d2709a17fcbe5ad08afd1b4a2abab3921c6ba273
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/instructions-author/assets/README.md
|
||||
@@ -5287,7 +5310,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:bd34264c24288ce4f8baac8febb41aff379f1141a41cca7c71a527fac28dea07
|
||||
content_hash: sha256:808c494bc9e39e11919ac06276a76b9e6b470f174e1d0c1e5ae99cdb10773891
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/instructions-author/references/content.md
|
||||
@@ -5305,7 +5328,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:ac1ca52ea450f58b7245830e8367fa1a89401963024b3a4d80b4dde169a0ef31
|
||||
content_hash: sha256:2d5575b992ee2d20c4c9172c4211bef513343833b677ab6ffa435dc4c054c572
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/instructions-author/references/improve.md
|
||||
@@ -5314,7 +5337,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:0bbeef069056ae2be02bb87e22a112f20e195b0736f7c1d80c106726e1942252
|
||||
content_hash: sha256:a202d998e8919f7904c80f7e8ff48849bc382b6273edeebb54ac2d43d40f2f1d
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/instructions-author/references/schema.md
|
||||
@@ -5323,7 +5346,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:6cc0c7cee226ae0a794d65093f4dd9e2e19c9cea14be616ba252bcc957e04b9b
|
||||
content_hash: sha256:70baea540110336b232cf7246f6642eae2e245eb5b778495ea1c81e64cd089a8
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/instructions-author/references/sources.md
|
||||
@@ -5332,7 +5355,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:ce16c0e62de3c99f74cfc259a2d8d7d99fde0f9f4830cf07ed2bfb2e520889c2
|
||||
content_hash: sha256:8698626b025ad01eb25dbdd99700397750774aac19185d41318210b55f68023d
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/instructions-author/references/target-mapping.md
|
||||
@@ -5341,7 +5364,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:cc2b132ef7d72cac3f6abd2b8aa1feb48edda7c7bbb219b8abc953995b21877b
|
||||
content_hash: sha256:70248f44d19ed5a566af1fd6262ab0378483f9f7da7795f89f81203b37f602c8
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/instructions-author/references/verify.md
|
||||
@@ -5350,7 +5373,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:4314b25d7b7ff036684f2ab3ceb96c1b13bd0705be04f3e888d15b2e0690f02c
|
||||
content_hash: sha256:42ee7a18494f0690a191edf86a5769f77414ecd3cede5477d56d2ae603ddb3de
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/instructions-author/scripts/README.md
|
||||
@@ -5377,7 +5400,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:4637a0a171cf515e5bc9163682e1951b54fd41fd37927b19c3b8e0e464752885
|
||||
content_hash: sha256:4ed182558fde1dec432f80f38e9d9810f5e6857731b24c7166bfbfd59c0c0aa8
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/instructions-author/tests/new-instructions.bats
|
||||
@@ -5386,7 +5409,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:ae34a57d331379990fc0b72396819497f973c3fa0a52016a99e9db4173ff2036
|
||||
content_hash: sha256:be168768d1f2abd62f4c810e0592f86d3bf2c1533d7cd56588fb2b1b876ecbda
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/k8s-diagnose
|
||||
@@ -5620,7 +5643,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:9d772ba7e35451eb8602f11a79ab9042582ae2514082193deb26161bdbe51ff0
|
||||
content_hash: sha256:c3cd5ebce0d364150c85b71ba7b848e4e5d710e0872fe2a31bb48e368c28dde8
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/prompt-author/assets/README.md
|
||||
@@ -5638,7 +5661,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:f2ec5fafcde549e503f497af7a64f1aee2d82ea842995a7e1ec5400ec6c105c8
|
||||
content_hash: sha256:25449e1bbda461503295ffc0b19cdf5f7d7971c162b03e78368b92177749368b
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/prompt-author/references/content.md
|
||||
@@ -5656,7 +5679,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:e552bcf8347d599c80603680fa39aeecc63c806c2df38a81a0647ea6ecea0512
|
||||
content_hash: sha256:090aac699825ff41b8fd017140b271134900b29a358bb1608f600df0bd6a117f
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/prompt-author/references/improve.md
|
||||
@@ -5665,7 +5688,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:fb830bdd8af6f99ff1cb946bb83888a4afdbdc3810e8cbc88437599b1bc313fb
|
||||
content_hash: sha256:f3c8b5e0f010bc952cc2d64e908327302a79b09ba0452943569a2d836466b10a
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/prompt-author/references/schema.md
|
||||
@@ -5674,7 +5697,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:6bdf4311878583b869b7d4b164c1e9cc8f8c7a2a578a30dabfd33a0afbf88ac5
|
||||
content_hash: sha256:e578e5e747e1adad70fe5d4cf330d1c6b86dc2616715b79f6c1730cb6ea0955f
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/prompt-author/references/sources.md
|
||||
@@ -5683,7 +5706,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:f465df6f1a7cb548f1c313bdddf237c8dd993374253286af53c42d86b98918c5
|
||||
content_hash: sha256:8bec78b627a1d490e27a65c289f612fb108d3d1bac2ed53bcd4152b29a4c303d
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/prompt-author/references/target-mapping.md
|
||||
@@ -5692,7 +5715,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:a1b30f19f565ef701c680b11bd94c7a813dd1899acf17ce109bd35279e5ff204
|
||||
content_hash: sha256:e535f2e166b87798dbaf353f7a3076b736b195f94b9c7969409dfea2a7e531fd
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/prompt-author/references/verify.md
|
||||
@@ -5701,7 +5724,7 @@ deployments:
|
||||
owners:
|
||||
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
|
||||
content_hash: sha256:11175c3cecbd11f9a940de62c646c54234789c4e46ebd69ecd20a9d6bd9b4874
|
||||
content_hash: sha256:da80855b36ff07003ffe5cda6a6e3a3be7fe75f92480a597fd921261675ba834
|
||||
- kind: project-relative
|
||||
target: claude
|
||||
value: .claude/skills/prompt-author/scripts/README.md
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: holocron
|
||||
version: 0.9.2
|
||||
version: 0.9.3
|
||||
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
|
||||
@@ -86,6 +89,12 @@ executables:
|
||||
# full-identity, version-in-key convention as above, kept by the same check.
|
||||
git.rkdr.net/Mortis/Holocron/plugins/delivery#0.8.1:
|
||||
hooks: true
|
||||
# git ships the hook that refuses a push to main.
|
||||
git.rkdr.net/Mortis/Holocron/plugins/git#1.4.0:
|
||||
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:
|
||||
# apm's Claude marketplace mapper only emits description:/version: into the
|
||||
@@ -93,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.2
|
||||
version: 0.9.3
|
||||
owner:
|
||||
name: Mortis
|
||||
url: https://git.rkdr.net/Mortis/
|
||||
@@ -164,3 +173,7 @@ marketplace:
|
||||
- name: plan
|
||||
source: ./plugins/plan
|
||||
category: Productivity
|
||||
|
||||
- name: rtk
|
||||
source: ./plugins/rtk
|
||||
category: Developer Tools
|
||||
@@ -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,14 @@ 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.*
|
||||
- *Amended 2026-11-25 ([Pre-merge Ansible dry run without exposing production credentials](https://git.rkdr.net/Mortis/Holocron/issues/200)):
|
||||
the reopened Ansible `--check --diff` now runs in CI from the base branch's copy with production
|
||||
credentials — automatic on human-authored PRs, gated on bot PRs by an allowlisted human's
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
# Bundled Claude Code skills are turned off with one user-level switch
|
||||
|
||||
**Status: accepted (2026-12-03).**
|
||||
|
||||
## Context
|
||||
|
||||
Issue #266. Claude Code ships bundled skills and syncs skills from the claude.ai account, and the
|
||||
operator wants only this repo's plugin skills. Claude Code 2.1.334 has no allowlist: a skill missing
|
||||
from `skillOverrides` is on, and `Skill(x)` allow rules do not restrict other skills. The operator
|
||||
wanted a setting that also covers bundled skills added later. A custom `/ship` is also not loaded
|
||||
where the built-in one is available.
|
||||
|
||||
## 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
|
||||
`~/.claude/settings.json`:
|
||||
|
||||
- `disableBundledSkills: true`
|
||||
- `syncClaudeAiSkills: false`
|
||||
- `env.CLAUDE_CODE_DISABLE_SHIP: "1"`, the documented fix for the custom `/ship`.
|
||||
- `skillOverrides.init: "off"`
|
||||
|
||||
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.
|
||||
|
||||
## Considered options
|
||||
|
||||
**A `skillOverrides` blocklist (rejected).** It needs a new entry for each unwanted skill that ships.
|
||||
|
||||
**`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
|
||||
cannot write the key either.
|
||||
|
||||
**A PreToolUse hook on the Skill tool (rejected).** It can refuse a call but cannot hide a skill or
|
||||
resolve a name collision.
|
||||
|
||||
**Turning off only the three unwanted synced skills in the claude.ai account (rejected).** The
|
||||
operator chose to turn off all syncing.
|
||||
|
||||
## Consequences
|
||||
|
||||
1. `simplify`, `loop`, `update-config` and `claude-api` are lost and cannot be re-enabled one by one
|
||||
(tested).
|
||||
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.
|
||||
|
||||
## Evidence
|
||||
|
||||
- **Tested** in headless mode on Claude Code 2.1.334: the effect of `disableBundledSkills` on bundled
|
||||
skills, and `skillOverrides.init: "off"`.
|
||||
- **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.
|
||||
- Sources: code.claude.com/docs/en/settings-reference, `/skills` and `/ship-command-troubleshooting`.
|
||||
|
||||
Related: ADR-0018, ADR-0019; #266.
|
||||
@@ -13,9 +13,10 @@ project repo (local overrides)
|
||||
|
||||
## Content deployment model
|
||||
|
||||
`scripts/install.sh` is a **deployer**, not a composer. It sources `scripts/deploy-manifest.sh` and deploys three categories:
|
||||
`scripts/install.sh` is a **deployer**, not a composer, with one exception: user settings are merged, not copied. It sources `scripts/deploy-manifest.sh` and deploys four categories:
|
||||
|
||||
- **Files** (`DEPLOY_FILES`): `providers/claude-code/CLAUDE.md` → `~/.claude/CLAUDE.md`; `providers/claude-code/settings.json` → `~/.claude/settings.json`; `core/AGENTS.md` → `~/.agents/AGENTS.md`
|
||||
- **Files** (`DEPLOY_FILES`): `providers/claude-code/CLAUDE.md` → `~/.claude/CLAUDE.md`; `core/AGENTS.md` → `~/.agents/AGENTS.md`
|
||||
- **Merged JSON** (`DEPLOY_JSON_MERGES`): `providers/claude-code/settings.json` → `~/.claude/settings.json`. Settings only the user has are kept, including inside nested objects; where both set a value, the repo's wins, and arrays are replaced whole. Removing a setting from the repo does not remove it from a user's file. An existing file that is not a valid JSON object stops the install and is left untouched (ADR-0035)
|
||||
- **Executables** (`DEPLOY_EXECUTABLES`): `providers/claude-code/statusline-command.sh` → `~/.claude/statusline-command.sh` (with `+x`)
|
||||
- **Directories** (`DEPLOY_DIRS`): `core/` → `~/.claude/core/` (destination fully replaced on each deploy)
|
||||
|
||||
|
||||
+36
-3
@@ -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)
|
||||
@@ -1232,7 +1232,39 @@ 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.
|
||||
|
||||
**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` and `.venv`) 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 runs `git init` with the same
|
||||
`origin` URL, the only git state apm reads. 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`. 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
|
||||
@@ -1357,7 +1389,8 @@ every key stays an accurate record of what was approved.
|
||||
|
||||
It covers every plugin that ships executables, not one named package. The script scans
|
||||
`plugins/*/` and treats a plugin as shipping executables when `plugins/<name>/.apm/hooks/` or
|
||||
`plugins/<name>/bin/` exists — kyberforge ships both, delivery ships a guard hook. For each one it
|
||||
`plugins/<name>/bin/` exists — kyberforge ships both, delivery ships a guard hook,
|
||||
git ships a hook that refuses a push to `main`. For each one it
|
||||
reads `name:` and `version:` from `plugins/<name>/apm.yml` and asserts root `apm.yml` carries the
|
||||
`<identity>#<version>` key under `executables.allow`. The `name:` must equal the directory name, so
|
||||
one that differs fails rather than being guessed at. Every failing package is
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"hooks": {
|
||||
"PreToolUse": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"command": "${CLAUDE_PLUGIN_ROOT}/.apm/hooks/refuse-push-to-main.py",
|
||||
"timeout": 10,
|
||||
"type": "command"
|
||||
}
|
||||
],
|
||||
"matcher": "Bash"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+265
@@ -0,0 +1,265 @@
|
||||
#!/usr/bin/env python3
|
||||
"""PreToolUse hook: refuse a `git push` that can update `main`.
|
||||
|
||||
A guardrail against accidents, not a security boundary: whatever it cannot read
|
||||
in the command line goes through. Limits and opt-out: the git plugin's README.
|
||||
"""
|
||||
|
||||
import fnmatch
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
MAIN_NAMES = ("main", "heads/main", "refs/heads/main")
|
||||
|
||||
HEREDOC = re.compile(
|
||||
r"""(?<!<)<<(-?)[ \t]*(?:'([^']+)'|"([^"]+)"|\\?([^\s;&|()<>'"`\\]+))"""
|
||||
)
|
||||
WORD = r"""(?:[^ \t\r\n;&|()`<>'"\\]|\\.|'[^']*'|"(?:[^"\\]|\\.)*")+"""
|
||||
TOKEN = re.compile(
|
||||
rf"""(?P<skip>[ \t\r]+|\#[^\n]*|(?:\d*|&)[<>]+[&|]?[ \t]*(?:{WORD})?)
|
||||
|(?P<separator>[;&|()`\n]+)
|
||||
|(?P<word>{WORD})""",
|
||||
re.S | re.X,
|
||||
)
|
||||
|
||||
ASSIGNMENT = re.compile(r"\w+=")
|
||||
SHELL_KEYWORDS = {"!", "{", "if", "then", "elif", "else", "while", "until", "do"}
|
||||
WRAPPERS = {
|
||||
"rtk",
|
||||
"proxy",
|
||||
"command",
|
||||
"env",
|
||||
"exec",
|
||||
"nohup",
|
||||
"sudo",
|
||||
"time",
|
||||
"timeout",
|
||||
"xargs",
|
||||
}
|
||||
WRAPPER_ARGUMENT = re.compile(r"-|\d+[smhd]?$")
|
||||
|
||||
SHORT_PUSH_OPTIONS = {"h": "--help", "n": "--dry-run"}
|
||||
GIT_OPTIONS_WITH_VALUE = {"-c", "--git-dir", "--work-tree", "--namespace", "--config-env"}
|
||||
REBASE_OPTIONS_WITH_VALUE = {
|
||||
"--onto",
|
||||
"-s",
|
||||
"--strategy",
|
||||
"-X",
|
||||
"--strategy-option",
|
||||
"-x",
|
||||
"--exec",
|
||||
}
|
||||
PUSH_OPTIONS_WITH_VALUE = {
|
||||
"--repo",
|
||||
"--push-option",
|
||||
"--receive-pack",
|
||||
"--exec",
|
||||
"--recurse-submodules",
|
||||
}
|
||||
|
||||
|
||||
def strip_heredocs(command):
|
||||
lines = command.split("\n")
|
||||
# A `<<` that nothing closes is text or arithmetic, not a heredoc.
|
||||
closing_lines = {line.lstrip("\t") for line in lines}
|
||||
kept, pending = [], []
|
||||
for line in lines:
|
||||
if pending:
|
||||
dash, delimiter = pending[0]
|
||||
if (line.lstrip("\t") if dash else line) == delimiter:
|
||||
pending.pop(0)
|
||||
continue
|
||||
kept.append(line)
|
||||
for dash, *quotings in HEREDOC.findall(line):
|
||||
delimiter = "".join(quotings)
|
||||
if delimiter in closing_lines:
|
||||
pending.append((dash, delimiter))
|
||||
return "\n".join(kept)
|
||||
|
||||
|
||||
def simple_commands(command):
|
||||
"""Split a command line into word lists; None when it does not parse.
|
||||
|
||||
A subshell's parentheses come out as the commands ["("] and [")"].
|
||||
"""
|
||||
command = re.sub(r"(?<!\\)\\\n", "", strip_heredocs(command))
|
||||
commands, position = [[]], 0
|
||||
while position < len(command):
|
||||
token = TOKEN.match(command, position)
|
||||
if not token:
|
||||
return None
|
||||
if token["separator"]:
|
||||
commands += [[c] for c in token["separator"] if c in "()"]
|
||||
commands.append([])
|
||||
elif token["word"]:
|
||||
commands[-1].append("".join(shlex.split(token["word"])))
|
||||
position = token.end()
|
||||
return commands
|
||||
|
||||
|
||||
def strip_prefixes(words):
|
||||
wrapped = False
|
||||
for index, word in enumerate(words):
|
||||
if word in WRAPPERS:
|
||||
wrapped = True
|
||||
elif not (
|
||||
word in SHELL_KEYWORDS
|
||||
or ASSIGNMENT.match(word)
|
||||
or (wrapped and WRAPPER_ARGUMENT.match(word))
|
||||
):
|
||||
return words[index:]
|
||||
return []
|
||||
|
||||
|
||||
def split_git_command(arguments, directory):
|
||||
"""(directory it runs in, subcommand, the subcommand's arguments)."""
|
||||
rest = iter(arguments)
|
||||
for word in rest:
|
||||
if word == "-C":
|
||||
directory = resolve(directory, next(rest, ""))
|
||||
elif word in GIT_OPTIONS_WITH_VALUE:
|
||||
next(rest, None)
|
||||
elif not word.startswith("-"):
|
||||
return directory, word, list(rest)
|
||||
return directory, "", []
|
||||
|
||||
|
||||
def resolve(directory, target):
|
||||
# Not normalised: a target such as `$X/..` must stay a path that does not
|
||||
# exist, so that the branch lookup fails and the push is allowed.
|
||||
return os.path.join(directory, os.path.expanduser(target))
|
||||
|
||||
|
||||
def changes_branch(subcommand, arguments):
|
||||
if subcommand == "branch":
|
||||
return not {"-m", "-M", "--move"}.isdisjoint(arguments)
|
||||
if subcommand == "rebase": # `git rebase <upstream> <branch>` checks out <branch>
|
||||
rest, names = iter(arguments), []
|
||||
for argument in rest:
|
||||
if argument in REBASE_OPTIONS_WITH_VALUE:
|
||||
next(rest, None)
|
||||
elif not argument.startswith("-"):
|
||||
names.append(argument)
|
||||
return len(names) > 1
|
||||
return subcommand == "switch" or (subcommand == "checkout" and "--" not in arguments)
|
||||
|
||||
|
||||
def parse_push(arguments):
|
||||
"""(long-form option names, refspecs) of a git push."""
|
||||
options, positional = set(), []
|
||||
rest = iter(arguments)
|
||||
for argument in rest:
|
||||
if argument == "--":
|
||||
positional.extend(rest)
|
||||
elif argument.startswith("--"):
|
||||
options.add(argument.split("=")[0])
|
||||
if argument in PUSH_OPTIONS_WITH_VALUE:
|
||||
next(rest, None)
|
||||
elif argument.startswith("-"):
|
||||
flags, push_option, value = argument[1:].partition("o")
|
||||
options.update(SHORT_PUSH_OPTIONS.get(f, f) for f in flags)
|
||||
if push_option and not value:
|
||||
next(rest, None)
|
||||
else:
|
||||
positional.append(argument)
|
||||
return options, positional[1:]
|
||||
|
||||
|
||||
def updates_main(arguments, on_main):
|
||||
"""Whether a push can update main. `on_main` is called only when it matters."""
|
||||
options, refspecs = parse_push(arguments)
|
||||
if options & {"--dry-run", "--help"}:
|
||||
return False
|
||||
if options & {"--all", "--branches", "--mirror"}:
|
||||
return True
|
||||
if not refspecs:
|
||||
return "--tags" not in options and on_main()
|
||||
|
||||
rest = iter(refspecs)
|
||||
for refspec in rest:
|
||||
if refspec == "tag":
|
||||
next(rest, None)
|
||||
continue
|
||||
source, colon, destination = refspec.removeprefix("+").partition(":")
|
||||
if colon and not source and not destination:
|
||||
return True
|
||||
target = destination if colon else source
|
||||
if any(fnmatch.fnmatchcase(name, target) for name in MAIN_NAMES):
|
||||
return True
|
||||
if not colon and source in ("HEAD", "@") and on_main():
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def current_branch_is_main(directory):
|
||||
head = subprocess.run(
|
||||
["git", "-C", directory, "symbolic-ref", "--quiet", "HEAD"], capture_output=True, text=True
|
||||
)
|
||||
return head.stdout.strip() == "refs/heads/main"
|
||||
|
||||
|
||||
def pushes_to_main(command, directory):
|
||||
if "git" not in command or "push" not in command:
|
||||
return False
|
||||
outer_directories = []
|
||||
branch_change = None # (directory, whether it went to main) of the latest one
|
||||
for all_words in simple_commands(command) or []:
|
||||
words = strip_prefixes(all_words)
|
||||
if not words:
|
||||
continue
|
||||
name, arguments = os.path.basename(words[0]), words[1:]
|
||||
if name == "(":
|
||||
outer_directories.append(directory)
|
||||
elif name == ")" and outer_directories:
|
||||
directory = outer_directories.pop()
|
||||
elif name in ("cd", "pushd", "popd"):
|
||||
directory = resolve(directory, words[-1])
|
||||
elif name in ("gh", "tea") and "checkout" in arguments:
|
||||
branch_change = (directory, False)
|
||||
elif name == "git":
|
||||
repo, subcommand, arguments = split_git_command(arguments, directory)
|
||||
# xargs adds refspecs, and another git dir has its own branch.
|
||||
unknown = "xargs" in all_words or any(
|
||||
w.startswith(("GIT_DIR=", "--git-dir")) for w in all_words
|
||||
)
|
||||
|
||||
def on_main():
|
||||
if unknown:
|
||||
return False
|
||||
if branch_change:
|
||||
return branch_change == (repo, True)
|
||||
return current_branch_is_main(repo)
|
||||
|
||||
if changes_branch(subcommand, arguments):
|
||||
names = [a for a in arguments if not a.startswith("-")]
|
||||
branch_change = (repo, subcommand != "branch" and names == ["main"])
|
||||
elif subcommand == "push" and updates_main(arguments, on_main):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
# apm deploys this file to Copilot and Codex too, where it must do nothing.
|
||||
if "/.claude/hooks/" not in os.path.abspath(__file__).replace("\\", "/"):
|
||||
return 0
|
||||
if os.environ.get("GIT_ALLOW_PUSH_TO_MAIN") == "1":
|
||||
return 0
|
||||
payload = json.load(sys.stdin)
|
||||
if payload["tool_name"] != "Bash":
|
||||
return 0
|
||||
if pushes_to_main(payload["tool_input"]["command"], payload["cwd"]):
|
||||
print(
|
||||
"Refused: this git push can update main. "
|
||||
"Push a feature branch by name and open a pull request instead.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return 2
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -35,9 +35,66 @@ Installing this plugin without `rtk`? Every prefixed command is a plain `git` in
|
||||
|---|---|---|
|
||||
| Skills | `.apm/skills/` | `git-commits`, `git-branches`, `git-history`, `git-remotes`, `git-submodules`, `git-workflow`, `git-worktrees`, `pc-author`, `pc-run` |
|
||||
| Agents | `.apm/agents/` | `git-orchestrate` |
|
||||
| Hooks | `.apm/hooks/` | `refuse-push-to-main.py`, see [Push-to-main hook](#push-to-main-hook) |
|
||||
|
||||
`.apm/` is the authoring source and the only thing apm deploys (ADR-0024).
|
||||
|
||||
## Push-to-main hook
|
||||
|
||||
On Claude Code, a `PreToolUse` hook refuses a Bash `git push` that can update `main`:
|
||||
|
||||
- an explicit destination: `main`, `HEAD:main`, `<branch>:main`, `refs/heads/main`, or deleting `main`
|
||||
- a bare `git push`, `HEAD` or `@` while `main` is checked out
|
||||
- a bulk push: `--all`, `--mirror`, `:`, or a wildcard refspec that covers `main`
|
||||
- any of these with `--force` or `--force-with-lease`
|
||||
|
||||
Pushes to other branches, tag pushes and `--dry-run` go through. apm also deploys the files to Copilot and Codex, where the hook does nothing.
|
||||
|
||||
### Limits
|
||||
|
||||
The hook is a guardrail against accidents. Server-side branch protection is the real control. If the hook itself fails, the push goes through. It does not see:
|
||||
|
||||
- git aliases, shell variables such as `$BRANCH`, scripts, `bash -c`, command substitution inside double quotes, or pushes made through an MCP server
|
||||
- git config that redirects a push (`push.default=upstream`, `remote.<name>.push`)
|
||||
- a push behind a wrapper option that takes a separate value, such as `sudo -u <user>` or `env -u <name>`
|
||||
- a command line the hook cannot parse, for example `$'...'` with an escaped quote
|
||||
- a bare `git push`, `HEAD` or `@` in a command that makes the branch unknown:
|
||||
- an earlier `git switch` or `git checkout` to anything but a literal `main`, `git branch -m`, `git rebase <upstream> <branch>`, `gh pr checkout` or `tea pr checkout`
|
||||
- an earlier `cd` to a path that is not literal
|
||||
- `--git-dir`, `GIT_DIR=` or `xargs` on the push itself
|
||||
|
||||
### Opt-out
|
||||
|
||||
To allow pushes to `main`, set the variable under `env` in `.claude/settings.json`, or in `.claude/settings.local.json` for yourself only:
|
||||
|
||||
```json
|
||||
{
|
||||
"env": {
|
||||
"GIT_ALLOW_PUSH_TO_MAIN": "1"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Claude Code puts `env` values into its own environment, which hooks inherit. Setting the variable inside the command (`GIT_ALLOW_PUSH_TO_MAIN=1 git push`) has no effect. After you remove the setting, restart Claude Code for the hook to refuse again.
|
||||
|
||||
### 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/git:
|
||||
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.
|
||||
|
||||
## Author
|
||||
|
||||
Defame1297
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
name: git
|
||||
version: 1.3.9
|
||||
version: 1.4.0
|
||||
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
|
||||
|
||||
@@ -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 raises this error when `.claude/settings.json` holds 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,7 +1,15 @@
|
||||
{
|
||||
"disableBundledSkills": true,
|
||||
"env": {
|
||||
"CLAUDE_CODE_DISABLE_SHIP": "1"
|
||||
},
|
||||
"skillOverrides": {
|
||||
"init": "off"
|
||||
},
|
||||
"statusLine": {
|
||||
"command": "bash ~/.claude/statusline-command.sh",
|
||||
"type": "command"
|
||||
},
|
||||
"syncClaudeAiSkills": false,
|
||||
"theme": "dark"
|
||||
}
|
||||
+259
-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,72 @@
|
||||
# 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` with the same origin URL
|
||||
# stands in for it -- apm reads only the origin remote, for org-policy
|
||||
# discovery, and the copy prints the same policy line the real root does.
|
||||
# * 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.
|
||||
# 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 +141,184 @@ 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 name rerun rc delta
|
||||
SCRATCH="$(mktemp -d "${TMPDIR:-/tmp}/apm-audit-ci.XXXXXX")" || return 1
|
||||
if ! tar -C . --exclude=./.git --exclude=./.venv -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
|
||||
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 +330,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
|
||||
|
||||
@@ -7,10 +7,14 @@
|
||||
# Individual files — copied verbatim
|
||||
DEPLOY_FILES=(
|
||||
"providers/claude-code/CLAUDE.md:.claude/CLAUDE.md"
|
||||
"providers/claude-code/settings.json:.claude/settings.json"
|
||||
"core/AGENTS.md:.agents/AGENTS.md"
|
||||
)
|
||||
|
||||
# JSON files — merged into an existing destination; this repo's values win
|
||||
DEPLOY_JSON_MERGES=(
|
||||
"providers/claude-code/settings.json:.claude/settings.json"
|
||||
)
|
||||
|
||||
# Files that also need the executable bit set
|
||||
DEPLOY_EXECUTABLES=(
|
||||
"providers/claude-code/statusline-command.sh:.claude/statusline-command.sh"
|
||||
|
||||
+8
-1
@@ -7,6 +7,13 @@ source "$REPO_ROOT/scripts/deploy-manifest.sh"
|
||||
|
||||
echo "Installing from $REPO_ROOT..."
|
||||
|
||||
# First, so an unmergeable file stops the install before anything is deployed.
|
||||
for entry in "${DEPLOY_JSON_MERGES[@]}"; do
|
||||
dest="$HOME/${entry##*:}"
|
||||
mkdir -p "$(dirname "$dest")"
|
||||
python3 "$REPO_ROOT/scripts/merge-json.py" "$REPO_ROOT/${entry%%:*}" "$dest"
|
||||
done
|
||||
|
||||
for entry in "${DEPLOY_FILES[@]}"; do
|
||||
dest="$HOME/${entry##*:}"
|
||||
mkdir -p "$(dirname "$dest")"
|
||||
@@ -47,7 +54,7 @@ fi
|
||||
|
||||
echo ""
|
||||
echo "Deployed:"
|
||||
for entry in "${DEPLOY_FILES[@]}" "${DEPLOY_EXECUTABLES[@]}"; do
|
||||
for entry in "${DEPLOY_FILES[@]}" "${DEPLOY_JSON_MERGES[@]}" "${DEPLOY_EXECUTABLES[@]}"; do
|
||||
echo " ~/${entry##*:}"
|
||||
done
|
||||
for entry in "${DEPLOY_DIRS[@]}"; do
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
"""Merge the JSON object in SRC into DEST. SRC wins; keys only DEST has are kept."""
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
|
||||
def merge(base, override):
|
||||
if not (isinstance(base, dict) and isinstance(override, dict)):
|
||||
return override
|
||||
merged = dict(base)
|
||||
for key, value in override.items():
|
||||
merged[key] = merge(base[key], value) if key in base else value
|
||||
return merged
|
||||
|
||||
|
||||
def merged_text(src_text, dest):
|
||||
with open(dest, encoding="utf-8") as f:
|
||||
existing = json.load(f)
|
||||
if not isinstance(existing, dict):
|
||||
raise ValueError("top level is not a JSON object")
|
||||
# json.load accepts NaN and Infinity, which are not valid JSON.
|
||||
before = json.dumps(existing, indent=2, ensure_ascii=False, allow_nan=False)
|
||||
after = json.dumps(merge(existing, json.loads(src_text)), indent=2, ensure_ascii=False)
|
||||
return None if after == before else after + "\n"
|
||||
|
||||
|
||||
def replace_file(dest, text):
|
||||
# Renaming a complete temporary file over dest means a failure never truncates it.
|
||||
fd, tmp = tempfile.mkstemp(dir=os.path.dirname(dest), prefix=".merge-json.")
|
||||
try:
|
||||
with os.fdopen(fd, "w", encoding="utf-8") as f:
|
||||
f.write(text)
|
||||
f.flush()
|
||||
os.fsync(f.fileno())
|
||||
if os.path.exists(dest):
|
||||
shutil.copymode(dest, tmp)
|
||||
os.replace(tmp, dest)
|
||||
except BaseException:
|
||||
os.unlink(tmp)
|
||||
raise
|
||||
|
||||
|
||||
def main():
|
||||
src, dest_arg = sys.argv[1:]
|
||||
# Renaming over a symlink would replace the link, so write to its target.
|
||||
dest = os.path.realpath(dest_arg)
|
||||
with open(src, encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
try:
|
||||
if os.path.exists(dest):
|
||||
text = merged_text(text, dest)
|
||||
if text is not None:
|
||||
replace_file(dest, text)
|
||||
except (OSError, ValueError) as error:
|
||||
sys.exit(f"ERROR: cannot merge settings into {dest_arg}, left unchanged: {error}")
|
||||
|
||||
|
||||
main()
|
||||
Executable
+273
@@ -0,0 +1,273 @@
|
||||
#!/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). 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"
|
||||
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 "--- not waived: the full-set re-run fails ---"
|
||||
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 ]]
|
||||
@@ -36,6 +36,7 @@ git -C "$TEMP_REPO" init -q
|
||||
cat > "$TEMP_REPO/scripts/deploy-manifest.sh" << 'EOF'
|
||||
# shellcheck disable=SC2034
|
||||
DEPLOY_FILES=()
|
||||
DEPLOY_JSON_MERGES=()
|
||||
DEPLOY_EXECUTABLES=()
|
||||
DEPLOY_DIRS=()
|
||||
EOF
|
||||
|
||||
Executable
+247
@@ -0,0 +1,247 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tests for plugins/git/.apm/hooks/refuse-push-to-main.py, the PreToolUse hook
|
||||
# that refuses a `git push` to `main` (#178).
|
||||
#
|
||||
# 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 fixture repos.
|
||||
set -euo pipefail
|
||||
|
||||
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY GIT_COMMON_DIR
|
||||
unset GIT_ALLOW_PUSH_TO_MAIN
|
||||
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
HOOKS_DIR="$REPO_ROOT/plugins/git/.apm/hooks"
|
||||
SRC="$HOOKS_DIR/refuse-push-to-main.py"
|
||||
PASS=0
|
||||
FAIL=0
|
||||
|
||||
pass() { PASS=$((PASS + 1)); }
|
||||
fail() { echo " FAIL: $1"; FAIL=$((FAIL + 1)); }
|
||||
|
||||
command -v python3 > /dev/null 2>&1 || { echo "python3 required"; exit 77; }
|
||||
[[ -f "$SRC" ]] || { echo "FAIL: $SRC does not exist"; exit 1; }
|
||||
|
||||
WORK="$(mktemp -d)"
|
||||
trap 'rm -rf "$WORK"' EXIT
|
||||
|
||||
for d in .claude/hooks/git/.apm/hooks .github/hooks/scripts/git/.apm/hooks \
|
||||
.codex/hooks/git/.apm/hooks elsewhere; do
|
||||
mkdir -p "$WORK/$d"
|
||||
cp "$SRC" "$WORK/$d/"
|
||||
done
|
||||
HOOK="$WORK/.claude/hooks/git/.apm/hooks/refuse-push-to-main.py"
|
||||
|
||||
git init -q -b main "$WORK/on-main"
|
||||
git init -q -b feat "$WORK/on-feat"
|
||||
|
||||
# decision <script> <cwd> <command> -> allow|refuse|error(...)
|
||||
# The payload is escaped in bash because a Python start per case doubles the run
|
||||
# time. The timeout is the one in hooks.json.
|
||||
decision() {
|
||||
local command="$3" out rc=0
|
||||
command="${command//\\/\\\\}"
|
||||
command="${command//\"/\\\"}"
|
||||
command="${command//$'\n'/\\n}"
|
||||
command="${command//$'\t'/\\t}"
|
||||
out="$(timeout 10 "$1" 2>&1 <<< "{\"tool_name\":\"Bash\",\"cwd\":\"$2\",\"tool_input\":{\"command\":\"$command\"}}")" || rc=$?
|
||||
if [[ $rc -eq 0 && -z "$out" ]]; then
|
||||
echo allow
|
||||
elif [[ $rc -eq 2 && "$out" == *main* ]]; then
|
||||
echo refuse
|
||||
else
|
||||
echo "error($rc: $out)"
|
||||
fi
|
||||
}
|
||||
|
||||
# expect <allow|refuse> <main|feat> <command>
|
||||
expect() {
|
||||
local got
|
||||
got="$(decision "$HOOK" "$WORK/on-$2" "$3")"
|
||||
if [[ "$got" == "$1" ]]; then pass; else fail "on $2: want $1, got $got: ${3:0:200}"; fi
|
||||
}
|
||||
|
||||
echo "== Refused from any branch"
|
||||
while IFS= read -r args; do
|
||||
expect refuse feat "git push $args"
|
||||
done << 'CASES'
|
||||
origin main
|
||||
origin +main
|
||||
origin heads/main
|
||||
origin refs/heads/main
|
||||
origin HEAD:main
|
||||
origin feat:main
|
||||
origin feat:refs/heads/main
|
||||
origin main --tags
|
||||
origin :main
|
||||
-d origin main
|
||||
--delete origin main
|
||||
origin --all
|
||||
origin --branches
|
||||
--mirror origin
|
||||
origin :
|
||||
origin +:
|
||||
origin refs/heads/*:refs/heads/*
|
||||
origin 'refs/heads/*:refs/heads/*'
|
||||
origin feat main
|
||||
-o ci.skip origin "main"
|
||||
CASES
|
||||
expect refuse main "git push origin main"
|
||||
|
||||
# Every prefix with an explicit destination and with a branch-dependent form.
|
||||
for prefix in "git push --force" "git push -f" "git push --force-with-lease" \
|
||||
"git push --force-with-lease=main:abc123" "rtk git push" "git -c k=v push" \
|
||||
"git -C . push" "git add . && git push"; do
|
||||
expect refuse feat "$prefix origin main"
|
||||
expect refuse feat "$prefix origin HEAD:main"
|
||||
expect refuse main "$prefix"
|
||||
expect refuse main "$prefix origin HEAD"
|
||||
expect allow feat "$prefix"
|
||||
expect allow feat "$prefix origin HEAD"
|
||||
done
|
||||
|
||||
echo "== Refused while on main, allowed on a feature branch"
|
||||
while IFS= read -r args; do
|
||||
expect refuse main "git push $args"
|
||||
expect allow feat "git push $args"
|
||||
done << 'CASES'
|
||||
|
||||
origin
|
||||
--follow-tags
|
||||
-o ci.skip origin
|
||||
--repo=origin
|
||||
origin HEAD
|
||||
origin @
|
||||
origin 2>&1 | tail -5
|
||||
CASES
|
||||
expect refuse feat "git -C $WORK/on-main push"
|
||||
expect refuse feat "git -C ../on-main push origin HEAD"
|
||||
expect allow main "git -C $WORK/on-feat push"
|
||||
|
||||
echo "== Allowed from any branch"
|
||||
while IFS= read -r cmd; do
|
||||
expect allow main "$cmd"
|
||||
done << 'CASES'
|
||||
git push origin feat
|
||||
git push -u origin feat
|
||||
git push origin main:feat
|
||||
git push origin main-fix
|
||||
git push origin feature/main
|
||||
git push --tags
|
||||
git push origin --tags
|
||||
git push origin tag v1
|
||||
git push origin tag main
|
||||
git push origin refs/tags/main
|
||||
git push --dry-run origin main
|
||||
git push --help
|
||||
git push -h
|
||||
git push -n origin main
|
||||
git push -o main origin feat
|
||||
git push origin 'refs/heads/feat/*:refs/heads/feat/*'
|
||||
git status
|
||||
git log origin main
|
||||
git commit -m "git push origin main"
|
||||
git commit -m "wip; git push origin main"
|
||||
echo git push origin main
|
||||
echo "git push origin main"
|
||||
git switch -c feat && git push -u origin HEAD
|
||||
git checkout -b feat && git push
|
||||
cd /somewhere/else && git push
|
||||
git push origin "main
|
||||
CASES
|
||||
|
||||
echo "== Earlier branch or directory changes"
|
||||
while IFS=$'\t' read -r want branch cmd; do
|
||||
expect "$want" "$branch" "${cmd//WORK/$WORK}"
|
||||
done << 'CASES'
|
||||
allow main gh pr checkout 5 && git push
|
||||
allow main tea pr checkout 5 && git push
|
||||
allow main rtk gh pr checkout 5 && git push
|
||||
allow main git branch -m feat && git push -u origin HEAD
|
||||
allow main git branch -M feat && git push -u origin HEAD
|
||||
allow main git branch --move feat && git push -u origin HEAD
|
||||
allow main git switch feat && cd sub && git push
|
||||
allow main git checkout main && git pull && git checkout -b x && git push -u origin HEAD
|
||||
refuse main git branch -a && git push
|
||||
allow feat git switch main && git pull && git rebase main feat && git push
|
||||
allow main git fetch && git rebase origin/main feat && git push --force-with-lease
|
||||
allow main git rebase --onto main old feat && git push
|
||||
refuse main git rebase origin/main && git push
|
||||
refuse main git rebase --onto origin/main old && git push
|
||||
refuse main git rebase -x true origin/main && git push
|
||||
allow feat cd WORK/on-main && git switch main && git pull; cd WORK/on-feat && git push
|
||||
allow main echo feat | xargs git push origin
|
||||
allow main echo feat | xargs -n 1 git push origin HEAD
|
||||
refuse feat git checkout main && git merge feat && git push
|
||||
refuse feat git switch main && git pull && git push origin HEAD
|
||||
refuse feat git -C WORK/on-feat switch main && git -C WORK/on-feat push
|
||||
refuse feat cd WORK/on-main && git push
|
||||
refuse feat cd ../on-main && git push origin HEAD
|
||||
refuse feat cd WORK && cd on-main && git push
|
||||
allow main cd WORK/on-feat && git push
|
||||
allow main cd "$(git rev-parse --show-toplevel)" && git push
|
||||
allow main cd $REPO/.. && git push
|
||||
allow main cd - && git push
|
||||
allow feat (cd WORK/on-main && git pull) && git push
|
||||
refuse main (cd WORK/on-feat && git pull) && git push
|
||||
allow main git --git-dir=WORK/on-feat/.git push
|
||||
allow main git --git-dir WORK/on-feat/.git push origin HEAD
|
||||
allow main GIT_DIR=WORK/on-feat/.git git push
|
||||
refuse feat git --git-dir=WORK/on-feat/.git push origin main
|
||||
CASES
|
||||
|
||||
echo "== Shell shapes"
|
||||
expect refuse feat "exec git push origin main"
|
||||
expect refuse feat "echo x | xargs git push origin main"
|
||||
expect refuse feat $'git push origin ma\\\nin'
|
||||
expect allow feat $'cat > a <<\'A\' && cat > b <<\'B\'\none\nA\ngit push origin main\nB'
|
||||
expect allow feat $'cat > a <<\'END OF\'\ngit push origin main\nEND OF'
|
||||
expect refuse feat $'git commit -m "explain <<EOF"\ngit push origin main'
|
||||
expect refuse feat $'echo $((1<<2))\ngit push origin main'
|
||||
printf -v many_heredocs 'cat <<EOF%d\n' {1..5000}
|
||||
expect allow feat "${many_heredocs}git log; echo push"
|
||||
expect refuse feat "cd /somewhere/else && git push origin main"
|
||||
expect refuse feat "git switch -c x && git push origin HEAD:main"
|
||||
expect refuse main "git checkout -- file.txt && git push"
|
||||
expect refuse feat "timeout 60 git push origin main"
|
||||
expect refuse feat "if true; then git push origin main; fi"
|
||||
expect refuse feat "(git push origin main)"
|
||||
expect refuse feat "git push origin main 2>&1 | tail -5"
|
||||
expect refuse feat $'git push \\\n origin main'
|
||||
expect refuse feat $'# don\'t forget to push\ngit push origin main'
|
||||
expect refuse feat $'git status\ngit push origin main'
|
||||
expect allow feat $'cat > notes.md <<\'EOF\'\ngit push origin main\nit\'s text\nEOF'
|
||||
expect allow feat $'cat <<-EOF\n\tgit push origin main\n\tEOF'
|
||||
expect allow feat $'git commit -m "$(cat <<\'EOF\'\nfix: x\n\ngit push origin main\nEOF\n)"'
|
||||
expect allow feat $'git commit -m "fix: x\n\ngit push origin main"'
|
||||
expect refuse feat $'cat > notes.md <<EOF\nit\'s text\nEOF\ngit push origin main'
|
||||
|
||||
echo "== Runtime: acts only from .claude/hooks/"
|
||||
for d in .github/hooks/scripts/git/.apm/hooks .codex/hooks/git/.apm/hooks elsewhere; do
|
||||
got="$(decision "$WORK/$d/refuse-push-to-main.py" "$WORK/on-main" "git push origin main")"
|
||||
if [[ "$got" == allow ]]; then pass; else fail "$d: want allow, got $got"; fi
|
||||
done
|
||||
|
||||
echo "== Opt-out: only from the hook's own environment"
|
||||
export GIT_ALLOW_PUSH_TO_MAIN=1
|
||||
expect allow main "git push origin main"
|
||||
export GIT_ALLOW_PUSH_TO_MAIN=0
|
||||
expect refuse main "git push origin main"
|
||||
unset GIT_ALLOW_PUSH_TO_MAIN
|
||||
expect refuse main "GIT_ALLOW_PUSH_TO_MAIN=1 git push origin main"
|
||||
expect refuse main "env GIT_ALLOW_PUSH_TO_MAIN=1 git push origin main"
|
||||
expect refuse main "export GIT_ALLOW_PUSH_TO_MAIN=1 && git push origin main"
|
||||
|
||||
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/refuse-push-to-main.py"
|
||||
assert "onFailure" not in hook
|
||||
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 ]]
|
||||
@@ -74,6 +74,111 @@ else
|
||||
fail "idempotent: ~/.agents/AGENTS.md corrupted after second install"
|
||||
fi
|
||||
|
||||
SETTINGS_SRC="$REPO_ROOT/providers/claude-code/settings.json"
|
||||
|
||||
if cmp -s "$SETTINGS_SRC" "$TEMP_HOME/.claude/settings.json"; then
|
||||
pass "idempotent: settings.json still identical to source after second install"
|
||||
else
|
||||
fail "idempotent: settings.json changed by second install"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "--- settings.json is merged into an existing file (ADR-0035) ---"
|
||||
|
||||
new_home() {
|
||||
local home
|
||||
home="$(mktemp -d "$TEMP_HOME/merge.XXXXXX")"
|
||||
mkdir -p "$home/.claude"
|
||||
echo "$home"
|
||||
}
|
||||
|
||||
install_into() {
|
||||
HOME="$1" bash "$REPO_ROOT/scripts/install.sh" 2>&1
|
||||
}
|
||||
|
||||
# Asserts a Python expression over the parsed JSON file, bound to `s`.
|
||||
check_json() {
|
||||
local file="$1" expr="$2" name="$3"
|
||||
if python3 -c 'import json, sys; s = json.load(open(sys.argv[1], encoding="utf-8")); sys.exit(not eval(sys.argv[2]))' "$file" "$expr" 2> /dev/null; then
|
||||
pass "$name"
|
||||
else
|
||||
fail "$name"
|
||||
fi
|
||||
}
|
||||
|
||||
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"
|
||||
|
||||
MERGE_HOME="$(new_home)"
|
||||
MERGED="$MERGE_HOME/.claude/settings.json"
|
||||
cat > "$MERGED" << 'EOF'
|
||||
{
|
||||
"model": "opus",
|
||||
"theme": "light",
|
||||
"permissions": {"allow": ["Bash(ls:*)"]},
|
||||
"env": {"MY_VAR": "kept", "CLAUDE_CODE_DISABLE_SHIP": "0"},
|
||||
"skillOverrides": {"other": "off", "init": "on"}
|
||||
}
|
||||
EOF
|
||||
chmod 640 "$MERGED"
|
||||
install_into "$MERGE_HOME" > /dev/null || fail "install over existing settings exited non-zero"
|
||||
|
||||
check_json "$MERGED" 's["model"] == "opus" and s["permissions"] == {"allow": ["Bash(ls:*)"]}' \
|
||||
"top-level settings the repo does not set are kept"
|
||||
check_json "$MERGED" 's["env"]["MY_VAR"] == "kept" and s["skillOverrides"]["other"] == "off"' \
|
||||
"nested entries the repo does not set are kept"
|
||||
check_json "$MERGED" 's["theme"] == "dark" and s["env"]["CLAUDE_CODE_DISABLE_SHIP"] == "1" and s["skillOverrides"]["init"] == "off"' \
|
||||
"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"
|
||||
|
||||
if [[ "$(find "$MERGED" -perm 640)" == "$MERGED" ]]; then
|
||||
pass "the existing file's permissions are kept"
|
||||
else
|
||||
fail "the existing file's permissions changed"
|
||||
fi
|
||||
|
||||
cp "$MERGED" "$MERGE_HOME/first-run.json"
|
||||
install_into "$MERGE_HOME" > /dev/null || fail "second install exited non-zero"
|
||||
if cmp -s "$MERGE_HOME/first-run.json" "$MERGED"; then
|
||||
pass "a second run leaves the merged settings unchanged"
|
||||
else
|
||||
fail "a second run changed the merged settings"
|
||||
fi
|
||||
|
||||
for invalid in '{"model": "opus",' '["not an object"]' '{"x": NaN}' ''; do
|
||||
BAD_HOME="$(new_home)"
|
||||
BAD="$BAD_HOME/.claude/settings.json"
|
||||
printf '%s' "$invalid" > "$BAD"
|
||||
printf '%s' "$invalid" > "$BAD_HOME/before"
|
||||
if output="$(install_into "$BAD_HOME")"; then
|
||||
fail "install accepted invalid settings: '$invalid'"
|
||||
elif [[ "$output" == *"$BAD"* && "$output" != *Traceback* ]]; then
|
||||
pass "invalid settings exit non-zero with an error naming the file: '$invalid'"
|
||||
else
|
||||
fail "invalid settings gave no clear error: '$invalid'"
|
||||
fi
|
||||
if cmp -s "$BAD_HOME/before" "$BAD"; then
|
||||
pass "invalid settings are left untouched: '$invalid'"
|
||||
else
|
||||
fail "invalid settings were changed: '$invalid'"
|
||||
fi
|
||||
done
|
||||
|
||||
LINK_HOME="$(new_home)"
|
||||
mkdir "$LINK_HOME/dotfiles"
|
||||
echo '{"model": "opus"}' > "$LINK_HOME/dotfiles/settings.json"
|
||||
ln -s ../dotfiles/settings.json "$LINK_HOME/.claude/settings.json"
|
||||
install_into "$LINK_HOME" > /dev/null || fail "install through a symlink exited non-zero"
|
||||
if [[ -L "$LINK_HOME/.claude/settings.json" ]]; then
|
||||
pass "a symlinked settings file stays a symlink"
|
||||
else
|
||||
fail "a symlinked settings file was replaced by a regular file"
|
||||
fi
|
||||
check_json "$LINK_HOME/dotfiles/settings.json" 's["model"] == "opus" and s["theme"] == "dark"' \
|
||||
"the symlink's target receives the merge"
|
||||
|
||||
echo ""
|
||||
echo "Results: $PASS passed, $FAIL failed"
|
||||
[[ $FAIL -eq 0 ]]
|
||||
Executable
+122
@@ -0,0 +1,122 @@
|
||||
#!/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)"
|
||||
|
||||
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
|
||||
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