Skip to content

Add kind field ("api" | "page" | "action" | "websocket") to EndpointInfo#5

Merged
kylejryan merged 1 commit intomainfrom
cursor/add-kind-field-4943
Apr 29, 2026
Merged

Add kind field ("api" | "page" | "action" | "websocket") to EndpointInfo#5
kylejryan merged 1 commit intomainfrom
cursor/add-kind-field-4943

Conversation

@jorgeraad
Copy link
Copy Markdown
Collaborator

EndpointInfo today exposes the wire shape of a route (method, path, handler, file, params, auth) but not its categorical role. Consumers like apex currently derive that with hand-written file-path regex, which puts framework-specific knowledge in the wrong repo.

Changes

Add a required kind field to EndpointInfo in src/types.ts, plus an optional kind? parameter to the endpoint() factory in src/utils.ts (defaulting to "api" for migration ergonomics). Existing extractors get the default — only server-actions and FastAPI websocket routes set explicit values.

Four values

Kind Meaning Set by
"api" REST / GraphQL / RPC / generic JSON HTTP routes Default for all extractors
"page" Server-rendered or client-routed page returning HTML/RSC Future: Next.js pages, Rails views, etc.
"action" RPC-style call invoked from UI (Next.js Server Actions) server-actions.ts extractor
"websocket" Persistent bidirectional channel fastapi.ts extractor (for @app.websocket)

Files changed

  • src/types.ts — Added EndpointKind type union; added required kind field to EndpointInfo
  • src/utils.ts — Added optional kind? parameter to endpoint() factory, defaulting to "api"
  • src/extractors/server-actions.ts — Set kind: "action" for server action endpoints
  • src/extractors/fastapi.ts — Set kind: "websocket" for FastAPI websocket routes
  • src/format.ts — Include kind in JSON and NDJSON output
  • src/format-impact.ts — Include kind in impact JSON and NDJSON output
  • src/index.ts — Export EndpointKind type from public API

Design

The factoring is deliberate: method carries the HTTP verb (or wire-shape distinction for WS / ACTION), kind carries the protocol/role category. Two fields, orthogonal concepts.

Foundation for the Next.js page extraction work and future page detection in Rails / Django / FastAPI / Spring view-rendering routes.

Open in Web Open in Cursor 

- 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>
@jorgeraad jorgeraad marked this pull request as ready for review April 29, 2026 18:53
@jorgeraad jorgeraad requested a review from kylejryan April 29, 2026 18:53
@kylejryan kylejryan merged commit a9288a6 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.

Add kind field ("api" | "page" | "action" | "websocket") to EndpointInfo

3 participants