mirror of
https://github.com/bitbaum/crewless.git
synced 2026-12-04 04:17:06 +01:00
Canonical copies from the live 36-repo fleet (dotfiles/scripts/ci and the bip-kit publish reconciler), with the outage history preserved in the script headers. v0: honest extraction; v1 (installer, repo detection, outsider docs) is being built in public. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
22 lines
1.2 KiB
Bash
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
|