@nifrajs/cli 5.6.0 → 5.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/CHANGELOG.md +175 -0
  2. package/dist/check-diagnostics.d.ts.map +1 -1
  3. package/dist/check-diagnostics.js +4 -0
  4. package/dist/check-diagnostics.js.map +1 -1
  5. package/dist/check-scan.d.ts +6 -0
  6. package/dist/check-scan.d.ts.map +1 -1
  7. package/dist/check-scan.js +1 -30
  8. package/dist/check-scan.js.map +1 -1
  9. package/dist/check.d.ts.map +1 -1
  10. package/dist/check.js +35 -12
  11. package/dist/check.js.map +1 -1
  12. package/dist/cli.d.ts +4 -0
  13. package/dist/cli.d.ts.map +1 -1
  14. package/dist/cli.js +53 -5
  15. package/dist/cli.js.map +1 -1
  16. package/dist/command-catalog.d.ts +5 -0
  17. package/dist/command-catalog.d.ts.map +1 -1
  18. package/dist/command-catalog.js +18 -6
  19. package/dist/command-catalog.js.map +1 -1
  20. package/dist/contracts.d.ts +42 -4
  21. package/dist/contracts.d.ts.map +1 -1
  22. package/dist/contracts.js +288 -9
  23. package/dist/contracts.js.map +1 -1
  24. package/dist/doctor.d.ts +6 -4
  25. package/dist/doctor.d.ts.map +1 -1
  26. package/dist/doctor.js +20 -6
  27. package/dist/doctor.js.map +1 -1
  28. package/dist/internal/git-ignored.d.ts +12 -0
  29. package/dist/internal/git-ignored.d.ts.map +1 -0
  30. package/dist/internal/git-ignored.js +49 -0
  31. package/dist/internal/git-ignored.js.map +1 -0
  32. package/dist/internal/source-facts.d.ts +29 -0
  33. package/dist/internal/source-facts.d.ts.map +1 -1
  34. package/dist/internal/source-facts.js +160 -0
  35. package/dist/internal/source-facts.js.map +1 -1
  36. package/dist/load.d.ts +4 -1
  37. package/dist/load.d.ts.map +1 -1
  38. package/dist/load.js +10 -0
  39. package/dist/load.js.map +1 -1
  40. package/dist/local-cli.d.ts +15 -0
  41. package/dist/local-cli.d.ts.map +1 -0
  42. package/dist/local-cli.js +74 -0
  43. package/dist/local-cli.js.map +1 -0
  44. package/dist/lock-links.d.ts +0 -7
  45. package/dist/lock-links.d.ts.map +1 -1
  46. package/dist/lock-links.js +5 -44
  47. package/dist/lock-links.js.map +1 -1
  48. package/dist/mcp-delegate.d.ts +13 -5
  49. package/dist/mcp-delegate.d.ts.map +1 -1
  50. package/dist/mcp-delegate.js +24 -8
  51. package/dist/mcp-delegate.js.map +1 -1
  52. package/dist/mcp-http.js +1 -1
  53. package/dist/openapi-types.d.ts.map +1 -1
  54. package/dist/openapi-types.js +45 -2
  55. package/dist/openapi-types.js.map +1 -1
  56. package/dist/recipes/5.7.0.d.ts +12 -0
  57. package/dist/recipes/5.7.0.d.ts.map +1 -0
  58. package/dist/recipes/5.7.0.js +70 -0
  59. package/dist/recipes/5.7.0.js.map +1 -0
  60. package/dist/recipes/5.8.0.d.ts +9 -0
  61. package/dist/recipes/5.8.0.d.ts.map +1 -0
  62. package/dist/recipes/5.8.0.js +20 -0
  63. package/dist/recipes/5.8.0.js.map +1 -0
  64. package/dist/recipes/index.d.ts +13 -0
  65. package/dist/recipes/index.d.ts.map +1 -1
  66. package/dist/recipes/index.js +4 -0
  67. package/dist/recipes/index.js.map +1 -1
  68. package/dist/review.d.ts.map +1 -1
  69. package/dist/review.js +2 -0
  70. package/dist/review.js.map +1 -1
  71. package/dist/rules/codes.d.ts +2 -0
  72. package/dist/rules/codes.d.ts.map +1 -1
  73. package/dist/rules/codes.js +2 -0
  74. package/dist/rules/codes.js.map +1 -1
  75. package/dist/rules/explanations.d.ts.map +1 -1
  76. package/dist/rules/explanations.js +13 -3
  77. package/dist/rules/explanations.js.map +1 -1
  78. package/dist/rules/legacy.js +1 -1
  79. package/dist/rules/legacy.js.map +1 -1
  80. package/dist/rules/text-slot-boolean.d.ts +8 -0
  81. package/dist/rules/text-slot-boolean.d.ts.map +1 -0
  82. package/dist/rules/text-slot-boolean.js +57 -0
  83. package/dist/rules/text-slot-boolean.js.map +1 -0
  84. package/dist/rules/undeclared-response.d.ts +9 -0
  85. package/dist/rules/undeclared-response.d.ts.map +1 -0
  86. package/dist/rules/undeclared-response.js +93 -0
  87. package/dist/rules/undeclared-response.js.map +1 -0
  88. package/dist/upgrade.d.ts +34 -8
  89. package/dist/upgrade.d.ts.map +1 -1
  90. package/dist/upgrade.js +197 -25
  91. package/dist/upgrade.js.map +1 -1
  92. package/dist/version-drift.js +1 -1
  93. package/dist/version-drift.js.map +1 -1
  94. package/dist/web-app-options.d.ts +1 -1
  95. package/dist/web-app-options.d.ts.map +1 -1
  96. package/dist/web-app-options.js.map +1 -1
  97. package/docs/examples.json +7 -1
  98. package/docs/llms-full.txt +441 -105
  99. package/docs/types.json +164 -43
  100. package/package.json +11 -11
  101. package/src/check-diagnostics.ts +4 -0
  102. package/src/check-scan.ts +1 -29
  103. package/src/check.ts +32 -10
  104. package/src/cli.ts +58 -5
  105. package/src/command-catalog.ts +23 -6
  106. package/src/contracts.ts +348 -14
  107. package/src/doctor.ts +28 -12
  108. package/src/internal/git-ignored.ts +47 -0
  109. package/src/internal/source-facts.ts +198 -0
  110. package/src/load.ts +16 -0
  111. package/src/local-cli.ts +83 -0
  112. package/src/lock-links.ts +5 -43
  113. package/src/mcp-delegate.ts +30 -9
  114. package/src/mcp-http.ts +1 -1
  115. package/src/openapi-types.ts +43 -2
  116. package/src/recipes/5.7.0.ts +72 -0
  117. package/src/recipes/5.8.0.ts +21 -0
  118. package/src/recipes/index.ts +18 -0
  119. package/src/review.ts +2 -0
  120. package/src/rules/codes.ts +2 -0
  121. package/src/rules/explanations.ts +13 -3
  122. package/src/rules/legacy.ts +1 -1
  123. package/src/rules/text-slot-boolean.ts +56 -0
  124. package/src/rules/undeclared-response.ts +92 -0
  125. package/src/upgrade.ts +229 -33
  126. package/src/version-drift.ts +1 -1
  127. package/src/web-app-options.ts +1 -0
