@synergenius/flow-weaver 0.15.2 → 0.16.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.
@@ -11,5 +11,19 @@ export declare const logger: {
11
11
  newline(): void;
12
12
  section(title: string): void;
13
13
  progress(current: number, total: number, item: string): void;
14
+ dim(message: string): string;
15
+ bold(message: string): string;
16
+ highlight(value: string): string;
17
+ banner(version: string): void;
18
+ table(rows: [string, string, string?][]): void;
19
+ spinner(message: string): {
20
+ stop: (msg?: string) => void;
21
+ fail: (msg?: string) => void;
22
+ update: (msg: string) => void;
23
+ };
24
+ timer(): {
25
+ elapsed: () => string;
26
+ ms: () => number;
27
+ };
14
28
  };
15
29
  //# sourceMappingURL=logger.d.ts.map
@@ -2,31 +2,26 @@
2
2
  /**
3
3
  * CLI logging utility with colors and formatting
4
4
  */
5
- // ANSI color support - respects NO_COLOR env var and non-TTY
6
- const USE_COLOR = !process.env.NO_COLOR && process.stdout.isTTY !== false;
7
- const RESET = USE_COLOR ? '\x1b[0m' : '';
8
- const GREEN = USE_COLOR ? '\x1b[32m' : '';
9
- const RED = USE_COLOR ? '\x1b[31m' : '';
10
- const YELLOW = USE_COLOR ? '\x1b[33m' : '';
11
- const BLUE = USE_COLOR ? '\x1b[34m' : '';
12
- const BOLD = USE_COLOR ? '\x1b[1m' : '';
13
- const DIM = USE_COLOR ? '\x1b[2m' : '';
5
+ import pc from 'picocolors';
6
+ const isTTY = process.stdout.isTTY === true;
7
+ // Spinner frames
8
+ const SPINNER_FRAMES = ['⠋', '⠙', '', '⠸', '', '⠴', '⠦', '⠧', '⠇', '⠏'];
14
9
  export const logger = {
15
10
  info(message) {
16
- console.log(`${BLUE} ${message}${RESET}`);
11
+ console.log(`${pc.blue('ℹ')} ${message}`);
17
12
  },
18
13
  success(message) {
19
- console.log(`${GREEN} ${message}${RESET}`);
14
+ console.log(`${pc.green('✓')} ${message}`);
20
15
  },
21
16
  error(message) {
22
- console.error(`${RED} ${message}${RESET}`);
17
+ console.error(`${pc.red('✗')} ${message}`);
23
18
  },
24
19
  warn(message) {
25
- console.warn(`${YELLOW} ${message}${RESET}`);
20
+ console.warn(`${pc.yellow('⚠')} ${message}`);
26
21
  },
27
22
  debug(message) {
28
23
  if (process.env.DEBUG) {
29
- console.log(`${DIM}🔍 ${message}${RESET}`);
24
+ console.log(`${pc.dim('🔍')} ${pc.dim(message)}`);
30
25
  }
31
26
  },
32
27
  log(message) {
@@ -37,10 +32,95 @@ export const logger = {
37
32
  },
38
33
  section(title) {
39
34
  console.log();
40
- console.log(`${BOLD}━━━ ${title} ━━━${RESET}`);
35
+ console.log(` ${pc.bold(title)}`);
36
+ console.log();
41
37
  },
42
38
  progress(current, total, item) {
43
- console.log(`[${current}/${total}] ${item}`);
39
+ console.log(`${pc.dim(`[${current}/${total}]`)} ${item}`);
40
+ },
41
+ // --- Formatting helpers ---
42
+ dim(message) {
43
+ return pc.dim(message);
44
+ },
45
+ bold(message) {
46
+ return pc.bold(message);
47
+ },
48
+ highlight(value) {
49
+ return pc.cyan(value);
50
+ },
51
+ // --- Branded output ---
52
+ banner(version) {
53
+ console.log(` ${pc.bold(pc.cyan('flow-weaver'))} ${pc.dim(`v${version}`)}`);
54
+ },
55
+ // --- Table output ---
56
+ table(rows) {
57
+ if (rows.length === 0)
58
+ return;
59
+ const col0 = Math.max(...rows.map((r) => r[0].length)) + 2;
60
+ const col1 = Math.max(...rows.map((r) => r[1].length)) + 2;
61
+ for (const [label, value, status] of rows) {
62
+ const line = ` ${label.padEnd(col0)}${value.padEnd(col1)}${status ?? ''}`;
63
+ console.log(line);
64
+ }
65
+ },
66
+ // --- Spinner ---
67
+ spinner(message) {
68
+ if (!isTTY) {
69
+ // Non-TTY: print a static line
70
+ process.stderr.write(` ${message}\n`);
71
+ return {
72
+ stop(msg) { if (msg)
73
+ process.stderr.write(` ${pc.green('✓')} ${msg}\n`); },
74
+ fail(msg) { if (msg)
75
+ process.stderr.write(` ${pc.red('✗')} ${msg}\n`); },
76
+ update() { },
77
+ };
78
+ }
79
+ let frame = 0;
80
+ let text = message;
81
+ const interval = setInterval(() => {
82
+ const spinner = pc.cyan(SPINNER_FRAMES[frame % SPINNER_FRAMES.length]);
83
+ process.stderr.write(`\r\x1b[K ${spinner} ${text}`);
84
+ frame++;
85
+ }, 80);
86
+ const clear = () => {
87
+ clearInterval(interval);
88
+ process.stderr.write('\r\x1b[K');
89
+ };
90
+ return {
91
+ stop(msg) {
92
+ clear();
93
+ if (msg)
94
+ process.stderr.write(` ${pc.green('✓')} ${msg}\n`);
95
+ },
96
+ fail(msg) {
97
+ clear();
98
+ if (msg)
99
+ process.stderr.write(` ${pc.red('✗')} ${msg}\n`);
100
+ },
101
+ update(msg) {
102
+ text = msg;
103
+ },
104
+ };
105
+ },
106
+ // --- Timer ---
107
+ timer() {
108
+ const start = performance.now();
109
+ return {
110
+ elapsed() {
111
+ const ms = performance.now() - start;
112
+ if (ms < 1000)
113
+ return `${Math.round(ms)}ms`;
114
+ if (ms < 60_000)
115
+ return `${(ms / 1000).toFixed(1)}s`;
116
+ const mins = Math.floor(ms / 60_000);
117
+ const secs = Math.round((ms % 60_000) / 1000);
118
+ return `${mins}m ${secs}s`;
119
+ },
120
+ ms() {
121
+ return Math.round(performance.now() - start);
122
+ },
123
+ };
44
124
  },
45
125
  };
46
126
  //# sourceMappingURL=logger.js.map
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.15.2";
1
+ export declare const VERSION = "0.16.0";
2
2
  //# sourceMappingURL=generated-version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by scripts/generate-version.ts — do not edit manually
2
- export const VERSION = '0.15.2';
2
+ export const VERSION = '0.16.0';
3
3
  //# sourceMappingURL=generated-version.js.map
@@ -116,7 +116,13 @@ export async function executeWorkflowFromFile(filePath, params, options) {
116
116
  // Find the target exported function
117
117
  const exportedFn = findExportedFunction(mod, options?.workflowName);
118
118
  if (!exportedFn) {
119
- throw new Error(`No exported workflow function found${options?.workflowName ? ` named "${options.workflowName}"` : ''}`);
119
+ const available = Object.entries(mod)
120
+ .filter(([k, v]) => k !== '__esModule' && typeof v === 'function')
121
+ .map(([k]) => k);
122
+ const availStr = available.length > 0 ? `. Available: ${available.join(', ')}` : '';
123
+ throw new Error(options?.workflowName
124
+ ? `Workflow "${options.workflowName}" not found in file${availStr}`
125
+ : `No exported workflow function found in file${availStr}`);
120
126
  }
121
127
  const startTime = Date.now();
122
128
  // Execute the workflow function: (execute, params, abortSignal?)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synergenius/flow-weaver",
3
- "version": "0.15.2",
3
+ "version": "0.16.0",
4
4
  "description": "Deterministic workflow compiler for AI agents. Compiles to standalone TypeScript, no runtime dependencies.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -138,6 +138,7 @@
138
138
  "glob": "^10.3.10",
139
139
  "immer": "^10.2.0",
140
140
  "js-yaml": "^4.1.0",
141
+ "picocolors": "^1.1.1",
141
142
  "socket.io-client": "^4.8.0",
142
143
  "source-map": "^0.7.6",
143
144
  "ts-morph": "^21.0.1",