@getchomp/mcp 0.2.44 → 0.2.46
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/designSystemPlugin.d.ts +263 -1
- package/dist/designSystemPlugin.js +193 -0
- package/dist/index.d.ts +151 -1
- package/dist/index.js +758 -76
- package/dist/intelligence.d.ts +5 -2
- package/dist/intelligence.js +371 -51
- package/dist/plugins/design-system/index.js +9 -2
- package/dist/plugins/enrich-nodes/index.d.ts +2 -2
- package/package.json +3 -3
|
@@ -29,7 +29,7 @@ import { type DesignSystemBaselineSnapshot, type FindingRecord, type WorkingTree
|
|
|
29
29
|
import { type DesignSystemConfig } from "./designSystem/config.js";
|
|
30
30
|
import { type AnalyzeDesignSystemOptions } from "./designSystem/topology.js";
|
|
31
31
|
import { type DerivedTokenProposal } from "./designSystem/valueClusters.js";
|
|
32
|
-
import type { AgentExtendabilitySection, AtomicConsolidationCandidate, AtomicHierarchySummary, BypassedAtomFinding, CallSiteOverrideFinding, ComponentDesignProfile, ComposabilityIssue, CompositeTypeTuple, ContextualStyleOverrideFinding, ContrastAuditItem, CoverageSection, DesignSystemAnalysisReport, DesignSystemSourceInfo, DuplicateTokenDiagnostic, InvariantViolation, NestedInteractiveFinding, ParallelTwinGroup, PropApiDriftGroup, RouteCompositionItem, SiblingAtomOverlapFinding, StructuralJsxCloneGroup, StylingConvention, ThemeSymmetryFinding, TokenRegistryEntry, TokenTier, TypographyRoleCluster, UnbackedSemanticTokenDiagnostic, UndefinedCssClassDiagnostic, UndefinedTokenDiagnostic, UnextractedUiShapeFinding } from "./designSystem/types.js";
|
|
32
|
+
import type { AgentExtendabilityMeasures, AgentExtendabilitySection, AtomicConsolidationCandidate, AtomicHierarchySummary, AtomicTier, BypassedAtomFinding, CallSiteOverrideFinding, ComponentDesignProfile, ComposabilityIssue, CompositeTypeTuple, ContextualStyleOverrideFinding, ContrastAuditItem, CoverageSection, DesignSystemAnalysisReport, DesignSystemSourceInfo, DuplicateTokenDiagnostic, InvariantViolation, NestedInteractiveFinding, ParallelTwinGroup, PropApiDriftGroup, RouteCompositionItem, SiblingAtomOverlapFinding, StructuralJsxCloneGroup, StylingConvention, ThemeSymmetryFinding, TokenRegistryEntry, TokenTier, TypographyRoleCluster, UnbackedSemanticTokenDiagnostic, UndefinedCssClassDiagnostic, UndefinedTokenDiagnostic, UnextractedUiShapeFinding } from "./designSystem/types.js";
|
|
33
33
|
export * from "./designSystem/types.js";
|
|
34
34
|
export { classifyTokenTier, parseCssStylesheet, type ParseCssOptions, type ParsedCssRule, type ParsedCssStylesheet, } from "./designSystem/cssParser.js";
|
|
35
35
|
export { computeRelativeLuminance, computeWcagContrastRatio, evaluateContrast, evaluateThemeContrastPairs, parseCssColorString, type ContrastEvaluation, type ContrastEvaluationOptions, type RgbaColor, type TailwindClassPairCandidate, } from "./designSystem/contrast.js";
|
|
@@ -227,6 +227,268 @@ export declare function auditDesignSystem(options: AuditDesignSystemOptions): Pr
|
|
|
227
227
|
recommendedHighlightNodeIds: string[];
|
|
228
228
|
agentGuidance: string[];
|
|
229
229
|
}>;
|
|
230
|
+
export declare function formatCompactDesignSystemAudit(report: Awaited<ReturnType<typeof auditDesignSystem>>, options?: {
|
|
231
|
+
verbose?: boolean;
|
|
232
|
+
hasSearchTerm?: boolean;
|
|
233
|
+
maxSemanticTokens?: number;
|
|
234
|
+
}): {
|
|
235
|
+
plugin: {
|
|
236
|
+
name: string;
|
|
237
|
+
version: string;
|
|
238
|
+
layer: import("@getchomp/db").OverlayLayer;
|
|
239
|
+
runId: string;
|
|
240
|
+
overlaysPersisted: number;
|
|
241
|
+
durationMs: number;
|
|
242
|
+
};
|
|
243
|
+
system: DesignSystemSourceInfo;
|
|
244
|
+
coverage: CoverageSection;
|
|
245
|
+
baseline: DesignSystemBaselineStatus;
|
|
246
|
+
summary: {
|
|
247
|
+
cssFilesScanned: number;
|
|
248
|
+
componentFilesScanned: number;
|
|
249
|
+
componentsProfiled: number;
|
|
250
|
+
routeCount: number;
|
|
251
|
+
templateCount: number;
|
|
252
|
+
organismCount: number;
|
|
253
|
+
moleculeCount: number;
|
|
254
|
+
atomCount: number;
|
|
255
|
+
utilityCount: number;
|
|
256
|
+
structuralJsxCloneCount: number;
|
|
257
|
+
bypassedAtomCount: number;
|
|
258
|
+
siblingAtomOverlapCount: number;
|
|
259
|
+
nestedInteractiveCount: number;
|
|
260
|
+
unextractedShapeCount: number;
|
|
261
|
+
parallelTwinGroupCount: number;
|
|
262
|
+
callSiteOverrideCount: number;
|
|
263
|
+
propApiDriftGroupCount: number;
|
|
264
|
+
agentExtendabilityScore: number | null;
|
|
265
|
+
agentExtendabilityGrade: "A" | "B" | "C" | "D" | "F" | "N/A";
|
|
266
|
+
totalDefinedTokens: number;
|
|
267
|
+
primitiveTokenCount: number;
|
|
268
|
+
semanticTokenCount: number;
|
|
269
|
+
componentTokenCount: number;
|
|
270
|
+
themeBridgeTokenCount: number;
|
|
271
|
+
unbackedSemanticTokenCount: number;
|
|
272
|
+
themeSymmetryIssueCount: number;
|
|
273
|
+
undefinedTokenCount: number;
|
|
274
|
+
undefinedCssClassCount: number;
|
|
275
|
+
duplicateTokenCount: number;
|
|
276
|
+
forkedTokenCount: number;
|
|
277
|
+
unusedTokenCount: number;
|
|
278
|
+
contrastPairsAudited: number;
|
|
279
|
+
contrastCandidateCount: number;
|
|
280
|
+
contrastFailureCount: number;
|
|
281
|
+
contrastPairsUnresolved: number;
|
|
282
|
+
hardcodedLiteralCount: number;
|
|
283
|
+
derivedTokenProposalCount: number;
|
|
284
|
+
invariantViolationCount: number;
|
|
285
|
+
composabilityIssueCount: number;
|
|
286
|
+
frontendPackageCount: number;
|
|
287
|
+
unsupportedFileCount: number;
|
|
288
|
+
arbitraryTailwindCount: number;
|
|
289
|
+
magicSpacingCount: number;
|
|
290
|
+
primitiveScaleSkipCount: number;
|
|
291
|
+
inlineStyleLiteralCount: number;
|
|
292
|
+
canvasCssSlotCount: number;
|
|
293
|
+
canvasTsConstSlotCount: number;
|
|
294
|
+
canvasLiteralSlotCount: number;
|
|
295
|
+
rawDomPrimitiveCount: number;
|
|
296
|
+
atomicConsolidationGroupCount: number;
|
|
297
|
+
dynamicClassPrefixCount: number;
|
|
298
|
+
unusedCssSelectorCount: number;
|
|
299
|
+
typographyTupleCount: number;
|
|
300
|
+
typographyDriftRoleCount: number;
|
|
301
|
+
contextualOverrideCount: number;
|
|
302
|
+
conventionBreakdown: Record<StylingConvention, number>;
|
|
303
|
+
};
|
|
304
|
+
routeComposition: RouteCompositionItem[];
|
|
305
|
+
atomicHierarchy: AtomicHierarchySummary;
|
|
306
|
+
alignmentAudit: {
|
|
307
|
+
bypassedAtoms: BypassedAtomFinding[];
|
|
308
|
+
siblingAtomOverlaps: SiblingAtomOverlapFinding[];
|
|
309
|
+
nestedInteractive: NestedInteractiveFinding[];
|
|
310
|
+
unextractedShapes: UnextractedUiShapeFinding[];
|
|
311
|
+
parallelTwins: ParallelTwinGroup[];
|
|
312
|
+
callSiteOverrides: CallSiteOverrideFinding[];
|
|
313
|
+
propApiDrift: PropApiDriftGroup[];
|
|
314
|
+
invariantViolations: InvariantViolation[];
|
|
315
|
+
composabilityIssues: ComposabilityIssue[];
|
|
316
|
+
};
|
|
317
|
+
dryAudit: {
|
|
318
|
+
structuralJsxClones: StructuralJsxCloneGroup[];
|
|
319
|
+
atomicConsolidation: AtomicConsolidationCandidate[];
|
|
320
|
+
duplicateCssTokens: DuplicateTokenDiagnostic[];
|
|
321
|
+
};
|
|
322
|
+
derivedTokens: DerivedTokenProposal[];
|
|
323
|
+
agentExtendability: AgentExtendabilitySection;
|
|
324
|
+
tokenCatalog: {
|
|
325
|
+
primitive: string[];
|
|
326
|
+
semantic: string[];
|
|
327
|
+
component: string[];
|
|
328
|
+
themeBridge: string[];
|
|
329
|
+
};
|
|
330
|
+
tokenRegistry: TokenRegistryEntry[];
|
|
331
|
+
mergeDecisions: import("./designSystem/merges.js").DesignSystemMergeDecision[];
|
|
332
|
+
atomicConsolidation: AtomicConsolidationCandidate[];
|
|
333
|
+
diagnostics: {
|
|
334
|
+
undefinedTokens: UndefinedTokenDiagnostic[];
|
|
335
|
+
undefinedCssClasses: UndefinedCssClassDiagnostic[];
|
|
336
|
+
duplicateTokens: DuplicateTokenDiagnostic[];
|
|
337
|
+
unusedTokens: {
|
|
338
|
+
name: string;
|
|
339
|
+
tier: TokenTier;
|
|
340
|
+
filePath: string;
|
|
341
|
+
lineNumber: number;
|
|
342
|
+
}[];
|
|
343
|
+
unbackedSemanticTokens: UnbackedSemanticTokenDiagnostic[];
|
|
344
|
+
themeSymmetryIssues: ThemeSymmetryFinding[];
|
|
345
|
+
typographyTuples: CompositeTypeTuple[];
|
|
346
|
+
typographyRoleClusters: TypographyRoleCluster[];
|
|
347
|
+
contextualStyleOverrides: ContextualStyleOverrideFinding[];
|
|
348
|
+
contrastFailures: ContrastAuditItem[];
|
|
349
|
+
contrastAudits: ContrastAuditItem[];
|
|
350
|
+
dynamicClassPrefixes: string[];
|
|
351
|
+
unusedCssSelectors: {
|
|
352
|
+
selector: string;
|
|
353
|
+
filePath: string;
|
|
354
|
+
lineNumber: number;
|
|
355
|
+
}[];
|
|
356
|
+
hardcodedCssLiteralCount: number;
|
|
357
|
+
};
|
|
358
|
+
components: ComponentDesignProfile[];
|
|
359
|
+
recommendedHighlightNodeIds: string[];
|
|
360
|
+
agentGuidance: string[];
|
|
361
|
+
} | {
|
|
362
|
+
plugin: {
|
|
363
|
+
name: string;
|
|
364
|
+
version: string;
|
|
365
|
+
layer: import("@getchomp/db").OverlayLayer;
|
|
366
|
+
runId: string;
|
|
367
|
+
overlaysPersisted: number;
|
|
368
|
+
durationMs: number;
|
|
369
|
+
};
|
|
370
|
+
system: DesignSystemSourceInfo;
|
|
371
|
+
baseline: DesignSystemBaselineStatus;
|
|
372
|
+
summary: {
|
|
373
|
+
cssFilesScanned: number;
|
|
374
|
+
componentFilesScanned: number;
|
|
375
|
+
componentsProfiled: number;
|
|
376
|
+
routeCount: number;
|
|
377
|
+
templateCount: number;
|
|
378
|
+
organismCount: number;
|
|
379
|
+
moleculeCount: number;
|
|
380
|
+
atomCount: number;
|
|
381
|
+
utilityCount: number;
|
|
382
|
+
structuralJsxCloneCount: number;
|
|
383
|
+
bypassedAtomCount: number;
|
|
384
|
+
siblingAtomOverlapCount: number;
|
|
385
|
+
nestedInteractiveCount: number;
|
|
386
|
+
unextractedShapeCount: number;
|
|
387
|
+
parallelTwinGroupCount: number;
|
|
388
|
+
callSiteOverrideCount: number;
|
|
389
|
+
propApiDriftGroupCount: number;
|
|
390
|
+
agentExtendabilityScore: number | null;
|
|
391
|
+
agentExtendabilityGrade: "A" | "B" | "C" | "D" | "F" | "N/A";
|
|
392
|
+
totalDefinedTokens: number;
|
|
393
|
+
primitiveTokenCount: number;
|
|
394
|
+
semanticTokenCount: number;
|
|
395
|
+
componentTokenCount: number;
|
|
396
|
+
themeBridgeTokenCount: number;
|
|
397
|
+
unbackedSemanticTokenCount: number;
|
|
398
|
+
themeSymmetryIssueCount: number;
|
|
399
|
+
undefinedTokenCount: number;
|
|
400
|
+
undefinedCssClassCount: number;
|
|
401
|
+
duplicateTokenCount: number;
|
|
402
|
+
forkedTokenCount: number;
|
|
403
|
+
unusedTokenCount: number;
|
|
404
|
+
contrastPairsAudited: number;
|
|
405
|
+
contrastCandidateCount: number;
|
|
406
|
+
contrastFailureCount: number;
|
|
407
|
+
contrastPairsUnresolved: number;
|
|
408
|
+
hardcodedLiteralCount: number;
|
|
409
|
+
derivedTokenProposalCount: number;
|
|
410
|
+
invariantViolationCount: number;
|
|
411
|
+
composabilityIssueCount: number;
|
|
412
|
+
frontendPackageCount: number;
|
|
413
|
+
unsupportedFileCount: number;
|
|
414
|
+
arbitraryTailwindCount: number;
|
|
415
|
+
magicSpacingCount: number;
|
|
416
|
+
primitiveScaleSkipCount: number;
|
|
417
|
+
inlineStyleLiteralCount: number;
|
|
418
|
+
canvasCssSlotCount: number;
|
|
419
|
+
canvasTsConstSlotCount: number;
|
|
420
|
+
canvasLiteralSlotCount: number;
|
|
421
|
+
rawDomPrimitiveCount: number;
|
|
422
|
+
atomicConsolidationGroupCount: number;
|
|
423
|
+
dynamicClassPrefixCount: number;
|
|
424
|
+
unusedCssSelectorCount: number;
|
|
425
|
+
typographyTupleCount: number;
|
|
426
|
+
typographyDriftRoleCount: number;
|
|
427
|
+
contextualOverrideCount: number;
|
|
428
|
+
conventionBreakdown: Record<StylingConvention, number>;
|
|
429
|
+
};
|
|
430
|
+
agentExtendability: {
|
|
431
|
+
score: number | null;
|
|
432
|
+
overallScore: number | null;
|
|
433
|
+
grade: "A" | "B" | "C" | "D" | "F" | "N/A";
|
|
434
|
+
measures: AgentExtendabilityMeasures;
|
|
435
|
+
pavedRoadBlueprint: {
|
|
436
|
+
canonicalTokensByRole: {
|
|
437
|
+
surfaces: string[];
|
|
438
|
+
text: string[];
|
|
439
|
+
borders: string[];
|
|
440
|
+
accents: string[];
|
|
441
|
+
states: string[];
|
|
442
|
+
};
|
|
443
|
+
reusableBuildingBlocks: Array<{
|
|
444
|
+
entityId: string;
|
|
445
|
+
label: string;
|
|
446
|
+
atomicTier: AtomicTier;
|
|
447
|
+
filePath: string;
|
|
448
|
+
rendersInDegree: number;
|
|
449
|
+
propSignature: string;
|
|
450
|
+
}>;
|
|
451
|
+
missingPrimitivesToExtract: string[];
|
|
452
|
+
extensionRules: string[];
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
atomicConsolidation: {
|
|
456
|
+
consolidationGuidance: string;
|
|
457
|
+
sampleInstances: {
|
|
458
|
+
componentName: string;
|
|
459
|
+
filePath: string;
|
|
460
|
+
lineNumber: number;
|
|
461
|
+
}[];
|
|
462
|
+
existingSharedComponent?: {
|
|
463
|
+
name: string;
|
|
464
|
+
filePath: string;
|
|
465
|
+
lineNumber?: number;
|
|
466
|
+
} | undefined;
|
|
467
|
+
atomName: string;
|
|
468
|
+
description: string;
|
|
469
|
+
instanceCount: number;
|
|
470
|
+
adopterCount: number;
|
|
471
|
+
adoptionRate: number | null;
|
|
472
|
+
}[];
|
|
473
|
+
semanticTokens: {
|
|
474
|
+
name: string;
|
|
475
|
+
value: string;
|
|
476
|
+
}[];
|
|
477
|
+
components: {
|
|
478
|
+
entityId: string;
|
|
479
|
+
label: string;
|
|
480
|
+
filePath: string;
|
|
481
|
+
atomicTier: AtomicTier;
|
|
482
|
+
uiKind: import("./designSystem/types.js").ComponentUiKind;
|
|
483
|
+
stylingConventions: StylingConvention[];
|
|
484
|
+
}[];
|
|
485
|
+
topIssuesSummary: Record<string, {
|
|
486
|
+
count: number;
|
|
487
|
+
examples: any[];
|
|
488
|
+
}>;
|
|
489
|
+
recommendedHighlightNodeIds: string[];
|
|
490
|
+
agentGuidance: string[];
|
|
491
|
+
};
|
|
230
492
|
export interface DiffDesignSystemOptions {
|
|
231
493
|
repoPath: string;
|
|
232
494
|
repoId?: string;
|
|
@@ -4487,6 +4487,199 @@ export async function auditDesignSystem(options) {
|
|
|
4487
4487
|
],
|
|
4488
4488
|
};
|
|
4489
4489
|
}
|
|
4490
|
+
export function formatCompactDesignSystemAudit(report, options) {
|
|
4491
|
+
if (options?.verbose) {
|
|
4492
|
+
return report;
|
|
4493
|
+
}
|
|
4494
|
+
const maxSemanticTokens = options?.maxSemanticTokens ?? 60;
|
|
4495
|
+
const hasSearchTerm = Boolean(options?.hasSearchTerm);
|
|
4496
|
+
const valueByTokenName = new Map();
|
|
4497
|
+
for (const entry of report.tokenRegistry) {
|
|
4498
|
+
const val = entry.declarations[0]?.value ??
|
|
4499
|
+
entry.valuesByTheme.root?.raw ??
|
|
4500
|
+
entry.valuesByTheme.dark?.raw ??
|
|
4501
|
+
entry.valuesByTheme.light?.raw ??
|
|
4502
|
+
entry.valuesByTheme.themeBridge?.raw ??
|
|
4503
|
+
"";
|
|
4504
|
+
if (!valueByTokenName.has(entry.name)) {
|
|
4505
|
+
valueByTokenName.set(entry.name, val);
|
|
4506
|
+
}
|
|
4507
|
+
}
|
|
4508
|
+
const seenTokens = new Set();
|
|
4509
|
+
const semanticTokens = [];
|
|
4510
|
+
for (const name of [
|
|
4511
|
+
...report.tokenCatalog.semantic,
|
|
4512
|
+
...report.tokenCatalog.themeBridge,
|
|
4513
|
+
]) {
|
|
4514
|
+
if (seenTokens.has(name))
|
|
4515
|
+
continue;
|
|
4516
|
+
seenTokens.add(name);
|
|
4517
|
+
semanticTokens.push({ name, value: valueByTokenName.get(name) ?? "" });
|
|
4518
|
+
if (semanticTokens.length >= maxSemanticTokens)
|
|
4519
|
+
break;
|
|
4520
|
+
}
|
|
4521
|
+
const stripSnippet = (item) => {
|
|
4522
|
+
if (!item || typeof item !== "object")
|
|
4523
|
+
return item;
|
|
4524
|
+
if (Array.isArray(item))
|
|
4525
|
+
return item.slice(0, 3).map(stripSnippet);
|
|
4526
|
+
const { snippet: _snippet, occurrences, instances, declarations, styleVectorDeltas: _deltas, ...rest } = item;
|
|
4527
|
+
return {
|
|
4528
|
+
...rest,
|
|
4529
|
+
...(Array.isArray(occurrences)
|
|
4530
|
+
? { occurrences: occurrences.slice(0, 2).map(stripSnippet) }
|
|
4531
|
+
: {}),
|
|
4532
|
+
...(Array.isArray(instances)
|
|
4533
|
+
? { instances: instances.slice(0, 2).map(stripSnippet) }
|
|
4534
|
+
: {}),
|
|
4535
|
+
...(Array.isArray(declarations)
|
|
4536
|
+
? { declarations: declarations.slice(0, 2).map(stripSnippet) }
|
|
4537
|
+
: {}),
|
|
4538
|
+
};
|
|
4539
|
+
};
|
|
4540
|
+
const issueBuckets = [
|
|
4541
|
+
[
|
|
4542
|
+
"bypassedAtoms",
|
|
4543
|
+
report.summary.bypassedAtomCount,
|
|
4544
|
+
report.alignmentAudit.bypassedAtoms,
|
|
4545
|
+
],
|
|
4546
|
+
[
|
|
4547
|
+
"siblingAtomOverlaps",
|
|
4548
|
+
report.summary.siblingAtomOverlapCount,
|
|
4549
|
+
report.alignmentAudit.siblingAtomOverlaps,
|
|
4550
|
+
],
|
|
4551
|
+
[
|
|
4552
|
+
"nestedInteractive",
|
|
4553
|
+
report.summary.nestedInteractiveCount,
|
|
4554
|
+
report.alignmentAudit.nestedInteractive,
|
|
4555
|
+
],
|
|
4556
|
+
[
|
|
4557
|
+
"unextractedShapes",
|
|
4558
|
+
report.summary.unextractedShapeCount,
|
|
4559
|
+
report.alignmentAudit.unextractedShapes,
|
|
4560
|
+
],
|
|
4561
|
+
[
|
|
4562
|
+
"parallelTwins",
|
|
4563
|
+
report.summary.parallelTwinGroupCount,
|
|
4564
|
+
report.alignmentAudit.parallelTwins,
|
|
4565
|
+
],
|
|
4566
|
+
[
|
|
4567
|
+
"callSiteOverrides",
|
|
4568
|
+
report.summary.callSiteOverrideCount,
|
|
4569
|
+
report.alignmentAudit.callSiteOverrides,
|
|
4570
|
+
],
|
|
4571
|
+
[
|
|
4572
|
+
"invariantViolations",
|
|
4573
|
+
report.summary.invariantViolationCount,
|
|
4574
|
+
report.alignmentAudit.invariantViolations,
|
|
4575
|
+
],
|
|
4576
|
+
[
|
|
4577
|
+
"composabilityIssues",
|
|
4578
|
+
report.summary.composabilityIssueCount,
|
|
4579
|
+
report.alignmentAudit.composabilityIssues,
|
|
4580
|
+
],
|
|
4581
|
+
[
|
|
4582
|
+
"structuralJsxClones",
|
|
4583
|
+
report.summary.structuralJsxCloneCount,
|
|
4584
|
+
report.dryAudit.structuralJsxClones,
|
|
4585
|
+
],
|
|
4586
|
+
[
|
|
4587
|
+
"undefinedTokens",
|
|
4588
|
+
report.summary.undefinedTokenCount,
|
|
4589
|
+
report.diagnostics.undefinedTokens,
|
|
4590
|
+
],
|
|
4591
|
+
[
|
|
4592
|
+
"undefinedCssClasses",
|
|
4593
|
+
report.summary.undefinedCssClassCount,
|
|
4594
|
+
report.diagnostics.undefinedCssClasses,
|
|
4595
|
+
],
|
|
4596
|
+
[
|
|
4597
|
+
"unbackedSemanticTokens",
|
|
4598
|
+
report.summary.unbackedSemanticTokenCount,
|
|
4599
|
+
report.diagnostics.unbackedSemanticTokens,
|
|
4600
|
+
],
|
|
4601
|
+
[
|
|
4602
|
+
"themeSymmetryIssues",
|
|
4603
|
+
report.summary.themeSymmetryIssueCount,
|
|
4604
|
+
report.diagnostics.themeSymmetryIssues,
|
|
4605
|
+
],
|
|
4606
|
+
[
|
|
4607
|
+
"contrastFailures",
|
|
4608
|
+
report.summary.contrastFailureCount,
|
|
4609
|
+
report.diagnostics.contrastFailures,
|
|
4610
|
+
],
|
|
4611
|
+
];
|
|
4612
|
+
const topIssuesSummary = {};
|
|
4613
|
+
for (const [key, totalCount, items] of issueBuckets) {
|
|
4614
|
+
if (items.length === 0 && totalCount === 0)
|
|
4615
|
+
continue;
|
|
4616
|
+
topIssuesSummary[key] = {
|
|
4617
|
+
count: Math.max(totalCount, items.length),
|
|
4618
|
+
examples: items.slice(0, 3).map(stripSnippet),
|
|
4619
|
+
};
|
|
4620
|
+
}
|
|
4621
|
+
const compactAtomicConsolidation = report.atomicConsolidation.map((cand) => ({
|
|
4622
|
+
atomName: cand.atomName,
|
|
4623
|
+
description: cand.description,
|
|
4624
|
+
instanceCount: cand.instanceCount,
|
|
4625
|
+
adopterCount: cand.adopterCount,
|
|
4626
|
+
adoptionRate: cand.adoptionRate,
|
|
4627
|
+
...(cand.existingSharedComponent
|
|
4628
|
+
? { existingSharedComponent: cand.existingSharedComponent }
|
|
4629
|
+
: {}),
|
|
4630
|
+
consolidationGuidance: cand.consolidationGuidance,
|
|
4631
|
+
sampleInstances: cand.instances.slice(0, 3).map((inst) => ({
|
|
4632
|
+
componentName: inst.componentName,
|
|
4633
|
+
filePath: inst.filePath,
|
|
4634
|
+
lineNumber: inst.lineNumber,
|
|
4635
|
+
})),
|
|
4636
|
+
}));
|
|
4637
|
+
const compactComponents = hasSearchTerm
|
|
4638
|
+
? report.components.map((c) => ({
|
|
4639
|
+
entityId: c.entityId,
|
|
4640
|
+
label: c.label,
|
|
4641
|
+
filePath: c.filePath,
|
|
4642
|
+
...(c.lineNumber ? { lineNumber: c.lineNumber } : {}),
|
|
4643
|
+
atomicTier: c.atomicTier,
|
|
4644
|
+
uiKind: c.uiKind,
|
|
4645
|
+
stylingConventions: c.stylingConventions,
|
|
4646
|
+
propContract: c.propContract,
|
|
4647
|
+
tokensConsumed: c.tokensConsumed,
|
|
4648
|
+
renderedComponents: c.renderedComponents,
|
|
4649
|
+
variantAxes: c.variantAxes,
|
|
4650
|
+
arbitraryTailwind: c.arbitraryTailwind.slice(0, 5).map(stripSnippet),
|
|
4651
|
+
rawDomPrimitives: c.rawDomPrimitives.slice(0, 5).map(stripSnippet),
|
|
4652
|
+
inlineStyleLiterals: c.inlineStyleLiterals.slice(0, 5).map(stripSnippet),
|
|
4653
|
+
health: c.health,
|
|
4654
|
+
}))
|
|
4655
|
+
: report.components.map((c) => ({
|
|
4656
|
+
entityId: c.entityId,
|
|
4657
|
+
label: c.label,
|
|
4658
|
+
filePath: c.filePath,
|
|
4659
|
+
atomicTier: c.atomicTier,
|
|
4660
|
+
uiKind: c.uiKind,
|
|
4661
|
+
stylingConventions: c.stylingConventions,
|
|
4662
|
+
}));
|
|
4663
|
+
return {
|
|
4664
|
+
plugin: report.plugin,
|
|
4665
|
+
system: report.system,
|
|
4666
|
+
baseline: report.baseline,
|
|
4667
|
+
summary: report.summary,
|
|
4668
|
+
agentExtendability: {
|
|
4669
|
+
score: report.agentExtendability.overallScore,
|
|
4670
|
+
overallScore: report.agentExtendability.overallScore,
|
|
4671
|
+
grade: report.agentExtendability.grade,
|
|
4672
|
+
measures: report.agentExtendability.measures,
|
|
4673
|
+
pavedRoadBlueprint: report.agentExtendability.pavedRoadBlueprint,
|
|
4674
|
+
},
|
|
4675
|
+
atomicConsolidation: compactAtomicConsolidation,
|
|
4676
|
+
semanticTokens,
|
|
4677
|
+
components: compactComponents,
|
|
4678
|
+
topIssuesSummary,
|
|
4679
|
+
recommendedHighlightNodeIds: report.recommendedHighlightNodeIds,
|
|
4680
|
+
agentGuidance: report.agentGuidance,
|
|
4681
|
+
};
|
|
4682
|
+
}
|
|
4490
4683
|
/** Short labels (scope stripped) of the frontend packages in a report's scope. */
|
|
4491
4684
|
export function frontendPackageLabels(report) {
|
|
4492
4685
|
return report.system.packages
|
package/dist/index.d.ts
CHANGED
|
@@ -45,7 +45,11 @@ export declare function loadActiveGraphWithShims(repoPath: string, dbPath: strin
|
|
|
45
45
|
* `baseGraph.commitSha` when available) and the live working tree (`analyzeTarget` + active plugin projections).
|
|
46
46
|
* Checks staleness (`[PAT-DB-03]`, Principle of Incomplete Truth) before reporting a delta.
|
|
47
47
|
*/
|
|
48
|
-
export declare function computeGraphDeltaWithShims(repoPath: string, dbPath: string, repoId: string, storageFactory?: (dbPath: string) => ChompStorage): Promise<GraphDelta
|
|
48
|
+
export declare function computeGraphDeltaWithShims(repoPath: string, dbPath: string, repoId: string, storageFactory?: (dbPath: string) => ChompStorage): Promise<GraphDelta & {
|
|
49
|
+
gateStatus?: "PASS" | "WARN";
|
|
50
|
+
architecturalGate?: ArchitecturalDiffGate;
|
|
51
|
+
designSystemGate?: CompactDesignSystemDiffGate;
|
|
52
|
+
}>;
|
|
49
53
|
export declare function computeGitRefDeltaWithShims(repoPath: string, options?: {
|
|
50
54
|
baseRef?: string;
|
|
51
55
|
targetRef?: string;
|
|
@@ -55,6 +59,54 @@ export declare function computeGitRefDeltaWithShims(repoPath: string, options?:
|
|
|
55
59
|
targetRef: string;
|
|
56
60
|
isWorkingTreeSnapshot: boolean;
|
|
57
61
|
snapshotAt?: string;
|
|
62
|
+
gateStatus?: "PASS" | "WARN";
|
|
63
|
+
architecturalGate?: ArchitecturalDiffGate;
|
|
64
|
+
designSystemGate?: CompactDesignSystemDiffGate;
|
|
65
|
+
}>;
|
|
66
|
+
export interface CompactDesignSystemDiffGate {
|
|
67
|
+
gateStatus: "PASS" | "WARN";
|
|
68
|
+
summary: {
|
|
69
|
+
newRawPrimitiveCount: number;
|
|
70
|
+
newHardcodedLiteralCount: number;
|
|
71
|
+
newArbitraryTailwindCount: number;
|
|
72
|
+
newUndefinedTokenCount: number;
|
|
73
|
+
newInvariantViolationCount: number;
|
|
74
|
+
newContrastFailureCount: number;
|
|
75
|
+
};
|
|
76
|
+
newIssues?: Record<string, Array<any>>;
|
|
77
|
+
}
|
|
78
|
+
export interface ArchitecturalDiffGate {
|
|
79
|
+
gateStatus: "PASS" | "WARN";
|
|
80
|
+
summary: {
|
|
81
|
+
newPassThroughWrapperCount: number;
|
|
82
|
+
newDuplicateFlowCount: number;
|
|
83
|
+
newDuplicateSymbolCount: number;
|
|
84
|
+
newBoundaryViolationCount: number;
|
|
85
|
+
newBoundaryAdvisoryCount?: number;
|
|
86
|
+
newCycleCount: number;
|
|
87
|
+
};
|
|
88
|
+
newPassThroughWrappers: Array<any>;
|
|
89
|
+
newDuplicateFlows: Array<any>;
|
|
90
|
+
newDuplicateSymbols: Array<any>;
|
|
91
|
+
newBoundaryViolations: Array<any>;
|
|
92
|
+
newBoundaryAdvisories?: Array<any>;
|
|
93
|
+
newCycles: {
|
|
94
|
+
packageCycles: Array<any>;
|
|
95
|
+
contractCycles: Array<any>;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export declare function computeArchitecturalDiffGate(baseGraph: RepresentationGraph, targetGraph: RepresentationGraph, options?: {
|
|
99
|
+
repoPath?: string;
|
|
100
|
+
packageName?: string;
|
|
101
|
+
limit?: number;
|
|
102
|
+
isTargetOnDisk?: boolean;
|
|
103
|
+
}): ArchitecturalDiffGate;
|
|
104
|
+
export declare function resolveLiveAndBaseGraphsForMcp(repoPath: string, dbPath: string, repoId: string, options?: {
|
|
105
|
+
needBaseGraph?: boolean;
|
|
106
|
+
}): Promise<{
|
|
107
|
+
targetGraph: RepresentationGraph;
|
|
108
|
+
baseGraph: RepresentationGraph | null;
|
|
109
|
+
evaluatedSource: "WORKING_TREE" | "COMMITTED_HEAD";
|
|
58
110
|
}>;
|
|
59
111
|
/**
|
|
60
112
|
* Wraps an MCP tool handler so uncaught errors return a structured
|
|
@@ -62,4 +114,102 @@ export declare function computeGitRefDeltaWithShims(repoPath: string, options?:
|
|
|
62
114
|
* crashing the stdio transport or leaking resources.
|
|
63
115
|
*/
|
|
64
116
|
export declare function withMcpToolErrorBoundary<A>(handler: (args: A) => Promise<any>): (args: A) => Promise<any>;
|
|
117
|
+
export declare function formatCompactMcpDiff(delta: GraphDelta & {
|
|
118
|
+
baseRef?: string;
|
|
119
|
+
targetRef?: string;
|
|
120
|
+
isWorkingTreeSnapshot?: boolean;
|
|
121
|
+
snapshotAt?: string;
|
|
122
|
+
gateStatus?: "PASS" | "WARN";
|
|
123
|
+
architecturalGate?: ArchitecturalDiffGate;
|
|
124
|
+
designSystemGate?: CompactDesignSystemDiffGate;
|
|
125
|
+
}, options?: {
|
|
126
|
+
includeLexicalShift?: boolean;
|
|
127
|
+
includeUnchanged?: boolean;
|
|
128
|
+
verbose?: boolean;
|
|
129
|
+
maxNodes?: number;
|
|
130
|
+
maxEdges?: number;
|
|
131
|
+
}): {
|
|
132
|
+
nodes: Record<string, import("@getchomp/core").DiffNode>;
|
|
133
|
+
edges: Record<string, import("@getchomp/core").DiffEdge>;
|
|
134
|
+
summary: {
|
|
135
|
+
nodes: {
|
|
136
|
+
ADDED: number;
|
|
137
|
+
MODIFIED: number;
|
|
138
|
+
REMOVED: number;
|
|
139
|
+
LEXICAL_SHIFT: number;
|
|
140
|
+
UNCHANGED: number;
|
|
141
|
+
};
|
|
142
|
+
edges: {
|
|
143
|
+
ADDED: number;
|
|
144
|
+
MODIFIED: number;
|
|
145
|
+
REMOVED: number;
|
|
146
|
+
LEXICAL_SHIFT: number;
|
|
147
|
+
UNCHANGED: number;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
designSystemGate?: CompactDesignSystemDiffGate | undefined;
|
|
151
|
+
architecturalGate?: ArchitecturalDiffGate | undefined;
|
|
152
|
+
baseExtractorVersion: string | undefined;
|
|
153
|
+
targetExtractorVersion: string | undefined;
|
|
154
|
+
snapshotAt?: string | undefined;
|
|
155
|
+
isWorkingTreeSnapshot?: boolean | undefined;
|
|
156
|
+
targetCommitSha: string | undefined;
|
|
157
|
+
headCommitSha: string | undefined;
|
|
158
|
+
targetRef?: string | undefined;
|
|
159
|
+
baseCommitSha: string | undefined;
|
|
160
|
+
baseRef?: string | undefined;
|
|
161
|
+
baseStatus: "FRESH" | "STALE";
|
|
162
|
+
gateStatus?: "PASS" | "WARN" | undefined;
|
|
163
|
+
} | {
|
|
164
|
+
summary: {
|
|
165
|
+
omittedNoise: {
|
|
166
|
+
modifiedDeploymentUnits: number;
|
|
167
|
+
modifiedExternalPackageImports: number;
|
|
168
|
+
modifiedSameEndpointEdges: number;
|
|
169
|
+
externalPackageCallEdges: number;
|
|
170
|
+
builtinOrDynamicEdges: number;
|
|
171
|
+
testFileNodes: number;
|
|
172
|
+
testFileEdges: number;
|
|
173
|
+
truncatedNodes: number;
|
|
174
|
+
truncatedEdges: number;
|
|
175
|
+
};
|
|
176
|
+
nodes: {
|
|
177
|
+
ADDED: number;
|
|
178
|
+
MODIFIED: number;
|
|
179
|
+
REMOVED: number;
|
|
180
|
+
LEXICAL_SHIFT: number;
|
|
181
|
+
UNCHANGED: number;
|
|
182
|
+
};
|
|
183
|
+
edges: {
|
|
184
|
+
ADDED: number;
|
|
185
|
+
MODIFIED: number;
|
|
186
|
+
REMOVED: number;
|
|
187
|
+
LEXICAL_SHIFT: number;
|
|
188
|
+
UNCHANGED: number;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
nodes: Record<string, any>;
|
|
192
|
+
edges: Record<string, any>;
|
|
193
|
+
designSystemGate?: CompactDesignSystemDiffGate | undefined;
|
|
194
|
+
architecturalGate?: ArchitecturalDiffGate | undefined;
|
|
195
|
+
baseExtractorVersion: string | undefined;
|
|
196
|
+
targetExtractorVersion: string | undefined;
|
|
197
|
+
snapshotAt?: string | undefined;
|
|
198
|
+
isWorkingTreeSnapshot?: boolean | undefined;
|
|
199
|
+
targetCommitSha: string | undefined;
|
|
200
|
+
headCommitSha: string | undefined;
|
|
201
|
+
targetRef?: string | undefined;
|
|
202
|
+
baseCommitSha: string | undefined;
|
|
203
|
+
baseRef?: string | undefined;
|
|
204
|
+
baseStatus: "FRESH" | "STALE";
|
|
205
|
+
gateStatus?: "PASS" | "WARN" | undefined;
|
|
206
|
+
};
|
|
207
|
+
export declare function formatCompactMcpNodes(nodes: Array<Record<string, any>>, options?: {
|
|
208
|
+
verbose?: boolean;
|
|
209
|
+
limit?: number;
|
|
210
|
+
}): Array<Record<string, any>>;
|
|
211
|
+
export declare function formatCompactMcpEdges(edges: Array<Record<string, any>>, options?: {
|
|
212
|
+
verbose?: boolean;
|
|
213
|
+
includeBuiltins?: boolean;
|
|
214
|
+
}): Array<Record<string, any>>;
|
|
65
215
|
export declare function runMcpServer(targetPath?: string): Promise<void>;
|