Compare commits

..
6 Commits
Author SHA1 Message Date
Defame1297 00c93ba03d Merge pull request 'fix(rtk): follow up the #284 review notes' (#287) from fix/rtk-review-polish into main
Reviewed-on: #287
2026-12-06 16:47:28 +00:00
Defame1297andClaude Opus 5.5 b66f1b838f fix(gates): carry info/exclude into the waiver's scratch re-run
The unlanded-plugin waiver re-runs `apm audit --ci` in a fresh
`git init` copy, which lacked the repo's info/exclude that
deployed-files-present consults through `git check-ignore`. Copy it from
`git rev-parse --git-path info/exclude` (the shared one in a linked
worktree) when it exists, and correct the claim that origin is the only
git state apm reads.

Leave .claude/worktrees out of the tar copy: those checkouts can carry
full .venvs, are ignored via info/exclude, and hold no lock-recorded
deployed path, so no root check could see them.

Add tests that turn red without the deletions-only diff guard (a
manifest with no trailing newline) or without the post-reduce
dep_identity guard (an rtk item split by a blank line surviving a
deletions-only reduction), plus coverage for the exclude copy and the
worktrees exclusion. Note in gates.md that a stale local origin/main
keeps the waiver alive after landing, which fails safe behind the
15-check re-run, and that `git fetch` ends it.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 16:15:44 +00:00
Defame1297andClaude Opus 5.5 7ee2066407 docs(rtk): name the commands that raise the duplicate-hook error
Verified against apm 0.39.3 (integration/hook_ownership.py and its
callers): `apm audit`, with or without --ci, reports "ambiguous duplicate
APM-owned hook entry" as a drift finding unless --no-drift is set, and
`apm export-patch` runs the same check. `apm install --frozen` reaches it
too but reports only that a managed hook entry was edited or removed.

README-only: it reaches no compiled output, so no plugin version bump
(apm-workflow references/configure.md).

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 16:15:36 +00:00
Defame1297andClaude Opus 5.5 98e8c27cdf test(rtk): cover an already-prefixed command and a missing timeout
Add a real-rtk case: a `rtk git status` payload yields no output and
exit 0, backing the README's claim that running both the plugin hook and
rtk's global hook is harmless. It skips with the other real-rtk cases
when rtk is absent.

Fail with a clear message when timeout(1) is missing instead of aborting
silently under set -e.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 16:15:28 +00:00
Defame1297 96307b2a5e Merge pull request 'chore(apm): deploy rtk 0.1.0 and its Bash routing hook' (#285) from chore/apm-deploy-rtk-0.1.0 into main
Reviewed-on: #285
2026-12-06 16:04:20 +00:00
Defame1297andClaude Opus 5.5 d16be22b2d chore(apm): deploy rtk 0.1.0 and its Bash routing hook
Refresh the lock and the deployed hook files after #284 merged, as the
session-start apm update rewrites them on main (ADR-0019). With rtk now
on origin/main, apm-audit-ci no longer needs the unlanded-plugin waiver
for it.

Refs: #179

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
2026-12-06 15:55:33 +00:00
8 changed files with 172 additions and 27 deletions

No files matched your search

+11
View File
@@ -22,6 +22,17 @@
}
],
"_apm_source": "Mortis/Holocron/plugins/git"
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"${CLAUDE_PROJECT_DIR}/.claude/hooks/rtk/.apm/hooks/route-through-rtk.sh\"",
"timeout": 10
}
],
"_apm_source": "Mortis/Holocron/plugins/rtk"
}
],
"SessionStart": [
+10
View File
@@ -21,6 +21,16 @@
"timeout": 10
}
]
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"${CLAUDE_PROJECT_DIR}/.claude/hooks/rtk/.apm/hooks/route-through-rtk.sh\"",
"timeout": 10
}
]
}
],
"SessionStart": [
+43 -13
View File
@@ -1,5 +1,5 @@
lockfile_version: '4'
generated_at: '2026-12-05T20:41:35.317702+00:00'
generated_at: '2026-12-06T15:33:54.945486+00:00'
apm_version: 0.39.3
manifest_targets:
- claude
@@ -7,7 +7,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: ansible
host: git.rkdr.net
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
version: 0.1.0
virtual_path: plugins/ansible
is_virtual: true
@@ -25,7 +25,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: bin
host: git.rkdr.net
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
version: 5.0.0
virtual_path: plugins/bin
is_virtual: true
@@ -75,7 +75,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: core
host: git.rkdr.net
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
version: 1.1.4
virtual_path: plugins/core
is_virtual: true
@@ -153,7 +153,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: delivery
host: git.rkdr.net
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
version: 0.8.1
virtual_path: plugins/delivery
is_virtual: true
@@ -272,7 +272,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: git
host: git.rkdr.net
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
version: 1.4.0
virtual_path: plugins/git
is_virtual: true
@@ -443,7 +443,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: gitea
host: git.rkdr.net
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
version: 1.3.10
virtual_path: plugins/gitea
is_virtual: true
@@ -571,7 +571,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: gitops
host: git.rkdr.net
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
version: 0.2.0
virtual_path: plugins/gitops
is_virtual: true
@@ -607,7 +607,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: k8s
host: git.rkdr.net
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
version: 0.2.0
virtual_path: plugins/k8s
is_virtual: true
@@ -639,7 +639,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: kyberforge
host: git.rkdr.net
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
version: 2.3.1
virtual_path: plugins/kyberforge
is_virtual: true
@@ -948,7 +948,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: lint
host: git.rkdr.net
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
version: 1.1.9
virtual_path: plugins/lint
is_virtual: true
@@ -994,7 +994,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: mattpocock
host: git.rkdr.net
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
version: 0.5.0
virtual_path: plugins/mattpocock
is_virtual: true
@@ -1012,7 +1012,7 @@ dependencies:
- repo_url: Mortis/Holocron
name: plan
host: git.rkdr.net
resolved_commit: 78cfbe2f324efded5d02989a2a21176d7b6df338
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
version: 0.5.0
virtual_path: plugins/plan
is_virtual: true
@@ -1071,6 +1071,27 @@ dependencies:
- path: LICENSE
source: LICENSE
hash: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
- repo_url: Mortis/Holocron
name: rtk
host: git.rkdr.net
resolved_commit: 0b04fa1e669620ca59662d3d129a682bbd1f96f0
version: 0.1.0
virtual_path: plugins/rtk
is_virtual: true
package_type: apm_package
deployed_files:
- .claude/hooks/rtk/.apm/hooks/route-through-rtk.sh
deployed_file_hashes:
.claude/hooks/rtk/.apm/hooks/route-through-rtk.sh: sha256:55f323f2349748e0d99051d5a6e592ea5c6e9b1e48ca2e8a6377885ab665f562
content_hash: sha256:0f258821b61a9d6712a65bcbeeabade2bf899c3dfd82bf695586f7b82d88eae1
package_targets:
- claude
declared_license: MIT
carried_licenses:
- path: LICENSE
source: LICENSE
hash: sha256:9d3692e6b35e0e43b81e096352f11c6b884e7004d78d3dcd92768232c6704525
exec_status: deployed
- repo_url: fluxcd/agent-skills
name: gitops-knowledge
host: github.com
@@ -1972,6 +1993,15 @@ deployments:
- git.rkdr.net/Mortis/Holocron/plugins/kyberforge
active_owner: git.rkdr.net/Mortis/Holocron/plugins/kyberforge
content_hash: sha256:30d9160d25eb712fe7a4d206d12c3779cf13725ccba2f09843713a6f3ebe9ca4
- kind: project-relative
target: claude
value: .claude/hooks/rtk/.apm/hooks/route-through-rtk.sh
runtime: null
scope: project
owners:
- git.rkdr.net/Mortis/Holocron/plugins/rtk
active_owner: git.rkdr.net/Mortis/Holocron/plugins/rtk
content_hash: sha256:55f323f2349748e0d99051d5a6e592ea5c6e9b1e48ca2e8a6377885ab665f562
- kind: project-relative
target: claude
value: .claude/skills/agent-author
+15 -6
View File
@@ -1247,22 +1247,31 @@ that `not found in lockfile` form for an identity equal to root `apm.yml`'s own
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.
`origin/main`, the follow-up PR that records it in the lock is required. Because the hook reads
only the local `origin/main` ref, a stale or unfetched one keeps the waiver alive after the plugin
has landed. That fails safe: the waiver still requires the full 15-check re-run below to pass, so
it waives only the `not found in lockfile` rows. `git fetch` refreshes the ref and ends the waiver.
**The waiver re-runs the full root check set before it passes.** The cut-short run never reaches the
other twelve root checks (`content-integrity`, `hook-approval-pins`, `local-bundle-hooks`,
`exec-status-current`, `deployed-files-present` and the rest), so the three-check result alone
would let a defect in any of them through. Once the conditions above hold, the hook copies the working
tree (minus `.git` 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
tree (minus `.git`, `.venv` and `.claude/worktrees`) into a `mktemp -d` directory with `tar`. In the
copy it drops only the `dependencies:` > `apm:` items whose `path:` names a waived plugin, checks
that the reduced `apm.yml` differs from the original by those deletions alone and that no entry for
a waived plugin survived, and runs `git init`. It gives that repo the git state apm reads: the
same `origin` URL, for org-policy discovery, and a copy of the real repo's `info/exclude` (from
`git rev-parse --git-path info/exclude`, so a linked worktree's shared one), which
`deployed-files-present` consults through `git check-ignore`. It then runs `apm audit --ci` there. The push passes only
if that run exits 0 and prints `All 15 check(s) passed`. On this branch (holocron#179, apm 0.39.3) it
does, and the hook prints `root re-run without the unlanded plugins: All 15 check(s) passed`. A copy
was chosen over swapping `apm.yml` in place under a `trap`: the copy never writes the working tree, so
the tree stays byte-identical even after `SIGKILL`, and a concurrent apm never sees a reduced
manifest. `.git` is not copied because in a linked worktree it points into the shared gitdir. `.venv`
is not copied because apm runs from the real one via `uv run --project`. The scratch directory is
is not copied because apm runs from the real one via `uv run --project`. `.claude/worktrees` is not
copied because each worktree there is a full checkout that can carry its own `.venv`. Leaving it out
hides nothing: it is ignored through `info/exclude`, and the root checks look only at lock-recorded
deployed paths, none of which is under it. The scratch directory is
removed on exit, including on `INT`, `TERM` and `HUP`. The script header records the full reasoning.
`tests/test-apm-audit-ci-waiver.sh` covers the waiver, the re-run, and each of its guards.
+1 -1
View File
@@ -77,7 +77,7 @@ This repo hand-writes its grant in the root `apm.yml` and does not run `apm appr
### "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.
`apm audit` raises this error, with or without `--ci`, unless drift checking is off with `--no-drift`. It reports it as a drift finding on `.claude/settings.json`. `apm export-patch` runs the same check. `apm install --frozen` runs it too, but reports only that an APM-managed hook entry was edited or removed. The cause is `.claude/settings.json` holding more byte-identical copies of an APM-owned hook entry than `.claude/apm-hooks.json` records. It happens when the same hook entry is pasted in by hand or merged in twice. To fix it, remove the duplicate entries from `.claude/settings.json`, keeping none of the hand-added copies, then run `apm install` again.
## Author
+29 -5
View File
@@ -116,11 +116,25 @@
# 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.
# worktree's real index. A fresh `git init` stands in for it, carrying the
# two pieces of git state apm reads: the origin remote's URL (org-policy
# discovery; the copy prints the same policy line the real root does) and
# the repo's info/exclude, copied from `git rev-parse --git-path
# info/exclude` (which resolves to the shared gitdir in a linked worktree)
# when it exists. deployed-files-present runs `git check-ignore` on each
# lock-recorded path that is absent, and an absent path ignored only
# through info/exclude must not count as missing in the copy either.
# .gitignore files travel with the tree, and core.excludesFile is the same
# user-level config for both runs.
# * NOT .venv: apm runs through `uv run --project <repo root>`, so the
# environment is the real one; .venv is no apm input and most of the size.
# * NOT .claude/worktrees: Claude Code's linked worktrees, each a full
# checkout that can carry its own .venv. They are ignored through
# info/exclude, and no root check reads them: deployed-files-present and
# content-integrity look up lock-recorded paths, none of which is under
# .claude/worktrees, and drift compares the replay's deployed files
# against the same paths in the tree. Leaving them out hides nothing the
# real audit would see.
# Only list items under `dependencies:` > `apm:` whose `path:` names a waived
# plugin are removed (comments and every other line kept), and the result is
# checked to differ from the original by deletions only, each waived entry gone.
@@ -276,9 +290,10 @@ trap 'exit 143' TERM HUP
# 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
local names="$1" origin exclude name rerun rc delta
SCRATCH="$(mktemp -d "${TMPDIR:-/tmp}/apm-audit-ci.XXXXXX")" || return 1
if ! tar -C . --exclude=./.git --exclude=./.venv -cf - . | tar -C "$SCRATCH" -xf -; then
if ! tar -C . --exclude=./.git --exclude=./.venv --exclude=./.claude/worktrees -cf - . |
tar -C "$SCRATCH" -xf -; then
echo 'apm audit --ci: ref-consistency not waived: could not copy the tree for the re-run' >&2
return 1
fi
@@ -309,6 +324,15 @@ reduced_root_audit() {
if origin="$(git remote get-url origin 2>/dev/null)"; then
git -C "$SCRATCH" remote add origin "$origin" || return 1
fi
# The real repo's ignore rules for deployed-files-present (header, "NOT
# .git"). --git-path resolves to the shared gitdir from a linked worktree.
exclude="$(git rev-parse --path-format=absolute --git-path info/exclude 2>/dev/null)" || exclude=""
if [ -n "$exclude" ] && [ -f "$exclude" ]; then
if ! mkdir -p "$SCRATCH/.git/info" || ! cp "$exclude" "$SCRATCH/.git/info/exclude"; then
echo 'apm audit --ci: ref-consistency not waived: could not copy info/exclude into the re-run copy' >&2
return 1
fi
fi
rc=0
rerun="$(cd "$SCRATCH" && run_apm audit --ci 2>&1)" || rc=$?
if [ "$rc" -ne 0 ] || ! grep -qF "$ROOT_FULL_PASS" <<<"$rerun"; then
+57 -1
View File
@@ -9,7 +9,9 @@
# 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
# (default 0). With $STUB_GIT_LOG set it also saves the copy's
# .git/info/exclude and notes whether .claude/worktrees was copied. The fixture
# is a throwaway git repo whose
# refs/remotes/origin/main is set with update-ref -- nothing is fetched.
set -euo pipefail
@@ -40,6 +42,10 @@ if [[ -f apm.lock.yaml.root-marker ]]; then
exit 1
fi
[[ -z "${STUB_RERUN_LOG:-}" ]] || cp apm.yml "$STUB_RERUN_LOG"
if [[ -n "${STUB_GIT_LOG:-}" ]]; then
cp .git/info/exclude "$STUB_GIT_LOG.exclude" 2> /dev/null || true
[[ ! -e .claude/worktrees ]] || touch "$STUB_GIT_LOG.worktrees"
fi
printf '%s\n' "${STUB_RERUN_OUTPUT-[*] All 15 check(s) passed}"
exit "${STUB_RERUN_RC:-0}"
fi
@@ -141,8 +147,58 @@ cmp -s "$TMP/apm.yml.orig" "$F/apm.yml" && [[ -z "$(git -C "$F" status --porcela
&& pass "leaves the working tree's apm.yml byte-identical" || fail "apm.yml changed"
tmp_clean && pass "removes the scratch copy" || fail "scratch left behind: $(ls -A "$TMPD")"
echo ""
echo "--- the re-run copy: carries info/exclude, leaves out .claude/worktrees ---"
F="$TMP/excl"
make_fixture "$F"
printf '%s\n' '# fixture marker' '**/.claude/worktrees/' >> "$F/.git/info/exclude"
mkdir -p "$F/.claude/worktrees/wt/.venv"
touch "$F/.claude/worktrees/wt/.venv/big"
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")" STUB_GIT_LOG="$TMP/gitlog"
[[ $RC -eq 0 ]] && pass "still waived" || fail "exited $RC: $OUT"
cmp -s "$F/.git/info/exclude" "$TMP/gitlog.exclude" \
&& pass "the copy's .git/info/exclude is the repo's" || fail "info/exclude not carried into the copy"
[[ ! -e "$TMP/gitlog.worktrees" ]] && pass ".claude/worktrees is not copied" || fail ".claude/worktrees was copied"
echo ""
echo "--- not waived: the reduction changes a line, not only deletes (deletions-only guard) ---"
F="$TMP/nonl"
make_fixture "$F"
# No trailing newline: awk prints one back, so the reduced manifest's last
# line differs from the original's, a change rather than a deletion.
printf '%s' "$(cat "$F/apm.yml")" > "$F/apm.yml.new" && mv "$F/apm.yml.new" "$F/apm.yml"
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")"
[[ $RC -ne 0 ]] && ! grep -qF "waived ref-consistency" <<< "$OUT" \
&& grep -qF "changed more than the waived entries" <<< "$OUT" \
&& pass "fails when the reduced apm.yml differs by more than deletions" || fail "must fail (rc=$RC): $OUT"
echo ""
echo "--- not waived: the reduction leaves an rtk entry in place ---"
F="$TMP/blank"
make_fixture "$F"
# A blank line inside the rtk item: dep_identity skips it and still finds the
# entry, but reduce_manifest ends the item there and keeps it whole.
sed -i '/# Routes Bash/{n;s|$|\n|}' "$F/apm.yml"
grep -qx '' "$F/apm.yml" || fail "fixture: no blank line in the rtk item"
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")"
[[ $RC -ne 0 ]] && ! grep -qF "waived ref-consistency" <<< "$OUT" \
&& pass "fails when nothing was removed" || fail "must fail (rc=$RC): $OUT"
# A second, blank-split rtk item after a normal one: the normal one is
# removed, a pure deletion, so only the post-reduce dep_identity guard sees the
# entry that survived.
F="$TMP/dup"
make_fixture "$F"
awk -v e=" - git: https://$IDENTITY.git"$'\n\n'" path: plugins/rtk" \
'/^ mcp:/ { print e } { print }' "$F/apm.yml" > "$F/apm.yml.new"
mv "$F/apm.yml.new" "$F/apm.yml"
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")"
[[ $RC -ne 0 ]] && ! grep -qF "waived ref-consistency" <<< "$OUT" \
&& grep -qF "could not remove plugins/rtk's entry" <<< "$OUT" \
&& pass "fails when an rtk entry survives a deletions-only reduction" || fail "must fail (rc=$RC): $OUT"
echo ""
echo "--- not waived: the full-set re-run fails ---"
F="$TMP/waived"
run_audit "$F" "$(root_output "$SOLE" "" "$RTK_DETAIL")" STUB_RERUN_RC=1 \
STUB_RERUN_OUTPUT="$(printf '%s\n' '| [x] | content-integrity | hidden Unicode |' '[x] 1 of 15 check(s) failed')"
[[ $RC -ne 0 ]] && ! grep -qF "waived ref-consistency" <<< "$OUT" \
+6 -1
View File
@@ -18,7 +18,8 @@ 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)"
TIMEOUT="$(command -v timeout || true)"
[[ -n "$TIMEOUT" ]] || { echo "FAIL: timeout(1) is not on PATH; install coreutils to run these tests"; exit 1; }
WORK="$(mktemp -d)"
trap 'rm -rf "$WORK"' EXIT
@@ -105,6 +106,10 @@ else
# so rtk passes it through with no output. A later rtk may add one.
run "$HOOK" "$REAL_PATH" "echo hello"
if [[ $RC -eq 0 && -z "$OUT" ]]; then pass; else fail "echo hello: want no output, got $RC: $OUT"; fi
# Backs the README's "running both hooks is harmless": rtk leaves a command
# that already starts with rtk alone, so a second hook adds nothing.
run "$HOOK" "$REAL_PATH" "rtk git status"
if [[ $RC -eq 0 && -z "$OUT" ]]; then pass; else fail "rtk git status: want no output, got $RC: $OUT"; fi
fi
echo "== hooks.json"