Skip to content

feat: stale-pattern drift checker (orphan patterns/*.md)#64

Open
advancedresearcharray wants to merge 5 commits into
theDakshJaitly:mainfrom
advancedresearcharray:feat/stale-pattern-checker-51
Open

feat: stale-pattern drift checker (orphan patterns/*.md)#64
advancedresearcharray wants to merge 5 commits into
theDakshJaitly:mainfrom
advancedresearcharray:feat/stale-pattern-checker-51

Conversation

@advancedresearcharray
Copy link
Copy Markdown
Contributor

@advancedresearcharray advancedresearcharray commented Jun 4, 2026

Summary

  • Adds checkStalePatterns drift checker: warns when patterns/*.md files (except INDEX/README) are not referenced from ROUTER.md or context/*.md
  • Parses markdown links and backtick *.md references
  • Unit tests in test/checkers.test.ts

How this differs from index-sync

  • index-sync checks the catalogpatterns/INDEX.md must list every pattern file on disk (and every INDEX entry must exist).
  • stale-pattern checks the navigation graph — pattern files must be reachable from ROUTER.md or context/*.md, regardless of INDEX coverage.
  • A pattern can pass index-sync (listed in INDEX) but still be flagged here if nothing in ROUTER/context links to it; conversely, a pattern linked from ROUTER/context but missing from INDEX is caught by index-sync, not here.

Closes #51

Test plan

  • npm run typecheck && npm test && npm run build
  • npm test -- --run test/checkers.test.ts

root and others added 2 commits June 5, 2026 10:40
Warn when patterns/*.md files are not linked from ROUTER.md or context/*.md.
Closes theDakshJaitly#51.

Co-authored-by: Cursor <cursoragent@cursor.com>
Fixes typecheck CI on stale-pattern checker PR.

Co-authored-by: Cursor <cursoragent@cursor.com>
@advancedresearcharray advancedresearcharray force-pushed the feat/stale-pattern-checker-51 branch 2 times, most recently from 06b7e58 to f34ceb5 Compare June 6, 2026 04:13
Align patternsDir fallback with index-sync, guard missing context/,
add reporter remediation, update README/CHANGELOG/CONTRIBUTING,
and add a test showing the index-sync vs stale-pattern distinction.
@advancedresearcharray advancedresearcharray force-pushed the feat/stale-pattern-checker-51 branch from f34ceb5 to ffeba4d Compare June 6, 2026 04:13
Strip HTML comments from ROUTER/context before collecting refs (matching
index-sync), add node_modules ignore to the patterns glob, and add tests
for commented-out links and project-root patterns fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
@advancedresearcharray
Copy link
Copy Markdown
Contributor Author

Pushed a small follow-up in b0f5045: strip HTML comments from ROUTER/context before collecting pattern refs (matching index-sync), add node_modules ignore on the patterns glob, and add tests for commented-out links plus project-root patterns fallback when scaffold is .mex/. Checker tests (54) pass locally. Ready for review when you have a moment.

Use the same .md-specific markdown link pattern as index-sync and add
coverage for anchor fragments and ./patterns/ relative paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a stale-pattern drift checker

1 participant