@synergenius/flow-weaver 0.3.0 → 0.4.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.
Files changed (73) hide show
  1. package/README.md +1 -0
  2. package/dist/annotation-generator.js +36 -0
  3. package/dist/api/generate-in-place.js +39 -0
  4. package/dist/api/generate.js +11 -1
  5. package/dist/api/manipulation/nodes.js +22 -0
  6. package/dist/ast/types.d.ts +27 -1
  7. package/dist/built-in-nodes/index.d.ts +1 -0
  8. package/dist/built-in-nodes/index.js +1 -0
  9. package/dist/built-in-nodes/invoke-workflow.js +12 -1
  10. package/dist/built-in-nodes/mock-types.d.ts +2 -0
  11. package/dist/built-in-nodes/wait-for-agent.d.ts +13 -0
  12. package/dist/built-in-nodes/wait-for-agent.js +26 -0
  13. package/dist/chevrotain-parser/fan-parser.d.ts +38 -0
  14. package/dist/chevrotain-parser/fan-parser.js +149 -0
  15. package/dist/chevrotain-parser/grammar-diagrams.d.ts +1 -0
  16. package/dist/chevrotain-parser/grammar-diagrams.js +3 -0
  17. package/dist/chevrotain-parser/index.d.ts +3 -1
  18. package/dist/chevrotain-parser/index.js +3 -1
  19. package/dist/chevrotain-parser/tokens.d.ts +2 -0
  20. package/dist/chevrotain-parser/tokens.js +10 -0
  21. package/dist/cli/commands/diagram.d.ts +2 -1
  22. package/dist/cli/commands/diagram.js +9 -6
  23. package/dist/cli/commands/run.js +59 -1
  24. package/dist/cli/flow-weaver.mjs +1396 -77
  25. package/dist/cli/index.js +23 -36
  26. package/dist/diagram/geometry.js +47 -5
  27. package/dist/diagram/html-viewer.d.ts +12 -0
  28. package/dist/diagram/html-viewer.js +399 -0
  29. package/dist/diagram/index.d.ts +12 -0
  30. package/dist/diagram/index.js +22 -0
  31. package/dist/diagram/types.d.ts +1 -0
  32. package/dist/doc-metadata/extractors/annotations.js +282 -1
  33. package/dist/doc-metadata/types.d.ts +6 -0
  34. package/dist/generator/control-flow.d.ts +13 -0
  35. package/dist/generator/control-flow.js +74 -0
  36. package/dist/generator/inngest.js +23 -0
  37. package/dist/generator/unified.js +122 -2
  38. package/dist/jsdoc-parser.d.ts +24 -0
  39. package/dist/jsdoc-parser.js +41 -1
  40. package/dist/mcp/agent-channel.d.ts +35 -0
  41. package/dist/mcp/agent-channel.js +61 -0
  42. package/dist/mcp/run-registry.d.ts +29 -0
  43. package/dist/mcp/run-registry.js +24 -0
  44. package/dist/mcp/tools-diagram.d.ts +1 -1
  45. package/dist/mcp/tools-diagram.js +15 -7
  46. package/dist/mcp/tools-editor.js +75 -3
  47. package/dist/mcp/workflow-executor.d.ts +28 -0
  48. package/dist/mcp/workflow-executor.js +62 -1
  49. package/dist/parser.d.ts +8 -0
  50. package/dist/parser.js +100 -0
  51. package/dist/runtime/ExecutionContext.d.ts +2 -0
  52. package/dist/runtime/ExecutionContext.js +2 -0
  53. package/dist/runtime/events.d.ts +1 -1
  54. package/dist/sugar-optimizer.js +28 -3
  55. package/dist/validator.d.ts +8 -0
  56. package/dist/validator.js +92 -0
  57. package/docs/reference/advanced-annotations.md +431 -0
  58. package/docs/reference/built-in-nodes.md +225 -0
  59. package/docs/reference/cli-reference.md +882 -0
  60. package/docs/reference/compilation.md +351 -0
  61. package/docs/reference/concepts.md +400 -0
  62. package/docs/reference/debugging.md +255 -0
  63. package/docs/reference/deployment.md +207 -0
  64. package/docs/reference/error-codes.md +686 -0
  65. package/docs/reference/export-interface.md +229 -0
  66. package/docs/reference/iterative-development.md +186 -0
  67. package/docs/reference/jsdoc-grammar.md +471 -0
  68. package/docs/reference/marketplace.md +205 -0
  69. package/docs/reference/node-conversion.md +308 -0
  70. package/docs/reference/patterns.md +161 -0
  71. package/docs/reference/scaffold.md +160 -0
  72. package/docs/reference/tutorial.md +519 -0
  73. package/package.json +1 -1
