mapra 0.1.0
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 +144 -0
- package/dist/analyzer/blast-radius.d.ts +27 -0
- package/dist/analyzer/blast-radius.d.ts.map +1 -0
- package/dist/analyzer/blast-radius.js +58 -0
- package/dist/analyzer/blast-radius.js.map +1 -0
- package/dist/analyzer/churn.d.ts +26 -0
- package/dist/analyzer/churn.d.ts.map +1 -0
- package/dist/analyzer/churn.js +96 -0
- package/dist/analyzer/churn.js.map +1 -0
- package/dist/analyzer/co-change.d.ts +60 -0
- package/dist/analyzer/co-change.d.ts.map +1 -0
- package/dist/analyzer/co-change.js +153 -0
- package/dist/analyzer/co-change.js.map +1 -0
- package/dist/analyzer/conventions.d.ts +22 -0
- package/dist/analyzer/conventions.d.ts.map +1 -0
- package/dist/analyzer/conventions.js +81 -0
- package/dist/analyzer/conventions.js.map +1 -0
- package/dist/analyzer/git-hash.d.ts +11 -0
- package/dist/analyzer/git-hash.d.ts.map +1 -0
- package/dist/analyzer/git-hash.js +25 -0
- package/dist/analyzer/git-hash.js.map +1 -0
- package/dist/analyzer/graph-utils.d.ts +46 -0
- package/dist/analyzer/graph-utils.d.ts.map +1 -0
- package/dist/analyzer/graph-utils.js +145 -0
- package/dist/analyzer/graph-utils.js.map +1 -0
- package/dist/analyzer/index.d.ts +34 -0
- package/dist/analyzer/index.d.ts.map +1 -0
- package/dist/analyzer/index.js +63 -0
- package/dist/analyzer/index.js.map +1 -0
- package/dist/cli/hooks.d.ts +24 -0
- package/dist/cli/hooks.d.ts.map +1 -0
- package/dist/cli/hooks.js +126 -0
- package/dist/cli/hooks.js.map +1 -0
- package/dist/cli/index.d.ts +18 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +818 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/plan-parser.d.ts +20 -0
- package/dist/cli/plan-parser.d.ts.map +1 -0
- package/dist/cli/plan-parser.js +104 -0
- package/dist/cli/plan-parser.js.map +1 -0
- package/dist/cli/shim.d.ts +3 -0
- package/dist/cli/shim.d.ts.map +1 -0
- package/dist/cli/shim.js +33 -0
- package/dist/cli/shim.js.map +1 -0
- package/dist/cli/templates.d.ts +28 -0
- package/dist/cli/templates.d.ts.map +1 -0
- package/dist/cli/templates.js +91 -0
- package/dist/cli/templates.js.map +1 -0
- package/dist/encoder/encode.d.ts +17 -0
- package/dist/encoder/encode.d.ts.map +1 -0
- package/dist/encoder/encode.js +270 -0
- package/dist/encoder/encode.js.map +1 -0
- package/dist/encoder/layer-infrastructure.d.ts +17 -0
- package/dist/encoder/layer-infrastructure.d.ts.map +1 -0
- package/dist/encoder/layer-infrastructure.js +232 -0
- package/dist/encoder/layer-infrastructure.js.map +1 -0
- package/dist/encoder/layer-labels.d.ts +18 -0
- package/dist/encoder/layer-labels.d.ts.map +1 -0
- package/dist/encoder/layer-labels.js +172 -0
- package/dist/encoder/layer-labels.js.map +1 -0
- package/dist/encoder/layer-terrain.d.ts +18 -0
- package/dist/encoder/layer-terrain.d.ts.map +1 -0
- package/dist/encoder/layer-terrain.js +135 -0
- package/dist/encoder/layer-terrain.js.map +1 -0
- package/dist/encoder/layout.d.ts +53 -0
- package/dist/encoder/layout.d.ts.map +1 -0
- package/dist/encoder/layout.js +178 -0
- package/dist/encoder/layout.js.map +1 -0
- package/dist/encoder/parse-strand-header.d.ts +29 -0
- package/dist/encoder/parse-strand-header.d.ts.map +1 -0
- package/dist/encoder/parse-strand-header.js +59 -0
- package/dist/encoder/parse-strand-header.js.map +1 -0
- package/dist/encoder/spatial-text-encode.d.ts +22 -0
- package/dist/encoder/spatial-text-encode.d.ts.map +1 -0
- package/dist/encoder/spatial-text-encode.js +199 -0
- package/dist/encoder/spatial-text-encode.js.map +1 -0
- package/dist/encoder/strand-format-encode-v1.d.ts +16 -0
- package/dist/encoder/strand-format-encode-v1.d.ts.map +1 -0
- package/dist/encoder/strand-format-encode-v1.js +296 -0
- package/dist/encoder/strand-format-encode-v1.js.map +1 -0
- package/dist/encoder/strand-format-encode.d.ts +21 -0
- package/dist/encoder/strand-format-encode.d.ts.map +1 -0
- package/dist/encoder/strand-format-encode.js +562 -0
- package/dist/encoder/strand-format-encode.js.map +1 -0
- package/dist/encoder/text-encode.d.ts +13 -0
- package/dist/encoder/text-encode.d.ts.map +1 -0
- package/dist/encoder/text-encode.js +123 -0
- package/dist/encoder/text-encode.js.map +1 -0
- package/dist/query/blast-radius.d.ts +14 -0
- package/dist/query/blast-radius.d.ts.map +1 -0
- package/dist/query/blast-radius.js +81 -0
- package/dist/query/blast-radius.js.map +1 -0
- package/dist/query/cache.d.ts +29 -0
- package/dist/query/cache.d.ts.map +1 -0
- package/dist/query/cache.js +138 -0
- package/dist/query/cache.js.map +1 -0
- package/dist/query/index.d.ts +2 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +46 -0
- package/dist/query/index.js.map +1 -0
- package/dist/query/resolve.d.ts +7 -0
- package/dist/query/resolve.d.ts.map +1 -0
- package/dist/query/resolve.js +24 -0
- package/dist/query/resolve.js.map +1 -0
- package/dist/query/risk-profile.d.ts +30 -0
- package/dist/query/risk-profile.d.ts.map +1 -0
- package/dist/query/risk-profile.js +94 -0
- package/dist/query/risk-profile.js.map +1 -0
- package/dist/query/test-map.d.ts +13 -0
- package/dist/query/test-map.d.ts.map +1 -0
- package/dist/query/test-map.js +43 -0
- package/dist/query/test-map.js.map +1 -0
- package/dist/scanner/index.d.ts +51 -0
- package/dist/scanner/index.d.ts.map +1 -0
- package/dist/scanner/index.js +480 -0
- package/dist/scanner/index.js.map +1 -0
- package/dist/scanner/workspace.d.ts +11 -0
- package/dist/scanner/workspace.d.ts.map +1 -0
- package/dist/scanner/workspace.js +243 -0
- package/dist/scanner/workspace.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strand Visual Encoder — converts a StrandGraph into a visual encoding
|
|
3
|
+
*
|
|
4
|
+
* This is the core innovation: a spatial visual language designed for
|
|
5
|
+
* multimodal LLM consumption, not human dashboards.
|
|
6
|
+
*
|
|
7
|
+
* Design principles:
|
|
8
|
+
* - Position encodes module boundaries (spatial clustering)
|
|
9
|
+
* - Size encodes complexity/importance (larger = more complex)
|
|
10
|
+
* - Color encodes file type (routes, components, utilities, tests)
|
|
11
|
+
* - Connection lines encode dependencies (thicker = stronger coupling)
|
|
12
|
+
* - Density encodes hotspots (tightly packed = high coupling)
|
|
13
|
+
* - Labels are minimal but machine-readable
|
|
14
|
+
*/
|
|
15
|
+
// Color palette — designed for visual distinctiveness in LLM vision
|
|
16
|
+
const TYPE_COLORS = {
|
|
17
|
+
route: "#FF6B35", // orange — pages/routes (entry points)
|
|
18
|
+
"api-route": "#E63946", // red — API routes (data endpoints)
|
|
19
|
+
component: "#457B9D", // blue — React components
|
|
20
|
+
layout: "#A8DADC", // light blue — layouts
|
|
21
|
+
middleware: "#F4A261", // amber — middleware
|
|
22
|
+
schema: "#2A9D8F", // teal — data schema
|
|
23
|
+
test: "#6C757D", // gray — tests
|
|
24
|
+
config: "#ADB5BD", // light gray — config
|
|
25
|
+
utility: "#264653", // dark blue — utilities
|
|
26
|
+
module: "#E9ECEF", // very light gray — module background
|
|
27
|
+
};
|
|
28
|
+
export function encodeToSVG(graph) {
|
|
29
|
+
const PADDING = 60;
|
|
30
|
+
const MODULE_PADDING = 30;
|
|
31
|
+
const MIN_NODE_RADIUS = 4;
|
|
32
|
+
const MAX_NODE_RADIUS = 18;
|
|
33
|
+
// Step 1: Layout modules in a grid
|
|
34
|
+
const layoutModules = layoutModulesInGrid(graph, PADDING, MODULE_PADDING);
|
|
35
|
+
// Step 2: Position nodes within their modules
|
|
36
|
+
const layoutNodes = positionNodesInModules(graph.nodes, layoutModules, graph.modules, MIN_NODE_RADIUS, MAX_NODE_RADIUS);
|
|
37
|
+
// Step 3: Calculate canvas size
|
|
38
|
+
const allNodes = layoutModules.flatMap((m) => m.nodes);
|
|
39
|
+
const maxX = Math.max(...layoutModules.map((m) => m.x + m.width)) + PADDING;
|
|
40
|
+
const maxY = Math.max(...layoutModules.map((m) => m.y + m.height)) + PADDING;
|
|
41
|
+
const canvasWidth = Math.max(maxX, 800);
|
|
42
|
+
const canvasHeight = Math.max(maxY, 600);
|
|
43
|
+
// Step 4: Build SVG
|
|
44
|
+
let svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${canvasWidth} ${canvasHeight}" width="${canvasWidth}" height="${canvasHeight}">
|
|
45
|
+
<style>
|
|
46
|
+
text { font-family: monospace; }
|
|
47
|
+
.module-label { font-size: 11px; font-weight: bold; fill: #333; }
|
|
48
|
+
.node-label { font-size: 7px; fill: #555; }
|
|
49
|
+
.title { font-size: 14px; font-weight: bold; fill: #111; }
|
|
50
|
+
.subtitle { font-size: 10px; fill: #666; }
|
|
51
|
+
.legend-text { font-size: 9px; fill: #444; }
|
|
52
|
+
</style>
|
|
53
|
+
<rect width="100%" height="100%" fill="#FAFAFA"/>
|
|
54
|
+
`;
|
|
55
|
+
// Title
|
|
56
|
+
svg += `<text x="${PADDING}" y="30" class="title">${escapeXml(graph.projectName)} — ${graph.framework}</text>\n`;
|
|
57
|
+
svg += `<text x="${PADDING}" y="45" class="subtitle">${graph.totalFiles} files · ${graph.totalLines.toLocaleString()} lines · ${graph.modules.length} modules</text>\n`;
|
|
58
|
+
// Draw edges first (behind nodes)
|
|
59
|
+
svg += drawEdges(graph.edges, layoutNodes, canvasWidth);
|
|
60
|
+
// Draw module backgrounds
|
|
61
|
+
for (const mod of layoutModules) {
|
|
62
|
+
svg += `<rect x="${mod.x}" y="${mod.y}" width="${mod.width}" height="${mod.height}" rx="8" fill="${TYPE_COLORS.module}" stroke="#DEE2E6" stroke-width="1" opacity="0.7"/>\n`;
|
|
63
|
+
svg += `<text x="${mod.x + 8}" y="${mod.y + 16}" class="module-label">${escapeXml(mod.name)}</text>\n`;
|
|
64
|
+
}
|
|
65
|
+
// Draw nodes
|
|
66
|
+
for (const node of allNodes) {
|
|
67
|
+
svg += drawNode(node);
|
|
68
|
+
}
|
|
69
|
+
// Legend
|
|
70
|
+
svg += drawLegend(canvasWidth - 180, 10);
|
|
71
|
+
svg += `</svg>`;
|
|
72
|
+
return svg;
|
|
73
|
+
}
|
|
74
|
+
function layoutModulesInGrid(graph, padding, modulePadding) {
|
|
75
|
+
const modules = graph.modules
|
|
76
|
+
.filter((m) => m.nodeCount > 0)
|
|
77
|
+
.sort((a, b) => b.totalLines - a.totalLines); // largest first
|
|
78
|
+
const cols = Math.ceil(Math.sqrt(modules.length));
|
|
79
|
+
const layoutModules = [];
|
|
80
|
+
let currentX = padding;
|
|
81
|
+
let currentY = 60; // below title
|
|
82
|
+
let rowHeight = 0;
|
|
83
|
+
let col = 0;
|
|
84
|
+
for (const mod of modules) {
|
|
85
|
+
// Estimate module size based on node count
|
|
86
|
+
const nodesPerRow = Math.ceil(Math.sqrt(mod.nodeCount));
|
|
87
|
+
const estimatedWidth = Math.max(nodesPerRow * 30 + modulePadding * 2, 120);
|
|
88
|
+
const estimatedHeight = Math.max(Math.ceil(mod.nodeCount / nodesPerRow) * 30 + modulePadding * 2 + 20, 80);
|
|
89
|
+
if (col >= cols && currentX + estimatedWidth > 1200) {
|
|
90
|
+
currentX = padding;
|
|
91
|
+
currentY += rowHeight + 20;
|
|
92
|
+
rowHeight = 0;
|
|
93
|
+
col = 0;
|
|
94
|
+
}
|
|
95
|
+
layoutModules.push({
|
|
96
|
+
id: mod.id,
|
|
97
|
+
name: mod.name,
|
|
98
|
+
x: currentX,
|
|
99
|
+
y: currentY,
|
|
100
|
+
width: estimatedWidth,
|
|
101
|
+
height: estimatedHeight,
|
|
102
|
+
nodes: [],
|
|
103
|
+
});
|
|
104
|
+
currentX += estimatedWidth + 15;
|
|
105
|
+
rowHeight = Math.max(rowHeight, estimatedHeight);
|
|
106
|
+
col++;
|
|
107
|
+
}
|
|
108
|
+
return layoutModules;
|
|
109
|
+
}
|
|
110
|
+
function positionNodesInModules(nodes, layoutModules, modules, minRadius, maxRadius) {
|
|
111
|
+
const nodeMap = new Map();
|
|
112
|
+
const moduleMap = new Map(layoutModules.map((m) => [m.id, m]));
|
|
113
|
+
// Assign nodes to modules
|
|
114
|
+
for (const node of nodes) {
|
|
115
|
+
const parts = node.path.split("/");
|
|
116
|
+
const moduleKey = parts.length > 2 ? parts.slice(0, 2).join("/") : (parts[0] ?? "");
|
|
117
|
+
const layoutMod = moduleMap.get(moduleKey);
|
|
118
|
+
if (!layoutMod)
|
|
119
|
+
continue;
|
|
120
|
+
const radius = minRadius + (maxRadius - minRadius) * Math.min(node.complexity, 1);
|
|
121
|
+
const layoutNode = {
|
|
122
|
+
...node,
|
|
123
|
+
x: 0,
|
|
124
|
+
y: 0,
|
|
125
|
+
radius,
|
|
126
|
+
color: TYPE_COLORS[node.type] ?? TYPE_COLORS["utility"] ?? "#888",
|
|
127
|
+
};
|
|
128
|
+
layoutMod.nodes.push(layoutNode);
|
|
129
|
+
nodeMap.set(node.id, layoutNode);
|
|
130
|
+
}
|
|
131
|
+
// Position nodes within each module using a spiral layout
|
|
132
|
+
for (const mod of layoutModules) {
|
|
133
|
+
const centerX = mod.x + mod.width / 2;
|
|
134
|
+
const centerY = mod.y + mod.height / 2 + 10; // offset for label
|
|
135
|
+
if (mod.nodes.length === 1) {
|
|
136
|
+
const singleNode = mod.nodes[0];
|
|
137
|
+
if (singleNode) {
|
|
138
|
+
singleNode.x = centerX;
|
|
139
|
+
singleNode.y = centerY;
|
|
140
|
+
}
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
// Sort nodes: entry points first, then by type, then by complexity
|
|
144
|
+
mod.nodes.sort((a, b) => {
|
|
145
|
+
const aEntry = modules
|
|
146
|
+
.find((m) => m.id === mod.id)
|
|
147
|
+
?.entryPoints.includes(a.id)
|
|
148
|
+
? -1
|
|
149
|
+
: 0;
|
|
150
|
+
const bEntry = modules
|
|
151
|
+
.find((m) => m.id === mod.id)
|
|
152
|
+
?.entryPoints.includes(b.id)
|
|
153
|
+
? -1
|
|
154
|
+
: 0;
|
|
155
|
+
if (aEntry !== bEntry)
|
|
156
|
+
return aEntry - bEntry;
|
|
157
|
+
return b.complexity - a.complexity;
|
|
158
|
+
});
|
|
159
|
+
// Spiral layout — most important nodes near center
|
|
160
|
+
const angleStep = (2 * Math.PI) / Math.max(mod.nodes.length, 1);
|
|
161
|
+
const maxR = Math.min(mod.width, mod.height) / 2 - 25;
|
|
162
|
+
for (let i = 0; i < mod.nodes.length; i++) {
|
|
163
|
+
const n = mod.nodes[i];
|
|
164
|
+
if (!n)
|
|
165
|
+
continue;
|
|
166
|
+
const angle = i * angleStep * 1.618; // golden angle for even distribution
|
|
167
|
+
const r = (maxR * Math.sqrt(i + 1)) / Math.sqrt(mod.nodes.length);
|
|
168
|
+
n.x = centerX + r * Math.cos(angle);
|
|
169
|
+
n.y = centerY + r * Math.sin(angle);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return nodeMap;
|
|
173
|
+
}
|
|
174
|
+
function drawNode(node) {
|
|
175
|
+
const { x, y, radius, color, name, type } = node;
|
|
176
|
+
let shape;
|
|
177
|
+
// Different shapes for different types — gives the LLM multiple visual signals
|
|
178
|
+
switch (type) {
|
|
179
|
+
case "api-route":
|
|
180
|
+
// Diamond for API routes
|
|
181
|
+
shape = `<polygon points="${x},${y - radius} ${x + radius},${y} ${x},${y + radius} ${x - radius},${y}" fill="${color}" stroke="#fff" stroke-width="1" opacity="0.85"/>`;
|
|
182
|
+
break;
|
|
183
|
+
case "route":
|
|
184
|
+
// Rounded rect for pages
|
|
185
|
+
shape = `<rect x="${x - radius}" y="${y - radius * 0.7}" width="${radius * 2}" height="${radius * 1.4}" rx="3" fill="${color}" stroke="#fff" stroke-width="1" opacity="0.85"/>`;
|
|
186
|
+
break;
|
|
187
|
+
case "schema":
|
|
188
|
+
// Hexagon for data schemas
|
|
189
|
+
const h = radius * 0.866;
|
|
190
|
+
shape = `<polygon points="${x - radius},${y} ${x - radius / 2},${y - h} ${x + radius / 2},${y - h} ${x + radius},${y} ${x + radius / 2},${y + h} ${x - radius / 2},${y + h}" fill="${color}" stroke="#fff" stroke-width="1" opacity="0.85"/>`;
|
|
191
|
+
break;
|
|
192
|
+
case "test":
|
|
193
|
+
// Triangle for tests
|
|
194
|
+
shape = `<polygon points="${x},${y - radius} ${x + radius},${y + radius * 0.7} ${x - radius},${y + radius * 0.7}" fill="${color}" stroke="#fff" stroke-width="1" opacity="0.6"/>`;
|
|
195
|
+
break;
|
|
196
|
+
default:
|
|
197
|
+
// Circle for everything else
|
|
198
|
+
shape = `<circle cx="${x}" cy="${y}" r="${radius}" fill="${color}" stroke="#fff" stroke-width="1" opacity="0.85"/>`;
|
|
199
|
+
}
|
|
200
|
+
// Label — only for larger nodes to avoid clutter
|
|
201
|
+
let label = "";
|
|
202
|
+
if (radius > 8) {
|
|
203
|
+
const shortName = name.replace(/\.(ts|tsx|js|jsx)$/, "").slice(0, 12);
|
|
204
|
+
label = `<text x="${x}" y="${y + radius + 10}" text-anchor="middle" class="node-label">${escapeXml(shortName)}</text>`;
|
|
205
|
+
}
|
|
206
|
+
return shape + "\n" + label + "\n";
|
|
207
|
+
}
|
|
208
|
+
function drawEdges(edges, nodeMap, _canvasWidth) {
|
|
209
|
+
let svg = '<g opacity="0.3">\n';
|
|
210
|
+
for (const edge of edges) {
|
|
211
|
+
const from = nodeMap.get(edge.from);
|
|
212
|
+
const to = nodeMap.get(edge.to);
|
|
213
|
+
if (!from || !to)
|
|
214
|
+
continue;
|
|
215
|
+
// Skip very short edges (same cluster, clutters the view)
|
|
216
|
+
const dx = to.x - from.x;
|
|
217
|
+
const dy = to.y - from.y;
|
|
218
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
219
|
+
if (dist < 20)
|
|
220
|
+
continue;
|
|
221
|
+
const strokeWidth = edge.type === "tests" ? 0.5 : Math.max(0.5, edge.weight * 2);
|
|
222
|
+
const color = edge.type === "tests" ? "#6C757D" : "#264653";
|
|
223
|
+
const dashArray = edge.type === "tests" ? "3,3" : "none";
|
|
224
|
+
svg += `<line x1="${from.x}" y1="${from.y}" x2="${to.x}" y2="${to.y}" stroke="${color}" stroke-width="${strokeWidth}" stroke-dasharray="${dashArray}"/>\n`;
|
|
225
|
+
}
|
|
226
|
+
svg += "</g>\n";
|
|
227
|
+
return svg;
|
|
228
|
+
}
|
|
229
|
+
function drawLegend(x, y) {
|
|
230
|
+
const items = [
|
|
231
|
+
{ label: "Page/Route", color: TYPE_COLORS.route, shape: "rect" },
|
|
232
|
+
{ label: "API Route", color: TYPE_COLORS["api-route"], shape: "diamond" },
|
|
233
|
+
{ label: "Component", color: TYPE_COLORS.component, shape: "circle" },
|
|
234
|
+
{ label: "Schema", color: TYPE_COLORS.schema, shape: "hexagon" },
|
|
235
|
+
{ label: "Utility", color: TYPE_COLORS.utility, shape: "circle" },
|
|
236
|
+
{ label: "Test", color: TYPE_COLORS.test, shape: "triangle" },
|
|
237
|
+
];
|
|
238
|
+
let svg = `<g transform="translate(${x},${y})">\n`;
|
|
239
|
+
svg += `<rect x="0" y="0" width="170" height="${items.length * 18 + 10}" rx="4" fill="white" stroke="#DEE2E6" stroke-width="1" opacity="0.9"/>\n`;
|
|
240
|
+
items.forEach((item, i) => {
|
|
241
|
+
const iy = 14 + i * 18;
|
|
242
|
+
switch (item.shape) {
|
|
243
|
+
case "diamond":
|
|
244
|
+
svg += `<polygon points="${12},${iy - 5} ${17},${iy} ${12},${iy + 5} ${7},${iy}" fill="${item.color}"/>`;
|
|
245
|
+
break;
|
|
246
|
+
case "rect":
|
|
247
|
+
svg += `<rect x="6" y="${iy - 5}" width="12" height="10" rx="2" fill="${item.color}"/>`;
|
|
248
|
+
break;
|
|
249
|
+
case "triangle":
|
|
250
|
+
svg += `<polygon points="${12},${iy - 5} ${17},${iy + 4} ${7},${iy + 4}" fill="${item.color}"/>`;
|
|
251
|
+
break;
|
|
252
|
+
case "hexagon":
|
|
253
|
+
svg += `<circle cx="12" cy="${iy}" r="5" fill="${item.color}"/>`;
|
|
254
|
+
break;
|
|
255
|
+
default:
|
|
256
|
+
svg += `<circle cx="12" cy="${iy}" r="5" fill="${item.color}"/>`;
|
|
257
|
+
}
|
|
258
|
+
svg += `<text x="24" y="${iy + 4}" class="legend-text">${item.label}</text>\n`;
|
|
259
|
+
});
|
|
260
|
+
svg += `</g>\n`;
|
|
261
|
+
return svg;
|
|
262
|
+
}
|
|
263
|
+
function escapeXml(str) {
|
|
264
|
+
return str
|
|
265
|
+
.replace(/&/g, "&")
|
|
266
|
+
.replace(/</g, "<")
|
|
267
|
+
.replace(/>/g, ">")
|
|
268
|
+
.replace(/"/g, """);
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=encode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encode.js","sourceRoot":"","sources":["../../src/encoder/encode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AASH,oEAAoE;AACpE,MAAM,WAAW,GAA2B;IAC1C,KAAK,EAAE,SAAS,EAAE,uCAAuC;IACzD,WAAW,EAAE,SAAS,EAAE,oCAAoC;IAC5D,SAAS,EAAE,SAAS,EAAE,0BAA0B;IAChD,MAAM,EAAE,SAAS,EAAE,uBAAuB;IAC1C,UAAU,EAAE,SAAS,EAAE,qBAAqB;IAC5C,MAAM,EAAE,SAAS,EAAE,qBAAqB;IACxC,IAAI,EAAE,SAAS,EAAE,eAAe;IAChC,MAAM,EAAE,SAAS,EAAE,sBAAsB;IACzC,OAAO,EAAE,SAAS,EAAE,wBAAwB;IAC5C,MAAM,EAAE,SAAS,EAAE,sCAAsC;CAC1D,CAAC;AAwBF,MAAM,UAAU,WAAW,CAAC,KAAkB;IAC5C,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,MAAM,cAAc,GAAG,EAAE,CAAC;IAC1B,MAAM,eAAe,GAAG,CAAC,CAAC;I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G,IAAI,QAAQ,CAAC;IAChB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,OAAO,GAAG;SACP,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layer 2 — Infrastructure (Data Flow & Routes)
|
|
3
|
+
*
|
|
4
|
+
* Encodes: Dependency paths, API routes, data flow directions.
|
|
5
|
+
* - Lines connecting modules = import dependencies (thicker = stronger coupling)
|
|
6
|
+
* - Arrows showing data flow direction (request → processing → response)
|
|
7
|
+
* - API entry points as labeled markers
|
|
8
|
+
* - Color-coded by flow type: auth (orange), payment (red), data (blue), rendering (green)
|
|
9
|
+
*
|
|
10
|
+
* What the LLM learns: How things connect. Which routes go through
|
|
11
|
+
* which terrain. Where the critical paths are.
|
|
12
|
+
*/
|
|
13
|
+
import type { StrandGraph } from "../scanner/index.js";
|
|
14
|
+
import { type CanvasLayout } from "./layout.js";
|
|
15
|
+
export declare function encodeInfrastructureSVG(graph: StrandGraph): string;
|
|
16
|
+
export declare function encodeInfrastructureSVGFromLayout(layout: CanvasLayout, graph: StrandGraph): string;
|
|
17
|
+
//# sourceMappingURL=layer-infrastructure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-infrastructure.d.ts","sourceRoot":"","sources":["../../src/encoder/layer-infrastructure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAGL,KAAK,YAAY,EAGlB,MAAM,aAAa,CAAC;AAoDrB,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAGlE;AAED,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,WAAW,GACjB,MAAM,CAER"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layer 2 — Infrastructure (Data Flow & Routes)
|
|
3
|
+
*
|
|
4
|
+
* Encodes: Dependency paths, API routes, data flow directions.
|
|
5
|
+
* - Lines connecting modules = import dependencies (thicker = stronger coupling)
|
|
6
|
+
* - Arrows showing data flow direction (request → processing → response)
|
|
7
|
+
* - API entry points as labeled markers
|
|
8
|
+
* - Color-coded by flow type: auth (orange), payment (red), data (blue), rendering (green)
|
|
9
|
+
*
|
|
10
|
+
* What the LLM learns: How things connect. Which routes go through
|
|
11
|
+
* which terrain. Where the critical paths are.
|
|
12
|
+
*/
|
|
13
|
+
import { computeLayout, escapeXml, } from "./layout.js";
|
|
14
|
+
const FLOW_TYPES = [
|
|
15
|
+
{
|
|
16
|
+
name: "auth",
|
|
17
|
+
color: "#F4A261", // warm orange
|
|
18
|
+
pathPatterns: [
|
|
19
|
+
/auth/,
|
|
20
|
+
/session/,
|
|
21
|
+
/login/,
|
|
22
|
+
/magic-link/,
|
|
23
|
+
/trusted-device/,
|
|
24
|
+
/verify/,
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "payment",
|
|
29
|
+
color: "#E63946", // red
|
|
30
|
+
pathPatterns: [/payment/, /authorize/, /order/, /cart/, /price/, /tip/],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "data",
|
|
34
|
+
color: "#457B9D", // blue
|
|
35
|
+
pathPatterns: [/prisma/, /schema/, /queries/, /api\//, /lib\//],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "rendering",
|
|
39
|
+
color: "#52B788", // green
|
|
40
|
+
pathPatterns: [/component/, /page/, /layout/, /\.tsx$/],
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
/** Classify an edge into a flow type based on the source and target paths */
|
|
44
|
+
function classifyFlow(fromPath, toPath) {
|
|
45
|
+
const combined = fromPath + " " + toPath;
|
|
46
|
+
for (const flow of FLOW_TYPES) {
|
|
47
|
+
if (flow.pathPatterns.some((p) => p.test(combined))) {
|
|
48
|
+
return flow;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Default: data flow
|
|
52
|
+
return FLOW_TYPES[2]; // blue/data
|
|
53
|
+
}
|
|
54
|
+
export function encodeInfrastructureSVG(graph) {
|
|
55
|
+
const layout = computeLayout(graph);
|
|
56
|
+
return renderInfrastructure(layout, graph);
|
|
57
|
+
}
|
|
58
|
+
export function encodeInfrastructureSVGFromLayout(layout, graph) {
|
|
59
|
+
return renderInfrastructure(layout, graph);
|
|
60
|
+
}
|
|
61
|
+
function renderInfrastructure(layout, graph) {
|
|
62
|
+
const { width, height, modules, nodes } = layout;
|
|
63
|
+
let svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}" width="${width}" height="${height}">
|
|
64
|
+
<defs>
|
|
65
|
+
<marker id="arrow-auth" viewBox="0 0 10 7" refX="10" refY="3.5" markerWidth="8" markerHeight="6" orient="auto-start-reverse">
|
|
66
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="${FLOW_TYPES[0].color}"/>
|
|
67
|
+
</marker>
|
|
68
|
+
<marker id="arrow-payment" viewBox="0 0 10 7" refX="10" refY="3.5" markerWidth="8" markerHeight="6" orient="auto-start-reverse">
|
|
69
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="${FLOW_TYPES[1].color}"/>
|
|
70
|
+
</marker>
|
|
71
|
+
<marker id="arrow-data" viewBox="0 0 10 7" refX="10" refY="3.5" markerWidth="8" markerHeight="6" orient="auto-start-reverse">
|
|
72
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="${FLOW_TYPES[2].color}"/>
|
|
73
|
+
</marker>
|
|
74
|
+
<marker id="arrow-rendering" viewBox="0 0 10 7" refX="10" refY="3.5" markerWidth="8" markerHeight="6" orient="auto-start-reverse">
|
|
75
|
+
<polygon points="0 0, 10 3.5, 0 7" fill="${FLOW_TYPES[3].color}"/>
|
|
76
|
+
</marker>
|
|
77
|
+
</defs>
|
|
78
|
+
<style>
|
|
79
|
+
text { font-family: monospace; }
|
|
80
|
+
.layer-title { font-size: 14px; font-weight: bold; fill: #111; }
|
|
81
|
+
.layer-subtitle { font-size: 10px; fill: #666; }
|
|
82
|
+
.module-label { font-size: 10px; fill: #999; font-weight: bold; }
|
|
83
|
+
.api-label { font-size: 8px; fill: #E63946; font-weight: bold; }
|
|
84
|
+
</style>
|
|
85
|
+
<rect width="100%" height="100%" fill="#F8F9FA"/>
|
|
86
|
+
`;
|
|
87
|
+
// Title
|
|
88
|
+
svg += `<text x="60" y="30" class="layer-title">L2: Infrastructure — ${escapeXml(graph.projectName)}</text>\n`;
|
|
89
|
+
svg += `<text x="60" y="45" class="layer-subtitle">Data flow · Dependency roads · Color = flow type</text>\n`;
|
|
90
|
+
// Faint module outlines for spatial reference
|
|
91
|
+
for (const mod of modules) {
|
|
92
|
+
svg += `<rect x="${mod.x}" y="${mod.y}" width="${mod.width}" height="${mod.height}" rx="8" fill="none" stroke="#DEE2E6" stroke-width="1" stroke-dasharray="4,4" opacity="0.5"/>\n`;
|
|
93
|
+
svg += `<text x="${mod.x + 8}" y="${mod.y + 16}" class="module-label">${escapeXml(mod.name)}</text>\n`;
|
|
94
|
+
}
|
|
95
|
+
// Draw edges as flow lines with arrows
|
|
96
|
+
svg += drawFlowEdges(graph.edges, nodes, modules);
|
|
97
|
+
// Draw API entry points as prominent markers
|
|
98
|
+
svg += drawApiMarkers(layout);
|
|
99
|
+
// Legend
|
|
100
|
+
svg += drawInfraLegend(width - 180, 10);
|
|
101
|
+
svg += `</svg>`;
|
|
102
|
+
return svg;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Draw dependency edges as colored, directed flow lines.
|
|
106
|
+
* Aggregates edges between modules for cleaner inter-module connections.
|
|
107
|
+
*/
|
|
108
|
+
function drawFlowEdges(edges, nodeMap, modules) {
|
|
109
|
+
let svg = "";
|
|
110
|
+
// Aggregate: count edges between each module pair for inter-module connections
|
|
111
|
+
const interModuleCounts = new Map();
|
|
112
|
+
// Draw intra-module edges faintly, collect inter-module stats
|
|
113
|
+
for (const edge of edges) {
|
|
114
|
+
if (edge.type === "tests")
|
|
115
|
+
continue; // skip test edges for clarity
|
|
116
|
+
const from = nodeMap.get(edge.from);
|
|
117
|
+
const to = nodeMap.get(edge.to);
|
|
118
|
+
if (!from || !to)
|
|
119
|
+
continue;
|
|
120
|
+
const dx = to.x - from.x;
|
|
121
|
+
const dy = to.y - from.y;
|
|
122
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
123
|
+
if (dist < 15)
|
|
124
|
+
continue; // skip very short edges
|
|
125
|
+
const flow = classifyFlow(from.path, to.path);
|
|
126
|
+
if (from.moduleId === to.moduleId) {
|
|
127
|
+
// Intra-module: thin, faint lines
|
|
128
|
+
svg += `<line x1="${from.x.toFixed(1)}" y1="${from.y.toFixed(1)}" x2="${to.x.toFixed(1)}" y2="${to.y.toFixed(1)}" stroke="${flow.color}" stroke-width="0.5" opacity="0.15"/>\n`;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
// Inter-module: aggregate for thicker "road" lines
|
|
132
|
+
const key = [from.moduleId, to.moduleId].sort().join("→");
|
|
133
|
+
if (!interModuleCounts.has(key)) {
|
|
134
|
+
interModuleCounts.set(key, { count: 0, flows: new Map() });
|
|
135
|
+
}
|
|
136
|
+
const agg = interModuleCounts.get(key);
|
|
137
|
+
agg.count++;
|
|
138
|
+
agg.flows.set(flow.name, (agg.flows.get(flow.name) ?? 0) + 1);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// Draw inter-module "roads" — thickness based on coupling strength
|
|
142
|
+
const moduleCenters = new Map();
|
|
143
|
+
for (const mod of modules) {
|
|
144
|
+
moduleCenters.set(mod.id, {
|
|
145
|
+
x: mod.x + mod.width / 2,
|
|
146
|
+
y: mod.y + mod.height / 2,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
for (const [key, agg] of interModuleCounts) {
|
|
150
|
+
const [modA, modB] = key.split("→");
|
|
151
|
+
const centerA = moduleCenters.get(modA);
|
|
152
|
+
const centerB = moduleCenters.get(modB);
|
|
153
|
+
if (!centerA || !centerB)
|
|
154
|
+
continue;
|
|
155
|
+
// Determine dominant flow type
|
|
156
|
+
let dominantFlow = "data";
|
|
157
|
+
let maxCount = 0;
|
|
158
|
+
for (const [flowName, count] of agg.flows) {
|
|
159
|
+
if (count > maxCount) {
|
|
160
|
+
dominantFlow = flowName;
|
|
161
|
+
maxCount = count;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const flowType = FLOW_TYPES.find((f) => f.name === dominantFlow) ?? FLOW_TYPES[2];
|
|
165
|
+
// Thickness based on coupling count (1-5px)
|
|
166
|
+
const thickness = Math.min(1 + agg.count * 0.5, 5);
|
|
167
|
+
const opacity = Math.min(0.3 + agg.count * 0.05, 0.7);
|
|
168
|
+
const markerId = `arrow-${flowType.name}`;
|
|
169
|
+
// Curved path for visual appeal
|
|
170
|
+
const midX = (centerA.x + centerB.x) / 2;
|
|
171
|
+
const midY = (centerA.y + centerB.y) / 2;
|
|
172
|
+
const dx = centerB.x - centerA.x;
|
|
173
|
+
const dy = centerB.y - centerA.y;
|
|
174
|
+
const curvature = 15; // subtle curve
|
|
175
|
+
const ctrlX = midX - (dy / Math.sqrt(dx * dx + dy * dy)) * curvature;
|
|
176
|
+
const ctrlY = midY + (dx / Math.sqrt(dx * dx + dy * dy)) * curvature;
|
|
177
|
+
svg += `<path d="M${centerA.x.toFixed(1)},${centerA.y.toFixed(1)} Q${ctrlX.toFixed(1)},${ctrlY.toFixed(1)} ${centerB.x.toFixed(1)},${centerB.y.toFixed(1)}" fill="none" stroke="${flowType.color}" stroke-width="${thickness.toFixed(1)}" opacity="${opacity.toFixed(2)}" marker-end="url(#${markerId})"/>\n`;
|
|
178
|
+
// Edge label: coupling count
|
|
179
|
+
if (agg.count >= 3) {
|
|
180
|
+
svg += `<text x="${midX.toFixed(1)}" y="${(midY - 5).toFixed(1)}" text-anchor="middle" font-family="monospace" font-size="7" fill="${flowType.color}" opacity="0.7">${agg.count}</text>\n`;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return svg;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Draw API route entry points as prominent diamond markers with route labels.
|
|
187
|
+
* These are the "on-ramps" to the system.
|
|
188
|
+
*/
|
|
189
|
+
function drawApiMarkers(layout) {
|
|
190
|
+
let svg = "";
|
|
191
|
+
for (const node of layout.allNodes) {
|
|
192
|
+
if (node.type !== "api-route")
|
|
193
|
+
continue;
|
|
194
|
+
const r = 6;
|
|
195
|
+
// Diamond marker
|
|
196
|
+
svg += `<polygon points="${node.x},${node.y - r} ${node.x + r},${node.y} ${node.x},${node.y + r} ${node.x - r},${node.y}" fill="#E63946" stroke="#fff" stroke-width="1" opacity="0.9"/>\n`;
|
|
197
|
+
// Route label
|
|
198
|
+
const routePath = node.framework?.metadata?.routePath ??
|
|
199
|
+
node.name;
|
|
200
|
+
const methods = node.framework?.metadata?.methods?.join(",") ?? "";
|
|
201
|
+
const label = methods ? `${methods} ${routePath}` : routePath;
|
|
202
|
+
svg += `<text x="${node.x}" y="${node.y - r - 3}" text-anchor="middle" class="api-label">${escapeXml(label)}</text>\n`;
|
|
203
|
+
}
|
|
204
|
+
// Also mark page entry points (but smaller, less prominent)
|
|
205
|
+
for (const node of layout.allNodes) {
|
|
206
|
+
if (node.type !== "route")
|
|
207
|
+
continue;
|
|
208
|
+
const r = 4;
|
|
209
|
+
svg += `<rect x="${node.x - r}" y="${node.y - r * 0.7}" width="${r * 2}" height="${r * 1.4}" rx="2" fill="#FF6B35" stroke="#fff" stroke-width="0.5" opacity="0.6"/>\n`;
|
|
210
|
+
}
|
|
211
|
+
return svg;
|
|
212
|
+
}
|
|
213
|
+
function drawInfraLegend(x, y) {
|
|
214
|
+
let svg = `<g transform="translate(${x},${y})">\n`;
|
|
215
|
+
svg += `<rect x="0" y="0" width="170" height="110" rx="4" fill="white" stroke="#DEE2E6" stroke-width="1" opacity="0.9"/>\n`;
|
|
216
|
+
svg += `<text x="8" y="14" font-family="monospace" font-size="9" font-weight="bold" fill="#333">Flow Types</text>\n`;
|
|
217
|
+
const items = [
|
|
218
|
+
{ label: "Auth flow", color: FLOW_TYPES[0].color },
|
|
219
|
+
{ label: "Payment flow", color: FLOW_TYPES[1].color },
|
|
220
|
+
{ label: "Data flow", color: FLOW_TYPES[2].color },
|
|
221
|
+
{ label: "Rendering flow", color: FLOW_TYPES[3].color },
|
|
222
|
+
];
|
|
223
|
+
items.forEach((item, i) => {
|
|
224
|
+
const iy = 30 + i * 16;
|
|
225
|
+
svg += `<line x1="8" y1="${iy}" x2="28" y2="${iy}" stroke="${item.color}" stroke-width="2.5"/>\n`;
|
|
226
|
+
svg += `<text x="34" y="${iy + 3}" font-family="monospace" font-size="8" fill="#555">${item.label}</text>\n`;
|
|
227
|
+
});
|
|
228
|
+
svg += `<text x="8" y="100" font-family="monospace" font-size="7" fill="#888">Thickness = coupling strength</text>\n`;
|
|
229
|
+
svg += `</g>\n`;
|
|
230
|
+
return svg;
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=layer-infrastructure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-infrastructure.js","sourceRoot":"","sources":["../../src/encoder/layer-infrastructure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EACL,aAAa,EACb,SAAS,GAIV,MAAM,aAAa,CAAC;AAUrB,MAAM,UAAU,GAAe;IAC7B;QACE,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,SAAS,EAAE,cAAc;QAChC,YAAY,EAAE;YACZ,MAAM;YACN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, function signatures, HTTP methods, model names.
|
|
5
|
+
* - Each node labeled with file name and key exports
|
|
6
|
+
* - API routes with HTTP methods (GET, POST, etc.)
|
|
7
|
+
* - Prisma models with field counts
|
|
8
|
+
* - Test coverage indicators
|
|
9
|
+
* - High-resolution, text-focused, minimal visual noise
|
|
10
|
+
*
|
|
11
|
+
* What the LLM learns: The precise details that Layer 1 and 2 can't show.
|
|
12
|
+
* File paths, function names, exact counts.
|
|
13
|
+
*/
|
|
14
|
+
import type { StrandGraph } from "../scanner/index.js";
|
|
15
|
+
import { type CanvasLayout } from "./layout.js";
|
|
16
|
+
export declare function encodeLabelsSVG(graph: StrandGraph): string;
|
|
17
|
+
export declare function encodeLabelsSVGFromLayout(layout: CanvasLayout, graph: StrandGraph): string;
|
|
18
|
+
//# sourceMappingURL=layer-labels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-labels.d.ts","sourceRoot":"","sources":["../../src/encoder/layer-labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAIL,KAAK,YAAY,EAGlB,MAAM,aAAa,CAAC;AAErB,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAG1D;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,WAAW,GACjB,MAAM,CAER"}
|