@@ -0,0 +1,21 @@
1
+ import type { UpgradeRecipe } from "./index.ts"
2
+
3
+ /**
4
+ * Upgrade recipe for Nifra 5.8.
5
+ *
6
+ * No import or dependency moves. On Bun, refusing a Host that Node and Deno refuse becomes the
7
+ * `validateHost` server option; the note says what an app on Bun sees differently.
8
+ */
9
+ export const recipe: UpgradeRecipe = {
10
+ version: "5.8.0",
11
+ pins: [
12
+ { match: "@nifrajs/", to: "5.8.0" },
13
+ { match: "create-nifra", to: "5.8.0" },
14
+ { match: "nifra", to: "5.8.0" },
15
+ ],
16
+ importMoves: [],
17
+ affects: ["@nifrajs/core"],
18
+ notes: [
19
+ "On Bun, a request whose Host Node and Deno refuse is served unless the app sets `server({ validateHost: true })`, where it was answered `400 invalid_host`: one sent twice, one no URL can be built on (a space, a byte past ASCII, a port past 65535, an IPv6 literal no parser takes), or a percent-encoded or sub-delimiter one. With the option such a request is refused as before, and an empty Host is refused from the first request a process serves. The check reads the Host on every request, about 6% of a bare route on Bun, so it is off by default. A target with `.` or `..` segments is still checked without it, and Node and Deno refuse these Hosts either way.",
20
+ ],
21
+ }
@@ -18,6 +18,8 @@ import { recipe as v5_3_0 } from "./5.3.0.ts"
18
18
  import { recipe as v5_4_0 } from "./5.4.0.ts"
