This directory contains GitHub Actions workflows and utility scripts for the S.M.A.R.T. project.
Automatically updates the README.md route table when route files change in pull requests.
Triggers:
- Pull requests targeting
mainbranch - When files in
routes/**/*.jsorapp.jsare modified
What it does:
- Detects route file changes in the PR
- Runs the route parser to extract all routes
- Updates README.md route table automatically
- Commits and pushes the updated README.md to the PR branch with descriptive message
- Comments on the PR to notify about the update
Note: For local commits, use the pre-commit hook which automatically appends route info to your commit message.
Commit message format:
docs: update route table
Updated routes from:
- admin
- applications
- app.js
Node.js script that dynamically parses route definitions and generates the README route table.
Features:
- Scans all route files in
routes/directory - Parses
app.jsto extract base paths - Extracts HTTP methods, paths, views, query params, and auth requirements
- Intelligently categorizes routes based on existing README structure
- Updates README.md route table section
Usage:
node .github/scripts/route-parser.jsLogs:
Check /tmp/cursor-routes.log for execution logs
What it parses:
- Route files:
router.get(),router.post(), etc. - Views:
res.render('viewname') - Base paths:
app.use('/path', router)from app.js - Query params: Dynamic params like
/:idorreq.queryusage - Auth:
validateRolemiddleware calls
- Pre-commit hook (local) - Updates README before commits
- GitHub Actions (PR) - Updates README on pull requests
- Route parser - Shared script used by both hooks
All three work together to keep route documentation in sync automatically.