feat(delivery): add the guard hook (ADR-0032 layer 2)

Ship one pre-tool-use hook in the delivery package. It denies the Never
tier on every runtime and asks before Odd jobs on Claude Code and Copilot
CLI (denying them on Codex and unknown runtimes):

- guard.py: stdlib-only Python; tokenises the shell line, unwraps
  bash -c / env / sudo / eval / xargs / find -exec / rtk / uv run and
  friends, checks file-tool paths for secret material, and uses read-verb
  allowlists for kubectl, helm, flux and tofu
- hooks.json: no matcher, onFailure: block, 10s timeout
- tests/test-delivery-guard-hook.sh: 281 cases incl. bypass attempts and
  per-runtime output shape
- root apm.yml: executables.allow delivery#0.1.0
- check-executables-allow-sync now covers every plugin shipping hooks/bin
- ADR-0032 amended: Copilot ask kept as an accepted risk, file tools and
  allowlists recorded

Refs #190

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012CqgnwEGtmfsjcoG9QwByN
This commit is contained in:
Defame1297andClaude Opus 5.5 committed 2026-11-23 08:15:14 +00:00
1 parent 6edd66432c
commit a6ff1c14d4
11 files changed
+2244 -110

No files matched your search

+2 -2
View File
@@ -70,8 +70,8 @@ repos:
always_run: true
- id: check-executables-allow-sync
name: Check executables allow key sync
description: Verify root apm.yml's executables.allow key names kyberforge's actual version -- apm matches that key by exact "<package>#<version>" lookup, so a version bump on one side alone silently stops deploying kyberforge's hooks/ and bin/ and lets the apm install go stale (see ADR-0019)
name: Check executables allow keys sync
description: Verify root apm.yml's executables.allow carries a "<name>#<version>" key matching the apm.yml version of every plugin that ships executables (plugins/<name>/.apm/hooks/ or bin/), reporting every out-of-sync package in one run. apm's grant is version-blind, so a stale key still deploys; this is a record-keeping gate that fails a version bump made without the matching key edit, keeping each key an accurate record of what was approved (see ADR-0019's 2026-09-19 correction and docs/spec/gates.md)
entry: bash scripts/check-executables-allow-sync.sh
language: system
stages: [pre-push]