feat(scripts): run the apm gates through the uv-pinned apm
Add scripts/lib/apm.sh, the one place the repo spells its apm command: `uv run --project <repo root> --frozen apm`. --project comes from the helper's own location, so it names the repo root even when apm runs inside plugins/<name>/. Sourcing it keeps the git-env scrub (#204), and require_apm_version fails with a clear message, naming `uv sync --frozen`, when the resolved apm is below 0.39.2, unreadable, or uv is missing. APM overrides the command, as ADR-0034 provides. apm-audit-ci.sh and apm-pack-check-clean.sh use it. The audit script's matching logic is unchanged; only its verified-against note now records 0.39.3. tests/test-apm-gate-invocation.sh is seam B: a fake uv and a stub apm first on a PATH without the real ones. It proves the command shape, --project from a plugin directory, the scrub, and the version floor. test-apm-hooks-git-env.sh reaches its stub through a fake uv, and the real-apm probe in test-apm-current-hook.sh now runs the pinned apm. Refs: #271 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014uGZTNugst7K9Bd2FTR4Mi
This commit is contained in:
1 parent
d15688ee99
commit
7291b46271
6 files changed
+345
-18
No files matched your search
+15
-8
@@ -28,7 +28,9 @@
|
||||
# and additionally litters it with an apm_modules/ tree
|
||||
#
|
||||
# So this hook waives exactly one failure: a plugin package whose ONLY failing
|
||||
# check is `lockfile-exists`. Verified against apm 0.28.0.
|
||||
# check is `lockfile-exists`. Verified against apm 0.28.0, and re-verified
|
||||
# against 0.39.3 (spike #269, on #268): both matched strings below are unchanged,
|
||||
# and no other check fails in any plugin directory.
|
||||
#
|
||||
# WHAT IS DELIBERATELY NOT WAIVED
|
||||
#
|
||||
@@ -55,12 +57,17 @@
|
||||
|
||||
set -uo pipefail
|
||||
|
||||
# Scrub git's repo-locating env before apm runs: pushed from a linked worktree,
|
||||
# the hook inherits an absolute GIT_DIR, and apm's drift replay runs `git init`
|
||||
# / `git checkout` in a temp dir with it -- flipping core.bare=true and moving
|
||||
# the worktree's HEAD (issue #204). See the helper for the full account.
|
||||
# shellcheck source=scripts/lib/clean-git-env.sh
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/lib/clean-git-env.sh"
|
||||
# apm is the repo-pinned one, run through scripts/lib/apm.sh as
|
||||
# `uv run --project <repo root> --frozen apm` (ADR-0034). Sourcing the helper
|
||||
# also scrubs git's repo-locating env before apm runs: pushed from a linked
|
||||
# worktree, the hook inherits an absolute GIT_DIR, and apm's drift replay runs
|
||||
# `git init` / `git checkout` in a temp dir with it -- flipping core.bare=true
|
||||
# and moving the worktree's HEAD (issue #204). See clean-git-env.sh for the
|
||||
# full account.
|
||||
# shellcheck source=scripts/lib/apm.sh
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/lib/apm.sh"
|
||||
|
||||
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'
|
||||
@@ -68,7 +75,7 @@ readonly SOLE_FAILURE='1 of 1 check(s) failed'
|
||||
status=0
|
||||
|
||||
for manifest_dir in . plugins/*/; do
|
||||
output="$(cd "$manifest_dir" && apm audit --ci 2>&1)"
|
||||
output="$(cd "$manifest_dir" && run_apm audit --ci 2>&1)"
|
||||
exit_code=$?
|
||||
|
||||
if [ "$exit_code" -eq 0 ]; then
|
||||
|
||||
Reference in new issue
Block a user