Fix grep portability bug and document doc-drift script in CLAUDE.md

- Use grep -rE (ERE) instead of BRE \| alternation for BSD/macOS compat
- Add doc-drift section to CLAUDE.md Testing section with usage and purpose

Nightshift-Task: doc-drift
Nightshift-Ref: https://github.com/marcus/nightshift
This commit is contained in:
2026-03-20 02:28:19 -04:00
parent 5ca15118f8
commit 508ba06e69
2 changed files with 7 additions and 1 deletions

View File

@@ -77,6 +77,12 @@ cd client && npm run test:watch
- Export pure functions (validators, formatters, etc.) for direct testing
- Run `npm test` in both `server/` and `client/` before committing
**Doc drift check:**
```bash
node scripts/doc-drift.js
```
Scans `CLAUDE.md` and `PRD.md` for verifiable code references (file paths, API routes, component names) and cross-checks each against the filesystem and source tree. Prints a PASS/FAIL report with doc name and line number. Exits non-zero on any failure — suitable for CI gating.
## Application Structure
The default route `/` renders the paycheck-centric main view (`client/src/pages/PaycheckView.jsx`). It shows the current month's two paychecks side-by-side with bills, paid status, one-time expenses, and remaining balance. Month navigation (prev/next) fetches data via `GET /api/paychecks?year=&month=`.

View File

@@ -79,7 +79,7 @@ function apiRouteExists(routePath) {
const fragment = clean.replace(/^\/api/, '');
try {
const out = execSync(
`grep -r --include="*.js" -l "${clean}\\|${fragment}" "${path.join(ROOT, 'server/src/routes')}"`,
`grep -rE --include="*.js" -l "${clean}|${fragment}" "${path.join(ROOT, 'server/src/routes')}"`,
{ stdio: ['pipe', 'pipe', 'pipe'] }
).toString().trim();
return out.length > 0;