@fragments-sdk/context 0.6.0 → 0.6.1

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.
@@ -247,7 +247,7 @@ var MCP_TOOL_DEFINITIONS = [
247
247
  },
248
248
  {
249
249
  key: "perf",
250
- description: "Query component performance data (bundle sizes, complexity tiers, budget status). Returns measured bundle sizes from fragments.json. Run `fragments perf` first to generate measurements.",
250
+ description: "Query component performance data (bundle sizes, complexity tiers, budget status). Returns measured bundle sizes when the active source provides performance data. Run `fragments perf` first to generate measurements for local fragments.json sources.",
251
251
  params: {
252
252
  component: {
253
253
  type: "string",
@@ -343,14 +343,14 @@ var CLI_TOOL_EXTENSIONS = [
343
343
  },
344
344
  {
345
345
  key: "fix",
346
- description: "Generate patches to fix token compliance issues in a component. Returns unified diff patches that replace hardcoded CSS values with design token references. Use this after fragments_render identifies issues to automatically fix them.",
346
+ description: "Generate patches to fix token compliance issues in a component. Returns unified diff patches that replace hardcoded CSS values with design token references. Use this after the render tool identifies issues to automatically fix them.",
347
347
  params: {}
348
348
  }
349
349
  ];
350
350
  function buildToolNames(prefix) {
351
351
  const map = {};
352
352
  for (const def of MCP_TOOL_DEFINITIONS) {
353
- map[def.key] = `${prefix}_${def.key}`;
353
+ map[def.key] = prefix ? `${prefix}_${def.key}` : def.key;
354
354
  }
355
355
  return map;
356
356
  }
@@ -382,7 +382,7 @@ function buildMcpTools(prefix, extensions) {
382
382
  properties[name] = prop;
383
383
  }
384
384
  return {
385
- name: `${prefix}_${def.key}`,
385
+ name: prefix ? `${prefix}_${def.key}` : def.key,
386
386
  description: ext?.description ?? def.description,
387
387
  inputSchema: {
388
388
  type: "object",
@@ -84,6 +84,8 @@ var CLI_COMMANDS = [
84
84
  { flags: "--registry", description: "Also generate .fragments/registry.json and context.md" },
85
85
  { flags: "--registry-only", description: "Only generate .fragments/ directory (skip fragments.json)" },
86
86
  { flags: "--from-source", description: "Build from source code (zero-config, no fragment files needed)" },
87
+ { flags: "--if-needed", description: "Skip rebuilding when fragments.json is already fresh" },
88
+ { flags: "--check", description: "Check whether fragments.json is fresh and exit non-zero if it is stale" },
87
89
  { flags: "--skip-usage", description: "Skip usage analysis when building from source" },
88
90
  { flags: "--skip-storybook", description: "Skip Storybook parsing when building from source" },
89
91
  { flags: "-v, --verbose", description: "Verbose output" }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CLI_COMMANDS,
3
3
  CLI_COMMAND_CATEGORIES
4
- } from "../chunk-XVZH4IVV.js";
4
+ } from "../chunk-RQ46R2HQ.js";
5
5
  export {
6
6
  CLI_COMMANDS,
7
7
  CLI_COMMAND_CATEGORIES
package/dist/index.js CHANGED
@@ -3,11 +3,11 @@ import {
3
3
  MCP_TOOL_DEFINITIONS,
4
4
  buildMcpTools,
5
5
  buildToolNames
6
- } from "./chunk-62K7BSAT.js";
6
+ } from "./chunk-3IBKSLZY.js";
7
7
  import {
8
8
  CLI_COMMANDS,
9
9
  CLI_COMMAND_CATEGORIES
10
- } from "./chunk-XVZH4IVV.js";
10
+ } from "./chunk-RQ46R2HQ.js";
11
11
  import {
12
12
  chunkByAST,
13
13
  chunkByLines,
@@ -15,7 +15,7 @@ interface McpToolParam {
15
15
  properties?: Record<string, McpToolParam>;
16
16
  }
17
17
  interface McpToolDefinition {
18
- /** Short key used to build the prefixed tool name, e.g. "discover" */
18
+ /** Short key used as the canonical tool name, e.g. "discover" */
19
19
  key: string;
20
20
  description: string;
21
21
  params: Record<string, McpToolParam>;
@@ -41,13 +41,14 @@ interface McpSdkTool {
41
41
  };
42
42
  }
43
43
  /**
44
- * Build a TOOL_NAMES map: `{ discover: "prefix_discover", ... }`
44
+ * Build a TOOL_NAMES map: `{ discover: "discover", ... }` by default.
45
+ * Pass a prefix only for embedding scenarios that intentionally namespace tools.
45
46
  */
46
- declare function buildToolNames(prefix: string): Record<string, string>;
47
+ declare function buildToolNames(prefix?: string): Record<string, string>;
47
48
  /**
48
49
  * Build MCP SDK `Tool[]` from shared definitions, optionally merging CLI
49
- * extensions.
50
+ * extensions. Tool names are bare by default.
50
51
  */
51
- declare function buildMcpTools(prefix: string, extensions?: CliToolExtension[]): McpSdkTool[];
52
+ declare function buildMcpTools(prefix?: string, extensions?: CliToolExtension[]): McpSdkTool[];
52
53
 
53
54
  export { CLI_TOOL_EXTENSIONS, type CliToolExtension, MCP_TOOL_DEFINITIONS, type McpToolDefinition, type McpToolParam, buildMcpTools, buildToolNames };
@@ -3,7 +3,7 @@ import {
3
3
  MCP_TOOL_DEFINITIONS,
4
4
  buildMcpTools,
5
5
  buildToolNames
6
- } from "../chunk-62K7BSAT.js";
6
+ } from "../chunk-3IBKSLZY.js";
7
7
  export {
8
8
  CLI_TOOL_EXTENSIONS,
9
9
  MCP_TOOL_DEFINITIONS,
@@ -219,6 +219,10 @@ interface PerformanceSummary {
219
219
  interface CompiledFragmentsFile {
220
220
  version: string;
221
221
  generatedAt: string;
222
+ /** CLI version that produced this file, used for freshness checks */
223
+ generatorVersion?: string;
224
+ /** Relative source/config inputs used to build this file, used for freshness checks */
225
+ buildInputs?: string[];
222
226
  packageName?: string;
223
227
  fragments: Record<string, CompiledFragment>;
224
228
  blocks?: Record<string, CompiledBlock>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fragments-sdk/context",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "license": "FSL-1.1-MIT",
5
5
  "description": "Code intelligence and RAG primitives for design system and codebase indexing",
6
6
  "author": "Conan McNicholl",