@synergenius/flow-weaver 0.20.1 → 0.20.3
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/annotation-generator.js +7 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/modify-operation.d.ts +15 -0
- package/dist/api/modify-operation.js +177 -0
- package/dist/api/validate.js +17 -0
- package/dist/ast/types.d.ts +2 -0
- package/dist/chevrotain-parser/node-parser.d.ts +2 -0
- package/dist/chevrotain-parser/node-parser.js +27 -1
- package/dist/chevrotain-parser/tokens.d.ts +1 -0
- package/dist/chevrotain-parser/tokens.js +5 -0
- package/dist/cli/commands/modify.d.ts +29 -0
- package/dist/cli/commands/modify.js +57 -0
- package/dist/cli/flow-weaver.mjs +44885 -44640
- package/dist/cli/index.js +73 -2
- package/dist/cli/templates/workflows/aggregator.js +3 -3
- package/dist/cli/templates/workflows/ai-agent.js +3 -3
- package/dist/cli/templates/workflows/ai-chat.js +5 -4
- package/dist/cli/templates/workflows/ai-rag.js +3 -3
- package/dist/cli/templates/workflows/ai-react.js +12 -12
- package/dist/cli/templates/workflows/conditional.js +3 -3
- package/dist/cli/templates/workflows/error-handler.js +2 -2
- package/dist/cli/templates/workflows/foreach.js +3 -3
- package/dist/cli/templates/workflows/sequential.js +7 -4
- package/dist/cli/templates/workflows/webhook.js +3 -3
- package/dist/generated-version.d.ts +1 -1
- package/dist/generated-version.js +1 -1
- package/dist/jsdoc-parser.d.ts +1 -0
- package/dist/jsdoc-parser.js +4 -3
- package/dist/mcp/tools-pattern.js +1 -180
- package/dist/parser.js +1 -0
- package/dist/validator.js +15 -0
- package/docs/reference/advanced-annotations.md +11 -0
- package/docs/reference/cli-reference.md +118 -1
- package/docs/reference/error-codes.md +1 -1
- package/docs/reference/jsdoc-grammar.md +4 -2
- package/docs/reference/marketplace.md +74 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: CLI Reference
|
|
3
3
|
description: Complete reference for all Flow Weaver CLI commands, flags, and options
|
|
4
|
-
keywords: [cli, commands, compile, validate, strip, run, watch, dev, serve, export, diagram, diff, doctor, init, migrate, marketplace, plugin, grammar, changelog, openapi, pattern, create, templates, context]
|
|
4
|
+
keywords: [cli, commands, compile, validate, strip, run, watch, dev, serve, export, diagram, diff, doctor, init, migrate, marketplace, plugin, grammar, changelog, openapi, pattern, create, templates, context, modify, implement, status]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# CLI Reference
|
|
@@ -34,6 +34,9 @@ Complete reference for all `flow-weaver` CLI commands.
|
|
|
34
34
|
| `changelog` | Generate changelog from git |
|
|
35
35
|
| `market` | Marketplace packages |
|
|
36
36
|
| `plugin` | External plugins |
|
|
37
|
+
| `modify` | Add/remove/rename nodes, connections, positions, and labels |
|
|
38
|
+
| `implement` | Replace stub node with function skeleton |
|
|
39
|
+
| `status` | Report implementation progress |
|
|
37
40
|
| `context` | Generate LLM context bundle |
|
|
38
41
|
| `docs` | Browse reference documentation |
|
|
39
42
|
| `ui` | Send commands to the editor |
|
|
@@ -475,6 +478,120 @@ flow-weaver create node checker my-workflow.ts --template validator
|
|
|
475
478
|
|
|
476
479
|
---
|
|
477
480
|
|
|
481
|
+
### modify
|
|
482
|
+
|
|
483
|
+
Modify workflow structure programmatically. Parses the file, applies the operation, and regenerates the JSDoc annotations in place. Useful for scripting, CI pipelines, and the genesis self-evolution system.
|
|
484
|
+
|
|
485
|
+
#### modify addNode
|
|
486
|
+
|
|
487
|
+
```bash
|
|
488
|
+
flow-weaver modify addNode --file <path> --nodeId <id> --nodeType <type>
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
Adds a new node instance to the workflow. Auto-positions to the right of the rightmost existing node. Warns if the node type isn't defined in the file.
|
|
492
|
+
|
|
493
|
+
#### modify removeNode
|
|
494
|
+
|
|
495
|
+
```bash
|
|
496
|
+
flow-weaver modify removeNode --file <path> --nodeId <id>
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
Removes a node instance and all connections attached to it.
|
|
500
|
+
|
|
501
|
+
#### modify addConnection
|
|
502
|
+
|
|
503
|
+
```bash
|
|
504
|
+
flow-weaver modify addConnection --file <path> --from <node.port> --to <node.port>
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
Adds a connection between two ports. Both nodes must exist. Port names are validated against the node type definition when available.
|
|
508
|
+
|
|
509
|
+
#### modify removeConnection
|
|
510
|
+
|
|
511
|
+
```bash
|
|
512
|
+
flow-weaver modify removeConnection --file <path> --from <node.port> --to <node.port>
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
Removes an existing connection.
|
|
516
|
+
|
|
517
|
+
#### modify renameNode
|
|
518
|
+
|
|
519
|
+
```bash
|
|
520
|
+
flow-weaver modify renameNode --file <path> --oldId <id> --newId <id>
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
Renames a node instance and updates all connections that reference it.
|
|
524
|
+
|
|
525
|
+
#### modify setPosition
|
|
526
|
+
|
|
527
|
+
```bash
|
|
528
|
+
flow-weaver modify setPosition --file <path> --nodeId <id> --x <number> --y <number>
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
Sets the canvas position of a node instance.
|
|
532
|
+
|
|
533
|
+
#### modify setLabel
|
|
534
|
+
|
|
535
|
+
```bash
|
|
536
|
+
flow-weaver modify setLabel --file <path> --nodeId <id> --label <text>
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
Sets the display label for a node instance.
|
|
540
|
+
|
|
541
|
+
**Examples:**
|
|
542
|
+
```bash
|
|
543
|
+
flow-weaver modify addNode --file workflow.ts --nodeId validator --nodeType validateInput
|
|
544
|
+
flow-weaver modify addConnection --file workflow.ts --from Start.data --to validator.input
|
|
545
|
+
flow-weaver modify removeNode --file workflow.ts --nodeId oldStep
|
|
546
|
+
flow-weaver modify removeConnection --file workflow.ts --from a.output --to b.input
|
|
547
|
+
flow-weaver modify renameNode --file workflow.ts --oldId step1 --newId validateStep
|
|
548
|
+
flow-weaver modify setPosition --file workflow.ts --nodeId step1 --x 200 --y 100
|
|
549
|
+
flow-weaver modify setLabel --file workflow.ts --nodeId step1 --label "Validate Input"
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
---
|
|
553
|
+
|
|
554
|
+
### implement
|
|
555
|
+
|
|
556
|
+
Replace a stub node (`declare function`) with a real function skeleton containing the correct signature, JSDoc annotations, and return type.
|
|
557
|
+
|
|
558
|
+
```bash
|
|
559
|
+
flow-weaver implement <input> <node> [options]
|
|
560
|
+
flow-weaver implement <input> --nodeId <id> [options]
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
The node can be specified as a positional argument or with the `--nodeId` flag.
|
|
564
|
+
|
|
565
|
+
| Flag | Description | Default |
|
|
566
|
+
|------|-------------|---------|
|
|
567
|
+
| `-w, --workflow <name>` | Specific workflow name | — |
|
|
568
|
+
| `--nodeId <id>` | Node to implement (alternative to positional arg) | — |
|
|
569
|
+
| `-p, --preview` | Preview without writing | `false` |
|
|
570
|
+
|
|
571
|
+
**Examples:**
|
|
572
|
+
```bash
|
|
573
|
+
flow-weaver implement workflow.ts validateInput
|
|
574
|
+
flow-weaver implement workflow.ts --nodeId validateInput
|
|
575
|
+
flow-weaver implement workflow.ts myNode --preview
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
---
|
|
579
|
+
|
|
580
|
+
### status
|
|
581
|
+
|
|
582
|
+
Report implementation progress for stub workflows. Shows which nodes are implemented vs still declared as stubs.
|
|
583
|
+
|
|
584
|
+
```bash
|
|
585
|
+
flow-weaver status <input> [options]
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
| Flag | Description | Default |
|
|
589
|
+
|------|-------------|---------|
|
|
590
|
+
| `-w, --workflow <name>` | Specific workflow name | — |
|
|
591
|
+
| `--json` | Output as JSON | `false` |
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
478
595
|
### templates
|
|
479
596
|
|
|
480
597
|
List available workflow and node templates.
|
|
@@ -540,7 +540,7 @@ const fetchData = (execute: boolean, url: string, apiKey: string) => { ... };
|
|
|
540
540
|
| Severity | Warning |
|
|
541
541
|
| Meaning | A node's data output port is never connected to anything. The data produced by this port is discarded. |
|
|
542
542
|
| Common Causes | The node produces an output that is not needed by the current workflow. A connection from this port was removed but the port still exists. Control flow ports (`onSuccess`, `onFailure`) and scoped ports are excluded from this check. |
|
|
543
|
-
| Fix | If the output is needed, connect it to a downstream node or to `Exit`. If
|
|
543
|
+
| Fix | If the output is needed, connect it to a downstream node or to `Exit`. If the output is intentionally discarded, add `[suppress: "UNUSED_OUTPUT_PORT"]` to the `@node` annotation to silence this warning for that instance. |
|
|
544
544
|
|
|
545
545
|
#### UNREACHABLE_EXIT_PORT (warning)
|
|
546
546
|
|
|
@@ -212,8 +212,8 @@ attributeBracket ::= "[" nodeAttr { "," nodeAttr } "]"
|
|
|
212
212
|
|
|
213
213
|
nodeAttr ::= labelAttr | exprAttr | portOrderAttr | portLabelAttr
|
|
214
214
|
| minimizedAttr | pullExecutionAttr | sizeAttr
|
|
215
|
-
| colorAttr | iconAttr | tagsAttr |
|
|
216
|
-
| jobAttr | environmentAttr
|
|
215
|
+
| colorAttr | iconAttr | tagsAttr | suppressAttr
|
|
216
|
+
| positionAttr | jobAttr | environmentAttr
|
|
217
217
|
|
|
218
218
|
labelAttr ::= "label:" STRING
|
|
219
219
|
exprAttr ::= "expr:" IDENTIFIER "=" STRING { "," IDENTIFIER "=" STRING }
|
|
@@ -229,6 +229,7 @@ tagEntry ::= STRING [ STRING ]
|
|
|
229
229
|
positionAttr ::= "position:" INTEGER INTEGER
|
|
230
230
|
jobAttr ::= "job:" STRING
|
|
231
231
|
environmentAttr ::= "environment:" STRING
|
|
232
|
+
suppressAttr ::= "suppress:" STRING { "," STRING }
|
|
232
233
|
```
|
|
233
234
|
|
|
234
235
|
Multiple attribute brackets are allowed (zero or more). Attributes can be split across brackets or combined in one.
|
|
@@ -250,6 +251,7 @@ Multiple attribute brackets are allowed (zero or more). Attributes can be split
|
|
|
250
251
|
@node myAdd Add [label: "hi"] [color: "#f00"] [position: 360 0]
|
|
251
252
|
@node build npmBuild [job: "build"]
|
|
252
253
|
@node deploy deploySsh [job: "deploy"] [environment: "production"]
|
|
254
|
+
@node fetch fetchData [suppress: "UNUSED_OUTPUT_PORT"]
|
|
253
255
|
```
|
|
254
256
|
|
|
255
257
|
## @connect
|
|
@@ -159,6 +159,80 @@ The `market pack` command validates packages against additional rules beyond sta
|
|
|
159
159
|
|
|
160
160
|
---
|
|
161
161
|
|
|
162
|
+
## Custom Tag Handlers
|
|
163
|
+
|
|
164
|
+
Tag handlers let packs extend the parser with custom JSDoc annotations. When the parser encounters a tag it doesn't recognize natively, it delegates to registered pack handlers before emitting "Unknown annotation" warnings.
|
|
165
|
+
|
|
166
|
+
The CI/CD pack (`flowweaver-pack-cicd`) is the primary example: it registers handlers for `@secret`, `@runner`, `@cache`, `@artifact`, and other CI/CD tags.
|
|
167
|
+
|
|
168
|
+
### Writing a handler
|
|
169
|
+
|
|
170
|
+
A tag handler is a function matching the `TTagHandlerFn` signature:
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
import type { TTagHandlerFn } from '@synergenius/flow-weaver/api';
|
|
174
|
+
|
|
175
|
+
export const myHandler: TTagHandlerFn = (tagName, comment, ctx) => {
|
|
176
|
+
// tagName: the tag without '@', e.g. "secret"
|
|
177
|
+
// comment: everything after the tag on that line
|
|
178
|
+
// ctx.deploy: the deploy map for your namespace (mutate it directly)
|
|
179
|
+
// ctx.warnings: push parser warnings here
|
|
180
|
+
|
|
181
|
+
const value = comment.trim();
|
|
182
|
+
if (!value) {
|
|
183
|
+
ctx.warnings.push(`Empty @${tagName} tag`);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const items = (ctx.deploy['items'] as string[]) ?? [];
|
|
188
|
+
items.push(value);
|
|
189
|
+
ctx.deploy['items'] = items;
|
|
190
|
+
};
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The handler receives one call per tag occurrence. Parsed data goes into `ctx.deploy`, which maps to `workflow.deploy[namespace]` or `nodeType.deploy[namespace]` in the final AST.
|
|
194
|
+
|
|
195
|
+
### Declaring handlers in the manifest
|
|
196
|
+
|
|
197
|
+
Add a `tagHandlers` entry to your `flowweaver.manifest.json`:
|
|
198
|
+
|
|
199
|
+
```json
|
|
200
|
+
{
|
|
201
|
+
"manifestVersion": 2,
|
|
202
|
+
"tagHandlers": [
|
|
203
|
+
{
|
|
204
|
+
"tags": ["secret", "runner", "cache"],
|
|
205
|
+
"namespace": "cicd",
|
|
206
|
+
"scope": "both",
|
|
207
|
+
"file": "dist/tag-handler.js",
|
|
208
|
+
"exportName": "cicdTagHandler"
|
|
209
|
+
}
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Fields:
|
|
215
|
+
|
|
216
|
+
| Field | Description |
|
|
217
|
+
|-------|-------------|
|
|
218
|
+
| `tags` | Tag names this handler processes (without the `@` prefix) |
|
|
219
|
+
| `namespace` | Key in the deploy map where parsed data is stored |
|
|
220
|
+
| `scope` | `workflow` for workflow-level tags, `nodeType` for node type tags, `both` for either |
|
|
221
|
+
| `file` | Relative path to the compiled JS file exporting the handler |
|
|
222
|
+
| `exportName` | Named export from the file (omit for `default` export) |
|
|
223
|
+
|
|
224
|
+
### Handler scope
|
|
225
|
+
|
|
226
|
+
A handler scoped to `workflow` only runs for tags inside `@flowWeaver workflow` blocks. A handler scoped to `nodeType` only runs inside `@flowWeaver nodeType` blocks. Use `both` when your tags are valid in either context.
|
|
227
|
+
|
|
228
|
+
If a tag appears in the wrong scope, the parser emits a warning and skips the handler call.
|
|
229
|
+
|
|
230
|
+
### How discovery works
|
|
231
|
+
|
|
232
|
+
When `parseWorkflow()` is called with a `projectDir` option (or when the CLI runs from a project directory), the parser scans `node_modules` for installed packs with a `flowweaver.manifest.json`. It reads the `tagHandlers` array from each manifest, dynamically imports the handler files, and registers them in the `TagHandlerRegistry`. This scan runs once per project directory and is cached for subsequent parse calls.
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
162
236
|
## External Plugins
|
|
163
237
|
|
|
164
238
|
Plugins extend the Flow Weaver Studio IDE with custom UI components, system logic, and integrations.
|
package/package.json
CHANGED