@nifrajs/cli 2.1.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 +64 -22
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +400 -83
- package/dist/check.js.map +1 -1
- package/dist/cli.d.ts +37 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +291 -53
- 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 +8 -4
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +74 -14
- package/dist/doctor.js.map +1 -1
- 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 +17 -6
- package/dist/load.d.ts.map +1 -1
- package/dist/load.js +45 -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.d.ts.map +1 -1
- package/dist/mcp-docs-tools.js +14 -10
- package/dist/mcp-docs-tools.js.map +1 -1
- 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 +15 -7
- package/dist/mcp-render.js.map +1 -1
- 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 +119 -47
- 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 +83 -0
- package/dist/pipeline-guard.d.ts.map +1 -0
- package/dist/pipeline-guard.js +136 -0
- package/dist/pipeline-guard.js.map +1 -0
- 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 +6 -6
- package/dist/types-search.d.ts.map +1 -1
- package/dist/types-search.js +53 -8
- package/dist/types-search.js.map +1 -1
- 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 +178 -88
- package/docs/llms-full.txt +1766 -766
- package/docs/types.json +2171 -2807
- package/package.json +22 -11
- package/src/assure.ts +17 -18
- package/src/capabilities-tool.ts +82 -16
- package/src/check.ts +493 -100
- package/src/cli.ts +306 -54
- package/src/diff-tool.ts +8 -8
- package/src/docs-search.ts +6 -6
- package/src/doctor.ts +81 -16
- 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 +65 -12
- package/src/manifest-tool.ts +4 -2
- package/src/mcp-docs-tools.ts +20 -10
- package/src/mcp-http.ts +7 -7
- package/src/mcp-protocol.ts +2 -2
- package/src/mcp-render.ts +15 -7
- package/src/mcp-run.ts +2 -2
- package/src/mcp.ts +127 -47
- package/src/openapi-tool.ts +2 -2
- package/src/pipeline-guard.ts +186 -0
- 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 +57 -8
- package/src/upgrade.ts +12 -12
- package/src/verification.ts +123 -0
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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E,CACF;KACF,CAAC,CAAA;AACJ,CAAC;AAED,2FAA2F;AAC3F,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,GAAW,EACX,UAAqF,EAAE;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,22 +22,33 @@ 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"]`. */
|
|
29
29
|
readonly conditions?: readonly string[];
|
|
30
30
|
/** Compile-time `define` replacements, e.g. Vue's `__VUE_*` flags. */
|
|
31
31
|
readonly define?: Readonly<Record<string, string>>;
|
|
32
|
+
/** Static files directory. Defaults to `<app>/public`; `false` disables it. */
|
|
33
|
+
readonly publicDir?: string | false;
|
|
34
|
+
/** Client-visible environment prefix (default `"PUBLIC_"`; empty disables exposure). */
|
|
35
|
+
readonly publicEnvPrefix?: string;
|
|
32
36
|
}
|
|
33
37
|
/** Normalize a {@link PluginsField} (array | thunk | undefined) to a fresh array, awaiting a thunk. */
|
|
34
38
|
export declare function resolvePlugins(field: PluginsField | undefined): Promise<unknown[]>;
|
|
39
|
+
export interface ResolvedPlugins {
|
|
40
|
+
readonly vitePlugins: readonly unknown[];
|
|
41
|
+
readonly clientPlugins: readonly unknown[];
|
|
42
|
+
readonly serverPlugins: readonly unknown[];
|
|
43
|
+
}
|
|
35
44
|
export interface LoadedApp {
|
|
36
45
|
readonly cwd: string;
|
|
37
46
|
readonly routesDir: string;
|
|
38
47
|
/** Build output dir (also where `nifra start` reads `manifest.json` + serves `/assets/*`). */
|
|
39
48
|
readonly outDir: string;
|
|
40
49
|
readonly framework: NifraFramework;
|
|
50
|
+
/** Plugin thunks resolved exactly once during app loading and reused by every command phase. */
|
|
51
|
+
readonly resolvedPlugins: ResolvedPlugins;
|
|
41
52
|
/** The `backend` export from `backend.ts`, or `undefined` if there's no `backend.ts`. */
|
|
42
53
|
readonly backend: unknown;
|
|
43
54
|
}
|
|
@@ -46,7 +57,7 @@ export interface LoadAppOptions {
|
|
|
46
57
|
readonly importQuery?: string;
|
|
47
58
|
}
|
|
48
59
|
/**
|
|
49
|
-
* Root-level monorepo config
|
|
60
|
+
* Root-level monorepo config - exported from `nifra.config.ts` at the workspace root.
|
|
50
61
|
* Each key in `apps` is the short name used to namespace MCP tools (`nifra_<name>_context` etc.);
|
|
51
62
|
* each value is a path relative to the root that contains its own `nifra.config.ts` / `framework.ts`.
|
|
52
63
|
*
|
|
@@ -69,7 +80,7 @@ export interface NifraMonorepoConfig {
|
|
|
69
80
|
export declare function detectMonorepo(cwd: string, options?: LoadAppOptions): Promise<NifraMonorepoConfig | null>;
|
|
70
81
|
/**
|
|
71
82
|
* Load all apps declared in a monorepo config. Returns `{ name, cwd, app }[]` in declaration order.
|
|
72
|
-
* Individual app load failures throw
|
|
83
|
+
* Individual app load failures throw - each app must be valid.
|
|
73
84
|
*/
|
|
74
85
|
export declare function loadMonorepoApps(rootCwd: string, config: NifraMonorepoConfig): Promise<Array<{
|
|
75
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":"
|
|
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,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAClC;AAyBD,uGAAuG;AACvG,wBAAsB,cAAc,CAAC,KAAK,EAAE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M,EACX,UAAU,SAAS,EACnB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,SAAS,CAAC,CA4DpB"}
|
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
|
|
@@ -22,6 +22,28 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
22
22
|
*/
|
|
23
23
|
import { existsSync } from "node:fs";
|
|
24
24
|
import { resolve } from "node:path";
|
|
25
|
+
import { checkPipelineSeparation } from "./pipeline-guard.js";
|
|
26
|
+
/**
|
|
27
|
+
* Refuse a config that puts one pipeline's plugins into the other's slot.
|
|
28
|
+
*
|
|
29
|
+
* Checked here rather than in `nifra check`, which holds a deliberate pre-`loadApp` invariant - reading
|
|
30
|
+
* plugins means importing the app's config, which is code execution. This runs at the moment the app
|
|
31
|
+
* IS loaded, so `dev`, `build` and `start` are all covered from one place, immediately before the
|
|
32
|
+
* plugins are handed to a bundler.
|
|
33
|
+
*
|
|
34
|
+
* Throws rather than warns. A misplaced plugin does not fail the build: Bun.build has no `transform`
|
|
35
|
+
* hook and Vite never calls `setup`, so the wrong-slot plugin is accepted and silently never invoked -
|
|
36
|
+
* the transform just does not happen, and the output looks plausible. A loud stop with the exact move
|
|
37
|
+
* is strictly better than a build that succeeds and omits the work. The classifier only fires on a
|
|
38
|
+
* decisive hook shape, so a plugin it cannot place is left alone.
|
|
39
|
+
*/
|
|
40
|
+
function assertPipelineSeparation(plugins, configFile) {
|
|
41
|
+
const mismatches = checkPipelineSeparation(plugins);
|
|
42
|
+
if (mismatches.length === 0)
|
|
43
|
+
return;
|
|
44
|
+
throw new Error(`[nifra] ${configFile}: plugins are in the wrong pipeline slot. nifra supports Vite and Bun, but a phase is owned by ONE of them - a plugin in the wrong slot is silently never called.\n\n` +
|
|
45
|
+
mismatches.map((m) => ` - ${m.fix}`).join("\n"));
|
|
46
|
+
}
|
|
25
47
|
/** Normalize a {@link PluginsField} (array | thunk | undefined) to a fresh array, awaiting a thunk. */
|
|
26
48
|
export async function resolvePlugins(field) {
|
|
27
49
|
const value = typeof field === "function" ? await field() : field;
|
|
@@ -42,7 +64,7 @@ export async function detectMonorepo(cwd, options = {}) {
|
|
|
42
64
|
}
|
|
43
65
|
/**
|
|
44
66
|
* Load all apps declared in a monorepo config. Returns `{ name, cwd, app }[]` in declaration order.
|
|
45
|
-
* Individual app load failures throw
|
|
67
|
+
* Individual app load failures throw - each app must be valid.
|
|
46
68
|
*/
|
|
47
69
|
export async function loadMonorepoApps(rootCwd, config) {
|
|
48
70
|
return Object.entries(config.apps).map(([name, rel]) => ({
|
|
@@ -70,12 +92,27 @@ export async function loadApp(cwd, outDirName = "dist", options = {}) {
|
|
|
70
92
|
" (create-nifra scaffolds this for you.)");
|
|
71
93
|
}
|
|
72
94
|
if (!existsSync(resolve(cwd, "routes"))) {
|
|
73
|
-
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/.`);
|
|
74
96
|
}
|
|
75
97
|
const fw = (await importWithQuery(configPath, options.importQuery));
|
|
76
98
|
if (!isAdapter(fw.adapter) || typeof fw.clientModule !== "string") {
|
|
77
99
|
throw new Error(`[nifra] ${configFile} must export \`adapter\` (a render adapter object) and \`clientModule\` (a string).`);
|
|
78
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;
|
|
109
|
+
const [vitePlugins, clientPlugins, serverPlugins] = await Promise.all([
|
|
110
|
+
resolvePlugins(fw.vitePlugins),
|
|
111
|
+
resolvePlugins(fw.clientPlugins),
|
|
112
|
+
resolvePlugins(fw.serverPlugins),
|
|
113
|
+
]);
|
|
114
|
+
const resolvedPlugins = { vitePlugins, clientPlugins, serverPlugins };
|
|
115
|
+
assertPipelineSeparation(resolvedPlugins, configFile);
|
|
79
116
|
let backend;
|
|
80
117
|
const backendPath = resolve(cwd, "backend.ts");
|
|
81
118
|
if (existsSync(backendPath)) {
|
|
@@ -86,7 +123,8 @@ export async function loadApp(cwd, outDirName = "dist", options = {}) {
|
|
|
86
123
|
cwd,
|
|
87
124
|
routesDir: resolve(cwd, "routes"),
|
|
88
125
|
outDir: resolve(cwd, outDirName),
|
|
89
|
-
framework: fw,
|
|
126
|
+
framework: { ...fw, clientModule },
|
|
127
|
+
resolvedPlugins,
|
|
90
128
|
backend,
|
|
91
129
|
};
|
|
92
130
|
}
|
package/dist/load.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":";;;;;;;;AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":";;;;;;;;AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AA0C7D;;;;;;;;;;;;;GAaG;AACH,SAAS,wBAAwB,CAAC,OAAwB,EAAE,UAAkB;IAC5E,MAAM,UAAU,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAA;IACnD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAM;IACnC,MAAM,IAAI,KAAK,CACb,WAAW,UAAU,uKAAuK;QAC1L,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CACnD,CAAA;AACH,CAAC;AAED,uGAAuG;AACvG,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAA+B;IAClE,MAAM,KAAK,GAAG,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;IACjE,OAAO,KAAK,CAAC,CAAC,CAAC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,MAAM,YAAY,GAChB,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC;QACnE,CAAC,CAAC,OAAO,CAAC,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,i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,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAC9D,CAAA;IACD,OAAO,CAAC,GAAG,CACT,OAAO,CAAC,IAAI,KAAK,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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-docs-tools.d.ts","sourceRoot":"","sources":["../src/mcp-docs-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,KAAK,OAAO,EAAwB,MAAM,eAAe,CAAA;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAKrE,yFAAyF;AACzF,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,EAC3C,YAAY,EAAE,MAAM,OAAO,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,EAClD,SAAS,EAAE,MAAM,OAAO,CAAC,SAAS,EAAE,GAAG,SAAS,CAAC,GAChD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"mcp-docs-tools.d.ts","sourceRoot":"","sources":["../src/mcp-docs-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,KAAK,OAAO,EAAwB,MAAM,eAAe,CAAA;AAClE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAKrE,yFAAyF;AACzF,wBAAgB,SAAS,CACvB,QAAQ,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,EAC3C,YAAY,EAAE,MAAM,OAAO,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,EAClD,SAAS,EAAE,MAAM,OAAO,CAAC,SAAS,EAAE,GAAG,SAAS,CAAC,GAChD,OAAO,EAAE,CA8FX"}
|
package/dist/mcp-docs-tools.js
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
|
|
@@ -15,7 +15,7 @@ export function docsTools(loadDocs, loadExamples, loadTypes) {
|
|
|
15
15
|
return [
|
|
16
16
|
{
|
|
17
17
|
name: "nifra_docs",
|
|
18
|
-
description: "Search nifra's framework documentation and get back ONLY the matching sections
|
|
18
|
+
description: "Search nifra's framework documentation and get back ONLY the matching sections - auth, uploads, ISR, WebSockets, loaders, deployment, anything. Call with no query for the cheap section index; pass query (e.g. \"isr revalidate\") for the top matching sections. Use this instead of reading llms-full.txt (~150 KB) whole. For the EXACT TypeScript of a type/interface/function, call nifra_types instead (don't read .d.ts files).",
|
|
19
19
|
inputSchema: {
|
|
20
20
|
type: "object",
|
|
21
21
|
properties: {
|
|
@@ -30,7 +30,7 @@ export function docsTools(loadDocs, loadExamples, loadTypes) {
|
|
|
30
30
|
handler: async (args) => {
|
|
31
31
|
const corpus = await loadDocs();
|
|
32
32
|
if (corpus === undefined) {
|
|
33
|
-
return "docs corpus missing
|
|
33
|
+
return "docs corpus missing - run `bun run gen:llms` in the nifra repo (published builds ship it).";
|
|
34
34
|
}
|
|
35
35
|
const { query, limit } = args;
|
|
36
36
|
return renderDocsResult(corpus, query, clamp(limit, 1, 5, 3));
|
|
@@ -38,7 +38,7 @@ export function docsTools(loadDocs, loadExamples, loadTypes) {
|
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
name: "nifra_example",
|
|
41
|
-
description: 'Get a VERIFIED, copy-pasteable nifra code example for a task
|
|
41
|
+
description: 'Get a VERIFIED, copy-pasteable nifra code example for a task - auth route, file upload, ISR page, loader/action, typed client, SSE, deployment, etc. Every snippet is typechecked against the installed nifra version, so it compiles as-is. PREFER THIS over writing nifra code from memory (training data drifts). Call with no query for the grouped index; pass query (e.g. "protected route", "upload", "isr revalidate") for matching snippets.',
|
|
42
42
|
inputSchema: {
|
|
43
43
|
type: "object",
|
|
44
44
|
properties: {
|
|
@@ -53,7 +53,7 @@ export function docsTools(loadDocs, loadExamples, loadTypes) {
|
|
|
53
53
|
handler: async (args) => {
|
|
54
54
|
const corpus = await loadExamples();
|
|
55
55
|
if (corpus === undefined) {
|
|
56
|
-
return "examples corpus missing
|
|
56
|
+
return "examples corpus missing - run `bun run gen:llms` in the nifra repo (published builds ship it).";
|
|
57
57
|
}
|
|
58
58
|
const { query, limit } = args;
|
|
59
59
|
return renderExamplesResult(corpus, query, clamp(limit, 1, 5, 3));
|
|
@@ -61,13 +61,13 @@ export function docsTools(loadDocs, loadExamples, loadTypes) {
|
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
name: "nifra_types",
|
|
64
|
-
description: 'Get the EXACT TypeScript declaration of any exported @nifrajs/* symbol
|
|
64
|
+
description: 'Get the EXACT TypeScript declaration of any exported @nifrajs/* symbol - interface, type, class, function, const. Each signature is generated from the package\'s built .d.ts, so it is the LITERAL declaration: complete, authoritative, never prose and never truncated. THIS IS THE SOURCE OF TRUTH for nifra\'s types - do NOT read node_modules/@nifrajs/**/*.d.ts; call this instead. Pass `name` for an exact symbol (e.g. "RateLimitStore", "RouteSchema", "Context", "rateLimit"); pass `query` to search by keyword; omit both for the per-package index of names. A `name` lookup is always the complete declaration; a `query` returns a one-line summary plus the signature, collapsing an oversized body - pass `full: true` to override.',
|
|
65
65
|
inputSchema: {
|
|
66
66
|
type: "object",
|
|
67
67
|
properties: {
|
|
68
68
|
name: {
|
|
69
69
|
type: "string",
|
|
70
|
-
description: "Exact symbol name
|
|
70
|
+
description: "Exact symbol name - returns its literal declaration (e.g. RateLimitStore).",
|
|
71
71
|
},
|
|
72
72
|
query: {
|
|
73
73
|
type: "string",
|
|
@@ -77,16 +77,20 @@ export function docsTools(loadDocs, loadExamples, loadTypes) {
|
|
|
77
77
|
type: "number",
|
|
78
78
|
description: "Max results for a query/search (default 5, max 8).",
|
|
79
79
|
},
|
|
80
|
+
full: {
|
|
81
|
+
type: "boolean",
|
|
82
|
+
description: "Query mode only: return whole declarations instead of collapsed ones. Off by default - a search is for picking a symbol, and one match can be tens of thousands of characters.",
|
|
83
|
+
},
|
|
80
84
|
},
|
|
81
85
|
additionalProperties: false,
|
|
82
86
|
},
|
|
83
87
|
handler: async (args) => {
|
|
84
88
|
const corpus = await loadTypes();
|
|
85
89
|
if (corpus === undefined) {
|
|
86
|
-
return "types corpus missing
|
|
90
|
+
return "types corpus missing - run `bun run build && bun run gen:llms` in the nifra repo (published builds ship it).";
|
|
87
91
|
}
|
|
88
|
-
const { name, query, limit } = args;
|
|
89
|
-
return renderTypesResult(corpus, name, query, clamp(limit, 1, 8, 5));
|
|
92
|
+
const { name, query, limit, full } = args;
|
|
93
|
+
return renderTypesResult(corpus, name, query, clamp(limit, 1, 8, 5), full === true);
|
|
90
94
|
},
|
|
91
95
|
},
|
|
92
96
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-docs-tools.js","sourceRoot":"","sources":["../src/mcp-docs-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAgB,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAElE,OAAO,EAAE,iBAAiB,EAAkB,MAAM,mBAAmB,CAAA;AAErE,MAAM,KAAK,GAAG,CAAC,CAAqB,EAAE,EAAU,EAAE,EAAU,EAAE,IAAY,EAAU,EAAE,CACpF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;AAE9D,yFAAyF;AACzF,MAAM,UAAU,SAAS,CACvB,QAA2C,EAC3C,YAAkD,EAClD,SAAiD;IAEjD,OAAO;QACL;YACE,IAAI,EAAE,YAAY;YAClB,WAAW,EACT,0aAA0a;YAC5a,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,8DAA8D;qBAC5E;oBACD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4CAA4C,EAAE;iBACrF;gBACD,oBAAoB,EAAE,KAAK;aAC5B;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;gBACtB,MAAM,MAAM,GAAG,MAAM,QAAQ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EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAKpC,CAAA;gBACD,OAAO,iBAAiB,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC,CAAA;YACrF,CAAC;SACF;KACF,CAAA;AACH,CAAC"}
|
package/dist/mcp-http.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The PUBLIC nifra docs MCP
|
|
2
|
+
* The PUBLIC nifra docs MCP - Streamable-HTTP transport exposing the project-INDEPENDENT tools
|
|
3
3
|
* (`nifra_docs` + `nifra_example`) so any remote AI agent can learn nifra without a local checkout.
|
|
4
4
|
* Both tools read the bundled corpus (llms-full.txt / examples.json shipped in this package) and ignore
|
|
5
|
-
* `cwd`, so they reuse the exact definitions from {@link projectTools}
|
|
5
|
+
* `cwd`, so they reuse the exact definitions from {@link projectTools} - one source, no drift.
|
|
6
6
|
*
|
|
7
7
|
* The transport itself (body cap, CORS, JSON-RPC dispatch) lives in `@nifrajs/mcp/http`; this module is
|
|
8
8
|
* the docs-specific layer over it: it supplies the bundled corpus tools and the `nifra-docs` server info.
|
|
9
|
-
* {@link handleMcpHttp} self-hosts ANYWHERE Bun runs
|
|
10
|
-
* same handler runs on Cloudflare/Vercel edge (there inline the corpus as string imports
|
|
9
|
+
* {@link handleMcpHttp} self-hosts ANYWHERE Bun runs - the simplest path is `nifra docs-mcp` on a VPS; the
|
|
10
|
+
* same handler runs on Cloudflare/Vercel edge (there inline the corpus as string imports - a Worker has no
|
|
11
11
|
* filesystem). `export default { port, fetch }` also lets `bun run mcp-http.ts` serve it directly.
|
|
12
12
|
*/
|
|
13
13
|
import { type McpHttpOptions } from "@nifrajs/mcp/http";
|
|
@@ -29,7 +29,7 @@ export declare function handleMcpHttp(request: Request): Promise<Response>;
|
|
|
29
29
|
/**
|
|
30
30
|
* Worker/edge + local entry. `export default { fetch }` is the universal server shape: Cloudflare /
|
|
31
31
|
* Vercel edge / Deno deploy use `fetch` (and ignore `port`); `bun run mcp-http.ts` auto-serves it on
|
|
32
|
-
* `port` (PORT env, default 8787)
|
|
32
|
+
* `port` (PORT env, default 8787) - Bun serves a module's default-exported server, so NO manual
|
|
33
33
|
* `Bun.serve` here (that would double-bind the port).
|
|
34
34
|
*/
|
|
35
35
|
declare const _default: {
|
package/dist/mcp-http.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The PUBLIC nifra docs MCP
|
|
2
|
+
* The PUBLIC nifra docs MCP - Streamable-HTTP transport exposing the project-INDEPENDENT tools
|
|
3
3
|
* (`nifra_docs` + `nifra_example`) so any remote AI agent can learn nifra without a local checkout.
|
|
4
4
|
* Both tools read the bundled corpus (llms-full.txt / examples.json shipped in this package) and ignore
|
|
5
|
-
* `cwd`, so they reuse the exact definitions from {@link projectTools}
|
|
5
|
+
* `cwd`, so they reuse the exact definitions from {@link projectTools} - one source, no drift.
|
|
6
6
|
*
|
|
7
7
|
* The transport itself (body cap, CORS, JSON-RPC dispatch) lives in `@nifrajs/mcp/http`; this module is
|
|
8
8
|
* the docs-specific layer over it: it supplies the bundled corpus tools and the `nifra-docs` server info.
|
|
9
|
-
* {@link handleMcpHttp} self-hosts ANYWHERE Bun runs
|
|
10
|
-
* same handler runs on Cloudflare/Vercel edge (there inline the corpus as string imports
|
|
9
|
+
* {@link handleMcpHttp} self-hosts ANYWHERE Bun runs - the simplest path is `nifra docs-mcp` on a VPS; the
|
|
10
|
+
* same handler runs on Cloudflare/Vercel edge (there inline the corpus as string imports - a Worker has no
|
|
11
11
|
* filesystem). `export default { port, fetch }` also lets `bun run mcp-http.ts` serve it directly.
|
|
12
12
|
*/
|
|
13
13
|
import { respondMcpHttp as respondMcpHttpCore } from "@nifrajs/mcp/http";
|
|
@@ -19,9 +19,9 @@ import { loadTypesCorpus } from "./types-search.js";
|
|
|
19
19
|
// tool factory + the transport core from one entry: `import { respondMcpHttp, docsTools } from "@nifrajs/cli/mcp"`.
|
|
20
20
|
export { docsTools } from "./mcp-docs-tools.js";
|
|
21
21
|
// Kept in lockstep with packages/cli/package.json by check:publish's version-consistency gate.
|
|
22
|
-
const VERSION = "2.
|
|
22
|
+
const VERSION = "2.3.0";
|
|
23
23
|
const SERVER_INFO = { name: "nifra-docs", version: VERSION };
|
|
24
|
-
const DOCS_HEALTH = "nifra docs MCP
|
|
24
|
+
const DOCS_HEALTH = "nifra docs MCP - POST JSON-RPC 2.0 here (methods: initialize, tools/list, tools/call). Tools: nifra_docs, nifra_example.";
|
|
25
25
|
/** The two project-independent tools, reading the package's bundled corpus from disk (CLI use). */
|
|
26
26
|
export function publicDocsTools() {
|
|
27
27
|
return docsTools(loadDocsCorpus, loadExamplesCorpus, loadTypesCorpus);
|
|
@@ -41,7 +41,7 @@ export function handleMcpHttp(request) {
|
|
|
41
41
|
/**
|
|
42
42
|
* Worker/edge + local entry. `export default { fetch }` is the universal server shape: Cloudflare /
|
|
43
43
|
* Vercel edge / Deno deploy use `fetch` (and ignore `port`); `bun run mcp-http.ts` auto-serves it on
|
|
44
|
-
* `port` (PORT env, default 8787)
|
|
44
|
+
* `port` (PORT env, default 8787) - Bun serves a module's default-exported server, so NO manual
|
|
45
45
|
* `Bun.serve` here (that would double-bind the port).
|
|
46
46
|
*/
|
|
47
47
|
export default {
|
package/dist/mcp-protocol.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The MCP JSON-RPC dispatch now lives in `@nifrajs/mcp` (shared with nifra apps that expose their own
|
|
3
|
-
* MCP server / MCP Apps widgets). This module is a thin re-export so the CLI's existing imports
|
|
4
|
-
* the `@nifrajs/cli/mcp` self-host surface
|
|
3
|
+
* MCP server / MCP Apps widgets). This module is a thin re-export so the CLI's existing imports - and
|
|
4
|
+
* the `@nifrajs/cli/mcp` self-host surface - keep resolving here unchanged.
|
|
5
5
|
*/
|
|
6
6
|
export * from "@nifrajs/mcp/protocol";
|
|
7
7
|
//# sourceMappingURL=mcp-protocol.d.ts.map
|