flowspec-mcp 4.0.0 → 4.2.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/README.md +1 -10
- package/dist/db.js +398 -231
- package/dist/db.js.map +1 -1
- package/dist/index.js +0 -0
- package/dist/server.js +4 -6
- package/dist/server.js.map +1 -1
- package/dist/tools/createEdge.d.ts +4 -4
- package/dist/tools/createNode.d.ts +2 -2
- package/dist/tools/updateEdge.d.ts +2 -2
- package/dist/tools/updateNode.d.ts +2 -2
- package/dist/tools/updateProject.d.ts +2 -2
- package/package.json +2 -2
- package/dist/analysis/analysisUtils.d.ts +0 -36
- package/dist/analysis/analysisUtils.js +0 -284
- package/dist/analysis/analysisUtils.js.map +0 -1
- package/dist/export/jsonExporter.d.ts +0 -7
- package/dist/export/jsonExporter.js +0 -152
- package/dist/export/jsonExporter.js.map +0 -1
- package/dist/layout/semanticLayout.d.ts +0 -24
- package/dist/layout/semanticLayout.js +0 -233
- package/dist/layout/semanticLayout.js.map +0 -1
- package/dist/tools/captureScreen.d.ts +0 -48
- package/dist/tools/captureScreen.js +0 -135
- package/dist/tools/captureScreen.js.map +0 -1
- package/dist/tools/generateSpec.d.ts +0 -26
- package/dist/tools/generateSpec.js +0 -336
- package/dist/tools/generateSpec.js.map +0 -1
- package/dist/tools/getJson.d.ts +0 -21
- package/dist/tools/getJson.js +0 -23
- package/dist/tools/getJson.js.map +0 -1
- package/dist/tools/healthCheck.d.ts +0 -8
- package/dist/tools/healthCheck.js +0 -16
- package/dist/tools/healthCheck.js.map +0 -1
- package/dist/tools/ingestCodebase.d.ts +0 -27
- package/dist/tools/ingestCodebase.js +0 -516
- package/dist/tools/ingestCodebase.js.map +0 -1
- package/dist/tools/smartLayout.d.ts +0 -30
- package/dist/tools/smartLayout.js +0 -74
- package/dist/tools/smartLayout.js.map +0 -1
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Exports canvas state to JSON specification optimised for Claude Code.
|
|
3
|
-
* v4.0.0+ - JSON format for faster parsing and smaller file sizes.
|
|
4
|
-
* Adapted from web app — uses plain interfaces instead of @xyflow/svelte types.
|
|
5
|
-
*/
|
|
6
|
-
export function exportToJson(nodes, edges, projectName = 'Untitled Project', screens = []) {
|
|
7
|
-
const exportableNodes = nodes.filter((n) => n.type !== 'image' && n.type !== 'screen');
|
|
8
|
-
const dataPointNodes = exportableNodes.filter((n) => n.type === 'datapoint');
|
|
9
|
-
const componentNodes = exportableNodes.filter((n) => n.type === 'component');
|
|
10
|
-
const transformNodes = exportableNodes.filter((n) => n.type === 'transform');
|
|
11
|
-
const tableNodes = exportableNodes.filter((n) => n.type === 'table');
|
|
12
|
-
const locationMap = buildLocationMap(dataPointNodes, componentNodes, edges);
|
|
13
|
-
// Build node label lookup for screen region export
|
|
14
|
-
const nodeLabelMap = new Map();
|
|
15
|
-
for (const n of exportableNodes) {
|
|
16
|
-
const label = n.data.label ?? 'Untitled';
|
|
17
|
-
nodeLabelMap.set(n.id, { label, type: n.type ?? 'unknown' });
|
|
18
|
-
}
|
|
19
|
-
const spec = {
|
|
20
|
-
version: '1.2.0',
|
|
21
|
-
metadata: {
|
|
22
|
-
projectName,
|
|
23
|
-
exportedAt: new Date().toISOString(),
|
|
24
|
-
nodeCount: exportableNodes.length,
|
|
25
|
-
edgeCount: edges.length,
|
|
26
|
-
},
|
|
27
|
-
dataPoints: dataPointNodes.map((node) => {
|
|
28
|
-
const data = node.data;
|
|
29
|
-
return {
|
|
30
|
-
id: node.id,
|
|
31
|
-
label: data.label,
|
|
32
|
-
type: data.type,
|
|
33
|
-
source: data.source,
|
|
34
|
-
sourceDefinition: data.sourceDefinition,
|
|
35
|
-
constraints: data.constraints,
|
|
36
|
-
locations: locationMap.get(node.id) ?? [],
|
|
37
|
-
};
|
|
38
|
-
}),
|
|
39
|
-
components: componentNodes.map((node) => {
|
|
40
|
-
const data = node.data;
|
|
41
|
-
const result = {
|
|
42
|
-
id: node.id,
|
|
43
|
-
label: data.label,
|
|
44
|
-
displays: data.displays,
|
|
45
|
-
captures: data.captures,
|
|
46
|
-
};
|
|
47
|
-
if (data.wireframeRef) {
|
|
48
|
-
result.wireframeRef = data.wireframeRef;
|
|
49
|
-
}
|
|
50
|
-
return result;
|
|
51
|
-
}),
|
|
52
|
-
transforms: transformNodes.map((node) => {
|
|
53
|
-
const data = node.data;
|
|
54
|
-
return {
|
|
55
|
-
id: node.id,
|
|
56
|
-
type: data.type,
|
|
57
|
-
description: data.description,
|
|
58
|
-
inputs: data.inputs,
|
|
59
|
-
outputs: data.outputs,
|
|
60
|
-
logic: data.logic,
|
|
61
|
-
};
|
|
62
|
-
}),
|
|
63
|
-
dataFlow: edges.filter((e) => {
|
|
64
|
-
return e.data?.edgeType !== 'contains';
|
|
65
|
-
}).map((edge) => {
|
|
66
|
-
const result = {
|
|
67
|
-
from: edge.source,
|
|
68
|
-
to: edge.target,
|
|
69
|
-
edgeType: edge.data?.edgeType ?? 'flows-to',
|
|
70
|
-
};
|
|
71
|
-
if (edge.data?.label) {
|
|
72
|
-
result.label = edge.data.label;
|
|
73
|
-
}
|
|
74
|
-
return result;
|
|
75
|
-
}),
|
|
76
|
-
};
|
|
77
|
-
// Add tables section if table nodes exist
|
|
78
|
-
if (tableNodes.length > 0) {
|
|
79
|
-
spec.tables = tableNodes.map((node) => {
|
|
80
|
-
const data = node.data;
|
|
81
|
-
const result = {
|
|
82
|
-
id: node.id,
|
|
83
|
-
label: data.label,
|
|
84
|
-
sourceType: data.sourceType,
|
|
85
|
-
columns: (data.columns ?? []).map((c) => ({ name: c.name, type: c.type })),
|
|
86
|
-
};
|
|
87
|
-
if (data.endpoint) {
|
|
88
|
-
result.endpoint = data.endpoint;
|
|
89
|
-
}
|
|
90
|
-
return result;
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
// Add screens section if screens exist
|
|
94
|
-
if (screens.length > 0) {
|
|
95
|
-
spec.screens = screens.map((sc) => ({
|
|
96
|
-
id: sc.id,
|
|
97
|
-
name: sc.name,
|
|
98
|
-
imageFilename: sc.imageFilename,
|
|
99
|
-
regions: sc.regions.map((r) => {
|
|
100
|
-
const region = {
|
|
101
|
-
id: r.id,
|
|
102
|
-
label: r.label,
|
|
103
|
-
position: {
|
|
104
|
-
x: Math.round(r.position.x * 10) / 10,
|
|
105
|
-
y: Math.round(r.position.y * 10) / 10,
|
|
106
|
-
},
|
|
107
|
-
size: {
|
|
108
|
-
width: Math.round(r.size.width * 10) / 10,
|
|
109
|
-
height: Math.round(r.size.height * 10) / 10,
|
|
110
|
-
},
|
|
111
|
-
elements: r.elementIds.map((eid) => {
|
|
112
|
-
const info = nodeLabelMap.get(eid);
|
|
113
|
-
return {
|
|
114
|
-
nodeId: eid,
|
|
115
|
-
nodeLabel: info?.label ?? 'Missing element',
|
|
116
|
-
nodeType: info?.type ?? 'unknown',
|
|
117
|
-
};
|
|
118
|
-
}),
|
|
119
|
-
};
|
|
120
|
-
if (r.componentNodeId) {
|
|
121
|
-
region.componentNodeId = r.componentNodeId;
|
|
122
|
-
}
|
|
123
|
-
return region;
|
|
124
|
-
}),
|
|
125
|
-
}));
|
|
126
|
-
}
|
|
127
|
-
return JSON.stringify(spec, null, 2);
|
|
128
|
-
}
|
|
129
|
-
function buildLocationMap(dataPoints, components, edges) {
|
|
130
|
-
const map = new Map();
|
|
131
|
-
for (const dp of dataPoints) {
|
|
132
|
-
map.set(dp.id, []);
|
|
133
|
-
}
|
|
134
|
-
for (const edge of edges) {
|
|
135
|
-
const sourceIsDataPoint = dataPoints.some((n) => n.id === edge.source);
|
|
136
|
-
const targetIsComponent = components.some((n) => n.id === edge.target);
|
|
137
|
-
if (sourceIsDataPoint && targetIsComponent) {
|
|
138
|
-
const locations = map.get(edge.source) ?? [];
|
|
139
|
-
locations.push({ component: edge.target, role: 'output' });
|
|
140
|
-
map.set(edge.source, locations);
|
|
141
|
-
}
|
|
142
|
-
const sourceIsComponent = components.some((n) => n.id === edge.source);
|
|
143
|
-
const targetIsDataPoint = dataPoints.some((n) => n.id === edge.target);
|
|
144
|
-
if (sourceIsComponent && targetIsDataPoint) {
|
|
145
|
-
const locations = map.get(edge.target) ?? [];
|
|
146
|
-
locations.push({ component: edge.source, role: 'input' });
|
|
147
|
-
map.set(edge.target, locations);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return map;
|
|
151
|
-
}
|
|
152
|
-
//# sourceMappingURL=jsonExporter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonExporter.js","sourceRoot":"","sources":["../../src/export/jsonExporter.ts"],"names":[],"mappings":"AA+FA;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAmB,EACnB,KAAmB,EACnB,cAAsB,kBAAkB,EACxC,UAAoB,EAAE;IAEtB,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;IAEvF,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;IAC7E,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;IAC7E,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;IAC7E,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;IAErE,MAAM,WAAW,GAAG,gBAAgB,CAAC,cAAc,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;IAE5E,mD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b,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { CanvasNode, CanvasEdge } from '../types.js';
|
|
2
|
-
export interface LayoutCommand {
|
|
3
|
-
nodeIds: string[];
|
|
4
|
-
targetBounds: {
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
};
|
|
10
|
-
arrangement: 'stack' | 'grid' | 'flow' | 'cluster';
|
|
11
|
-
direction?: 'vertical' | 'horizontal';
|
|
12
|
-
}
|
|
13
|
-
export declare function parseNaturalLanguageLayout(command: string, nodes: CanvasNode[], canvasBounds: {
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
16
|
-
}): LayoutCommand | {
|
|
17
|
-
error: string;
|
|
18
|
-
};
|
|
19
|
-
export declare function applySemanticLayout(nodes: CanvasNode[], edges: CanvasEdge[], command: LayoutCommand): Map<string, {
|
|
20
|
-
x: number;
|
|
21
|
-
y: number;
|
|
22
|
-
}>;
|
|
23
|
-
export declare const SUPPORTED_COMMANDS: string[];
|
|
24
|
-
export declare const SUPPORTED_REGIONS: string[];
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import nlp from 'compromise';
|
|
2
|
-
// ─── Layout Regions (9-grid system for infinite canvas) ─────────
|
|
3
|
-
const LAYOUT_REGIONS = {
|
|
4
|
-
'top-left': { x: 0.05, y: 0.05 },
|
|
5
|
-
'top-center': { x: 0.4, y: 0.05 },
|
|
6
|
-
'top-right': { x: 0.7, y: 0.05 },
|
|
7
|
-
'center-left': { x: 0.05, y: 0.4 },
|
|
8
|
-
'center': { x: 0.4, y: 0.4 },
|
|
9
|
-
'center-right': { x: 0.7, y: 0.4 },
|
|
10
|
-
'bottom-left': { x: 0.05, y: 0.7 },
|
|
11
|
-
'bottom-center': { x: 0.4, y: 0.7 },
|
|
12
|
-
'bottom-right': { x: 0.7, y: 0.7 }
|
|
13
|
-
};
|
|
14
|
-
// Aliases for natural language
|
|
15
|
-
const REGION_ALIASES = {
|
|
16
|
-
'top': 'top-center',
|
|
17
|
-
'bottom': 'bottom-center',
|
|
18
|
-
'left': 'center-left',
|
|
19
|
-
'right': 'center-right',
|
|
20
|
-
'upper-left': 'top-left',
|
|
21
|
-
'upper-right': 'top-right',
|
|
22
|
-
'lower-left': 'bottom-left',
|
|
23
|
-
'lower-right': 'bottom-right',
|
|
24
|
-
'middle': 'center'
|
|
25
|
-
};
|
|
26
|
-
// ─── Natural Language Parsing ────────────────────────────────────
|
|
27
|
-
export function parseNaturalLanguageLayout(command, nodes, canvasBounds) {
|
|
28
|
-
const doc = nlp(command.toLowerCase());
|
|
29
|
-
// Extract action verb (move, arrange, cluster, position)
|
|
30
|
-
const verbs = doc.verbs().out('array');
|
|
31
|
-
const action = verbs[0] ?? 'move';
|
|
32
|
-
// Extract target nodes (by label matching)
|
|
33
|
-
const nodeMatches = extractNodeReferences(command, nodes);
|
|
34
|
-
if (nodeMatches.length === 0) {
|
|
35
|
-
return {
|
|
36
|
-
error: `No matching nodes found. Command: "${command}". Try specifying node labels explicitly (e.g., "move user auth nodes to top-right").`
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
// Extract target region
|
|
40
|
-
const region = extractTargetRegion(command);
|
|
41
|
-
if (!region) {
|
|
42
|
-
return {
|
|
43
|
-
error: `No target region found. Supported regions: ${Object.keys(LAYOUT_REGIONS).join(', ')}. Command: "${command}".`
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
// Extract arrangement style (vertical, horizontal, grid, cluster)
|
|
47
|
-
const arrangement = extractArrangement(command);
|
|
48
|
-
const direction = extractDirection(command);
|
|
49
|
-
// Convert region to absolute coordinates
|
|
50
|
-
const relativePos = LAYOUT_REGIONS[region];
|
|
51
|
-
const targetBounds = {
|
|
52
|
-
x: relativePos.x * canvasBounds.width,
|
|
53
|
-
y: relativePos.y * canvasBounds.height,
|
|
54
|
-
width: canvasBounds.width * 0.25, // 25% of canvas for layout region
|
|
55
|
-
height: canvasBounds.height * 0.25
|
|
56
|
-
};
|
|
57
|
-
return {
|
|
58
|
-
nodeIds: nodeMatches,
|
|
59
|
-
targetBounds,
|
|
60
|
-
arrangement,
|
|
61
|
-
direction
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function extractNodeReferences(command, nodes) {
|
|
65
|
-
const matches = [];
|
|
66
|
-
// Extract potential node label keywords (nouns, adjectives)
|
|
67
|
-
const doc = nlp(command);
|
|
68
|
-
const keywords = [
|
|
69
|
-
...doc.nouns().out('array'),
|
|
70
|
-
...doc.adjectives().out('array')
|
|
71
|
-
];
|
|
72
|
-
// Match keywords against node labels (fuzzy matching)
|
|
73
|
-
for (const node of nodes) {
|
|
74
|
-
const label = (node.data?.label ?? '').toLowerCase();
|
|
75
|
-
if (!label)
|
|
76
|
-
continue;
|
|
77
|
-
// Check if any keyword appears in label
|
|
78
|
-
for (const keyword of keywords) {
|
|
79
|
-
if (label.includes(keyword) || keyword.includes(label)) {
|
|
80
|
-
matches.push(node.id);
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return [...new Set(matches)]; // Deduplicate
|
|
86
|
-
}
|
|
87
|
-
function extractTargetRegion(command) {
|
|
88
|
-
const lowerCommand = command.toLowerCase();
|
|
89
|
-
// Check for explicit region names
|
|
90
|
-
for (const [alias, canonical] of Object.entries(REGION_ALIASES)) {
|
|
91
|
-
if (lowerCommand.includes(alias)) {
|
|
92
|
-
return canonical;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
for (const region of Object.keys(LAYOUT_REGIONS)) {
|
|
96
|
-
if (lowerCommand.includes(region)) {
|
|
97
|
-
return region;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
// Pattern matching: "to the <direction>"
|
|
101
|
-
if (lowerCommand.includes('to the top'))
|
|
102
|
-
return 'top-center';
|
|
103
|
-
if (lowerCommand.includes('to the bottom'))
|
|
104
|
-
return 'bottom-center';
|
|
105
|
-
if (lowerCommand.includes('to the left'))
|
|
106
|
-
return 'center-left';
|
|
107
|
-
if (lowerCommand.includes('to the right'))
|
|
108
|
-
return 'center-right';
|
|
109
|
-
// Pattern matching: "in the <region>"
|
|
110
|
-
if (lowerCommand.includes('in the top left'))
|
|
111
|
-
return 'top-left';
|
|
112
|
-
if (lowerCommand.includes('in the top right'))
|
|
113
|
-
return 'top-right';
|
|
114
|
-
if (lowerCommand.includes('in the bottom left'))
|
|
115
|
-
return 'bottom-left';
|
|
116
|
-
if (lowerCommand.includes('in the bottom right'))
|
|
117
|
-
return 'bottom-right';
|
|
118
|
-
if (lowerCommand.includes('in the center'))
|
|
119
|
-
return 'center';
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
function extractArrangement(command) {
|
|
123
|
-
const lowerCommand = command.toLowerCase();
|
|
124
|
-
if (lowerCommand.includes('stack') || lowerCommand.includes('column') || lowerCommand.includes('row')) {
|
|
125
|
-
return 'stack';
|
|
126
|
-
}
|
|
127
|
-
if (lowerCommand.includes('grid')) {
|
|
128
|
-
return 'grid';
|
|
129
|
-
}
|
|
130
|
-
if (lowerCommand.includes('flow')) {
|
|
131
|
-
return 'flow';
|
|
132
|
-
}
|
|
133
|
-
if (lowerCommand.includes('cluster') || lowerCommand.includes('group')) {
|
|
134
|
-
return 'cluster';
|
|
135
|
-
}
|
|
136
|
-
// Default: stack for small groups, grid for larger
|
|
137
|
-
return 'stack';
|
|
138
|
-
}
|
|
139
|
-
function extractDirection(command) {
|
|
140
|
-
const lowerCommand = command.toLowerCase();
|
|
141
|
-
if (lowerCommand.includes('vertical') || lowerCommand.includes('vertically') || lowerCommand.includes('column')) {
|
|
142
|
-
return 'vertical';
|
|
143
|
-
}
|
|
144
|
-
if (lowerCommand.includes('horizontal') || lowerCommand.includes('horizontally') || lowerCommand.includes('row')) {
|
|
145
|
-
return 'horizontal';
|
|
146
|
-
}
|
|
147
|
-
return undefined; // Let arrangement logic decide
|
|
148
|
-
}
|
|
149
|
-
// ─── Apply Semantic Layout ───────────────────────────────────────
|
|
150
|
-
export function applySemanticLayout(nodes, edges, command) {
|
|
151
|
-
const positions = new Map();
|
|
152
|
-
const targetNodes = nodes.filter((n) => command.nodeIds.includes(n.id));
|
|
153
|
-
if (targetNodes.length === 0)
|
|
154
|
-
return positions;
|
|
155
|
-
const { targetBounds, arrangement, direction } = command;
|
|
156
|
-
switch (arrangement) {
|
|
157
|
-
case 'stack': {
|
|
158
|
-
// Stack vertically or horizontally
|
|
159
|
-
const isVertical = direction === 'vertical' || direction === undefined;
|
|
160
|
-
const spacing = 60;
|
|
161
|
-
targetNodes.forEach((node, index) => {
|
|
162
|
-
if (isVertical) {
|
|
163
|
-
positions.set(node.id, {
|
|
164
|
-
x: targetBounds.x,
|
|
165
|
-
y: targetBounds.y + index * spacing
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
positions.set(node.id, {
|
|
170
|
-
x: targetBounds.x + index * spacing,
|
|
171
|
-
y: targetBounds.y
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
break;
|
|
176
|
-
}
|
|
177
|
-
case 'grid': {
|
|
178
|
-
// Arrange in a grid (3 columns max)
|
|
179
|
-
const cols = Math.min(3, Math.ceil(Math.sqrt(targetNodes.length)));
|
|
180
|
-
const spacing = 80;
|
|
181
|
-
targetNodes.forEach((node, index) => {
|
|
182
|
-
const col = index % cols;
|
|
183
|
-
const row = Math.floor(index / cols);
|
|
184
|
-
positions.set(node.id, {
|
|
185
|
-
x: targetBounds.x + col * spacing,
|
|
186
|
-
y: targetBounds.y + row * spacing
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
break;
|
|
190
|
-
}
|
|
191
|
-
case 'flow': {
|
|
192
|
-
// Flow layout (left-to-right, wrapping)
|
|
193
|
-
const maxWidth = targetBounds.width;
|
|
194
|
-
const spacing = 70;
|
|
195
|
-
let currentX = targetBounds.x;
|
|
196
|
-
let currentY = targetBounds.y;
|
|
197
|
-
for (const node of targetNodes) {
|
|
198
|
-
positions.set(node.id, { x: currentX, y: currentY });
|
|
199
|
-
currentX += spacing;
|
|
200
|
-
if (currentX - targetBounds.x > maxWidth) {
|
|
201
|
-
currentX = targetBounds.x;
|
|
202
|
-
currentY += spacing;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
case 'cluster': {
|
|
208
|
-
// Cluster in a compact circle/ellipse
|
|
209
|
-
const centerX = targetBounds.x + targetBounds.width / 2;
|
|
210
|
-
const centerY = targetBounds.y + targetBounds.height / 2;
|
|
211
|
-
const radius = Math.min(targetBounds.width, targetBounds.height) / 3;
|
|
212
|
-
targetNodes.forEach((node, index) => {
|
|
213
|
-
const angle = (index / targetNodes.length) * 2 * Math.PI;
|
|
214
|
-
positions.set(node.id, {
|
|
215
|
-
x: centerX + radius * Math.cos(angle),
|
|
216
|
-
y: centerY + radius * Math.sin(angle)
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
break;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return positions;
|
|
223
|
-
}
|
|
224
|
-
// ─── Supported Commands (for tool description) ───────────────────
|
|
225
|
-
export const SUPPORTED_COMMANDS = [
|
|
226
|
-
'move <nodes> to <region>',
|
|
227
|
-
'arrange <nodes> vertically/horizontally in <region>',
|
|
228
|
-
'cluster <nodes> in <region>',
|
|
229
|
-
'position <nodes> at <region>',
|
|
230
|
-
'stack <nodes> in <region>'
|
|
231
|
-
];
|
|
232
|
-
export const SUPPORTED_REGIONS = Object.keys(LAYOUT_REGIONS);
|
|
233
|
-
//# sourceMappingURL=semanticLayout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"semanticLayout.js","sourceRoot":"","sources":["../../src/layout/semanticLayout.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,YAAY,CAAC;AAY7B,mEAAmE;AAEnE,MAAM,cAA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M,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;oBACrC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;iBACrC,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;YACH,MAAM;QACP,CAAC;IACF,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,oEAAoE;AAEpE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,0BAA0B;IAC1B,qDAAqD;IACrD,6BAA6B;IAC7B,8BAA8B;IAC9B,2BAA2B;CAC3B,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const captureScreenSchema: z.ZodObject<{
|
|
3
|
-
url: z.ZodString;
|
|
4
|
-
selector: z.ZodOptional<z.ZodString>;
|
|
5
|
-
viewport: z.ZodOptional<z.ZodObject<{
|
|
6
|
-
width: z.ZodNumber;
|
|
7
|
-
height: z.ZodNumber;
|
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
}, {
|
|
12
|
-
width: number;
|
|
13
|
-
height: number;
|
|
14
|
-
}>>;
|
|
15
|
-
waitFor: z.ZodOptional<z.ZodString>;
|
|
16
|
-
fullPage: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
17
|
-
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
url: string;
|
|
19
|
-
fullPage: boolean;
|
|
20
|
-
selector?: string | undefined;
|
|
21
|
-
viewport?: {
|
|
22
|
-
width: number;
|
|
23
|
-
height: number;
|
|
24
|
-
} | undefined;
|
|
25
|
-
waitFor?: string | undefined;
|
|
26
|
-
}, {
|
|
27
|
-
url: string;
|
|
28
|
-
selector?: string | undefined;
|
|
29
|
-
viewport?: {
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
} | undefined;
|
|
33
|
-
waitFor?: string | undefined;
|
|
34
|
-
fullPage?: boolean | undefined;
|
|
35
|
-
}>;
|
|
36
|
-
export declare function handleCaptureScreen(args: z.infer<typeof captureScreenSchema>): Promise<{
|
|
37
|
-
content: {
|
|
38
|
-
type: "text";
|
|
39
|
-
text: string;
|
|
40
|
-
}[];
|
|
41
|
-
isError: boolean;
|
|
42
|
-
} | {
|
|
43
|
-
content: {
|
|
44
|
-
type: "text";
|
|
45
|
-
text: string;
|
|
46
|
-
}[];
|
|
47
|
-
isError?: undefined;
|
|
48
|
-
}>;
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { uploadImageViaApi } from '../db.js';
|
|
3
|
-
import { detectImageDimensions } from '../image/dimensions.js';
|
|
4
|
-
export const captureScreenSchema = z.object({
|
|
5
|
-
url: z.string().describe('URL to screenshot (http:// or https://)'),
|
|
6
|
-
selector: z.string().optional().describe('CSS selector for specific element (full page if omitted)'),
|
|
7
|
-
viewport: z
|
|
8
|
-
.object({
|
|
9
|
-
width: z.number(),
|
|
10
|
-
height: z.number()
|
|
11
|
-
})
|
|
12
|
-
.optional()
|
|
13
|
-
.describe('Viewport size (default: 1920x1080)'),
|
|
14
|
-
waitFor: z
|
|
15
|
-
.string()
|
|
16
|
-
.optional()
|
|
17
|
-
.describe('CSS selector to wait for before screenshot, or timeout in ms (e.g., "3000")'),
|
|
18
|
-
fullPage: z.boolean().optional().default(false).describe('Capture full page height (default: false)')
|
|
19
|
-
});
|
|
20
|
-
export async function handleCaptureScreen(args) {
|
|
21
|
-
// Validate URL
|
|
22
|
-
if (!args.url.startsWith('http://') && !args.url.startsWith('https://')) {
|
|
23
|
-
return {
|
|
24
|
-
content: [{ type: 'text', text: `Invalid URL. Must start with http:// or https://` }],
|
|
25
|
-
isError: true
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
let browser;
|
|
29
|
-
try {
|
|
30
|
-
// Dynamically import playwright (cloud-only dependency)
|
|
31
|
-
const { chromium } = await import('playwright');
|
|
32
|
-
// Launch browser
|
|
33
|
-
browser = await chromium.launch({ headless: true });
|
|
34
|
-
const context = await browser.newContext({
|
|
35
|
-
viewport: args.viewport ?? { width: 1920, height: 1080 }
|
|
36
|
-
});
|
|
37
|
-
const page = await context.newPage();
|
|
38
|
-
// Navigate to URL
|
|
39
|
-
await page.goto(args.url, { waitUntil: 'networkidle' });
|
|
40
|
-
// Wait for selector or timeout if specified
|
|
41
|
-
if (args.waitFor) {
|
|
42
|
-
const timeoutMs = parseInt(args.waitFor, 10);
|
|
43
|
-
if (!isNaN(timeoutMs)) {
|
|
44
|
-
// Wait for timeout
|
|
45
|
-
await page.waitForTimeout(timeoutMs);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
// Wait for selector
|
|
49
|
-
try {
|
|
50
|
-
await page.waitForSelector(args.waitFor, { timeout: 10000 });
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
return {
|
|
54
|
-
content: [
|
|
55
|
-
{
|
|
56
|
-
type: 'text',
|
|
57
|
-
text: `Selector "${args.waitFor}" not found within 10s. Screenshot may be incomplete.`
|
|
58
|
-
}
|
|
59
|
-
],
|
|
60
|
-
isError: true
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// Take screenshot
|
|
66
|
-
let screenshotBuffer;
|
|
67
|
-
if (args.selector) {
|
|
68
|
-
// Screenshot specific element
|
|
69
|
-
const element = await page.$(args.selector);
|
|
70
|
-
if (!element) {
|
|
71
|
-
return {
|
|
72
|
-
content: [
|
|
73
|
-
{
|
|
74
|
-
type: 'text',
|
|
75
|
-
text: `Element not found: ${args.selector}`
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
isError: true
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
screenshotBuffer = await element.screenshot({ type: 'png' });
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
// Screenshot full page or viewport
|
|
85
|
-
screenshotBuffer = await page.screenshot({
|
|
86
|
-
type: 'png',
|
|
87
|
-
fullPage: args.fullPage
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
await browser.close();
|
|
91
|
-
// Detect dimensions from screenshot
|
|
92
|
-
const detected = detectImageDimensions(new Uint8Array(screenshotBuffer));
|
|
93
|
-
const width = detected?.width ?? args.viewport?.width ?? 1920;
|
|
94
|
-
const height = detected?.height ?? args.viewport?.height ?? 1080;
|
|
95
|
-
// Upload to Vercel Blob (via API)
|
|
96
|
-
const base64Data = screenshotBuffer.toString('base64');
|
|
97
|
-
const filename = `screenshot_${Date.now()}.png`;
|
|
98
|
-
const result = await uploadImageViaApi(base64Data, filename, 'image/png');
|
|
99
|
-
if (!result) {
|
|
100
|
-
return {
|
|
101
|
-
content: [
|
|
102
|
-
{
|
|
103
|
-
type: 'text',
|
|
104
|
-
text: `Failed to upload screenshot. In cloud mode, image upload is not yet supported.`
|
|
105
|
-
}
|
|
106
|
-
],
|
|
107
|
-
isError: true
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
// Return result in same format as uploadImage
|
|
111
|
-
return {
|
|
112
|
-
content: [
|
|
113
|
-
{
|
|
114
|
-
type: 'text',
|
|
115
|
-
text: JSON.stringify({ url: result.url, width, height, filename }, null, 2)
|
|
116
|
-
}
|
|
117
|
-
]
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
if (browser) {
|
|
122
|
-
await browser.close();
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
content: [
|
|
126
|
-
{
|
|
127
|
-
type: 'text',
|
|
128
|
-
text: `Screenshot capture failed: ${error.message}`
|
|
129
|
-
}
|
|
130
|
-
],
|
|
131
|
-
isError: true
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
//# sourceMapping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;QAChD,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,UAAU,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;QAE1E,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,OAAO;gBACN,OAAO,EAAE;oBACR;wBACC,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,gFAAgF;qBACtF;iBACD;gBACD,OAAO,EAAE,IAAI;aACb,CAAC;QACH,CAAC;QAED,8CAA8C;QAC9C,OAAO;YACN,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBAC3E;aACD;SACD,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,OAAO,EAAE,CAAC;YACb,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC;QAED,OAAO;YACN,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,8BAA+B,KAAe,CAAC,OAAO,EAAE;iBAC9D;aACD;YACD,OAAO,EAAE,IAAI;SACb,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const generateSpecSchema: z.ZodObject<{
|
|
3
|
-
projectId: z.ZodString;
|
|
4
|
-
format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
5
|
-
sections: z.ZodOptional<z.ZodArray<z.ZodEnum<["db_schema", "api_contracts", "component_tree", "validation_rules", "all"]>, "many">>;
|
|
6
|
-
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
projectId: string;
|
|
8
|
-
format: "markdown" | "json";
|
|
9
|
-
sections?: ("db_schema" | "api_contracts" | "component_tree" | "validation_rules" | "all")[] | undefined;
|
|
10
|
-
}, {
|
|
11
|
-
projectId: string;
|
|
12
|
-
format?: "markdown" | "json" | undefined;
|
|
13
|
-
sections?: ("db_schema" | "api_contracts" | "component_tree" | "validation_rules" | "all")[] | undefined;
|
|
14
|
-
}>;
|
|
15
|
-
export declare function handleGenerateSpec(args: z.infer<typeof generateSpecSchema>): Promise<{
|
|
16
|
-
content: {
|
|
17
|
-
type: "text";
|
|
18
|
-
text: string;
|
|
19
|
-
}[];
|
|
20
|
-
isError: boolean;
|
|
21
|
-
} | {
|
|
22
|
-
content: {
|
|
23
|
-
type: "text";
|
|
24
|
-
text: string;
|
|
25
|
-
}[];
|
|
26
|
-
}>;
|