@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.
@@ -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 or interactive HTML diagrams from workflow files.
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 or interactive HTML diagrams from workflow files.
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
- const isHtml = format === 'html';
19
- const result = isHtml
20
- ? fileToHTML(filePath, diagramOptions)
21
- : fileToSVG(filePath, diagramOptions);
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');