Skip to content

Cursor/add kind field 4943#8

Merged
jorgeraad merged 2 commits intomainfrom
cursor/add-kind-field-4943
Apr 29, 2026
Merged

Cursor/add kind field 4943#8
jorgeraad merged 2 commits intomainfrom
cursor/add-kind-field-4943

Conversation

@jorgeraad
Copy link
Copy Markdown
Collaborator

@jorgeraad jorgeraad commented Apr 29, 2026

Note

Medium Risk
Changes the EndpointInfo schema 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.kind field (defaulting to api) and threads it through core helpers and public types/exports, with formatters (formatJson/Ndjson and impact JSON/NDJSON) now emitting kind.

Extends extractors to set kind appropriately: FastAPI websocket routes become kind="websocket", server actions become kind="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 from tsconfig.json compilation.

Reviewed by Cursor Bugbot for commit 798100f. Bugbot is set up for automated code reviews on this repo. Configure here.

cursoragent and others added 2 commits April 29, 2026 18:50
- 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>
@jorgeraad jorgeraad merged commit 5f032a2 into main Apr 29, 2026
2 checks passed
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.

2 participants