@fragments-sdk/context 0.3.0 → 0.3.2
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/LICENSE +77 -14
- package/dist/{chunk-KKABP4K4.js → chunk-2UQY4VNM.js} +40 -40
- package/dist/{chunk-U4V5NX67.js → chunk-IQMVRBVF.js} +1 -1
- package/dist/cli-commands/index.js +1 -1
- package/dist/generate/index.d.ts +4 -4
- package/dist/generate/index.js +1 -1
- package/dist/graph/index.d.ts +3 -3
- package/dist/graph/index.js +8 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/types/index.d.ts +16 -15
- package/dist/{types-DOhSojcf.d.ts → types-RAbbckR4.d.ts} +2 -2
- package/package.json +12 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,84 @@
|
|
|
1
|
-
MIT License
|
|
1
|
+
Functional Source License, Version 1.1, MIT Future License
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Licensor: Conan McNicholl
|
|
4
|
+
Software: Fragments SDK (@fragments-sdk/cli, @fragments-sdk/mcp, @fragments-sdk/context)
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
6
|
+
IMPORTANT: The @fragments-sdk/ui package is licensed separately under the MIT License.
|
|
7
|
+
See libs/ui/LICENSE for details.
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The individual or entity listed above.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The software identified above, including all source code, object code,
|
|
20
|
+
documentation, and other files provided by the Licensor.
|
|
21
|
+
|
|
22
|
+
### Grant of Rights
|
|
23
|
+
|
|
24
|
+
Subject to the conditions below, the Licensor grants you a non-exclusive,
|
|
25
|
+
worldwide, royalty-free license to use, copy, modify, create derivative works,
|
|
26
|
+
and redistribute the Software, in each case subject to the limitations below.
|
|
27
|
+
|
|
28
|
+
### Limitation — Competing Use
|
|
29
|
+
|
|
30
|
+
You may not use the Software in, or to provide, a Commercial Product or Service
|
|
31
|
+
that competes with the Software or with any product or service that the Licensor
|
|
32
|
+
provides using the Software. A "Commercial Product or Service" is any product or
|
|
33
|
+
service offered to third parties for a fee or other consideration.
|
|
34
|
+
|
|
35
|
+
For clarity, the following uses are always permitted regardless of this limitation:
|
|
36
|
+
|
|
37
|
+
- Using the Software for your own internal business purposes
|
|
38
|
+
- Using the Software to build and deploy your own applications
|
|
39
|
+
- Using the Software for personal, educational, or evaluation purposes
|
|
40
|
+
- Providing professional services (consulting, integration) to your clients
|
|
41
|
+
that involve configuring or extending the Software
|
|
42
|
+
|
|
43
|
+
The following are examples of Competing Use that are NOT permitted:
|
|
44
|
+
|
|
45
|
+
- Offering a hosted developer tools service that repackages or exposes
|
|
46
|
+
the functionality of the Software
|
|
47
|
+
- Selling or distributing a product that is a substitute for any product
|
|
48
|
+
or service offered by the Licensor
|
|
49
|
+
- Building and offering an MCP server, CLI tool, or code intelligence
|
|
50
|
+
platform that is substantially derived from the Software
|
|
51
|
+
|
|
52
|
+
### Change Date and License
|
|
53
|
+
|
|
54
|
+
On the second anniversary of each version's release date, the Licensor grants
|
|
55
|
+
you the rights under the terms of the MIT License for that version.
|
|
56
|
+
The "MIT License" means the license identified by SPDX as "MIT" and published
|
|
57
|
+
at https://opensource.org/licenses/MIT.
|
|
58
|
+
|
|
59
|
+
### No Warranties
|
|
14
60
|
|
|
15
61
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
62
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
18
|
-
|
|
63
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
64
|
+
|
|
65
|
+
### Limitation of Liability
|
|
66
|
+
|
|
67
|
+
IN NO EVENT SHALL THE LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
68
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
SOFTWARE.
|
|
69
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
70
|
+
THE SOFTWARE.
|
|
71
|
+
|
|
72
|
+
### General
|
|
73
|
+
|
|
74
|
+
If any provision of this License is held to be unenforceable, that provision
|
|
75
|
+
shall be reformed only to the extent necessary to make it enforceable, and the
|
|
76
|
+
remaining provisions shall continue in full force and effect.
|
|
77
|
+
|
|
78
|
+
This License does not grant permission to use the trade names, trademarks,
|
|
79
|
+
service marks, or product names of the Licensor, except as required for
|
|
80
|
+
reasonable and customary use in describing the origin of the Software.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
For more information about the Functional Source License, see https://fsl.software/
|
|
@@ -10,7 +10,7 @@ function filterPlaceholders(items) {
|
|
|
10
10
|
(item) => !PLACEHOLDER_PATTERNS.some((pattern) => pattern.test(item.trim()))
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
|
-
function generateContext(
|
|
13
|
+
function generateContext(fragments, options = {}, blocks) {
|
|
14
14
|
const format = options.format ?? "markdown";
|
|
15
15
|
const compact = options.compact ?? false;
|
|
16
16
|
const include = {
|
|
@@ -20,7 +20,7 @@ function generateContext(segments, options = {}, blocks) {
|
|
|
20
20
|
relations: options.include?.relations ?? false,
|
|
21
21
|
code: options.include?.code ?? false
|
|
22
22
|
};
|
|
23
|
-
const sorted = [...
|
|
23
|
+
const sorted = [...fragments].sort((a, b) => {
|
|
24
24
|
const catCompare = a.meta.category.localeCompare(b.meta.category);
|
|
25
25
|
if (catCompare !== 0) return catCompare;
|
|
26
26
|
return a.meta.name.localeCompare(b.meta.name);
|
|
@@ -30,7 +30,7 @@ function generateContext(segments, options = {}, blocks) {
|
|
|
30
30
|
}
|
|
31
31
|
return generateMarkdownContext(sorted, include, compact, blocks);
|
|
32
32
|
}
|
|
33
|
-
function generateMarkdownContext(
|
|
33
|
+
function generateMarkdownContext(fragments, include, compact, blocks) {
|
|
34
34
|
const lines = [];
|
|
35
35
|
lines.push("# Design System Reference");
|
|
36
36
|
lines.push("");
|
|
@@ -38,10 +38,10 @@ function generateMarkdownContext(segments, include, compact, blocks) {
|
|
|
38
38
|
lines.push("");
|
|
39
39
|
lines.push("| Component | Category | Use For |");
|
|
40
40
|
lines.push("|-----------|----------|---------|");
|
|
41
|
-
for (const
|
|
42
|
-
const filteredWhen = filterPlaceholders(
|
|
43
|
-
const useFor = filteredWhen.slice(0, 2).join(", ") ||
|
|
44
|
-
lines.push(`| ${
|
|
41
|
+
for (const fragment of fragments) {
|
|
42
|
+
const filteredWhen = filterPlaceholders(fragment.usage.when);
|
|
43
|
+
const useFor = filteredWhen.slice(0, 2).join(", ") || fragment.meta.description;
|
|
44
|
+
lines.push(`| ${fragment.meta.name} | ${fragment.meta.category} | ${truncate(useFor, 50)} |`);
|
|
45
45
|
}
|
|
46
46
|
lines.push("");
|
|
47
47
|
if (compact) {
|
|
@@ -50,21 +50,21 @@ function generateMarkdownContext(segments, include, compact, blocks) {
|
|
|
50
50
|
}
|
|
51
51
|
lines.push("## Components");
|
|
52
52
|
lines.push("");
|
|
53
|
-
for (const
|
|
54
|
-
lines.push(`### ${
|
|
53
|
+
for (const fragment of fragments) {
|
|
54
|
+
lines.push(`### ${fragment.meta.name}`);
|
|
55
55
|
lines.push("");
|
|
56
|
-
const statusParts = [`**Category:** ${
|
|
57
|
-
if (
|
|
58
|
-
statusParts.push(`**Status:** ${
|
|
56
|
+
const statusParts = [`**Category:** ${fragment.meta.category}`];
|
|
57
|
+
if (fragment.meta.status) {
|
|
58
|
+
statusParts.push(`**Status:** ${fragment.meta.status}`);
|
|
59
59
|
}
|
|
60
60
|
lines.push(statusParts.join(" | "));
|
|
61
61
|
lines.push("");
|
|
62
|
-
if (
|
|
63
|
-
lines.push(
|
|
62
|
+
if (fragment.meta.description) {
|
|
63
|
+
lines.push(fragment.meta.description);
|
|
64
64
|
lines.push("");
|
|
65
65
|
}
|
|
66
|
-
const whenFiltered = filterPlaceholders(
|
|
67
|
-
const whenNotFiltered = filterPlaceholders(
|
|
66
|
+
const whenFiltered = filterPlaceholders(fragment.usage.when);
|
|
67
|
+
const whenNotFiltered = filterPlaceholders(fragment.usage.whenNot);
|
|
68
68
|
if (include.usage && (whenFiltered.length > 0 || whenNotFiltered.length > 0)) {
|
|
69
69
|
if (whenFiltered.length > 0) {
|
|
70
70
|
lines.push("**When to use:**");
|
|
@@ -81,19 +81,19 @@ function generateMarkdownContext(segments, include, compact, blocks) {
|
|
|
81
81
|
lines.push("");
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
if (include.props && Object.keys(
|
|
84
|
+
if (include.props && Object.keys(fragment.props).length > 0) {
|
|
85
85
|
lines.push("**Props:**");
|
|
86
|
-
for (const [name, prop] of Object.entries(
|
|
86
|
+
for (const [name, prop] of Object.entries(fragment.props)) {
|
|
87
87
|
lines.push(`- \`${name}\`: ${formatPropType(prop)}${prop.required ? " (required)" : ""}`);
|
|
88
88
|
}
|
|
89
89
|
lines.push("");
|
|
90
90
|
}
|
|
91
|
-
if (include.variants &&
|
|
92
|
-
const variantNames =
|
|
91
|
+
if (include.variants && fragment.variants.length > 0) {
|
|
92
|
+
const variantNames = fragment.variants.map((v) => v.name).join(", ");
|
|
93
93
|
lines.push(`**Variants:** ${variantNames}`);
|
|
94
94
|
lines.push("");
|
|
95
95
|
if (include.code) {
|
|
96
|
-
for (const variant of
|
|
96
|
+
for (const variant of fragment.variants) {
|
|
97
97
|
if (variant.code) {
|
|
98
98
|
lines.push(`*${variant.name}:*`);
|
|
99
99
|
lines.push("```tsx");
|
|
@@ -104,9 +104,9 @@ function generateMarkdownContext(segments, include, compact, blocks) {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
if (include.relations &&
|
|
107
|
+
if (include.relations && fragment.relations && fragment.relations.length > 0) {
|
|
108
108
|
lines.push("**Related:**");
|
|
109
|
-
for (const relation of
|
|
109
|
+
for (const relation of fragment.relations) {
|
|
110
110
|
lines.push(`- ${relation.component} (${relation.relationship}): ${relation.note}`);
|
|
111
111
|
}
|
|
112
112
|
lines.push("");
|
|
@@ -141,27 +141,27 @@ function generateMarkdownContext(segments, include, compact, blocks) {
|
|
|
141
141
|
const content = lines.join("\n");
|
|
142
142
|
return { content, tokenEstimate: estimateTokens(content) };
|
|
143
143
|
}
|
|
144
|
-
function generateJsonContext(
|
|
145
|
-
const categories = [...new Set(
|
|
144
|
+
function generateJsonContext(fragments, include, compact, blocks) {
|
|
145
|
+
const categories = [...new Set(fragments.map((s) => s.meta.category))].sort();
|
|
146
146
|
const components = {};
|
|
147
|
-
for (const
|
|
147
|
+
for (const fragment of fragments) {
|
|
148
148
|
const component = {
|
|
149
|
-
category:
|
|
150
|
-
description:
|
|
149
|
+
category: fragment.meta.category,
|
|
150
|
+
description: fragment.meta.description
|
|
151
151
|
};
|
|
152
|
-
if (
|
|
153
|
-
component.status =
|
|
152
|
+
if (fragment.meta.status) {
|
|
153
|
+
component.status = fragment.meta.status;
|
|
154
154
|
}
|
|
155
155
|
if (!compact) {
|
|
156
156
|
if (include.usage) {
|
|
157
|
-
const whenFiltered = filterPlaceholders(
|
|
158
|
-
const whenNotFiltered = filterPlaceholders(
|
|
157
|
+
const whenFiltered = filterPlaceholders(fragment.usage.when);
|
|
158
|
+
const whenNotFiltered = filterPlaceholders(fragment.usage.whenNot);
|
|
159
159
|
if (whenFiltered.length > 0) component.whenToUse = whenFiltered;
|
|
160
160
|
if (whenNotFiltered.length > 0) component.whenNotToUse = whenNotFiltered;
|
|
161
161
|
}
|
|
162
|
-
if (include.props && Object.keys(
|
|
162
|
+
if (include.props && Object.keys(fragment.props).length > 0) {
|
|
163
163
|
component.props = {};
|
|
164
|
-
for (const [name, prop] of Object.entries(
|
|
164
|
+
for (const [name, prop] of Object.entries(fragment.props)) {
|
|
165
165
|
component.props[name] = {
|
|
166
166
|
type: formatPropType(prop),
|
|
167
167
|
description: prop.description
|
|
@@ -170,18 +170,18 @@ function generateJsonContext(segments, include, compact, blocks) {
|
|
|
170
170
|
if (prop.default !== void 0) component.props[name].default = prop.default;
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
if (include.variants &&
|
|
174
|
-
component.variants =
|
|
173
|
+
if (include.variants && fragment.variants.length > 0) {
|
|
174
|
+
component.variants = fragment.variants.map((v) => v.name);
|
|
175
175
|
}
|
|
176
|
-
if (include.relations &&
|
|
177
|
-
component.relations =
|
|
176
|
+
if (include.relations && fragment.relations && fragment.relations.length > 0) {
|
|
177
|
+
component.relations = fragment.relations.map((r) => ({
|
|
178
178
|
component: r.component,
|
|
179
179
|
relationship: r.relationship,
|
|
180
180
|
note: r.note
|
|
181
181
|
}));
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
|
-
components[
|
|
184
|
+
components[fragment.meta.name] = component;
|
|
185
185
|
}
|
|
186
186
|
const blocksMap = blocks && blocks.length > 0 ? Object.fromEntries(blocks.map((b) => [b.name, {
|
|
187
187
|
description: b.description,
|
|
@@ -194,7 +194,7 @@ function generateJsonContext(segments, include, compact, blocks) {
|
|
|
194
194
|
version: "1.0",
|
|
195
195
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
196
196
|
summary: {
|
|
197
|
-
totalComponents:
|
|
197
|
+
totalComponents: fragments.length,
|
|
198
198
|
categories,
|
|
199
199
|
...blocksMap && { totalBlocks: blocks.length }
|
|
200
200
|
},
|
|
@@ -399,7 +399,7 @@ var CLI_COMMANDS = [
|
|
|
399
399
|
options: [
|
|
400
400
|
{ flags: "-c, --config <path>", description: "Path to config file" },
|
|
401
401
|
{ flags: "-o, --output <dir>", description: "Output directory", default: ".storybook/generated" },
|
|
402
|
-
{ flags: "--watch", description: "Watch for
|
|
402
|
+
{ flags: "--watch", description: "Watch for fragment changes and regenerate" },
|
|
403
403
|
{ flags: "--format <format>", description: "Story format (csf3)", default: "csf3" }
|
|
404
404
|
]
|
|
405
405
|
},
|
package/dist/generate/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '../types-
|
|
1
|
+
import { CompiledFragment, CompiledBlock } from '../types/index.js';
|
|
2
|
+
import '../types-RAbbckR4.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Context generation for AI agents.
|
|
@@ -37,8 +37,8 @@ interface ContextResult {
|
|
|
37
37
|
tokenEstimate: number;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* Generate AI-ready context from compiled
|
|
40
|
+
* Generate AI-ready context from compiled fragments and optional blocks
|
|
41
41
|
*/
|
|
42
|
-
declare function generateContext(
|
|
42
|
+
declare function generateContext(fragments: CompiledFragment[], options?: ContextOptions, blocks?: CompiledBlock[]): ContextResult;
|
|
43
43
|
|
|
44
44
|
export { type ContextOptions, type ContextResult, PLACEHOLDER_PATTERNS, filterPlaceholders, generateContext };
|
package/dist/generate/index.js
CHANGED
package/dist/graph/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ComponentGraph, G as GraphEdgeType, a as GraphEdge, I as ImpactResult, P as PathResult, N as NeighborResult, b as CompositionTree, c as GraphHealth, d as ComponentNode, S as SerializedComponentGraph } from '../types-
|
|
2
|
-
export { E as EDGE_TYPE_WEIGHTS, f as GRAPH_EDGE_TYPES, e as SerializedEdge } from '../types-
|
|
1
|
+
import { C as ComponentGraph, G as GraphEdgeType, a as GraphEdge, I as ImpactResult, P as PathResult, N as NeighborResult, b as CompositionTree, c as GraphHealth, d as ComponentNode, S as SerializedComponentGraph } from '../types-RAbbckR4.js';
|
|
2
|
+
export { E as EDGE_TYPE_WEIGHTS, f as GRAPH_EDGE_TYPES, e as SerializedEdge } from '../types-RAbbckR4.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* ComponentGraphEngine — query engine for the design-system relationship graph.
|
|
@@ -33,7 +33,7 @@ declare class ComponentGraphEngine {
|
|
|
33
33
|
neighbors(component: string, maxHops?: number): NeighborResult;
|
|
34
34
|
/** Get the composition tree for a compound component */
|
|
35
35
|
composition(component: string): CompositionTree;
|
|
36
|
-
/** Get alternative components */
|
|
36
|
+
/** Get alternative components (deduplicated for bidirectional edges) */
|
|
37
37
|
alternatives(component: string): Array<{
|
|
38
38
|
component: string;
|
|
39
39
|
note?: string;
|
package/dist/graph/index.js
CHANGED
|
@@ -203,7 +203,7 @@ var ComponentGraphEngine = class {
|
|
|
203
203
|
const node = this.nodes.get(component);
|
|
204
204
|
const subComponents = node?.subComponents ?? [];
|
|
205
205
|
const parentEdges = (this.outgoing.get(component) ?? []).filter((e) => e.type === "parent-of");
|
|
206
|
-
const
|
|
206
|
+
const children = parentEdges.map((e) => e.target);
|
|
207
207
|
const childEdges = (this.incoming.get(component) ?? []).filter((e) => e.type === "parent-of");
|
|
208
208
|
const parent = childEdges.length > 0 ? childEdges[0].source : void 0;
|
|
209
209
|
const siblings = [];
|
|
@@ -227,22 +227,25 @@ var ComponentGraphEngine = class {
|
|
|
227
227
|
component,
|
|
228
228
|
compositionPattern: node?.compositionPattern,
|
|
229
229
|
subComponents,
|
|
230
|
-
|
|
230
|
+
children,
|
|
231
231
|
parent,
|
|
232
232
|
siblings,
|
|
233
233
|
blocks: this.blockIndex.get(component) ?? []
|
|
234
234
|
};
|
|
235
235
|
}
|
|
236
|
-
/** Get alternative components */
|
|
236
|
+
/** Get alternative components (deduplicated for bidirectional edges) */
|
|
237
237
|
alternatives(component) {
|
|
238
|
+
const seen = /* @__PURE__ */ new Set();
|
|
238
239
|
const alts = [];
|
|
239
240
|
for (const edge of this.outgoing.get(component) ?? []) {
|
|
240
|
-
if (edge.type === "alternative-to") {
|
|
241
|
+
if (edge.type === "alternative-to" && !seen.has(edge.target)) {
|
|
242
|
+
seen.add(edge.target);
|
|
241
243
|
alts.push({ component: edge.target, note: edge.note });
|
|
242
244
|
}
|
|
243
245
|
}
|
|
244
246
|
for (const edge of this.incoming.get(component) ?? []) {
|
|
245
|
-
if (edge.type === "alternative-to") {
|
|
247
|
+
if (edge.type === "alternative-to" && !seen.has(edge.source)) {
|
|
248
|
+
seen.add(edge.source);
|
|
246
249
|
alts.push({ component: edge.source, note: edge.note });
|
|
247
250
|
}
|
|
248
251
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AIMetadata, CompiledBlock,
|
|
1
|
+
export { AIMetadata, CompiledBlock, CompiledFragment, CompiledFragmentsFile, CompiledTokenData, CompiledTokenEntry, ComponentRelation, FragmentContract, FragmentGenerated, FragmentMeta, FragmentUsage, PropDefinition, Theme, VerifyResult } from './types/index.js';
|
|
2
2
|
export { ContextOptions, ContextResult, PLACEHOLDER_PATTERNS, filterPlaceholders, generateContext } from './generate/index.js';
|
|
3
3
|
export { ASTChunkerOptions, ChunkOptions, CodeChunk, chunkByAST, chunkByLines, chunkFile } from './chunking/index.js';
|
|
4
4
|
export { EmbeddingOptions, EmbeddingResult, RerankOptions, RerankResult, generateEmbeddings, rerankResults } from './embeddings/voyage.js';
|
|
@@ -8,4 +8,4 @@ export { AST_SUPPORTED_LANGUAGES, ChangedFiles, FileEntry, GrammarMapping, INDEX
|
|
|
8
8
|
export { ChunkMapping, CitationDocumentBlock, CitationDocumentOptions, DocumentMapping, RawCitation, ResolvedCitation, buildCitationDocuments, resolveCitation, resolveCitations } from './citations/index.js';
|
|
9
9
|
export { CLI_TOOL_EXTENSIONS, CliToolExtension, MCP_TOOL_DEFINITIONS, McpToolDefinition, McpToolParam, buildMcpTools, buildToolNames } from './mcp-tools/index.js';
|
|
10
10
|
export { CLI_COMMANDS, CLI_COMMAND_CATEGORIES, CliCategoryInfo, CliCommandCategory, CliCommandDef, CliOptionDef } from './cli-commands/index.js';
|
|
11
|
-
import './types-
|
|
11
|
+
import './types-RAbbckR4.js';
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
CLI_COMMANDS,
|
|
9
9
|
CLI_COMMAND_CATEGORIES
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-IQMVRBVF.js";
|
|
11
11
|
import {
|
|
12
12
|
chunkByAST,
|
|
13
13
|
chunkByLines,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
PLACEHOLDER_PATTERNS,
|
|
37
37
|
filterPlaceholders,
|
|
38
38
|
generateContext
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-2UQY4VNM.js";
|
|
40
40
|
import {
|
|
41
41
|
buildCitationDocuments,
|
|
42
42
|
resolveCitation,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SerializedComponentGraph } from '../types-
|
|
1
|
+
import { S as SerializedComponentGraph } from '../types-RAbbckR4.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Compiled fragment types — shared between CLI and MCP packages.
|
|
@@ -9,7 +9,7 @@ import { S as SerializedComponentGraph } from '../types-DOhSojcf.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* Component metadata
|
|
11
11
|
*/
|
|
12
|
-
interface
|
|
12
|
+
interface FragmentMeta {
|
|
13
13
|
name: string;
|
|
14
14
|
description: string;
|
|
15
15
|
category: string;
|
|
@@ -22,7 +22,7 @@ interface SegmentMeta {
|
|
|
22
22
|
/**
|
|
23
23
|
* Usage guidelines for AI agents and developers
|
|
24
24
|
*/
|
|
25
|
-
interface
|
|
25
|
+
interface FragmentUsage {
|
|
26
26
|
when: string[];
|
|
27
27
|
whenNot: string[];
|
|
28
28
|
guidelines?: string[];
|
|
@@ -58,7 +58,7 @@ interface ComponentRelation {
|
|
|
58
58
|
/**
|
|
59
59
|
* Agent-optimized contract metadata
|
|
60
60
|
*/
|
|
61
|
-
interface
|
|
61
|
+
interface FragmentContract {
|
|
62
62
|
propsSummary?: string[];
|
|
63
63
|
a11yRules?: string[];
|
|
64
64
|
bans?: Array<{
|
|
@@ -68,9 +68,9 @@ interface SegmentContract {
|
|
|
68
68
|
scenarioTags?: string[];
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
|
-
* Provenance tracking for generated
|
|
71
|
+
* Provenance tracking for generated fragments
|
|
72
72
|
*/
|
|
73
|
-
interface
|
|
73
|
+
interface FragmentGenerated {
|
|
74
74
|
source: "storybook" | "manual" | "ai";
|
|
75
75
|
sourceFile?: string;
|
|
76
76
|
confidence?: number;
|
|
@@ -86,12 +86,12 @@ interface AIMetadata {
|
|
|
86
86
|
commonPatterns?: string[];
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
|
-
* Compiled
|
|
89
|
+
* Compiled fragment data (JSON-serializable for AI consumption)
|
|
90
90
|
*/
|
|
91
|
-
interface
|
|
91
|
+
interface CompiledFragment {
|
|
92
92
|
filePath: string;
|
|
93
|
-
meta:
|
|
94
|
-
usage:
|
|
93
|
+
meta: FragmentMeta;
|
|
94
|
+
usage: FragmentUsage;
|
|
95
95
|
props: Record<string, PropDefinition>;
|
|
96
96
|
relations?: ComponentRelation[];
|
|
97
97
|
variants: Array<{
|
|
@@ -101,9 +101,9 @@ interface CompiledSegment {
|
|
|
101
101
|
figma?: string;
|
|
102
102
|
args?: Record<string, unknown>;
|
|
103
103
|
}>;
|
|
104
|
-
contract?:
|
|
104
|
+
contract?: FragmentContract;
|
|
105
105
|
ai?: AIMetadata;
|
|
106
|
-
_generated?:
|
|
106
|
+
_generated?: FragmentGenerated;
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* Compiled block data (JSON-serializable for AI consumption)
|
|
@@ -122,6 +122,7 @@ interface CompiledBlock {
|
|
|
122
122
|
*/
|
|
123
123
|
interface CompiledTokenEntry {
|
|
124
124
|
name: string;
|
|
125
|
+
value?: string;
|
|
125
126
|
description?: string;
|
|
126
127
|
}
|
|
127
128
|
/**
|
|
@@ -135,11 +136,11 @@ interface CompiledTokenData {
|
|
|
135
136
|
/**
|
|
136
137
|
* The compiled fragments.json structure
|
|
137
138
|
*/
|
|
138
|
-
interface
|
|
139
|
+
interface CompiledFragmentsFile {
|
|
139
140
|
version: string;
|
|
140
141
|
generatedAt: string;
|
|
141
142
|
packageName?: string;
|
|
142
|
-
|
|
143
|
+
fragments: Record<string, CompiledFragment>;
|
|
143
144
|
blocks?: Record<string, CompiledBlock>;
|
|
144
145
|
tokens?: CompiledTokenData;
|
|
145
146
|
/** Component relationship graph for AI structural queries */
|
|
@@ -171,4 +172,4 @@ interface VerifyResult {
|
|
|
171
172
|
};
|
|
172
173
|
}
|
|
173
174
|
|
|
174
|
-
export type { AIMetadata, CompiledBlock,
|
|
175
|
+
export type { AIMetadata, CompiledBlock, CompiledFragment, CompiledFragmentsFile, CompiledTokenData, CompiledTokenEntry, ComponentRelation, FragmentContract, FragmentGenerated, FragmentMeta, FragmentUsage, PropDefinition, Theme, VerifyResult };
|
|
@@ -87,8 +87,8 @@ interface CompositionTree {
|
|
|
87
87
|
compositionPattern?: 'compound' | 'simple' | 'controlled';
|
|
88
88
|
/** Direct sub-components */
|
|
89
89
|
subComponents: string[];
|
|
90
|
-
/**
|
|
91
|
-
|
|
90
|
+
/** Components that declare this component as their parent */
|
|
91
|
+
children: string[];
|
|
92
92
|
/** Parent component (if this is a sub-component) */
|
|
93
93
|
parent?: string;
|
|
94
94
|
/** Sibling components at the same level */
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fragments-sdk/context",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
|
+
"license": "FSL-1.1-MIT",
|
|
4
5
|
"description": "Code intelligence and RAG primitives for design system and codebase indexing",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
@@ -56,6 +57,16 @@
|
|
|
56
57
|
"import": "./dist/graph/index.js"
|
|
57
58
|
}
|
|
58
59
|
},
|
|
60
|
+
"keywords": [
|
|
61
|
+
"rag",
|
|
62
|
+
"embeddings",
|
|
63
|
+
"code-intelligence",
|
|
64
|
+
"chunking",
|
|
65
|
+
"search",
|
|
66
|
+
"indexing",
|
|
67
|
+
"ai",
|
|
68
|
+
"context"
|
|
69
|
+
],
|
|
59
70
|
"publishConfig": {
|
|
60
71
|
"access": "public"
|
|
61
72
|
},
|