19
19
  import { recipe as v5_5_0 } from "./5.5.0.ts"
20
20
  import { recipe as v5_6_0 } from "./5.6.0.ts"
21
+ import { recipe as v5_7_0 } from "./5.7.0.ts"
22
+ import { recipe as v5_8_0 } from "./5.8.0.ts"
21
23
 
22
24
  /** A pin rule: every dependency whose name starts with `match` is set to version `to`. */
23
25
  export interface PinRule {
@@ -34,6 +36,19 @@ export interface DependencyMove {
34
36
  readonly toVersion: string
35
37
  }
36
38
 
39
+ /**
40
+ * A package an import needs that a project may only have had through another package. When a source
41
+ * file imports one of `imports`, or a subpath of one, and the nearest package.json lists `add` in no
42
+ * dependency field, the upgrade adds it at the target version beside the imported package, or beside
43
+ * one of `beside` when the imported package is not listed there.
44
+ */
45
+ export interface DependencyAdd {
46
+ /** Import specifiers, matched after the release's import moves. */
47
+ readonly imports: readonly string[]
48
+ readonly add: string
49
+ readonly beside?: readonly string[]
50
+ }
51
+
37
52
  /** An exact import-specifier rewrite (string-level, not AST): `from` → `to`. */
38
53
  export interface ImportMove {
39
54
  readonly from: string
@@ -52,6 +67,7 @@ export interface UpgradeRecipe {
52
67
  readonly pins: readonly PinRule[]
53
68
  readonly dependencyMoves?: readonly DependencyMove[]
54
69
  readonly importMoves: readonly ImportMove[]
70
+ readonly dependencyAdds?: readonly DependencyAdd[]
55
71
  readonly retiredMarkers?: readonly RetiredMarker[]
56
72
  /** Human notes printed after the plan - e.g. structural changes the runner deliberately can't do. */
57
73
  readonly notes?: readonly string[]
@@ -76,6 +92,8 @@ const RECIPES: Record<string, UpgradeRecipe> = {
76
92
  [v5_4_0.version]: v5_4_0,
77
93
  [v5_5_0.version]: v5_5_0,
78
94
  [v5_6_0.version]: v5_6_0,
95
+ [v5_7_0.version]: v5_7_0,
96
+ [v5_8_0.version]: v5_8_0,
79
97
  }
80
98
 
81
99
  export function getRecipe(version: string): UpgradeRecipe | undefined {
package/src/review.ts CHANGED
@@ -162,6 +162,8 @@ export const CHECK_CODES: Readonly<Record<string, ReviewCheckId>> = {
162
162
  "NF-C043": "security",
163
163
  "NF-C044": "route-boundary",
164
164
  "NF-C045": "typed-client",
165
+ "NF-C054": "typed-client",
166
+ "NF-C055": "route-boundary",
165
167
  "NF-C046": "dependency",
166
168
  "NF-D001": "dependency",
167
169
  "NF-D002": "dependency",
@@ -52,6 +52,8 @@ export const RULE_CODES = Object.freeze({
52
52
  "NF-C051": "Slot content is not its slot() alone",
53
53
  "NF-C052": "Swap URL's page renders no such slot",
54
54
  "NF-C053": "Partially prerendered page reads the request",
55
+ "NF-C054": "Route without a response schema in a published document",
56
+ "NF-C055": "zod coerce.boolean() reads request text",
55
57
  "NF-D001": "Doctor check",
56
58
  "NF-D002": "Mixed nifra versions",
57
59
  "NF-D003": "Stale file: dependencies in bun.lock",
@@ -46,7 +46,7 @@ export const RULE_EXPLANATIONS: Readonly<Record<BuiltInCode, RuleExplanation>> =
46
46
  },
47
47
  "NF-C007": {
48
48
  why: "A route handler returns a raw Response, so the typed client infers `data: never` and drift detection is lost for that route.",
49
- fix: "Return a plain object (set status, headers and cookies on c.set), use app.sse() for a stream, or declare `{ response: t.... }`; mark an intended file or redirect with `// nifra-expect NF-C007: <reason>`.",
49
+ fix: "Return a plain object (set status, headers and cookies on c.set), use app.sse() for a stream, `bytes()` from @nifrajs/core/binary for a file or other binary body, or `raw<T>(response)` from the same module for a hand-built JSON Response; or declare `{ response: t.... }`. Mark an intended redirect with `// nifra-expect NF-C007: <reason>`.",
50
50
  docs: "/docs/api",
51
51
  },
52
52
  "NF-C008": {
@@ -279,6 +279,16 @@ export const RULE_EXPLANATIONS: Readonly<Record<BuiltInCode, RuleExplanation>> =
279
279
  command: "nifra fix --code NF-C053",
280
280
  docs: "/docs/partial-prerendering",
281
281
  },
282
+ "NF-C054": {
283
+ why: "The project builds an OpenAPI document from its running routes (openapi(), buildOpenApiDocument or toOpenAPI), and a route declares no response schema. The document can only say it answers 200, so a client generated from it, in any language, has no type for the body. nifra's typed client is unaffected: it reads the handler's TypeScript type.",
284
+ fix: "Declare `{ response: ... }` on the route, or build the document with `nifra openapi`, which reads each handler's return type. A route kept out on purpose takes `// nifra-expect NF-C054: <reason>` above the registration.",
285
+ docs: "/docs/api",
286
+ },
287
+ "NF-C055": {
288
+ why: "zod's `z.coerce.boolean()` is `Boolean(value)`. A query, header or cookie value always arrives as text, so every non-empty value reads as true: `?archived=false` and `?archived=0` both do.",
289
+ fix: "Use `z.stringbool()`, which reads `true`/`1`/`yes`/`on` as true, `false`/`0`/`no`/`off` as false, and refuses other text. A use kept on purpose takes `// nifra-expect NF-C055: <reason>` above the call.",
290
+ docs: "/docs/api",
291
+ },
282
292
  "NF-D001": {
283
293
  why: "The doctor gate of `nifra assure` found an undeclared import or a package installed more than once.",
284
294
  fix: "Run `nifra doctor` for the details and the fix of each finding.",
@@ -291,8 +301,8 @@ export const RULE_EXPLANATIONS: Readonly<Record<BuiltInCode, RuleExplanation>> =
291
301
  docs: "/docs/troubleshooting#mixed-versions",
292
302
  },
293
303
  "NF-D003": {
294
- why: "bun.lock records dependencies a file: package no longer declares. Bun never reads that package.json again, so it installs the recorded versions beside the declared ones.",
295
- fix: "Run `bun update <package>` for each package the finding names; `nifra upgrade --write` drops the entries before the next install.",
304
+ why: "bun.lock records dependencies a file: package no longer declares. Bun 1.4.2 never reads that package.json again, so it installs the recorded versions beside the declared ones.",
305
+ fix: "Run `bun update <package>` for each package the finding names: it refreshes those entries and keeps every other pin. Deleting an entry by hand makes the next install re-resolve the whole lock.",
296
306
  docs: "/docs/troubleshooting#stale-file-links",
297
307
  },
298
308
  "NF-A001": {
@@ -104,7 +104,7 @@ const STREAM_HINT =
104
104
  const SERVER_IMPORT_HINT =
105
105
  "server-only code in browser code (a route's frontend half, frontend/ or shared/) - reach it from the route's backend half (x.backend.ts) or a *.fn.ts server function; a dynamic import() is bundled too"
106
106
  const RESPONSE_ROUTE_HINT =
107
- "route handler returns a raw Response - the typed client infers `data: never`, so drift detection is lost for this route. Return a plain object (it's serialized for you); for a stream use a typed SSE route (`app.sse(...)`), which keeps typed events; or, if a raw Response is intended (file/redirect), add `{ response: t.… }` or a `// nifra-expect NF-C007: <reason>` comment to mark it and silence this"
107
+ "route handler returns a raw Response - the typed client infers `data: never`, so drift detection is lost for this route. Return a plain object (it's serialized for you); for a stream use a typed SSE route (`app.sse(...)`), which keeps typed events; for a file or other binary body return `bytes(body, { type, filename })` from @nifrajs/core/binary (the client reads it as a Blob); for a Response you must build yourself, wrap it as `raw<T>(response)` from the same module to keep `data` typed. For a redirect, add `{ response: t.… }` or a `// nifra-expect NF-C007: <reason>` comment to mark it and silence this"
108
108
  const PIPELINE_DOC_HINT =
109
109
  "nifra runs one bundler per phase - `vitePlugins` feed Vite, `clientPlugins`/`serverPlugins` feed Bun, and the file `nifra build` imports the adapter from is bundled into the server. See the Gotchas section of the Dev & HMR guide."
110
110
  const UNDECLARED_DEP_HINT =
@@ -0,0 +1,56 @@
1
+ import { type Diagnostic, diagnostic } from "../diagnostics.ts"
2
+ import { createSourceFacts } from "../internal/source-facts.ts"
3
+ import { commentBlockExpectation } from "./comment-markers.ts"
4
+ import type { CheckRule } from "./index.ts"
5
+ import { loadRuleTypeScript } from "./typescript.ts"
6
+
7
+ const TEXT_SLOT_BOOLEAN_EXPECTATION = ["NF-C055", "text-slot-boolean"]
8
+ const ZOD_IMPORT = /from\s+["']zod(?:\/v4)?(?:\/mini)?["']/
9
+ const VALUE_IN = { query: "query", headers: "header", cookies: "cookie" } as const
10
+
11
+ /**
12
+ * NF-C055: a zod `z.coerce.boolean()` in a route's `query`, `headers` or `cookies` schema. It is
13
+ * `Boolean(value)`, and those values always arrive as text, so every non-empty value reads as `true`:
14
+ * `?archived=false` and `?archived=0` both do. `z.stringbool()` reads the words a request sends.
15
+ */
16
+ export const textSlotBooleanRule: CheckRule = {
17
+ code: "NF-C055",
18
+ title: "zod coerce.boolean() reads request text",
19
+ async scan(ctx) {
20
+ const loaded = await loadRuleTypeScript(ctx)
21
+ if (loaded.diagnostics !== undefined) return loaded.diagnostics
22
+ const ts = loaded.compiler
23
+ if (ts === undefined) return []
24
+ const facts = createSourceFacts(ts)
25
+ const findings: Diagnostic[] = []
26
+ for (const file of ctx.project.source.files) {
27
+ if (!/\.[cm]?tsx?$/.test(file)) continue
28
+ const text = ctx.project.source.read(file)
29
+ if (text === undefined || !text.includes("coerce") || !ZOD_IMPORT.test(text)) continue
30
+ const tree = facts.parse(file, text)
31
+ if (tree === undefined) continue
32
+ const lines = text.split("\n")
33
+ for (const found of facts.textSlotBooleanCoercions(tree)) {
34
+ const line = tree.getLineAndCharacterOfPosition(found.position).line + 1
35
+ if (commentBlockExpectation(lines, line, TEXT_SLOT_BOOLEAN_EXPECTATION) !== undefined)
36
+ continue
37
+ findings.push(
38
+ diagnostic({
39
+ code: "NF-C055",
40
+ severity: "warn",
41
+ file,
42
+ line,
43
+ message: `\`coerce.boolean()\` in the \`${found.slot}\` schema of ${found.method} ${found.path} reads every non-empty value as true, "false" and "0" included: a ${VALUE_IN[found.slot]} value is always text. Use \`z.stringbool()\`, which reads "false", "0", "no" and "off" as false and refuses text it does not know.`,
44
+ evidence: [
45
+ "zod's coerce.boolean() is Boolean(value): any non-empty string is true",
46
+ `${found.slot} values arrive as text, so "false" never reaches the schema as false`,
47
+ "a use kept on purpose: `// nifra-expect NF-C055: <reason>` above the call",
48
+ ],
49
+ verify: "nifra check",
50
+ }),
51
+ )
52
+ }
53
+ }
54
+ return findings
55
+ },
56
+ }
@@ -0,0 +1,92 @@
1
+ import type * as TSApi from "typescript"
2
+ import { type Diagnostic, diagnostic } from "../diagnostics.ts"
3
+ import { createSourceFacts } from "../internal/source-facts.ts"
4
+ import type { TypeScriptApi } from "../internal/typescript-import.ts"
5
+ import { commentBlockExpectation } from "./comment-markers.ts"
6
+ import type { CheckRule } from "./index.ts"
7
+ import { loadRuleTypeScript } from "./typescript.ts"
8
+
9
+ const UNDECLARED_RESPONSE_EXPECTATION = ["NF-C054", "undeclared-response"]
10
+ const SERVER_FACTORY = /(?<![.\w$])(?:server|createWebApp)\s*\(/
11
+
12
+ /** The imports that build an OpenAPI document from the running routes, by module. */
13
+ const DOCUMENT_BUILDERS: ReadonlyMap<string, ReadonlySet<string>> = new Map([
14
+ ["@nifrajs/middleware", new Set(["openapi", "buildOpenApiDocument"])],
15
+ ["@nifrajs/schema", new Set(["toOpenAPI", "toOpenAPIFromEvidence"])],
16
+ ["@nifrajs/schema/openapi", new Set(["toOpenAPI", "toOpenAPIFromEvidence"])],
17
+ ])
18
+
19
+ /** The first value import in `tree` of a builder in {@link DOCUMENT_BUILDERS}, as `name` from `module`. */
20
+ function documentBuilder(ts: TypeScriptApi, tree: TSApi.SourceFile): string | undefined {
21
+ for (const statement of tree.statements) {
22
+ if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier))
23
+ continue
24
+ const names = DOCUMENT_BUILDERS.get(statement.moduleSpecifier.text)
25
+ const clause = statement.importClause
26
+ const bindings = clause?.namedBindings
27
+ if (names === undefined || clause?.isTypeOnly === true || bindings === undefined) continue
28
+ if (!ts.isNamedImports(bindings)) continue
29
+ for (const element of bindings.elements) {
30
+ const name = (element.propertyName ?? element.name).text
31
+ if (!element.isTypeOnly && names.has(name))
32
+ return `\`${name}\` from ${statement.moduleSpecifier.text}`
33
+ }
34
+ }
35
+ return undefined
36
+ }
37
+
38
+ /**
39
+ * NF-C054: in a project that builds its OpenAPI document from the running routes (`openapi()`,
40
+ * `buildOpenApiDocument`, `toOpenAPI`), a route registered without a `response` schema. The document
41
+ * can only say such a route answers a generic `200`, so a client generated from it, in any language,
42
+ * gets no type for the body. The typed client is unaffected: it reads the handler's TypeScript type.
43
+ */
44
+ export const undeclaredResponseRule: CheckRule = {
45
+ code: "NF-C054",
46
+ title: "Route without a response schema in a published document",
47
+ async scan(ctx) {
48
+ const loaded = await loadRuleTypeScript(ctx)
49
+ if (loaded.diagnostics !== undefined) return loaded.diagnostics
50
+ const ts = loaded.compiler
51
+ if (ts === undefined) return []
52
+ const facts = createSourceFacts(ts)
53
+ const sources: { file: string; text: string; tree: TSApi.SourceFile }[] = []
54
+ let builder: string | undefined
55
+ for (const file of ctx.project.source.files) {
56
+ if (!/\.[cm]?tsx?$/.test(file)) continue
57
+ const text = ctx.project.source.read(file)
58
+ const serves = text !== undefined && SERVER_FACTORY.test(text)
59
+ if (text === undefined || (!serves && !text.includes("@nifrajs/"))) continue
60
+ const tree = facts.parse(file, text)
61
+ if (tree === undefined) continue
62
+ builder ??= documentBuilder(ts, tree)
63
+ if (serves) sources.push({ file, text, tree })
64
+ }
65
+ if (builder === undefined) return []
66
+ const findings: Diagnostic[] = []
67
+ for (const { file, text, tree } of sources) {
68
+ const lines = text.split("\n")
69
+ for (const route of facts.undeclaredResponseRoutes(tree)) {
70
+ const line = tree.getLineAndCharacterOfPosition(route.position).line + 1
71
+ if (commentBlockExpectation(lines, line, UNDECLARED_RESPONSE_EXPECTATION) !== undefined)
72
+ continue
73
+ findings.push(
74
+ diagnostic({
75
+ code: "NF-C054",
76
+ severity: "info",
77
+ file,
78
+ line,
79
+ message: `${route.method} ${route.path} declares no \`response\` schema, so the OpenAPI document this project builds says only that it answers 200: a client generated from it gets no type for the body. Declare \`{ response: ... }\`, or generate the document with \`nifra openapi\`, which reads the handler's return type.`,
80
+ evidence: [
81
+ `the project builds its document from the running routes with ${builder}`,
82
+ "a route without a response schema is documented as a 200 with no body type",
83
+ "a route left out on purpose: `// nifra-expect NF-C054: <reason>` above the registration",
84
+ ],
85
+ verify: "nifra check",
86
+ }),
87
+ )
88
+ }
89
+ }
90
+ return findings
91
+ },
92
+ }