Quality Gates
Run All Gates
./scripts/gates.sh
For faster local iteration (skips next build):
./scripts/gates.sh --quick
Gate Order
Gates run sequentially. Failure stops execution immediately.
bun run db:check— Drizzle schema ↔ migration file sync. Catches schema drift before it reaches production.bun run env:check— Verifies no rawprocess.envfallback patterns. All env access must go throughlib/env/*modules.bun run lint— ESLint.bun run test— Vitest (all unit tests intests/unit/).bun run build— Full Next.js production build. Catches type errors and import issues that lint misses.
When to Run
- Before opening any PR
- Before promotion to staging or production (the
promote-deploymentskill calls this automatically) - After any schema change to
lib/schema.ts - After adding or modifying environment variable access
- After any refactor touching multiple files
Quick Mode
Use --quick when iterating locally — it skips the build gate (which takes 30-60s). Always run the full suite before creating a PR.
If a Gate Fails
- db:check: Run
bunx drizzle-kit generateto sync migrations, then retry. - env:check: You have a raw
process.env.Xsomewhere. Move it to the appropriatelib/env/*.tsmodule. - lint: Fix reported issues.
bun run lint --fixfor auto-fixable ones. - test: Read the failure output. Fix the test or the code.
bun run test:watchfor interactive mode. - build: Usually a type error. Check the build output for the file and line.