@schemyx/mcp 0.1.9 → 0.1.11
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/codebase-scanner/bundle.d.ts +2 -1
- package/dist/codebase-scanner/bundle.js +43 -8
- package/dist/codebase-scanner/bundle.js.map +1 -1
- package/dist/codebase-scanner/index.d.ts +3 -0
- package/dist/codebase-scanner/index.js +36 -1
- package/dist/codebase-scanner/index.js.map +1 -1
- package/dist/codebase-scanner/utils.js +25 -6
- package/dist/codebase-scanner/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -150,6 +150,7 @@ export declare function looksLikeCssLength(value: string): boolean;
|
|
|
150
150
|
export declare function tailwindShadowValue(base: string): string;
|
|
151
151
|
export declare function bootstrapDeclarationsForClass(className: string, styleContext?: StyleResolutionContext): ResolvedStyleDeclaration[];
|
|
152
152
|
export declare function isBootstrapClass(className: string): boolean;
|
|
153
|
+
export declare function isStrongBootstrapSignalClass(className: string): boolean;
|
|
153
154
|
export declare function bootstrapResponsivePrefixes(className: string): string[];
|
|
154
155
|
export declare function stripBootstrapResponsiveInfix(className: string): string;
|
|
155
156
|
export declare function bootstrapComponentDeclarations(base: string): Array<{
|
|
@@ -244,7 +245,7 @@ export declare function createUiGenerationGuidance(kind: string, elements: UiEle
|
|
|
244
245
|
export declare function summarizeActionUsages(elements: UiElement[]): Array<Record<string, unknown>>;
|
|
245
246
|
export declare function actionVariantNamesForElement(element: UiElement): string[];
|
|
246
247
|
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;
|
|
248
|
+
export declare function addUiCompositionRules(entries: RegistryEntry[], usedKeys: Set<string>, nodes: GraphNode[], edges: GraphEdge[], files: AnalyzedFile[], rootPath: string, styleContext?: StyleResolutionContext): void;
|
|
248
249
|
export declare function addGlobalUiContractRules(entries: RegistryEntry[], usedKeys: Set<string>, nodes: GraphNode[], edges: GraphEdge[], files: AnalyzedFile[]): void;
|
|
249
250
|
export declare function addConnectedPatternRules(entries: RegistryEntry[], usedKeys: Set<string>, nodes: GraphNode[], edges: GraphEdge[], reviewItems: ReviewItem[], files: AnalyzedFile[], styleContext?: StyleResolutionContext): void;
|
|
250
251
|
export declare function buildConnectedPatternClusters(files: AnalyzedFile[], styleContext?: StyleResolutionContext): ConnectedPatternCluster[];
|
|
@@ -63,6 +63,7 @@ exports.looksLikeCssLength = looksLikeCssLength;
|
|
|
63
63
|
exports.tailwindShadowValue = tailwindShadowValue;
|
|
64
64
|
exports.bootstrapDeclarationsForClass = bootstrapDeclarationsForClass;
|
|
65
65
|
exports.isBootstrapClass = isBootstrapClass;
|
|
66
|
+
exports.isStrongBootstrapSignalClass = isStrongBootstrapSignalClass;
|
|
66
67
|
exports.bootstrapResponsivePrefixes = bootstrapResponsivePrefixes;
|
|
67
68
|
exports.stripBootstrapResponsiveInfix = stripBootstrapResponsiveInfix;
|
|
68
69
|
exports.bootstrapComponentDeclarations = bootstrapComponentDeclarations;
|
|
@@ -186,14 +187,19 @@ function createBundle(rootPath, projectType, files) {
|
|
|
186
187
|
const componentStyleContext = createComponentStyleContext(files);
|
|
187
188
|
enrichUiElementsWithComponentStyles(files, componentStyleContext);
|
|
188
189
|
const styleResolutionContext = createStyleResolutionContext(files);
|
|
190
|
+
const localImportKeysByPath = createLocalImportKeyMap(rootPath, files);
|
|
189
191
|
for (const file of files) {
|
|
190
192
|
const fileSource = sourceInfo('core.files', 'high', [`path:${file.relPath}`], file);
|
|
193
|
+
const localImportKeys = localImportKeysByPath.get(file.relPath) ?? [];
|
|
191
194
|
addEntry(entries, usedKeys, {
|
|
192
195
|
key: file.key,
|
|
193
196
|
group: 'file',
|
|
194
197
|
summary: file.summary,
|
|
195
198
|
tags: file.tags,
|
|
196
|
-
dependencies:
|
|
199
|
+
dependencies: (0, utils_1.unique)([
|
|
200
|
+
...file.dependencies.map((dependency) => (0, utils_1.toRegistryKey)('dep', dependency)),
|
|
201
|
+
...localImportKeys,
|
|
202
|
+
]),
|
|
197
203
|
usedBy: [],
|
|
198
204
|
confidence: 'high',
|
|
199
205
|
status: 'inferred',
|
|
@@ -268,6 +274,7 @@ function createBundle(rootPath, projectType, files) {
|
|
|
268
274
|
const compositionRuleKey = (0, utils_1.toRegistryKey)('rule', `ui.composition.${file.relPath.replace(/\.[^.]+$/, '')}`);
|
|
269
275
|
const dependencies = (0, utils_1.unique)([
|
|
270
276
|
file.key,
|
|
277
|
+
...localImportKeys,
|
|
271
278
|
...(hasStyleSurface(file) ? [styleKey] : []),
|
|
272
279
|
...(file.uiElements.length ? [compositionRuleKey] : []),
|
|
273
280
|
]);
|
|
@@ -339,6 +346,7 @@ function createBundle(rootPath, projectType, files) {
|
|
|
339
346
|
const compositionRuleKey = (0, utils_1.toRegistryKey)('rule', `ui.composition.${file.relPath.replace(/\.[^.]+$/, '')}`);
|
|
340
347
|
const dependencies = (0, utils_1.unique)([
|
|
341
348
|
file.key,
|
|
349
|
+
...localImportKeys,
|
|
342
350
|
...(hasStyleSurface(file) ? [styleKey] : []),
|
|
343
351
|
...(file.uiElements.length ? [compositionRuleKey] : []),
|
|
344
352
|
]);
|
|
@@ -699,7 +707,7 @@ function createBundle(rootPath, projectType, files) {
|
|
|
699
707
|
}
|
|
700
708
|
}
|
|
701
709
|
addUiPatternRules(entries, usedKeys, nodes, edges, files, styleResolutionContext);
|
|
702
|
-
addUiCompositionRules(entries, usedKeys, nodes, edges, files, styleResolutionContext);
|
|
710
|
+
addUiCompositionRules(entries, usedKeys, nodes, edges, files, rootPath, styleResolutionContext);
|
|
703
711
|
addGlobalUiContractRules(entries, usedKeys, nodes, edges, files);
|
|
704
712
|
addConnectedPatternRules(entries, usedKeys, nodes, edges, reviewItems, files, styleResolutionContext);
|
|
705
713
|
addRenderEdges(entries, files, edges);
|
|
@@ -739,6 +747,20 @@ function createComponentStyleContext(files) {
|
|
|
739
747
|
}
|
|
740
748
|
return { byName, byHelper };
|
|
741
749
|
}
|
|
750
|
+
function createLocalImportKeyMap(rootPath, files) {
|
|
751
|
+
const relPaths = new Set(files.map((file) => file.relPath));
|
|
752
|
+
const result = new Map();
|
|
753
|
+
for (const file of files) {
|
|
754
|
+
const localImportKeys = file.imports
|
|
755
|
+
.filter(utils_1.isRelativeImport)
|
|
756
|
+
.map((importValue) => (0, utils_1.resolveImportPath)(file.relPath, importValue, relPaths, rootPath))
|
|
757
|
+
.filter((targetRelPath) => Boolean(targetRelPath))
|
|
758
|
+
.filter((targetRelPath) => targetRelPath !== file.relPath)
|
|
759
|
+
.map((targetRelPath) => (0, utils_1.toRegistryKey)('file', targetRelPath.replace(/\.[^.]+$/, '')));
|
|
760
|
+
result.set(file.relPath, (0, utils_1.unique)(localImportKeys));
|
|
761
|
+
}
|
|
762
|
+
return result;
|
|
763
|
+
}
|
|
742
764
|
function enrichUiElementsWithComponentStyles(files, context) {
|
|
743
765
|
for (const file of files) {
|
|
744
766
|
file.uiElements = file.uiElements.map((element) => enrichUiElementWithComponentStyles(element, context));
|
|
@@ -1640,6 +1662,10 @@ function detectProjectStyleSystems(files) {
|
|
|
1640
1662
|
const dependencyText = files.flatMap((file) => file.dependencies).join(' ').toLowerCase();
|
|
1641
1663
|
const importText = files.flatMap((file) => file.imports).join(' ').toLowerCase();
|
|
1642
1664
|
const pathText = files.map((file) => file.relPath).join(' ').toLowerCase();
|
|
1665
|
+
const strongBootstrapClassCount = allClasses.filter(isStrongBootstrapSignalClass).length;
|
|
1666
|
+
const hasBootstrapDependency = /\bbootstrap\b/.test(dependencyText) ||
|
|
1667
|
+
/\bbootstrap\b/.test(importText) ||
|
|
1668
|
+
/bootstrap(?:\.min)?\.css|bootstrap(?:\.bundle)?(?:\.min)?\.js/.test(pathText);
|
|
1643
1669
|
if (files.some((file) => file.cssRules.length || file.cssVariableValues.length || file.cssClasses.length)) {
|
|
1644
1670
|
systems.add('raw-css');
|
|
1645
1671
|
}
|
|
@@ -1649,9 +1675,7 @@ function detectProjectStyleSystems(files) {
|
|
|
1649
1675
|
/tailwind\.config|tailwind-theme|@tailwind/.test(pathText)) {
|
|
1650
1676
|
systems.add('tailwind');
|
|
1651
1677
|
}
|
|
1652
|
-
if (
|
|
1653
|
-
/\bbootstrap\b/.test(dependencyText) ||
|
|
1654
|
-
/\bbootstrap\b/.test(importText)) {
|
|
1678
|
+
if (hasBootstrapDependency || strongBootstrapClassCount >= 3) {
|
|
1655
1679
|
systems.add('bootstrap');
|
|
1656
1680
|
}
|
|
1657
1681
|
return Array.from(systems).length ? Array.from(systems) : ['unknown'];
|
|
@@ -1720,6 +1744,7 @@ function resolveCssValueTokens(value, cssVariables) {
|
|
|
1720
1744
|
}
|
|
1721
1745
|
function resolveUiClassDeclarations(classes, styleContext) {
|
|
1722
1746
|
const declarations = [];
|
|
1747
|
+
const bootstrapEnabled = styleContext?.detectedStyleSystems.includes('bootstrap') ?? true;
|
|
1723
1748
|
for (const className of classes) {
|
|
1724
1749
|
const candidates = (0, utils_1.unique)([className, (0, utils_1.classBase)(className), (0, utils_1.classBase)(className).replace(/^!/, '')]);
|
|
1725
1750
|
for (const candidate of candidates) {
|
|
@@ -1729,7 +1754,9 @@ function resolveUiClassDeclarations(classes, styleContext) {
|
|
|
1729
1754
|
})));
|
|
1730
1755
|
}
|
|
1731
1756
|
declarations.push(...tailwindDeclarationsForClass(className, styleContext));
|
|
1732
|
-
|
|
1757
|
+
if (bootstrapEnabled) {
|
|
1758
|
+
declarations.push(...bootstrapDeclarationsForClass(className, styleContext));
|
|
1759
|
+
}
|
|
1733
1760
|
}
|
|
1734
1761
|
return (0, utils_1.uniqueBy)(declarations, (declaration) => [
|
|
1735
1762
|
declaration.className,
|
|
@@ -2191,6 +2218,10 @@ function isBootstrapClass(className) {
|
|
|
2191
2218
|
const base = stripBootstrapResponsiveInfix((0, utils_1.classBase)(className));
|
|
2192
2219
|
return /^(?:container|container-fluid|row|col|col-\d+|card|card-(?:body|title|text|header|footer)|btn|btn-(?:primary|secondary|success|danger|warning|info|light|dark|link|outline-primary|outline-secondary|outline-success|outline-danger|outline-warning|outline-info|outline-light|outline-dark)|badge|rounded|rounded-\d|rounded-pill|rounded-circle|border|border-\d|border-(?:0|top|end|bottom|start|primary|secondary|success|danger|warning|info|light|dark|white)|bg-|text-|fw-|fs-|lh-|display-|lead|small|d-|flex-|justify-content-|align-items-|align-self-|order-|m[stebxy]?-|p[stebxy]?-|gap-|w-|h-|mw-|mh-|min-vh-|min-vw-|vw-|vh-|form-|input-group|navbar|nav|nav-|list-group|modal|alert|shadow|overflow-|position-|top-|bottom-|start-|end-|translate-middle|visually-hidden)/.test(base);
|
|
2193
2220
|
}
|
|
2221
|
+
function isStrongBootstrapSignalClass(className) {
|
|
2222
|
+
const base = stripBootstrapResponsiveInfix((0, utils_1.classBase)(className));
|
|
2223
|
+
return /^(?:container-fluid|row|col(?:-\d+)?|offset-\d+|card(?:-(?:body|title|text|header|footer|img(?:-top|-bottom)?))?|btn(?:-(?:primary|secondary|success|danger|warning|info|light|dark|link|outline-primary|outline-secondary|outline-success|outline-danger|outline-warning|outline-info|outline-light|outline-dark))?|badge(?:-(?:pill|rounded-pill))?|form-(?:control|select|check|label|text|range|switch|floating)|input-group(?:-(?:text|sm|lg))?|navbar(?:-(?:brand|nav|toggler|collapse|expand(?:-[a-z]+)?))?|nav-(?:item|link|tabs|pills|underline)|list-group(?:-item)?|modal(?:-(?:dialog|content|header|body|footer|title))?|alert(?:-(?:primary|secondary|success|danger|warning|info|light|dark))?|dropdown(?:-(?:menu|item|toggle|divider))?|accordion(?:-(?:item|header|button|collapse|body))?|carousel(?:-(?:item|inner|control-prev|control-next))?|d-(?:none|block|inline|inline-block|flex|grid)|justify-content-(?:start|end|center|between|around|evenly)|align-items-(?:start|end|center|baseline|stretch)|align-self-(?:start|end|center|baseline|stretch)|rounded-(?:pill|circle)|text-bg-(?:primary|secondary|success|danger|warning|info|light|dark)|visually-hidden)$/.test(base);
|
|
2224
|
+
}
|
|
2194
2225
|
function bootstrapResponsivePrefixes(className) {
|
|
2195
2226
|
const match = className.match(/^(?:d|col|offset|order|m[stebxy]?|p[stebxy]?|gap|text|float|flex|justify-content|align-items|align-self)-((?:sm|md|lg|xl|xxl))-/);
|
|
2196
2227
|
return match ? [match[1]] : [];
|
|
@@ -2466,7 +2497,8 @@ function createStyleSystemEvidence(classes, declarations, styleContext) {
|
|
|
2466
2497
|
if (tailwindDeclarationsForClass(className, styleContext).length || isLikelyTailwindClass(className)) {
|
|
2467
2498
|
systems.add('tailwind');
|
|
2468
2499
|
}
|
|
2469
|
-
if (
|
|
2500
|
+
if ((styleContext?.detectedStyleSystems.includes('bootstrap') ?? true) &&
|
|
2501
|
+
(bootstrapDeclarationsForClass(className, styleContext).length || isBootstrapClass(className))) {
|
|
2470
2502
|
systems.add('bootstrap');
|
|
2471
2503
|
}
|
|
2472
2504
|
if (!systems.size) {
|
|
@@ -3310,7 +3342,8 @@ function addUiPatternRules(entries, usedKeys, nodes, edges, files, styleContext)
|
|
|
3310
3342
|
}
|
|
3311
3343
|
}
|
|
3312
3344
|
}
|
|
3313
|
-
function addUiCompositionRules(entries, usedKeys, nodes, edges, files, styleContext) {
|
|
3345
|
+
function addUiCompositionRules(entries, usedKeys, nodes, edges, files, rootPath, styleContext) {
|
|
3346
|
+
const localImportKeysByPath = createLocalImportKeyMap(rootPath, files);
|
|
3314
3347
|
for (const file of files) {
|
|
3315
3348
|
if ((0, extractors_1.isTestFile)(file.relPath)) {
|
|
3316
3349
|
continue;
|
|
@@ -3322,8 +3355,10 @@ function addUiCompositionRules(entries, usedKeys, nodes, edges, files, styleCont
|
|
|
3322
3355
|
const styleKey = (0, utils_1.toRegistryKey)('style', file.relPath.replace(/\.[^.]+$/, ''));
|
|
3323
3356
|
const componentKeys = file.components.map((component) => (0, utils_1.toRegistryKey)('component', component));
|
|
3324
3357
|
const routeKeys = file.routes.map((route) => (0, utils_1.toRegistryKey)('route', route));
|
|
3358
|
+
const localImportKeys = localImportKeysByPath.get(file.relPath) ?? [];
|
|
3325
3359
|
const dependencies = (0, utils_1.unique)([
|
|
3326
3360
|
file.key,
|
|
3361
|
+
...localImportKeys,
|
|
3327
3362
|
...(hasStyleSurface(file) ? [styleKey] : []),
|
|
3328
3363
|
...componentKeys,
|
|
3329
3364
|
...routeKeys,
|