@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.
Files changed (123) hide show
  1. package/dist/api/index.d.ts +4 -1
  2. package/dist/api/index.js +4 -1
  3. package/dist/api/templates.js +2 -2
  4. package/dist/api/validate.d.ts +2 -2
  5. package/dist/api/validate.js +6 -6
  6. package/dist/api/validation-registry.d.ts +10 -0
  7. package/dist/api/validation-registry.js +10 -0
  8. package/dist/ast/types.d.ts +91 -4
  9. package/dist/built-in-nodes/invoke-workflow.d.ts +1 -1
  10. package/dist/built-in-nodes/invoke-workflow.js +1 -1
  11. package/dist/chevrotain-parser/connect-parser.js +25 -7
  12. package/dist/cli/commands/compile.d.ts +5 -9
  13. package/dist/cli/commands/compile.js +21 -14
  14. package/dist/cli/commands/dev.d.ts +2 -13
  15. package/dist/cli/commands/dev.js +10 -204
  16. package/dist/cli/commands/doctor.js +6 -3
  17. package/dist/cli/commands/export.d.ts +8 -17
  18. package/dist/cli/commands/export.js +8 -17
  19. package/dist/cli/commands/init-personas.d.ts +17 -6
  20. package/dist/cli/commands/init-personas.js +73 -24
  21. package/dist/cli/commands/init.d.ts +5 -2
  22. package/dist/cli/commands/init.js +73 -42
  23. package/dist/cli/commands/mcp-setup.d.ts +7 -0
  24. package/dist/cli/commands/mcp-setup.js +16 -1
  25. package/dist/cli/flow-weaver.mjs +71002 -70385
  26. package/dist/cli/index.d.ts +1 -0
  27. package/dist/cli/index.js +9 -7
  28. package/dist/cli/templates/index.d.ts +20 -1
  29. package/dist/cli/templates/index.js +66 -15
  30. package/dist/cli/templates/nodes/human-approval.js +2 -3
  31. package/dist/cli/templates/nodes/rag-retriever.js +1 -1
  32. package/dist/constants.d.ts +7 -0
  33. package/dist/constants.js +13 -3
  34. package/dist/context/index.js +13 -3
  35. package/dist/deployment/config/loader.js +2 -1
  36. package/dist/deployment/core/adapters.d.ts +1 -25
  37. package/dist/deployment/core/adapters.js +0 -95
  38. package/dist/deployment/core/formatters.d.ts +0 -15
  39. package/dist/deployment/core/formatters.js +0 -24
  40. package/dist/deployment/index.d.ts +7 -5
  41. package/dist/deployment/index.js +8 -5
  42. package/dist/deployment/types.d.ts +2 -45
  43. package/dist/diagram/html-viewer.js +65 -32
  44. package/dist/diagram/renderer.js +9 -6
  45. package/dist/diagram/theme.js +4 -0
  46. package/dist/diagram/types.d.ts +2 -0
  47. package/dist/doc-metadata/extractors/annotations.js +5 -5
  48. package/dist/doc-metadata/extractors/cli-commands.js +1 -1
  49. package/dist/doc-metadata/extractors/mcp-tools.js +1 -2
  50. package/dist/docs/index.d.ts +28 -1
  51. package/dist/docs/index.js +95 -28
  52. package/dist/export/index.d.ts +2 -3
  53. package/dist/{deployment/targets/cicd-base.d.ts → extensions/cicd/base-target.d.ts} +35 -36
  54. package/dist/{deployment/targets/cicd-base.js → extensions/cicd/base-target.js} +97 -57
  55. package/dist/{validation/cicd-detection.d.ts → extensions/cicd/detection.d.ts} +2 -2
  56. package/dist/{validation/cicd-detection.js → extensions/cicd/detection.js} +13 -1
  57. package/dist/extensions/cicd/docs/cicd.md +395 -0
  58. package/dist/extensions/cicd/index.d.ts +10 -0
  59. package/dist/extensions/cicd/index.js +10 -0
  60. package/dist/extensions/cicd/register.d.ts +11 -0
  61. package/dist/extensions/cicd/register.js +62 -0
  62. package/dist/extensions/cicd/rules.d.ts +30 -0
  63. package/dist/{validation/cicd-rules.js → extensions/cicd/rules.js} +60 -56
  64. package/dist/extensions/cicd/tag-handler.d.ts +14 -0
  65. package/dist/extensions/cicd/tag-handler.js +488 -0
  66. package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-docker.d.ts +1 -1
  67. package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-matrix.d.ts +1 -1
  68. package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-multi-env.d.ts +1 -1
  69. package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-test-deploy.d.ts +1 -1
  70. package/dist/extensions/index.d.ts +12 -0
  71. package/dist/extensions/index.js +12 -0
  72. package/dist/extensions/inngest/dev-mode.d.ts +9 -0
  73. package/dist/extensions/inngest/dev-mode.js +213 -0
  74. package/dist/{generator/inngest.d.ts → extensions/inngest/generator.d.ts} +2 -2
  75. package/dist/{generator/inngest.js → extensions/inngest/generator.js} +4 -4
  76. package/dist/extensions/inngest/index.d.ts +2 -0
  77. package/dist/extensions/inngest/index.js +2 -0
  78. package/dist/extensions/inngest/register.d.ts +6 -0
  79. package/dist/extensions/inngest/register.js +23 -0
  80. package/dist/extensions/inngest/templates/ai-agent-durable.d.ts +8 -0
  81. package/dist/{cli/templates/workflows → extensions/inngest/templates}/ai-agent-durable.js +8 -8
  82. package/dist/{cli/templates/workflows → extensions/inngest/templates}/ai-pipeline-durable.d.ts +2 -2
  83. package/dist/{cli/templates/workflows → extensions/inngest/templates}/ai-pipeline-durable.js +7 -7
  84. package/dist/generated-version.d.ts +1 -1
  85. package/dist/generated-version.js +1 -1
  86. package/dist/generator/compile-target-registry.d.ts +20 -0
  87. package/dist/generator/compile-target-registry.js +20 -0
  88. package/dist/generator/dev-mode-registry.d.ts +27 -0
  89. package/dist/generator/dev-mode-registry.js +20 -0
  90. package/dist/index.d.ts +4 -0
  91. package/dist/index.js +3 -0
  92. package/dist/jsdoc-parser.d.ts +12 -114
  93. package/dist/jsdoc-parser.js +57 -362
  94. package/dist/marketplace/index.d.ts +2 -2
  95. package/dist/marketplace/index.js +1 -1
  96. package/dist/marketplace/registry.d.ts +39 -1
  97. package/dist/marketplace/registry.js +77 -0
  98. package/dist/marketplace/types.d.ts +76 -3
  99. package/dist/mcp/server.d.ts +1 -0
  100. package/dist/mcp/server.js +2 -0
  101. package/dist/mcp/tools-export.js +3 -3
  102. package/dist/mcp/tools-query.js +17 -11
  103. package/dist/mcp/tools-template.js +1 -1
  104. package/dist/parser/tag-registry.d.ts +47 -0
  105. package/dist/parser/tag-registry.js +57 -0
  106. package/dist/parser.d.ts +3 -0
  107. package/dist/parser.js +10 -23
  108. package/dist/validation/rule-registry.d.ts +36 -0
  109. package/dist/validation/rule-registry.js +37 -0
  110. package/dist/validator.js +3 -3
  111. package/docs/reference/concepts.md +2 -1
  112. package/docs/reference/deployment.md +21 -0
  113. package/docs/reference/jsdoc-grammar.md +242 -1
  114. package/docs/reference/scaffold.md +0 -6
  115. package/package.json +9 -1
  116. package/dist/cli/templates/workflows/ai-agent-durable.d.ts +0 -8
  117. package/dist/export/templates.d.ts +0 -24
  118. package/dist/export/templates.js +0 -186
  119. package/dist/validation/cicd-rules.d.ts +0 -62
  120. /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-docker.js +0 -0
  121. /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-matrix.js +0 -0
  122. /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-multi-env.js +0 -0
  123. /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-test-deploy.js +0 -0
