Use pre-commit hooks for fast local feedback, not as the only quality gate. Keep CI as the source of truth because developers can bypass local hooks.
Create .git/hooks/pre-commit:
#!/usr/bin/env bash
set -euo pipefail
npx debtlens scan . --staged --fail-on high --fail-on-confidence 0.8Then make it executable:
chmod +x .git/hooks/pre-commitnpm install --save-dev husky
npx husky initAdd this to .husky/pre-commit:
npx debtlens scan . --staged --fail-on high --fail-on-confidence 0.8Teams adopting DebtLens for the first time often prefer a warning-only local hook:
npx debtlens scan . --staged --min-severity medium --format terminal || truePair that with a CI job that writes a JSON report and gates only the findings your team agrees are merge-blocking.