@fragments-sdk/context 0.3.1 → 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 CHANGED
@@ -1,21 +1,84 @@
1
- MIT License
1
+ Functional Source License, Version 1.1, MIT Future License
2
2
 
3
- Copyright (c) 2024 Conan McNicholl
3
+ Licensor: Conan McNicholl
4
+ Software: Fragments SDK (@fragments-sdk/cli, @fragments-sdk/mcp, @fragments-sdk/context)
4
5
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
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
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
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. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
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 THE
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/
@@ -1,5 +1,5 @@
1
1
  import { CompiledFragment, CompiledBlock } from '../types/index.js';
2
- import '../types-DOhSojcf.js';
2
+ import '../types-RAbbckR4.js';
3
3
 
4
4
  /**
5
5
  * Context generation for AI agents.
@@ -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-DOhSojcf.js';
2
- export { E as EDGE_TYPE_WEIGHTS, f as GRAPH_EDGE_TYPES, e as SerializedEdge } from '../types-DOhSojcf.js';
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;
@@ -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 requiredChildren = parentEdges.map((e) => e.target);
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
- requiredChildren,
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
@@ -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-DOhSojcf.js';
11
+ import './types-RAbbckR4.js';
@@ -1,4 +1,4 @@
1
- import { S as SerializedComponentGraph } from '../types-DOhSojcf.js';
1
+ import { S as SerializedComponentGraph } from '../types-RAbbckR4.js';
2
2
 
3
3
  /**
4
4
  * Compiled fragment types — shared between CLI and MCP packages.
@@ -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
  /**
@@ -87,8 +87,8 @@ interface CompositionTree {
87
87
  compositionPattern?: 'compound' | 'simple' | 'controlled';
88
88
  /** Direct sub-components */
89
89
  subComponents: string[];
90
- /** Sub-components that must be present */
91
- requiredChildren: string[];
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.1",
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
  },