Conversation
- Add EndpointKind type to types.ts - Add required kind field to EndpointInfo interface - Add optional kind? parameter to endpoint() factory (defaults to 'api') - Set kind: 'action' in server-actions extractor - Set kind: 'websocket' for FastAPI websocket routes - Include kind in JSON/NDJSON output for both map and impact formatters - Export EndpointKind from public API (index.ts) Co-authored-by: Jorge Alejandro Raad <jorge@pensarai.com>
Extend the Next.js extractor to discover user-visible page routes:
App Router:
- Scan app/**/page.{tsx,jsx,ts,js} files
- Emit as { method: 'GET', handler: 'Page', kind: 'page' }
- Exclude layout files (layout, template, loading, error, not-found, default)
Pages Router:
- Scan pages/**/*.{tsx,jsx,ts,js} files
- Exclude pages/api/ (already handled as API endpoints)
- Exclude special files (_app, _document, _error, _middleware)
- Normalize /index segments (pages/about/index.tsx -> /about)
Also adds test fixture and 21 tests covering all extraction scenarios.
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Medium Risk
Changes the
EndpointInfoschema and output formats, which may affect downstream consumers expecting the old JSON shape. Next.js extraction logic now scans more files and applies new exclusions, so endpoint counts/paths may shift in existing repos.Overview
Adds a new
EndpointInfo.kindfield (defaulting toapi) and threads it through core helpers and public types/exports, with formatters (formatJson/Ndjsonand impact JSON/NDJSON) now emittingkind.Extends extractors to set
kindappropriately: FastAPI websocket routes becomekind="websocket", server actions becomekind="action", and the Next.js extractor now discovers page routes for both App Router (app/**/page.*) and Pages Router (pages/**/*) while excluding special/layout files and keeping API route extraction intact. Adds a Next.js fixture project plus comprehensive tests for page/API extraction behavior, and excludes fixtures fromtsconfig.jsoncompilation.Reviewed by Cursor Bugbot for commit 798100f. Bugbot is set up for automated code reviews on this repo. Configure here.