fix(config): resolve Python reliably, add command-safety hook, harden CI
- Resolve Python 3.11+ through shared Resolve-Python.ps1/resolve-python.sh, which probe python, python3 and py -3 and skip the Windows Store alias. Build and capability checks fail early with an actionable message; doctor reports missing Python and the skipped hooks. - Fix check-capabilities.sh comparing only the major version. - Register Validate-CommandSafety as a PreToolUse hook for Claude and Codex; shared logic in command-safety.py catches rm -rf variants, git reset --hard, git clean -f, Remove-Item -Recurse, del/rd /s /q and nested shells. - Replace duplicated placeholder chains in both builds with adapters/placeholders.tsv. - Restore shell parity: add test-capabilities.sh, rename credentials.ps1 to with-credential.ps1 and qmd-warm.sh to start-qmd-warm.sh. - CI: build once and pass generated/ as an artifact, lint Python with ruff and JavaScript modules with node --check, require SHA pins for all actions. - Add evals for all own skills and update documentation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e19aa2e27c
commit
79694fbaa2
95 files changed
+1838
-218
No files matched your search
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
# Checks that Python resolution skips a PATH entry that cannot run Python (such as the Windows
|
||||
# Store app execution alias) and that check-capabilities reports the resolved interpreter.
|
||||
set -euo pipefail
|
||||
summary=false
|
||||
[ "${1:-}" != --summary ] || summary=true
|
||||
root=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)
|
||||
stubs=$(mktemp -d)
|
||||
trap 'rm -rf -- "$stubs"' EXIT
|
||||
|
||||
# python3 imitates the Store alias: it is on PATH but only prints an install hint.
|
||||
printf '#!/bin/sh\necho "Python was not found; run without arguments to install from the Microsoft Store" >&2\nexit 9009\n' > "$stubs/python3"
|
||||
printf '#!/bin/sh\nfor arg in "$@"; do [ "$arg" != -c ] || { echo 3.12.0; exit 0; }; done\nexit 0\n' > "$stubs/python"
|
||||
chmod +x "$stubs/python3" "$stubs/python"
|
||||
|
||||
# shellcheck disable=SC2016 # Expanded by the child shell.
|
||||
resolved=$(PATH="$stubs:$PATH" bash -c '. "$1/shared/hooks/scripts/resolve-python.sh"; resolve_python && printf "%s" "$(python_display)"' _ "$root")
|
||||
[ "$resolved" = python ] || { printf 'FAIL resolver chose "%s" instead of skipping the broken python3\n' "$resolved" >&2; exit 1; }
|
||||
|
||||
output=$(PATH="$stubs:$PATH" bash "$root/scripts/commands/check-capabilities.sh" 2>&1) || true
|
||||
grep -q 'PASS Python 3.12.0' <<<"$output" || { printf 'FAIL check-capabilities did not use the resolved interpreter:\n%s\n' "$output" >&2; exit 1; }
|
||||
|
||||
if [ "$summary" = true ]; then printf 'Tests: PASS | capabilities\n'; else printf 'PASS capabilities: broken Python aliases are skipped\n'; fi
|
||||
Reference in new issue
Block a user