Files
fleet/templates/ci/pre-commit
Mao NakamotoandClaude Opus 5 f1d5549a36 feat: the fleet's central automation, moved out of dotfiles
The audits, the golden CI templates, the shared-package registry and the
reusable auto-merge sweep now live in a repo whose only job is gating the
fleet. dotfiles goes back to being the environment — a repo holding a .bashrc
is the wrong place for machinery that 16 repos call as a reusable workflow,
and keeping them together made every fleet change look like an environment
change and vice versa (three sessions and the owner collided there in one
week).

Layout is unchanged (SHARED.md, scripts/{ci,fleet,audit}, templates/ci,
.github/workflows), so every script's relative paths still hold. The
reusable sweep now checks out bitbaum/fleet; dotfiles keeps a forwarding
shim so its 16 existing callers keep working unchanged.

All six test suites pass in the new location: shared-inventory 7,
verify-predicates 29, auto-merge-sweep 17, stranded-work 24, worktree-gc 9,
model-pin-audit 102.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZCNYHwjEeqxNpYCUk6Yna
2026-08-28 10:10:21 +02:00

22 lines
1.2 KiB
Bash

#!/usr/bin/env sh
# GOLDEN PRE-COMMIT — the local half of the floor. See templates/ci/README.md.
# CI protects the shared branch; this catches the same classes one step earlier
# so you don't burn a CI round-trip on a typo. Bypassable with --no-verify, so it
# is a convenience, NOT the guarantee — CI is the guarantee.
#
# Install into a repo: copy to .husky/pre-commit (repo must have husky), or wire
# via `git config core.hooksPath`. Requires lint-staged for the staged-file pass.
# 1) Committed-secret guard (lifted from botsmann — propagate everywhere).
STAGED=$(git diff --cached --name-only --diff-filter=ACM 2>/dev/null | grep -v '\.env' | grep -v 'node_modules' || true)
if [ -n "$STAGED" ]; then
if echo "$STAGED" | xargs -r rg -l \
"(SUPABASE_SERVICE_ROLE_KEY=\"eyJ[A-Za-z0-9_-]{50,}\"|NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ[A-Za-z0-9_-]{50,}|GROQ_API_KEY=gsk_[A-Za-z0-9]{30,}|VERCEL_OIDC_TOKEN=eyJ[A-Za-z0-9_-]{100,}|SUPABASE_ACCESS_TOKEN=sbp_[A-Za-z0-9]{30,}|-----BEGIN [A-Z ]*PRIVATE KEY-----)" 2>/dev/null; then
echo "[SECURITY] Potential secret in staged files. Commit aborted (override: --no-verify)." >&2
exit 1
fi
fi
# 2) Lint + typecheck the staged change.
npx lint-staged