@schemyx/mcp 0.1.9 → 0.1.10

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.
@@ -244,7 +244,7 @@ export declare function createUiGenerationGuidance(kind: string, elements: UiEle
244
244
  export declare function summarizeActionUsages(elements: UiElement[]): Array<Record<string, unknown>>;
245
245
  export declare function actionVariantNamesForElement(element: UiElement): string[];
246
246
  export declare function addUiPatternRules(entries: RegistryEntry[], usedKeys: Set<string>, nodes: GraphNode[], edges: GraphEdge[], files: AnalyzedFile[], styleContext?: StyleResolutionContext): void;
247
- export declare function addUiCompositionRules(entries: RegistryEntry[], usedKeys: Set<string>, nodes: GraphNode[], edges: GraphEdge[], files: AnalyzedFile[], styleContext?: StyleResolutionContext): void;
247
+ export declare function addUiCompositionRules(entries: RegistryEntry[], usedKeys: Set<string>, nodes: GraphNode[], edges: GraphEdge[], files: AnalyzedFile[], rootPath: string, styleContext?: StyleResolutionContext): void;
248
248
  export declare function addGlobalUiContractRules(entries: RegistryEntry[], usedKeys: Set<string>, nodes: GraphNode[], edges: GraphEdge[], files: AnalyzedFile[]): void;
249
249
  export declare function addConnectedPatternRules(entries: RegistryEntry[], usedKeys: Set<string>, nodes: GraphNode[], edges: GraphEdge[], reviewItems: ReviewItem[], files: AnalyzedFile[], styleContext?: StyleResolutionContext): void;
250
250
  export declare function buildConnectedPatternClusters(files: AnalyzedFile[], styleContext?: StyleResolutionContext): ConnectedPatternCluster[];
@@ -186,14 +186,19 @@ function createBundle(rootPath, projectType, files) {
186
186
  const componentStyleContext = createComponentStyleContext(files);
187
187
  enrichUiElementsWithComponentStyles(files, componentStyleContext);
188
188
  const styleResolutionContext = createStyleResolutionContext(files);
189
+ const localImportKeysByPath = createLocalImportKeyMap(rootPath, files);
189
190
  for (const file of files) {
190
191
  const fileSource = sourceInfo('core.files', 'high', [`path:${file.relPath}`], file);
192
+ const localImportKeys = localImportKeysByPath.get(file.relPath) ?? [];
191
193
  addEntry(entries, usedKeys, {
192
194
  key: file.key,
193
195
  group: 'file',
194
196
  summary: file.summary,
195
197
  tags: file.tags,
196
- dependencies: file.dependencies.map((dependency) => (0, utils_1.toRegistryKey)('dep', dependency)),
198
+ dependencies: (0, utils_1.unique)([
199
+ ...file.dependencies.map((dependency) => (0, utils_1.toRegistryKey)('dep', dependency)),
200
+ ...localImportKeys,
201
+ ]),
197
202
  usedBy: [],
198
203
  confidence: 'high',
199
204
  status: 'inferred',
@@ -268,6 +273,7 @@ function createBundle(rootPath, projectType, files) {
268
273
  const compositionRuleKey = (0, utils_1.toRegistryKey)('rule', `ui.composition.${file.relPath.replace(/\.[^.]+$/, '')}`);
269
274
  const dependencies = (0, utils_1.unique)([
270
275
  file.key,
276
+ ...localImportKeys,
271
277
  ...(hasStyleSurface(file) ? [styleKey] : []),
272
278
  ...(file.uiElements.length ? [compositionRuleKey] : []),
273
279
  ]);
@@ -339,6 +345,7 @@ function createBundle(rootPath, projectType, files) {
339
345
  const compositionRuleKey = (0, utils_1.toRegistryKey)('rule', `ui.composition.${file.relPath.replace(/\.[^.]+$/, '')}`);
340
346
  const dependencies = (0, utils_1.unique)([
341
347
  file.key,
348
+ ...localImportKeys,
342
349
  ...(hasStyleSurface(file) ? [styleKey] : []),
343
350
  ...(file.uiElements.length ? [compositionRuleKey] : []),
344
351
  ]);
@@ -699,7 +706,7 @@ function createBundle(rootPath, projectType, files) {
699
706
  }
700
707
  }
701
708
  addUiPatternRules(entries, usedKeys, nodes, edges, files, styleResolutionContext);
702
- addUiCompositionRules(entries, usedKeys, nodes, edges, files, styleResolutionContext);
709
+ addUiCompositionRules(entries, usedKeys, nodes, edges, files, rootPath, styleResolutionContext);
703
710
  addGlobalUiContractRules(entries, usedKeys, nodes, edges, files);
704
711
  addConnectedPatternRules(entries, usedKeys, nodes, edges, reviewItems, files, styleResolutionContext);
705
712
  addRenderEdges(entries, files, edges);
@@ -739,6 +746,20 @@ function createComponentStyleContext(files) {
739
746
  }
740
747
  return { byName, byHelper };
741
748
  }
749
+ function createLocalImportKeyMap(rootPath, files) {
750
+ const relPaths = new Set(files.map((file) => file.relPath));
751
+ const result = new Map();
752
+ for (const file of files) {
753
+ const localImportKeys = file.imports
754
+ .filter(utils_1.isRelativeImport)
755
+ .map((importValue) => (0, utils_1.resolveImportPath)(file.relPath, importValue, relPaths, rootPath))
756
+ .filter((targetRelPath) => Boolean(targetRelPath))
757
+ .filter((targetRelPath) => targetRelPath !== file.relPath)
758
+ .map((targetRelPath) => (0, utils_1.toRegistryKey)('file', targetRelPath.replace(/\.[^.]+$/, '')));
759
+ result.set(file.relPath, (0, utils_1.unique)(localImportKeys));
760
+ }
761
+ return result;
762
+ }
742
763
  function enrichUiElementsWithComponentStyles(files, context) {
743
764
  for (const file of files) {
744
765
  file.uiElements = file.uiElements.map((element) => enrichUiElementWithComponentStyles(element, context));
@@ -3310,7 +3331,8 @@ function addUiPatternRules(entries, usedKeys, nodes, edges, files, styleContext)
3310
3331
  }
3311
3332
  }
3312
3333
  }
3313
- function addUiCompositionRules(entries, usedKeys, nodes, edges, files, styleContext) {
3334
+ function addUiCompositionRules(entries, usedKeys, nodes, edges, files, rootPath, styleContext) {
3335
+ const localImportKeysByPath = createLocalImportKeyMap(rootPath, files);
3314
3336
  for (const file of files) {
3315
3337
  if ((0, extractors_1.isTestFile)(file.relPath)) {
3316
3338
  continue;
@@ -3322,8 +3344,10 @@ function addUiCompositionRules(entries, usedKeys, nodes, edges, files, styleCont
3322
3344
  const styleKey = (0, utils_1.toRegistryKey)('style', file.relPath.replace(/\.[^.]+$/, ''));
3323
3345
  const componentKeys = file.components.map((component) => (0, utils_1.toRegistryKey)('component', component));
3324
3346
  const routeKeys = file.routes.map((route) => (0, utils_1.toRegistryKey)('route', route));
3347
+ const localImportKeys = localImportKeysByPath.get(file.relPath) ?? [];
3325
3348
  const dependencies = (0, utils_1.unique)([
3326
3349
  file.key,
3350
+ ...localImportKeys,
3327
3351
  ...(hasStyleSurface(file) ? [styleKey] : []),
3328
3352
  ...componentKeys,
3329
3353
  ...routeKeys,