You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2.**Configuration generator** - CLI tool that creates AI agent guides and ESLint configs
17
+
3.**Guardrails: No-New-Debt Ratchet** — hooks + CI that block increases in analyzer categories. See [No-New-Debt Ratchet (All projects)](#no-new-debt-ratchet-all-projects)
17
18
18
19
### Generated Files
19
20
@@ -87,6 +88,7 @@ After setup, you'll have:
87
88
88
89
- Review `AGENTS.md` for coding guidelines
89
90
- Run `npx eslint .` to check your code
91
+
- Enable the No‑New‑Debt Ratchet to prevent regressions (see section below)
90
92
- Use AI assistants (they'll automatically read AGENTS.md)
91
93
92
94
## Quick Start
@@ -464,6 +466,48 @@ This tool is designed for JavaScript/Node.js projects and is currently in active
464
466
465
467
---
466
468
469
+
## No-New-Debt Ratchet (All projects)
470
+
471
+
Keep quality trending in one direction only: better. The ratchet blocks any increase in analyzer categories (complexity, architecture, domain terms, magic numbers) while allowing gradual cleanup.
472
+
473
+
Why this matters (works for greenfield and brownfield)
474
+
- New templates often ship with violations; accept the baseline once, then prevent regressions
475
+
- Rapid prototyping: iterate fast without blocking, but never get worse than the last accepted state
476
+
- AI-generated and copied code: capture current count as baseline; fix over time
477
+
478
+
How it works in this repo
479
+
- Baseline file: analysis-baseline.json
480
+
- Local hook: pre-push runs `npm run lint:json && npm run analyze:current && npm run ratchet && npm test`
481
+
- CI: .github/workflows/ci-ratchet.yml runs the same and uploads artifacts
482
+
483
+
Usage
484
+
```bash
485
+
# Create/refresh baseline from current state (intend to accept current count)
486
+
npm run lint:json && npm run analyze:baseline
487
+
488
+
# Check current branch against baseline (runs in hooks/CI)
489
+
npm run lint:json && npm run analyze:current && npm run ratchet
490
+
491
+
# After reducing violations, refresh baseline intentionally
492
+
npm run lint:json && npm run analyze:baseline
493
+
# Commit the updated baseline (recommended message):
494
+
# 'ratchet: refresh baseline after reductions'
495
+
```
496
+
497
+
Modes for different project types
498
+
- Zero-Tolerance (pure greenfield)
499
+
- Keep baseline at 0; optionally promote key rules to error in CI-only config
500
+
- Flexible Greenfield (prototype mode)
501
+
- Set baseline from current state (e.g., template/prototype); prevent increases; ratchet down as you fix
502
+
- Brownfield (existing code)
503
+
- Set baseline from current codebase; prevent increases; reduce over time; optionally use path-specific overrides for legacy areas
504
+
505
+
Adopting ratchet in other repos
506
+
- Manual setup today: copy scripts/ratchet.js, add the npm scripts shown above, wire a pre-push hook, and add a CI job similar to ci-ratchet
507
+
- Coming soon: a one-shot "guardrails setup" command to scaffold these pieces automatically (see issue #180)
508
+
509
+
---
510
+
467
511
## Developing (Self-hosting guardrails)
468
512
469
513
For contributors to this repo (self-hosting the plugin): running our rule fixers on the plugin’s own rule sources can mutate rule implementations. We added guardrails and documented a safe workflow — see docs/DEVELOPING.md.
0 commit comments