@synergenius/flow-weaver 0.17.1 → 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 +12 -3
- package/dist/cli/commands/init-personas.js +27 -4
- package/dist/cli/commands/init.d.ts +2 -2
- package/dist/cli/commands/init.js +5 -11
- package/dist/cli/flow-weaver.mjs +61463 -60910
- 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
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: CI/CD Pipelines
|
|
3
|
+
description: Build GitHub Actions and GitLab CI pipelines with workflow annotations
|
|
4
|
+
keywords: [cicd, github-actions, gitlab-ci, pipeline, secret, runner, cache, artifact, environment, matrix, service, concurrency, trigger, job, deploy]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# CI/CD Pipelines
|
|
8
|
+
|
|
9
|
+
Flow Weaver can generate native CI/CD pipeline configurations from annotated TypeScript workflows. The output is platform-native YAML (GitHub Actions or GitLab CI) with no runtime dependency on Flow Weaver. You model your pipeline as a workflow graph, annotate it with CI/CD-specific tags, and export.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
flow-weaver export pipeline.ts --target github-actions --output .github/workflows/
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The generated YAML maps directly to the target platform's native syntax. Jobs, steps, secrets, caches, services, matrix strategies, and triggers all translate to their platform equivalents.
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# 1. Scaffold a CI/CD template
|
|
21
|
+
flow-weaver scaffold --template cicd-test-deploy --output pipeline.ts
|
|
22
|
+
|
|
23
|
+
# 2. Validate the pipeline structure
|
|
24
|
+
flow-weaver validate pipeline.ts
|
|
25
|
+
|
|
26
|
+
# 3. Export to GitHub Actions
|
|
27
|
+
flow-weaver export pipeline.ts --target github-actions --output .github/workflows/
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Four CI/CD templates are available: `cicd-test-deploy` (standard test + deploy), `cicd-docker` (build and push container images), `cicd-matrix` (test across Node versions and OSes), and `cicd-multi-env` (staging + production deployment).
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## CI/CD Annotations
|
|
35
|
+
|
|
36
|
+
These annotations are placed inside `@flowWeaver workflow` JSDoc blocks alongside the standard `@node`, `@connect`, and `@path` annotations.
|
|
37
|
+
|
|
38
|
+
### @trigger (CI/CD mode)
|
|
39
|
+
|
|
40
|
+
Defines when the pipeline runs. When the value is `push`, `pull_request`, `dispatch`, `tag`, or `schedule`, the parser treats it as a CI/CD trigger rather than a runtime event trigger.
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
@trigger push branches="main,develop"
|
|
44
|
+
@trigger pull_request branches="main" types="opened,synchronize"
|
|
45
|
+
@trigger tag pattern="v*"
|
|
46
|
+
@trigger dispatch
|
|
47
|
+
@trigger schedule cron="0 9 * * 1"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Attributes: `branches`, `paths`, `paths-ignore`, `types`, `pattern`, `cron`. For `dispatch` triggers, use `input_<name>` attributes to declare workflow_dispatch inputs.
|
|
51
|
+
|
|
52
|
+
### @secret
|
|
53
|
+
|
|
54
|
+
Declares a secret the pipeline needs access to. Secrets are wired to node inputs via `@connect secret:NAME -> node.port`.
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
@secret NPM_TOKEN - NPM authentication token
|
|
58
|
+
@secret DEPLOY_KEY scope="deploy" platform="github" - SSH deploy key
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Attributes: `scope` (limits which jobs see it), `platform` (restrict to `github`, `gitlab`, or `all`).
|
|
62
|
+
|
|
63
|
+
### @runner
|
|
64
|
+
|
|
65
|
+
Sets the runner or machine image for the pipeline.
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
@runner ubuntu-latest
|
|
69
|
+
@runner self-hosted
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### @cache
|
|
73
|
+
|
|
74
|
+
Configures dependency caching.
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
@cache npm key="package-lock.json"
|
|
78
|
+
@cache npm key="package-lock.json" path="~/.npm"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The `strategy` value (first argument) maps to platform-specific cache actions. `key` specifies the cache hash file, `path` overrides the cache directory.
|
|
82
|
+
|
|
83
|
+
### @artifact
|
|
84
|
+
|
|
85
|
+
Declares build artifacts passed between jobs.
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
@artifact dist path="dist/" retention=5
|
|
89
|
+
@artifact coverage path="coverage/"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Attributes: `path` (required, the directory or file to upload), `retention` (days to keep, optional).
|
|
93
|
+
|
|
94
|
+
### @environment
|
|
95
|
+
|
|
96
|
+
Configures deployment environments with optional protection rules.
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
@environment production url="https://app.example.com" reviewers=2
|
|
100
|
+
@environment staging
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Attributes: `url` (environment URL shown in GitHub/GitLab), `reviewers` (number of required approvals).
|
|
104
|
+
|
|
105
|
+
### @matrix
|
|
106
|
+
|
|
107
|
+
Defines a test matrix for parallel execution across combinations.
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
@matrix node="18,20,22" os="ubuntu-latest,macos-latest"
|
|
111
|
+
@matrix include node="22" os="windows-latest"
|
|
112
|
+
@matrix exclude node="18" os="macos-latest"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Each key-value pair becomes a matrix dimension. Values are comma-separated. Use `include` or `exclude` prefixes to add or remove specific combinations.
|
|
116
|
+
|
|
117
|
+
### @service
|
|
118
|
+
|
|
119
|
+
Declares service containers that run alongside pipeline jobs (databases, caches, etc.).
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
@service postgres image="postgres:16" env="POSTGRES_PASSWORD=test" ports="5432:5432"
|
|
123
|
+
@service redis image="redis:7" ports="6379:6379"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Attributes: `image` (required), `env` (comma-separated `K=V` pairs), `ports` (comma-separated port mappings).
|
|
127
|
+
|
|
128
|
+
### @concurrency
|
|
129
|
+
|
|
130
|
+
Controls concurrent pipeline runs.
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
@concurrency deploy cancel-in-progress=true
|
|
134
|
+
@concurrency ci-${{ github.ref }}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The first argument is the concurrency group name. `cancel-in-progress` cancels queued runs when a new one starts.
|
|
138
|
+
|
|
139
|
+
### @job
|
|
140
|
+
|
|
141
|
+
Configures per-job settings. The first argument is the job name (must match a `[job: "name"]` used on `@node` declarations). Remaining arguments are key=value pairs.
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
@job build retry=2 timeout="10m"
|
|
145
|
+
@job test-unit coverage='/Coverage: (\d+)%/' reports="junit=test-results.xml"
|
|
146
|
+
@job test-e2e allow_failure=true timeout="30m"
|
|
147
|
+
@job deploy rules="$CI_COMMIT_BRANCH == main" tags="production" extends=".deploy-base"
|
|
148
|
+
@job lint runner="macos-latest"
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Supported keys:
|
|
152
|
+
|
|
153
|
+
| Key | Type | Description |
|
|
154
|
+
|-----|------|-------------|
|
|
155
|
+
| `retry` | number | Maximum retry count on failure |
|
|
156
|
+
| `allow_failure` | boolean | Job can fail without failing the pipeline |
|
|
157
|
+
| `timeout` | string | Job timeout duration ("5m", "1h", "1h30m") |
|
|
158
|
+
| `runner` | string | Runner override for this specific job |
|
|
159
|
+
| `tags` | comma-list | Runner selection tags (e.g. "docker,linux") |
|
|
160
|
+
| `coverage` | string | Coverage regex pattern (GitLab CI) |
|
|
161
|
+
| `reports` | comma-list | Report declarations as type=path (e.g. "junit=results.xml") |
|
|
162
|
+
| `rules` | string | Conditional execution rule (e.g. "$CI_COMMIT_BRANCH == main") |
|
|
163
|
+
| `extends` | string | GitLab CI template to extend (e.g. ".deploy-base") |
|
|
164
|
+
| `before_script` | comma-list | Setup commands before main script |
|
|
165
|
+
| `variables` | comma-list | Environment variables as KEY=VALUE pairs |
|
|
166
|
+
|
|
167
|
+
Multiple `@job` annotations for the same job name are merged. You can split attributes across lines:
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
@job deploy retry=2
|
|
171
|
+
@job deploy tags="production"
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### @stage
|
|
175
|
+
|
|
176
|
+
Declares pipeline stages for GitLab CI. When present, jobs are grouped into named stages instead of the default one-job-per-stage behavior.
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
@stage test
|
|
180
|
+
@stage build
|
|
181
|
+
@stage deploy
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Jobs are assigned to stages by name prefix matching: a job named `test-unit` matches stage `test`, `build-docker` matches stage `build`. Jobs that don't match any stage by prefix are assigned by dependency depth (depth 0 gets the first stage, depth 1 the second, etc.).
|
|
185
|
+
|
|
186
|
+
Stage ordering follows declaration order.
|
|
187
|
+
|
|
188
|
+
### @variables
|
|
189
|
+
|
|
190
|
+
Sets workflow-level environment variables applied to all jobs as defaults. Jobs with explicit variables (via `@job`) are not overwritten.
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
@variables NODE_ENV="production" CI="true"
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### @before_script
|
|
197
|
+
|
|
198
|
+
Sets workflow-level setup commands run before each job's main script. Applied as defaults to jobs without their own `before_script`.
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
@before_script "npm ci"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### @tags
|
|
205
|
+
|
|
206
|
+
Sets workflow-level runner tags applied to all jobs as defaults. Jobs with explicit tags (via `@job`) are not overwritten.
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
@tags docker linux
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
In GitHub Actions, tags translate to `runs-on: [self-hosted, tag1, tag2]`. In GitLab CI, they become `tags: [tag1, tag2]`.
|
|
213
|
+
|
|
214
|
+
### @includes
|
|
215
|
+
|
|
216
|
+
Declares external configuration files to include (GitLab CI feature). Ignored for GitHub Actions export.
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
@includes local="ci/shared-templates.yml"
|
|
220
|
+
@includes template="Auto-DevOps.gitlab-ci.yml"
|
|
221
|
+
@includes remote="https://example.com/ci.yml"
|
|
222
|
+
@includes project="other-group/other-project" file="ci/shared.yml" ref="main"
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Wiring Secrets with secret:NAME
|
|
228
|
+
|
|
229
|
+
Secrets are pseudo-nodes in the connection graph. They don't correspond to real node instances. Instead, `secret:NAME` acts as a source that provides the secret value to a node's input port.
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
/**
|
|
233
|
+
* @flowWeaver workflow
|
|
234
|
+
* @secret NPM_TOKEN - NPM auth token
|
|
235
|
+
* @node publish npmPublish [job: "publish"]
|
|
236
|
+
* @connect secret:NPM_TOKEN -> publish.token
|
|
237
|
+
*/
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
This generates the equivalent of:
|
|
241
|
+
|
|
242
|
+
```yaml
|
|
243
|
+
# GitHub Actions
|
|
244
|
+
env:
|
|
245
|
+
TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
246
|
+
|
|
247
|
+
# GitLab CI
|
|
248
|
+
variables:
|
|
249
|
+
TOKEN: $NPM_TOKEN
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
The target port name is converted to an environment variable name (camelCase becomes UPPER_SNAKE_CASE). The validation rules `CICD_SECRET_NOT_DECLARED` and `CICD_SECRET_UNUSED` catch mismatches between `@secret` declarations and `@connect secret:NAME` references.
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Job Grouping
|
|
257
|
+
|
|
258
|
+
By default, each node becomes its own job. Use the `[job: "name"]` attribute on `@node` to group nodes into the same job. Nodes with the same job name become sequential steps within that job.
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
@node checkout gitCheckout [job: "test"]
|
|
262
|
+
@node setup setupNode [job: "test"]
|
|
263
|
+
@node install npmInstall [job: "test"]
|
|
264
|
+
@node test npmTest [job: "test"]
|
|
265
|
+
@node deploy deploySsh [job: "deploy"]
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
This produces two jobs: `test` (4 steps) and `deploy` (1 step). Job dependencies are inferred from the connection graph between nodes in different jobs.
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Node-to-Action Mapping
|
|
273
|
+
|
|
274
|
+
Common node types map to platform-specific actions automatically:
|
|
275
|
+
|
|
276
|
+
| Node Type | GitHub Actions | GitLab CI |
|
|
277
|
+
|-----------|---------------|-----------|
|
|
278
|
+
| `checkout` / `gitCheckout` | `actions/checkout@v4` | `git checkout` |
|
|
279
|
+
| `setupNode` | `actions/setup-node@v4` | image selection |
|
|
280
|
+
| `npmInstall` | `npm ci` run step | `npm ci` script |
|
|
281
|
+
| `npmTest` | `npm test` run step | `npm test` script |
|
|
282
|
+
| `npmBuild` | `npm run build` run step | `npm run build` script |
|
|
283
|
+
|
|
284
|
+
Custom node types generate shell `run:` steps. Use `@deploy github-actions action="custom/action@v1"` to override the mapping for a specific node.
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Complete Example
|
|
289
|
+
|
|
290
|
+
```typescript
|
|
291
|
+
/**
|
|
292
|
+
* @flowWeaver nodeType
|
|
293
|
+
* @expression
|
|
294
|
+
*/
|
|
295
|
+
declare function gitCheckout(): { path: string };
|
|
296
|
+
|
|
297
|
+
/** @flowWeaver nodeType
|
|
298
|
+
* @expression
|
|
299
|
+
*/
|
|
300
|
+
declare function setupNode(version: string): { ready: boolean };
|
|
301
|
+
|
|
302
|
+
/** @flowWeaver nodeType
|
|
303
|
+
* @expression
|
|
304
|
+
*/
|
|
305
|
+
declare function npmInstall(): { installed: boolean };
|
|
306
|
+
|
|
307
|
+
/** @flowWeaver nodeType
|
|
308
|
+
* @expression
|
|
309
|
+
*/
|
|
310
|
+
declare function npmTest(): { passed: boolean };
|
|
311
|
+
|
|
312
|
+
/** @flowWeaver nodeType
|
|
313
|
+
* @expression
|
|
314
|
+
*/
|
|
315
|
+
declare function npmBuild(): { output: string };
|
|
316
|
+
|
|
317
|
+
/** @flowWeaver nodeType
|
|
318
|
+
* @expression
|
|
319
|
+
*/
|
|
320
|
+
declare function deploySsh(sshKey: string): { result: string };
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Test and deploy pipeline
|
|
324
|
+
*
|
|
325
|
+
* @flowWeaver workflow
|
|
326
|
+
* @trigger push branches="main"
|
|
327
|
+
* @trigger pull_request branches="main"
|
|
328
|
+
* @runner ubuntu-latest
|
|
329
|
+
* @secret DEPLOY_KEY - SSH key for production deploy
|
|
330
|
+
* @cache npm key="package-lock.json"
|
|
331
|
+
* @artifact dist path="dist/" retention=5
|
|
332
|
+
* @tags docker linux
|
|
333
|
+
* @variables NODE_ENV="production"
|
|
334
|
+
* @before_script "npm ci"
|
|
335
|
+
*
|
|
336
|
+
* @stage test
|
|
337
|
+
* @stage build
|
|
338
|
+
* @stage deploy
|
|
339
|
+
*
|
|
340
|
+
* @job test retry=1 coverage='/Coverage: (\d+)%/' reports="junit=test-results.xml"
|
|
341
|
+
* @job build retry=2 timeout="10m"
|
|
342
|
+
* @job deploy allow_failure=false rules="$CI_COMMIT_BRANCH == main"
|
|
343
|
+
*
|
|
344
|
+
* @node co gitCheckout [job: "test"]
|
|
345
|
+
* @node setup setupNode [job: "test"]
|
|
346
|
+
* @node install npmInstall [job: "test"]
|
|
347
|
+
* @node test npmTest [job: "test"]
|
|
348
|
+
* @node build npmBuild [job: "build"]
|
|
349
|
+
* @node deploy deploySsh [job: "deploy"] [environment: "production"]
|
|
350
|
+
*
|
|
351
|
+
* @path Start -> co -> setup -> install -> test -> Exit
|
|
352
|
+
* @connect install.installed -> build.execute
|
|
353
|
+
* @connect build.output -> deploy.execute
|
|
354
|
+
* @connect secret:DEPLOY_KEY -> deploy.sshKey
|
|
355
|
+
*
|
|
356
|
+
* @param execute - Run the pipeline
|
|
357
|
+
* @returns result - Pipeline result
|
|
358
|
+
*/
|
|
359
|
+
export function ciPipeline(execute: boolean): { result: string } {
|
|
360
|
+
throw new Error('stub');
|
|
361
|
+
}
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Export:
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
flow-weaver export pipeline.ts --target github-actions --output .github/workflows/
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Validation Rules
|
|
373
|
+
|
|
374
|
+
Nine CI/CD-specific validation rules run automatically when the workflow contains CI/CD annotations:
|
|
375
|
+
|
|
376
|
+
| Rule | Severity | What it catches |
|
|
377
|
+
|------|----------|-----------------|
|
|
378
|
+
| `CICD_SECRET_NOT_DECLARED` | error | `@connect secret:X` used but no `@secret X` declared |
|
|
379
|
+
| `CICD_SECRET_UNUSED` | warning | `@secret X` declared but never wired via `@connect secret:X` |
|
|
380
|
+
| `CICD_TRIGGER_MISSING` | warning | No trigger annotations, pipeline would never run automatically |
|
|
381
|
+
| `CICD_JOB_MISSING_RUNNER` | warning | No `@runner` and jobs have no explicit runner |
|
|
382
|
+
| `CICD_ARTIFACT_CROSS_JOB` | warning | Data flows between jobs but no `@artifact` declared |
|
|
383
|
+
| `CICD_CIRCULAR_JOB_DEPS` | error | Job dependency cycle detected |
|
|
384
|
+
| `CICD_MATRIX_WITH_ENVIRONMENT` | warning | `@matrix` with `@environment` triggers N approval prompts |
|
|
385
|
+
| `CICD_JOB_CONFIG_ORPHAN` | warning | `@job X` references a job not used by any node |
|
|
386
|
+
| `CICD_STAGE_ORPHAN` | warning | `@stage X` declared but no job matches by name prefix |
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
## Related Topics
|
|
391
|
+
|
|
392
|
+
- [Deployment](deployment) — Full export target reference (serverless + CI/CD)
|
|
393
|
+
- [JSDoc Grammar](jsdoc-grammar) — Formal annotation syntax including CI/CD tags
|
|
394
|
+
- [Scaffold](scaffold) — CI/CD template options
|
|
395
|
+
- [Concepts](concepts) — Core workflow fundamentals
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CI/CD Extension — public API barrel file.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports detection, base target, and validation rule utilities
|
|
5
|
+
* for consumers importing from `@synergenius/flow-weaver/extensions/cicd`.
|
|
6
|
+
*/
|
|
7
|
+
export { isCICDWorkflow, getJobNames, getDeclaredSecrets, getReferencedSecrets } from './detection.js';
|
|
8
|
+
export { BaseCICDTarget, NODE_ACTION_MAP, type CICDJob, type CICDStep, type ActionMapping } from './base-target.js';
|
|
9
|
+
export { getCICDValidationRules } from './rules.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CI/CD Extension — public API barrel file.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports detection, base target, and validation rule utilities
|
|
5
|
+
* for consumers importing from `@synergenius/flow-weaver/extensions/cicd`.
|
|
6
|
+
*/
|
|
7
|
+
export { isCICDWorkflow, getJobNames, getDeclaredSecrets, getReferencedSecrets } from './detection.js';
|
|
8
|
+
export { BaseCICDTarget, NODE_ACTION_MAP } from './base-target.js';
|
|
9
|
+
export { getCICDValidationRules } from './rules.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CI/CD extension self-registration module.
|
|
3
|
+
*
|
|
4
|
+
* Importing this module registers all CI/CD functionality through
|
|
5
|
+
* the existing extension registries: tag handlers, validation rules,
|
|
6
|
+
* documentation topics, init use cases, and scaffold templates.
|
|
7
|
+
*
|
|
8
|
+
* Loaded as a side-effect import from src/extensions/index.ts.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=register.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CI/CD extension self-registration module.
|
|
3
|
+
*
|
|
4
|
+
* Importing this module registers all CI/CD functionality through
|
|
5
|
+
* the existing extension registries: tag handlers, validation rules,
|
|
6
|
+
* documentation topics, init use cases, and scaffold templates.
|
|
7
|
+
*
|
|
8
|
+
* Loaded as a side-effect import from src/extensions/index.ts.
|
|
9
|
+
*/
|
|
10
|
+
import * as path from 'path';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
import { tagHandlerRegistry } from '../../parser/tag-registry.js';
|
|
13
|
+
import { validationRuleRegistry } from '../../api/validation-registry.js';
|
|
14
|
+
import { registerPackDocTopics } from '../../docs/index.js';
|
|
15
|
+
import { registerPackUseCase } from '../../cli/commands/init-personas.js';
|
|
16
|
+
import { registerWorkflowTemplates } from '../../cli/templates/index.js';
|
|
17
|
+
import { cicdTagHandler } from './tag-handler.js';
|
|
18
|
+
import { isCICDWorkflow } from './detection.js';
|
|
19
|
+
import { getCICDValidationRules } from './rules.js';
|
|
20
|
+
import { cicdTestDeployTemplate } from './templates/cicd-test-deploy.js';
|
|
21
|
+
import { cicdDockerTemplate } from './templates/cicd-docker.js';
|
|
22
|
+
import { cicdMultiEnvTemplate } from './templates/cicd-multi-env.js';
|
|
23
|
+
import { cicdMatrixTemplate } from './templates/cicd-matrix.js';
|
|
24
|
+
// ── Tag handlers ────────────────────────────────────────────────────────────
|
|
25
|
+
tagHandlerRegistry.register([
|
|
26
|
+
'secret', 'runner', 'cache', 'artifact', 'environment', 'matrix',
|
|
27
|
+
'service', 'concurrency', 'job', 'stage', 'variables',
|
|
28
|
+
'before_script', 'tags', 'includes', '_cicdTrigger',
|
|
29
|
+
], 'cicd', 'workflow', cicdTagHandler);
|
|
30
|
+
// ── Validation rules ────────────────────────────────────────────────────────
|
|
31
|
+
validationRuleRegistry.register({
|
|
32
|
+
name: 'CI/CD Rules',
|
|
33
|
+
namespace: 'cicd',
|
|
34
|
+
detect: isCICDWorkflow,
|
|
35
|
+
getRules: getCICDValidationRules,
|
|
36
|
+
});
|
|
37
|
+
// ── Documentation ───────────────────────────────────────────────────────────
|
|
38
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
39
|
+
registerPackDocTopics([
|
|
40
|
+
{
|
|
41
|
+
slug: 'cicd',
|
|
42
|
+
name: 'CI/CD Pipeline Workflows',
|
|
43
|
+
description: 'Building CI/CD pipelines with Flow Weaver annotations and exporting to GitHub Actions or GitLab CI',
|
|
44
|
+
keywords: ['cicd', 'pipeline', 'github-actions', 'gitlab-ci', 'deploy', 'secret', 'runner'],
|
|
45
|
+
presets: ['authoring', 'full', 'ops'],
|
|
46
|
+
absoluteFile: path.resolve(__dirname, 'docs/cicd.md'),
|
|
47
|
+
},
|
|
48
|
+
]);
|
|
49
|
+
// ── Init use case ───────────────────────────────────────────────────────────
|
|
50
|
+
registerPackUseCase({
|
|
51
|
+
id: 'cicd',
|
|
52
|
+
name: 'CI/CD Pipeline',
|
|
53
|
+
description: 'GitHub Actions, GitLab CI, and deployment workflows',
|
|
54
|
+
}, ['cicd-test-deploy', 'cicd-docker', 'cicd-multi-env', 'cicd-matrix']);
|
|
55
|
+
// ── Scaffold templates ──────────────────────────────────────────────────────
|
|
56
|
+
registerWorkflowTemplates([
|
|
57
|
+
cicdTestDeployTemplate,
|
|
58
|
+
cicdDockerTemplate,
|
|
59
|
+
cicdMultiEnvTemplate,
|
|
60
|
+
cicdMatrixTemplate,
|
|
61
|
+
]);
|
|
62
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CI/CD-Specific Validation Rules
|
|
3
|
+
*
|
|
4
|
+
* Custom TValidationRule implementations for CI/CD pipeline workflows.
|
|
5
|
+
* Registered through the ValidationRuleRegistry by the CI/CD extension.
|
|
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
|
|
11
|
+
* 4. CICD_JOB_MISSING_RUNNER - Job has no runner
|
|
12
|
+
* 5. CICD_ARTIFACT_CROSS_JOB - Data flows between jobs without @artifact
|
|
13
|
+
* 6. CICD_CIRCULAR_JOB_DEPS - Job dependency cycle
|
|
14
|
+
* 7. CICD_MATRIX_WITH_ENVIRONMENT - Matrix + environment = N approvals
|
|
15
|
+
* 8. CICD_JOB_CONFIG_ORPHAN - @job config references non-existent job
|
|
16
|
+
* 9. CICD_STAGE_ORPHAN - @stage has no matching jobs
|
|
17
|
+
*/
|
|
18
|
+
import type { TValidationRule } from '../../ast/types.js';
|
|
19
|
+
export declare const secretNotDeclaredRule: TValidationRule;
|
|
20
|
+
export declare const secretUnusedRule: TValidationRule;
|
|
21
|
+
export declare const triggerMissingRule: TValidationRule;
|
|
22
|
+
export declare const jobMissingRunnerRule: TValidationRule;
|
|
23
|
+
export declare const artifactCrossJobRule: TValidationRule;
|
|
24
|
+
export declare const circularJobDepsRule: TValidationRule;
|
|
25
|
+
export declare const matrixWithEnvironmentRule: TValidationRule;
|
|
26
|
+
export declare const jobConfigOrphanRule: TValidationRule;
|
|
27
|
+
export declare const stageOrphanRule: TValidationRule;
|
|
28
|
+
export declare const cicdValidationRules: TValidationRule[];
|
|
29
|
+
export declare function getCICDValidationRules(): TValidationRule[];
|
|
30
|
+
//# sourceMappingURL=rules.d.ts.map
|