@synergenius/flow-weaver 0.17.0 → 0.17.2
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/api/index.d.ts +4 -1
- package/dist/api/index.js +4 -1
- package/dist/api/templates.js +2 -2
- package/dist/api/validate.d.ts +2 -2
- package/dist/api/validate.js +6 -6
- package/dist/api/validation-registry.d.ts +10 -0
- package/dist/api/validation-registry.js +10 -0
- package/dist/ast/types.d.ts +91 -4
- package/dist/built-in-nodes/invoke-workflow.d.ts +1 -1
- package/dist/built-in-nodes/invoke-workflow.js +1 -1
- package/dist/chevrotain-parser/connect-parser.js +25 -7
- package/dist/cli/commands/compile.d.ts +5 -9
- package/dist/cli/commands/compile.js +21 -14
- package/dist/cli/commands/dev.d.ts +2 -13
- package/dist/cli/commands/dev.js +10 -204
- package/dist/cli/commands/doctor.js +6 -3
- package/dist/cli/commands/export.d.ts +8 -17
- package/dist/cli/commands/export.js +8 -17
- package/dist/cli/commands/init-personas.d.ts +17 -6
- package/dist/cli/commands/init-personas.js +73 -24
- package/dist/cli/commands/init.d.ts +5 -2
- package/dist/cli/commands/init.js +73 -42
- package/dist/cli/commands/mcp-setup.d.ts +7 -0
- package/dist/cli/commands/mcp-setup.js +16 -1
- package/dist/cli/flow-weaver.mjs +71002 -70385
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +9 -7
- package/dist/cli/templates/index.d.ts +20 -1
- package/dist/cli/templates/index.js +66 -15
- package/dist/cli/templates/nodes/human-approval.js +2 -3
- package/dist/cli/templates/nodes/rag-retriever.js +1 -1
- package/dist/constants.d.ts +7 -0
- package/dist/constants.js +13 -3
- package/dist/context/index.js +13 -3
- package/dist/deployment/config/loader.js +2 -1
- package/dist/deployment/core/adapters.d.ts +1 -25
- package/dist/deployment/core/adapters.js +0 -95
- package/dist/deployment/core/formatters.d.ts +0 -15
- package/dist/deployment/core/formatters.js +0 -24
- package/dist/deployment/index.d.ts +7 -5
- package/dist/deployment/index.js +8 -5
- package/dist/deployment/types.d.ts +2 -45
- package/dist/diagram/html-viewer.js +65 -32
- package/dist/diagram/renderer.js +9 -6
- package/dist/diagram/theme.js +4 -0
- package/dist/diagram/types.d.ts +2 -0
- package/dist/doc-metadata/extractors/annotations.js +5 -5
- package/dist/doc-metadata/extractors/cli-commands.js +1 -1
- package/dist/doc-metadata/extractors/mcp-tools.js +1 -2
- package/dist/docs/index.d.ts +28 -1
- package/dist/docs/index.js +95 -28
- package/dist/export/index.d.ts +2 -3
- package/dist/{deployment/targets/cicd-base.d.ts → extensions/cicd/base-target.d.ts} +35 -36
- package/dist/{deployment/targets/cicd-base.js → extensions/cicd/base-target.js} +97 -57
- package/dist/{validation/cicd-detection.d.ts → extensions/cicd/detection.d.ts} +2 -2
- package/dist/{validation/cicd-detection.js → extensions/cicd/detection.js} +13 -1
- package/dist/extensions/cicd/docs/cicd.md +395 -0
- package/dist/extensions/cicd/index.d.ts +10 -0
- package/dist/extensions/cicd/index.js +10 -0
- package/dist/extensions/cicd/register.d.ts +11 -0
- package/dist/extensions/cicd/register.js +62 -0
- package/dist/extensions/cicd/rules.d.ts +30 -0
- package/dist/{validation/cicd-rules.js → extensions/cicd/rules.js} +60 -56
- package/dist/extensions/cicd/tag-handler.d.ts +14 -0
- package/dist/extensions/cicd/tag-handler.js +488 -0
- package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-docker.d.ts +1 -1
- package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-matrix.d.ts +1 -1
- package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-multi-env.d.ts +1 -1
- package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-test-deploy.d.ts +1 -1
- package/dist/extensions/index.d.ts +12 -0
- package/dist/extensions/index.js +12 -0
- package/dist/extensions/inngest/dev-mode.d.ts +9 -0
- package/dist/extensions/inngest/dev-mode.js +213 -0
- package/dist/{generator/inngest.d.ts → extensions/inngest/generator.d.ts} +2 -2
- package/dist/{generator/inngest.js → extensions/inngest/generator.js} +4 -4
- package/dist/extensions/inngest/index.d.ts +2 -0
- package/dist/extensions/inngest/index.js +2 -0
- package/dist/extensions/inngest/register.d.ts +6 -0
- package/dist/extensions/inngest/register.js +23 -0
- package/dist/extensions/inngest/templates/ai-agent-durable.d.ts +8 -0
- package/dist/{cli/templates/workflows → extensions/inngest/templates}/ai-agent-durable.js +8 -8
- package/dist/{cli/templates/workflows → extensions/inngest/templates}/ai-pipeline-durable.d.ts +2 -2
- package/dist/{cli/templates/workflows → extensions/inngest/templates}/ai-pipeline-durable.js +7 -7
- package/dist/generated-version.d.ts +1 -1
- package/dist/generated-version.js +1 -1
- package/dist/generator/compile-target-registry.d.ts +20 -0
- package/dist/generator/compile-target-registry.js +20 -0
- package/dist/generator/dev-mode-registry.d.ts +27 -0
- package/dist/generator/dev-mode-registry.js +20 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/jsdoc-parser.d.ts +12 -114
- package/dist/jsdoc-parser.js +57 -362
- package/dist/marketplace/index.d.ts +2 -2
- package/dist/marketplace/index.js +1 -1
- package/dist/marketplace/registry.d.ts +39 -1
- package/dist/marketplace/registry.js +77 -0
- package/dist/marketplace/types.d.ts +76 -3
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/server.js +2 -0
- package/dist/mcp/tools-export.js +3 -3
- package/dist/mcp/tools-query.js +17 -11
- package/dist/mcp/tools-template.js +1 -1
- package/dist/parser/tag-registry.d.ts +47 -0
- package/dist/parser/tag-registry.js +57 -0
- package/dist/parser.d.ts +3 -0
- package/dist/parser.js +10 -23
- package/dist/validation/rule-registry.d.ts +36 -0
- package/dist/validation/rule-registry.js +37 -0
- package/dist/validator.js +3 -3
- package/docs/reference/concepts.md +2 -1
- package/docs/reference/deployment.md +21 -0
- package/docs/reference/jsdoc-grammar.md +242 -1
- package/docs/reference/scaffold.md +0 -6
- package/package.json +9 -1
- package/dist/cli/templates/workflows/ai-agent-durable.d.ts +0 -8
- package/dist/export/templates.d.ts +0 -24
- package/dist/export/templates.js +0 -186
- package/dist/validation/cicd-rules.d.ts +0 -62
- /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-docker.js +0 -0
- /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-matrix.js +0 -0
- /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-multi-env.js +0 -0
- /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-test-deploy.js +0 -0
|
@@ -105,6 +105,26 @@ Generates:
|
|
|
105
105
|
|
|
106
106
|
---
|
|
107
107
|
|
|
108
|
+
## CI/CD Pipeline Export
|
|
109
|
+
|
|
110
|
+
CI/CD export works differently from serverless export. Instead of generating a handler that runs your workflow at request time, it reads the workflow graph and produces native pipeline YAML. The generated file has no runtime dependency on Flow Weaver.
|
|
111
|
+
|
|
112
|
+
Use CI/CD-specific annotations (`@secret`, `@runner`, `@cache`, `@artifact`, `@environment`, `@matrix`, `@service`, `@concurrency`) alongside `@node` and `@connect` to define pipeline structure. The `[job: "name"]` attribute on `@node` groups nodes into jobs. Triggers use `@trigger push`, `@trigger pull_request`, etc.
|
|
113
|
+
|
|
114
|
+
Secrets are wired as pseudo-node connections: `@connect secret:TOKEN -> node.port`. The export target renders these as platform-native secret references (`${{ secrets.TOKEN }}` for GitHub, `$NPM_TOKEN` for GitLab).
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# GitHub Actions
|
|
118
|
+
flow-weaver export pipeline.ts --target github-actions --output .github/workflows/
|
|
119
|
+
|
|
120
|
+
# GitLab CI
|
|
121
|
+
flow-weaver export pipeline.ts --target gitlab-ci --output .
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
See the [CI/CD Pipelines](cicd) topic for the complete annotation reference, validation rules, and full examples.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
108
128
|
## Multi-Workflow Export
|
|
109
129
|
|
|
110
130
|
Export all workflows in a file as a **unified service** with routing, function registry, and optional API documentation:
|
|
@@ -241,6 +261,7 @@ This:
|
|
|
241
261
|
|
|
242
262
|
## Related Topics
|
|
243
263
|
|
|
264
|
+
- [CI/CD Pipelines](cicd) — CI/CD annotation reference, secret wiring, job grouping, validation rules
|
|
244
265
|
- [CLI Reference](cli-reference) — Full command flags for export, serve, openapi
|
|
245
266
|
- [Compilation](compilation) — Inngest target details and serve handlers
|
|
246
267
|
- [Built-in Nodes](built-in-nodes) — Mock system for local testing
|
|
@@ -213,6 +213,7 @@ attributeBracket ::= "[" nodeAttr { "," nodeAttr } "]"
|
|
|
213
213
|
nodeAttr ::= labelAttr | exprAttr | portOrderAttr | portLabelAttr
|
|
214
214
|
| minimizedAttr | pullExecutionAttr | sizeAttr
|
|
215
215
|
| colorAttr | iconAttr | tagsAttr | positionAttr
|
|
216
|
+
| jobAttr | environmentAttr
|
|
216
217
|
|
|
217
218
|
labelAttr ::= "label:" STRING
|
|
218
219
|
exprAttr ::= "expr:" IDENTIFIER "=" STRING { "," IDENTIFIER "=" STRING }
|
|
@@ -226,6 +227,8 @@ iconAttr ::= "icon:" STRING
|
|
|
226
227
|
tagsAttr ::= "tags:" tagEntry { "," tagEntry }
|
|
227
228
|
tagEntry ::= STRING [ STRING ]
|
|
228
229
|
positionAttr ::= "position:" INTEGER INTEGER
|
|
230
|
+
jobAttr ::= "job:" STRING
|
|
231
|
+
environmentAttr ::= "environment:" STRING
|
|
229
232
|
```
|
|
230
233
|
|
|
231
234
|
Multiple attribute brackets are allowed (zero or more). Attributes can be split across brackets or combined in one.
|
|
@@ -245,6 +248,8 @@ Multiple attribute brackets are allowed (zero or more). Attributes can be split
|
|
|
245
248
|
@node myAdd Add [tags: "math" "Math operation", "transform"]
|
|
246
249
|
@node myAdd Add [position: 180 0]
|
|
247
250
|
@node myAdd Add [label: "hi"] [color: "#f00"] [position: 360 0]
|
|
251
|
+
@node build npmBuild [job: "build"]
|
|
252
|
+
@node deploy deploySsh [job: "deploy"] [environment: "production"]
|
|
248
253
|
```
|
|
249
254
|
|
|
250
255
|
## @connect
|
|
@@ -253,15 +258,17 @@ Multiple attribute brackets are allowed (zero or more). Attributes can be split
|
|
|
253
258
|
connectTag ::= "@connect" portRef "->" portRef
|
|
254
259
|
|
|
255
260
|
portRef ::= IDENTIFIER "." IDENTIFIER [ ":" IDENTIFIER ]
|
|
261
|
+
| IDENTIFIER ":" IDENTIFIER
|
|
256
262
|
```
|
|
257
263
|
|
|
258
|
-
The optional `:
|
|
264
|
+
The first form is the standard `node.port` reference with optional `:scope` suffix. The second form is a pseudo-node reference for CI/CD secrets: `secret:NAME` resolves to `{ nodeId: "secret:NAME", portName: "value" }`.
|
|
259
265
|
|
|
260
266
|
**Examples:**
|
|
261
267
|
|
|
262
268
|
```
|
|
263
269
|
@connect myAdd.result -> myLog.message
|
|
264
270
|
@connect loop.item -> process.input:loopScope
|
|
271
|
+
@connect secret:NPM_TOKEN -> publish.token
|
|
265
272
|
```
|
|
266
273
|
|
|
267
274
|
## @path
|
|
@@ -425,6 +432,239 @@ Limits concurrent executions of an Inngest function.
|
|
|
425
432
|
|
|
426
433
|
---
|
|
427
434
|
|
|
435
|
+
# CI/CD Workflow Annotations
|
|
436
|
+
|
|
437
|
+
These tags configure CI/CD pipeline behavior when exporting to GitHub Actions or GitLab CI. They are placed inside `@flowWeaver workflow` blocks alongside standard workflow tags.
|
|
438
|
+
|
|
439
|
+
## @trigger (CI/CD mode)
|
|
440
|
+
|
|
441
|
+
When the trigger value is one of `push`, `pull_request`, `dispatch`, `tag`, or `schedule`, the parser treats it as a CI/CD trigger rather than an Inngest event trigger.
|
|
442
|
+
|
|
443
|
+
```
|
|
444
|
+
cicdTriggerTag ::= "@trigger" ( "push" | "pull_request" | "dispatch" | "tag" | "schedule" )
|
|
445
|
+
{ IDENTIFIER "=" STRING }
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
Recognized attributes: `branches`, `paths`, `paths-ignore`, `types`, `pattern`, `cron`.
|
|
449
|
+
|
|
450
|
+
**Examples:**
|
|
451
|
+
|
|
452
|
+
```
|
|
453
|
+
@trigger push branches="main,develop"
|
|
454
|
+
@trigger pull_request branches="main" types="opened,synchronize"
|
|
455
|
+
@trigger tag pattern="v*"
|
|
456
|
+
@trigger dispatch
|
|
457
|
+
@trigger schedule cron="0 9 * * 1"
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
## @secret
|
|
461
|
+
|
|
462
|
+
```
|
|
463
|
+
secretTag ::= "@secret" IDENTIFIER { IDENTIFIER "=" STRING } [ "-" TEXT ]
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
**Examples:**
|
|
467
|
+
|
|
468
|
+
```
|
|
469
|
+
@secret NPM_TOKEN - NPM authentication token
|
|
470
|
+
@secret DEPLOY_KEY scope="deploy" platform="github" - SSH deploy key
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
## @runner
|
|
474
|
+
|
|
475
|
+
```
|
|
476
|
+
runnerTag ::= "@runner" TEXT
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
**Examples:**
|
|
480
|
+
|
|
481
|
+
```
|
|
482
|
+
@runner ubuntu-latest
|
|
483
|
+
@runner self-hosted
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
## @cache
|
|
487
|
+
|
|
488
|
+
```
|
|
489
|
+
cacheTag ::= "@cache" IDENTIFIER { IDENTIFIER "=" STRING }
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
**Examples:**
|
|
493
|
+
|
|
494
|
+
```
|
|
495
|
+
@cache npm key="package-lock.json"
|
|
496
|
+
@cache npm key="package-lock.json" path="~/.npm"
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
## @artifact
|
|
500
|
+
|
|
501
|
+
```
|
|
502
|
+
artifactTag ::= "@artifact" IDENTIFIER { IDENTIFIER "=" ( STRING | INTEGER ) }
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
**Examples:**
|
|
506
|
+
|
|
507
|
+
```
|
|
508
|
+
@artifact dist path="dist/" retention=5
|
|
509
|
+
@artifact coverage path="coverage/"
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
## @environment
|
|
513
|
+
|
|
514
|
+
```
|
|
515
|
+
environmentTag ::= "@environment" IDENTIFIER { IDENTIFIER "=" ( STRING | INTEGER ) }
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
**Examples:**
|
|
519
|
+
|
|
520
|
+
```
|
|
521
|
+
@environment production url="https://app.example.com" reviewers=2
|
|
522
|
+
@environment staging
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
## @matrix
|
|
526
|
+
|
|
527
|
+
```
|
|
528
|
+
matrixTag ::= "@matrix" [ "include" | "exclude" ] { IDENTIFIER "=" STRING }
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
Without a prefix, each key-value pair declares a dimension with comma-separated values. With `include` or `exclude`, it adds or removes a specific combination.
|
|
532
|
+
|
|
533
|
+
**Examples:**
|
|
534
|
+
|
|
535
|
+
```
|
|
536
|
+
@matrix node="18,20,22" os="ubuntu-latest,macos-latest"
|
|
537
|
+
@matrix include node="22" os="windows-latest"
|
|
538
|
+
@matrix exclude node="18" os="macos-latest"
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
## @service
|
|
542
|
+
|
|
543
|
+
```
|
|
544
|
+
serviceTag ::= "@service" IDENTIFIER { IDENTIFIER "=" STRING }
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
**Examples:**
|
|
548
|
+
|
|
549
|
+
```
|
|
550
|
+
@service postgres image="postgres:16" env="POSTGRES_PASSWORD=test" ports="5432:5432"
|
|
551
|
+
@service redis image="redis:7" ports="6379:6379"
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
## @concurrency
|
|
555
|
+
|
|
556
|
+
```
|
|
557
|
+
concurrencyTag ::= "@concurrency" IDENTIFIER [ "cancel-in-progress=" ( "true" | "false" ) ]
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
**Examples:**
|
|
561
|
+
|
|
562
|
+
```
|
|
563
|
+
@concurrency deploy cancel-in-progress=true
|
|
564
|
+
@concurrency ci-main
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
## @job
|
|
568
|
+
|
|
569
|
+
Configures per-job settings. The name must match a `[job: "name"]` attribute used on `@node` declarations.
|
|
570
|
+
|
|
571
|
+
```
|
|
572
|
+
jobTag ::= "@job" IDENTIFIER { IDENTIFIER "=" ( STRING | IDENTIFIER | INTEGER ) }
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
Recognized keys: `retry` (number), `allow_failure` (boolean), `timeout` (string), `runner` (string), `tags` (comma-list), `coverage` (string), `reports` (comma-list of type=path), `rules` (string), `extends` (string), `before_script` (comma-list), `variables` (comma-list of KEY=VALUE).
|
|
576
|
+
|
|
577
|
+
**Examples:**
|
|
578
|
+
|
|
579
|
+
```
|
|
580
|
+
@job build retry=2 timeout="10m"
|
|
581
|
+
@job test-unit coverage='/Coverage: (\d+)%/' reports="junit=test-results.xml"
|
|
582
|
+
@job deploy allow_failure=true rules="$CI_COMMIT_BRANCH == main"
|
|
583
|
+
@job lint tags="docker,linux" extends=".base-lint"
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
## @stage
|
|
587
|
+
|
|
588
|
+
Declares a pipeline stage for GitLab CI grouping. Multiple `@stage` annotations define stage ordering.
|
|
589
|
+
|
|
590
|
+
```
|
|
591
|
+
stageTag ::= "@stage" IDENTIFIER
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
**Examples:**
|
|
595
|
+
|
|
596
|
+
```
|
|
597
|
+
@stage test
|
|
598
|
+
@stage build
|
|
599
|
+
@stage deploy
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
## @variables
|
|
603
|
+
|
|
604
|
+
Sets workflow-level environment variables. Applied as defaults to all jobs.
|
|
605
|
+
|
|
606
|
+
```
|
|
607
|
+
variablesTag ::= "@variables" { IDENTIFIER "=" ( STRING | IDENTIFIER ) }
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
**Examples:**
|
|
611
|
+
|
|
612
|
+
```
|
|
613
|
+
@variables NODE_ENV="production" CI="true"
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
## @before_script
|
|
617
|
+
|
|
618
|
+
Sets workflow-level setup commands. Applied as defaults to all jobs.
|
|
619
|
+
|
|
620
|
+
```
|
|
621
|
+
beforeScriptTag ::= "@before_script" ( STRING | TEXT )
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
**Examples:**
|
|
625
|
+
|
|
626
|
+
```
|
|
627
|
+
@before_script "npm ci"
|
|
628
|
+
@before_script npm ci
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
## @tags
|
|
632
|
+
|
|
633
|
+
Sets workflow-level runner tags. Applied as defaults to all jobs.
|
|
634
|
+
|
|
635
|
+
```
|
|
636
|
+
tagsTag ::= "@tags" { IDENTIFIER }
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
Tags can be space-separated or comma-separated.
|
|
640
|
+
|
|
641
|
+
**Examples:**
|
|
642
|
+
|
|
643
|
+
```
|
|
644
|
+
@tags docker linux
|
|
645
|
+
@tags docker,linux,arm64
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
## @includes
|
|
649
|
+
|
|
650
|
+
Declares external configuration files to include (GitLab CI). Ignored for GitHub Actions.
|
|
651
|
+
|
|
652
|
+
```
|
|
653
|
+
includesTag ::= "@includes" ( "local" | "template" | "remote" | "project" ) "=" STRING
|
|
654
|
+
[ "file=" STRING ] [ "ref=" STRING ]
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
**Examples:**
|
|
658
|
+
|
|
659
|
+
```
|
|
660
|
+
@includes local="ci/shared-templates.yml"
|
|
661
|
+
@includes template="Auto-DevOps.gitlab-ci.yml"
|
|
662
|
+
@includes remote="https://example.com/ci.yml"
|
|
663
|
+
@includes project="other-group/other-project" file="ci/shared.yml" ref="main"
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
---
|
|
667
|
+
|
|
428
668
|
# Pattern Tags
|
|
429
669
|
|
|
430
670
|
A `@flowWeaver pattern` block defines a reusable partial workflow with boundary ports:
|
|
@@ -471,6 +711,7 @@ IDENTIFIER supports `/` and `-` to accommodate npm package naming conventions (e
|
|
|
471
711
|
# Related Topics
|
|
472
712
|
|
|
473
713
|
- `advanced-annotations` — Conceptual explanations and examples for pull execution, execution strategies, merge strategies, auto-connect, strict types, path/map sugar, and node attributes
|
|
714
|
+
- `cicd` — CI/CD pipeline export with annotation examples and validation rules
|
|
474
715
|
- `compilation` — How annotations affect code generation, Inngest target details for @trigger/@cancelOn/@retries/@timeout/@throttle
|
|
475
716
|
- `concepts` — Core workflow fundamentals and quick reference
|
|
476
717
|
- `error-codes` — Validation errors and warnings for annotation issues
|
|
@@ -92,12 +92,6 @@ flow-weaver templates [--json]
|
|
|
92
92
|
| `aggregator` | Combine multiple data sources into one output |
|
|
93
93
|
| `webhook` | HTTP-triggered workflow with request/response handling |
|
|
94
94
|
| `error-handler` | Try/catch/retry pattern with error recovery |
|
|
95
|
-
| `ai-agent-durable` | Linear agent pipeline with durability — classify, tools, approval, respond |
|
|
96
|
-
| `ai-pipeline-durable` | Sequential data pipeline with durability — fetch, extract, validate, save |
|
|
97
|
-
| `cicd-test-deploy` | Standard test-and-deploy pipeline with checkout, setup, test, build, and deploy stages |
|
|
98
|
-
| `cicd-docker` | Build and push Docker images to a container registry |
|
|
99
|
-
| `cicd-multi-env` | Multi-environment deployment pipeline with staging and production stages |
|
|
100
|
-
| `cicd-matrix` | Test across multiple Node.js versions and operating systems |
|
|
101
95
|
<!-- AUTO:END workflow_templates_table -->
|
|
102
96
|
|
|
103
97
|
## Node Templates
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synergenius/flow-weaver",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"description": "Deterministic workflow compiler for AI agents. Compiles to standalone TypeScript, no runtime dependencies.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -70,6 +70,14 @@
|
|
|
70
70
|
"./testing": {
|
|
71
71
|
"types": "./dist/testing/index.d.ts",
|
|
72
72
|
"default": "./dist/testing/index.js"
|
|
73
|
+
},
|
|
74
|
+
"./extensions/inngest": {
|
|
75
|
+
"types": "./dist/extensions/inngest/index.d.ts",
|
|
76
|
+
"default": "./dist/extensions/inngest/index.js"
|
|
77
|
+
},
|
|
78
|
+
"./extensions/cicd": {
|
|
79
|
+
"types": "./dist/extensions/cicd/index.d.ts",
|
|
80
|
+
"default": "./dist/extensions/cicd/index.js"
|
|
73
81
|
}
|
|
74
82
|
},
|
|
75
83
|
"bin": {
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Durable AI Agent Template
|
|
3
|
-
* Linear agent pipeline with durability annotations for Inngest compilation.
|
|
4
|
-
* Each node maps to a checkpointed step when compiled with: fw export --target inngest
|
|
5
|
-
*/
|
|
6
|
-
import type { WorkflowTemplate } from '../index.js';
|
|
7
|
-
export declare const aiAgentDurableTemplate: WorkflowTemplate;
|
|
8
|
-
//# sourceMappingURL=ai-agent-durable.d.ts.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Serverless handler templates for different platforms
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* AWS Lambda handler template
|
|
6
|
-
*/
|
|
7
|
-
export declare const LAMBDA_TEMPLATE = "{{GENERATED_HEADER}}\nimport type { APIGatewayProxyEventV2, APIGatewayProxyResultV2, Context } from 'aws-lambda';\n{{WORKFLOW_IMPORT}}\n\nexport const handler = async (\n event: APIGatewayProxyEventV2,\n context: Context\n): Promise<APIGatewayProxyResultV2> => {\n context.callbackWaitsForEmptyEventLoop = false;\n\n try {\n const body = typeof event.body === 'string'\n ? JSON.parse(event.body || '{}')\n : event.body || {};\n\n const startTime = Date.now();\n const result = await {{FUNCTION_NAME}}(true, body);\n\n return {\n statusCode: 200,\n headers: {\n 'Content-Type': 'application/json',\n 'X-Execution-Time': `${Date.now() - startTime}ms`,\n },\n body: JSON.stringify({ success: true, result }),\n };\n } catch (error) {\n return {\n statusCode: 500,\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n success: false,\n error: error instanceof Error ? error.message : String(error),\n requestId: context.awsRequestId,\n }),\n };\n }\n};\n";
|
|
8
|
-
/**
|
|
9
|
-
* Vercel serverless function template
|
|
10
|
-
*/
|
|
11
|
-
export declare const VERCEL_TEMPLATE = "{{GENERATED_HEADER}}\nimport type { VercelRequest, VercelResponse } from '@vercel/node';\n{{WORKFLOW_IMPORT}}\n\nexport const config = {\n runtime: 'nodejs20.x',\n maxDuration: {{MAX_DURATION}},\n};\n\nexport default async function handler(req: VercelRequest, res: VercelResponse) {\n if (req.method !== 'POST') {\n return res.status(405).json({ error: 'Method Not Allowed' });\n }\n\n try {\n const params = req.body || {};\n const startTime = Date.now();\n\n const result = await {{FUNCTION_NAME}}(true, params);\n\n return res.status(200).json({\n success: true,\n result,\n executionTime: Date.now() - startTime,\n });\n } catch (error) {\n return res.status(500).json({\n success: false,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n}\n";
|
|
12
|
-
/**
|
|
13
|
-
* Cloudflare Workers template
|
|
14
|
-
*/
|
|
15
|
-
export declare const CLOUDFLARE_TEMPLATE = "{{GENERATED_HEADER}}\n{{WORKFLOW_IMPORT}}\n\ninterface Env {\n // Add your bindings here (D1, KV, R2, etc.)\n}\n\nexport default {\n async fetch(request: Request, env: Env): Promise<Response> {\n if (request.method !== 'POST') {\n return new Response(JSON.stringify({ error: 'Method Not Allowed' }), {\n status: 405,\n headers: { 'Content-Type': 'application/json' },\n });\n }\n\n try {\n const body = await request.json() as Record<string, unknown>;\n const startTime = performance.now();\n\n const result = await {{FUNCTION_NAME}}(true, body);\n\n return new Response(JSON.stringify({\n success: true,\n result,\n executionTime: Math.round(performance.now() - startTime),\n }), {\n status: 200,\n headers: { 'Content-Type': 'application/json' },\n });\n } catch (error) {\n return new Response(JSON.stringify({\n success: false,\n error: error instanceof Error ? error.message : String(error),\n }), {\n status: 500,\n headers: { 'Content-Type': 'application/json' },\n });\n }\n },\n} satisfies ExportedHandler<Env>;\n";
|
|
16
|
-
/**
|
|
17
|
-
* Inngest durable function template
|
|
18
|
-
*/
|
|
19
|
-
export declare const INNGEST_TEMPLATE = "{{GENERATED_HEADER}}\nimport { Inngest } from 'inngest';\nimport { serve } from 'inngest/express';\n{{WORKFLOW_IMPORT}}\n\nconst inngest = new Inngest({ id: 'fw-{{FUNCTION_NAME}}' });\n\nconst workflowFn = inngest.createFunction(\n { id: '{{FUNCTION_NAME}}', name: '{{FUNCTION_NAME}}' },\n { event: 'fw/{{FUNCTION_NAME}}.execute' },\n async ({ event, step }) => {\n const params = event.data ?? {};\n\n const result = await step.run('execute-workflow', async () => {\n return {{FUNCTION_NAME}}(true, params);\n });\n\n return { success: true, result };\n }\n);\n\nexport const handler = serve({ client: inngest, functions: [workflowFn] });\nexport default handler;\n";
|
|
20
|
-
/**
|
|
21
|
-
* SAM (Serverless Application Model) template for AWS Lambda
|
|
22
|
-
*/
|
|
23
|
-
export declare const SAM_TEMPLATE = "AWSTemplateFormatVersion: '2010-09-09'\nTransform: AWS::Serverless-2016-10-31\nDescription: Flow Weaver workflow - {{WORKFLOW_NAME}}\n\nGlobals:\n Function:\n Timeout: 30\n Runtime: nodejs20.x\n MemorySize: 256\n\nResources:\n WorkflowFunction:\n Type: AWS::Serverless::Function\n Properties:\n Handler: handler.handler\n CodeUri: .\n Description: {{WORKFLOW_DESCRIPTION}}\n Events:\n ApiEvent:\n Type: HttpApi\n Properties:\n Path: /{{WORKFLOW_PATH}}\n Method: POST\n\nOutputs:\n ApiEndpoint:\n Description: API endpoint URL\n Value: !Sub \"https://${ServerlessHttpApi}.execute-api.${AWS::Region}.amazonaws.com/{{WORKFLOW_PATH}}\"\n";
|
|
24
|
-
//# sourceMappingURL=templates.d.ts.map
|
package/dist/export/templates.js
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Serverless handler templates for different platforms
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* AWS Lambda handler template
|
|
6
|
-
*/
|
|
7
|
-
export const LAMBDA_TEMPLATE = `{{GENERATED_HEADER}}
|
|
8
|
-
import type { APIGatewayProxyEventV2, APIGatewayProxyResultV2, Context } from 'aws-lambda';
|
|
9
|
-
{{WORKFLOW_IMPORT}}
|
|
10
|
-
|
|
11
|
-
export const handler = async (
|
|
12
|
-
event: APIGatewayProxyEventV2,
|
|
13
|
-
context: Context
|
|
14
|
-
): Promise<APIGatewayProxyResultV2> => {
|
|
15
|
-
context.callbackWaitsForEmptyEventLoop = false;
|
|
16
|
-
|
|
17
|
-
try {
|
|
18
|
-
const body = typeof event.body === 'string'
|
|
19
|
-
? JSON.parse(event.body || '{}')
|
|
20
|
-
: event.body || {};
|
|
21
|
-
|
|
22
|
-
const startTime = Date.now();
|
|
23
|
-
const result = await {{FUNCTION_NAME}}(true, body);
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
statusCode: 200,
|
|
27
|
-
headers: {
|
|
28
|
-
'Content-Type': 'application/json',
|
|
29
|
-
'X-Execution-Time': \`\${Date.now() - startTime}ms\`,
|
|
30
|
-
},
|
|
31
|
-
body: JSON.stringify({ success: true, result }),
|
|
32
|
-
};
|
|
33
|
-
} catch (error) {
|
|
34
|
-
return {
|
|
35
|
-
statusCode: 500,
|
|
36
|
-
headers: { 'Content-Type': 'application/json' },
|
|
37
|
-
body: JSON.stringify({
|
|
38
|
-
success: false,
|
|
39
|
-
error: error instanceof Error ? error.message : String(error),
|
|
40
|
-
requestId: context.awsRequestId,
|
|
41
|
-
}),
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
`;
|
|
46
|
-
/**
|
|
47
|
-
* Vercel serverless function template
|
|
48
|
-
*/
|
|
49
|
-
export const VERCEL_TEMPLATE = `{{GENERATED_HEADER}}
|
|
50
|
-
import type { VercelRequest, VercelResponse } from '@vercel/node';
|
|
51
|
-
{{WORKFLOW_IMPORT}}
|
|
52
|
-
|
|
53
|
-
export const config = {
|
|
54
|
-
runtime: 'nodejs20.x',
|
|
55
|
-
maxDuration: {{MAX_DURATION}},
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export default async function handler(req: VercelRequest, res: VercelResponse) {
|
|
59
|
-
if (req.method !== 'POST') {
|
|
60
|
-
return res.status(405).json({ error: 'Method Not Allowed' });
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
const params = req.body || {};
|
|
65
|
-
const startTime = Date.now();
|
|
66
|
-
|
|
67
|
-
const result = await {{FUNCTION_NAME}}(true, params);
|
|
68
|
-
|
|
69
|
-
return res.status(200).json({
|
|
70
|
-
success: true,
|
|
71
|
-
result,
|
|
72
|
-
executionTime: Date.now() - startTime,
|
|
73
|
-
});
|
|
74
|
-
} catch (error) {
|
|
75
|
-
return res.status(500).json({
|
|
76
|
-
success: false,
|
|
77
|
-
error: error instanceof Error ? error.message : String(error),
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
`;
|
|
82
|
-
/**
|
|
83
|
-
* Cloudflare Workers template
|
|
84
|
-
*/
|
|
85
|
-
export const CLOUDFLARE_TEMPLATE = `{{GENERATED_HEADER}}
|
|
86
|
-
{{WORKFLOW_IMPORT}}
|
|
87
|
-
|
|
88
|
-
interface Env {
|
|
89
|
-
// Add your bindings here (D1, KV, R2, etc.)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export default {
|
|
93
|
-
async fetch(request: Request, env: Env): Promise<Response> {
|
|
94
|
-
if (request.method !== 'POST') {
|
|
95
|
-
return new Response(JSON.stringify({ error: 'Method Not Allowed' }), {
|
|
96
|
-
status: 405,
|
|
97
|
-
headers: { 'Content-Type': 'application/json' },
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
try {
|
|
102
|
-
const body = await request.json() as Record<string, unknown>;
|
|
103
|
-
const startTime = performance.now();
|
|
104
|
-
|
|
105
|
-
const result = await {{FUNCTION_NAME}}(true, body);
|
|
106
|
-
|
|
107
|
-
return new Response(JSON.stringify({
|
|
108
|
-
success: true,
|
|
109
|
-
result,
|
|
110
|
-
executionTime: Math.round(performance.now() - startTime),
|
|
111
|
-
}), {
|
|
112
|
-
status: 200,
|
|
113
|
-
headers: { 'Content-Type': 'application/json' },
|
|
114
|
-
});
|
|
115
|
-
} catch (error) {
|
|
116
|
-
return new Response(JSON.stringify({
|
|
117
|
-
success: false,
|
|
118
|
-
error: error instanceof Error ? error.message : String(error),
|
|
119
|
-
}), {
|
|
120
|
-
status: 500,
|
|
121
|
-
headers: { 'Content-Type': 'application/json' },
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
} satisfies ExportedHandler<Env>;
|
|
126
|
-
`;
|
|
127
|
-
/**
|
|
128
|
-
* Inngest durable function template
|
|
129
|
-
*/
|
|
130
|
-
export const INNGEST_TEMPLATE = `{{GENERATED_HEADER}}
|
|
131
|
-
import { Inngest } from 'inngest';
|
|
132
|
-
import { serve } from 'inngest/express';
|
|
133
|
-
{{WORKFLOW_IMPORT}}
|
|
134
|
-
|
|
135
|
-
const inngest = new Inngest({ id: 'fw-{{FUNCTION_NAME}}' });
|
|
136
|
-
|
|
137
|
-
const workflowFn = inngest.createFunction(
|
|
138
|
-
{ id: '{{FUNCTION_NAME}}', name: '{{FUNCTION_NAME}}' },
|
|
139
|
-
{ event: 'fw/{{FUNCTION_NAME}}.execute' },
|
|
140
|
-
async ({ event, step }) => {
|
|
141
|
-
const params = event.data ?? {};
|
|
142
|
-
|
|
143
|
-
const result = await step.run('execute-workflow', async () => {
|
|
144
|
-
return {{FUNCTION_NAME}}(true, params);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
return { success: true, result };
|
|
148
|
-
}
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
export const handler = serve({ client: inngest, functions: [workflowFn] });
|
|
152
|
-
export default handler;
|
|
153
|
-
`;
|
|
154
|
-
/**
|
|
155
|
-
* SAM (Serverless Application Model) template for AWS Lambda
|
|
156
|
-
*/
|
|
157
|
-
export const SAM_TEMPLATE = `AWSTemplateFormatVersion: '2010-09-09'
|
|
158
|
-
Transform: AWS::Serverless-2016-10-31
|
|
159
|
-
Description: Flow Weaver workflow - {{WORKFLOW_NAME}}
|
|
160
|
-
|
|
161
|
-
Globals:
|
|
162
|
-
Function:
|
|
163
|
-
Timeout: 30
|
|
164
|
-
Runtime: nodejs20.x
|
|
165
|
-
MemorySize: 256
|
|
166
|
-
|
|
167
|
-
Resources:
|
|
168
|
-
WorkflowFunction:
|
|
169
|
-
Type: AWS::Serverless::Function
|
|
170
|
-
Properties:
|
|
171
|
-
Handler: handler.handler
|
|
172
|
-
CodeUri: .
|
|
173
|
-
Description: {{WORKFLOW_DESCRIPTION}}
|
|
174
|
-
Events:
|
|
175
|
-
ApiEvent:
|
|
176
|
-
Type: HttpApi
|
|
177
|
-
Properties:
|
|
178
|
-
Path: /{{WORKFLOW_PATH}}
|
|
179
|
-
Method: POST
|
|
180
|
-
|
|
181
|
-
Outputs:
|
|
182
|
-
ApiEndpoint:
|
|
183
|
-
Description: API endpoint URL
|
|
184
|
-
Value: !Sub "https://\${ServerlessHttpApi}.execute-api.\${AWS::Region}.amazonaws.com/{{WORKFLOW_PATH}}"
|
|
185
|
-
`;
|
|
186
|
-
//# sourceMappingURL=templates.js.map
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CI/CD-Specific Validation Rules
|
|
3
|
-
*
|
|
4
|
-
* Custom TValidationRule implementations for CI/CD pipeline workflows.
|
|
5
|
-
* These run AFTER the built-in validator via the api/validate.ts custom rules injection.
|
|
6
|
-
*
|
|
7
|
-
* Rules:
|
|
8
|
-
* 1. CICD_SECRET_NOT_DECLARED - secret:X referenced but no @secret X declared
|
|
9
|
-
* 2. CICD_SECRET_UNUSED - @secret X declared but never wired
|
|
10
|
-
* 3. CICD_TRIGGER_MISSING - No trigger annotations — pipeline would never run
|
|
11
|
-
* 4. CICD_JOB_MISSING_RUNNER - Job has no runner (uses workflow default or none)
|
|
12
|
-
* 5. CICD_ARTIFACT_CROSS_JOB - Data flows between jobs without @artifact declaration
|
|
13
|
-
* 6. CICD_CIRCULAR_JOB_DEPS - Job dependency cycle detected
|
|
14
|
-
* 7. CICD_MATRIX_WITH_ENVIRONMENT - Matrix + environment = N approval prompts
|
|
15
|
-
*/
|
|
16
|
-
import type { TValidationRule } from '../ast/types.js';
|
|
17
|
-
/**
|
|
18
|
-
* A `secret:X` pseudo-node is referenced in @connect but no `@secret X` is declared.
|
|
19
|
-
* This means the export target won't know about the secret and can't generate
|
|
20
|
-
* proper environment variable references.
|
|
21
|
-
*/
|
|
22
|
-
export declare const secretNotDeclaredRule: TValidationRule;
|
|
23
|
-
/**
|
|
24
|
-
* A `@secret X` is declared but never wired via `@connect secret:X -> ...`.
|
|
25
|
-
* The secret might be intentional (used in a shell-command step) or a leftover.
|
|
26
|
-
*/
|
|
27
|
-
export declare const secretUnusedRule: TValidationRule;
|
|
28
|
-
/**
|
|
29
|
-
* A CI/CD workflow with no trigger annotations would never run automatically.
|
|
30
|
-
* Needs at least one @trigger (push, pull_request, schedule, dispatch, or tag).
|
|
31
|
-
*/
|
|
32
|
-
export declare const triggerMissingRule: TValidationRule;
|
|
33
|
-
/**
|
|
34
|
-
* A job (group of nodes with same [job: "name"]) has no explicit runner
|
|
35
|
-
* and the workflow has no default @runner. The export target will use a
|
|
36
|
-
* platform default, which may not be what the user expects.
|
|
37
|
-
*/
|
|
38
|
-
export declare const jobMissingRunnerRule: TValidationRule;
|
|
39
|
-
/**
|
|
40
|
-
* Data flows between nodes in different jobs via connections, but no @artifact
|
|
41
|
-
* is declared. In CI/CD, each job runs in a fresh environment — data must be
|
|
42
|
-
* explicitly passed via artifacts.
|
|
43
|
-
*/
|
|
44
|
-
export declare const artifactCrossJobRule: TValidationRule;
|
|
45
|
-
/**
|
|
46
|
-
* Job dependencies (derived from @path connections between jobs) form a cycle.
|
|
47
|
-
* CI/CD platforms reject circular job dependencies.
|
|
48
|
-
*/
|
|
49
|
-
export declare const circularJobDepsRule: TValidationRule;
|
|
50
|
-
/**
|
|
51
|
-
* Using @matrix with @environment protection means each matrix combination
|
|
52
|
-
* triggers an approval prompt. For a 3x2 matrix, that's 6 prompts.
|
|
53
|
-
*/
|
|
54
|
-
export declare const matrixWithEnvironmentRule: TValidationRule;
|
|
55
|
-
/** All CI/CD validation rules */
|
|
56
|
-
export declare const cicdValidationRules: TValidationRule[];
|
|
57
|
-
/**
|
|
58
|
-
* Get all CI/CD validation rules.
|
|
59
|
-
* Convenience function for passing to validateWorkflow().
|
|
60
|
-
*/
|
|
61
|
-
export declare function getCICDValidationRules(): TValidationRule[];
|
|
62
|
-
//# sourceMappingURL=cicd-rules.d.ts.map
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|