@nifrajs/cli 2.0.0 → 2.2.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 (47) hide show
  1. package/dist/check.d.ts +4 -1
  2. package/dist/check.d.ts.map +1 -1
  3. package/dist/check.js +71 -0
  4. package/dist/check.js.map +1 -1
  5. package/dist/cli.d.ts +9 -0
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +165 -23
  8. package/dist/cli.js.map +1 -1
  9. package/dist/doctor.d.ts +5 -1
  10. package/dist/doctor.d.ts.map +1 -1
  11. package/dist/doctor.js +66 -6
  12. package/dist/doctor.js.map +1 -1
  13. package/dist/load.d.ts +11 -0
  14. package/dist/load.d.ts.map +1 -1
  15. package/dist/load.js +30 -0
  16. package/dist/load.js.map +1 -1
  17. package/dist/mcp-docs-tools.d.ts.map +1 -1
  18. package/dist/mcp-docs-tools.js +7 -3
  19. package/dist/mcp-docs-tools.js.map +1 -1
  20. package/dist/mcp-http.js +1 -1
  21. package/dist/mcp-render.js +9 -1
  22. package/dist/mcp-render.js.map +1 -1
  23. package/dist/mcp.d.ts.map +1 -1
  24. package/dist/mcp.js +44 -2
  25. package/dist/mcp.js.map +1 -1
  26. package/dist/pipeline-guard.d.ts +83 -0
  27. package/dist/pipeline-guard.d.ts.map +1 -0
  28. package/dist/pipeline-guard.js +136 -0
  29. package/dist/pipeline-guard.js.map +1 -0
  30. package/dist/types-search.d.ts +1 -1
  31. package/dist/types-search.d.ts.map +1 -1
  32. package/dist/types-search.js +47 -2
  33. package/dist/types-search.js.map +1 -1
  34. package/docs/examples.json +6 -0
  35. package/docs/llms-full.txt +169 -35
  36. package/docs/types.json +1618 -45
  37. package/package.json +9 -9
  38. package/src/check.ts +91 -0
  39. package/src/cli.ts +173 -24
  40. package/src/doctor.ts +71 -6
  41. package/src/load.ts +44 -0
  42. package/src/mcp-docs-tools.ts +13 -3
  43. package/src/mcp-http.ts +1 -1
  44. package/src/mcp-render.ts +9 -1
  45. package/src/mcp.ts +45 -2
  46. package/src/pipeline-guard.ts +186 -0
  47. package/src/types-search.ts +50 -1
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Pipeline separation guard — one bundler owns a phase, never two.
3
+ *
4
+ * nifra supports both Vite and Bun, and the config keeps them in separate slots: `vitePlugins` for
5
+ * the Vite pipeline, `clientPlugins`/`serverPlugins` for the Bun one. Nothing enforces the split, so
6
+ * a plugin lands in the wrong slot and is silently ignored - a Vite plugin in `clientPlugins` is
7
+ * handed to `Bun.build`, which has no `transform` hook to call, so the transform simply never runs
8
+ * and the build succeeds.
9
+ *
10
+ * That failure mode is the whole reason for this file. nifra's expensive bugs are not caused by Vite
11
+ * or by Bun; they are caused by two toolchains disagreeing about one module. Dual-React is that, the
12
+ * dedupe plugins are patches for that, and a `resolve.alias` that never reaches SSR is that. Mixing
13
+ * is the defect - choice is not - so the separation has to be checked rather than documented.
14
+ *
15
+ * Detection is by hook shape, which is what each bundler actually dispatches on:
16
+ * - a Bun plugin has `setup(build)`
17
+ * - a Rollup/Vite plugin has `resolveId` / `load` / `transform` / `config` / `configResolved` /
18
+ * `transformIndexHtml` and no `setup`
19
+ *
20
+ * Deliberately conservative: a plugin that matches neither shape is left alone rather than guessed
21
+ * at. A guard that fires on correct config is a guard people turn off.
22
+ */
23
+ /** Which pipeline a slot belongs to. */
24
+ export type PipelineSlot = "vitePlugins" | "clientPlugins" | "serverPlugins";
25
+ export interface PipelineMismatch {
26
+ readonly slot: PipelineSlot;
27
+ /** The plugin's `name`, or a positional label when it has none. */
28
+ readonly plugin: string;
29
+ /** The pipeline the slot feeds. */
30
+ readonly expected: "vite" | "bun";
31
+ /** The pipeline the plugin's hooks say it belongs to. */
32
+ readonly actual: "vite" | "bun";
33
+ readonly fix: string;
34
+ }
35
+ /**
36
+ * Check one slot's resolved plugin list. Pure: takes the already-resolved array so a thunk-valued
37
+ * field is awaited by the caller, and so this stays testable without loading a project.
38
+ */
39
+ export declare function checkPipelineSlot(slot: PipelineSlot, plugins: readonly unknown[]): PipelineMismatch[];
40
+ /** Check every slot of a resolved framework config. */
41
+ export declare function checkPipelineSeparation(slots: {
42
+ readonly vitePlugins?: readonly unknown[];
43
+ readonly clientPlugins?: readonly unknown[];
44
+ readonly serverPlugins?: readonly unknown[];
45
+ }): PipelineMismatch[];
46
+ /** Which bundler a build runs on. */
47
+ export type BuildPipeline = "bun" | "vite";
48
+ export interface PipelineDecision {
49
+ readonly pipeline: BuildPipeline;
50
+ /**
51
+ * Why this pipeline, for the `nifra build` log line - so an auto-selected Vite build never looks
52
+ * like the user got the default. `undefined` when the choice was the plain default or was forced.
53
+ */
54
+ readonly reason?: string;
55
+ }
56
+ /** The plugin slots a decision reads, already resolved. */
57
+ export interface PipelineSlots {
58
+ readonly vitePlugins?: readonly unknown[];
59
+ readonly clientPlugins?: readonly unknown[];
60
+ readonly serverPlugins?: readonly unknown[];
61
+ }
62
+ /**
63
+ * Pick the bundler for `nifra build`, per app rather than per global default.
64
+ *
65
+ * The phase defaults are deliberately asymmetric - `nifra dev` is Vite (for the plugin ecosystem, and
66
+ * because Bun's DEV-server bundler cannot compile CSS Modules), `nifra build` is Bun (faster and
67
+ * Bun-native). For an app with no transforms that asymmetry is free: there is nothing to disagree about.
68
+ * For an app whose ONLY transforms are Vite plugins it is not. Those plugins run in dev and are then
69
+ * dropped by the Bun build - `buildForTarget` reads `clientPlugins`/`serverPlugins`, never `vitePlugins`
70
+ * - so the build succeeds, the output looks plausible, and the transform simply did not happen. That is
71
+ * the same failure {@link checkPipelineSeparation} exists to prevent, reached by crossing PHASES instead
72
+ * of slots, and the slot check cannot see it because the plugins are correctly placed.
73
+ *
74
+ * So the default follows the app: Vite plugins with no Bun counterpart means the app has exactly one
75
+ * pipeline that can build it, and that is the one used. An app declaring BOTH has supplied the Bun
76
+ * equivalent on purpose - nothing is dropped - so the fast Bun default stands.
77
+ *
78
+ * `forced` is `--vite` / `--bun` and always wins, except for the one combination that silently discards
79
+ * work, which throws instead. Refusing rather than warning matches the slot guard: a build that succeeds
80
+ * and omits the transform is worse than one that stops and says so.
81
+ */
82
+ export declare function chooseBuildPipeline(slots: PipelineSlots, forced?: BuildPipeline): PipelineDecision;
83
+ //# sourceMappingURL=pipeline-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline-guard.d.ts","sourceRoot":"","sources":["../src/pipeline-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,wCAAwC;AACxC,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,eAAe,GAAG,eAAe,CAAA;AAE5E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAC3B,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,mCAAmC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAA;IACjC,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAA;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB;AAmCD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,SAAS,OAAO,EAAE,GAC1B,gBAAgB,EAAE,CAqBpB;AAED,uDAAuD;AACvD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,OAAO,EAAE,CAAA;IACzC,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,OAAO,EAAE,CAAA;IAC3C,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,OAAO,EAAE,CAAA;CAC5C,GAAG,gBAAgB,EAAE,CAMrB;AAED,qCAAqC;AACrC,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAA;AAE1C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAA;IAChC;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,OAAO,EAAE,CAAA;IACzC,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,OAAO,EAAE,CAAA;IAC3C,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,OAAO,EAAE,CAAA;CAC5C;AAUD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,EACpB,MAAM,CAAC,EAAE,aAAa,GACrB,gBAAgB,CAsBlB"}
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Pipeline separation guard — one bundler owns a phase, never two.
3
+ *
4
+ * nifra supports both Vite and Bun, and the config keeps them in separate slots: `vitePlugins` for
5
+ * the Vite pipeline, `clientPlugins`/`serverPlugins` for the Bun one. Nothing enforces the split, so
6
+ * a plugin lands in the wrong slot and is silently ignored - a Vite plugin in `clientPlugins` is
7
+ * handed to `Bun.build`, which has no `transform` hook to call, so the transform simply never runs
8
+ * and the build succeeds.
9
+ *
10
+ * That failure mode is the whole reason for this file. nifra's expensive bugs are not caused by Vite
11
+ * or by Bun; they are caused by two toolchains disagreeing about one module. Dual-React is that, the
12
+ * dedupe plugins are patches for that, and a `resolve.alias` that never reaches SSR is that. Mixing
13
+ * is the defect - choice is not - so the separation has to be checked rather than documented.
14
+ *
15
+ * Detection is by hook shape, which is what each bundler actually dispatches on:
16
+ * - a Bun plugin has `setup(build)`
17
+ * - a Rollup/Vite plugin has `resolveId` / `load` / `transform` / `config` / `configResolved` /
18
+ * `transformIndexHtml` and no `setup`
19
+ *
20
+ * Deliberately conservative: a plugin that matches neither shape is left alone rather than guessed
21
+ * at. A guard that fires on correct config is a guard people turn off.
22
+ */
23
+ const ROLLUP_HOOKS = [
24
+ "resolveId",
25
+ "load",
26
+ "transform",
27
+ "config",
28
+ "configResolved",
29
+ "configureServer",
30
+ "transformIndexHtml",
31
+ "generateBundle",
32
+ "renderChunk",
33
+ ];
34
+ /** Classify a plugin by the hooks it exposes, or `undefined` when its shape says nothing. */
35
+ function classify(plugin) {
36
+ if (typeof plugin !== "object" || plugin === null)
37
+ return undefined;
38
+ const record = plugin;
39
+ // `setup` is Bun's only entry point, so its presence is decisive even alongside other keys.
40
+ if (typeof record.setup === "function")
41
+ return "bun";
42
+ if (ROLLUP_HOOKS.some((hook) => typeof record[hook] === "function"))
43
+ return "vite";
44
+ return undefined;
45
+ }
46
+ const SLOT_PIPELINE = {
47
+ vitePlugins: "vite",
48
+ clientPlugins: "bun",
49
+ serverPlugins: "bun",
50
+ };
51
+ const MOVE_TO = {
52
+ vite: "`vitePlugins`",
53
+ bun: "`clientPlugins` (client bundle) or `serverPlugins` (SSR)",
54
+ };
55
+ /**
56
+ * Check one slot's resolved plugin list. Pure: takes the already-resolved array so a thunk-valued
57
+ * field is awaited by the caller, and so this stays testable without loading a project.
58
+ */
59
+ export function checkPipelineSlot(slot, plugins) {
60
+ const expected = SLOT_PIPELINE[slot];
61
+ const out = [];
62
+ for (let i = 0; i < plugins.length; i++) {
63
+ const plugin = plugins[i];
64
+ const actual = classify(plugin);
65
+ if (actual === undefined || actual === expected)
66
+ continue;
67
+ const named = plugin.name;
68
+ const label = typeof named === "string" && named !== "" ? named : `${slot}[${i}]`;
69
+ out.push({
70
+ slot,
71
+ plugin: label,
72
+ expected,
73
+ actual,
74
+ fix: actual === "vite"
75
+ ? `"${label}" is a Vite/Rollup plugin (it defines Rollup hooks, not \`setup\`) but sits in \`${slot}\`, which feeds Bun.build. Bun never calls those hooks, so the transform silently does not run. Move it to ${MOVE_TO.vite}.`
76
+ : `"${label}" is a Bun plugin (it defines \`setup\`) but sits in \`${slot}\`, which feeds Vite. Vite never calls \`setup\`, so the transform silently does not run. Move it to ${MOVE_TO.bun}.`,
77
+ });
78
+ }
79
+ return out;
80
+ }
81
+ /** Check every slot of a resolved framework config. */
82
+ export function checkPipelineSeparation(slots) {
83
+ return [
84
+ ...checkPipelineSlot("vitePlugins", slots.vitePlugins ?? []),
85
+ ...checkPipelineSlot("clientPlugins", slots.clientPlugins ?? []),
86
+ ...checkPipelineSlot("serverPlugins", slots.serverPlugins ?? []),
87
+ ];
88
+ }
89
+ const pluginNames = (plugins) => plugins
90
+ .map((plugin, i) => {
91
+ const named = plugin.name;
92
+ return typeof named === "string" && named !== "" ? named : `vitePlugins[${i}]`;
93
+ })
94
+ .join(", ");
95
+ /**
96
+ * Pick the bundler for `nifra build`, per app rather than per global default.
97
+ *
98
+ * The phase defaults are deliberately asymmetric - `nifra dev` is Vite (for the plugin ecosystem, and
99
+ * because Bun's DEV-server bundler cannot compile CSS Modules), `nifra build` is Bun (faster and
100
+ * Bun-native). For an app with no transforms that asymmetry is free: there is nothing to disagree about.
101
+ * For an app whose ONLY transforms are Vite plugins it is not. Those plugins run in dev and are then
102
+ * dropped by the Bun build - `buildForTarget` reads `clientPlugins`/`serverPlugins`, never `vitePlugins`
103
+ * - so the build succeeds, the output looks plausible, and the transform simply did not happen. That is
104
+ * the same failure {@link checkPipelineSeparation} exists to prevent, reached by crossing PHASES instead
105
+ * of slots, and the slot check cannot see it because the plugins are correctly placed.
106
+ *
107
+ * So the default follows the app: Vite plugins with no Bun counterpart means the app has exactly one
108
+ * pipeline that can build it, and that is the one used. An app declaring BOTH has supplied the Bun
109
+ * equivalent on purpose - nothing is dropped - so the fast Bun default stands.
110
+ *
111
+ * `forced` is `--vite` / `--bun` and always wins, except for the one combination that silently discards
112
+ * work, which throws instead. Refusing rather than warning matches the slot guard: a build that succeeds
113
+ * and omits the transform is worse than one that stops and says so.
114
+ */
115
+ export function chooseBuildPipeline(slots, forced) {
116
+ const vitePlugins = slots.vitePlugins ?? [];
117
+ const bunPlugins = [...(slots.clientPlugins ?? []), ...(slots.serverPlugins ?? [])];
118
+ const viteOnly = vitePlugins.length > 0 && bunPlugins.length === 0;
119
+ if (forced === "bun" && viteOnly) {
120
+ throw new Error("[nifra] `nifra build --bun` would silently drop this app's only transforms. `vitePlugins` are " +
121
+ "read by the Vite build; the Bun build reads `clientPlugins`/`serverPlugins`, so these would " +
122
+ "never run and the output would look plausible without them.\n" +
123
+ ` Would be dropped: ${pluginNames(vitePlugins)}\n` +
124
+ " Drop the flag to build with Vite, or add the Bun equivalents to `clientPlugins`/`serverPlugins`.");
125
+ }
126
+ if (forced !== undefined)
127
+ return { pipeline: forced };
128
+ if (viteOnly) {
129
+ return {
130
+ pipeline: "vite",
131
+ reason: `auto: this app's only transforms are \`vitePlugins\` (${pluginNames(vitePlugins)}), which the Bun build cannot run`,
132
+ };
133
+ }
134
+ return { pipeline: "bun" };
135
+ }
136
+ //# sourceMappingURL=pipeline-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline-guard.js","sourceRoot":"","sources":["../src/pipeline-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAgBH,MAAM,YAAY,GAAG;IACnB,WAAW;IACX,MAAM;IACN,WAAW;IACX,QAAQ;IACR,gBAAgB;IAChB,iBAAiB;IACjB,oBAAoB;IACpB,gBAAgB;IAChB,aAAa;CACL,CAAA;AAEV,6FAA6F;AAC7F,SAAS,QAAQ,CAAC,MAAe;IAC/B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,SAAS,CAAA;IACnE,MAAM,MAAM,GAAG,MAAiC,CAAA;IAChD,4FAA4F;IAC5F,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,UAAU;QAAE,OAAO,KAAK,CAAA;IACpD,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC;QAAE,OAAO,MAAM,CAAA;IAClF,OAAO,SAAS,CAAA;AAClB,CAA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S;QAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;IACrD,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO;YACL,QAAQ,EAAE,MAAM;YAChB,MAAM,EAAE,yDAAyD,WAAW,CAAC,WAAW,CAAC,mCAAmC;SAC7H,CAAA;IACH,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;AAC5B,CAAC"}
@@ -30,7 +30,7 @@ export declare function searchTypes(types: readonly TypeEntry[], query: string,
30
30
  * per-package index of type names. The signatures are authoritative (generated from the built `.d.ts`),
31
31
  * so this is the complete answer — there is no need to read a `.d.ts` file.
32
32
  */
33
- export declare function renderTypesResult(types: readonly TypeEntry[], name: string | undefined, query: string | undefined, limit: number): string;
33
+ export declare function renderTypesResult(types: readonly TypeEntry[], name: string | undefined, query: string | undefined, limit: number, full?: boolean): string;
34
34
  /** Load the bundled type corpus (`docs/types.json`), resolved relative to this module so it works from
35
35
  * `src/` (dev) and `dist/` (published) alike. */
36
36
  export declare function loadTypesCorpus(): Promise<TypeEntry[] | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"types-search.d.ts","sourceRoot":"","sources":["../src/types-search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAA;IAC7E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,4FAA4F;IAC5F,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,6CAA6C;IAC7C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED;6BAC6B;AAC7B,w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E,EAC3B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,UAAU,EAAE,CAed;AAuDD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,KAAK,EAAE,MAAM,EACb,IAAI,UAAQ,GACX,MAAM,CA2BR;AAED;iDACiD;AACjD,wBAAsB,eAAe,IAAI,OAAO,CAAC,SAAS,EAAE,GAAG,SAAS,CAAC,CAUxE"}
@@ -40,12 +40,56 @@ function renderEntry(t) {
40
40
  const doc = t.doc ? `${t.doc}\n` : "";
41
41
  return `${head}\n\n\`\`\`ts\n${doc}${t.signature}\n\`\`\``;
42
42
  }
43
+ /**
44
+ * Longest signature rendered whole in a SEARCH result.
45
+ *
46
+ * Search is "which symbol did I mean?", not "show me everything about it" - and the corpus is wildly
47
+ * uneven: the median declaration is small, while `Server` alone is ~32,000 characters, five times the
48
+ * next largest. One broad query that happened to match it returned the entire class for near-zero
49
+ * value. Above this, a search result shows the head plus a member count and says how to get the rest;
50
+ * an exact `name` lookup is never collapsed, because there the caller asked for that symbol.
51
+ */
52
+ const SEARCH_SIGNATURE_MAX = 600;
53
+ /** First sentence of the doc block, flattened to one line - enough to pick between candidates. */
54
+ function summarize(doc) {
55
+ if (doc === undefined)
56
+ return "";
57
+ const text = doc
58
+ .replace(/\/\*\*|\*\/|^\s*\*/gm, " ")
59
+ .replace(/\s+/g, " ")
60
+ .trim();
61
+ if (text === "")
62
+ return "";
63
+ const end = text.search(/\.\s|\.$/);
64
+ const sentence = end === -1 ? text : text.slice(0, end + 1);
65
+ return sentence.length > 200 ? `${sentence.slice(0, 197)}...` : sentence;
66
+ }
67
+ /** Keep the declaration head; replace a long body with a member count. */
68
+ function collapseSignature(signature) {
69
+ const open = signature.indexOf("{");
70
+ if (open === -1)
71
+ return `${signature.slice(0, SEARCH_SIGNATURE_MAX)}…`;
72
+ const body = signature.slice(open);
73
+ // Rough but honest: count top-level-looking member lines rather than parsing TypeScript here.
74
+ const members = body.split("\n").filter((line) => /^\s{2,4}\S/.test(line)).length;
75
+ return `${signature.slice(0, open).trim()} { … ${members} members … }`;
76
+ }
77
+ /** A search hit: enough to choose, not the whole declaration. */
78
+ function renderSearchHit(t) {
79
+ const head = `## ${t.name} — ${t.kind}, \`${t.package}\``;
80
+ const summary = summarize(t.doc);
81
+ const signature = t.signature.length <= SEARCH_SIGNATURE_MAX ? t.signature : collapseSignature(t.signature);
82
+ const note = t.signature.length <= SEARCH_SIGNATURE_MAX
83
+ ? ""
84
+ : `\n_Collapsed (${t.signature.length} chars). Call \`nifra_types({ name: "${t.name}" })\` for the full declaration._`;
85
+ return `${head}\n${summary ? `\n${summary}\n` : ""}\n\`\`\`ts\n${signature}\n\`\`\`${note}`;
86
+ }
43
87
  /**
44
88
  * Render the tool result. `name` → the exact declaration(s); else `query` → the top matches; else a
45
89
  * per-package index of type names. The signatures are authoritative (generated from the built `.d.ts`),
46
90
  * so this is the complete answer — there is no need to read a `.d.ts` file.
47
91
  */
48
- export function renderTypesResult(types, name, query, limit) {
92
+ export function renderTypesResult(types, name, query, limit, full = false) {
49
93
  if (name !== undefined && name.trim() !== "") {
50
94
  const hits = lookupType(types, name);
51
95
  if (hits.length === 0) {
@@ -58,7 +102,8 @@ export function renderTypesResult(types, name, query, limit) {
58
102
  if (matches.length === 0) {
59
103
  return `No types matched ${JSON.stringify(query)}. Try a broader term, pass an exact \`name\`, or call with no args for the index.`;
60
104
  }
61
- return matches.map(renderEntry).join("\n\n---\n\n");
105
+ // Search results are collapsed by default; `full` opts back into whole declarations.
106
+ return matches.map(full ? renderEntry : renderSearchHit).join("\n\n---\n\n");
62
107
  }
63
108
  const byPkg = new Map();
64
109
  for (const t of types) {
@@ -1 +1 @@
1
- {"version":3,"file":"types-search.js","sourceRoot":"","sources":["../src/types-search.ts"],"names":[],"mappings":"AAAA;;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D,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC1D,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;QACvC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,SAAS,CAAA;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAgB,CAAA;QAC9C,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;IACxE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC"}
@@ -125,6 +125,12 @@
125
125
  "slug": "deployment",
126
126
  "code": "// _worker.ts — the edge SSR entry\nimport { toFetchHandler } from \"@nifrajs/core/server\"\nimport { createWebApp } from \"@nifrajs/web\"\nimport { reactAdapter } from \"@nifrajs/web-react\"\nimport { clientEntry, manifest } from \"./server-manifest\" // generated by buildServer\n\nconst app = createWebApp({ adapter: reactAdapter, manifest, clientEntry })\nexport default toFetchHandler(app) // a Workers/Pages fetch handler\n\n// build.ts — buildClient (→ /assets) + buildServer (edge conditions → _worker.js)\nimport { buildClient, buildServer } from \"@nifrajs/web/build\""
127
127
  },
128
+ {
129
+ "name": "VITE_PROD",
130
+ "topic": "Nifra — Dev & HMR",
131
+ "slug": "dev",
132
+ "code": "// vite.config.ts — a Vite/Rollup PRODUCTION client build (the escape hatch, not the default).\n// Only reach for this when an app needs a Vite-only transform with no Bun equivalent; nifra's default\n// production bundler stays Bun (buildClient), which is faster and Bun-native.\nimport { viteLeakGuard } from \"@nifrajs/web/plugins/vite-leak-guard\"\n\nexport default {\n build: {\n // The SAME two client-leak guards nifra's Bun build runs — server-only code or a node: builtin\n // reaching the browser fails the build, with the identical error message. A second production\n // pipeline must not ship without them.\n rollupOptions: { plugins: [viteLeakGuard()] },\n },\n}"
133
+ },
128
134
  {
129
135
  "name": "LAB",
130
136
  "topic": "Nifra - Failure laboratory",