@@ -2,26 +2,23 @@
2
2
  * CI/CD-Specific Validation Rules
3
3
  *
4
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.
5
+ * Registered through the ValidationRuleRegistry by the CI/CD extension.
6
6
  *
7
7
  * Rules:
8
8
  * 1. CICD_SECRET_NOT_DECLARED - secret:X referenced but no @secret X declared
9
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
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
15
17
  */
16
- import { getDeclaredSecrets, getReferencedSecrets, getJobNames, } from './cicd-detection.js';
18
+ import { getDeclaredSecrets, getReferencedSecrets, getJobNames, } from './detection.js';
17
19
  // ---------------------------------------------------------------------------
18
20
  // Rule 1: Secret Not Declared
19
21
  // ---------------------------------------------------------------------------
20
- /**
21
- * A `secret:X` pseudo-node is referenced in @connect but no `@secret X` is declared.
22
- * This means the export target won't know about the secret and can't generate
23
- * proper environment variable references.
24
- */
25
22
  export const secretNotDeclaredRule = {
26
23
  name: 'CICD_SECRET_NOT_DECLARED',
27
24
  validate(ast) {
@@ -43,10 +40,6 @@ export const secretNotDeclaredRule = {
43
40
  // ---------------------------------------------------------------------------
44
41
  // Rule 2: Secret Unused
45
42
  // ---------------------------------------------------------------------------
46
- /**
47
- * A `@secret X` is declared but never wired via `@connect secret:X -> ...`.
48
- * The secret might be intentional (used in a shell-command step) or a leftover.
49
- */
50
43
  export const secretUnusedRule = {
51
44
  name: 'CICD_SECRET_UNUSED',
52
45
  validate(ast) {
@@ -68,15 +61,10 @@ export const secretUnusedRule = {
68
61
  // ---------------------------------------------------------------------------
69
62
  // Rule 3: Trigger Missing
70
63
  // ---------------------------------------------------------------------------
71
- /**
72
- * A CI/CD workflow with no trigger annotations would never run automatically.
73
- * Needs at least one @trigger (push, pull_request, schedule, dispatch, or tag).
74
- */
75
64
  export const triggerMissingRule = {
76
65
  name: 'CICD_TRIGGER_MISSING',
77
66
  validate(ast) {
78
67
  const triggers = ast.options?.cicd?.triggers || [];
79
- // Also check for FW-style triggers (event=, cron=)
80
68
  const fwTrigger = ast.options?.trigger;
81
69
  if (triggers.length === 0 && !fwTrigger) {
82
70
  return [
@@ -93,21 +81,14 @@ export const triggerMissingRule = {
93
81
  // ---------------------------------------------------------------------------
94
82
  // Rule 4: Job Missing Runner
95
83
  // ---------------------------------------------------------------------------
96
- /**
97
- * A job (group of nodes with same [job: "name"]) has no explicit runner
98
- * and the workflow has no default @runner. The export target will use a
99
- * platform default, which may not be what the user expects.
100
- */
101
84
  export const jobMissingRunnerRule = {
102
85
  name: 'CICD_JOB_MISSING_RUNNER',
103
86
  validate(ast) {
104
87
  const errors = [];
105
88
  const defaultRunner = ast.options?.cicd?.runner;
106
89
  const jobNames = getJobNames(ast);
107
- // If there's a default runner, all jobs are covered
108
90
  if (defaultRunner)
109
91
  return [];
110
- // If there are jobs but no default runner, warn
111
92
  if (jobNames.length > 0) {
112
93
  errors.push({
113
94
  type: 'warning',
@@ -121,26 +102,18 @@ export const jobMissingRunnerRule = {
121
102
  // ---------------------------------------------------------------------------
122
103
  // Rule 5: Artifact Cross-Job
123
104
  // ---------------------------------------------------------------------------
124
- /**
125
- * Data flows between nodes in different jobs via connections, but no @artifact
126
- * is declared. In CI/CD, each job runs in a fresh environment — data must be
127
- * explicitly passed via artifacts.
128
- */
129
105
  export const artifactCrossJobRule = {
130
106
  name: 'CICD_ARTIFACT_CROSS_JOB',
131
107
  validate(ast) {
132
108
  const errors = [];
133
109
  const artifacts = ast.options?.cicd?.artifacts || [];
134
- // Build node -> job map
135
110
  const nodeJob = new Map();
136
111
  for (const inst of ast.instances) {
137
112
  if (inst.job)
138
113
  nodeJob.set(inst.id, inst.job);
139
114
  }
140
- // Check connections between nodes in different jobs
141
115
  const crossJobPairs = new Set();
142
116
  for (const conn of ast.connections) {
143
- // Skip secret: pseudo-nodes and Start/Exit
144
117
  if (conn.from.node.startsWith('secret:'))
145
118
  continue;
146
119
  if (conn.from.node === 'Start' || conn.to.node === 'Exit')
@@ -154,7 +127,6 @@ export const artifactCrossJobRule = {
154
127
  }
155
128
  }
156
129
  }
157
- // If there are cross-job data flows but no artifacts declared, warn
158
130
  if (crossJobPairs.size > 0 && artifacts.length === 0) {
159
131
  const pairs = Array.from(crossJobPairs);
160
132
  errors.push({
@@ -169,21 +141,15 @@ export const artifactCrossJobRule = {
169
141
  // ---------------------------------------------------------------------------
170
142
  // Rule 6: Circular Job Dependencies
171
143
  // ---------------------------------------------------------------------------
172
- /**
173
- * Job dependencies (derived from @path connections between jobs) form a cycle.
174
- * CI/CD platforms reject circular job dependencies.
175
- */
176
144
  export const circularJobDepsRule = {
177
145
  name: 'CICD_CIRCULAR_JOB_DEPS',
178
146
  validate(ast) {
179
147
  const errors = [];
180
- // Build node -> job map
181
148
  const nodeJob = new Map();
182
149
  for (const inst of ast.instances) {
183
150
  if (inst.job)
184
151
  nodeJob.set(inst.id, inst.job);
185
152
  }
186
- // Build job dependency graph from connections
187
153
  const jobDeps = new Map();
188
154
  for (const conn of ast.connections) {
189
155
  if (conn.from.node.startsWith('secret:'))
@@ -198,7 +164,6 @@ export const circularJobDepsRule = {
198
164
  jobDeps.get(toJob).add(fromJob);
199
165
  }
200
166
  }
201
- // Detect cycles using DFS
202
167
  const visited = new Set();
203
168
  const inStack = new Set();
204
169
  function hasCycle(job) {
@@ -226,7 +191,7 @@ export const circularJobDepsRule = {
226
191
  code: 'CICD_CIRCULAR_JOB_DEPS',
227
192
  message: `Circular dependency detected involving job '${job}'. CI/CD platforms require a directed acyclic graph of job dependencies.`,
228
193
  });
229
- break; // Report once
194
+ break;
230
195
  }
231
196
  }
232
197
  return errors;
@@ -235,10 +200,6 @@ export const circularJobDepsRule = {
235
200
  // ---------------------------------------------------------------------------
236
201
  // Rule 7: Matrix with Environment
237
202
  // ---------------------------------------------------------------------------
238
- /**
239
- * Using @matrix with @environment protection means each matrix combination
240
- * triggers an approval prompt. For a 3x2 matrix, that's 6 prompts.
241
- */
242
203
  export const matrixWithEnvironmentRule = {
243
204
  name: 'CICD_MATRIX_WITH_ENVIRONMENT',
244
205
  validate(ast) {
@@ -246,7 +207,6 @@ export const matrixWithEnvironmentRule = {
246
207
  const matrix = ast.options?.cicd?.matrix;
247
208
  const environments = ast.options?.cicd?.environments || [];
248
209
  if (matrix && environments.length > 0) {
249
- // Calculate matrix size
250
210
  const dimensions = matrix.include
251
211
  ? matrix.include.length
252
212
  : Object.values(matrix.dimensions || {}).reduce((acc, vals) => acc * vals.length, 1);
@@ -262,9 +222,55 @@ export const matrixWithEnvironmentRule = {
262
222
  },
263
223
  };
264
224
  // ---------------------------------------------------------------------------
225
+ // Rule 8: Job Config Orphan
226
+ // ---------------------------------------------------------------------------
227
+ export const jobConfigOrphanRule = {
228
+ name: 'CICD_JOB_CONFIG_ORPHAN',
229
+ validate(ast) {
230
+ const errors = [];
231
+ const jobConfigs = ast.options?.cicd?.jobs || [];
232
+ const actualJobs = new Set(getJobNames(ast));
233
+ for (const jc of jobConfigs) {
234
+ if (!actualJobs.has(jc.id)) {
235
+ errors.push({
236
+ type: 'warning',
237
+ code: 'CICD_JOB_CONFIG_ORPHAN',
238
+ message: `@job '${jc.id}' is configured but no node uses [job: "${jc.id}"]. Check for typos or add a node with that job attribute.`,
239
+ });
240
+ }
241
+ }
242
+ return errors;
243
+ },
244
+ };
245
+ // ---------------------------------------------------------------------------
246
+ // Rule 9: Stage Orphan
247
+ // ---------------------------------------------------------------------------
248
+ export const stageOrphanRule = {
249
+ name: 'CICD_STAGE_ORPHAN',
250
+ validate(ast) {
251
+ const errors = [];
252
+ const stages = ast.options?.cicd?.stages || [];
253
+ if (stages.length === 0)
254
+ return [];
255
+ const jobNames = getJobNames(ast);
256
+ if (jobNames.length === 0)
257
+ return [];
258
+ for (const stage of stages) {
259
+ const hasMatch = jobNames.some(j => j === stage.name || j.startsWith(stage.name + '-') || j.startsWith(stage.name + '_'));
260
+ if (!hasMatch && jobNames.length > 0) {
261
+ errors.push({
262
+ type: 'warning',
263
+ code: 'CICD_STAGE_ORPHAN',
264
+ message: `Stage '${stage.name}' has no jobs matching by name prefix. Jobs will be assigned by dependency depth.`,
265
+ });
266
+ }
267
+ }
268
+ return errors;
269
+ },
270
+ };
271
+ // ---------------------------------------------------------------------------
265
272
  // Public API
266
273
  // ---------------------------------------------------------------------------
267
- /** All CI/CD validation rules */
268
274
  export const cicdValidationRules = [
269
275
  secretNotDeclaredRule,
270
276
  secretUnusedRule,
@@ -273,12 +279,10 @@ export const cicdValidationRules = [
273
279
  artifactCrossJobRule,
274
280
  circularJobDepsRule,
275
281
  matrixWithEnvironmentRule,
282
+ jobConfigOrphanRule,
283
+ stageOrphanRule,
276
284
  ];
277
- /**
278
- * Get all CI/CD validation rules.
279
- * Convenience function for passing to validateWorkflow().
280
- */
281
285
  export function getCICDValidationRules() {
282
286
  return cicdValidationRules;
283
287
  }
284
- //# sourceMappingURL=cicd-rules.js.map
288
+ //# sourceMappingURL=rules.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * CI/CD tag handler for the TagHandlerRegistry.
3
+ *
4
+ * Handles all CI/CD annotation tags: @secret, @runner, @cache, @artifact,
5
+ * @environment, @matrix, @service, @concurrency, @job, @stage, @variables,
6
+ * @before_script, @tags, @includes, plus the synthetic _cicdTrigger tag
7
+ * for CI/CD trigger variants of @trigger.
8
+ *
9
+ * Each parser writes to ctx.deploy (the 'cicd' namespace slot) using the
10
+ * same structures as the former jsdoc-parser.ts private methods.
11
+ */
12
+ import type { TTagHandlerFn } from '../../parser/tag-registry.js';
13
+ export declare const cicdTagHandler: TTagHandlerFn;
14
+ //# sourceMappingURL=tag-handler.d.ts.map