fix(kyberforge): target-neutral hook token and accurate hook reach docs

Switch the SessionStart hook to apm's target-neutral ${PLUGIN_ROOT} token.
Two scratch packages differing only in the token deploy byte-identical
SessionStart entries with apm 0.28.0, matching the committed
.claude/settings.json, so the deployed output does not change. The test
pin in tests/test-apm-current-hook.sh moves with it.

Correct the claim that Copilot loads no hooks from kyberforge. targets:
is package-wide, so apm also writes .github/hooks/kyberforge-hooks.json
(nested shape passed through, runtime unverified) and merges into
.codex/hooks.json when .codex/ exists. Recorded as accepted in an
ADR-0019 amendment dated 2026-09-28; README and docs/hooks.md updated.

Refs #94

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KkT7RSDwDbmrM9T34b6sTi
This commit is contained in:
2026-09-28 18:22:44 +00:00
parent 0ea3f69dc6
commit 0771fb2d37
5 changed files with 65 additions and 34 deletions

View File

@@ -124,6 +124,9 @@ A test pins the reference.
> `plugins/kyberforge/hooks/` no longer exists at all — so `${CLAUDE_PLUGIN_ROOT}/hooks/...` still
> names a path with nothing at it, now because the directory is gone rather than because a sync
> emptied it. `tests/test-apm-current-hook.sh` still pins the literal string.
>
> *Superseded in part by the 2026-09-28 amendment below: the token is now `${PLUGIN_ROOT}`. The
> `.apm/`-path conclusion is unchanged.*
**Session startup gets slower when the install is stale.** Measured: ~0.7 s for the `apm outdated`
check when everything is current, ~10.4 s when six packages are behind and the refresh runs. The
@@ -234,6 +237,30 @@ no hook at all, for the reasons already documented in `plugins/kyberforge/docs/h
> lockfile there is nothing for `apm update` to refresh, so exiting silently is the correct
> behaviour rather than a defensive measure aimed at a second installer. The Copilot CLI sentence is
> unaffected.
>
> *The Copilot CLI sentence is superseded by the 2026-09-28 amendment below.*
> **Amendment (2026-09-28) — target-neutral token; the hook reaches Copilot and Codex, accepted.**
> Two corrections from the apm 0.28.0 research pass behind `primitive-author` (issue #94;
> `plugins/kyberforge/docs/research/docs/microsoft-apm/hooks-primitive-schema.md`).
>
> *The token.* `hooks.json` now references `${PLUGIN_ROOT}/.apm/hooks/check-apm-current.sh`. apm
> documents `${PLUGIN_ROOT}` as its target-neutral token and rewrites it exactly as it rewrites
> `${CLAUDE_PLUGIN_ROOT}`: two scratch packages differing only in the token deploy byte-identical
> `SessionStart` entries, matching the one committed in `.claude/settings.json`. The `.apm/`-path
> rule above is unchanged, and `tests/test-apm-current-hook.sh` pins the new literal.
>
> *The reach.* "Copilot CLI sees no hook at all" was wrong for apm installs. `targets:` is
> package-wide, and kyberforge declares `claude`, `copilot` and `codex`, so apm also writes the hook
> to `.github/hooks/kyberforge-hooks.json` — event renamed to `sessionStart`, path rewritten,
> `version: 1` added, the nested Claude shape otherwise passed through unreshaped — and merges it
> into `.codex/hooks.json` whenever `.codex/` exists. Whether Copilot CLI executes a nested entry or
> honours `matcher` is unverified. This is **accepted**: the hook's behaviour is Claude-specific (the
> `startup` matcher, `CLAUDE_PROJECT_DIR`, the `reloadSkills` output) and the `apm.lock.yaml` guard
> keeps it inert where there is nothing to refresh. Keeping it Claude-only the apm-native way would
> need a separate package declaring `target: claude` — the seventh-plugin alternative below, still
> rejected as disproportionate — because per-file routing (`claude-hooks.json`) is deprecated and
> narrowing kyberforge's own `targets:` would drop its skills from Copilot and Codex.
**`scripts/git-hooks/` is now empty.** `post-push` and `test-post-push.sh` are deleted.
`install.sh`'s copy block is generic and is kept; `test-git-hooks-install.sh` now synthesizes its