@synergenius/flow-weaver 0.2.1 → 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 (83) hide show
  1. package/README.md +261 -200
  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/docs.d.ts +11 -0
  24. package/dist/cli/commands/docs.js +77 -0
  25. package/dist/cli/commands/run.js +59 -1
  26. package/dist/cli/flow-weaver.mjs +2447 -594
  27. package/dist/cli/index.js +40 -2
  28. package/dist/diagram/geometry.d.ts +9 -4
  29. package/dist/diagram/geometry.js +262 -31
  30. package/dist/diagram/html-viewer.d.ts +12 -0
  31. package/dist/diagram/html-viewer.js +399 -0
  32. package/dist/diagram/index.d.ts +12 -0
  33. package/dist/diagram/index.js +22 -0
  34. package/dist/diagram/renderer.js +137 -116
  35. package/dist/diagram/types.d.ts +1 -0
  36. package/dist/doc-metadata/extractors/annotations.js +282 -1
  37. package/dist/doc-metadata/types.d.ts +6 -0
  38. package/dist/docs/index.d.ts +54 -0
  39. package/dist/docs/index.js +256 -0
  40. package/dist/generator/control-flow.d.ts +13 -0
  41. package/dist/generator/control-flow.js +74 -0
  42. package/dist/generator/inngest.js +23 -0
  43. package/dist/generator/unified.js +122 -2
  44. package/dist/jsdoc-parser.d.ts +24 -0
  45. package/dist/jsdoc-parser.js +41 -1
  46. package/dist/mcp/agent-channel.d.ts +35 -0
  47. package/dist/mcp/agent-channel.js +61 -0
  48. package/dist/mcp/run-registry.d.ts +29 -0
  49. package/dist/mcp/run-registry.js +24 -0
  50. package/dist/mcp/server.js +2 -0
  51. package/dist/mcp/tools-diagram.d.ts +1 -1
  52. package/dist/mcp/tools-diagram.js +15 -7
  53. package/dist/mcp/tools-docs.d.ts +3 -0
  54. package/dist/mcp/tools-docs.js +62 -0
  55. package/dist/mcp/tools-editor.js +77 -3
  56. package/dist/mcp/tools-query.js +3 -1
  57. package/dist/mcp/workflow-executor.d.ts +28 -0
  58. package/dist/mcp/workflow-executor.js +66 -3
  59. package/dist/parser.d.ts +8 -0
  60. package/dist/parser.js +100 -0
  61. package/dist/runtime/ExecutionContext.d.ts +2 -0
  62. package/dist/runtime/ExecutionContext.js +2 -0
  63. package/dist/runtime/events.d.ts +1 -1
  64. package/dist/sugar-optimizer.js +28 -3
  65. package/dist/validator.d.ts +8 -0
  66. package/dist/validator.js +92 -0
  67. package/docs/reference/advanced-annotations.md +431 -0
  68. package/docs/reference/built-in-nodes.md +225 -0
  69. package/docs/reference/cli-reference.md +882 -0
  70. package/docs/reference/compilation.md +351 -0
  71. package/docs/reference/concepts.md +400 -0
  72. package/docs/reference/debugging.md +255 -0
  73. package/docs/reference/deployment.md +207 -0
  74. package/docs/reference/error-codes.md +686 -0
  75. package/docs/reference/export-interface.md +229 -0
  76. package/docs/reference/iterative-development.md +186 -0
  77. package/docs/reference/jsdoc-grammar.md +471 -0
  78. package/docs/reference/marketplace.md +205 -0
  79. package/docs/reference/node-conversion.md +308 -0
  80. package/docs/reference/patterns.md +161 -0
  81. package/docs/reference/scaffold.md +160 -0
  82. package/docs/reference/tutorial.md +519 -0
  83. package/package.json +10 -4
