@nifrajs/cli 2.2.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/README.md +25 -25
  2. package/dist/assure.d.ts +2 -2
  3. package/dist/assure.d.ts.map +1 -1
  4. package/dist/assure.js +17 -10
  5. package/dist/assure.js.map +1 -1
  6. package/dist/capabilities-tool.d.ts +7 -0
  7. package/dist/capabilities-tool.d.ts.map +1 -1
  8. package/dist/capabilities-tool.js +68 -16
  9. package/dist/capabilities-tool.js.map +1 -1
  10. package/dist/check.d.ts +61 -22
  11. package/dist/check.d.ts.map +1 -1
  12. package/dist/check.js +336 -87
  13. package/dist/check.js.map +1 -1
  14. package/dist/cli.d.ts +30 -2
  15. package/dist/cli.d.ts.map +1 -1
  16. package/dist/cli.js +148 -39
  17. package/dist/cli.js.map +1 -1
  18. package/dist/diff-tool.d.ts +3 -3
  19. package/dist/diff-tool.js +7 -7
  20. package/dist/docs-search.d.ts +3 -3
  21. package/dist/docs-search.js +6 -6
  22. package/dist/doctor.d.ts +3 -3
  23. package/dist/doctor.d.ts.map +1 -1
  24. package/dist/doctor.js +12 -8
  25. package/dist/doctor.js.map +1 -1
  26. package/dist/examples.d.ts +5 -5
  27. package/dist/examples.js +5 -5
  28. package/dist/init-agents.d.ts +14 -14
  29. package/dist/init-agents.js +14 -14
  30. package/dist/internal/typescript-import.d.ts +24 -0
  31. package/dist/internal/typescript-import.d.ts.map +1 -0
  32. package/dist/internal/typescript-import.js +32 -0
  33. package/dist/internal/typescript-import.js.map +1 -0
  34. package/dist/introspect.d.ts +12 -12
  35. package/dist/introspect.js +24 -24
  36. package/dist/learn.d.ts +32 -0
  37. package/dist/learn.d.ts.map +1 -0
  38. package/dist/learn.js +127 -0
  39. package/dist/learn.js.map +1 -0
  40. package/dist/levels-tool.d.ts +8 -8
  41. package/dist/levels-tool.d.ts.map +1 -1
  42. package/dist/levels-tool.js +33 -30
  43. package/dist/levels-tool.js.map +1 -1
  44. package/dist/load.d.ts +6 -6
  45. package/dist/load.d.ts.map +1 -1
  46. package/dist/load.js +15 -7
  47. package/dist/load.js.map +1 -1
  48. package/dist/manifest-tool.d.ts +1 -1
  49. package/dist/manifest-tool.d.ts.map +1 -1
  50. package/dist/manifest-tool.js +4 -2
  51. package/dist/manifest-tool.js.map +1 -1
  52. package/dist/mcp-app-tool.d.ts +14 -0
  53. package/dist/mcp-app-tool.d.ts.map +1 -0
  54. package/dist/mcp-app-tool.js +80 -0
  55. package/dist/mcp-app-tool.js.map +1 -0
  56. package/dist/mcp-docs-tools.d.ts +1 -1
  57. package/dist/mcp-docs-tools.d.ts.map +1 -1
  58. package/dist/mcp-docs-tools.js +25 -9
  59. package/dist/mcp-docs-tools.js.map +1 -1
  60. package/dist/mcp-http.d.ts +14 -10
  61. package/dist/mcp-http.d.ts.map +1 -1
  62. package/dist/mcp-http.js +30 -16
  63. package/dist/mcp-http.js.map +1 -1
  64. package/dist/mcp-protocol.d.ts +2 -2
  65. package/dist/mcp-protocol.js +2 -2
  66. package/dist/mcp-render.d.ts +3 -3
  67. package/dist/mcp-render.js +6 -6
  68. package/dist/mcp-run.d.ts +2 -2
  69. package/dist/mcp-run.js +2 -2
  70. package/dist/mcp.d.ts +28 -14
  71. package/dist/mcp.d.ts.map +1 -1
  72. package/dist/mcp.js +263 -45
  73. package/dist/mcp.js.map +1 -1
  74. package/dist/openapi-tool.d.ts +1 -1
  75. package/dist/openapi-tool.js +2 -2
  76. package/dist/pipeline-guard.d.ts +1 -1
  77. package/dist/pipeline-guard.js +1 -1
  78. package/dist/port.d.ts +9 -9
  79. package/dist/port.js +27 -27
  80. package/dist/recipes/1.8.0.d.ts +2 -2
  81. package/dist/recipes/1.8.0.js +5 -5
  82. package/dist/recipes/index.d.ts +2 -2
  83. package/dist/recipes/index.js +1 -1
  84. package/dist/scaffold.d.ts +3 -3
  85. package/dist/scaffold.js +8 -8
  86. package/dist/sync-routes.d.ts +28 -0
  87. package/dist/sync-routes.d.ts.map +1 -0
  88. package/dist/sync-routes.js +55 -0
  89. package/dist/sync-routes.js.map +1 -0
  90. package/dist/types-search.d.ts +5 -5
  91. package/dist/types-search.js +7 -7
  92. package/dist/upgrade.d.ts +20 -9
  93. package/dist/upgrade.d.ts.map +1 -1
  94. package/dist/upgrade.js +117 -19
  95. package/dist/upgrade.js.map +1 -1
  96. package/dist/verification.d.ts +51 -0
  97. package/dist/verification.d.ts.map +1 -0
  98. package/dist/verification.js +80 -0
  99. package/dist/verification.js.map +1 -0
  100. package/docs/examples.json +174 -90
  101. package/docs/llms-full.txt +1771 -748
  102. package/docs/types.json +2027 -3089
  103. package/package.json +22 -11
  104. package/src/assure.ts +17 -18
  105. package/src/capabilities-tool.ts +82 -16
  106. package/src/check.ts +410 -104
  107. package/src/cli.ts +161 -41
  108. package/src/diff-tool.ts +8 -8
  109. package/src/docs-search.ts +6 -6
  110. package/src/doctor.ts +18 -10
  111. package/src/examples.ts +7 -7
  112. package/src/init-agents.ts +17 -17
  113. package/src/internal/typescript-import.ts +33 -0
  114. package/src/introspect.ts +28 -28
  115. package/src/learn.ts +152 -0
  116. package/src/levels-tool.ts +37 -31
  117. package/src/load.ts +21 -12
  118. package/src/manifest-tool.ts +4 -2
  119. package/src/mcp-app-tool.ts +86 -0
  120. package/src/mcp-docs-tools.ts +26 -9
  121. package/src/mcp-http.ts +31 -18
  122. package/src/mcp-protocol.ts +2 -2
  123. package/src/mcp-render.ts +6 -6
  124. package/src/mcp-run.ts +2 -2
  125. package/src/mcp.ts +319 -45
  126. package/src/openapi-tool.ts +2 -2
  127. package/src/pipeline-guard.ts +1 -1
  128. package/src/port.ts +31 -31
  129. package/src/recipes/1.8.0.ts +5 -5
  130. package/src/recipes/index.ts +2 -2
  131. package/src/scaffold.ts +8 -8
  132. package/src/sync-routes.ts +69 -0
  133. package/src/types-search.ts +8 -8
  134. package/src/upgrade.ts +137 -19
  135. package/src/verification.ts +123 -0
