@nifrajs/cli 2.2.0 → 2.3.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/README.md +25 -25
- package/dist/assure.d.ts +2 -2
- package/dist/assure.d.ts.map +1 -1
- package/dist/assure.js +17 -10
- package/dist/assure.js.map +1 -1
- package/dist/capabilities-tool.d.ts +7 -0
- package/dist/capabilities-tool.d.ts.map +1 -1
- package/dist/capabilities-tool.js +68 -16
- package/dist/capabilities-tool.js.map +1 -1
- package/dist/check.d.ts +61 -22
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +332 -86
- package/dist/check.js.map +1 -1
- package/dist/cli.d.ts +30 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +132 -36
- package/dist/cli.js.map +1 -1
- package/dist/diff-tool.d.ts +3 -3
- package/dist/diff-tool.js +7 -7
- package/dist/docs-search.d.ts +3 -3
- package/dist/docs-search.js +6 -6
- package/dist/doctor.d.ts +3 -3
- package/dist/doctor.js +8 -8
- package/dist/examples.d.ts +5 -5
- package/dist/examples.js +5 -5
- package/dist/init-agents.d.ts +14 -14
- package/dist/init-agents.js +14 -14
- package/dist/internal/typescript-import.d.ts +24 -0
- package/dist/internal/typescript-import.d.ts.map +1 -0
- package/dist/internal/typescript-import.js +32 -0
- package/dist/internal/typescript-import.js.map +1 -0
- package/dist/introspect.d.ts +12 -12
- package/dist/introspect.js +24 -24
- package/dist/levels-tool.d.ts +8 -8
- package/dist/levels-tool.d.ts.map +1 -1
- package/dist/levels-tool.js +33 -30
- package/dist/levels-tool.js.map +1 -1
- package/dist/load.d.ts +6 -6
- package/dist/load.d.ts.map +1 -1
- package/dist/load.js +15 -7
- package/dist/load.js.map +1 -1
- package/dist/manifest-tool.d.ts +1 -1
- package/dist/manifest-tool.d.ts.map +1 -1
- package/dist/manifest-tool.js +4 -2
- package/dist/manifest-tool.js.map +1 -1
- package/dist/mcp-docs-tools.d.ts +1 -1
- package/dist/mcp-docs-tools.js +9 -9
- package/dist/mcp-http.d.ts +5 -5
- package/dist/mcp-http.js +7 -7
- package/dist/mcp-protocol.d.ts +2 -2
- package/dist/mcp-protocol.js +2 -2
- package/dist/mcp-render.d.ts +3 -3
- package/dist/mcp-render.js +6 -6
- package/dist/mcp-run.d.ts +2 -2
- package/dist/mcp-run.js +2 -2
- package/dist/mcp.d.ts +14 -14
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +75 -45
- package/dist/mcp.js.map +1 -1
- package/dist/openapi-tool.d.ts +1 -1
- package/dist/openapi-tool.js +2 -2
- package/dist/pipeline-guard.d.ts +1 -1
- package/dist/pipeline-guard.js +1 -1
- package/dist/port.d.ts +9 -9
- package/dist/port.js +27 -27
- package/dist/recipes/1.8.0.d.ts +2 -2
- package/dist/recipes/1.8.0.js +5 -5
- package/dist/recipes/index.d.ts +2 -2
- package/dist/recipes/index.js +1 -1
- package/dist/scaffold.d.ts +3 -3
- package/dist/scaffold.js +8 -8
- package/dist/sync-routes.d.ts +28 -0
- package/dist/sync-routes.d.ts.map +1 -0
- package/dist/sync-routes.js +55 -0
- package/dist/sync-routes.js.map +1 -0
- package/dist/types-search.d.ts +5 -5
- package/dist/types-search.js +7 -7
- package/dist/upgrade.d.ts +7 -7
- package/dist/upgrade.js +12 -12
- package/dist/verification.d.ts +51 -0
- package/dist/verification.d.ts.map +1 -0
- package/dist/verification.js +80 -0
- package/dist/verification.js.map +1 -0
- package/docs/examples.json +174 -90
- package/docs/llms-full.txt +1696 -747
- package/docs/types.json +1892 -3105
- package/package.json +22 -11
- package/src/assure.ts +17 -18
- package/src/capabilities-tool.ts +82 -16
- package/src/check.ts +405 -103
- package/src/cli.ts +141 -38
- package/src/diff-tool.ts +8 -8
- package/src/docs-search.ts +6 -6
- package/src/doctor.ts +10 -10
- package/src/examples.ts +7 -7
- package/src/init-agents.ts +17 -17
- package/src/internal/typescript-import.ts +33 -0
- package/src/introspect.ts +28 -28
- package/src/levels-tool.ts +37 -31
- package/src/load.ts +21 -12
- package/src/manifest-tool.ts +4 -2
- package/src/mcp-docs-tools.ts +9 -9
- package/src/mcp-http.ts +7 -7
- package/src/mcp-protocol.ts +2 -2
- package/src/mcp-render.ts +6 -6
- package/src/mcp-run.ts +2 -2
- package/src/mcp.ts +82 -45
- package/src/openapi-tool.ts +2 -2
- package/src/pipeline-guard.ts +1 -1
- package/src/port.ts +31 -31
- package/src/recipes/1.8.0.ts +5 -5
- package/src/recipes/index.ts +2 -2
- package/src/scaffold.ts +8 -8
- package/src/sync-routes.ts +69 -0
- package/src/types-search.ts +8 -8
- package/src/upgrade.ts +12 -12
- package/src/verification.ts +123 -0
package/dist/introspect.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Introspect a loaded nifra project into a Markdown brief
|
|
3
|
-
* page routes (`discoverRoutes`), and a conventions summary
|
|
2
|
+
* Introspect a loaded nifra project into a Markdown brief - the API routes (`backend.routes()`), the
|
|
3
|
+
* page routes (`discoverRoutes`), and a conventions summary - for piping into an AI coding agent's
|
|
4
4
|
* prompt. Used by `nifra context` (stdout) and the `nifra mcp` server (a tool result), so an agent sees
|
|
5
5
|
* *this* project's actual surface, not just generic docs.
|
|
6
6
|
*/
|
|
@@ -11,7 +11,7 @@ export function backendRoutes(backend) {
|
|
|
11
11
|
return [...reflectRoutes(backend)];
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Render a JSON Schema as a compact TypeScript-like type (`{ id: string, name?: string }`)
|
|
14
|
+
* Render a JSON Schema as a compact TypeScript-like type (`{ id: string, name?: string }`) - the
|
|
15
15
|
* shape agents already think in, at a fraction of the raw JSON Schema's tokens (~70-80% smaller).
|
|
16
16
|
* Anything the renderer doesn't model falls back to the raw JSON for that subtree, so the output
|
|
17
17
|
* is always faithful, just not always minimal.
|
|
@@ -58,7 +58,7 @@ export function tsTypeOf(schema, depth = 0) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
/** One route's request/response field shapes, indented under its line. Reads the declared schemas off the
|
|
61
|
-
* descriptor so an agent gets the exact input + output contract
|
|
61
|
+
* descriptor so an agent gets the exact input + output contract - not just "this route is validated". */
|
|
62
62
|
function schemaLines(schema) {
|
|
63
63
|
const s = schema;
|
|
64
64
|
if (!s)
|
|
@@ -77,11 +77,11 @@ function schemaLines(schema) {
|
|
|
77
77
|
}
|
|
78
78
|
const IDENT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
79
79
|
/**
|
|
80
|
-
* The typed-client call form for a route
|
|
80
|
+
* The typed-client call form for a route - the exact `client<typeof app>` proxy chain an agent should
|
|
81
81
|
* write, derived from the same convention `@nifrajs/client` implements (so it never has to read the
|
|
82
82
|
* client tests to learn it): a static segment is a property (`.users`), a path param/wildcard is a call
|
|
83
83
|
* that appends the value (`({ id })`), the root path is `.index`, and the HTTP verb is the terminal call.
|
|
84
|
-
* Body verbs (POST/PUT/PATCH) take the body first then call-options; other verbs take call-options first
|
|
84
|
+
* Body verbs (POST/PUT/PATCH) take the body first then call-options; other verbs take call-options first -
|
|
85
85
|
* so the `{ query }` argument lands in the right slot for each.
|
|
86
86
|
*/
|
|
87
87
|
export function clientCall(method, path, schema) {
|
|
@@ -125,9 +125,9 @@ export function apiRoutesSection(routes) {
|
|
|
125
125
|
...schemaLines(r.schema),
|
|
126
126
|
` - call: \`${clientCall(r.method, r.path, r.schema)}\` → \`{ ok, status, data, error }\``,
|
|
127
127
|
]);
|
|
128
|
-
return `## API routes (backend.ts)\n\nEach route's \`body\`/\`query\`/\`response\` shape is its contract
|
|
128
|
+
return `## API routes (backend.ts)\n\nEach route's \`body\`/\`query\`/\`response\` shape is its contract - the typed client derives request inputs and \`res.data\` from these, so a screen built on \`client<typeof app>\` stays in sync automatically. The \`call\` line is the exact \`client<typeof app>\` form: static path segments are properties, a path param is a call (\`({ id })\`), the verb is the terminal call (body first for POST/PUT/PATCH), and every call returns the never-throwing \`{ ok, status, data, error }\` Result.\n\n${lines.join("\n")}`;
|
|
129
129
|
}
|
|
130
|
-
/** Compact API-routes INDEX for the no-arg `nifra_context` call
|
|
130
|
+
/** Compact API-routes INDEX for the no-arg `nifra_context` call - `METHOD path` per route, WITHOUT the
|
|
131
131
|
* body/query/response shapes or the per-route `call` line. Bounds the first-call payload on a big backend:
|
|
132
132
|
* an agent gets the full route list (so it knows what's mounted) plus a pointer to fetch any route's full
|
|
133
133
|
* contract via the `path`/`kind` slice, instead of every schema up front. */
|
|
@@ -138,7 +138,7 @@ export function apiRoutesIndexSection(routes) {
|
|
|
138
138
|
const lines = [...routes]
|
|
139
139
|
.sort((a, b) => a.path.localeCompare(b.path) || a.method.localeCompare(b.method))
|
|
140
140
|
.map((r) => `- \`${r.method} ${r.path}\``);
|
|
141
|
-
return `## API routes (backend.ts)\n\n${routes.length} route${routes.length === 1 ? "" : "s"}. Call \`nifra_context\` again with \`path\` (a route prefix) and/or \`kind: "api"\` for the body/query/response contracts + the exact \`client<typeof app>\` call form
|
|
141
|
+
return `## API routes (backend.ts)\n\n${routes.length} route${routes.length === 1 ? "" : "s"}. Call \`nifra_context\` again with \`path\` (a route prefix) and/or \`kind: "api"\` for the body/query/response contracts + the exact \`client<typeof app>\` call form - or \`nifra_routes\` for the same as structured JSON.\n\n${lines.join("\n")}`;
|
|
142
142
|
}
|
|
143
143
|
/** Markdown section listing the file-routed pages (URL pattern → source file). */
|
|
144
144
|
export function pageRoutesSection(manifest) {
|
|
@@ -154,27 +154,27 @@ const CONVENTIONS = `## Conventions (summary)
|
|
|
154
154
|
|
|
155
155
|
- **Backend:** \`server()\` from \`@nifrajs/core\`; returning a value sends JSON. Validate untrusted input with
|
|
156
156
|
a route schema (\`{ body, query, params }\` using \`t\` from \`@nifrajs/schema\` or any Standard Schema) and read
|
|
157
|
-
the typed \`c.body\` / \`c.query\` / \`c.params\`
|
|
157
|
+
the typed \`c.body\` / \`c.query\` / \`c.params\` - never hand-parse.
|
|
158
158
|
- **Cross-cutting concerns** (rate limit / \`429\`, CORS, auth, CSRF, caching, security headers, body limits)
|
|
159
159
|
→ \`@nifrajs/middleware\`, applied with \`app.use(...)\`. Don't hand-roll them; call \`nifra_docs("middleware")\`
|
|
160
160
|
for the full list + usage.
|
|
161
161
|
- **Need the exact TypeScript of a \`@nifrajs/*\` symbol?** Call \`nifra_types({ name })\` (e.g. \`RateLimitStore\`,
|
|
162
|
-
\`RouteSchema\`)
|
|
162
|
+
\`RouteSchema\`) - the authoritative, complete declaration. Never read \`@nifrajs\` \`.d.ts\` files.
|
|
163
163
|
- **Response contract (no drift):** declare \`{ response: t.object({...}) }\` on a route to lock its output
|
|
164
|
-
shape
|
|
164
|
+
shape - the handler is type-checked against it and the client sees exactly that shape. The contract above
|
|
165
165
|
is the single source of truth for both sides.
|
|
166
|
-
- **Client
|
|
166
|
+
- **Client - ALWAYS use this for API calls:** \`client<typeof app>(url)\` derives request inputs AND
|
|
167
167
|
\`res.data\` from the backend's route types, so the compiler catches any frontend/backend drift. Never
|
|
168
|
-
hand-roll \`fetch\` + ad-hoc response types for an internal API
|
|
168
|
+
hand-roll \`fetch\` + ad-hoc response types for an internal API - that's exactly how screens drift. It
|
|
169
169
|
never throws: branch on \`res.ok ? res.data : res.error\`.
|
|
170
170
|
- **Pages:** file-routed under \`routes/\`; \`loader\`/\`action\` are server-only but the module is also bundled
|
|
171
|
-
for the browser
|
|
171
|
+
for the browser - **never top-level-import server-only code** (DB, secrets, \`process.env\`) into a route
|
|
172
172
|
file; reach it via \`ctx.api\` / \`ctx.env\`.
|
|
173
173
|
- \`app.fetch(Request)\` is the universal entry. Full reference: this repo's \`AGENTS.md\`, or \`llms-full.txt\`.`;
|
|
174
174
|
/**
|
|
175
|
-
* Build the project brief as Markdown. A no-arg call returns a tight **INDEX**
|
|
175
|
+
* Build the project brief as Markdown. A no-arg call returns a tight **INDEX** - the route list (API
|
|
176
176
|
* routes as `METHOD path`, page routes as `pattern → file`) + conventions + a pointer to fetch full
|
|
177
|
-
* contracts via the slice
|
|
177
|
+
* contracts via the slice - so learning a big project is cheap, not a full-surface schema dump. Passing a
|
|
178
178
|
* {@link ContextFilter} (`path` prefix and/or `kind`) returns the narrowed, FULL detail (per-route
|
|
179
179
|
* body/query/response shapes + the typed-client `call` form), and omits the conventions block (the agent
|
|
180
180
|
* already has it from the index call).
|
|
@@ -185,7 +185,7 @@ export function describeProject(app, filter) {
|
|
|
185
185
|
manifest = discoverRoutes(app.routesDir);
|
|
186
186
|
}
|
|
187
187
|
catch {
|
|
188
|
-
// No (or unreadable) routes/
|
|
188
|
+
// No (or unreadable) routes/ - the page-routes section reports that.
|
|
189
189
|
}
|
|
190
190
|
const prefix = filter?.path;
|
|
191
191
|
let routes = backendRoutes(app.backend);
|
|
@@ -201,10 +201,10 @@ export function describeProject(app, filter) {
|
|
|
201
201
|
const isIndex = filter?.kind === undefined && (prefix === undefined || prefix === "");
|
|
202
202
|
const sections = [`# nifra project: ${app.cwd.slice(app.cwd.lastIndexOf("/") + 1)}`];
|
|
203
203
|
if (isIndex) {
|
|
204
|
-
sections.push("A full-stack nifra app
|
|
205
|
-
// Point agents at the verified surface, not recalled APIs
|
|
204
|
+
sections.push("A full-stack nifra app - Web-standard, one app on Bun, Node, Deno, and the edge. This is the route INDEX; fetch a route's full body/query/response contract on demand (see below).",
|
|
205
|
+
// Point agents at the verified surface, not recalled APIs - nifra is young, so training data is the
|
|
206
206
|
// wrong source. The MCP tools (nifra_docs / nifra_example) are checked against the installed version.
|
|
207
|
-
"> **Build against THIS surface + the verified tools
|
|
207
|
+
"> **Build against THIS surface + the verified tools - do not write nifra APIs from memory** (the\n> framework is young; recalled APIs drift). For framework code, call `nifra_example` (snippets\n> typechecked against the installed version) or `nifra_docs`; verify edits with `nifra_run` + `nifra_check`.");
|
|
208
208
|
}
|
|
209
209
|
if (filter?.kind !== "pages") {
|
|
210
210
|
// Index → compact `METHOD path` list; a slice → the full schema + call-form detail.
|
|
@@ -217,7 +217,7 @@ export function describeProject(app, filter) {
|
|
|
217
217
|
return sections.join("\n\n");
|
|
218
218
|
}
|
|
219
219
|
/**
|
|
220
|
-
* The backend's API routes as structured JSON
|
|
220
|
+
* The backend's API routes as structured JSON - what the `nifra_routes` MCP tool returns, so an agent
|
|
221
221
|
* consumes the contract programmatically (`list_routes` / `get_route_schema`) instead of parsing the
|
|
222
222
|
* Markdown brief. Optionally filtered to routes whose path starts with `pathPrefix`. Reuses the exact
|
|
223
223
|
* same `call` form and TS-shaped contracts the Markdown brief shows.
|
|
@@ -261,7 +261,7 @@ function isUnderPrefix(path, prefix) {
|
|
|
261
261
|
return path === prefix || path.startsWith(`${prefix}/`);
|
|
262
262
|
}
|
|
263
263
|
/**
|
|
264
|
-
* Build the unified, sorted route table from page routes + backend API routes. Pure
|
|
264
|
+
* Build the unified, sorted route table from page routes + backend API routes. Pure - the caller
|
|
265
265
|
* supplies page `hasAction` (resolved via a module load) and the API descriptors (`backend.routes()`).
|
|
266
266
|
* Page routes serve `GET` (+ `POST` when they export an `action`); API routes carry their declared
|
|
267
267
|
* method, and are flagged `autoMounted` when at/under `apiPrefix`. Sorted by path, then kind, then the
|
|
@@ -342,7 +342,7 @@ export async function describeRoutes(app, opts = {}) {
|
|
|
342
342
|
manifest = discoverRoutes(app.routesDir);
|
|
343
343
|
}
|
|
344
344
|
catch {
|
|
345
|
-
// No (or unreadable) routes/
|
|
345
|
+
// No (or unreadable) routes/ - fall through with no pages; the table still shows API routes.
|
|
346
346
|
}
|
|
347
347
|
const pages = [];
|
|
348
348
|
for (const route of manifest?.routes ?? []) {
|
package/dist/levels-tool.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `nifra levels`
|
|
2
|
+
* `nifra levels` - the verification ladder, computed from gates that already exist:
|
|
3
3
|
*
|
|
4
|
-
* L0 typed contract
|
|
5
|
-
* L1 route assurance
|
|
6
|
-
* L2 capability lockfile
|
|
7
|
-
* L3 route manifest
|
|
8
|
-
* L4 invariant-tested
|
|
4
|
+
* L0 typed contract - `nifra check` passes (compiler-enforced frontend↔backend contract)
|
|
5
|
+
* L1 route assurance - `nifra.assurance.ts` present and every route satisfies its policy
|
|
6
|
+
* L2 capability lockfile - capability/effect assurance passes and the lockfile is in sync
|
|
7
|
+
* L3 route manifest - the emitted manifest hash-verifies and matches the current app
|
|
8
|
+
* L4 invariant-tested - every route passes through an explicitly isolated executor
|
|
9
9
|
*
|
|
10
|
-
* A level counts only when every level below it holds
|
|
10
|
+
* A level counts only when every level below it holds - the ladder is cumulative, so "L3" is one
|
|
11
11
|
* honest word for a whole posture. Levels are computed, never self-declared.
|
|
12
12
|
*/
|
|
13
13
|
export interface VerificationLevelStatus {
|
|
14
14
|
readonly level: number;
|
|
15
15
|
readonly name: string;
|
|
16
16
|
readonly ok: boolean;
|
|
17
|
-
/** Why the level does not hold
|
|
17
|
+
/** Why the level does not hold - a gate failure or a missing prerequisite. Empty when ok. */
|
|
18
18
|
readonly reasons: readonly string[];
|
|
19
19
|
}
|
|
20
20
|
export interface VerificationLevelsResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"levels-tool.d.ts","sourceRoot":"","sources":["../src/levels-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"levels-tool.d.ts","sourceRoot":"","sources":["../src/levels-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAeH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAA;IACpB,6FAA6F;IAC7F,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CACpC;AAED,MAAM,WAAW,wBAAwB;IACvC,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,SAAS,uBAAuB,EAAE,CAAA;CACpD;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,iGAAiG;AACjG,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,CAgJnC;AAqBD,2FAA2F;AAC3F,wBAAsB,SAAS,CAC7B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,oBAAoB,GAAG;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GACtF,OAAO,CAAC,OAAO,CAAC,CAkBlB"}
|
package/dist/levels-tool.js
CHANGED
|
@@ -1,30 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `nifra levels`
|
|
2
|
+
* `nifra levels` - the verification ladder, computed from gates that already exist:
|
|
3
3
|
*
|
|
4
|
-
* L0 typed contract
|
|
5
|
-
* L1 route assurance
|
|
6
|
-
* L2 capability lockfile
|
|
7
|
-
* L3 route manifest
|
|
8
|
-
* L4 invariant-tested
|
|
4
|
+
* L0 typed contract - `nifra check` passes (compiler-enforced frontend↔backend contract)
|
|
5
|
+
* L1 route assurance - `nifra.assurance.ts` present and every route satisfies its policy
|
|
6
|
+
* L2 capability lockfile - capability/effect assurance passes and the lockfile is in sync
|
|
7
|
+
* L3 route manifest - the emitted manifest hash-verifies and matches the current app
|
|
8
|
+
* L4 invariant-tested - every route passes through an explicitly isolated executor
|
|
9
9
|
*
|
|
10
|
-
* A level counts only when every level below it holds
|
|
10
|
+
* A level counts only when every level below it holds - the ladder is cumulative, so "L3" is one
|
|
11
11
|
* honest word for a whole posture. Levels are computed, never self-declared.
|
|
12
12
|
*/
|
|
13
13
|
import { existsSync } from "node:fs";
|
|
14
14
|
import { resolve } from "node:path";
|
|
15
|
-
import { evaluateRouteAssurance } from "@nifrajs/core/assurance";
|
|
16
15
|
import { snapshotCapabilities } from "@nifrajs/core/capabilities";
|
|
17
16
|
import { buildNifraManifest, parseNifraManifest } from "@nifrajs/core/manifest";
|
|
18
17
|
import { runAdversarialContract } from "@nifrajs/testing";
|
|
19
|
-
import {
|
|
20
|
-
import { collectCapabilityProjectReport, diffCapabilitySnapshots, parseCapabilityLockfile, } from "./capabilities-tool.js";
|
|
21
|
-
import { collectCheckResult } from "./check.js";
|
|
18
|
+
import { diffCapabilitySnapshots, parseCapabilityLockfile, } from "./capabilities-tool.js";
|
|
22
19
|
import { DEFAULT_MANIFEST_FILE } from "./manifest-tool.js";
|
|
23
20
|
/** Compute the ladder. Each level is evaluated independently, then gated on the levels below. */
|
|
24
21
|
export async function collectVerificationLevels(cwd, options = {}) {
|
|
22
|
+
// The ladder is the fullest view over the one project verification: L0 is the check view, L1/L2 read
|
|
23
|
+
// the route-assurance + capability evidence the same collector already computed (no second walk), and
|
|
24
|
+
// only the ladder-specific L3 (manifest) and L4 (invariants) are evaluated here.
|
|
25
|
+
const { collectProjectVerification } = await import("./verification.js");
|
|
26
|
+
const verification = await collectProjectVerification(cwd, {
|
|
27
|
+
...(options.config !== undefined ? { config: options.config } : {}),
|
|
28
|
+
maxDiagnostics: 5,
|
|
29
|
+
});
|
|
25
30
|
const statuses = [];
|
|
26
|
-
// L0
|
|
27
|
-
const check = await
|
|
31
|
+
// L0 - typed contract (`nifra check`).
|
|
32
|
+
const check = await verification.check();
|
|
28
33
|
statuses.push({
|
|
29
34
|
level: 0,
|
|
30
35
|
name: "typed contract",
|
|
@@ -32,12 +37,10 @@ export async function collectVerificationLevels(cwd, options = {}) {
|
|
|
32
37
|
reasons: check.ok ? [] : check.diagnostics.map((d) => `${d.rule}: ${d.message}`).slice(0, 5),
|
|
33
38
|
});
|
|
34
39
|
// L1-L4 all hang off the assurance config; without it the ladder stops at L0 by definition.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
catch (err) {
|
|
40
|
-
const reason = err instanceof Error ? err.message : String(err);
|
|
40
|
+
if (verification.config === undefined) {
|
|
41
|
+
const reason = verification.configError instanceof Error
|
|
42
|
+
? verification.configError.message
|
|
43
|
+
: String(verification.configError);
|
|
41
44
|
for (const [level, name] of [
|
|
42
45
|
[1, "route assurance"],
|
|
43
46
|
[2, "capability lockfile"],
|
|
@@ -48,23 +51,23 @@ export async function collectVerificationLevels(cwd, options = {}) {
|
|
|
48
51
|
}
|
|
49
52
|
return finalize(statuses);
|
|
50
53
|
}
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
const config = verification.config;
|
|
55
|
+
// L1 - route assurance.
|
|
56
|
+
const assurance = verification.routeAssurance;
|
|
53
57
|
statuses.push({
|
|
54
58
|
level: 1,
|
|
55
59
|
name: "route assurance",
|
|
56
60
|
ok: assurance.ok,
|
|
57
61
|
reasons: assurance.findings.map((f) => f.message).slice(0, 5),
|
|
58
62
|
});
|
|
59
|
-
// L2
|
|
63
|
+
// L2 - capability assurance + lockfile in sync.
|
|
60
64
|
const l2Reasons = [];
|
|
61
|
-
|
|
65
|
+
const capabilityReport = verification.capability?.report;
|
|
62
66
|
if (config.capabilities === undefined) {
|
|
63
67
|
l2Reasons.push("nifra.assurance.ts declares no capabilities policy");
|
|
64
68
|
}
|
|
65
69
|
else {
|
|
66
|
-
const project =
|
|
67
|
-
capabilityReport = project.report;
|
|
70
|
+
const project = verification.capability;
|
|
68
71
|
if (!project.report.ok) {
|
|
69
72
|
l2Reasons.push(...project.report.findings.map((f) => f.message).slice(0, 5));
|
|
70
73
|
}
|
|
@@ -85,11 +88,11 @@ export async function collectVerificationLevels(cwd, options = {}) {
|
|
|
85
88
|
ok: l2Reasons.length === 0,
|
|
86
89
|
reasons: l2Reasons,
|
|
87
90
|
});
|
|
88
|
-
// L3
|
|
91
|
+
// L3 - emitted manifest hash-verifies AND matches the current app.
|
|
89
92
|
const l3Reasons = [];
|
|
90
93
|
const manifestPath = resolve(cwd, config.manifest?.path ?? DEFAULT_MANIFEST_FILE);
|
|
91
94
|
if (!existsSync(manifestPath)) {
|
|
92
|
-
l3Reasons.push(`manifest missing (${manifestPath})
|
|
95
|
+
l3Reasons.push(`manifest missing (${manifestPath}) - run \`nifra manifest emit\``);
|
|
93
96
|
}
|
|
94
97
|
else {
|
|
95
98
|
try {
|
|
@@ -101,7 +104,7 @@ export async function collectVerificationLevels(cwd, options = {}) {
|
|
|
101
104
|
...(capabilityReport !== undefined ? { capabilities: capabilityReport } : {}),
|
|
102
105
|
});
|
|
103
106
|
if (current.contentHash !== recorded.contentHash) {
|
|
104
|
-
l3Reasons.push("manifest is stale
|
|
107
|
+
l3Reasons.push("manifest is stale - the app changed since it was emitted");
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
else {
|
|
@@ -118,10 +121,10 @@ export async function collectVerificationLevels(cwd, options = {}) {
|
|
|
118
121
|
ok: l3Reasons.length === 0,
|
|
119
122
|
reasons: l3Reasons,
|
|
120
123
|
});
|
|
121
|
-
// L4
|
|
124
|
+
// L4 - contract-generated invariants against an explicitly isolated executor.
|
|
122
125
|
const l4Reasons = [];
|
|
123
126
|
if (config.invariants === undefined) {
|
|
124
|
-
l4Reasons.push("no isolated invariant executor configured
|
|
127
|
+
l4Reasons.push("no isolated invariant executor configured - add `invariants.executor` in nifra.assurance.ts");
|
|
125
128
|
}
|
|
126
129
|
else {
|
|
127
130
|
const invariants = await runAdversarialContract(config.source, {
|
package/dist/levels-tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"levels-tool.js","sourceRoot":"","sources":["../src/levels-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":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E;IAEvF,MAAM,MAAM,GAAG,MAAM,yBAAyB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAC5D,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IAC9C,CAAC;SAAM,CAAC;QACN,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YACnC,MAAM,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;YAClC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,KAAK,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;YACtD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO;gBAAE,OAAO,CAAC,GAAG,CAAC,SAAS,MAAM,EAAE,CAAC,CAAA;QACrE,CAAC;QACD,OAAO,CAAC,GAAG,CACT,MAAM,CAAC,QAAQ,GAAG,CAAC;YACjB,CAAC,CAAC,+CAA+C;YACjD,CAAC,CAAC,gCAAgC,MAAM,CAAC,QAAQ,EAAE,CACtD,CAAA;IACH,CAAC;IACD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,CAAA;IAC5B,OAAO,MAAM,CAAC,QAAQ,IAAI,GAAG,CAAA;AAC/B,CAAC"}
|
package/dist/load.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A plugin list
|
|
2
|
+
* A plugin list - either an array, or a **thunk** that returns one (optionally async). Both forms are
|
|
3
3
|
* accepted; {@link resolvePlugins} normalizes them. The thunk is just a convenience for deferring a
|
|
4
|
-
* plugin's construction
|
|
4
|
+
* plugin's construction - it does NOT make a plugin edge-safe (Bun.build follows a dynamic `import()`
|
|
5
5
|
* even from an unused export, so a Vite/compiler import in an edge-bundled file fails regardless). Edge
|
|
6
6
|
* safety comes from WHERE the config lives: keep these fields in `nifra.config.ts` (CLI-only), not in
|
|
7
7
|
* the edge-imported `framework.ts`. See the module header.
|
|
8
8
|
*/
|
|
9
9
|
export type PluginsField = readonly unknown[] | (() => readonly unknown[] | Promise<readonly unknown[]>);
|
|
10
10
|
/**
|
|
11
|
-
* The CLI's framework wiring
|
|
11
|
+
* The CLI's framework wiring - exported from `nifra.config.ts` (or `framework.ts` as a fallback).
|
|
12
12
|
* `create-nifra` generates it. Only `adapter` + `clientModule` are required; the plugin/condition
|
|
13
13
|
* fields are framework-specific extras (Vue/Svelte/Solid need them; React/Preact don't).
|
|
14
14
|
*/
|
|
@@ -22,7 +22,7 @@ export interface NifraFramework {
|
|
|
22
22
|
/** Bun build plugins that compile routes for the CLIENT bundle (`nifra build`), e.g.
|
|
23
23
|
* `[vueBunPlugin("dom")]`. React/Preact JSX is Bun-native → none. */
|
|
24
24
|
readonly clientPlugins?: PluginsField;
|
|
25
|
-
/** Bun runtime plugins that compile routes for SSR
|
|
25
|
+
/** Bun runtime plugins that compile routes for SSR - `nifra dev` (Bun-native route import) and
|
|
26
26
|
* `nifra start` register them via `Bun.plugin`, e.g. `[vueBunPlugin("ssr")]`. React/Preact → none. */
|
|
27
27
|
readonly serverPlugins?: PluginsField;
|
|
28
28
|
/** Extra Bun.build / Vite resolve conditions, e.g. Solid's `["solid"]`. */
|
|
@@ -57,7 +57,7 @@ export interface LoadAppOptions {
|
|
|
57
57
|
readonly importQuery?: string;
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
* Root-level monorepo config
|
|
60
|
+
* Root-level monorepo config - exported from `nifra.config.ts` at the workspace root.
|
|
61
61
|
* Each key in `apps` is the short name used to namespace MCP tools (`nifra_<name>_context` etc.);
|
|
62
62
|
* each value is a path relative to the root that contains its own `nifra.config.ts` / `framework.ts`.
|
|
63
63
|
*
|
|
@@ -80,7 +80,7 @@ export interface NifraMonorepoConfig {
|
|
|
80
80
|
export declare function detectMonorepo(cwd: string, options?: LoadAppOptions): Promise<NifraMonorepoConfig | null>;
|
|
81
81
|
/**
|
|
82
82
|
* Load all apps declared in a monorepo config. Returns `{ name, cwd, app }[]` in declaration order.
|
|
83
|
-
* Individual app load failures throw
|
|
83
|
+
* Individual app load failures throw - each app must be valid.
|
|
84
84
|
*/
|
|
85
85
|
export declare function loadMonorepoApps(rootCwd: string, config: NifraMonorepoConfig): Promise<Array<{
|
|
86
86
|
name: string;
|
package/dist/load.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAkBA;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GACpB,SAAS,OAAO,EAAE,GAClB,CAAC,MAAM,SAAS,OAAO,EAAE,GAAG,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC,CAAA;AAE5D;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,6FAA6F;IAC7F,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,oGAAoG;IACpG,QAAQ,CAAC,WAAW,CAAC,EAAE,YAAY,CAAA;IACnC;yEACqE;IACrE,QAAQ,CAAC,aAAa,CAAC,EAAE,YAAY,CAAA;IACrC;0GACsG;IACtG,QAAQ,CAAC,aAAa,CAAC,EAAE,YAAY,CAAA;IACrC,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACvC,sEAAsE;IACtE,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAClD,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IACnC,wFAAwF;IACxF,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
|
package/dist/load.js
CHANGED
|
@@ -8,13 +8,13 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* Zero-config app discovery. The CLI reads a few conventions from the project root:
|
|
11
|
-
* - `routes/`
|
|
12
|
-
* - `nifra.config.ts`
|
|
11
|
+
* - `routes/` - the file-based routes (per `@nifrajs/web/fs`).
|
|
12
|
+
* - `nifra.config.ts` - the CLI's framework wiring (see {@link NifraFramework}); `framework.ts` is
|
|
13
13
|
* used as a fallback. One of the two is required.
|
|
14
|
-
* - `backend.ts`
|
|
14
|
+
* - `backend.ts` - exports `backend` (a `@nifrajs/core` server, the contract). Optional.
|
|
15
15
|
*
|
|
16
16
|
* Why two filenames: a multi-target app's edge entry (`_worker.ts`) imports `framework.ts` for the
|
|
17
|
-
* render adapter, so `framework.ts` must stay edge-bundlable
|
|
17
|
+
* render adapter, so `framework.ts` must stay edge-bundlable - it can't reference Vite plugins or the
|
|
18
18
|
* SFC compiler (Bun would pull them into the `target:"browser"` worker and fail on `child_process`).
|
|
19
19
|
* `nifra.config.ts` holds that build/dev tooling instead: it's imported ONLY by this CLI (which runs on
|
|
20
20
|
* Bun), so its Vite plugin + SFC-compiler imports (`@vitejs/plugin-vue`, `@nifrajs/web-vue/plugin`) never
|
|
@@ -64,7 +64,7 @@ export async function detectMonorepo(cwd, options = {}) {
|
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* Load all apps declared in a monorepo config. Returns `{ name, cwd, app }[]` in declaration order.
|
|
67
|
-
* Individual app load failures throw
|
|
67
|
+
* Individual app load failures throw - each app must be valid.
|
|
68
68
|
*/
|
|
69
69
|
export async function loadMonorepoApps(rootCwd, config) {
|
|
70
70
|
return Object.entries(config.apps).map(([name, rel]) => ({
|
|
@@ -92,12 +92,20 @@ export async function loadApp(cwd, outDirName = "dist", options = {}) {
|
|
|
92
92
|
" (create-nifra scaffolds this for you.)");
|
|
93
93
|
}
|
|
94
94
|
if (!existsSync(resolve(cwd, "routes"))) {
|
|
95
|
-
throw new Error(`[nifra] no routes/ directory in ${cwd}
|
|
95
|
+
throw new Error(`[nifra] no routes/ directory in ${cwd} - nifra apps are file-routed under routes/.`);
|
|
96
96
|
}
|
|
97
97
|
const fw = (await importWithQuery(configPath, options.importQuery));
|
|
98
98
|
if (!isAdapter(fw.adapter) || typeof fw.clientModule !== "string") {
|
|
99
99
|
throw new Error(`[nifra] ${configFile} must export \`adapter\` (a render adapter object) and \`clientModule\` (a string).`);
|
|
100
100
|
}
|
|
101
|
+
// A `clientModule` given as a RELATIVE path (a local client entry, e.g. `./src/client.tsx`) is
|
|
102
|
+
// resolved to absolute here. It is embedded verbatim as an import specifier in the generated client
|
|
103
|
+
// entry, and `nifra dev` and `nifra build` write that entry into DIFFERENT directories - so a relative
|
|
104
|
+
// specifier would resolve against different bases and load in one phase but not the other. A bare or
|
|
105
|
+
// package specifier (`@nifrajs/web-react/client`) is location-independent and passes through unchanged.
|
|
106
|
+
const clientModule = fw.clientModule.startsWith("./") || fw.clientModule.startsWith("../")
|
|
107
|
+
? resolve(cwd, fw.clientModule)
|
|
108
|
+
: fw.clientModule;
|
|
101
109
|
const [vitePlugins, clientPlugins, serverPlugins] = await Promise.all([
|
|
102
110
|
resolvePlugins(fw.vitePlugins),
|
|
103
111
|
resolvePlugins(fw.clientPlugins),
|
|
@@ -115,7 +123,7 @@ export async function loadApp(cwd, outDirName = "dist", options = {}) {
|
|
|
115
123
|
cwd,
|
|
116
124
|
routesDir: resolve(cwd, "routes"),
|
|
117
125
|
outDir: resolve(cwd, outDirName),
|
|
118
|
-
framework: fw,
|
|
126
|
+
framework: { ...fw, clientModule },
|
|
119
127
|
resolvedPlugins,
|
|
120
128
|
backend,
|
|
121
129
|
};
|
package/dist/load.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":";;;;;;;;A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C,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC;QAC/B,CAAC,CAAC,EAAE,CAAC,YAAY,CAAA;IACrB,MAAM,CAAC,WAAW,EAAE,aAAa,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACpE,cAAc,CAAC,EAAE,CAAC,WAAW,CAAC;QAC9B,cAAc,CAAC,EAAE,CAAC,aAAa,CAAC;QAChC,cAAc,CAAC,EAAE,CAAC,aAAa,CAAC;KACjC,CAAC,CAAA;IACF,MAAM,eAAe,GAAG,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,CAAA;IACrE,wBAAwB,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;IAErD,IAAI,OAAgB,CAAA;IACpB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;IAC9C,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAI,CAAC,MAAM,eAAe,CAAC,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,CAA2B;aAC3F,OAAO,CAAA;IACZ,CAAC;IAED,OAAO;QACL,GAAG;QACH,SAAS,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC;QACjC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC;QAChC,SAAS,EAAE,EAAE,GAAG,EAAE,EAAE,YAAY,EAAoB;QACpD,eAAe;QACf,OAAO;KACR,CAAA;AACH,CAAC"}
|
package/dist/manifest-tool.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** `nifra manifest`
|
|
1
|
+
/** `nifra manifest` - emit/sign/diff the deployable route trust artifact. */
|
|
2
2
|
import { type NifraManifestDiff } from "@nifrajs/core/manifest";
|
|
3
3
|
export declare const DEFAULT_MANIFEST_FILE = "nifra.manifest.json";
|
|
4
4
|
export declare function formatManifestDiff(diff: NifraManifestDiff): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-tool.d.ts","sourceRoot":"","sources":["../src/manifest-tool.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAK7E,OAAO,EAGL,KAAK,iBAAiB,EAKvB,MAAM,wBAAwB,CAAA;AAI/B,eAAO,MAAM,qBAAqB,wBAAwB,CAAA;AAE1D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAqBlE;AAED,sGAAsG;AACtG,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GACxF,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"manifest-tool.d.ts","sourceRoot":"","sources":["../src/manifest-tool.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAK7E,OAAO,EAGL,KAAK,iBAAiB,EAKvB,MAAM,wBAAwB,CAAA;AAI/B,eAAO,MAAM,qBAAqB,wBAAwB,CAAA;AAE1D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAqBlE;AAED,sGAAsG;AACtG,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GACxF,OAAO,CAAC,OAAO,CAAC,CAmClB;AAED,8FAA8F;AAC9F,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GACxC,OAAO,CAAC,OAAO,CAAC,CAelB"}
|
package/dist/manifest-tool.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** `nifra manifest`
|
|
1
|
+
/** `nifra manifest` - emit/sign/diff the deployable route trust artifact. */
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { evaluateRouteAssurance } from "@nifrajs/core/assurance";
|
|
@@ -24,7 +24,9 @@ export function formatManifestDiff(diff) {
|
|
|
24
24
|
/** Build only after both assurance layers pass, then optionally create an operator-signed sidecar. */
|
|
25
25
|
export async function runManifestEmit(cwd, options = {}) {
|
|
26
26
|
const config = await loadAssuranceConfig(cwd, options.config);
|
|
27
|
-
const assurance = evaluateRouteAssurance(config.source, config.policy
|
|
27
|
+
const assurance = evaluateRouteAssurance(config.source, config.policy, {
|
|
28
|
+
...(config.capabilities !== undefined ? { definitions: config.capabilities.definitions } : {}),
|
|
29
|
+
});
|
|
28
30
|
const capabilityProject = config.capabilities === undefined
|
|
29
31
|
? undefined
|
|
30
32
|
: await collectCapabilityProjectReport(cwd, config.source, config.capabilities);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-tool.js","sourceRoot":"","sources":["../src/manifest-tool.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAElB,kBAAkB,EAClB,sBAAsB,EACtB,+BAA+B,EAC/B,iBAAiB,GAClB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAA;AAEvE,MAA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,IAAI;QACnB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QACnF,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAC7B,CAAA;IACD,OAAO,CAAC,IAAI,CAAC,WAAW,CAAA;AAC1B,CAAC"}
|
package/dist/mcp-docs-tools.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The two project-INDEPENDENT MCP tools
|
|
2
|
+
* The two project-INDEPENDENT MCP tools - `nifra_docs` + `nifra_example` - as a single factory shared
|
|
3
3
|
* by every transport: the project stdio server ({@link projectTools}), the CLI HTTP server
|
|
4
4
|
* (`nifra docs-mcp`), and the site's Cloudflare-Pages worker (`/mcp`). The corpus source is injected as
|
|
5
5
|
* loaders, so the SAME tool definitions work whether the corpus comes from disk (`Bun.file`, on the
|