@synergenius/flow-weaver 0.21.10 → 0.21.11
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 +59 -57
- package/dist/cli/commands/context.js +2 -2
- package/dist/cli/commands/create.js +2 -2
- package/dist/cli/commands/docs.js +5 -5
- package/dist/cli/commands/export.d.ts +4 -4
- package/dist/cli/commands/export.js +4 -4
- package/dist/cli/commands/init-personas.js +11 -11
- package/dist/cli/commands/init.js +5 -5
- package/dist/cli/commands/market.js +5 -5
- package/dist/cli/commands/openapi.d.ts +3 -3
- package/dist/cli/commands/openapi.js +3 -3
- package/dist/cli/commands/run.d.ts +5 -5
- package/dist/cli/commands/run.js +5 -5
- package/dist/cli/commands/serve.d.ts +5 -5
- package/dist/cli/commands/serve.js +5 -5
- package/dist/cli/commands/templates.js +2 -2
- package/dist/cli/flow-weaver.mjs +58 -58
- package/dist/cli/index.js +10 -10
- package/dist/cli/templates/workflows/aggregator.js +1 -1
- package/dist/cli/templates/workflows/ai-agent.js +1 -1
- package/dist/cli/templates/workflows/ai-chat.js +1 -1
- package/dist/cli/templates/workflows/ai-rag.js +1 -1
- package/dist/cli/templates/workflows/ai-react.js +1 -1
- package/dist/cli/templates/workflows/conditional.js +1 -1
- package/dist/cli/templates/workflows/error-handler.js +1 -1
- package/dist/cli/templates/workflows/foreach.js +1 -1
- package/dist/cli/templates/workflows/sequential.js +2 -2
- package/dist/cli/templates/workflows/webhook.js +1 -1
- package/dist/doc-metadata/extractors/cli-commands.js +24 -24
- package/dist/doc-metadata/types.d.ts +1 -1
- package/dist/generated-version.d.ts +1 -1
- package/dist/generated-version.js +1 -1
- package/dist/mcp/server.js +1 -1
- package/docs/reference/advanced-annotations.md +4 -4
- package/docs/reference/built-in-nodes.md +2 -2
- package/docs/reference/cli-reference.md +142 -140
- package/docs/reference/compilation.md +12 -12
- package/docs/reference/concepts.md +29 -29
- package/docs/reference/debugging.md +34 -34
- package/docs/reference/deployment.md +27 -27
- package/docs/reference/export-interface.md +1 -1
- package/docs/reference/iterative-development.md +6 -6
- package/docs/reference/marketplace.md +18 -18
- package/docs/reference/node-conversion.md +1 -1
- package/docs/reference/patterns.md +7 -7
- package/docs/reference/scaffold.md +22 -22
- package/docs/reference/tutorial.md +29 -29
- package/package.json +3 -2
|
@@ -53,7 +53,7 @@ The default `typescript` target generates code that runs directly in Node.js or
|
|
|
53
53
|
### Example
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
|
-
|
|
56
|
+
fw compile workflow.ts
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
Generates code like:
|
|
@@ -79,7 +79,7 @@ export function myWorkflow(params: { data: string }) {
|
|
|
79
79
|
The `inngest` target generates **durable functions** using [Inngest](https://www.inngest.com/). Each workflow node becomes a `step.run()` call, providing automatic retries, event-driven triggers, and crash recovery.
|
|
80
80
|
|
|
81
81
|
```bash
|
|
82
|
-
|
|
82
|
+
fw compile workflow.ts --target inngest
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
### Per-Node Durability
|
|
@@ -237,7 +237,7 @@ export async function expenseWorkflow(
|
|
|
237
237
|
Strips all debug instrumentation from generated code. No `STATUS_CHANGED`, `VARIABLE_SET`, or `LOG_ERROR` events are emitted. Use this for deployed workflows.
|
|
238
238
|
|
|
239
239
|
```bash
|
|
240
|
-
|
|
240
|
+
fw compile workflow.ts --production
|
|
241
241
|
```
|
|
242
242
|
|
|
243
243
|
### Source Maps (`--source-map`)
|
|
@@ -245,7 +245,7 @@ flow-weaver compile workflow.ts --production
|
|
|
245
245
|
Generate source maps alongside compiled output:
|
|
246
246
|
|
|
247
247
|
```bash
|
|
248
|
-
|
|
248
|
+
fw compile workflow.ts --source-map
|
|
249
249
|
```
|
|
250
250
|
|
|
251
251
|
### Module Format (`--format`)
|
|
@@ -259,7 +259,7 @@ Control the output module format:
|
|
|
259
259
|
| `cjs` | CommonJS (`require`/`module.exports`) |
|
|
260
260
|
|
|
261
261
|
```bash
|
|
262
|
-
|
|
262
|
+
fw compile workflow.ts --format cjs
|
|
263
263
|
```
|
|
264
264
|
|
|
265
265
|
### Strict Mode (`--strict`)
|
|
@@ -267,7 +267,7 @@ flow-weaver compile workflow.ts --format cjs
|
|
|
267
267
|
Promote type coercion warnings to errors:
|
|
268
268
|
|
|
269
269
|
```bash
|
|
270
|
-
|
|
270
|
+
fw compile workflow.ts --strict
|
|
271
271
|
```
|
|
272
272
|
|
|
273
273
|
Equivalent to adding `@strictTypes` to the workflow annotation.
|
|
@@ -277,7 +277,7 @@ Equivalent to adding `@strictTypes` to the workflow annotation.
|
|
|
277
277
|
Force inline runtime code even when `@synergenius/flow-weaver` is installed as a dependency. Normally the compiler generates an import; this flag embeds the runtime directly.
|
|
278
278
|
|
|
279
279
|
```bash
|
|
280
|
-
|
|
280
|
+
fw compile workflow.ts --inline-runtime
|
|
281
281
|
```
|
|
282
282
|
|
|
283
283
|
### Clean Output (`--clean`)
|
|
@@ -285,7 +285,7 @@ flow-weaver compile workflow.ts --inline-runtime
|
|
|
285
285
|
Omit redundant `@param`/`@returns` annotations from the compiled output. Produces cleaner generated code.
|
|
286
286
|
|
|
287
287
|
```bash
|
|
288
|
-
|
|
288
|
+
fw compile workflow.ts --clean
|
|
289
289
|
```
|
|
290
290
|
|
|
291
291
|
### Dry Run (`--dry-run`)
|
|
@@ -293,7 +293,7 @@ flow-weaver compile workflow.ts --clean
|
|
|
293
293
|
Preview compilation output without writing any files:
|
|
294
294
|
|
|
295
295
|
```bash
|
|
296
|
-
|
|
296
|
+
fw compile workflow.ts --dry-run
|
|
297
297
|
```
|
|
298
298
|
|
|
299
299
|
---
|
|
@@ -303,7 +303,7 @@ flow-weaver compile workflow.ts --dry-run
|
|
|
303
303
|
Generate a complete HTTP handler for receiving Inngest events:
|
|
304
304
|
|
|
305
305
|
```bash
|
|
306
|
-
|
|
306
|
+
fw compile workflow.ts --target inngest --serve --framework next
|
|
307
307
|
```
|
|
308
308
|
|
|
309
309
|
### Supported Frameworks
|
|
@@ -321,7 +321,7 @@ flow-weaver compile workflow.ts --target inngest --serve --framework next
|
|
|
321
321
|
Generate Zod schemas for event validation from `@param` annotations:
|
|
322
322
|
|
|
323
323
|
```bash
|
|
324
|
-
|
|
324
|
+
fw compile workflow.ts --target inngest --typed-events
|
|
325
325
|
```
|
|
326
326
|
|
|
327
327
|
---
|
|
@@ -337,7 +337,7 @@ Several Inngest annotations can be overridden from the CLI without modifying the
|
|
|
337
337
|
| `--timeout <duration>` | `@timeout` |
|
|
338
338
|
|
|
339
339
|
```bash
|
|
340
|
-
|
|
340
|
+
fw compile workflow.ts --target inngest --retries 5 --timeout "1h"
|
|
341
341
|
```
|
|
342
342
|
|
|
343
343
|
---
|
|
@@ -82,7 +82,7 @@ That is it. Two expression-mode functions, one workflow annotation, zero boilerp
|
|
|
82
82
|
| Use delay/waitForEvent/mocks | `built-in-nodes` | debugging |
|
|
83
83
|
| Publish marketplace packages | `marketplace` | — |
|
|
84
84
|
|
|
85
|
-
Use `
|
|
85
|
+
Use `fw docs <topic>` to read any topic.
|
|
86
86
|
|
|
87
87
|
## File Format
|
|
88
88
|
|
|
@@ -91,18 +91,18 @@ Workflows are TypeScript files with JSDoc annotations. Any `.ts`, `.tsx`, `.js`,
|
|
|
91
91
|
## CLI Commands
|
|
92
92
|
|
|
93
93
|
```bash
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
94
|
+
fw validate <file> # Check for errors (--json for machine parsing)
|
|
95
|
+
fw compile <file> # Generate executable code
|
|
96
|
+
fw run <file> # Execute a workflow directly. No compile step needed for testing.
|
|
97
|
+
fw describe <file> # Get workflow structure as JSON
|
|
98
|
+
fw watch <file> # Watch mode
|
|
99
|
+
fw dev <file> # Watch + compile + run in one command
|
|
100
|
+
fw serve [dir] # HTTP server exposing workflows as endpoints
|
|
101
|
+
fw diagram <file> # Generate SVG diagram
|
|
102
|
+
fw export <file> # Export as serverless function or CI/CD pipeline
|
|
103
|
+
fw docs # Browse documentation
|
|
104
|
+
fw docs <topic> # Read a specific topic
|
|
105
|
+
fw docs search <q> # Search across all docs
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
Options: `-w/--workflow-name`, `--json`, `--format text|mermaid`. See `cli-reference` for all commands and flags.
|
|
@@ -350,7 +350,7 @@ Key points:
|
|
|
350
350
|
*/
|
|
351
351
|
```
|
|
352
352
|
|
|
353
|
-
See `
|
|
353
|
+
See `fw docs export-interface` for full scope documentation.
|
|
354
354
|
|
|
355
355
|
## Node Positioning
|
|
356
356
|
|
|
@@ -372,48 +372,48 @@ Spacing: 180px horizontal (standard), 150px vertical for branches
|
|
|
372
372
|
### Recipe 1: Build a Workflow from Scratch
|
|
373
373
|
|
|
374
374
|
```
|
|
375
|
-
1.
|
|
375
|
+
1. fw create workflow sequential my-workflow.ts --preview # preview the template
|
|
376
376
|
2. Write the file with node types + workflow annotations
|
|
377
|
-
3.
|
|
377
|
+
3. fw validate my-workflow.ts # check for errors
|
|
378
378
|
4. Fix any errors, re-validate
|
|
379
|
-
5.
|
|
380
|
-
6.
|
|
379
|
+
5. fw compile my-workflow.ts # generate executable code
|
|
380
|
+
6. fw describe my-workflow.ts --format text # verify structure
|
|
381
381
|
```
|
|
382
382
|
|
|
383
383
|
### Recipe 2: Add a Node to Existing Workflow
|
|
384
384
|
|
|
385
385
|
```
|
|
386
|
-
1.
|
|
386
|
+
1. fw describe my-workflow.ts --format text # understand current structure
|
|
387
387
|
2. Edit the file: add @flowWeaver nodeType function + @node + @connect annotations
|
|
388
|
-
3.
|
|
388
|
+
3. fw validate my-workflow.ts # verify
|
|
389
389
|
```
|
|
390
390
|
|
|
391
391
|
### Recipe 3: Debug a Broken Workflow
|
|
392
392
|
|
|
393
393
|
```
|
|
394
|
-
1.
|
|
395
|
-
2.
|
|
396
|
-
3. Fix errors based on error codes (see:
|
|
394
|
+
1. fw validate my-workflow.ts # get all errors
|
|
395
|
+
2. fw describe my-workflow.ts --format text # get full picture
|
|
396
|
+
3. Fix errors based on error codes (see: fw docs error-codes)
|
|
397
397
|
```
|
|
398
398
|
|
|
399
399
|
### Recipe 4: Add Iteration (ForEach)
|
|
400
400
|
|
|
401
401
|
```
|
|
402
|
-
1. Read:
|
|
402
|
+
1. Read: fw docs export-interface # scoped port syntax
|
|
403
403
|
2. Edit file: add forEach node type with scope ports
|
|
404
404
|
3. Edit file: add child node with parent scope reference
|
|
405
405
|
4. Edit file: wire scoped connections (:scopeName suffix)
|
|
406
|
-
5.
|
|
406
|
+
5. fw validate my-workflow.ts # verify scope wiring
|
|
407
407
|
```
|
|
408
408
|
|
|
409
409
|
## Workflow Development Process
|
|
410
410
|
|
|
411
411
|
1. **Create file** - Write TypeScript file with types and node functions
|
|
412
412
|
2. **Add annotations** - `@flowWeaver nodeType` and `@flowWeaver workflow`
|
|
413
|
-
3. **Validate** - `
|
|
414
|
-
4. **Test** - Start with `
|
|
415
|
-
5. **Compile** - `
|
|
416
|
-
6. **Inspect** - `
|
|
413
|
+
3. **Validate** - `fw validate <file>`
|
|
414
|
+
4. **Test** - Start with `fw run <file>` for quick testing. Compile only for production deployment.
|
|
415
|
+
5. **Compile** - `fw compile <file>`
|
|
416
|
+
6. **Inspect** - `fw describe <file>` for structure
|
|
417
417
|
|
|
418
418
|
## Additional Annotations
|
|
419
419
|
|
|
@@ -6,7 +6,7 @@ keywords: [debug, troubleshooting, errors, WebSocket, diagnostics, runtime, vali
|
|
|
6
6
|
|
|
7
7
|
# Flow Weaver Debugging Guide
|
|
8
8
|
|
|
9
|
-
For error code lookup, use `
|
|
9
|
+
For error code lookup, use `fw docs error-codes`.
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
@@ -14,11 +14,11 @@ For error code lookup, use `flow-weaver docs error-codes`.
|
|
|
14
14
|
|
|
15
15
|
| Error | Fix |
|
|
16
16
|
| ----------------------- | --------------------------------------------------------------- |
|
|
17
|
-
| UNKNOWN_NODE_TYPE | Check spelling, run `
|
|
17
|
+
| UNKNOWN_NODE_TYPE | Check spelling, run `fw describe <file>` |
|
|
18
18
|
| MISSING_REQUIRED_INPUT | Add `@connect` or make port optional with `@input [name]` |
|
|
19
19
|
| STEP_PORT_TYPE_MISMATCH | STEP ports (execute/onSuccess/onFailure) only connect to STEP |
|
|
20
20
|
| CYCLE_DETECTED | Use scoped forEach instead of graph loops |
|
|
21
|
-
| UNKNOWN_SOURCE_PORT | Check port name spelling, run `
|
|
21
|
+
| UNKNOWN_SOURCE_PORT | Check port name spelling, run `fw describe <file>` |
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
@@ -30,13 +30,13 @@ Flow Weaver can emit real-time execution events over WebSocket for runtime debug
|
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
32
|
# Compile the workflow (debug mode is the default)
|
|
33
|
-
|
|
33
|
+
fw compile my-workflow.ts
|
|
34
34
|
|
|
35
35
|
# Run with WebSocket debug target
|
|
36
36
|
FLOW_WEAVER_DEBUG=ws://localhost:9000 node my-workflow.generated.js
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
Production builds (`
|
|
39
|
+
Production builds (`fw compile --production`) strip all debug event code.
|
|
40
40
|
|
|
41
41
|
### Event Types
|
|
42
42
|
|
|
@@ -63,7 +63,7 @@ START: What is the problem?
|
|
|
63
63
|
|
|
|
64
64
|
+-- "Compilation fails" (parse or validation errors)
|
|
65
65
|
| |
|
|
66
|
-
| +-- Run:
|
|
66
|
+
| +-- Run: fw validate <file> --verbose
|
|
67
67
|
| |
|
|
68
68
|
| +-- Are there PARSE errors?
|
|
69
69
|
| | |
|
|
@@ -75,7 +75,7 @@ START: What is the problem?
|
|
|
75
75
|
| | |
|
|
76
76
|
| | +-- NO --> Are there VALIDATION errors?
|
|
77
77
|
| | |
|
|
78
|
-
| | +-- YES --> Look up the error code:
|
|
78
|
+
| | +-- YES --> Look up the error code: fw docs error-codes
|
|
79
79
|
| | | Common quick fixes:
|
|
80
80
|
| | | - UNKNOWN_*: Check spelling, use validator suggestions
|
|
81
81
|
| | | - MISSING_REQUIRED_INPUT: Add connection or default
|
|
@@ -148,35 +148,35 @@ START: What is the problem?
|
|
|
148
148
|
|
|
149
149
|
## CLI Debugging Commands
|
|
150
150
|
|
|
151
|
-
###
|
|
151
|
+
### fw validate -- Validate a Workflow
|
|
152
152
|
|
|
153
153
|
The first command to use when something seems wrong. Returns all errors and warnings with codes, messages, and hints.
|
|
154
154
|
|
|
155
155
|
```bash
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
fw validate src/workflows/my-workflow.ts
|
|
157
|
+
fw validate src/workflows/my-workflow.ts --json # machine-readable
|
|
158
|
+
fw validate src/workflows/my-workflow.ts --verbose # detailed diagnostics
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
###
|
|
161
|
+
### fw describe -- Understand Workflow Structure
|
|
162
162
|
|
|
163
163
|
Provides a full description of the workflow: nodes, connections, ports, types, and execution graph.
|
|
164
164
|
|
|
165
165
|
```bash
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
fw describe src/workflows/my-workflow.ts # JSON
|
|
167
|
+
fw describe src/workflows/my-workflow.ts --format text # human-readable
|
|
168
|
+
fw describe src/workflows/my-workflow.ts --format mermaid # diagram
|
|
169
|
+
fw describe src/workflows/my-workflow.ts --node fetcher1 # focus on a node
|
|
170
170
|
```
|
|
171
171
|
|
|
172
|
-
###
|
|
172
|
+
### fw run --stream vs --trace
|
|
173
173
|
|
|
174
174
|
Both flags give you execution trace data, but in different ways:
|
|
175
175
|
|
|
176
176
|
**`--stream`** writes events to stderr in real-time as nodes execute. Each STATUS_CHANGED event prints the node ID, new status, and duration. Use this for live debugging during development — you can watch the workflow progress node by node.
|
|
177
177
|
|
|
178
178
|
```bash
|
|
179
|
-
|
|
179
|
+
fw run workflow.ts --stream
|
|
180
180
|
# Output (to stderr):
|
|
181
181
|
# [STATUS_CHANGED] fetcher: → RUNNING
|
|
182
182
|
# [STATUS_CHANGED] fetcher: → SUCCEEDED (142ms)
|
|
@@ -188,10 +188,10 @@ flow-weaver run workflow.ts --stream
|
|
|
188
188
|
**`--trace`** collects all ExecutionTraceEvent objects during execution and includes them in the output after completion. Use this for post-mortem analysis or programmatic consumption (e.g., in CI or with `--json`).
|
|
189
189
|
|
|
190
190
|
```bash
|
|
191
|
-
|
|
191
|
+
fw run workflow.ts --trace
|
|
192
192
|
# Shows: "12 events captured" + first 5 events as summary
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
fw run workflow.ts --trace --json | jq '.traceCount'
|
|
195
195
|
# Outputs: 12
|
|
196
196
|
```
|
|
197
197
|
|
|
@@ -204,10 +204,10 @@ flow-weaver run workflow.ts --trace --json | jq '.traceCount'
|
|
|
204
204
|
|
|
205
205
|
### Diagnostic Strategy
|
|
206
206
|
|
|
207
|
-
1. **
|
|
208
|
-
2. **
|
|
209
|
-
3. **
|
|
210
|
-
4. **
|
|
207
|
+
1. **fw validate** -- Get all errors and warnings. Fix errors first.
|
|
208
|
+
2. **fw describe --format text** -- Full readable summary.
|
|
209
|
+
3. **fw describe --node <id>** -- Trace data flow for a specific node.
|
|
210
|
+
4. **fw describe --format mermaid** -- Visual graph for inspection.
|
|
211
211
|
|
|
212
212
|
---
|
|
213
213
|
|
|
@@ -253,8 +253,8 @@ Scoped ports use direction inversion: scoped OUTPUTS = data parent sends to chil
|
|
|
253
253
|
When testing workflows that use `delay`, `waitForEvent`, `invokeWorkflow`, or `waitForAgent`, use mocks to avoid real side effects:
|
|
254
254
|
|
|
255
255
|
```bash
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
fw run workflow.ts --mocks '{"fast": true, "events": {"app/approved": {"status": "ok"}}}'
|
|
257
|
+
fw run workflow.ts --mocks-file mocks.json
|
|
258
258
|
```
|
|
259
259
|
|
|
260
260
|
Mock config structure:
|
|
@@ -276,7 +276,7 @@ The debug system intercepts execution at two points per node: before it runs (wh
|
|
|
276
276
|
### CLI Debug Mode
|
|
277
277
|
|
|
278
278
|
```bash
|
|
279
|
-
|
|
279
|
+
fw run workflow.ts --debug --params '{"x": 5}'
|
|
280
280
|
```
|
|
281
281
|
|
|
282
282
|
This starts an interactive debug REPL. The workflow pauses before the first node and waits for your command:
|
|
@@ -320,7 +320,7 @@ Debug REPL commands:
|
|
|
320
320
|
You can set breakpoints at startup with `--breakpoint`:
|
|
321
321
|
|
|
322
322
|
```bash
|
|
323
|
-
|
|
323
|
+
fw run workflow.ts --debug --breakpoint processData --breakpoint formatOutput
|
|
324
324
|
```
|
|
325
325
|
|
|
326
326
|
### MCP Debug Tools
|
|
@@ -366,7 +366,7 @@ Checkpointing writes workflow state to disk after each node completes. If the pr
|
|
|
366
366
|
### Enabling Checkpoints
|
|
367
367
|
|
|
368
368
|
```bash
|
|
369
|
-
|
|
369
|
+
fw run workflow.ts --checkpoint --params '{"data": "large-dataset"}'
|
|
370
370
|
```
|
|
371
371
|
|
|
372
372
|
This creates a `.fw-checkpoints/` directory next to the workflow file containing one JSON file per run. The file is automatically deleted after successful completion, so you'll only see them after a crash.
|
|
@@ -375,13 +375,13 @@ This creates a `.fw-checkpoints/` directory next to the workflow file containing
|
|
|
375
375
|
|
|
376
376
|
```bash
|
|
377
377
|
# Auto-detect the most recent checkpoint
|
|
378
|
-
|
|
378
|
+
fw run workflow.ts --resume
|
|
379
379
|
|
|
380
380
|
# Specify a checkpoint file
|
|
381
|
-
|
|
381
|
+
fw run workflow.ts --resume .fw-checkpoints/myWorkflow-run-123.json
|
|
382
382
|
|
|
383
383
|
# Resume in debug mode (step through from the resume point)
|
|
384
|
-
|
|
384
|
+
fw run workflow.ts --resume --debug
|
|
385
385
|
```
|
|
386
386
|
|
|
387
387
|
Via MCP: `fw_resume_from_checkpoint(filePath: "workflow.ts")`.
|
|
@@ -416,10 +416,10 @@ Checkpoints live in `.fw-checkpoints/` next to the workflow file. Add this to `.
|
|
|
416
416
|
|
|
417
417
|
## Dev Mode
|
|
418
418
|
|
|
419
|
-
Use `
|
|
419
|
+
Use `fw dev` to watch, compile, and run in a single command:
|
|
420
420
|
|
|
421
421
|
```bash
|
|
422
|
-
|
|
422
|
+
fw dev workflow.ts --params '{"data": "test"}'
|
|
423
423
|
```
|
|
424
424
|
|
|
425
425
|
This recompiles and re-runs automatically on every file save.
|
|
@@ -33,13 +33,13 @@ The `export` command automatically discovers installed packs — no configuratio
|
|
|
33
33
|
The `export` command generates platform-specific handler code, configuration files, and deploy instructions.
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
|
|
36
|
+
fw export <input> --target <target> --output <dir>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
### AWS Lambda
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
|
|
42
|
+
fw export workflow.ts --target lambda --output dist/
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Generates:
|
|
@@ -50,7 +50,7 @@ Generates:
|
|
|
50
50
|
### Vercel
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
|
|
53
|
+
fw export workflow.ts --target vercel --output api/
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
Generates:
|
|
@@ -60,7 +60,7 @@ Generates:
|
|
|
60
60
|
### Cloudflare Workers
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
|
-
|
|
63
|
+
fw export workflow.ts --target cloudflare --output worker/
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
Generates:
|
|
@@ -70,7 +70,7 @@ Generates:
|
|
|
70
70
|
### Inngest
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
|
-
|
|
73
|
+
fw export workflow.ts --target inngest --output dist/
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
Generates:
|
|
@@ -80,13 +80,13 @@ Generates:
|
|
|
80
80
|
Add `--durable-steps` for per-node `step.run()` durability:
|
|
81
81
|
|
|
82
82
|
```bash
|
|
83
|
-
|
|
83
|
+
fw export workflow.ts --target inngest --output dist/ --durable-steps
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
### GitHub Actions
|
|
87
87
|
|
|
88
88
|
```bash
|
|
89
|
-
|
|
89
|
+
fw export workflow.ts --target github-actions --output .github/workflows/
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
Generates:
|
|
@@ -96,7 +96,7 @@ Generates:
|
|
|
96
96
|
### GitLab CI
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
|
-
|
|
99
|
+
fw export workflow.ts --target gitlab-ci --output .
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
Generates:
|
|
@@ -115,10 +115,10 @@ Secrets are wired as pseudo-node connections: `@connect secret:TOKEN -> node.por
|
|
|
115
115
|
|
|
116
116
|
```bash
|
|
117
117
|
# GitHub Actions
|
|
118
|
-
|
|
118
|
+
fw export pipeline.ts --target github-actions --output .github/workflows/
|
|
119
119
|
|
|
120
120
|
# GitLab CI
|
|
121
|
-
|
|
121
|
+
fw export pipeline.ts --target gitlab-ci --output .
|
|
122
122
|
```
|
|
123
123
|
|
|
124
124
|
See the [CI/CD Pipelines](cicd) topic for the complete annotation reference, validation rules, and full examples.
|
|
@@ -130,7 +130,7 @@ See the [CI/CD Pipelines](cicd) topic for the complete annotation reference, val
|
|
|
130
130
|
Export all workflows in a file as a **unified service** with routing, function registry, and optional API documentation:
|
|
131
131
|
|
|
132
132
|
```bash
|
|
133
|
-
|
|
133
|
+
fw export workflows.ts --target lambda --output dist/ --multi
|
|
134
134
|
```
|
|
135
135
|
|
|
136
136
|
### Features
|
|
@@ -140,7 +140,7 @@ flow-weaver export workflows.ts --target lambda --output dist/ --multi
|
|
|
140
140
|
- **API docs** — Add `--docs` to include Swagger UI at `/docs` and OpenAPI spec at `/openapi.json`
|
|
141
141
|
|
|
142
142
|
```bash
|
|
143
|
-
|
|
143
|
+
fw export workflows.ts --target vercel --output api/ --multi --docs
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
### Selecting Workflows
|
|
@@ -148,17 +148,17 @@ flow-weaver export workflows.ts --target vercel --output api/ --multi --docs
|
|
|
148
148
|
Export a subset of workflows from a multi-workflow file:
|
|
149
149
|
|
|
150
150
|
```bash
|
|
151
|
-
|
|
151
|
+
fw export workflows.ts --target lambda --output dist/ --multi --workflows validatePipeline,enrichPipeline
|
|
152
152
|
```
|
|
153
153
|
|
|
154
154
|
---
|
|
155
155
|
|
|
156
156
|
## HTTP Serve Mode
|
|
157
157
|
|
|
158
|
-
Run workflows as HTTP endpoints locally or in production with `
|
|
158
|
+
Run workflows as HTTP endpoints locally or in production with `fw serve`:
|
|
159
159
|
|
|
160
160
|
```bash
|
|
161
|
-
|
|
161
|
+
fw serve [directory] [options]
|
|
162
162
|
```
|
|
163
163
|
|
|
164
164
|
### Features
|
|
@@ -175,17 +175,17 @@ flow-weaver serve [directory] [options]
|
|
|
175
175
|
|
|
176
176
|
Development server with hot reload:
|
|
177
177
|
```bash
|
|
178
|
-
|
|
178
|
+
fw serve ./workflows
|
|
179
179
|
```
|
|
180
180
|
|
|
181
181
|
Production server:
|
|
182
182
|
```bash
|
|
183
|
-
|
|
183
|
+
fw serve ./workflows --production --precompile --no-watch --port 8080
|
|
184
184
|
```
|
|
185
185
|
|
|
186
186
|
With Swagger UI:
|
|
187
187
|
```bash
|
|
188
|
-
|
|
188
|
+
fw serve ./workflows --swagger
|
|
189
189
|
# Open http://localhost:3000/docs for API documentation
|
|
190
190
|
```
|
|
191
191
|
|
|
@@ -206,7 +206,7 @@ Content-Type: application/json
|
|
|
206
206
|
Generate an OpenAPI specification from all workflows in a directory:
|
|
207
207
|
|
|
208
208
|
```bash
|
|
209
|
-
|
|
209
|
+
fw openapi <directory> [options]
|
|
210
210
|
```
|
|
211
211
|
|
|
212
212
|
The specification is derived from workflow `@param` and `@returns` annotations.
|
|
@@ -215,13 +215,13 @@ The specification is derived from workflow `@param` and `@returns` annotations.
|
|
|
215
215
|
|
|
216
216
|
```bash
|
|
217
217
|
# JSON output (default)
|
|
218
|
-
|
|
218
|
+
fw openapi ./workflows --output api-spec.json
|
|
219
219
|
|
|
220
220
|
# YAML output
|
|
221
|
-
|
|
221
|
+
fw openapi ./workflows --format yaml --output api-spec.yaml
|
|
222
222
|
|
|
223
223
|
# With server URL
|
|
224
|
-
|
|
224
|
+
fw openapi ./workflows --server https://api.example.com --title "My API" --version "2.0.0"
|
|
225
225
|
```
|
|
226
226
|
|
|
227
227
|
### Generated Spec
|
|
@@ -236,10 +236,10 @@ Each workflow becomes an endpoint with:
|
|
|
236
236
|
|
|
237
237
|
## Dev Mode with Inngest
|
|
238
238
|
|
|
239
|
-
For Inngest development, `
|
|
239
|
+
For Inngest development, `fw dev` starts a local dev server with the Inngest Dev Server:
|
|
240
240
|
|
|
241
241
|
```bash
|
|
242
|
-
|
|
242
|
+
fw dev workflow.ts --target inngest --port 8080 --framework express
|
|
243
243
|
```
|
|
244
244
|
|
|
245
245
|
This:
|
|
@@ -251,10 +251,10 @@ This:
|
|
|
251
251
|
|
|
252
252
|
## Deployment Checklist
|
|
253
253
|
|
|
254
|
-
1. **Validate** — Run `
|
|
254
|
+
1. **Validate** — Run `fw validate workflow.ts --strict` before deploying
|
|
255
255
|
2. **Production compile** — Use `--production` to strip debug instrumentation
|
|
256
|
-
3. **Test locally** — Use `
|
|
257
|
-
4. **Export** — Generate platform-specific code with `
|
|
256
|
+
3. **Test locally** — Use `fw serve` or `fw run` with mocks
|
|
257
|
+
4. **Export** — Generate platform-specific code with `fw export`
|
|
258
258
|
5. **Deploy** — Follow platform-specific instructions in the generated output
|
|
259
259
|
|
|
260
260
|
---
|
|
@@ -50,7 +50,7 @@ export function myWorkflow(
|
|
|
50
50
|
Test:
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
|
|
53
|
+
fw validate <file>
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
### Phase 3: Create the Nodes
|
|
@@ -122,7 +122,7 @@ Add node instances with `@node` and connections with `@connect`:
|
|
|
122
122
|
Test after each change:
|
|
123
123
|
|
|
124
124
|
```bash
|
|
125
|
-
|
|
125
|
+
fw validate <file>
|
|
126
126
|
```
|
|
127
127
|
|
|
128
128
|
### Phase 4: Finalizing
|
|
@@ -137,9 +137,9 @@ After everything is connected:
|
|
|
137
137
|
Final validation:
|
|
138
138
|
|
|
139
139
|
```bash
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
fw validate <file>
|
|
141
|
+
fw compile <file>
|
|
142
|
+
fw describe <file> # Get workflow structure as JSON
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
## Common Mistakes
|
|
@@ -168,7 +168,7 @@ If the workflow should return values, connect them: `@connect lastNode.result ->
|
|
|
168
168
|
|
|
169
169
|
### 5. Not Validating After Each Change
|
|
170
170
|
|
|
171
|
-
Always run `
|
|
171
|
+
Always run `fw validate` after adding nodes/connections. Don't batch 10 changes then validate -- validate incrementally.
|
|
172
172
|
|
|
173
173
|
### 6. Using Normal Mode When Expression Mode Works
|
|
174
174
|
|