package/dist/load.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  /**
2
- * A plugin list — either an array, or a **thunk** that returns one (optionally async). Both forms are
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 — it does NOT make a plugin edge-safe (Bun.build follows a dynamic `import()`
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 — exported from `nifra.config.ts` (or `framework.ts` as a fallback).
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 — `nifra dev` (Bun-native route import) and
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 — exported from `nifra.config.ts` at the workspace root.
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 — each app must be valid.
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;
@@ -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,C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O,CAC3B,GAAG,EAAE,MAAM,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/` — the file-based routes (per `@nifrajs/web/fs`).
12
- * - `nifra.config.ts` — the CLI's framework wiring (see {@link NifraFramework}); `framework.ts` is
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` — exports `backend` (a `@nifrajs/core` server, the contract). Optional.
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 — it can't reference Vite plugins or the
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 — each app must be valid.
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} — nifra apps are file-routed under routes/.`);
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":";;;;;;;;AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,uBAAuB,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AAE,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"}
@@ -1,4 +1,4 @@
1
- /** `nifra manifest` — emit/sign/diff the deployable route trust artifact. */
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,eA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AAO,GAAE;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GACxC,OAAO,CAAC,OAAO,CAAC,CAelB"}
@@ -1,4 +1,4 @@
1
- /** `nifra manifest` — emit/sign/diff the deployable route trust artifact. */
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,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CAAA;AAE1D,MAAM,UAAU,kBAAkB,CAA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G,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"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The `nifra_examples_app` MCP tool: nifra's verified code examples as an MCP Apps widget. It returns the
3
+ * examples as `structuredContent`, rendered by the {@link examplesWidget} `ui://` widget in MCP Apps hosts
4
+ * (ChatGPT Apps, MCPJam, Goose); text-only hosts still get the example names as plain text. Part of the
5
+ * public docs-MCP tool set (served by `handleMcpHttp`), so every self-host gets it from one definition.
6
+ * `loadExamples` is injected, so the same tool reads the corpus from disk (CLI) or a cached fetch (edge).
7
+ */
8
+ import { type McpTool } from "@nifrajs/mcp";
9
+ import type { Example } from "./examples.js";
10
+ /** The widget: renders `structuredContent.examples` as a filterable list of example cards. */
11
+ export declare const examplesWidget: import("@nifrajs/mcp").McpWidget;
12
+ /** The widget-backed tool. `loadExamples` is injected (disk on the CLI, cached fetch on the edge). */
13
+ export declare function examplesAppTool(loadExamples: () => Promise<Example[] | undefined>): McpTool;
14
+ //# sourceMappingURL=mcp-app-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-app-tool.d.ts","sourceRoot":"","sources":["../src/mcp-app-tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAkC,KAAK,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAE5C,8FAA8F;AAC9F,eAAO,MAAM,cAAc,kCAoCzB,CAAA;AAEF,sGAAsG;AACtG,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,OAAO,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,GAAG,OAAO,CAmC3F"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * The `nifra_examples_app` MCP tool: nifra's verified code examples as an MCP Apps widget. It returns the
3
+ * examples as `structuredContent`, rendered by the {@link examplesWidget} `ui://` widget in MCP Apps hosts
4
+ * (ChatGPT Apps, MCPJam, Goose); text-only hosts still get the example names as plain text. Part of the
5
+ * public docs-MCP tool set (served by `handleMcpHttp`), so every self-host gets it from one definition.
6
+ * `loadExamples` is injected, so the same tool reads the corpus from disk (CLI) or a cached fetch (edge).
7
+ */
8
+ import { defineMcpTool, defineMcpWidget } from "@nifrajs/mcp";
9
+ /** The widget: renders `structuredContent.examples` as a filterable list of example cards. */
10
+ export const examplesWidget = defineMcpWidget({
11
+ uri: "ui://nifra/examples",
12
+ name: "nifra examples",
13
+ description: "Interactive browser of verified, copy-pasteable nifra code examples.",
14
+ head: `<style>
15
+ :root { color-scheme: light dark; font: 14px/1.5 system-ui, sans-serif; }
16
+ body { margin: 0; padding: 16px; }
17
+ h1 { font-size: 16px; margin: 0 0 4px; }
18
+ #q { width: 100%; box-sizing: border-box; padding: 6px 10px; margin: 8px 0 14px; border-radius: 6px; border: 1px solid color-mix(in srgb, currentColor 25%, transparent); background: transparent; color: inherit; font: inherit; }
19
+ .card { border: 1px solid color-mix(in srgb, currentColor 15%, transparent); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
20
+ .topic { font-size: 12px; opacity: .6; }
21
+ .name { font-weight: 600; margin: 2px 0 6px; }
22
+ pre { margin: 0; padding: 8px 10px; border-radius: 6px; background: color-mix(in srgb, currentColor 8%, transparent); overflow-x: auto; font: 12px/1.5 ui-monospace, monospace; }
23
+ </style>`,
24
+ html: `
25
+ <h1>nifra examples</h1>
26
+ <input id="q" placeholder="Filter examples…" />
27
+ <div id="list"></div>
28
+ <script>
29
+ var ALL = [];
30
+ function esc(s){ return String(s).replace(/[&<>]/g, function(c){ return c==="&"?"&amp;":c==="<"?"&lt;":"&gt;"; }); }
31
+ function paint(items){
32
+ document.getElementById("list").innerHTML = items.map(function(e){
33
+ var code = e.code.length > 600 ? e.code.slice(0, 600) + "\\n…" : e.code;
34
+ return "<div class='card'><div class='topic'>" + esc(e.topic) + "</div><div class='name'>" + esc(e.name) +
35
+ "</div><pre>" + esc(code) + "</pre></div>";
36
+ }).join("") || "<p style='opacity:.6'>No matching examples.</p>";
37
+ }
38
+ function render(data){ ALL = (data && data.examples) || []; paint(ALL); }
39
+ mcpApp.onData(render);
40
+ document.getElementById("q").addEventListener("input", function(ev){
41
+ var q = ev.target.value.toLowerCase();
42
+ paint(ALL.filter(function(e){ return (e.topic + e.name + e.slug).toLowerCase().indexOf(q) !== -1; }));
43
+ });
44
+ </script>
45
+ `,
46
+ });
47
+ /** The widget-backed tool. `loadExamples` is injected (disk on the CLI, cached fetch on the edge). */
48
+ export function examplesAppTool(loadExamples) {
49
+ return defineMcpTool({
50
+ name: "nifra_examples_app",
51
+ description: "Browse nifra's verified code examples as an interactive, filterable list (MCP Apps widget). Pass query to pre-filter; the widget also filters client-side.",
52
+ inputSchema: {
53
+ type: "object",
54
+ properties: { query: { type: "string", description: "Pre-filter examples by keyword." } },
55
+ additionalProperties: false,
56
+ },
57
+ widget: examplesWidget,
58
+ handler: async (args) => {
59
+ const all = (await loadExamples()) ?? [];
60
+ const q = (args.query ?? "").toLowerCase();
61
+ const matched = (q
62
+ ? all.filter((e) => `${e.topic} ${e.name} ${e.slug} ${e.code}`.toLowerCase().includes(q))
63
+ : all).slice(0, 30);
64
+ return {
65
+ text: matched.length === 0
66
+ ? "No matching examples."
67
+ : `${matched.length} example(s): ${matched.map((e) => e.name).join(", ")}.`,
68
+ structuredContent: {
69
+ examples: matched.map((e) => ({
70
+ name: e.name,
71
+ topic: e.topic,
72
+ slug: e.slug,
73
+ code: e.code,
74
+ })),
75
+ },
76
+ };
77
+ },
78
+ });
79
+ }
80
+ //# sourceMappingURL=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AAC;gBACzF,CAAC,CAAC,GAAG,CACR,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;YACd,OAAO;gBACL,IAAI,EACF,OAAO,CAAC,MAAM,KAAK,CAAC;oBAClB,CAAC,CAAC,uBAAuB;oBACzB,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,gBAAgB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;gBAC/E,iBAAiB,EAAE;oBACjB,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;wBAC5B,IAAI,EAAE,CAAC,CAAC,IAAI;wBACZ,KAAK,EAAE,CAAC,CAAC,KAAK;wBACd,IAAI,EAAE,CAAC,CAAC,IAAI;wBACZ,IAAI,EAAE,CAAC,CAAC,IAAI;qBACb,CAAC,CAAC;iBACJ;aACF,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The two project-INDEPENDENT MCP tools — `nifra_docs` + `nifra_example` — as a single factory shared
2
+ * The project-INDEPENDENT MCP tools - `nifra_docs`, `nifra_example`, `nifra_types`, `nifra_learn` - 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,CA8FX"}
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;AAElE,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,CA8GX"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The two project-INDEPENDENT MCP tools — `nifra_docs` + `nifra_example` — as a single factory shared
2
+ * The project-INDEPENDENT MCP tools - `nifra_docs`, `nifra_example`, `nifra_types`, `nifra_learn` - 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
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import { renderDocsResult } from "./docs-search.js";
10
10
  import { renderExamplesResult } from "./examples.js";
