Add automatic documentation synchronization system

Implements Option C (Hybrid) solution to prevent outdated documentation:

New Features:
- Pre-commit git hook that validates documentation before every commit
- npm run docs:check - Validates README against current project state
- npm run docs:sync - Automatically updates NPM Scripts section in README

What gets checked:
- NPM Scripts in package.json vs README
- API routes in app/api/* vs README
- App structure (directories in app/) vs README
- Components vs README
- Scripts vs README

Workflow:
1. Make code changes
2. git commit triggers pre-commit hook
3. Hook warns if documentation is outdated
4. Run docs:sync to auto-update or edit manually
5. Commit with updated README

Benefits:
- No more forgetting to update README
- Non-blocking (can use --no-verify if needed)
- Automatic NPM scripts synchronization
- Clear warnings show exactly what needs updating

Scripts added:
- scripts/check-docs.js - Validation script
- scripts/sync-docs.js - Synchronization script
- .git/hooks/pre-commit - Git hook (not tracked)

Documentation:
- Added complete workflow section in README
- Examples and usage tips included

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-04 12:27:52 +00:00
parent 4fcc5b989f
commit 17aaf130a8
4 changed files with 458 additions and 0 deletions

View File

@@ -19,6 +19,8 @@
"test:geofence": "node scripts/test-geofence.js",
"test:geofence:email": "node scripts/test-geofence-notification.js",
"test:geofence:mqtt": "node scripts/test-mqtt-geofence.js",
"docs:check": "node scripts/check-docs.js",
"docs:sync": "node scripts/sync-docs.js",
"email:dev": "email dev"
},
"keywords": [],