Repository navigation
Closed
Labels
CLISentry CLI and CLI documentationSentry CLI and CLI documentation
Description
The CLI rebuilds its command metadata at runtime or with generators that parse source. --help, --fields and introspection read each command's valibot output schema when the command runs, and generate-route-loaders.ts parses src/app.ts with the TypeScript compiler API to find the route tree. Review of #1826 and #1830 settled on a checked-in .ts manifest plus valibot as the only output-schema source, with generators that load both and write per-command data.
Background
- Runtime readers of
output.schema:buildFieldsFlag(--fieldsparsing and completion) andenrichDocsWithSchema(--help) insrc/lib/command.ts, and__jsonSchema→src/lib/introspect.ts. Reading all 67 schemas takes ~21 ms cold, under 1 ms per command, so the gain is mostly the build/runtime split and bundle size, not startup. generate:routeswritessrc/generated/route-loaders.tsfrom thebuildSentryRoutes({...})literal inapp.ts. perf(cli): Skip loading commands for --version and leading global flags #1826 addsgenerate-root-help.ts→root-help.jsonand passesansiColorthrough the StriclirenderHelppatch so root help can skip loading commands.- Some output schemas also validate API responses at runtime and must stay in runtime code:
ConversationListItemSchema,DashboardRevisionSchema, and the list items insideSpansResponseSchema,TransactionsResponseSchemaandLogsResponseSchema.
Proposal (from #1826 and #1830 review)
- Manifest. A checked-in
.tsfile with each route's name,brief, aliases, hidden flag, subcommands, and the module/export that implements it. It replacesgenerate:routes, and root help can be rendered by Stricli from a stub tree built from it, which dropsroot-help.jsonand theansiColorpatch change from perf(cli): Skip loading commands for --version and leading global flags #1826. - Build-only output schemas. CLI-only output schemas move into build-only modules keyed by manifest entry. Commands import only their types (
import type+InferOutput, as in ref(cli): Derive command output types from their output schemas #1830); a lint rule blocks value imports from runtime code. - Generated per-command data. Generators load (not parse) the manifest and schemas through
tsxand write per-command field data (names, descriptions, paths) that--fields,--help, completion and introspection read at runtime.
Out of scope: JSON Schema as an authoring format (data-only artifacts can be emitted from valibot when needed), and moving flags/positionals out of buildCommand.
Related: #1824, #1830, #1826, #1852, #1853.
via @BYK.
--
Metadata
Metadata
Assignees
Labels
CLISentry CLI and CLI documentationSentry CLI and CLI documentation
Activity
linear-code commentedon Nov 3, 2026
MCP-1183
perf(cli): Skip loading commands for --version and leading global fla…
ref(cli): Load top-level routes from a checked-in command manifest (#…
sentry-junior commentedon Nov 3, 2026
Note for parts 2–3: #1919 (open, stacked on #1916) adds a third generated per-command artifact,
packages/mcp-core/src/command-catalog.json, for the MCP command surface (#1890). It holds each command's JSON Schema for flags and positionals, permission, exposure, examples,outputFieldsand API operations. Today it getsoutputFieldsfromintrospect.ts, which reads each command's valibot schema when the generator runs. When part 3 writes per-command field data, the catalog generator should read that data so there's one source.command-api.jsonandcommand-api-access.json(#1916) could come from the same pass.docs(cli): Say MCP servers read the generated catalog
ref(cli): Write top-level briefs once and generate root help data (#1921
ref(cli): Read output fields from generated data, not schemas (getsen…
build(cli): Run generators in one process (#1939)