@synergenius/flow-weaver 0.17.7 → 0.17.9

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 (52) hide show
  1. package/dist/api/parse.d.ts +5 -0
  2. package/dist/api/parse.js +4 -0
  3. package/dist/ast/types.d.ts +2 -0
  4. package/dist/cli/commands/compile.js +2 -1
  5. package/dist/cli/commands/init.js +15 -9
  6. package/dist/cli/commands/validate.js +1 -1
  7. package/dist/cli/exports.d.ts +17 -0
  8. package/dist/cli/exports.js +23 -0
  9. package/dist/cli/flow-weaver.mjs +59021 -62127
  10. package/dist/cli/templates/index.js +8 -1
  11. package/dist/extensions/index.d.ts +10 -6
  12. package/dist/extensions/index.js +11 -6
  13. package/dist/generated-version.d.ts +1 -1
  14. package/dist/generated-version.js +1 -1
  15. package/dist/generator/index.d.ts +11 -0
  16. package/dist/generator/index.js +11 -0
  17. package/dist/parser.d.ts +7 -0
  18. package/dist/parser.js +29 -0
  19. package/package.json +11 -7
  20. package/dist/extensions/cicd/base-target.d.ts +0 -110
  21. package/dist/extensions/cicd/base-target.js +0 -397
  22. package/dist/extensions/cicd/detection.d.ts +0 -33
  23. package/dist/extensions/cicd/detection.js +0 -88
  24. package/dist/extensions/cicd/docs/cicd.md +0 -395
  25. package/dist/extensions/cicd/index.d.ts +0 -15
  26. package/dist/extensions/cicd/index.js +0 -15
  27. package/dist/extensions/cicd/register.d.ts +0 -11
  28. package/dist/extensions/cicd/register.js +0 -62
  29. package/dist/extensions/cicd/rules.d.ts +0 -30
  30. package/dist/extensions/cicd/rules.js +0 -288
  31. package/dist/extensions/cicd/tag-handler.d.ts +0 -14
  32. package/dist/extensions/cicd/tag-handler.js +0 -504
  33. package/dist/extensions/cicd/templates/cicd-docker.d.ts +0 -9
  34. package/dist/extensions/cicd/templates/cicd-docker.js +0 -110
  35. package/dist/extensions/cicd/templates/cicd-matrix.d.ts +0 -9
  36. package/dist/extensions/cicd/templates/cicd-matrix.js +0 -112
  37. package/dist/extensions/cicd/templates/cicd-multi-env.d.ts +0 -9
  38. package/dist/extensions/cicd/templates/cicd-multi-env.js +0 -126
  39. package/dist/extensions/cicd/templates/cicd-test-deploy.d.ts +0 -11
  40. package/dist/extensions/cicd/templates/cicd-test-deploy.js +0 -156
  41. package/dist/extensions/inngest/dev-mode.d.ts +0 -9
  42. package/dist/extensions/inngest/dev-mode.js +0 -213
  43. package/dist/extensions/inngest/generator.d.ts +0 -53
  44. package/dist/extensions/inngest/generator.js +0 -1176
  45. package/dist/extensions/inngest/index.d.ts +0 -2
  46. package/dist/extensions/inngest/index.js +0 -2
  47. package/dist/extensions/inngest/register.d.ts +0 -6
  48. package/dist/extensions/inngest/register.js +0 -23
  49. package/dist/extensions/inngest/templates/ai-agent-durable.d.ts +0 -8
  50. package/dist/extensions/inngest/templates/ai-agent-durable.js +0 -334
  51. package/dist/extensions/inngest/templates/ai-pipeline-durable.d.ts +0 -8
  52. package/dist/extensions/inngest/templates/ai-pipeline-durable.js +0 -326
