Skip to content

chore(hooks): local pre-push gate + secret scan#24

Merged
offendingcommit merged 1 commit into
mainfrom
chore/local-prepush-gates
May 28, 2026
Merged

chore(hooks): local pre-push gate + secret scan#24
offendingcommit merged 1 commit into
mainfrom
chore/local-prepush-gates

Conversation

@offendingcommit
Copy link
Copy Markdown
Owner

Adds laptop-side gates that run before code leaves the machine — CI-agnostic, no external services:

  • .husky/pre-commit — pure-bash secret-scan.sh (credential patterns, no network) runs first, then Biome auto-fixes staged files.
  • .husky/pre-push — runs pnpm check (lint + typecheck + test) so red never reaches the remote.
  • scripts/pr-evidence.sh + pr:evidence script — drafts PR evidence locally.

Catches secrets and breakage before push rather than waiting on CI.

Credit

From @BenSheridanEdwards's fork (chore/local-prepush-gates), authorship preserved. Thanks Ben!

Verification

make check passes; secret-scan.sh exits clean; the pre-push hook ran pnpm check green on this very push.

Phase A of the quality-gate rollout — local + pre-push gates that stop
slop before it leaves the laptop. Preventative controls, per the
architect playbook.

- .husky/pre-commit — adds scripts/secret-scan.sh as the first check
  before the existing Biome format/lint. Blocks the commit when a
  likely secret is found in staged additions. Existing Biome behaviour
  is preserved.
- .husky/pre-push (new) — runs `pnpm check` (lint + typecheck + test)
  before the branch leaves the laptop. Mirrors the `check` job in
  .github/workflows/ci.yml so PR-blocking issues surface locally first.
  Bypassable for genuine emergencies with `git push --no-verify`.
- scripts/secret-scan.sh (new) — regex scan over staged additions for
  the common accidents: AWS keys, Anthropic/OpenAI/GitHub/Slack/Google/
  Stripe tokens, JWTs, PEM private key blocks, hardcoded password
  literals. Validated against synthetic leaks of each type. No external
  tool dependency — pure bash + grep, runs in <100ms typical.
- scripts/pr-evidence.sh (new) — drafts a PR_BODY.md from the diff vs
  origin/main: file lists (added/modified/deleted), commit summaries,
  and the QA checklist. Flags screenshots as REQUIRED when the diff
  touches packages/web/src/{components,routes} or packages/desktop.
  Wired as `pnpm pr:evidence` so it runs from anywhere in the
  workspace.
- .gitignore — adds PR_BODY.md so drafts don't get committed by
  accident.

Pre-commit stays fast (<2s typical). Heavy checks (typecheck, full
test run) live in pre-push.
@offendingcommit offendingcommit merged commit 62a5085 into main May 28, 2026
2 checks passed
@offendingcommit offendingcommit deleted the chore/local-prepush-gates branch May 28, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants