@nifrajs/cli 5.5.1 → 5.7.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.
- package/CHANGELOG.md +314 -0
- package/dist/cdn-check.d.ts +7 -6
- package/dist/cdn-check.d.ts.map +1 -1
- package/dist/cdn-check.js +13 -1
- package/dist/cdn-check.js.map +1 -1
- package/dist/check-diagnostics.d.ts.map +1 -1
- package/dist/check-diagnostics.js +9 -3
- package/dist/check-diagnostics.js.map +1 -1
- package/dist/check-scan.d.ts +6 -0
- package/dist/check-scan.d.ts.map +1 -1
- package/dist/check-scan.js +30 -32
- package/dist/check-scan.js.map +1 -1
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +35 -12
- package/dist/check.js.map +1 -1
- package/dist/cli.d.ts +4 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +66 -9
- package/dist/cli.js.map +1 -1
- package/dist/command-catalog.d.ts +19 -1
- package/dist/command-catalog.d.ts.map +1 -1
- package/dist/command-catalog.js +111 -6
- package/dist/command-catalog.js.map +1 -1
- package/dist/contracts.d.ts +42 -4
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +288 -9
- package/dist/contracts.js.map +1 -1
- package/dist/doctor.d.ts +12 -2
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +67 -1
- package/dist/doctor.js.map +1 -1
- package/dist/fix-recipes.d.ts.map +1 -1
- package/dist/fix-recipes.js +27 -0
- package/dist/fix-recipes.js.map +1 -1
- package/dist/frontend-guidance.d.ts +1 -1
- package/dist/frontend-guidance.d.ts.map +1 -1
- package/dist/frontend-guidance.js +17 -8
- package/dist/frontend-guidance.js.map +1 -1
- package/dist/internal/git-ignored.d.ts +12 -0
- package/dist/internal/git-ignored.d.ts.map +1 -0
- package/dist/internal/git-ignored.js +49 -0
- package/dist/internal/git-ignored.js.map +1 -0
- package/dist/internal/source-facts.d.ts +29 -0
- package/dist/internal/source-facts.d.ts.map +1 -1
- package/dist/internal/source-facts.js +160 -0
- package/dist/internal/source-facts.js.map +1 -1
- package/dist/introspect.js +1 -1
- package/dist/introspect.js.map +1 -1
- package/dist/load.d.ts +7 -1
- package/dist/load.d.ts.map +1 -1
- package/dist/load.js +18 -0
- package/dist/load.js.map +1 -1
- package/dist/local-cli.d.ts +15 -0
- package/dist/local-cli.d.ts.map +1 -0
- package/dist/local-cli.js +74 -0
- package/dist/local-cli.js.map +1 -0
- package/dist/lock-links.d.ts +0 -7
- package/dist/lock-links.d.ts.map +1 -1
- package/dist/lock-links.js +5 -44
- package/dist/lock-links.js.map +1 -1
- package/dist/mcp-delegate.d.ts +13 -5
- package/dist/mcp-delegate.d.ts.map +1 -1
- package/dist/mcp-delegate.js +24 -8
- package/dist/mcp-delegate.js.map +1 -1
- package/dist/mcp-exec.d.ts.map +1 -1
- package/dist/mcp-exec.js +57 -3
- package/dist/mcp-exec.js.map +1 -1
- package/dist/mcp-http.d.ts +2 -1
- package/dist/mcp-http.d.ts.map +1 -1
- package/dist/mcp-http.js +3 -2
- package/dist/mcp-http.js.map +1 -1
- package/dist/mcp-tool-meta.d.ts +21 -0
- package/dist/mcp-tool-meta.d.ts.map +1 -0
- package/dist/mcp-tool-meta.js +246 -0
- package/dist/mcp-tool-meta.js.map +1 -0
- package/dist/mcp.d.ts +3 -2
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +36 -98
- package/dist/mcp.js.map +1 -1
- package/dist/openapi-types.d.ts.map +1 -1
- package/dist/openapi-types.js +45 -2
- package/dist/openapi-types.js.map +1 -1
- package/dist/output-schemas.d.ts +8 -0
- package/dist/output-schemas.d.ts.map +1 -1
- package/dist/output-schemas.js +14 -0
- package/dist/output-schemas.js.map +1 -1
- package/dist/ppr-read-fix.d.ts +8 -0
- package/dist/ppr-read-fix.d.ts.map +1 -0
- package/dist/ppr-read-fix.js +356 -0
- package/dist/ppr-read-fix.js.map +1 -0
- package/dist/recipes/5.6.0.d.ts +10 -0
- package/dist/recipes/5.6.0.d.ts.map +1 -0
- package/dist/recipes/5.6.0.js +68 -0
- package/dist/recipes/5.6.0.js.map +1 -0
- package/dist/recipes/5.7.0.d.ts +12 -0
- package/dist/recipes/5.7.0.d.ts.map +1 -0
- package/dist/recipes/5.7.0.js +70 -0
- package/dist/recipes/5.7.0.js.map +1 -0
- package/dist/recipes/index.d.ts +13 -0
- package/dist/recipes/index.d.ts.map +1 -1
- package/dist/recipes/index.js +4 -0
- package/dist/recipes/index.js.map +1 -1
- package/dist/review.d.ts.map +1 -1
- package/dist/review.js +9 -2
- package/dist/review.js.map +1 -1
- package/dist/rules/codes.d.ts +10 -3
- package/dist/rules/codes.d.ts.map +1 -1
- package/dist/rules/codes.js +11 -4
- package/dist/rules/codes.js.map +1 -1
- package/dist/rules/explanations.d.ts.map +1 -1
- package/dist/rules/explanations.js +52 -16
- package/dist/rules/explanations.js.map +1 -1
- package/dist/rules/islands.d.ts +91 -0
- package/dist/rules/islands.d.ts.map +1 -1
- package/dist/rules/islands.js +757 -3
- package/dist/rules/islands.js.map +1 -1
- package/dist/rules/legacy.js +1 -1
- package/dist/rules/legacy.js.map +1 -1
- package/dist/rules/ppr.d.ts +16 -0
- package/dist/rules/ppr.d.ts.map +1 -0
- package/dist/rules/ppr.js +114 -0
- package/dist/rules/ppr.js.map +1 -0
- package/dist/rules/swap.d.ts +7 -0
- package/dist/rules/swap.d.ts.map +1 -0
- package/dist/rules/swap.js +338 -0
- package/dist/rules/swap.js.map +1 -0
- package/dist/rules/text-slot-boolean.d.ts +8 -0
- package/dist/rules/text-slot-boolean.d.ts.map +1 -0
- package/dist/rules/text-slot-boolean.js +57 -0
- package/dist/rules/text-slot-boolean.js.map +1 -0
- package/dist/rules/undeclared-response.d.ts +9 -0
- package/dist/rules/undeclared-response.d.ts.map +1 -0
- package/dist/rules/undeclared-response.js +93 -0
- package/dist/rules/undeclared-response.js.map +1 -0
- package/dist/scaffold-hole.d.ts +105 -0
- package/dist/scaffold-hole.d.ts.map +1 -0
- package/dist/scaffold-hole.js +688 -0
- package/dist/scaffold-hole.js.map +1 -0
- package/dist/scaffold.d.ts +5 -3
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/scaffold.js +56 -46
- package/dist/scaffold.js.map +1 -1
- package/dist/upgrade.d.ts +34 -8
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +197 -25
- package/dist/upgrade.js.map +1 -1
- package/dist/verification-plan.d.ts.map +1 -1
- package/dist/verification-plan.js +12 -1
- package/dist/verification-plan.js.map +1 -1
- package/dist/version-drift.js +1 -1
- package/dist/version-drift.js.map +1 -1
- package/dist/web-app-options.d.ts +1 -1
- package/dist/web-app-options.d.ts.map +1 -1
- package/dist/web-app-options.js.map +1 -1
- package/docs/examples.json +70 -10
- package/docs/llms-full.txt +3162 -1196
- package/docs/types.json +1473 -322
- package/package.json +11 -11
- package/src/cdn-check.ts +21 -7
- package/src/check-diagnostics.ts +9 -3
- package/src/check-scan.ts +35 -32
- package/src/check.ts +32 -10
- package/src/cli.ts +71 -9
- package/src/command-catalog.ts +149 -6
- package/src/contracts.ts +348 -14
- package/src/doctor.ts +62 -3
- package/src/fix-recipes.ts +28 -0
- package/src/frontend-guidance.ts +20 -8
- package/src/internal/git-ignored.ts +47 -0
- package/src/internal/source-facts.ts +198 -0
- package/src/introspect.ts +1 -1
- package/src/load.ts +29 -0
- package/src/local-cli.ts +83 -0
- package/src/lock-links.ts +5 -43
- package/src/mcp-delegate.ts +30 -9
- package/src/mcp-exec.ts +74 -3
- package/src/mcp-http.ts +3 -2
- package/src/mcp-tool-meta.ts +268 -0
- package/src/mcp.ts +35 -99
- package/src/openapi-types.ts +43 -2
- package/src/output-schemas.ts +28 -0
- package/src/ppr-read-fix.ts +426 -0
- package/src/recipes/5.6.0.ts +69 -0
- package/src/recipes/5.7.0.ts +72 -0
- package/src/recipes/index.ts +18 -0
- package/src/review.ts +9 -2
- package/src/rules/codes.ts +11 -4
- package/src/rules/explanations.ts +52 -16
- package/src/rules/islands.ts +875 -3
- package/src/rules/legacy.ts +1 -1
- package/src/rules/ppr.ts +143 -0
- package/src/rules/swap.ts +402 -0
- package/src/rules/text-slot-boolean.ts +56 -0
- package/src/rules/undeclared-response.ts +92 -0
- package/src/scaffold-hole.ts +880 -0
- package/src/scaffold.ts +60 -49
- package/src/upgrade.ts +229 -33
- package/src/verification-plan.ts +20 -1
- package/src/version-drift.ts +1 -1
- package/src/web-app-options.ts +2 -0
- package/dist/rules/nano.d.ts +0 -6
- package/dist/rules/nano.d.ts.map +0 -1
- package/dist/rules/nano.js +0 -273
- package/dist/rules/nano.js.map +0 -1
- package/src/rules/nano.ts +0 -307
package/src/rules/codes.ts
CHANGED
|
@@ -44,9 +44,16 @@ export const RULE_CODES = Object.freeze({
|
|
|
44
44
|
"NF-C045": "Route registered outside the typed chain",
|
|
45
45
|
"NF-C046": "Identity-sensitive version skew",
|
|
46
46
|
"NF-C020": "Island enhancer cleanup check",
|
|
47
|
-
"NF-
|
|
48
|
-
"NF-
|
|
49
|
-
"NF-
|
|
47
|
+
"NF-C022": "bindList key check",
|
|
48
|
+
"NF-C047": "Island binding name check",
|
|
49
|
+
"NF-C048": "Island binding outside a bindIsland host",
|
|
50
|
+
"NF-C049": "Swap link or form misdeclared",
|
|
51
|
+
"NF-C050": "Swap names a slot nothing declares",
|
|
52
|
+
"NF-C051": "Slot content is not its slot() alone",
|
|
53
|
+
"NF-C052": "Swap URL's page renders no such slot",
|
|
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",
|
|
50
57
|
"NF-D001": "Doctor check",
|
|
51
58
|
"NF-D002": "Mixed nifra versions",
|
|
52
59
|
"NF-D003": "Stale file: dependencies in bun.lock",
|
|
@@ -68,7 +75,7 @@ export const RULE_CODES = Object.freeze({
|
|
|
68
75
|
} as const)
|
|
69
76
|
|
|
70
77
|
/** Codes that no longer fire but remain reserved forever. */
|
|
71
|
-
export const RETIRED_CODES: ReadonlySet<string> = new Set()
|
|
78
|
+
export const RETIRED_CODES: ReadonlySet<string> = new Set(["NF-C021", "NF-C023"])
|
|
72
79
|
|
|
73
80
|
export type BuiltInCode = keyof typeof RULE_CODES
|
|
74
81
|
|
|
@@ -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.... }
|
|
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": {
|
|
@@ -118,20 +118,10 @@ export const RULE_EXPLANATIONS: Readonly<Record<BuiltInCode, RuleExplanation>> =
|
|
|
118
118
|
fix: "Return a function that removes the listener.",
|
|
119
119
|
docs: "/docs/islands",
|
|
120
120
|
},
|
|
121
|
-
"NF-C021": {
|
|
122
|
-
why: "A nano binding's returned disposer is discarded, so the binding outlives its component and leaks on soft navigation.",
|
|
123
|
-
fix: "Collect the disposer and call it on teardown.",
|
|
124
|
-
docs: "/docs/nano",
|
|
125
|
-
},
|
|
126
121
|
"NF-C022": {
|
|
127
|
-
why: "bindList
|
|
128
|
-
fix: "Key each item by a stable id.",
|
|
129
|
-
docs: "/docs/
|
|
130
|
-
},
|
|
131
|
-
"NF-C023": {
|
|
132
|
-
why: "A computed or effect reads a signal its deps array does not list, so it does not update when that signal changes.",
|
|
133
|
-
fix: "Add the missing signals to the deps array.",
|
|
134
|
-
docs: "/docs/nano",
|
|
122
|
+
why: "A bindList key reads the item's position (a second parameter, which bindList never passes, or an indexOf/findIndex call handed the item), so adding, removing or reordering items hands a node and its state to the wrong item.",
|
|
123
|
+
fix: "Key each item by a stable id on the item.",
|
|
124
|
+
docs: "/docs/islands",
|
|
135
125
|
},
|
|
136
126
|
"NF-C024": {
|
|
137
127
|
why: "Two route patterns match a common path (the finding shows one), so one shadows the other for some requests.",
|
|
@@ -253,6 +243,52 @@ export const RULE_EXPLANATIONS: Readonly<Record<BuiltInCode, RuleExplanation>> =
|
|
|
253
243
|
fix: "Install one version everywhere: align the ranges in every install root that carries a copy, or for nifra packages run `nifra upgrade <version>` in this app and in the linked repository, then install in each.",
|
|
254
244
|
docs: "/docs/troubleshooting",
|
|
255
245
|
},
|
|
246
|
+
"NF-C047": {
|
|
247
|
+
why: 'A data-bind-* attribute inside an island host names a signal its bindIsland setup never declares with state("..."), or a handler the setup does not return. At runtime the binding is skipped with a console warning, so the markup never updates or never reacts.',
|
|
248
|
+
fix: 'Fix the name in the markup, or declare it in the setup: state("name", initial) for a signal, a returned handler for data-bind-on.',
|
|
249
|
+
docs: "/docs/islands",
|
|
250
|
+
},
|
|
251
|
+
"NF-C048": {
|
|
252
|
+
why: "A data-bind-* attribute sits outside every data-island host, or inside a host mounted with defineIsland or a plain enhancer. Only bindIsland walks bindings, so this one never binds.",
|
|
253
|
+
fix: "Move the element inside a host mounted with bindIsland, or mount that host with bindIsland. A binding inside a data-swap-slot belongs to an island inside that slot, which a swap mounts again.",
|
|
254
|
+
docs: "/docs/islands",
|
|
255
|
+
},
|
|
256
|
+
"NF-C049": {
|
|
257
|
+
why: "A data-swap attribute sits on an element other than <a href> or <form>, its value is not replace:<slot> or append:<slot>, or it is in JSX, where no page can answer a slot swap. The link or form behaves as if the attribute were not there.",
|
|
258
|
+
fix: "Put data-swap on a link with an href or on a form, write replace:<slot> or append:<slot>, and render the page with @nifrajs/web-vanilla.",
|
|
259
|
+
docs: "/docs/islands",
|
|
260
|
+
},
|
|
261
|
+
"NF-C050": {
|
|
262
|
+
why: "A data-swap link or form names a slot that no data-swap-slot element in the project declares, so there is nothing to swap and every click loads the page normally.",
|
|
263
|
+
fix: 'Fix the slot name, or mark the region to refresh with data-swap-slot="<name>" and render its content with slot("<name>", ...).',
|
|
264
|
+
docs: "/docs/islands",
|
|
265
|
+
},
|
|
266
|
+
"NF-C051": {
|
|
267
|
+
why: 'A data-swap-slot element must hold slot("<name>", ...) and nothing else: the server answers a swap with what slot() renders and the client replaces the whole element content with it. Content beside it is lost on the first swap; without it, the server has nothing to answer with; a slot() outside its element swaps nothing.',
|
|
268
|
+
fix: 'Make slot("<name>", content) the only content of the element marked data-swap-slot="<name>", and move anything else outside it.',
|
|
269
|
+
docs: "/docs/islands",
|
|
270
|
+
},
|
|
271
|
+
"NF-C052": {
|
|
272
|
+
why: "A data-swap link or form goes to a page whose module and layouts render no slot() of the name it swaps, so the server answers with the whole document and every swap loads the page normally.",
|
|
273
|
+
fix: "Point the link or form at the page that renders the slot, or render the slot in that page.",
|
|
274
|
+
docs: "/docs/islands",
|
|
275
|
+
},
|
|
276
|
+
"NF-C053": {
|
|
277
|
+
why: "A page whose backend half exports shellLoader calls getContext() or tryGetContext(). Its shell is built once and served to every visitor, so the shell check refuses a page that reads the request.",
|
|
278
|
+
fix: "Read the request in a dynamic hole's loader, and render what uses it in that hole. The fix moves a read held in one const, and the one element that uses it, into a new hole.",
|
|
279
|
+
command: "nifra fix --code NF-C053",
|
|
280
|
+
docs: "/docs/partial-prerendering",
|
|
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
|
+
},
|
|
256
292
|
"NF-D001": {
|
|
257
293
|
why: "The doctor gate of `nifra assure` found an undeclared import or a package installed more than once.",
|
|
258
294
|
fix: "Run `nifra doctor` for the details and the fix of each finding.",
|
|
@@ -265,8 +301,8 @@ export const RULE_EXPLANATIONS: Readonly<Record<BuiltInCode, RuleExplanation>> =
|
|
|
265
301
|
docs: "/docs/troubleshooting#mixed-versions",
|
|
266
302
|
},
|
|
267
303
|
"NF-D003": {
|
|
268
|
-
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.",
|
|
269
|
-
fix: "Run `bun update <package>` for each package the finding names
|
|
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.",
|
|
270
306
|
docs: "/docs/troubleshooting#stale-file-links",
|
|
271
307
|
},
|
|
272
308
|
"NF-A001": {
|