@fragments-sdk/context 0.3.4 → 0.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.
|
@@ -193,6 +193,19 @@ var CLI_COMMANDS = [
|
|
|
193
193
|
{ flags: "-p, --port <port>", description: "Dev server port", default: "6006" }
|
|
194
194
|
]
|
|
195
195
|
},
|
|
196
|
+
{
|
|
197
|
+
name: "perf",
|
|
198
|
+
description: "Profile component bundle sizes and performance budgets",
|
|
199
|
+
category: "quality",
|
|
200
|
+
usage: "fragments perf [options]",
|
|
201
|
+
options: [
|
|
202
|
+
{ flags: "-c, --config <path>", description: "Path to config file" },
|
|
203
|
+
{ flags: "--json", description: "Output results as JSON" },
|
|
204
|
+
{ flags: "--component <name>", description: "Measure specific component only" },
|
|
205
|
+
{ flags: "--no-write", description: "Do not write results to fragments.json" },
|
|
206
|
+
{ flags: "--concurrency <n>", description: "Max concurrent measurements", default: "4" }
|
|
207
|
+
]
|
|
208
|
+
},
|
|
196
209
|
{
|
|
197
210
|
name: "test",
|
|
198
211
|
description: "Run interaction tests for fragments with play functions",
|
|
@@ -245,6 +245,26 @@ var MCP_TOOL_DEFINITIONS = [
|
|
|
245
245
|
},
|
|
246
246
|
required: ["mode"]
|
|
247
247
|
},
|
|
248
|
+
{
|
|
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.",
|
|
251
|
+
params: {
|
|
252
|
+
component: {
|
|
253
|
+
type: "string",
|
|
254
|
+
description: "Component name to query (optional, returns all if omitted)"
|
|
255
|
+
},
|
|
256
|
+
sort: {
|
|
257
|
+
type: "string",
|
|
258
|
+
enum: ["size", "name", "budget"],
|
|
259
|
+
description: "Sort order: size (largest first), name (alphabetical), budget (most over-budget first). Default: size"
|
|
260
|
+
},
|
|
261
|
+
filter: {
|
|
262
|
+
type: "string",
|
|
263
|
+
enum: ["lightweight", "moderate", "heavy", "over-budget"],
|
|
264
|
+
description: "Filter by complexity tier or over-budget status"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
},
|
|
248
268
|
{
|
|
249
269
|
key: "a11y",
|
|
250
270
|
description: "Run an accessibility audit on a component. Returns axe-core violations, a WCAG compliance score, and optional fix suggestions. Requires a running Fragments dev server.",
|
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-FGBRIJOT.js";
|
|
7
7
|
import {
|
|
8
8
|
CLI_COMMANDS,
|
|
9
9
|
CLI_COMMAND_CATEGORIES
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-5CV3LGEU.js";
|
|
11
11
|
import {
|
|
12
12
|
chunkByAST,
|
|
13
13
|
chunkByLines,
|
package/dist/mcp-tools/index.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -16,6 +16,11 @@ interface FragmentMeta {
|
|
|
16
16
|
tags?: string[];
|
|
17
17
|
status?: "stable" | "beta" | "deprecated" | "experimental";
|
|
18
18
|
since?: string;
|
|
19
|
+
dependencies?: Array<{
|
|
20
|
+
name: string;
|
|
21
|
+
version: string;
|
|
22
|
+
reason?: string;
|
|
23
|
+
}>;
|
|
19
24
|
figma?: string;
|
|
20
25
|
figmaProps?: Record<string, unknown>;
|
|
21
26
|
}
|
|
@@ -66,6 +71,8 @@ interface FragmentContract {
|
|
|
66
71
|
message: string;
|
|
67
72
|
}>;
|
|
68
73
|
scenarioTags?: string[];
|
|
74
|
+
/** Per-component performance budget override in bytes (gzipped) */
|
|
75
|
+
performanceBudget?: number;
|
|
69
76
|
}
|
|
70
77
|
/**
|
|
71
78
|
* Provenance tracking for generated fragments
|
|
@@ -85,6 +92,36 @@ interface AIMetadata {
|
|
|
85
92
|
requiredChildren?: string[];
|
|
86
93
|
commonPatterns?: string[];
|
|
87
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Performance data for a component (from bundle size measurement)
|
|
97
|
+
*/
|
|
98
|
+
/**
|
|
99
|
+
* A single import contributing to bundle size
|
|
100
|
+
*/
|
|
101
|
+
interface ImportEntry {
|
|
102
|
+
/** Resolved file path (relative to project root) */
|
|
103
|
+
path: string;
|
|
104
|
+
/** Bytes contributed to the bundle */
|
|
105
|
+
bytes: number;
|
|
106
|
+
/** Percentage of total bundle size */
|
|
107
|
+
percent: number;
|
|
108
|
+
}
|
|
109
|
+
interface PerformanceData {
|
|
110
|
+
/** Gzipped bundle size in bytes */
|
|
111
|
+
bundleSize: number;
|
|
112
|
+
/** Raw (minified, not gzipped) bundle size in bytes */
|
|
113
|
+
rawSize: number;
|
|
114
|
+
/** Complexity classification */
|
|
115
|
+
complexity: 'lightweight' | 'moderate' | 'heavy';
|
|
116
|
+
/** Percentage of budget used (0-100+) */
|
|
117
|
+
budgetPercent: number;
|
|
118
|
+
/** Whether the component exceeds its budget */
|
|
119
|
+
overBudget: boolean;
|
|
120
|
+
/** ISO timestamp when measured */
|
|
121
|
+
measuredAt: string;
|
|
122
|
+
/** Top imports by size (largest first) */
|
|
123
|
+
imports?: ImportEntry[];
|
|
124
|
+
}
|
|
88
125
|
/**
|
|
89
126
|
* Compiled fragment data (JSON-serializable for AI consumption)
|
|
90
127
|
*/
|
|
@@ -103,6 +140,8 @@ interface CompiledFragment {
|
|
|
103
140
|
}>;
|
|
104
141
|
contract?: FragmentContract;
|
|
105
142
|
ai?: AIMetadata;
|
|
143
|
+
/** Component performance data from bundle size measurement */
|
|
144
|
+
performance?: PerformanceData;
|
|
106
145
|
_generated?: FragmentGenerated;
|
|
107
146
|
}
|
|
108
147
|
/**
|
|
@@ -133,6 +172,21 @@ interface CompiledTokenData {
|
|
|
133
172
|
total: number;
|
|
134
173
|
categories: Record<string, CompiledTokenEntry[]>;
|
|
135
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* Performance summary across all components
|
|
177
|
+
*/
|
|
178
|
+
interface PerformanceSummary {
|
|
179
|
+
/** Preset name used */
|
|
180
|
+
preset: string;
|
|
181
|
+
/** Budget applied in bytes */
|
|
182
|
+
budget: number;
|
|
183
|
+
/** Total components measured */
|
|
184
|
+
total: number;
|
|
185
|
+
/** Number of components over budget */
|
|
186
|
+
overBudget: number;
|
|
187
|
+
/** Distribution by tier */
|
|
188
|
+
tiers: Record<string, number>;
|
|
189
|
+
}
|
|
136
190
|
/**
|
|
137
191
|
* The compiled fragments.json structure
|
|
138
192
|
*/
|
|
@@ -145,6 +199,8 @@ interface CompiledFragmentsFile {
|
|
|
145
199
|
tokens?: CompiledTokenData;
|
|
146
200
|
/** Component relationship graph for AI structural queries */
|
|
147
201
|
graph?: SerializedComponentGraph;
|
|
202
|
+
/** Performance measurement summary */
|
|
203
|
+
performanceSummary?: PerformanceSummary;
|
|
148
204
|
/** @deprecated Use blocks instead */
|
|
149
205
|
recipes?: Record<string, CompiledBlock>;
|
|
150
206
|
}
|
|
@@ -172,4 +228,4 @@ interface VerifyResult {
|
|
|
172
228
|
};
|
|
173
229
|
}
|
|
174
230
|
|
|
175
|
-
export type { AIMetadata, CompiledBlock, CompiledFragment, CompiledFragmentsFile, CompiledTokenData, CompiledTokenEntry, ComponentRelation, FragmentContract, FragmentGenerated, FragmentMeta, FragmentUsage, PropDefinition, Theme, VerifyResult };
|
|
231
|
+
export type { AIMetadata, CompiledBlock, CompiledFragment, CompiledFragmentsFile, CompiledTokenData, CompiledTokenEntry, ComponentRelation, FragmentContract, FragmentGenerated, FragmentMeta, FragmentUsage, ImportEntry, PerformanceData, PerformanceSummary, PropDefinition, Theme, VerifyResult };
|