Root-cause fix (audit §12.4.1): the only pre-commit gate was _gate_webapi, which greps comment provenance / webapi ref-rate but NEVER runs tsc or vitest → 48 type errors + 20 failing tests could merge under an all-green gate (false green). - scripts/quality-gate.sh: [1] tsc --noEmit (block) [2] vitest run tests/unit (block) [3] backend smoke (advisory local / mandatory CI). No ceremony (no magic-string grep). git rev-parse for root (no hardcoded /home/ubuntu). - scripts/githooks/pre-commit (version-controlled): runs quality-gate (blocking), then _gate_webapi as advisory (never blocks). - scripts/install-hooks.sh: git config core.hooksPath scripts/githooks - README §232: gate now enforced, tsc rule 靠自觉 → 门强制 blindspot_guards.test.ts quarantined via --exclude (12 fails = registry drift, PLAN §P2.5) — loudly documented, not silently hidden. Verified: NEGATIVE test — injected a type error, gate BLOCKED the commit (exit 2); removed → tsc 0, gate passes. Gate passes its own gate. Co-Authored-By: Claude <[email protected]>
11 lines
436 B
Bash
Executable File
11 lines
436 B
Bash
Executable File
#!/bin/sh
|
|
# 激活 dacli 版本受控 git hooks (P3, 2026-07-24)
|
|
# 用法: sh scripts/install-hooks.sh
|
|
set -e
|
|
ROOT="$(git rev-parse --show-toplevel)"
|
|
cd "$ROOT"
|
|
chmod +x scripts/githooks/* scripts/quality-gate.sh 2>/dev/null || true
|
|
git config core.hooksPath scripts/githooks
|
|
echo "✅ core.hooksPath = scripts/githooks (真质量门已激活: tsc+vitest+smoke)"
|
|
echo " 验证: 故意加一个类型错误后 git commit 应被阻塞"
|