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
15 lines
694 B
Bash
Executable File
15 lines
694 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# apm-pack-check-clean pre-push hook: `apm pack --check-versions --check-clean
|
|
# --dry-run`, run through scripts/lib/apm.sh. That helper runs the repo-pinned
|
|
# apm as `uv run --project <repo root> --frozen apm` (ADR-0034), fails clearly
|
|
# below the minimum version, and scrubs git's repo-locating env first -- see
|
|
# scripts/lib/clean-git-env.sh and issue #204, and docs/spec/gates.md,
|
|
# "apm-audit-ci", the "apm runs with git's repo-locating env scrubbed" paragraph.
|
|
set -euo pipefail
|
|
|
|
# shellcheck source=scripts/lib/apm.sh
|
|
source "$(dirname "${BASH_SOURCE[0]}")/lib/apm.sh"
|
|
|
|
require_apm_version || exit 1
|
|
exec "${APM_CMD[@]}" pack --check-versions --check-clean --dry-run
|