@getchomp/mcp 0.0.0-stage → 0.2.43
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 +21 -0
- package/README.md +15 -2
- package/dist/conventionsReference.d.ts +84 -0
- package/dist/conventionsReference.js +313 -0
- package/dist/designSystem/astScanner.d.ts +153 -0
- package/dist/designSystem/astScanner.js +2014 -0
- package/dist/designSystem/baseline.d.ts +65 -0
- package/dist/designSystem/baseline.js +136 -0
- package/dist/designSystem/color.d.ts +35 -0
- package/dist/designSystem/color.js +265 -0
- package/dist/designSystem/config.d.ts +183 -0
- package/dist/designSystem/config.js +469 -0
- package/dist/designSystem/contrast.d.ts +55 -0
- package/dist/designSystem/contrast.js +377 -0
- package/dist/designSystem/cssParser.d.ts +63 -0
- package/dist/designSystem/cssParser.js +469 -0
- package/dist/designSystem/merges.d.ts +57 -0
- package/dist/designSystem/merges.js +94 -0
- package/dist/designSystem/preprocessors.d.ts +46 -0
- package/dist/designSystem/preprocessors.js +1108 -0
- package/dist/designSystem/presentation.d.ts +45 -0
- package/dist/designSystem/presentation.js +796 -0
- package/dist/designSystem/styleVectors.d.ts +27 -0
- package/dist/designSystem/styleVectors.js +484 -0
- package/dist/designSystem/tokens.d.ts +39 -0
- package/dist/designSystem/tokens.js +409 -0
- package/dist/designSystem/topology.d.ts +64 -0
- package/dist/designSystem/topology.js +254 -0
- package/dist/designSystem/types.d.ts +857 -0
- package/dist/designSystem/types.js +113 -0
- package/dist/designSystem/typography.d.ts +25 -0
- package/dist/designSystem/typography.js +244 -0
- package/dist/designSystem/uiShapes.d.ts +74 -0
- package/dist/designSystem/uiShapes.js +285 -0
- package/dist/designSystem/valueClusters.d.ts +76 -0
- package/dist/designSystem/valueClusters.js +281 -0
- package/dist/designSystemPlugin.d.ts +321 -0
- package/dist/designSystemPlugin.js +4730 -0
- package/dist/enrichNodesPlugin.d.ts +160 -0
- package/dist/enrichNodesPlugin.js +957 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.js +1298 -0
- package/dist/intelligence.d.ts +502 -0
- package/dist/intelligence.js +3058 -0
- package/dist/pluginRunner.d.ts +364 -0
- package/dist/pluginRunner.js +1096 -0
- package/dist/plugins/design-system/index.d.ts +14 -0
- package/dist/plugins/design-system/index.js +241 -0
- package/dist/plugins/enrich-nodes/index.d.ts +388 -0
- package/dist/plugins/enrich-nodes/index.js +697 -0
- package/dist/plugins/index.d.ts +15 -0
- package/dist/plugins/index.js +20 -0
- package/dist/plugins/local-shims/index.d.ts +121 -0
- package/dist/plugins/local-shims/index.js +237 -0
- package/dist/shimsPlugin.d.ts +134 -0
- package/dist/shimsPlugin.js +1392 -0
- package/package.json +39 -3
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* packages/mcp/src/enrichNodesPlugin.ts
|
|
3
|
+
*
|
|
4
|
+
* Node Enrichment Plugin (`L1_SEMANTIC` / `source: 'enrich-nodes'`)
|
|
5
|
+
* Enforces [PAT-DB-03], [PAT-DB-05], [PAT-MCP-08], [PAT-VIS-24], [PAT-VIS-25], [PAT-VIS-26], [PAT-VIS-36].
|
|
6
|
+
*
|
|
7
|
+
* Synthesizes Plugin Presentation Contract v1 (`payload.presentation`) for Layer 1 semantic
|
|
8
|
+
* enrichments (`chomp_enrich_nodes` / `AI_HYPOTHESIS` rows in `entity_overlays`) without ever
|
|
9
|
+
* overwriting or pruning the underlying `AI_HYPOTHESIS` rows:
|
|
10
|
+
* - Scoped strictly to `PackageInspectorDrawer` (`inspectorScopes: ["package"]`) because node-level
|
|
11
|
+
* semantic labels and summaries write directly to the node's primary title, alias, and description.
|
|
12
|
+
* - Surfaces a clean HUD status dot (no canvas Spotlight views) with un-enriched node count, concise
|
|
13
|
+
* value description, and copyable agent prompt instructions.
|
|
14
|
+
* - Renders a streamlined 3-metric Package Inspector card (`Coverage`, `Enriched`, `Stale`) with
|
|
15
|
+
* skimmable click-through line items.
|
|
16
|
+
*/
|
|
17
|
+
import { type RepresentationGraph, type StructuralNode } from "@getchomp/core";
|
|
18
|
+
import type { EntityOverlayRecord } from "@getchomp/db";
|
|
19
|
+
import type { ChompPlugin } from "./pluginRunner.js";
|
|
20
|
+
export declare const ENRICH_NODES_PLUGIN_NAME: "enrich-nodes";
|
|
21
|
+
export declare const SEMANTIC_OVERLAY_LAYER: "L1_SEMANTIC";
|
|
22
|
+
export declare const SEMANTIC_PRODUCER_SOURCE: "chomp_enrich_nodes";
|
|
23
|
+
export declare const SEMANTIC_SIDECAR_FILENAME: "semantic.json";
|
|
24
|
+
export declare const SEMANTIC_SIDECAR_FILE_REL: ".chomp/plugins/enrich-nodes/semantic.json";
|
|
25
|
+
export interface SemanticSidecarEntry {
|
|
26
|
+
domain?: string;
|
|
27
|
+
humanLabel?: string;
|
|
28
|
+
summary?: string;
|
|
29
|
+
rationale?: string;
|
|
30
|
+
bodyHash?: string | null;
|
|
31
|
+
updatedAt?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface SemanticSidecarFile {
|
|
34
|
+
schemaVersion: 1;
|
|
35
|
+
domains: string[];
|
|
36
|
+
nodes: Record<string, SemanticSidecarEntry>;
|
|
37
|
+
}
|
|
38
|
+
interface AggregatedNodeEnrichment {
|
|
39
|
+
entityId: string;
|
|
40
|
+
domain?: string;
|
|
41
|
+
humanLabel?: string;
|
|
42
|
+
summary?: string;
|
|
43
|
+
rationale?: string;
|
|
44
|
+
bodyHash: string | null;
|
|
45
|
+
stale: boolean;
|
|
46
|
+
staleReason?: "bodyHash_drift" | "marked_stale";
|
|
47
|
+
producerSources: string[];
|
|
48
|
+
updatedAt?: string;
|
|
49
|
+
}
|
|
50
|
+
export declare function parseSemanticSidecar(rawText: string | null): SemanticSidecarFile;
|
|
51
|
+
export declare function serializeSemanticSidecar(sidecar: SemanticSidecarFile): string;
|
|
52
|
+
export declare function readSemanticSidecar(repoPath: string): SemanticSidecarFile | null;
|
|
53
|
+
export declare function writeSemanticSidecar(repoPath: string, sidecar: SemanticSidecarFile): string;
|
|
54
|
+
export declare function mergeNodesIntoSemanticSidecar(repoPath: string, updates: ReadonlyArray<{
|
|
55
|
+
nodeId: string;
|
|
56
|
+
domain?: string;
|
|
57
|
+
humanLabel?: string;
|
|
58
|
+
summary?: string;
|
|
59
|
+
rationale?: string;
|
|
60
|
+
bodyHash?: string | null;
|
|
61
|
+
}>, existingFromDb?: readonly EntityOverlayRecord[]): {
|
|
62
|
+
path: string;
|
|
63
|
+
totalNodes: number;
|
|
64
|
+
domains: string[];
|
|
65
|
+
};
|
|
66
|
+
export declare function isEnrichmentTargetNode(node: StructuralNode, includeExportedTypes?: boolean): boolean;
|
|
67
|
+
export declare function classifySemanticOverlayMap(graph: RepresentationGraph, existingOverlays: readonly EntityOverlayRecord[], flagStaleDrift?: boolean): Map<string, AggregatedNodeEnrichment>;
|
|
68
|
+
export declare function extractNodeCodeContext(repoPath: string | undefined, filePath: string | undefined, lineNumber: number | undefined, contextLines?: number, fileLinesCache?: Map<string, string[] | null>): {
|
|
69
|
+
jsdocSummary?: string;
|
|
70
|
+
codeContext?: string;
|
|
71
|
+
};
|
|
72
|
+
export declare function buildEnrichmentStatus(params: {
|
|
73
|
+
graph: RepresentationGraph;
|
|
74
|
+
existingOverlays: readonly EntityOverlayRecord[];
|
|
75
|
+
repoPath?: string;
|
|
76
|
+
settings?: Record<string, unknown>;
|
|
77
|
+
packageName?: string;
|
|
78
|
+
}): {
|
|
79
|
+
action: "status";
|
|
80
|
+
totalContracts: number;
|
|
81
|
+
enrichedContracts: number;
|
|
82
|
+
unenrichedContracts: number;
|
|
83
|
+
staleContracts: number;
|
|
84
|
+
coveragePct: number | null;
|
|
85
|
+
includeExportedTypes: boolean;
|
|
86
|
+
sidecarPath: ".chomp/plugins/enrich-nodes/semantic.json";
|
|
87
|
+
sidecarExists: boolean;
|
|
88
|
+
domains: {
|
|
89
|
+
domain: string;
|
|
90
|
+
count: number;
|
|
91
|
+
}[];
|
|
92
|
+
packages: {
|
|
93
|
+
packageLabel: string;
|
|
94
|
+
packageKey: string;
|
|
95
|
+
totalContracts: number;
|
|
96
|
+
enrichedContracts: number;
|
|
97
|
+
unenrichedContracts: number;
|
|
98
|
+
staleContracts: number;
|
|
99
|
+
coveragePct: number | null;
|
|
100
|
+
}[];
|
|
101
|
+
};
|
|
102
|
+
export interface EnrichmentQueueItem {
|
|
103
|
+
nodeId: string;
|
|
104
|
+
packageKey: string;
|
|
105
|
+
name: string;
|
|
106
|
+
entityType: string;
|
|
107
|
+
priority: 1 | 2 | 3 | 4;
|
|
108
|
+
filePath?: string;
|
|
109
|
+
lineNumber?: number;
|
|
110
|
+
parentBoundaryName?: string;
|
|
111
|
+
signature?: {
|
|
112
|
+
inputs?: Array<{
|
|
113
|
+
name: string;
|
|
114
|
+
type?: string;
|
|
115
|
+
}>;
|
|
116
|
+
outputType?: string;
|
|
117
|
+
};
|
|
118
|
+
isStale: boolean;
|
|
119
|
+
staleReason?: "bodyHash_drift" | "marked_stale";
|
|
120
|
+
previousEnrichment?: {
|
|
121
|
+
domain?: string;
|
|
122
|
+
humanLabel?: string;
|
|
123
|
+
summary?: string;
|
|
124
|
+
rationale?: string;
|
|
125
|
+
};
|
|
126
|
+
jsdocSummary?: string;
|
|
127
|
+
codeContext?: string;
|
|
128
|
+
}
|
|
129
|
+
export declare function buildEnrichmentQueue(params: {
|
|
130
|
+
graph: RepresentationGraph;
|
|
131
|
+
existingOverlays: readonly EntityOverlayRecord[];
|
|
132
|
+
repoPath?: string;
|
|
133
|
+
settings?: Record<string, unknown>;
|
|
134
|
+
packageName?: string;
|
|
135
|
+
status?: "needs_enrichment" | "unenriched" | "stale" | "all";
|
|
136
|
+
includeTypes?: boolean;
|
|
137
|
+
limit?: number;
|
|
138
|
+
cursor?: number;
|
|
139
|
+
includeContext?: boolean;
|
|
140
|
+
contextLines?: number;
|
|
141
|
+
}): {
|
|
142
|
+
action: "queue";
|
|
143
|
+
statusFilter: "needs_enrichment" | "unenriched" | "stale" | "all";
|
|
144
|
+
totalMatching: number;
|
|
145
|
+
returnedCount: number;
|
|
146
|
+
cursor: number;
|
|
147
|
+
nextCursor: number | null;
|
|
148
|
+
existingDomains: {
|
|
149
|
+
domain: string;
|
|
150
|
+
count: number;
|
|
151
|
+
}[];
|
|
152
|
+
byPackage: Record<string, {
|
|
153
|
+
totalMatching: number;
|
|
154
|
+
unenriched: number;
|
|
155
|
+
stale: number;
|
|
156
|
+
}>;
|
|
157
|
+
items: EnrichmentQueueItem[];
|
|
158
|
+
};
|
|
159
|
+
export declare const enrichNodesPlugin: ChompPlugin;
|
|
160
|
+
export {};
|