11
+ import { renderLearnResult } from "./learn.js";
11
12
  import { renderTypesResult } from "./types-search.js";
12
13
  const clamp = (n, lo, hi, dflt) => Math.min(Math.max(typeof n === "number" ? n : dflt, lo), hi);
13
14
  /** Build `nifra_docs` + `nifra_example` + `nifra_types` over injected corpus loaders. */
@@ -15,7 +16,7 @@ export function docsTools(loadDocs, loadExamples, loadTypes) {
15
16
  return [
16
17
  {
17
18
  name: "nifra_docs",
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
+ 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
20
  inputSchema: {
20
21
  type: "object",
21
22
  properties: {
@@ -30,7 +31,7 @@ export function docsTools(loadDocs, loadExamples, loadTypes) {
30
31
  handler: async (args) => {
31
32
  const corpus = await loadDocs();
32
33
  if (corpus === undefined) {
33
- return "docs corpus missing — run `bun run gen:llms` in the nifra repo (published builds ship it).";
34
+ return "docs corpus missing - run `bun run gen:llms` in the nifra repo (published builds ship it).";
34
35
  }
35
36
  const { query, limit } = args;
36
37
  return renderDocsResult(corpus, query, clamp(limit, 1, 5, 3));
@@ -38,7 +39,7 @@ export function docsTools(loadDocs, loadExamples, loadTypes) {
38
39
  },
39
40
  {
40
41
  name: "nifra_example",
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
+ 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
43
  inputSchema: {
43
44
  type: "object",
44
45
  properties: {
@@ -53,7 +54,7 @@ export function docsTools(loadDocs, loadExamples, loadTypes) {
53
54
  handler: async (args) => {
54
55
  const corpus = await loadExamples();
55
56
  if (corpus === undefined) {
56
- return "examples corpus missing — run `bun run gen:llms` in the nifra repo (published builds ship it).";
57
+ return "examples corpus missing - run `bun run gen:llms` in the nifra repo (published builds ship it).";
57
58
  }
58
59
  const { query, limit } = args;
59
60
  return renderExamplesResult(corpus, query, clamp(limit, 1, 5, 3));
@@ -61,13 +62,13 @@ export function docsTools(loadDocs, loadExamples, loadTypes) {
61
62
  },
62
63
  {
63
64
  name: "nifra_types",
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
+ 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
66
  inputSchema: {
66
67
  type: "object",
67
68
  properties: {
68
69
  name: {
69
70
  type: "string",
70
- description: "Exact symbol name — returns its literal declaration (e.g. RateLimitStore).",
71
+ description: "Exact symbol name - returns its literal declaration (e.g. RateLimitStore).",
71
72
  },
72
73
  query: {
73
74
  type: "string",
@@ -79,7 +80,7 @@ export function docsTools(loadDocs, loadExamples, loadTypes) {
79
80
  },
80
81
  full: {
81
82
  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
+ 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
84
  },
84
85
  },
85
86
  additionalProperties: false,
@@ -87,12 +88,27 @@ export function docsTools(loadDocs, loadExamples, loadTypes) {
87
88
  handler: async (args) => {
88
89
  const corpus = await loadTypes();
89
90
  if (corpus === undefined) {
90
- return "types corpus missing — run `bun run build && bun run gen:llms` in the nifra repo (published builds ship it).";
91
+ return "types corpus missing - run `bun run build && bun run gen:llms` in the nifra repo (published builds ship it).";
91
92
  }
92
93
  const { name, query, limit, full } = args;
93
94
  return renderTypesResult(corpus, name, query, clamp(limit, 1, 8, 5), full === true);
94
95
  },
95
96
  },
97
+ {
98
+ name: "nifra_learn",
99
+ description: "Walk the guided path to build a nifra app end to end - an ORDERED sequence (create → page route → loader → typed API → typed client → auth → background jobs → deploy), not the random-access search of nifra_docs/nifra_example. Call with no args for the step index; pass `step: N` for that step's goal, how to do it (which tool emits the correct artifact), and how to verify it. Use it when scaffolding a new app or learning nifra's flow - each step composes the other nifra_* tools.",
100
+ inputSchema: {
101
+ type: "object",
102
+ properties: {
103
+ step: {
104
+ type: "number",
105
+ description: "1-based step number to expand (omit for the index).",
106
+ },
107
+ },
108
+ additionalProperties: false,
109
+ },
110
+ handler: async (args) => renderLearnResult(args.step),
111
+ },
96
112
  ];
97
113
  }
98
114
  //# sourceMappingURL=mcp-docs-tools.js.map
@@ -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,EAAE,CAAA;gBAC/B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;oBACzB,OAAO,4FAA4F,CAAA;gBACrG,CAAC;gBAC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ACd,WAAW,EAAE,qDAAqD;qBACnE;iBACF;gBACD,oBAAoB,EAAE,KAAK;aAC5B;YACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,iBAAiB,CAAE,IAA0B,CAAC,IAAI,CAAC;SAC7E;KACF,CAAA;AACH,CAAC"}
@@ -1,22 +1,25 @@
1
1
  /**
2
- * The PUBLIC nifra docs MCP — Streamable-HTTP transport exposing the project-INDEPENDENT tools
3
- * (`nifra_docs` + `nifra_example`) so any remote AI agent can learn nifra without a local checkout.
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} — one source, no drift.
2
+ * The PUBLIC nifra docs MCP - Streamable-HTTP transport exposing the project-INDEPENDENT tools
3
+ * (`nifra_docs`, `nifra_example`, `nifra_types`, `nifra_learn` + the `nifra_examples_app` MCP Apps widget)
4
+ * so any remote AI agent can learn nifra without a local checkout. They read the bundled corpus
5
+ * (llms-full.txt / examples.json / types.json shipped in this package) and ignore `cwd`, so they reuse the
6
+ * exact definitions from {@link projectTools} - one source, no drift.
6
7
  *
7
8
  * The transport itself (body cap, CORS, JSON-RPC dispatch) lives in `@nifrajs/mcp/http`; this module is
8
9
  * 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 — 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
10
+ * {@link handleMcpHttp} self-hosts ANYWHERE Bun runs - the simplest path is `nifra docs-mcp` on a VPS; the
11
+ * same handler runs on Cloudflare/Vercel edge (there inline the corpus as string imports - a Worker has no
11
12
  * filesystem). `export default { port, fetch }` also lets `bun run mcp-http.ts` serve it directly.
12
13
  */
13
14
  import { type McpHttpOptions } from "@nifrajs/mcp/http";
14
- import type { McpTool } from "@nifrajs/mcp/protocol";
15
+ import { type McpTool } from "@nifrajs/mcp/protocol";
15
16
  export type { McpHttpOptions } from "@nifrajs/mcp/http";
16
17
  export type { Example } from "./examples.js";
18
+ export { examplesAppTool, examplesWidget } from "./mcp-app-tool.js";
17
19
  export { docsTools } from "./mcp-docs-tools.js";
18
20
  export type { TypeEntry } from "./types-search.js";
19
- /** The two project-independent tools, reading the package's bundled corpus from disk (CLI use). */
21
+ /** The project-independent tools, reading the package's bundled corpus from disk (CLI use): the text
22
+ * docs tools plus the `nifra_examples_app` MCP Apps widget tool. */
20
23
  export declare function publicDocsTools(): McpTool[];
21
24
  /**
22
25
  * Handle one MCP request against the given `tools` with the docs server identity. A thin docs-flavored
@@ -24,12 +27,13 @@ export declare function publicDocsTools(): McpTool[];
24
27
  * `(request, tools, options?)` shape (the site's edge worker calls it with two args).
25
28
  */
26
29
  export declare function respondMcpHttp(request: Request, tools: McpTool[], options?: McpHttpOptions): Promise<Response>;
27
- /** The CLI HTTP handler: serves the disk-backed corpus tools. (`nifra docs-mcp` / `bun run` this file.) */
30
+ /** The CLI HTTP handler: serves the disk-backed corpus tools + registers the examples widget's `ui://`
31
+ * resource so MCP Apps hosts can render `nifra_examples_app`. (`nifra docs-mcp` / `bun run` this file.) */
28
32
  export declare function handleMcpHttp(request: Request): Promise<Response>;
29
33
  /**
30
34
  * Worker/edge + local entry. `export default { fetch }` is the universal server shape: Cloudflare /
31
35
  * Vercel edge / Deno deploy use `fetch` (and ignore `port`); `bun run mcp-http.ts` auto-serves it on
32
- * `port` (PORT env, default 8787) — Bun serves a module's default-exported server, so NO manual
36
+ * `port` (PORT env, default 8787) - Bun serves a module's default-exported server, so NO manual
33
37
  * `Bun.serve` here (that would double-bind the port).
34
38
  */
35
39
  declare const _default: {
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-http.d.ts","sourceRoot":"","sources":["../src/mcp-http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,KAAK,cAAc,EAAwC,MAAM,mBAAmB,CAAA;AAC7F,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EAChB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,QAAQ,CAAC,CAEnB;AAED;2GAC2G;AAC3G,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAIjE;AAED;;;;;GAKG;;;;;AACH,wBAGC"}
package/dist/mcp-http.js CHANGED
@@ -1,30 +1,41 @@
1
1
  /**
2
- * The PUBLIC nifra docs MCP — Streamable-HTTP transport exposing the project-INDEPENDENT tools
3
- * (`nifra_docs` + `nifra_example`) so any remote AI agent can learn nifra without a local checkout.
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} — one source, no drift.
2
+ * The PUBLIC nifra docs MCP - Streamable-HTTP transport exposing the project-INDEPENDENT tools
3
+ * (`nifra_docs`, `nifra_example`, `nifra_types`, `nifra_learn` + the `nifra_examples_app` MCP Apps widget)
4
+ * so any remote AI agent can learn nifra without a local checkout. They read the bundled corpus
5
+ * (llms-full.txt / examples.json / types.json shipped in this package) and ignore `cwd`, so they reuse the
6
+ * exact definitions from {@link projectTools} - one source, no drift.
6
7
  *
7
8
  * The transport itself (body cap, CORS, JSON-RPC dispatch) lives in `@nifrajs/mcp/http`; this module is
8
9
  * 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 — 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
10
+ * {@link handleMcpHttp} self-hosts ANYWHERE Bun runs - the simplest path is `nifra docs-mcp` on a VPS; the
11
+ * same handler runs on Cloudflare/Vercel edge (there inline the corpus as string imports - a Worker has no
11
12
  * filesystem). `export default { port, fetch }` also lets `bun run mcp-http.ts` serve it directly.
12
13
  */
13
14
  import { respondMcpHttp as respondMcpHttpCore } from "@nifrajs/mcp/http";
15
+ import { UI_MIME } from "@nifrajs/mcp/protocol";
14
16
  import { loadDocsCorpus } from "./docs-search.js";
15
17
  import { loadExamplesCorpus } from "./examples.js";
18
+ import { examplesAppTool, examplesWidget } from "./mcp-app-tool.js";
16
19
  import { docsTools } from "./mcp-docs-tools.js";
17
20
  import { loadTypesCorpus } from "./types-search.js";
18
- // Re-exported so a self-host (e.g. a Cloudflare-Pages `/mcp` worker route) gets the corpus-injectable
19
- // tool factory + the transport core from one entry: `import { respondMcpHttp, docsTools } from "@nifrajs/cli/mcp"`.
21
+ // Re-exported so a self-host gets the corpus-injectable tool factories + the transport core from one
22
+ // entry: `import { respondMcpHttp, docsTools, examplesAppTool } from "@nifrajs/cli/mcp"`.
23
+ export { examplesAppTool, examplesWidget } from "./mcp-app-tool.js";
20
24
  export { docsTools } from "./mcp-docs-tools.js";
21
25
  // Kept in lockstep with packages/cli/package.json by check:publish's version-consistency gate.
22
- const VERSION = "2.2.0";
26
+ const VERSION = "2.4.0";
23
27
  const SERVER_INFO = { name: "nifra-docs", version: VERSION };
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
- /** The two project-independent tools, reading the package's bundled corpus from disk (CLI use). */
28
+ // Derive the GET/health tool list from the tools actually served, so the line can never drift from them.
29
+ const docsHealth = (tools) => `nifra docs MCP - POST JSON-RPC 2.0 here (methods: initialize, tools/list, tools/call). Tools: ${tools
30
+ .map((tool) => tool.name)
31
+ .join(", ")}.`;
32
+ /** The project-independent tools, reading the package's bundled corpus from disk (CLI use): the text
33
+ * docs tools plus the `nifra_examples_app` MCP Apps widget tool. */
26
34
  export function publicDocsTools() {
27
- return docsTools(loadDocsCorpus, loadExamplesCorpus, loadTypesCorpus);
35
+ return [
36
+ ...docsTools(loadDocsCorpus, loadExamplesCorpus, loadTypesCorpus),
37
+ examplesAppTool(loadExamplesCorpus),
38
+ ];
28
39
  }
29
40
  /**
30
41
  * Handle one MCP request against the given `tools` with the docs server identity. A thin docs-flavored
@@ -32,16 +43,19 @@ export function publicDocsTools() {
32
43
  * `(request, tools, options?)` shape (the site's edge worker calls it with two args).
33
44
  */
34
45
  export function respondMcpHttp(request, tools, options = {}) {
35
- return respondMcpHttpCore(request, tools, SERVER_INFO, { health: DOCS_HEALTH, ...options });
46
+ return respondMcpHttpCore(request, tools, SERVER_INFO, { health: docsHealth(tools), ...options });
36
47
  }
37
- /** The CLI HTTP handler: serves the disk-backed corpus tools. (`nifra docs-mcp` / `bun run` this file.) */
48
+ /** The CLI HTTP handler: serves the disk-backed corpus tools + registers the examples widget's `ui://`
49
+ * resource so MCP Apps hosts can render `nifra_examples_app`. (`nifra docs-mcp` / `bun run` this file.) */
38
50
  export function handleMcpHttp(request) {
39
- return respondMcpHttp(request, publicDocsTools());
51
+ return respondMcpHttp(request, publicDocsTools(), {
52
+ features: { resources: [examplesWidget.resource], ui: { mimeTypes: [UI_MIME] } },
53
+ });
40
54
  }
41
55
  /**
42
56
  * Worker/edge + local entry. `export default { fetch }` is the universal server shape: Cloudflare /
43
57
  * Vercel edge / Deno deploy use `fetch` (and ignore `port`); `bun run mcp-http.ts` auto-serves it on
44
- * `port` (PORT env, default 8787) — Bun serves a module's default-exported server, so NO manual
58
+ * `port` (PORT env, default 8787) - Bun serves a module's default-exported server, so NO manual
45
59
  * `Bun.serve` here (that would double-bind the port).
46
60
  */
47
61
  export default {
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-http.js","sourceRoot":"","sources":["../src/mcp-http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAuB,cAAc,IAAI,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAE7F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBA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Ac,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE;KACjF,CAAC,CAAA;AACJ,CAAC;AAED;;;;;GAKG;AACH,eAAe;IACb,IAAI,EAAE,OAAO,GAAG,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;IACtE,KAAK,EAAE,aAAa;CACrB,CAAA"}
@@ -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 — and
4
- * the `@nifrajs/cli/mcp` self-host surface — keep resolving here unchanged.
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