@@ -0,0 +1,471 @@
1
+ ---
2
+ name: Flow Weaver JSDoc Grammar
3
+ description: Formal syntax grammar for @flowWeaver JSDoc annotations parsed by Chevrotain
4
+ keywords: [grammar, syntax, JSDoc, annotations, input, output, connect, node, Chevrotain, EBNF, scope, position]
5
+ ---
6
+
7
+ # JSDoc Block Structure
8
+
9
+ All Flow Weaver annotations live inside standard JSDoc `/** ... */` blocks placed directly above a `function` declaration. The parser recognizes three block types based on the `@flowWeaver` tag value.
10
+
11
+ ```
12
+ jsdocBlock ::= "/**" { tagLine } "*/"
13
+ tagLine ::= "*" "@" TAG_NAME [ tagContent ]
14
+ ```
15
+
16
+ ---
17
+
18
+ # Block Types
19
+
20
+ ```
21
+ flowWeaverTag ::= "@flowWeaver" ( "nodeType" | "workflow" | "pattern" )
22
+ ```
23
+
24
+ ---
25
+
26
+ # Node Type Tags
27
+
28
+ A `@flowWeaver nodeType` block accepts these tags (order does not matter):
29
+
30
+ ```
31
+ nodeTypeBlock ::= "@flowWeaver nodeType"
32
+ [ "@expression" ]
33
+ [ "@name" TEXT ]
34
+ [ "@label" TEXT ]
35
+ [ "@description" TEXT ]
36
+ [ "@scope" IDENTIFIER ]
37
+ [ "@executeWhen" IDENTIFIER ]
38
+ [ "@pullExecution" IDENTIFIER ]
39
+ [ "@color" TEXT ]
40
+ [ "@icon" TEXT ]
41
+ { "@tag" IDENTIFIER [ STRING ] }
42
+ { inputTag }
43
+ { outputTag }
44
+ { stepTag }
45
+ ```
46
+
47
+ ---
48
+
49
+ # Port Tags (Input / Output / Step)
50
+
51
+ These are parsed by the Chevrotain port grammar.
52
+
53
+ ## @input
54
+
55
+ ```
56
+ inputTag ::= "@input" ( bracketedInput | plainInput )
57
+ [ scopeClause ] { metadataBracket } [ descriptionClause ]
58
+
59
+ plainInput ::= IDENTIFIER
60
+ bracketedInput ::= "[" IDENTIFIER [ "=" defaultValue ] "]"
61
+
62
+ defaultValue ::= IDENTIFIER | INTEGER | STRING
63
+ ```
64
+
65
+ **Examples:**
66
+
67
+ ```
68
+ @input name plain required input
69
+ @input [name] optional input (no connection required)
70
+ @input [name=defaultValue] optional with default (identifier)
71
+ @input [name=42] optional with default (integer)
72
+ @input [name="hello"] optional with default (string)
73
+ @input name scope:myScope scoped input
74
+ @input name [order:2] with ordering metadata
75
+ @input name - Description text with description
76
+ ```
77
+
78
+ ## @output
79
+
80
+ ```
81
+ outputTag ::= "@output" IDENTIFIER
82
+ [ scopeClause ] { metadataBracket } [ descriptionClause ]
83
+ ```
84
+
85
+ **Examples:**
86
+
87
+ ```
88
+ @output result
89
+ @output result scope:myScope
90
+ @output result [order:1, placement:TOP]
91
+ @output result - The computed result
92
+ ```
93
+
94
+ ## @step
95
+
96
+ ```
97
+ stepTag ::= "@step" IDENTIFIER [ descriptionClause ]
98
+ ```
99
+
100
+ **Examples:**
101
+
102
+ ```
103
+ @step process
104
+ @step process - Runs the processing pipeline
105
+ ```
106
+
107
+ ---
108
+
109
+ # Shared Clauses
110
+
111
+ ```
112
+ scopeClause ::= "scope:" IDENTIFIER
113
+
114
+ metadataBracket ::= "[" metadataAttr { "," metadataAttr } "]"
115
+
116
+ metadataAttr ::= orderAttr | placementAttr | typeAttr | mergeStrategyAttr
117
+
118
+ orderAttr ::= "order:" INTEGER
119
+ placementAttr ::= "placement:" ( "TOP" | "BOTTOM" )
120
+ typeAttr ::= "type:" IDENTIFIER
121
+ mergeStrategyAttr ::= "mergeStrategy:" IDENTIFIER
122
+
123
+ descriptionClause ::= "-" TEXT
124
+ ```
125
+
126
+ Metadata brackets can be repeated: `@input name [order:1] [placement:TOP]`
127
+
128
+ ---
129
+
130
+ # Workflow Tags
131
+
132
+ A `@flowWeaver workflow` block accepts these tags:
133
+
134
+ ```
135
+ workflowBlock ::= "@flowWeaver workflow"
136
+ [ "@name" TEXT ]
137
+ [ "@description" TEXT ]
138
+ [ "@strictTypes" [ "false" ] ]
139
+ [ "@autoConnect" ]
140
+ { fwImportTag }
141
+ { "@param" paramTag }
142
+ { ( "@returns" | "@return" ) returnsTag }
143
+ { nodeTag }
144
+ { connectTag }
145
+ { pathTag }
146
+ { mapTag }
147
+ { positionTag }
148
+ { scopeTag }
149
+ ```
150
+
151
+ ## @strictTypes
152
+
153
+ ```
154
+ strictTypesTag ::= "@strictTypes" [ "false" ]
155
+ ```
156
+
157
+ Enables strict type checking for the workflow. When present (or with any value other than `"false"`), type warnings (LOSSY_TYPE_COERCION, UNUSUAL_TYPE_COERCION, TYPE_MISMATCH) are promoted to errors. Defaults to off when absent.
158
+
159
+ **Examples:**
160
+
161
+ ```
162
+ @strictTypes enables strict mode
163
+ @strictTypes false explicitly disables
164
+ ```
165
+
166
+ ## @autoConnect
167
+
168
+ ```
169
+ autoConnectTag ::= "@autoConnect"
170
+ ```
171
+
172
+ Enables automatic linear connection wiring for the workflow. When present, the compiler automatically wires nodes in declaration order (connecting compatible ports from previous nodes). No value is needed — presence enables the feature.
173
+
174
+ **Examples:**
175
+
176
+ ```
177
+ @autoConnect
178
+ ```
179
+
180
+ ## @fwImport
181
+
182
+ ```
183
+ fwImportTag ::= "@fwImport" IDENTIFIER IDENTIFIER "from" QUOTED_STRING
184
+
185
+ QUOTED_STRING ::= STRING | "'" { any character except "'" } "'"
186
+ ```
187
+
188
+ Import npm package functions or local module exports as node types. The imported function becomes an expression node that can be instantiated with `@node`. Both double and single quotes are accepted for the module specifier.
189
+
190
+ **Examples:**
191
+
192
+ ```
193
+ @fwImport npm/lodash/map map from "lodash"
194
+ @fwImport npm/date-fns/format format from "date-fns"
195
+ @fwImport local/utils/helper helper from './utils'
196
+ ```
197
+
198
+ - First identifier: node type name (used in `@node` tags, convention: `npm/pkg/fn` or `local/path/fn`)
199
+ - Second identifier: exported function name to import
200
+ - String: package name or relative path
201
+
202
+ Port types are inferred from TypeScript `.d.ts` files when available. Falls back to a stub with `ANY` result port if inference fails.
203
+
204
+ ## @node
205
+
206
+ ```
207
+ nodeTag ::= "@node" IDENTIFIER IDENTIFIER [ parentScopeRef ] { attributeBracket }
208
+
209
+ parentScopeRef ::= IDENTIFIER "." IDENTIFIER
210
+
211
+ attributeBracket ::= "[" nodeAttr { "," nodeAttr } "]"
212
+
213
+ nodeAttr ::= labelAttr | exprAttr | portOrderAttr | portLabelAttr
214
+ | minimizedAttr | pullExecutionAttr | sizeAttr
215
+ | colorAttr | iconAttr | tagsAttr
216
+
217
+ labelAttr ::= "label:" STRING
218
+ exprAttr ::= "expr:" IDENTIFIER "=" STRING { "," IDENTIFIER "=" STRING }
219
+ portOrderAttr ::= "portOrder:" IDENTIFIER "=" INTEGER { "," IDENTIFIER "=" INTEGER }
220
+ portLabelAttr ::= "portLabel:" IDENTIFIER "=" STRING { "," IDENTIFIER "=" STRING }
221
+ minimizedAttr ::= "minimized"
222
+ pullExecutionAttr ::= "pullExecution:" IDENTIFIER
223
+ sizeAttr ::= "size:" INTEGER INTEGER
224
+ colorAttr ::= "color:" STRING
225
+ iconAttr ::= "icon:" STRING
226
+ tagsAttr ::= "tags:" tagEntry { "," tagEntry }
227
+ tagEntry ::= STRING [ STRING ]
228
+ ```
229
+
230
+ Multiple attribute brackets are allowed (zero or more). Attributes can be split across brackets or combined in one.
231
+
232
+ **Examples:**
233
+
234
+ ```
235
+ @node myAdd Add
236
+ @node myAdd Add [label: "My Adder"]
237
+ @node myAdd Add parent.loopScope
238
+ @node myAdd Add [expr: a="x + 1", b="y * 2"]
239
+ @node myAdd Add [portOrder: a=1, b=2]
240
+ @node myAdd Add [minimized, label: "Compact"]
241
+ @node myAdd Add [pullExecution: trigger]
242
+ @node myAdd Add [size: 200 150]
243
+ @node myAdd Add [color: "#ff0000", icon: "math-plus"]
244
+ @node myAdd Add [tags: "math" "Math operation", "transform"]
245
+ @node myAdd Add [label: "hi"] [color: "#f00"]
246
+ ```
247
+
248
+ ## @connect
249
+
250
+ ```
251
+ connectTag ::= "@connect" portRef "->" portRef
252
+
253
+ portRef ::= IDENTIFIER "." IDENTIFIER [ ":" IDENTIFIER ]
254
+ ```
255
+
256
+ The optional `:IDENTIFIER` suffix is a scope qualifier.
257
+
258
+ **Examples:**
259
+
260
+ ```
261
+ @connect myAdd.result -> myLog.message
262
+ @connect loop.item -> process.input:loopScope
263
+ ```
264
+
265
+ ## @path
266
+
267
+ ```
268
+ pathTag ::= "@path" pathStep ( "->" pathStep )+
269
+ pathStep ::= IDENTIFIER [ ":" ( "ok" | "fail" ) ]
270
+ ```
271
+
272
+ Declare a complete execution route through the graph with scope walking for data ports. Steps separated by `->`, each optionally suffixed with `:ok` (default) or `:fail` to select `onSuccess` or `onFailure`.
273
+
274
+ **Examples:**
275
+
276
+ ```
277
+ @path Start -> validator -> classifier -> urgencyRouter:fail -> escalate -> Exit
278
+ @path Start -> validator:ok -> processor -> Exit
279
+ ```
280
+
281
+ - `:ok` follows `onSuccess` (default when no suffix)
282
+ - `:fail` follows `onFailure`
283
+ - Data ports auto-resolve by walking backward through the path to the nearest ancestor with a same-name output port (scope walking)
284
+ - Multiple `@path` lines can coexist; overlapping prefixes are deduplicated
285
+ - Manual `@connect` lines can supplement for cross-named ports
286
+
287
+ ## @position
288
+
289
+ ```
290
+ positionTag ::= "@position" IDENTIFIER INTEGER INTEGER
291
+ ```
292
+
293
+ **Examples:**
294
+
295
+ ```
296
+ @position myAdd 100 200
297
+ ```
298
+
299
+ ## @scope
300
+
301
+ ```
302
+ scopeTag ::= "@scope" scopeRef "[" IDENTIFIER { "," IDENTIFIER } "]"
303
+
304
+ scopeRef ::= IDENTIFIER | IDENTIFIER "." IDENTIFIER
305
+ ```
306
+
307
+ **Examples:**
308
+
309
+ ```
310
+ @scope loopScope [process, validate]
311
+ @scope container.inner [step1, step2]
312
+ ```
313
+
314
+ ## @map
315
+
316
+ ```
317
+ mapTag ::= "@map" IDENTIFIER IDENTIFIER [ "(" IDENTIFIER "->" IDENTIFIER ")" ]
318
+ "over" IDENTIFIER "." IDENTIFIER
319
+ ```
320
+
321
+ Declares a map (iteration) node that processes items from a source array port using a child node type. The optional port mapping overrides the default input/output port wiring.
322
+
323
+ **Examples:**
324
+
325
+ ```
326
+ @map loop process over scan.files
327
+ @map loop process(inputPort -> outputPort) over scan.files
328
+ ```
329
+
330
+ - First identifier: instance ID for the map node
331
+ - Second identifier: child node type to execute per item
332
+ - Optional port mapping: `(inputPort -> outputPort)` overrides default wiring
333
+ - `over` clause: `sourceNode.sourcePort` specifies the array to iterate
334
+
335
+ ## @param / @returns (workflow I/O)
336
+
337
+ ```
338
+ paramTag ::= IDENTIFIER [ scopeClause ] { metadataBracket } [ descriptionClause ]
339
+ returnsTag ::= IDENTIFIER [ scopeClause ] { metadataBracket } [ descriptionClause ]
340
+ ```
341
+
342
+ These follow the same clause syntax as port tags. `@return` is accepted as an alias for `@returns`.
343
+
344
+ ## @trigger (workflow-level, Inngest)
345
+
346
+ ```
347
+ triggerTag ::= "@trigger" ( "event=" STRING | "cron=" STRING )*
348
+ ```
349
+
350
+ Declares an event or cron trigger for Inngest deployment. Can specify event, cron, or both.
351
+
352
+ **Examples:**
353
+
354
+ ```
355
+ @trigger event="agent/request"
356
+ @trigger cron="0 9 * * *"
357
+ @trigger event="agent/request" cron="0 9 * * *"
358
+ ```
359
+
360
+ ## @cancelOn (workflow-level, Inngest)
361
+
362
+ ```
363
+ cancelOnTag ::= "@cancelOn" "event=" STRING [ "match=" STRING ] [ "timeout=" STRING ]
364
+ ```
365
+
366
+ Cancels a running Inngest function when a specified event is received.
367
+
368
+ **Examples:**
369
+
370
+ ```
371
+ @cancelOn event="app/user.deleted"
372
+ @cancelOn event="app/user.deleted" match="data.userId"
373
+ @cancelOn event="x" match="data.id" timeout="1h"
374
+ ```
375
+
376
+ ## @retries (workflow-level, Inngest)
377
+
378
+ ```
379
+ retriesTag ::= "@retries" INTEGER
380
+ ```
381
+
382
+ Sets the retry count for an Inngest function (overrides default of 3).
383
+
384
+ **Examples:**
385
+
386
+ ```
387
+ @retries 5
388
+ @retries 0
389
+ ```
390
+
391
+ ## @timeout (workflow-level, Inngest)
392
+
393
+ ```
394
+ timeoutTag ::= "@timeout" STRING
395
+ ```
396
+
397
+ Sets the maximum execution time for an Inngest function.
398
+
399
+ **Examples:**
400
+
401
+ ```
402
+ @timeout "30m"
403
+ @timeout "2h"
404
+ ```
405
+
406
+ ## @throttle (workflow-level, Inngest)
407
+
408
+ ```
409
+ throttleTag ::= "@throttle" "limit=" INTEGER [ "period=" STRING ]
410
+ ```
411
+
412
+ Limits concurrent executions of an Inngest function.
413
+
414
+ **Examples:**
415
+
416
+ ```
417
+ @throttle limit=3 period="1m"
418
+ @throttle limit=10
419
+ ```
420
+
421
+ ---
422
+
423
+ # Pattern Tags
424
+
425
+ A `@flowWeaver pattern` block defines a reusable partial workflow with boundary ports:
426
+
427
+ ```
428
+ patternBlock ::= "@flowWeaver pattern"
429
+ [ "@name" TEXT ]
430
+ [ "@description" TEXT ]
431
+ { nodeTag }
432
+ { positionTag }
433
+ { connectTag }
434
+ { portTag }
435
+
436
+ portTag ::= "@port" ( "IN" | "OUT" ) "." IDENTIFIER [ "-" TEXT ]
437
+ ```
438
+
439
+ Pattern ports define the boundary connections (IN for inputs, OUT for outputs) that are wired when the pattern is applied to a workflow.
440
+
441
+ **Examples:**
442
+
443
+ ```
444
+ @port IN.data - Input data to process
445
+ @port OUT.result - Processed result
446
+ @port IN.config - Configuration object
447
+ @port OUT.error - Error output
448
+ ```
449
+
450
+ ---
451
+
452
+ # Terminals
453
+
454
+ <!-- AUTO:START terminals -->
455
+ ```
456
+ IDENTIFIER ::= [a-zA-Z_$] [a-zA-Z0-9_$\/-]*
457
+ INTEGER ::= "-"? [0-9]+
458
+ STRING ::= '"' { any character except '"' or '\', or escape sequence } '"'
459
+ TEXT ::= any characters to end of line
460
+ ```
461
+ IDENTIFIER supports `/` and `-` to accommodate npm package naming conventions (e.g., `npm/react-window/areEqual`).
462
+ <!-- AUTO:END terminals -->
463
+
464
+ ---
465
+
466
+ # Related Topics
467
+
468
+ - `advanced-annotations` — Conceptual explanations and examples for pull execution, execution strategies, merge strategies, auto-connect, strict types, path/map sugar, and node attributes
469
+ - `compilation` — How annotations affect code generation, Inngest target details for @trigger/@cancelOn/@retries/@timeout/@throttle
470
+ - `concepts` — Core workflow fundamentals and quick reference
471
+ - `error-codes` — Validation errors and warnings for annotation issues
@@ -0,0 +1,205 @@
1
+ ---
2
+ name: Marketplace
3
+ description: Create, publish, install, and manage Flow Weaver marketplace packages and external plugins
4
+ keywords: [marketplace, market, package, publish, install, search, npm, flowweaver-pack, plugin, init, manifest, node types, patterns, workflows, component, area, sandbox]
5
+ ---
6
+
7
+ # Marketplace
8
+
9
+ The Flow Weaver marketplace is an npm-based ecosystem for sharing reusable node types, workflows, and patterns. Packages follow the `flowweaver-pack-*` naming convention and are discoverable via npm search.
10
+
11
+ ## Overview
12
+
13
+ | What | Purpose |
14
+ |------|---------|
15
+ | **Node types** | Reusable `@flowWeaver nodeType` functions |
16
+ | **Workflows** | Complete `@flowWeaver workflow` exports |
17
+ | **Patterns** | Reusable `@flowWeaver pattern` fragments |
18
+
19
+ A single package can contain any combination of these.
20
+
21
+ ---
22
+
23
+ ## Using Packages
24
+
25
+ ### Search
26
+
27
+ Find packages on npm:
28
+
29
+ ```bash
30
+ flow-weaver market search openai
31
+ flow-weaver market search # Browse all packages
32
+ flow-weaver market search llm --limit 5
33
+ ```
34
+
35
+ For private registries:
36
+
37
+ ```bash
38
+ flow-weaver market search openai --registry https://npm.internal.com
39
+ ```
40
+
41
+ ### Install
42
+
43
+ Install a package:
44
+
45
+ ```bash
46
+ flow-weaver market install flowweaver-pack-openai
47
+ flow-weaver market install flowweaver-pack-openai@1.0.0
48
+ ```
49
+
50
+ After installation, the package's node types, workflows, and patterns are available for use in your workflows via `@fwImport`.
51
+
52
+ ### List Installed
53
+
54
+ ```bash
55
+ flow-weaver market list
56
+ ```
57
+
58
+ Shows all installed `flowweaver-pack-*` packages with their available node types, workflows, and patterns.
59
+
60
+ ---
61
+
62
+ ## Creating Packages
63
+
64
+ ### Scaffold
65
+
66
+ Create a new marketplace package:
67
+
68
+ ```bash
69
+ flow-weaver market init openai
70
+ ```
71
+
72
+ This creates a `flowweaver-pack-openai/` directory with:
73
+ - `package.json` — Configured with `flowweaver-pack` keyword
74
+ - `src/` — Source directory for node types, workflows, and patterns
75
+ - `tsconfig.json` — TypeScript configuration
76
+
77
+ Options:
78
+
79
+ ```bash
80
+ flow-weaver market init openai --description "OpenAI nodes for Flow Weaver" --author "Your Name"
81
+ flow-weaver market init openai -y # Skip prompts
82
+ ```
83
+
84
+ ### Package Structure
85
+
86
+ ```
87
+ flowweaver-pack-openai/
88
+ src/
89
+ nodes/
90
+ chat-completion.ts # @flowWeaver nodeType functions
91
+ embeddings.ts
92
+ workflows/
93
+ rag-pipeline.ts # @flowWeaver workflow functions
94
+ patterns/
95
+ retry-with-backoff.ts # @flowWeaver pattern functions
96
+ package.json
97
+ tsconfig.json
98
+ ```
99
+
100
+ ### Validate & Pack
101
+
102
+ Validate your package and generate the manifest:
103
+
104
+ ```bash
105
+ flow-weaver market pack
106
+ flow-weaver market pack --verbose # Show parse warnings
107
+ ```
108
+
109
+ This:
110
+ 1. Scans all TypeScript files for `@flowWeaver` annotations
111
+ 2. Validates against 12 marketplace-specific rules
112
+ 3. Generates `flowweaver.manifest.json` with metadata about all exports
113
+
114
+ ### Publish
115
+
116
+ Publish to npm:
117
+
118
+ ```bash
119
+ flow-weaver market publish
120
+ flow-weaver market publish --dry-run # Preview without publishing
121
+ flow-weaver market publish --tag beta # Publish with dist-tag
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Marketplace Validation Rules
127
+
128
+ The `market pack` command validates packages against additional rules beyond standard workflow validation:
129
+
130
+ - Package name must start with `flowweaver-pack-`
131
+ - Must include `flowweaver-pack` keyword in `package.json`
132
+ - All exported node types must have proper annotations
133
+ - All exported workflows must validate successfully
134
+ - No conflicting node type names
135
+ - Proper TypeScript compilation
136
+ - Manifest generation succeeds
137
+
138
+ ---
139
+
140
+ ## External Plugins
141
+
142
+ Plugins extend the Flow Weaver Studio IDE with custom UI components, system logic, and integrations.
143
+
144
+ ### Scaffold a Plugin
145
+
146
+ ```bash
147
+ flow-weaver plugin init my-plugin
148
+ ```
149
+
150
+ Options:
151
+
152
+ | Flag | Description | Default |
153
+ |------|-------------|---------|
154
+ | `-a, --area <area>` | Component area | `panel` |
155
+ | `--no-system` | Skip system module | included |
156
+ | `-p, --preview` | Preview without writing | `false` |
157
+ | `--force` | Overwrite existing | `false` |
158
+
159
+ ### Component Areas
160
+
161
+ Plugins register React components in specific areas of the Studio IDE:
162
+
163
+ | Area | Location |
164
+ |------|----------|
165
+ | `sidebar` | Left sidebar panel |
166
+ | `main` | Main content area |
167
+ | `toolbar` | Top toolbar |
168
+ | `modal` | Modal dialog |
169
+ | `panel` | Bottom or side panel |
170
+
171
+ ### Plugin Structure
172
+
173
+ ```bash
174
+ flow-weaver plugin init my-plugin --area sidebar
175
+ ```
176
+
177
+ Generates:
178
+ ```
179
+ my-plugin/
180
+ src/
181
+ index.ts # Plugin manifest and registration
182
+ component.tsx # React component for the area
183
+ system.ts # System module (event handlers, state)
184
+ package.json
185
+ ```
186
+
187
+ ### Capability Sandboxing
188
+
189
+ Plugins declare required capabilities. The runtime enforces access controls:
190
+
191
+ | Capability | Allows |
192
+ |------------|--------|
193
+ | `filesystem` | Read/write workflow files |
194
+ | `network` | HTTP requests |
195
+ | `process` | Spawn processes |
196
+ | `interop` | Communicate with other plugins |
197
+
198
+ ---
199
+
200
+ ## Related Topics
201
+
202
+ - [CLI Reference](cli-reference) — Full marketplace and plugin command flags
203
+ - [Patterns](patterns) — Creating and sharing reusable patterns
204
+ - [Scaffold](scaffold) — Template system for node types and workflows
205
+ - [Concepts](concepts) — Core workflow fundamentals