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:
Julian LechnerandClaude Opus 5.5 committed 2026-11-05 09:34:54 +01:00
1 parent e19aa2e27c
commit 79694fbaa2
95 files changed
+1838 -218

No files matched your search

+29 -6
View File
@@ -48,6 +48,10 @@ jobs:
python-version: '3.12'
- name: Compile Python sources
run: python -m compileall -q scripts shared
- name: Lint Python
run: |
python -m pip install --quiet --disable-pip-version-check ruff==0.17.1
python -m ruff check --output-format=github .
- name: Run Python tests
run: |
set -euo pipefail
@@ -107,6 +111,16 @@ jobs:
bash scripts/commands/build.sh --summary
after=$(find generated -type f -print0 | sort -z | xargs -0 sha256sum)
test "$before" = "$after"
# Later jobs test these exact packages instead of rebuilding them. A tarball keeps file modes,
# which artifact uploads would otherwise drop.
- name: Pack generated packages
run: tar -czf generated.tar.gz generated
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: generated-packages
path: generated.tar.gz
retention-days: 1
if-no-files-found: error
shell-integration:
name: Bash integration and installation guards
@@ -115,13 +129,15 @@ jobs:
needs: [build]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Build packages for integration checks
env:
REQUIRE_CODEX_SCHEMA: 'false'
run: bash scripts/commands/build.sh --summary
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: generated-packages
- name: Unpack generated packages
run: tar -xzf generated.tar.gz && rm generated.tar.gz
- name: Run integration tests
run: |
set -euo pipefail
bash scripts/tests/test-capabilities.sh --summary
bash scripts/tests/test-install-guards.sh --summary
bash scripts/tests/test-plugin-selection.sh --summary
bash scripts/tests/test-quick-update.sh --summary
@@ -149,8 +165,11 @@ jobs:
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.12'
- name: Build packages
run: bash scripts/commands/build.sh --summary
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: generated-packages
- name: Unpack generated packages
run: tar -xzf generated.tar.gz && rm generated.tar.gz
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v22.16.0
with:
node-version: '24'
@@ -184,6 +203,8 @@ jobs:
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v22.16.0
with:
node-version: '24'
- name: Check JavaScript module syntax
run: git ls-files -z '*.mjs' | xargs -0 -r -n1 node --check
# CI runs model-free tests only; real-model integration requires a suitable local machine.
- name: Install QMD test dependency
run: npm install --prefix "$QMD_PACKAGE_DIR" --ignore-scripts --no-package-lock --no-audit --no-fund yaml@2.9.0
@@ -206,6 +227,8 @@ jobs:
! grep -RInE "$unsafe_patterns" .gitea/workflows
test "$(grep -Roh 'runs-on: ubuntu-latest' .gitea/workflows | wc -l)" -ge 1
test "$(grep -Roh 'uses: actions/[^@]*@[0-9a-f]\{40\}' .gitea/workflows | wc -l)" -ge 1
# Every action, including artifact transfer, must be pinned to a full commit SHA.
! grep -RhE '^[[:space:]-]*uses:' .gitea/workflows | grep -vE 'uses:[[:space:]]*[^@[:space:]]+@[0-9a-f]{40}([[:space:]]|$)'
- name: Check for tracked secrets
run: |
set -euo pipefail