@fragments-sdk/context 0.5.1 → 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.
- package/dist/{chunk-27BMCKU6.js → chunk-3IBKSLZY.js} +6 -6
- package/dist/{chunk-BZ6SGVA2.js → chunk-RQ46R2HQ.js} +2 -14
- package/dist/cli-commands/index.js +1 -1
- package/dist/index.js +2 -2
- package/dist/mcp-tools/index.d.ts +6 -5
- package/dist/mcp-tools/index.js +1 -1
- package/dist/types/index.d.ts +23 -1
- package/package.json +1 -1
|
@@ -32,7 +32,7 @@ var MCP_TOOL_DEFINITIONS = [
|
|
|
32
32
|
},
|
|
33
33
|
compact: {
|
|
34
34
|
type: "boolean",
|
|
35
|
-
description: "If true, returns minimal output (
|
|
35
|
+
description: "If true, returns minimal output (names, categories, and propsSummary per component)"
|
|
36
36
|
},
|
|
37
37
|
includeCode: {
|
|
38
38
|
type: "boolean",
|
|
@@ -81,7 +81,7 @@ var MCP_TOOL_DEFINITIONS = [
|
|
|
81
81
|
verbosity: {
|
|
82
82
|
type: "string",
|
|
83
83
|
enum: ["compact", "standard", "full"],
|
|
84
|
-
description: 'Response detail level: "compact" (meta +
|
|
84
|
+
description: 'Response detail level: "compact" (~200 tokens: meta + propsSummary + provenance), "standard" (default, everything except full code), "full" (everything)'
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
required: ["component"]
|
|
@@ -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
|
|
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
|
|
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" }
|
|
@@ -129,20 +131,6 @@ var CLI_COMMANDS = [
|
|
|
129
131
|
]
|
|
130
132
|
},
|
|
131
133
|
// ── Dev ──
|
|
132
|
-
{
|
|
133
|
-
name: "dev",
|
|
134
|
-
description: "Start the development server with live component rendering",
|
|
135
|
-
category: "dev",
|
|
136
|
-
usage: "fragments dev [options]",
|
|
137
|
-
options: [
|
|
138
|
-
{ flags: "-p, --port <port>", description: "Port to run on", default: "6006" },
|
|
139
|
-
{ flags: "--no-open", description: "Do not open browser" },
|
|
140
|
-
{ flags: "--skip-setup", description: "Skip auto-setup (Storybook import, build, Figma link)" },
|
|
141
|
-
{ flags: "--skip-storybook", description: "Skip auto-importing from Storybook" },
|
|
142
|
-
{ flags: "--skip-figma", description: "Skip Figma link check" },
|
|
143
|
-
{ flags: "--skip-build", description: "Skip auto-building fragments.json" }
|
|
144
|
-
]
|
|
145
|
-
},
|
|
146
134
|
{
|
|
147
135
|
name: "list",
|
|
148
136
|
description: "List all discovered fragment files",
|
package/dist/index.js
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
MCP_TOOL_DEFINITIONS,
|
|
4
4
|
buildMcpTools,
|
|
5
5
|
buildToolNames
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3IBKSLZY.js";
|
|
7
7
|
import {
|
|
8
8
|
CLI_COMMANDS,
|
|
9
9
|
CLI_COMMAND_CATEGORIES
|
|
10
|
-
} from "./chunk-
|
|
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
|
|
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: "
|
|
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
|
|
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
|
|
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 };
|
package/dist/mcp-tools/index.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -86,9 +86,11 @@ interface FragmentContract {
|
|
|
86
86
|
* Provenance tracking for generated fragments
|
|
87
87
|
*/
|
|
88
88
|
interface FragmentGenerated {
|
|
89
|
-
source: "storybook" | "manual" | "ai";
|
|
89
|
+
source: "storybook" | "manual" | "ai" | "extracted" | "merged" | "migrated";
|
|
90
90
|
sourceFile?: string;
|
|
91
|
+
/** @deprecated Use provenance.verified instead */
|
|
91
92
|
confidence?: number;
|
|
93
|
+
verified?: boolean;
|
|
92
94
|
timestamp?: string;
|
|
93
95
|
}
|
|
94
96
|
/**
|
|
@@ -148,6 +150,22 @@ interface CompiledFragment {
|
|
|
148
150
|
}>;
|
|
149
151
|
contract?: FragmentContract;
|
|
150
152
|
ai?: AIMetadata;
|
|
153
|
+
/** Framework hint from contract, used by preview adapters and Cloud */
|
|
154
|
+
framework?: string;
|
|
155
|
+
/** Top-level compact prop summaries for agent first-pass */
|
|
156
|
+
propsSummary?: string[];
|
|
157
|
+
/** Source file path relative to config root (for contract-sourced fragments) */
|
|
158
|
+
sourcePath?: string;
|
|
159
|
+
/** Named export for preview adapter resolution */
|
|
160
|
+
exportName?: string;
|
|
161
|
+
/** Clean provenance tracking (V2) */
|
|
162
|
+
provenance?: {
|
|
163
|
+
source: string;
|
|
164
|
+
verified: boolean;
|
|
165
|
+
frameworkSupport?: string;
|
|
166
|
+
sourceHash?: string;
|
|
167
|
+
extractedAt?: string;
|
|
168
|
+
};
|
|
151
169
|
/** Component performance data from bundle size measurement */
|
|
152
170
|
performance?: PerformanceData;
|
|
153
171
|
_generated?: FragmentGenerated;
|
|
@@ -201,6 +219,10 @@ interface PerformanceSummary {
|
|
|
201
219
|
interface CompiledFragmentsFile {
|
|
202
220
|
version: string;
|
|
203
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[];
|
|
204
226
|
packageName?: string;
|
|
205
227
|
fragments: Record<string, CompiledFragment>;
|
|
206
228
|
blocks?: Record<string, CompiledBlock>;
|