Add kind field ("api" | "page" | "action" | "websocket") to EndpointInfo#5
Merged
Add kind field ("api" | "page" | "action" | "websocket") to EndpointInfo#5
kind field ("api" | "page" | "action" | "websocket") to EndpointInfo#5Conversation
- 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>
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.
EndpointInfotoday 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
kindfield toEndpointInfoinsrc/types.ts, plus an optionalkind?parameter to theendpoint()factory insrc/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
"api""page""action"server-actions.tsextractor"websocket"fastapi.tsextractor (for@app.websocket)Files changed
src/types.ts— AddedEndpointKindtype union; added requiredkindfield toEndpointInfosrc/utils.ts— Added optionalkind?parameter toendpoint()factory, defaulting to"api"src/extractors/server-actions.ts— Setkind: "action"for server action endpointssrc/extractors/fastapi.ts— Setkind: "websocket"for FastAPI websocket routessrc/format.ts— Includekindin JSON and NDJSON outputsrc/format-impact.ts— Includekindin impact JSON and NDJSON outputsrc/index.ts— ExportEndpointKindtype from public APIDesign
The factoring is deliberate:
methodcarries the HTTP verb (or wire-shape distinction forWS/ACTION),kindcarries 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.