@@ -1,288 +0,0 @@
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 { getDeclaredSecrets, getReferencedSecrets, getJobNames, } from './detection.js';
19
- // ---------------------------------------------------------------------------
20
- // Rule 1: Secret Not Declared
21
- // ---------------------------------------------------------------------------
22
- export const secretNotDeclaredRule = {
23
- name: 'CICD_SECRET_NOT_DECLARED',
24
- validate(ast) {
25
- const errors = [];
26
- const declared = new Set(getDeclaredSecrets(ast));
27
- const referenced = getReferencedSecrets(ast);
28
- for (const secretName of referenced) {
29
- if (!declared.has(secretName)) {
30
- errors.push({
31
- type: 'error',
32
- code: 'CICD_SECRET_NOT_DECLARED',
33
- message: `Secret '${secretName}' is referenced via @connect but not declared with @secret. Add: @secret ${secretName} - description`,
34
- });
35
- }
36
- }
37
- return errors;
38
- },
39
- };
40
- // ---------------------------------------------------------------------------
41
- // Rule 2: Secret Unused
42
- // ---------------------------------------------------------------------------
43
- export const secretUnusedRule = {
44
- name: 'CICD_SECRET_UNUSED',
45
- validate(ast) {
46
- const errors = [];
47
- const referenced = new Set(getReferencedSecrets(ast));
48
- const declared = getDeclaredSecrets(ast);
49
- for (const secretName of declared) {
50
- if (!referenced.has(secretName)) {
51
- errors.push({
52
- type: 'warning',
53
- code: 'CICD_SECRET_UNUSED',
54
- message: `Secret '${secretName}' is declared but not wired to any node. If used in a shell command, this is fine. Otherwise, wire it with: @connect secret:${secretName} -> node.port`,
55
- });
56
- }
57
- }
58
- return errors;
59
- },
60
- };
61
- // ---------------------------------------------------------------------------
62
- // Rule 3: Trigger Missing
63
- // ---------------------------------------------------------------------------
64
- export const triggerMissingRule = {
65
- name: 'CICD_TRIGGER_MISSING',
66
- validate(ast) {
67
- const triggers = ast.options?.cicd?.triggers || [];
68
- const fwTrigger = ast.options?.trigger;
69
- if (triggers.length === 0 && !fwTrigger) {
70
- return [
71
- {
72
- type: 'warning',
73
- code: 'CICD_TRIGGER_MISSING',
74
- message: 'No trigger annotations found. The pipeline will never run automatically. Add at least one: @trigger push branches="main" or @trigger dispatch',
75
- },
76
- ];
77
- }
78
- return [];
79
- },
80
- };
81
- // ---------------------------------------------------------------------------
82
- // Rule 4: Job Missing Runner
83
- // ---------------------------------------------------------------------------
84
- export const jobMissingRunnerRule = {
85
- name: 'CICD_JOB_MISSING_RUNNER',
86
- validate(ast) {
87
- const errors = [];
88
- const defaultRunner = ast.options?.cicd?.runner;
89
- const jobNames = getJobNames(ast);
90
- if (defaultRunner)
91
- return [];
92
- if (jobNames.length > 0) {
93
- errors.push({
94
- type: 'warning',
95
- code: 'CICD_JOB_MISSING_RUNNER',
96
- message: `No @runner annotation found. Jobs (${jobNames.join(', ')}) will use platform defaults. Add: @runner ubuntu-latest`,
97
- });
98
- }
99
- return errors;
100
- },
101
- };
102
- // ---------------------------------------------------------------------------
103
- // Rule 5: Artifact Cross-Job
104
- // ---------------------------------------------------------------------------
105
- export const artifactCrossJobRule = {
106
- name: 'CICD_ARTIFACT_CROSS_JOB',
107
- validate(ast) {
108
- const errors = [];
109
- const artifacts = ast.options?.cicd?.artifacts || [];
110
- const nodeJob = new Map();
111
- for (const inst of ast.instances) {
112
- if (inst.job)
113
- nodeJob.set(inst.id, inst.job);
114
- }
115
- const crossJobPairs = new Set();
116
- for (const conn of ast.connections) {
117
- if (conn.from.node.startsWith('secret:'))
118
- continue;
119
- if (conn.from.node === 'Start' || conn.to.node === 'Exit')
120
- continue;
121
- const fromJob = nodeJob.get(conn.from.node);
122
- const toJob = nodeJob.get(conn.to.node);
123
- if (fromJob && toJob && fromJob !== toJob) {
124
- const pairKey = `${fromJob}->${toJob}`;
125
- if (!crossJobPairs.has(pairKey)) {
126
- crossJobPairs.add(pairKey);
127
- }
128
- }
129
- }
130
- if (crossJobPairs.size > 0 && artifacts.length === 0) {
131
- const pairs = Array.from(crossJobPairs);
132
- errors.push({
133
- type: 'warning',
134
- code: 'CICD_ARTIFACT_CROSS_JOB',
135
- message: `Data flows between jobs (${pairs.join(', ')}) but no @artifact is declared. In CI/CD, each job runs in a fresh environment. Add @artifact declarations to pass data between jobs.`,
136
- });
137
- }
138
- return errors;
139
- },
140
- };
141
- // ---------------------------------------------------------------------------
142
- // Rule 6: Circular Job Dependencies
143
- // ---------------------------------------------------------------------------
144
- export const circularJobDepsRule = {
145
- name: 'CICD_CIRCULAR_JOB_DEPS',
146
- validate(ast) {
147
- const errors = [];
148
- const nodeJob = new Map();
149
- for (const inst of ast.instances) {
150
- if (inst.job)
151
- nodeJob.set(inst.id, inst.job);
152
- }
153
- const jobDeps = new Map();
154
- for (const conn of ast.connections) {
155
- if (conn.from.node.startsWith('secret:'))
156
- continue;
157
- if (conn.from.node === 'Start' || conn.to.node === 'Exit')
158
- continue;
159
- const fromJob = nodeJob.get(conn.from.node);
160
- const toJob = nodeJob.get(conn.to.node);
161
- if (fromJob && toJob && fromJob !== toJob) {
162
- if (!jobDeps.has(toJob))
163
- jobDeps.set(toJob, new Set());
164
- jobDeps.get(toJob).add(fromJob);
165
- }
166
- }
167
- const visited = new Set();
168
- const inStack = new Set();
169
- function hasCycle(job) {
170
- if (inStack.has(job))
171
- return true;
172
- if (visited.has(job))
173
- return false;
174
- visited.add(job);
175
- inStack.add(job);
176
- const deps = jobDeps.get(job);
177
- if (deps) {
178
- for (const dep of deps) {
179
- if (hasCycle(dep))
180
- return true;
181
- }
182
- }
183
- inStack.delete(job);
184
- return false;
185
- }
186
- const allJobs = getJobNames(ast);
187
- for (const job of allJobs) {
188
- if (hasCycle(job)) {
189
- errors.push({
190
- type: 'error',
191
- code: 'CICD_CIRCULAR_JOB_DEPS',
192
- message: `Circular dependency detected involving job '${job}'. CI/CD platforms require a directed acyclic graph of job dependencies.`,
193
- });
194
- break;
195
- }
196
- }
197
- return errors;
198
- },
199
- };
200
- // ---------------------------------------------------------------------------
201
- // Rule 7: Matrix with Environment
202
- // ---------------------------------------------------------------------------
203
- export const matrixWithEnvironmentRule = {
204
- name: 'CICD_MATRIX_WITH_ENVIRONMENT',
205
- validate(ast) {
206
- const errors = [];
207
- const matrix = ast.options?.cicd?.matrix;
208
- const environments = ast.options?.cicd?.environments || [];
209
- if (matrix && environments.length > 0) {
210
- const dimensions = matrix.include
211
- ? matrix.include.length
212
- : Object.values(matrix.dimensions || {}).reduce((acc, vals) => acc * vals.length, 1);
213
- if (dimensions > 1) {
214
- errors.push({
215
- type: 'warning',
216
- code: 'CICD_MATRIX_WITH_ENVIRONMENT',
217
- message: `Using @matrix (${dimensions} combinations) with @environment protection will trigger ${dimensions} approval prompts per deployment. Consider separating the matrix job from the deploy job.`,
218
- });
219
- }
220
- }
221
- return errors;
222
- },
223
- };
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
- // ---------------------------------------------------------------------------
272
- // Public API
273
- // ---------------------------------------------------------------------------
274
- export const cicdValidationRules = [
275
- secretNotDeclaredRule,
276
- secretUnusedRule,
277
- triggerMissingRule,
278
- jobMissingRunnerRule,
279
- artifactCrossJobRule,
280
- circularJobDepsRule,
281
- matrixWithEnvironmentRule,
282
- jobConfigOrphanRule,
283
- stageOrphanRule,
284
- ];
285
- export function getCICDValidationRules() {
286
- return cicdValidationRules;
287
- }
288
- //# sourceMappingURL=rules.js.map
@@ -1,14 +0,0 @@
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