@@ -0,0 +1,882 @@
1
+ ---
2
+ name: CLI Reference
3
+ description: Complete reference for all Flow Weaver CLI commands, flags, and options
4
+ keywords: [cli, commands, compile, validate, run, watch, dev, serve, export, diagram, diff, doctor, init, migrate, marketplace, plugin, grammar, changelog, openapi, pattern, create, templates]
5
+ ---
6
+
7
+ # CLI Reference
8
+
9
+ Complete reference for all `flow-weaver` CLI commands.
10
+
11
+ ## Quick Reference
12
+
13
+ | Command | Description |
14
+ |---------|-------------|
15
+ | `compile` | Compile workflow files to TypeScript |
16
+ | `validate` | Validate without compiling |
17
+ | `describe` | Output workflow structure (JSON/text/mermaid) |
18
+ | `run` | Execute a workflow directly |
19
+ | `watch` | Recompile on file changes |
20
+ | `dev` | Watch + compile + run in one command |
21
+ | `serve` | HTTP server exposing workflows as endpoints |
22
+ | `diagram` | Generate SVG diagram |
23
+ | `diff` | Semantic diff between two workflows |
24
+ | `doctor` | Check project environment |
25
+ | `init` | Create a new project |
26
+ | `create` | Create workflows/nodes from templates |
27
+ | `templates` | List available templates |
28
+ | `pattern` | Work with reusable patterns |
29
+ | `export` | Export as serverless function |
30
+ | `openapi` | Generate OpenAPI specification |
31
+ | `migrate` | Migrate to current syntax |
32
+ | `grammar` | Output annotation grammar |
33
+ | `changelog` | Generate changelog from git |
34
+ | `market` | Marketplace packages |
35
+ | `plugin` | External plugins |
36
+ | `docs` | Browse reference documentation |
37
+ | `ui` | Send commands to the editor |
38
+ | `listen` | Stream editor events |
39
+ | `mcp-server` | Start MCP server |
40
+
41
+ ---
42
+
43
+ ## Core Commands
44
+
45
+ ### compile
46
+
47
+ Compile workflow files to TypeScript. Inserts generated code into marker sections in the source file — user code outside markers is preserved.
48
+
49
+ ```bash
50
+ flow-weaver compile <input> [options]
51
+ ```
52
+
53
+ | Flag | Description | Default |
54
+ |------|-------------|---------|
55
+ | `-o, --output <path>` | Output file or directory | in-place |
56
+ | `-p, --production` | No debug events | `false` |
57
+ | `-s, --source-map` | Generate source maps | `false` |
58
+ | `--verbose` | Verbose output | `false` |
59
+ | `--dry-run` | Preview without writing | `false` |
60
+ | `-w, --workflow-name <name>` | Specific workflow name | all |
61
+ | `-f, --format <format>` | Module format: `esm`, `cjs`, `auto` | `auto` |
62
+ | `--strict` | Type coercion warnings become errors | `false` |
63
+ | `--inline-runtime` | Force inline runtime | `false` |
64
+ | `--clean` | Omit redundant @param/@returns | `false` |
65
+ | `--target <target>` | `typescript` or `inngest` | `typescript` |
66
+ | `--cron <schedule>` | Cron schedule (Inngest only) | — |
67
+ | `--serve` | Generate serve() handler | `false` |
68
+ | `--framework <name>` | `next`, `express`, `hono`, `fastify`, `remix` | — |
69
+ | `--typed-events` | Generate Zod event schemas | `false` |
70
+ | `--retries <n>` | Retries per function (Inngest only) | — |
71
+ | `--timeout <duration>` | Function timeout (e.g. `"30m"`) | — |
72
+
73
+ **Examples:**
74
+ ```bash
75
+ flow-weaver compile my-workflow.ts
76
+ flow-weaver compile '**/*.ts' -o .output
77
+ flow-weaver compile my-workflow.ts --format cjs
78
+ flow-weaver compile workflow.ts --target inngest --serve --framework next
79
+ flow-weaver compile workflow.ts --production --clean
80
+ ```
81
+
82
+ > See also: [Compilation](compilation) for details on targets and Inngest integration.
83
+
84
+ ---
85
+
86
+ ### validate
87
+
88
+ Validate workflow files without compiling. Reports errors and warnings with suggestions.
89
+
90
+ ```bash
91
+ flow-weaver validate <input> [options]
92
+ ```
93
+
94
+ | Flag | Description | Default |
95
+ |------|-------------|---------|
96
+ | `--verbose` | Verbose output | `false` |
97
+ | `-q, --quiet` | Suppress warnings | `false` |
98
+ | `--json` | Output as JSON | `false` |
99
+ | `-w, --workflow-name <name>` | Specific workflow name | all |
100
+ | `--strict` | Type coercion warnings become errors | `false` |
101
+
102
+ **Examples:**
103
+ ```bash
104
+ flow-weaver validate my-workflow.ts
105
+ flow-weaver validate '**/*.ts' --verbose
106
+ flow-weaver validate workflow.ts --json --strict
107
+ ```
108
+
109
+ ---
110
+
111
+ ### describe
112
+
113
+ Output workflow structure in LLM-friendly formats.
114
+
115
+ ```bash
116
+ flow-weaver describe <input> [options]
117
+ ```
118
+
119
+ | Flag | Description | Default |
120
+ |------|-------------|---------|
121
+ | `-f, --format <format>` | `json`, `text`, `mermaid`, `paths` | `json` |
122
+ | `-n, --node <id>` | Focus on a specific node | — |
123
+ | `--compile` | Also update runtime markers | `false` |
124
+ | `-w, --workflow-name <name>` | Specific workflow name | all |
125
+
126
+ **Examples:**
127
+ ```bash
128
+ flow-weaver describe workflow.ts
129
+ flow-weaver describe workflow.ts --format mermaid
130
+ flow-weaver describe workflow.ts --node validator
131
+ flow-weaver describe workflow.ts --format paths
132
+ ```
133
+
134
+ ---
135
+
136
+ ### run
137
+
138
+ Execute a workflow file directly. Compiles in memory and runs immediately.
139
+
140
+ ```bash
141
+ flow-weaver run <input> [options]
142
+ ```
143
+
144
+ | Flag | Description | Default |
145
+ |------|-------------|---------|
146
+ | `-w, --workflow <name>` | Specific workflow name | — |
147
+ | `--params <json>` | Input parameters as JSON string | — |
148
+ | `--params-file <path>` | Path to JSON file with parameters | — |
149
+ | `-p, --production` | No trace events | `false` |
150
+ | `-t, --trace` | Include execution trace events | `false` |
151
+ | `--json` | Output result as JSON | `false` |
152
+ | `--timeout <ms>` | Execution timeout in milliseconds | — |
153
+ | `--mocks <json>` | Mock config for built-in nodes as JSON | — |
154
+ | `--mocks-file <path>` | Path to JSON file with mock config | — |
155
+
156
+ **Examples:**
157
+ ```bash
158
+ flow-weaver run workflow.ts --params '{"amount": 500}'
159
+ flow-weaver run workflow.ts --params-file input.json --trace
160
+ flow-weaver run workflow.ts --mocks '{"fast": true, "events": {"app/approved": {"status": "ok"}}}'
161
+ flow-weaver run workflow.ts --timeout 30000 --json
162
+ ```
163
+
164
+ > See also: [Built-in Nodes](built-in-nodes) for mock configuration details.
165
+
166
+ ---
167
+
168
+ ## Development Commands
169
+
170
+ ### watch
171
+
172
+ Watch workflow files and recompile on changes.
173
+
174
+ ```bash
175
+ flow-weaver watch <input> [options]
176
+ ```
177
+
178
+ | Flag | Description | Default |
179
+ |------|-------------|---------|
180
+ | `-o, --output <path>` | Output file or directory | in-place |
181
+ | `-p, --production` | No debug events | `false` |
182
+ | `-s, --source-map` | Generate source maps | `false` |
183
+ | `--verbose` | Verbose output | `false` |
184
+ | `-w, --workflow-name <name>` | Specific workflow name | all |
185
+ | `-f, --format <format>` | `esm`, `cjs`, `auto` | `auto` |
186
+
187
+ **Examples:**
188
+ ```bash
189
+ flow-weaver watch my-workflow.ts
190
+ flow-weaver watch 'src/**/*.ts' -o dist
191
+ ```
192
+
193
+ ---
194
+
195
+ ### dev
196
+
197
+ Watch, compile, and run workflow on changes. Combines `watch` + `run` into a single command for rapid iteration.
198
+
199
+ ```bash
200
+ flow-weaver dev <input> [options]
201
+ ```
202
+
203
+ | Flag | Description | Default |
204
+ |------|-------------|---------|
205
+ | `--params <json>` | Input parameters as JSON string | — |
206
+ | `--params-file <path>` | Path to JSON file with parameters | — |
207
+ | `-w, --workflow <name>` | Specific workflow name | — |
208
+ | `-p, --production` | No trace events | `false` |
209
+ | `-f, --format <format>` | `esm`, `cjs`, `auto` | `auto` |
210
+ | `--clean` | Omit redundant annotations | `false` |
211
+ | `--once` | Run once then exit | `false` |
212
+ | `--json` | Output result as JSON | `false` |
213
+ | `--target <target>` | `typescript` or `inngest` | `typescript` |
214
+ | `--framework <framework>` | Framework for serve handler (Inngest only) | `express` |
215
+ | `--port <port>` | Port for dev server (Inngest only) | `3000` |
216
+
217
+ **Examples:**
218
+ ```bash
219
+ flow-weaver dev workflow.ts --params '{"input": "hello"}'
220
+ flow-weaver dev workflow.ts --once --json
221
+ flow-weaver dev workflow.ts --target inngest --port 8080
222
+ ```
223
+
224
+ ---
225
+
226
+ ### serve
227
+
228
+ Start an HTTP server exposing workflows as REST endpoints. Supports hot reload, CORS, and Swagger UI.
229
+
230
+ ```bash
231
+ flow-weaver serve [directory] [options]
232
+ ```
233
+
234
+ | Flag | Description | Default |
235
+ |------|-------------|---------|
236
+ | `-p, --port <port>` | Server port | `3000` |
237
+ | `-H, --host <host>` | Server host | `0.0.0.0` |
238
+ | `--no-watch` | Disable file watching | watch enabled |
239
+ | `--production` | No trace events | `false` |
240
+ | `--precompile` | Precompile all workflows on startup | `false` |
241
+ | `--cors <origin>` | CORS origin | `*` |
242
+ | `--swagger` | Enable Swagger UI at `/docs` | `false` |
243
+
244
+ **Examples:**
245
+ ```bash
246
+ flow-weaver serve ./workflows
247
+ flow-weaver serve ./workflows --port 8080 --swagger
248
+ flow-weaver serve --production --precompile --no-watch
249
+ ```
250
+
251
+ > See also: [Deployment](deployment) for production serving and export.
252
+
253
+ ---
254
+
255
+ ### listen
256
+
257
+ Connect to the editor and stream integration events as JSON lines.
258
+
259
+ ```bash
260
+ flow-weaver listen [options]
261
+ ```
262
+
263
+ | Flag | Description | Default |
264
+ |------|-------------|---------|
265
+ | `-s, --server <url>` | Editor URL | `http://localhost:9000` |
266
+
267
+ ---
268
+
269
+ ## Visualization
270
+
271
+ ### diagram
272
+
273
+ Generate SVG diagram of a workflow.
274
+
275
+ ```bash
276
+ flow-weaver diagram <input> [options]
277
+ ```
278
+
279
+ | Flag | Description | Default |
280
+ |------|-------------|---------|
281
+ | `-t, --theme <theme>` | `dark` or `light` | `dark` |
282
+ | `-w, --width <pixels>` | SVG width in pixels | auto |
283
+ | `-p, --padding <pixels>` | Canvas padding in pixels | auto |
284
+ | `--no-port-labels` | Hide data type labels on ports | shown |
285
+ | `--workflow-name <name>` | Specific workflow | all |
286
+ | `-o, --output <file>` | Write SVG to file | stdout |
287
+
288
+ **Examples:**
289
+ ```bash
290
+ flow-weaver diagram workflow.ts
291
+ flow-weaver diagram workflow.ts --theme light -o diagram.svg
292
+ flow-weaver diagram workflow.ts --no-port-labels --width 1200
293
+ ```
294
+
295
+ ---
296
+
297
+ ### grammar
298
+
299
+ Output the JSDoc annotation grammar as HTML railroad diagrams or EBNF text.
300
+
301
+ ```bash
302
+ flow-weaver grammar [options]
303
+ ```
304
+
305
+ | Flag | Description | Default |
306
+ |------|-------------|---------|
307
+ | `-f, --format <format>` | `html` or `ebnf` | `html` |
308
+ | `-o, --output <path>` | Write to file | stdout |
309
+
310
+ **Examples:**
311
+ ```bash
312
+ flow-weaver grammar
313
+ flow-weaver grammar --format ebnf
314
+ flow-weaver grammar -o grammar.html
315
+ ```
316
+
317
+ ---
318
+
319
+ ## Analysis
320
+
321
+ ### diff
322
+
323
+ Compare two workflow files semantically. Reports node type changes, instance changes, connection changes, and breaking changes.
324
+
325
+ ```bash
326
+ flow-weaver diff <file1> <file2> [options]
327
+ ```
328
+
329
+ | Flag | Description | Default |
330
+ |------|-------------|---------|
331
+ | `-f, --format <format>` | `text`, `json`, `compact` | `text` |
332
+ | `-w, --workflow-name <name>` | Specific workflow | all |
333
+ | `--exit-zero` | Exit 0 even with differences | `false` |
334
+
335
+ **Examples:**
336
+ ```bash
337
+ flow-weaver diff workflow-v1.ts workflow-v2.ts
338
+ flow-weaver diff workflow-v1.ts workflow-v2.ts --format json
339
+ flow-weaver diff old.ts new.ts --exit-zero # for CI pipelines
340
+ ```
341
+
342
+ ---
343
+
344
+ ### doctor
345
+
346
+ Check project environment and configuration for flow-weaver compatibility.
347
+
348
+ ```bash
349
+ flow-weaver doctor [options]
350
+ ```
351
+
352
+ | Flag | Description | Default |
353
+ |------|-------------|---------|
354
+ | `--json` | Output as JSON | `false` |
355
+
356
+ ---
357
+
358
+ ## Code Generation
359
+
360
+ ### init
361
+
362
+ Create a new flow-weaver project with recommended structure.
363
+
364
+ ```bash
365
+ flow-weaver init [directory] [options]
366
+ ```
367
+
368
+ | Flag | Description | Default |
369
+ |------|-------------|---------|
370
+ | `-n, --name <name>` | Project name | directory name |
371
+ | `-t, --template <template>` | Workflow template | `simple` |
372
+ | `-f, --format <format>` | `esm` or `cjs` | `esm` |
373
+ | `-y, --yes` | Skip prompts, use defaults | `false` |
374
+ | `--install` | Run npm install | — |
375
+ | `--no-install` | Skip npm install | — |
376
+ | `--git` | Initialize git repo | — |
377
+ | `--no-git` | Skip git init | — |
378
+ | `--force` | Overwrite existing files | `false` |
379
+ | `--json` | Output as JSON | `false` |
380
+
381
+ **Examples:**
382
+ ```bash
383
+ flow-weaver init my-project
384
+ flow-weaver init --template ai-agent -y
385
+ flow-weaver init my-project --format cjs --no-git
386
+ ```
387
+
388
+ ---
389
+
390
+ ### create workflow
391
+
392
+ Create a workflow from a template. Appends to existing files.
393
+
394
+ ```bash
395
+ flow-weaver create workflow <template> <file> [options]
396
+ ```
397
+
398
+ | Flag | Description | Default |
399
+ |------|-------------|---------|
400
+ | `-l, --line <number>` | Insert at specific line | end of file |
401
+ | `-a, --async` | Generate async workflow | `false` |
402
+ | `-p, --preview` | Preview without writing | `false` |
403
+ | `--provider <provider>` | LLM provider: `openai`, `anthropic`, `ollama`, `mock` | — |
404
+ | `--model <model>` | Model identifier | — |
405
+ | `--config <json>` | Configuration as JSON | — |
406
+ | `--name <name>` | Override workflow function name | derived |
407
+ | `--nodes <names>` | Comma-separated node names | — |
408
+ | `--input <name>` | Custom input port name | `data` |
409
+ | `--output <name>` | Custom output port name | `result` |
410
+
411
+ **Examples:**
412
+ ```bash
413
+ flow-weaver create workflow sequential my-workflow.ts
414
+ flow-weaver create workflow ai-agent agent.ts --provider openai --model gpt-4o
415
+ flow-weaver create workflow foreach pipeline.ts --nodes "fetch,parse,store" --async
416
+ ```
417
+
418
+ ---
419
+
420
+ ### create node
421
+
422
+ Create a node type from a template. Appends to existing files.
423
+
424
+ ```bash
425
+ flow-weaver create node <name> <file> [options]
426
+ ```
427
+
428
+ | Flag | Description | Default |
429
+ |------|-------------|---------|
430
+ | `-l, --line <number>` | Insert at specific line | end of file |
431
+ | `-t, --template <template>` | Node template | `processor` |
432
+ | `-p, --preview` | Preview without writing | `false` |
433
+ | `--strategy <strategy>` | Template strategy (e.g. `mock`, `callback`, `webhook`) | — |
434
+ | `--config <json>` | Additional configuration | — |
435
+
436
+ **Examples:**
437
+ ```bash
438
+ flow-weaver create node myProcessor my-workflow.ts
439
+ flow-weaver create node apiClient my-workflow.ts --template http
440
+ flow-weaver create node checker my-workflow.ts --template validator
441
+ ```
442
+
443
+ ---
444
+
445
+ ### templates
446
+
447
+ List available workflow and node templates.
448
+
449
+ ```bash
450
+ flow-weaver templates [options]
451
+ ```
452
+
453
+ | Flag | Description | Default |
454
+ |------|-------------|---------|
455
+ | `--json` | Output as JSON | `false` |
456
+
457
+ > See also: [Scaffold](scaffold) for template details.
458
+
459
+ ---
460
+
461
+ ## Patterns
462
+
463
+ ### pattern list
464
+
465
+ List patterns in a file or directory.
466
+
467
+ ```bash
468
+ flow-weaver pattern list <path> [options]
469
+ ```
470
+
471
+ | Flag | Description | Default |
472
+ |------|-------------|---------|
473
+ | `--json` | Output as JSON | `false` |
474
+
475
+ ---
476
+
477
+ ### pattern apply
478
+
479
+ Apply a reusable pattern to a workflow file.
480
+
481
+ ```bash
482
+ flow-weaver pattern apply <pattern-file> <target-file> [options]
483
+ ```
484
+
485
+ | Flag | Description | Default |
486
+ |------|-------------|---------|
487
+ | `-p, --preview` | Preview without writing | `false` |
488
+ | `--prefix <prefix>` | Prefix for node IDs (conflict avoidance) | — |
489
+ | `-n, --name <name>` | Specific pattern name | — |
490
+
491
+ ---
492
+
493
+ ### pattern extract
494
+
495
+ Extract a pattern from selected workflow nodes.
496
+
497
+ ```bash
498
+ flow-weaver pattern extract <source-file> [options]
499
+ ```
500
+
501
+ | Flag | Description | Default |
502
+ |------|-------------|---------|
503
+ | `--nodes <nodes>` | Comma-separated node IDs **(required)** | — |
504
+ | `-o, --output <file>` | Output file **(required)** | — |
505
+ | `-n, --name <name>` | Pattern name | — |
506
+ | `-p, --preview` | Preview without writing | `false` |
507
+
508
+ **Examples:**
509
+ ```bash
510
+ flow-weaver pattern extract workflow.ts --nodes a,b -o extracted.ts
511
+ flow-weaver pattern extract workflow.ts --nodes validator,transformer -o validate-transform.ts --name validateTransform
512
+ ```
513
+
514
+ > See also: [Patterns](patterns) for the full pattern system guide.
515
+
516
+ ---
517
+
518
+ ## Deployment
519
+
520
+ ### export
521
+
522
+ Export workflow as a serverless function for cloud platforms.
523
+
524
+ ```bash
525
+ flow-weaver export <input> [options]
526
+ ```
527
+
528
+ | Flag | Description | Default |
529
+ |------|-------------|---------|
530
+ | `-t, --target <target>` | `lambda`, `vercel`, `cloudflare`, `inngest` **(required)** | — |
531
+ | `-o, --output <path>` | Output directory **(required)** | — |
532
+ | `-w, --workflow <name>` | Specific workflow | — |
533
+ | `-p, --production` | Production mode | `true` |
534
+ | `--dry-run` | Preview without writing | `false` |
535
+ | `--multi` | Export all workflows as single service | `false` |
536
+ | `--workflows <names>` | Comma-separated workflow subset (with `--multi`) | all |
537
+ | `--docs` | Include API documentation routes | `false` |
538
+ | `--durable-steps` | Per-node Inngest steps (Inngest only) | `false` |
539
+
540
+ **Examples:**
541
+ ```bash
542
+ flow-weaver export workflow.ts --target vercel --output api/
543
+ flow-weaver export workflows.ts --target lambda --output dist/ --multi --docs
544
+ flow-weaver export workflow.ts --target inngest --output dist/ --durable-steps
545
+ flow-weaver export workflow.ts --target cloudflare --output worker/
546
+ ```
547
+
548
+ > See also: [Deployment](deployment) for target-specific details.
549
+
550
+ ---
551
+
552
+ ### openapi
553
+
554
+ Generate OpenAPI specification from workflows in a directory.
555
+
556
+ ```bash
557
+ flow-weaver openapi <directory> [options]
558
+ ```
559
+
560
+ | Flag | Description | Default |
561
+ |------|-------------|---------|
562
+ | `-o, --output <path>` | Output file | stdout |
563
+ | `--title <title>` | API title | `Flow Weaver API` |
564
+ | `--version <version>` | API version | `1.0.0` |
565
+ | `--description <desc>` | API description | — |
566
+ | `-f, --format <format>` | `json` or `yaml` | `json` |
567
+ | `--server <url>` | Server URL | — |
568
+
569
+ **Examples:**
570
+ ```bash
571
+ flow-weaver openapi ./workflows --output api-spec.json
572
+ flow-weaver openapi ./workflows --format yaml --server https://api.example.com
573
+ ```
574
+
575
+ ---
576
+
577
+ ## Migration
578
+
579
+ ### migrate
580
+
581
+ Migrate workflow files to current syntax via parse-regenerate round-trip. Adds defaults for missing fields and transforms edge cases.
582
+
583
+ ```bash
584
+ flow-weaver migrate <glob> [options]
585
+ ```
586
+
587
+ | Flag | Description | Default |
588
+ |------|-------------|---------|
589
+ | `--dry-run` | Preview without writing | `false` |
590
+ | `--diff` | Show semantic diff before/after | `false` |
591
+
592
+ Ignores `**/node_modules/**` and `**/*.generated.ts`.
593
+
594
+ **Examples:**
595
+ ```bash
596
+ flow-weaver migrate '**/*.ts'
597
+ flow-weaver migrate 'src/**/*.ts' --dry-run
598
+ flow-weaver migrate '**/*.ts' --diff
599
+ ```
600
+
601
+ ---
602
+
603
+ ## Marketplace
604
+
605
+ ### market init
606
+
607
+ Scaffold a new marketplace package.
608
+
609
+ ```bash
610
+ flow-weaver market init <name> [options]
611
+ ```
612
+
613
+ | Flag | Description | Default |
614
+ |------|-------------|---------|
615
+ | `-d, --description <desc>` | Package description | — |
616
+ | `-a, --author <author>` | Author name | — |
617
+ | `-y, --yes` | Skip prompts | `false` |
618
+
619
+ ---
620
+
621
+ ### market pack
622
+
623
+ Validate and generate `flowweaver.manifest.json`.
624
+
625
+ ```bash
626
+ flow-weaver market pack [directory] [options]
627
+ ```
628
+
629
+ | Flag | Description | Default |
630
+ |------|-------------|---------|
631
+ | `--json` | Output as JSON | `false` |
632
+ | `--verbose` | Show parse warnings | `false` |
633
+
634
+ ---
635
+
636
+ ### market publish
637
+
638
+ Pack and publish to npm.
639
+
640
+ ```bash
641
+ flow-weaver market publish [directory] [options]
642
+ ```
643
+
644
+ | Flag | Description | Default |
645
+ |------|-------------|---------|
646
+ | `--dry-run` | Preview without publishing | `false` |
647
+ | `--tag <tag>` | npm dist-tag | — |
648
+
649
+ ---
650
+
651
+ ### market install
652
+
653
+ Install a marketplace package.
654
+
655
+ ```bash
656
+ flow-weaver market install <package> [options]
657
+ ```
658
+
659
+ | Flag | Description | Default |
660
+ |------|-------------|---------|
661
+ | `--json` | Output as JSON | `false` |
662
+
663
+ ---
664
+
665
+ ### market search
666
+
667
+ Search npm for marketplace packages.
668
+
669
+ ```bash
670
+ flow-weaver market search [query] [options]
671
+ ```
672
+
673
+ | Flag | Description | Default |
674
+ |------|-------------|---------|
675
+ | `-l, --limit <number>` | Max results | `20` |
676
+ | `-r, --registry <url>` | Custom registry URL | public npm |
677
+ | `--json` | Output as JSON | `false` |
678
+
679
+ ---
680
+
681
+ ### market list
682
+
683
+ List installed marketplace packages.
684
+
685
+ ```bash
686
+ flow-weaver market list [options]
687
+ ```
688
+
689
+ | Flag | Description | Default |
690
+ |------|-------------|---------|
691
+ | `--json` | Output as JSON | `false` |
692
+
693
+ > See also: [Marketplace](marketplace) for the full package lifecycle guide.
694
+
695
+ ---
696
+
697
+ ## Plugins
698
+
699
+ ### plugin init
700
+
701
+ Scaffold a new external plugin with component area and optional system module.
702
+
703
+ ```bash
704
+ flow-weaver plugin init <name> [options]
705
+ ```
706
+
707
+ | Flag | Description | Default |
708
+ |------|-------------|---------|
709
+ | `-a, --area <area>` | `sidebar`, `main`, `toolbar`, `modal`, `panel` | `panel` |
710
+ | `--no-system` | Skip generating a system module | system included |
711
+ | `-p, --preview` | Preview without writing | `false` |
712
+ | `--force` | Overwrite existing files | `false` |
713
+
714
+ **Examples:**
715
+ ```bash
716
+ flow-weaver plugin init my-plugin
717
+ flow-weaver plugin init my-plugin --area sidebar --no-system
718
+ ```
719
+
720
+ ---
721
+
722
+ ## Documentation
723
+
724
+ ### docs list
725
+
726
+ List available documentation topics.
727
+
728
+ ```bash
729
+ flow-weaver docs [list] [options]
730
+ ```
731
+
732
+ | Flag | Description | Default |
733
+ |------|-------------|---------|
734
+ | `--json` | Output as JSON | `false` |
735
+ | `--compact` | Compact output | `false` |
736
+
737
+ ---
738
+
739
+ ### docs read
740
+
741
+ Read a documentation topic.
742
+
743
+ ```bash
744
+ flow-weaver docs read <topic> [options]
745
+ ```
746
+
747
+ | Flag | Description | Default |
748
+ |------|-------------|---------|
749
+ | `--json` | Output as JSON | `false` |
750
+ | `--compact` | LLM-friendly version (strips prose) | `false` |
751
+
752
+ ---
753
+
754
+ ### docs search
755
+
756
+ Search across all documentation.
757
+
758
+ ```bash
759
+ flow-weaver docs search <query> [options]
760
+ ```
761
+
762
+ | Flag | Description | Default |
763
+ |------|-------------|---------|
764
+ | `--json` | Output as JSON | `false` |
765
+
766
+ **Examples:**
767
+ ```bash
768
+ flow-weaver docs
769
+ flow-weaver docs read error-codes
770
+ flow-weaver docs read scaffold --compact
771
+ flow-weaver docs search "missing workflow"
772
+ ```
773
+
774
+ ---
775
+
776
+ ## Editor Integration
777
+
778
+ ### ui focus-node
779
+
780
+ Select and center a node in the editor.
781
+
782
+ ```bash
783
+ flow-weaver ui focus-node <nodeId> [options]
784
+ ```
785
+
786
+ ### ui add-node
787
+
788
+ Add a node type at viewport center.
789
+
790
+ ```bash
791
+ flow-weaver ui add-node <nodeTypeName> [options]
792
+ ```
793
+
794
+ ### ui open-workflow
795
+
796
+ Open a workflow file in the editor.
797
+
798
+ ```bash
799
+ flow-weaver ui open-workflow <filePath> [options]
800
+ ```
801
+
802
+ ### ui get-state
803
+
804
+ Return current workflow state from the editor.
805
+
806
+ ```bash
807
+ flow-weaver ui get-state [options]
808
+ ```
809
+
810
+ ### ui batch
811
+
812
+ Execute a batch of commands with auto-snapshot rollback.
813
+
814
+ ```bash
815
+ flow-weaver ui batch <json> [options]
816
+ ```
817
+
818
+ All UI commands accept:
819
+
820
+ | Flag | Description | Default |
821
+ |------|-------------|---------|
822
+ | `-s, --server <url>` | Editor URL | `http://localhost:9000` |
823
+
824
+ ---
825
+
826
+ ## System
827
+
828
+ ### mcp-server
829
+
830
+ Start MCP server for Claude Code integration.
831
+
832
+ ```bash
833
+ flow-weaver mcp-server [options]
834
+ ```
835
+
836
+ | Flag | Description | Default |
837
+ |------|-------------|---------|
838
+ | `-s, --server <url>` | Editor URL | `http://localhost:9000` |
839
+ | `--stdio` | Run in MCP stdio mode | `false` |
840
+
841
+ ---
842
+
843
+ ### changelog
844
+
845
+ Generate changelog from git history, categorized by file path.
846
+
847
+ ```bash
848
+ flow-weaver changelog [options]
849
+ ```
850
+
851
+ | Flag | Description | Default |
852
+ |------|-------------|---------|
853
+ | `--last-tag` | From last git tag to HEAD | `false` |
854
+ | `--since <date>` | Date-based range | — |
855
+ | `-r, --range <range>` | Custom git range | — |
856
+
857
+ **Examples:**
858
+ ```bash
859
+ flow-weaver changelog --last-tag
860
+ flow-weaver changelog --range v0.1.0..HEAD
861
+ flow-weaver changelog --since 2024-01-01
862
+ ```
863
+
864
+ ---
865
+
866
+ ## Global Flag
867
+
868
+ | Flag | Description |
869
+ |------|-------------|
870
+ | `-v, --version` | Output the current version |
871
+
872
+ ---
873
+
874
+ ## Related Topics
875
+
876
+ - [Concepts](concepts) — Fundamental workflow concepts
877
+ - [Compilation](compilation) — Compilation targets and Inngest integration
878
+ - [Deployment](deployment) — Export, serve, and OpenAPI
879
+ - [Built-in Nodes](built-in-nodes) — delay, waitForEvent, invokeWorkflow, and mocks
880
+ - [Scaffold](scaffold) — Template details
881
+ - [Marketplace](marketplace) — Package ecosystem
882
+ - [Advanced Annotations](advanced-annotations) — Pull execution, merge strategies, and more