@synergenius/flow-weaver 0.10.8 → 0.10.9
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/cli/commands/describe.d.ts +2 -2
- package/dist/cli/commands/describe.js +6 -0
- package/dist/cli/commands/diagram.d.ts +2 -2
- package/dist/cli/commands/diagram.js +13 -6
- package/dist/cli/flow-weaver.mjs +964 -361
- package/dist/cli/index.js +2 -2
- package/dist/diagram/ascii-renderer.d.ts +13 -0
- package/dist/diagram/ascii-renderer.js +528 -0
- package/dist/diagram/index.d.ts +4 -0
- package/dist/diagram/index.js +26 -0
- package/dist/diagram/types.d.ts +1 -1
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/prompts.d.ts +3 -0
- package/dist/mcp/prompts.js +68 -0
- package/dist/mcp/server.js +2 -0
- package/dist/mcp/tools-diagram.d.ts +2 -1
- package/dist/mcp/tools-diagram.js +50 -14
- package/dist/mcp/tools-query.js +2 -2
- package/dist/parser.d.ts +6 -0
- package/dist/parser.js +59 -25
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { TWorkflowAST, TNodeInstanceAST, TNodeTypeAST } from '../../ast/types.js';
|
|
5
5
|
export interface DescribeOptions {
|
|
6
|
-
format?: 'json' | 'text' | 'mermaid' | 'paths';
|
|
6
|
+
format?: 'json' | 'text' | 'mermaid' | 'paths' | 'ascii' | 'ascii-compact';
|
|
7
7
|
node?: string;
|
|
8
8
|
workflowName?: string;
|
|
9
9
|
compile?: boolean;
|
|
@@ -63,6 +63,6 @@ export declare function formatTextOutput(ast: TWorkflowAST, output: DescribeOutp
|
|
|
63
63
|
/**
|
|
64
64
|
* Format the describe output based on format option
|
|
65
65
|
*/
|
|
66
|
-
export declare function formatDescribeOutput(ast: TWorkflowAST, output: DescribeOutput | FocusedNodeOutput, format: 'json' | 'text' | 'mermaid' | 'paths'): string;
|
|
66
|
+
export declare function formatDescribeOutput(ast: TWorkflowAST, output: DescribeOutput | FocusedNodeOutput, format: 'json' | 'text' | 'mermaid' | 'paths' | 'ascii' | 'ascii-compact'): string;
|
|
67
67
|
export declare function describeCommand(input: string, options?: DescribeOptions): Promise<void>;
|
|
68
68
|
//# sourceMappingURL=describe.d.ts.map
|
|
@@ -9,6 +9,8 @@ import { validator } from '../../validator.js';
|
|
|
9
9
|
import { getNode, getIncomingConnections, getOutgoingConnections } from '../../api/query.js';
|
|
10
10
|
import { logger } from '../utils/logger.js';
|
|
11
11
|
import { getErrorMessage } from '../../utils/error-utils.js';
|
|
12
|
+
import { buildDiagramGraph } from '../../diagram/geometry.js';
|
|
13
|
+
import { renderASCII, renderASCIICompact } from '../../diagram/ascii-renderer.js';
|
|
12
14
|
export function buildNodeInfo(instance, nodeType) {
|
|
13
15
|
return {
|
|
14
16
|
id: instance.id,
|
|
@@ -329,6 +331,10 @@ export function formatDescribeOutput(ast, output, format) {
|
|
|
329
331
|
return generateMermaid(ast);
|
|
330
332
|
case 'paths':
|
|
331
333
|
return formatPaths(ast);
|
|
334
|
+
case 'ascii':
|
|
335
|
+
return renderASCII(buildDiagramGraph(ast));
|
|
336
|
+
case 'ascii-compact':
|
|
337
|
+
return renderASCIICompact(buildDiagramGraph(ast));
|
|
332
338
|
case 'json':
|
|
333
339
|
default:
|
|
334
340
|
return JSON.stringify(output, null, 2);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Diagram command — generates SVG
|
|
2
|
+
* Diagram command — generates SVG, interactive HTML, or ASCII diagrams from workflow files.
|
|
3
3
|
*/
|
|
4
4
|
export interface DiagramCommandOptions {
|
|
5
5
|
theme?: 'dark' | 'light';
|
|
@@ -8,7 +8,7 @@ export interface DiagramCommandOptions {
|
|
|
8
8
|
showPortLabels?: boolean;
|
|
9
9
|
workflowName?: string;
|
|
10
10
|
output?: string;
|
|
11
|
-
format?: 'svg' | 'html';
|
|
11
|
+
format?: 'svg' | 'html' | 'ascii' | 'ascii-compact' | 'text';
|
|
12
12
|
}
|
|
13
13
|
export declare function diagramCommand(input: string, options?: DiagramCommandOptions): Promise<void>;
|
|
14
14
|
//# sourceMappingURL=diagram.d.ts.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
/**
|
|
3
|
-
* Diagram command — generates SVG
|
|
3
|
+
* Diagram command — generates SVG, interactive HTML, or ASCII diagrams from workflow files.
|
|
4
4
|
*/
|
|
5
5
|
import * as fs from 'fs';
|
|
6
6
|
import * as path from 'path';
|
|
7
|
-
import { fileToSVG, fileToHTML } from '../../diagram/index.js';
|
|
7
|
+
import { fileToSVG, fileToHTML, fileToASCII } from '../../diagram/index.js';
|
|
8
8
|
import { logger } from '../utils/logger.js';
|
|
9
9
|
import { getErrorMessage } from '../../utils/error-utils.js';
|
|
10
|
+
const ASCII_FORMATS = new Set(['ascii', 'ascii-compact', 'text']);
|
|
10
11
|
export async function diagramCommand(input, options = {}) {
|
|
11
12
|
const { output, format = 'svg', ...diagramOptions } = options;
|
|
12
13
|
const filePath = path.resolve(input);
|
|
@@ -15,10 +16,16 @@ export async function diagramCommand(input, options = {}) {
|
|
|
15
16
|
process.exit(1);
|
|
16
17
|
}
|
|
17
18
|
try {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
let result;
|
|
20
|
+
if (ASCII_FORMATS.has(format)) {
|
|
21
|
+
result = fileToASCII(filePath, { ...diagramOptions, format });
|
|
22
|
+
}
|
|
23
|
+
else if (format === 'html') {
|
|
24
|
+
result = fileToHTML(filePath, diagramOptions);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
result = fileToSVG(filePath, diagramOptions);
|
|
28
|
+
}
|
|
22
29
|
if (output) {
|
|
23
30
|
const outputPath = path.resolve(output);
|
|
24
31
|
fs.writeFileSync(outputPath, result, 'utf-8');
|