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
@@ -1,4 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck source=../../shared/hooks/scripts/resolve-python.sh
|
||||
. "$(dirname -- "${BASH_SOURCE[0]}")/../../shared/hooks/scripts/resolve-python.sh"
|
||||
resolve_python || true
|
||||
# Managed-file manifest: tracks every file this setup previously installed into a
|
||||
# destination so a later run can detect stale files (removed from the source) or
|
||||
# locally modified files (changed on disk since the last install) without ever
|
||||
@@ -146,7 +149,7 @@ run_managed_sync() {
|
||||
local entries entry entry_action entry_path entry_backup entry_hash entry_target
|
||||
local -a journal_lines
|
||||
# One stamp line, then one unit-separated line per file (an empty field must survive read).
|
||||
entries=$(python3 -c '
|
||||
entries=$(run_python -c '
|
||||
import json, sys
|
||||
journal = json.load(open(sys.argv[1], encoding="utf-8-sig"))
|
||||
lines = [str(journal["stamp"])]
|
||||
@@ -211,12 +214,12 @@ sys.stdout.buffer.write(("\n".join(lines) + "\n").encode("utf-8"))
|
||||
content=${content%$'\034'}
|
||||
needs_sub=false
|
||||
if { [ "$flashbang_enabled" = false ] || [ "$statusline_enabled" = false ] || [ "$semantic_retrieval_enabled" = false ]; } && [[ "$relative" = settings.json || "$relative" = config.toml ]]; then
|
||||
content=$(python3 "$(dirname -- "${BASH_SOURCE[0]}")/install-options.py" filter --path "$source_file" --flashbang "$flashbang_enabled" --statusline "$statusline_enabled" --semantic-retrieval "$semantic_retrieval_enabled" && printf '\034') || return
|
||||
content=$(run_python "$(dirname -- "${BASH_SOURCE[0]}")/install-options.py" filter --path "$source_file" --flashbang "$flashbang_enabled" --statusline "$statusline_enabled" --semantic-retrieval "$semantic_retrieval_enabled" && printf '\034') || return
|
||||
content=${content%$'\034'}
|
||||
needs_sub=true
|
||||
fi
|
||||
if [[ "$relative" = CLAUDE.md || "$relative" = AGENTS.md ]] || { [ "$semantic_retrieval_enabled" = false ] && [ "$relative" = rules/general.md ]; }; then
|
||||
content=$(python3 "$(dirname -- "${BASH_SOURCE[0]}")/install-options.py" filter-instructions --path "$source_file" --destination "$destination" --semantic-retrieval "$semantic_retrieval_enabled" && printf '\034') || return
|
||||
content=$(run_python "$(dirname -- "${BASH_SOURCE[0]}")/install-options.py" filter-instructions --path "$source_file" --destination "$destination" --semantic-retrieval "$semantic_retrieval_enabled" && printf '\034') || return
|
||||
content=${content%$'\034'}
|
||||
needs_sub=true
|
||||
fi
|
||||
@@ -234,12 +237,12 @@ sys.stdout.buffer.write(("\n".join(lines) + "\n").encode("utf-8"))
|
||||
new_hash=$(sha256_of_file "$source_file")
|
||||
fi
|
||||
if [ "$relative" = config.toml ] && [ -f "$target" ]; then
|
||||
content=$(printf '%s' "$content" | python3 "$(dirname -- "${BASH_SOURCE[0]}")/install-options.py" merge-toml --current "$target" --statusline "$statusline_enabled") || return
|
||||
content=$(printf '%s' "$content" | run_python "$(dirname -- "${BASH_SOURCE[0]}")/install-options.py" merge-toml --current "$target" --statusline "$statusline_enabled") || return
|
||||
needs_sub=true
|
||||
new_hash=$(sha256_of_string "$content")
|
||||
fi
|
||||
if [ "$relative" = settings.json ] && [ -f "$target" ]; then
|
||||
content=$(printf '%s' "$content" | python3 "$(dirname -- "${BASH_SOURCE[0]}")/install-options.py" merge-json --current "$target") || return
|
||||
content=$(printf '%s' "$content" | run_python "$(dirname -- "${BASH_SOURCE[0]}")/install-options.py" merge-json --current "$target") || return
|
||||
needs_sub=true
|
||||
new_hash=$(sha256_of_string "$content")
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user