musubi-sdd 3.10.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -19
- package/package.json +1 -1
- package/src/agents/agent-loop.js +532 -0
- package/src/agents/agentic/code-generator.js +767 -0
- package/src/agents/agentic/code-reviewer.js +698 -0
- package/src/agents/agentic/index.js +43 -0
- package/src/agents/function-tool.js +432 -0
- package/src/agents/index.js +45 -0
- package/src/agents/schema-generator.js +514 -0
- package/src/analyzers/ast-extractor.js +870 -0
- package/src/analyzers/context-optimizer.js +681 -0
- package/src/analyzers/repository-map.js +692 -0
- package/src/integrations/index.js +7 -1
- package/src/integrations/mcp/index.js +175 -0
- package/src/integrations/mcp/mcp-context-provider.js +472 -0
- package/src/integrations/mcp/mcp-discovery.js +436 -0
- package/src/integrations/mcp/mcp-tool-registry.js +467 -0
- package/src/integrations/mcp-connector.js +818 -0
- package/src/integrations/tool-discovery.js +589 -0
- package/src/managers/index.js +7 -0
- package/src/managers/skill-tools.js +565 -0
- package/src/monitoring/cost-tracker.js +7 -0
- package/src/monitoring/incident-manager.js +10 -0
- package/src/monitoring/observability.js +10 -0
- package/src/monitoring/quality-dashboard.js +491 -0
- package/src/monitoring/release-manager.js +10 -0
- package/src/orchestration/agent-skill-binding.js +655 -0
- package/src/orchestration/error-handler.js +827 -0
- package/src/orchestration/index.js +235 -1
- package/src/orchestration/mcp-tool-adapters.js +896 -0
- package/src/orchestration/reasoning/index.js +58 -0
- package/src/orchestration/reasoning/planning-engine.js +831 -0
- package/src/orchestration/reasoning/reasoning-engine.js +710 -0
- package/src/orchestration/reasoning/self-correction.js +751 -0
- package/src/orchestration/skill-executor.js +665 -0
- package/src/orchestration/skill-registry.js +650 -0
- package/src/orchestration/workflow-examples.js +1072 -0
- package/src/orchestration/workflow-executor.js +779 -0
- package/src/phase4-integration.js +248 -0
- package/src/phase5-integration.js +402 -0
- package/src/steering/steering-auto-update.js +572 -0
- package/src/steering/steering-validator.js +547 -0
- package/src/templates/template-constraints.js +646 -0
- package/src/validators/advanced-validation.js +580 -0
|
@@ -0,0 +1,1072 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Complex Workflow Examples
|
|
3
|
+
* Sprint 3.5: Advanced Workflows
|
|
4
|
+
*
|
|
5
|
+
* Real-world workflow templates demonstrating:
|
|
6
|
+
* - Multi-stage feature development
|
|
7
|
+
* - CI/CD integration
|
|
8
|
+
* - Code review automation
|
|
9
|
+
* - Incident response
|
|
10
|
+
* - Data pipeline orchestration
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const { WorkflowDefinition, StepType, RecoveryStrategy } = require('./workflow-executor');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Feature Development Workflow
|
|
17
|
+
*
|
|
18
|
+
* Complete SDD-based feature development from requirements to deployment
|
|
19
|
+
*/
|
|
20
|
+
const featureDevelopmentWorkflow = new WorkflowDefinition(
|
|
21
|
+
'feature-development',
|
|
22
|
+
'Feature Development Workflow',
|
|
23
|
+
[
|
|
24
|
+
// Stage 1: Requirements
|
|
25
|
+
{
|
|
26
|
+
id: 'gather-requirements',
|
|
27
|
+
type: StepType.SKILL,
|
|
28
|
+
skillId: 'sdd-requirements',
|
|
29
|
+
input: {
|
|
30
|
+
feature: { $var: 'feature_name' },
|
|
31
|
+
description: { $var: 'description' },
|
|
32
|
+
stakeholders: { $var: 'stakeholders', default: [] }
|
|
33
|
+
},
|
|
34
|
+
outputVariable: 'requirements'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'requirements-checkpoint',
|
|
38
|
+
type: StepType.CHECKPOINT,
|
|
39
|
+
name: 'requirements-complete'
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// Stage 2: Design
|
|
43
|
+
{
|
|
44
|
+
id: 'create-design',
|
|
45
|
+
type: StepType.SKILL,
|
|
46
|
+
skillId: 'sdd-design',
|
|
47
|
+
input: {
|
|
48
|
+
feature: { $var: 'feature_name' },
|
|
49
|
+
requirements: { $var: 'requirements' }
|
|
50
|
+
},
|
|
51
|
+
outputVariable: 'design'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: 'design-review',
|
|
55
|
+
type: StepType.HUMAN_REVIEW,
|
|
56
|
+
message: 'Review design for ${feature_name}:\n\n${design}',
|
|
57
|
+
options: ['approve', 'request-changes', 'reject']
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'design-checkpoint',
|
|
61
|
+
type: StepType.CHECKPOINT,
|
|
62
|
+
name: 'design-approved'
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
// Stage 3: Task Breakdown
|
|
66
|
+
{
|
|
67
|
+
id: 'create-tasks',
|
|
68
|
+
type: StepType.SKILL,
|
|
69
|
+
skillId: 'sdd-tasks',
|
|
70
|
+
input: {
|
|
71
|
+
feature: { $var: 'feature_name' },
|
|
72
|
+
design: { $var: 'design' }
|
|
73
|
+
},
|
|
74
|
+
outputVariable: 'tasks'
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
// Stage 4: Implementation (parallel where possible)
|
|
78
|
+
{
|
|
79
|
+
id: 'implement-tasks',
|
|
80
|
+
type: StepType.LOOP,
|
|
81
|
+
items: { $var: 'tasks' },
|
|
82
|
+
itemVariable: 'current_task',
|
|
83
|
+
indexVariable: 'task_index',
|
|
84
|
+
steps: [
|
|
85
|
+
{
|
|
86
|
+
id: 'implement-task',
|
|
87
|
+
type: StepType.SKILL,
|
|
88
|
+
skillId: 'sdd-implement',
|
|
89
|
+
input: {
|
|
90
|
+
task: { $var: 'current_task' },
|
|
91
|
+
design: { $var: 'design' }
|
|
92
|
+
},
|
|
93
|
+
outputVariable: 'implementation_${task_index}'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: 'run-tests',
|
|
97
|
+
type: StepType.TOOL,
|
|
98
|
+
toolName: 'run_tests',
|
|
99
|
+
arguments: {
|
|
100
|
+
files: { $var: 'implementation_${task_index}.testFiles' }
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
// Stage 5: Validation
|
|
107
|
+
{
|
|
108
|
+
id: 'validate-implementation',
|
|
109
|
+
type: StepType.SKILL,
|
|
110
|
+
skillId: 'sdd-validate',
|
|
111
|
+
input: {
|
|
112
|
+
feature: { $var: 'feature_name' },
|
|
113
|
+
design: { $var: 'design' }
|
|
114
|
+
},
|
|
115
|
+
outputVariable: 'validation_result',
|
|
116
|
+
onError: {
|
|
117
|
+
strategy: RecoveryStrategy.ROLLBACK,
|
|
118
|
+
rollbackTo: 'design-approved'
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
// Stage 6: Documentation
|
|
123
|
+
{
|
|
124
|
+
id: 'generate-docs',
|
|
125
|
+
type: StepType.PARALLEL,
|
|
126
|
+
maxConcurrency: 3,
|
|
127
|
+
steps: [
|
|
128
|
+
{
|
|
129
|
+
id: 'api-docs',
|
|
130
|
+
type: StepType.SKILL,
|
|
131
|
+
skillId: 'documentation',
|
|
132
|
+
input: { type: 'api', source: { $var: 'implementation' } }
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: 'user-docs',
|
|
136
|
+
type: StepType.SKILL,
|
|
137
|
+
skillId: 'documentation',
|
|
138
|
+
input: { type: 'user-guide', feature: { $var: 'feature_name' } }
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
id: 'changelog',
|
|
142
|
+
type: StepType.SKILL,
|
|
143
|
+
skillId: 'documentation',
|
|
144
|
+
input: { type: 'changelog', feature: { $var: 'feature_name' } }
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
outputVariable: 'documentation'
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
{
|
|
151
|
+
description: 'Complete feature development workflow following SDD methodology',
|
|
152
|
+
version: '1.0.0',
|
|
153
|
+
inputs: [
|
|
154
|
+
{ name: 'feature_name', type: 'string', required: true },
|
|
155
|
+
{ name: 'description', type: 'string', required: true },
|
|
156
|
+
{ name: 'stakeholders', type: 'array', required: false }
|
|
157
|
+
],
|
|
158
|
+
outputs: [
|
|
159
|
+
{ name: 'requirements', from: 'requirements' },
|
|
160
|
+
{ name: 'design', from: 'design' },
|
|
161
|
+
{ name: 'tasks', from: 'tasks' },
|
|
162
|
+
{ name: 'validation', from: 'validation_result' },
|
|
163
|
+
{ name: 'documentation', from: 'documentation' }
|
|
164
|
+
],
|
|
165
|
+
errorHandling: {
|
|
166
|
+
strategy: RecoveryStrategy.ROLLBACK,
|
|
167
|
+
rollbackTo: 'requirements-complete'
|
|
168
|
+
},
|
|
169
|
+
retryPolicy: {
|
|
170
|
+
maxRetries: 2,
|
|
171
|
+
backoffMs: 5000
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* CI/CD Pipeline Workflow
|
|
178
|
+
*
|
|
179
|
+
* Automated build, test, and deployment pipeline
|
|
180
|
+
*/
|
|
181
|
+
const cicdPipelineWorkflow = new WorkflowDefinition(
|
|
182
|
+
'cicd-pipeline',
|
|
183
|
+
'CI/CD Pipeline Workflow',
|
|
184
|
+
[
|
|
185
|
+
// Pre-flight checks
|
|
186
|
+
{
|
|
187
|
+
id: 'preflight-checks',
|
|
188
|
+
type: StepType.PARALLEL,
|
|
189
|
+
steps: [
|
|
190
|
+
{
|
|
191
|
+
id: 'lint-check',
|
|
192
|
+
type: StepType.TOOL,
|
|
193
|
+
toolName: 'run_command',
|
|
194
|
+
arguments: { command: 'npm run lint' }
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
id: 'type-check',
|
|
198
|
+
type: StepType.TOOL,
|
|
199
|
+
toolName: 'run_command',
|
|
200
|
+
arguments: { command: 'npm run typecheck' }
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
id: 'security-scan',
|
|
204
|
+
type: StepType.TOOL,
|
|
205
|
+
toolName: 'run_command',
|
|
206
|
+
arguments: { command: 'npm audit --production' },
|
|
207
|
+
onError: { strategy: RecoveryStrategy.SKIP }
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
// Build
|
|
213
|
+
{
|
|
214
|
+
id: 'build',
|
|
215
|
+
type: StepType.TOOL,
|
|
216
|
+
toolName: 'run_command',
|
|
217
|
+
arguments: {
|
|
218
|
+
command: 'npm run build',
|
|
219
|
+
env: {
|
|
220
|
+
NODE_ENV: 'production',
|
|
221
|
+
BUILD_ID: { $var: 'build_id' }
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
outputVariable: 'build_result',
|
|
225
|
+
retry: { maxRetries: 2, backoffMs: 10000 }
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
id: 'build-checkpoint',
|
|
229
|
+
type: StepType.CHECKPOINT,
|
|
230
|
+
name: 'build-complete'
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
// Test stages
|
|
234
|
+
{
|
|
235
|
+
id: 'unit-tests',
|
|
236
|
+
type: StepType.TOOL,
|
|
237
|
+
toolName: 'run_tests',
|
|
238
|
+
arguments: {
|
|
239
|
+
type: 'unit',
|
|
240
|
+
coverage: true,
|
|
241
|
+
coverageThreshold: 80
|
|
242
|
+
},
|
|
243
|
+
outputVariable: 'unit_test_result'
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: 'integration-tests',
|
|
247
|
+
type: StepType.TOOL,
|
|
248
|
+
toolName: 'run_tests',
|
|
249
|
+
arguments: { type: 'integration' },
|
|
250
|
+
outputVariable: 'integration_test_result',
|
|
251
|
+
when: { $var: 'run_integration_tests' }
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
id: 'e2e-tests',
|
|
255
|
+
type: StepType.CONDITION,
|
|
256
|
+
condition: { $var: 'run_e2e_tests' },
|
|
257
|
+
thenSteps: [
|
|
258
|
+
{
|
|
259
|
+
id: 'start-test-env',
|
|
260
|
+
type: StepType.TOOL,
|
|
261
|
+
toolName: 'run_command',
|
|
262
|
+
arguments: { command: 'docker-compose up -d test-env' }
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
id: 'run-e2e',
|
|
266
|
+
type: StepType.TOOL,
|
|
267
|
+
toolName: 'run_tests',
|
|
268
|
+
arguments: { type: 'e2e' }
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
id: 'stop-test-env',
|
|
272
|
+
type: StepType.TOOL,
|
|
273
|
+
toolName: 'run_command',
|
|
274
|
+
arguments: { command: 'docker-compose down test-env' }
|
|
275
|
+
}
|
|
276
|
+
]
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
id: 'tests-checkpoint',
|
|
280
|
+
type: StepType.CHECKPOINT,
|
|
281
|
+
name: 'tests-passed'
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
// Deployment decision
|
|
285
|
+
{
|
|
286
|
+
id: 'deployment-decision',
|
|
287
|
+
type: StepType.CONDITION,
|
|
288
|
+
condition: {
|
|
289
|
+
$and: [
|
|
290
|
+
{ $eq: [{ $var: 'branch' }, 'main'] },
|
|
291
|
+
{ $eq: [{ $var: 'auto_deploy' }, true] }
|
|
292
|
+
]
|
|
293
|
+
},
|
|
294
|
+
thenSteps: [
|
|
295
|
+
{
|
|
296
|
+
id: 'deploy-staging',
|
|
297
|
+
type: StepType.TOOL,
|
|
298
|
+
toolName: 'deploy',
|
|
299
|
+
arguments: {
|
|
300
|
+
environment: 'staging',
|
|
301
|
+
version: { $var: 'build_id' }
|
|
302
|
+
},
|
|
303
|
+
outputVariable: 'staging_deploy'
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
id: 'smoke-tests',
|
|
307
|
+
type: StepType.TOOL,
|
|
308
|
+
toolName: 'run_tests',
|
|
309
|
+
arguments: { type: 'smoke', environment: 'staging' },
|
|
310
|
+
onError: {
|
|
311
|
+
strategy: RecoveryStrategy.FALLBACK,
|
|
312
|
+
fallbackSteps: [
|
|
313
|
+
{
|
|
314
|
+
id: 'rollback-staging',
|
|
315
|
+
type: StepType.TOOL,
|
|
316
|
+
toolName: 'deploy',
|
|
317
|
+
arguments: {
|
|
318
|
+
environment: 'staging',
|
|
319
|
+
version: { $var: 'previous_version' },
|
|
320
|
+
action: 'rollback'
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
id: 'production-approval',
|
|
328
|
+
type: StepType.HUMAN_REVIEW,
|
|
329
|
+
message: 'Staging deployment successful. Approve production deployment?',
|
|
330
|
+
options: ['deploy-to-production', 'hold', 'cancel']
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
id: 'deploy-production',
|
|
334
|
+
type: StepType.TOOL,
|
|
335
|
+
when: { $eq: [{ $var: 'review_result' }, 'deploy-to-production'] },
|
|
336
|
+
toolName: 'deploy',
|
|
337
|
+
arguments: {
|
|
338
|
+
environment: 'production',
|
|
339
|
+
version: { $var: 'build_id' },
|
|
340
|
+
strategy: 'blue-green'
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
],
|
|
344
|
+
elseSteps: [
|
|
345
|
+
{
|
|
346
|
+
id: 'skip-deploy-notification',
|
|
347
|
+
type: StepType.TOOL,
|
|
348
|
+
toolName: 'send_notification',
|
|
349
|
+
arguments: {
|
|
350
|
+
channel: 'builds',
|
|
351
|
+
message: 'Build ${build_id} complete. Manual deployment required.'
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
],
|
|
357
|
+
{
|
|
358
|
+
description: 'Automated CI/CD pipeline with staging and production deployment',
|
|
359
|
+
version: '2.0.0',
|
|
360
|
+
inputs: [
|
|
361
|
+
{ name: 'build_id', type: 'string', required: true },
|
|
362
|
+
{ name: 'branch', type: 'string', required: true },
|
|
363
|
+
{ name: 'auto_deploy', type: 'boolean', default: false },
|
|
364
|
+
{ name: 'run_integration_tests', type: 'boolean', default: true },
|
|
365
|
+
{ name: 'run_e2e_tests', type: 'boolean', default: false }
|
|
366
|
+
],
|
|
367
|
+
outputs: [
|
|
368
|
+
{ name: 'build_result', from: 'build_result' },
|
|
369
|
+
{ name: 'test_coverage', from: 'unit_test_result.coverage' },
|
|
370
|
+
{ name: 'deployment_status', from: 'staging_deploy' }
|
|
371
|
+
],
|
|
372
|
+
timeout: 3600000, // 1 hour
|
|
373
|
+
errorHandling: {
|
|
374
|
+
strategy: RecoveryStrategy.ROLLBACK,
|
|
375
|
+
rollbackTo: 'build-complete'
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
);
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Automated Code Review Workflow
|
|
382
|
+
*
|
|
383
|
+
* AI-assisted code review with human oversight
|
|
384
|
+
*/
|
|
385
|
+
const codeReviewWorkflow = new WorkflowDefinition(
|
|
386
|
+
'code-review',
|
|
387
|
+
'Automated Code Review Workflow',
|
|
388
|
+
[
|
|
389
|
+
// Fetch PR details
|
|
390
|
+
{
|
|
391
|
+
id: 'fetch-pr',
|
|
392
|
+
type: StepType.TOOL,
|
|
393
|
+
toolName: 'github_get_pr',
|
|
394
|
+
serverName: 'github',
|
|
395
|
+
arguments: {
|
|
396
|
+
owner: { $var: 'repo_owner' },
|
|
397
|
+
repo: { $var: 'repo_name' },
|
|
398
|
+
pr_number: { $var: 'pr_number' }
|
|
399
|
+
},
|
|
400
|
+
outputVariable: 'pr_details'
|
|
401
|
+
},
|
|
402
|
+
|
|
403
|
+
// Get changed files
|
|
404
|
+
{
|
|
405
|
+
id: 'get-diff',
|
|
406
|
+
type: StepType.TOOL,
|
|
407
|
+
toolName: 'github_get_pr_diff',
|
|
408
|
+
serverName: 'github',
|
|
409
|
+
arguments: {
|
|
410
|
+
owner: { $var: 'repo_owner' },
|
|
411
|
+
repo: { $var: 'repo_name' },
|
|
412
|
+
pr_number: { $var: 'pr_number' }
|
|
413
|
+
},
|
|
414
|
+
outputVariable: 'diff'
|
|
415
|
+
},
|
|
416
|
+
|
|
417
|
+
// Parallel analysis
|
|
418
|
+
{
|
|
419
|
+
id: 'parallel-analysis',
|
|
420
|
+
type: StepType.PARALLEL,
|
|
421
|
+
maxConcurrency: 4,
|
|
422
|
+
steps: [
|
|
423
|
+
{
|
|
424
|
+
id: 'code-quality',
|
|
425
|
+
type: StepType.SKILL,
|
|
426
|
+
skillId: 'code-analysis',
|
|
427
|
+
input: {
|
|
428
|
+
type: 'quality',
|
|
429
|
+
diff: { $var: 'diff' }
|
|
430
|
+
},
|
|
431
|
+
outputVariable: 'quality_report'
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
id: 'security-review',
|
|
435
|
+
type: StepType.SKILL,
|
|
436
|
+
skillId: 'security-analysis',
|
|
437
|
+
input: { diff: { $var: 'diff' } },
|
|
438
|
+
outputVariable: 'security_report'
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
id: 'performance-review',
|
|
442
|
+
type: StepType.SKILL,
|
|
443
|
+
skillId: 'performance-analysis',
|
|
444
|
+
input: { diff: { $var: 'diff' } },
|
|
445
|
+
outputVariable: 'performance_report'
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
id: 'test-coverage-check',
|
|
449
|
+
type: StepType.SKILL,
|
|
450
|
+
skillId: 'coverage-analysis',
|
|
451
|
+
input: {
|
|
452
|
+
changed_files: { $var: 'diff.files' }
|
|
453
|
+
},
|
|
454
|
+
outputVariable: 'coverage_report'
|
|
455
|
+
}
|
|
456
|
+
]
|
|
457
|
+
},
|
|
458
|
+
|
|
459
|
+
// Aggregate findings
|
|
460
|
+
{
|
|
461
|
+
id: 'aggregate-findings',
|
|
462
|
+
type: StepType.SKILL,
|
|
463
|
+
skillId: 'review-aggregator',
|
|
464
|
+
input: {
|
|
465
|
+
quality: { $var: 'quality_report' },
|
|
466
|
+
security: { $var: 'security_report' },
|
|
467
|
+
performance: { $var: 'performance_report' },
|
|
468
|
+
coverage: { $var: 'coverage_report' }
|
|
469
|
+
},
|
|
470
|
+
outputVariable: 'aggregated_review'
|
|
471
|
+
},
|
|
472
|
+
|
|
473
|
+
// Determine review outcome
|
|
474
|
+
{
|
|
475
|
+
id: 'determine-outcome',
|
|
476
|
+
type: StepType.CONDITION,
|
|
477
|
+
condition: {
|
|
478
|
+
$or: [
|
|
479
|
+
{ $gt: [{ $var: 'aggregated_review.critical_issues' }, 0] },
|
|
480
|
+
{ $gt: [{ $var: 'aggregated_review.security_vulnerabilities' }, 0] }
|
|
481
|
+
]
|
|
482
|
+
},
|
|
483
|
+
thenSteps: [
|
|
484
|
+
{
|
|
485
|
+
id: 'request-changes',
|
|
486
|
+
type: StepType.TOOL,
|
|
487
|
+
toolName: 'github_create_review',
|
|
488
|
+
serverName: 'github',
|
|
489
|
+
arguments: {
|
|
490
|
+
owner: { $var: 'repo_owner' },
|
|
491
|
+
repo: { $var: 'repo_name' },
|
|
492
|
+
pr_number: { $var: 'pr_number' },
|
|
493
|
+
event: 'REQUEST_CHANGES',
|
|
494
|
+
body: { $var: 'aggregated_review.summary' },
|
|
495
|
+
comments: { $var: 'aggregated_review.comments' }
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
],
|
|
499
|
+
elseSteps: [
|
|
500
|
+
{
|
|
501
|
+
id: 'human-review-decision',
|
|
502
|
+
type: StepType.CONDITION,
|
|
503
|
+
condition: { $gt: [{ $var: 'aggregated_review.total_issues' }, 5] },
|
|
504
|
+
thenSteps: [
|
|
505
|
+
{
|
|
506
|
+
id: 'request-human-review',
|
|
507
|
+
type: StepType.HUMAN_REVIEW,
|
|
508
|
+
message: 'Multiple issues found. Please review:\n${aggregated_review.summary}',
|
|
509
|
+
options: ['approve-with-comments', 'request-changes', 'approve']
|
|
510
|
+
}
|
|
511
|
+
],
|
|
512
|
+
elseSteps: [
|
|
513
|
+
{
|
|
514
|
+
id: 'auto-approve',
|
|
515
|
+
type: StepType.TOOL,
|
|
516
|
+
toolName: 'github_create_review',
|
|
517
|
+
serverName: 'github',
|
|
518
|
+
arguments: {
|
|
519
|
+
owner: { $var: 'repo_owner' },
|
|
520
|
+
repo: { $var: 'repo_name' },
|
|
521
|
+
pr_number: { $var: 'pr_number' },
|
|
522
|
+
event: 'APPROVE',
|
|
523
|
+
body: 'LGTM! Automated review passed.\n\n${aggregated_review.summary}'
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
]
|
|
527
|
+
}
|
|
528
|
+
]
|
|
529
|
+
},
|
|
530
|
+
|
|
531
|
+
// Post review comments
|
|
532
|
+
{
|
|
533
|
+
id: 'post-comments',
|
|
534
|
+
type: StepType.LOOP,
|
|
535
|
+
items: { $var: 'aggregated_review.line_comments' },
|
|
536
|
+
itemVariable: 'comment',
|
|
537
|
+
steps: [
|
|
538
|
+
{
|
|
539
|
+
id: 'post-line-comment',
|
|
540
|
+
type: StepType.TOOL,
|
|
541
|
+
toolName: 'github_create_review_comment',
|
|
542
|
+
serverName: 'github',
|
|
543
|
+
arguments: {
|
|
544
|
+
owner: { $var: 'repo_owner' },
|
|
545
|
+
repo: { $var: 'repo_name' },
|
|
546
|
+
pr_number: { $var: 'pr_number' },
|
|
547
|
+
path: { $var: 'comment.file' },
|
|
548
|
+
line: { $var: 'comment.line' },
|
|
549
|
+
body: { $var: 'comment.body' }
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
],
|
|
553
|
+
maxIterations: 50
|
|
554
|
+
}
|
|
555
|
+
],
|
|
556
|
+
{
|
|
557
|
+
description: 'AI-powered code review with quality, security, and performance analysis',
|
|
558
|
+
version: '1.0.0',
|
|
559
|
+
inputs: [
|
|
560
|
+
{ name: 'repo_owner', type: 'string', required: true },
|
|
561
|
+
{ name: 'repo_name', type: 'string', required: true },
|
|
562
|
+
{ name: 'pr_number', type: 'number', required: true }
|
|
563
|
+
],
|
|
564
|
+
outputs: [
|
|
565
|
+
{ name: 'review_summary', from: 'aggregated_review' },
|
|
566
|
+
{ name: 'critical_issues', from: 'aggregated_review.critical_issues' }
|
|
567
|
+
],
|
|
568
|
+
retryPolicy: {
|
|
569
|
+
maxRetries: 2,
|
|
570
|
+
backoffMs: 3000
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
);
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Incident Response Workflow
|
|
577
|
+
*
|
|
578
|
+
* Automated incident detection, triage, and resolution
|
|
579
|
+
*/
|
|
580
|
+
const incidentResponseWorkflow = new WorkflowDefinition(
|
|
581
|
+
'incident-response',
|
|
582
|
+
'Incident Response Workflow',
|
|
583
|
+
[
|
|
584
|
+
// Initial triage
|
|
585
|
+
{
|
|
586
|
+
id: 'classify-incident',
|
|
587
|
+
type: StepType.SKILL,
|
|
588
|
+
skillId: 'incident-classifier',
|
|
589
|
+
input: {
|
|
590
|
+
alert: { $var: 'alert_data' },
|
|
591
|
+
service: { $var: 'affected_service' }
|
|
592
|
+
},
|
|
593
|
+
outputVariable: 'classification'
|
|
594
|
+
},
|
|
595
|
+
|
|
596
|
+
// Severity-based routing
|
|
597
|
+
{
|
|
598
|
+
id: 'severity-routing',
|
|
599
|
+
type: StepType.CONDITION,
|
|
600
|
+
condition: {
|
|
601
|
+
$or: [
|
|
602
|
+
{ $eq: [{ $var: 'classification.severity' }, 'critical'] },
|
|
603
|
+
{ $eq: [{ $var: 'classification.severity' }, 'high'] }
|
|
604
|
+
]
|
|
605
|
+
},
|
|
606
|
+
thenSteps: [
|
|
607
|
+
// Critical/High: Immediate response
|
|
608
|
+
{
|
|
609
|
+
id: 'page-oncall',
|
|
610
|
+
type: StepType.PARALLEL,
|
|
611
|
+
steps: [
|
|
612
|
+
{
|
|
613
|
+
id: 'send-pagerduty',
|
|
614
|
+
type: StepType.TOOL,
|
|
615
|
+
toolName: 'pagerduty_create_incident',
|
|
616
|
+
arguments: {
|
|
617
|
+
service: { $var: 'affected_service' },
|
|
618
|
+
title: { $var: 'classification.title' },
|
|
619
|
+
urgency: 'high'
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
id: 'create-incident-channel',
|
|
624
|
+
type: StepType.TOOL,
|
|
625
|
+
toolName: 'slack_create_channel',
|
|
626
|
+
arguments: {
|
|
627
|
+
name: 'incident-${incident_id}',
|
|
628
|
+
topic: { $var: 'classification.title' }
|
|
629
|
+
},
|
|
630
|
+
outputVariable: 'incident_channel'
|
|
631
|
+
}
|
|
632
|
+
]
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
id: 'gather-diagnostics',
|
|
636
|
+
type: StepType.PARALLEL,
|
|
637
|
+
steps: [
|
|
638
|
+
{
|
|
639
|
+
id: 'fetch-logs',
|
|
640
|
+
type: StepType.TOOL,
|
|
641
|
+
toolName: 'fetch_logs',
|
|
642
|
+
arguments: {
|
|
643
|
+
service: { $var: 'affected_service' },
|
|
644
|
+
timeRange: '15m',
|
|
645
|
+
level: 'error'
|
|
646
|
+
},
|
|
647
|
+
outputVariable: 'error_logs'
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
id: 'fetch-metrics',
|
|
651
|
+
type: StepType.TOOL,
|
|
652
|
+
toolName: 'fetch_metrics',
|
|
653
|
+
arguments: {
|
|
654
|
+
service: { $var: 'affected_service' },
|
|
655
|
+
timeRange: '1h'
|
|
656
|
+
},
|
|
657
|
+
outputVariable: 'metrics'
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
id: 'check-dependencies',
|
|
661
|
+
type: StepType.TOOL,
|
|
662
|
+
toolName: 'check_service_health',
|
|
663
|
+
arguments: {
|
|
664
|
+
services: { $var: 'classification.dependencies' }
|
|
665
|
+
},
|
|
666
|
+
outputVariable: 'dependency_health'
|
|
667
|
+
}
|
|
668
|
+
]
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
id: 'ai-diagnosis',
|
|
672
|
+
type: StepType.SKILL,
|
|
673
|
+
skillId: 'incident-diagnosis',
|
|
674
|
+
input: {
|
|
675
|
+
logs: { $var: 'error_logs' },
|
|
676
|
+
metrics: { $var: 'metrics' },
|
|
677
|
+
dependencies: { $var: 'dependency_health' },
|
|
678
|
+
classification: { $var: 'classification' }
|
|
679
|
+
},
|
|
680
|
+
outputVariable: 'diagnosis'
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
id: 'post-diagnosis',
|
|
684
|
+
type: StepType.TOOL,
|
|
685
|
+
toolName: 'slack_post_message',
|
|
686
|
+
arguments: {
|
|
687
|
+
channel: { $var: 'incident_channel.id' },
|
|
688
|
+
blocks: { $var: 'diagnosis.slack_blocks' }
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
],
|
|
692
|
+
elseSteps: [
|
|
693
|
+
// Medium/Low: Create ticket
|
|
694
|
+
{
|
|
695
|
+
id: 'create-ticket',
|
|
696
|
+
type: StepType.TOOL,
|
|
697
|
+
toolName: 'jira_create_issue',
|
|
698
|
+
arguments: {
|
|
699
|
+
project: 'OPS',
|
|
700
|
+
type: 'Bug',
|
|
701
|
+
summary: { $var: 'classification.title' },
|
|
702
|
+
priority: { $var: 'classification.jira_priority' }
|
|
703
|
+
},
|
|
704
|
+
outputVariable: 'ticket'
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
id: 'notify-team',
|
|
708
|
+
type: StepType.TOOL,
|
|
709
|
+
toolName: 'slack_post_message',
|
|
710
|
+
arguments: {
|
|
711
|
+
channel: '#ops-alerts',
|
|
712
|
+
text: 'New incident: ${classification.title}\nTicket: ${ticket.key}'
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
]
|
|
716
|
+
},
|
|
717
|
+
|
|
718
|
+
// Resolution attempt
|
|
719
|
+
{
|
|
720
|
+
id: 'attempt-auto-resolution',
|
|
721
|
+
type: StepType.CONDITION,
|
|
722
|
+
condition: {
|
|
723
|
+
$and: [
|
|
724
|
+
{ $exists: 'diagnosis.auto_remediation' },
|
|
725
|
+
{ $eq: [{ $var: 'classification.auto_remediation_allowed' }, true] }
|
|
726
|
+
]
|
|
727
|
+
},
|
|
728
|
+
thenSteps: [
|
|
729
|
+
{
|
|
730
|
+
id: 'execute-remediation',
|
|
731
|
+
type: StepType.LOOP,
|
|
732
|
+
items: { $var: 'diagnosis.remediation_steps' },
|
|
733
|
+
itemVariable: 'step',
|
|
734
|
+
steps: [
|
|
735
|
+
{
|
|
736
|
+
id: 'run-remediation-step',
|
|
737
|
+
type: StepType.TOOL,
|
|
738
|
+
toolName: { $var: 'step.tool' },
|
|
739
|
+
arguments: { $var: 'step.arguments' },
|
|
740
|
+
onError: {
|
|
741
|
+
strategy: RecoveryStrategy.MANUAL,
|
|
742
|
+
message: 'Remediation step failed: ${step.name}'
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
]
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
id: 'verify-resolution',
|
|
749
|
+
type: StepType.TOOL,
|
|
750
|
+
toolName: 'check_service_health',
|
|
751
|
+
arguments: {
|
|
752
|
+
services: [{ $var: 'affected_service' }]
|
|
753
|
+
},
|
|
754
|
+
outputVariable: 'post_remediation_health'
|
|
755
|
+
}
|
|
756
|
+
]
|
|
757
|
+
},
|
|
758
|
+
|
|
759
|
+
// Post-incident
|
|
760
|
+
{
|
|
761
|
+
id: 'finalize-incident',
|
|
762
|
+
type: StepType.PARALLEL,
|
|
763
|
+
steps: [
|
|
764
|
+
{
|
|
765
|
+
id: 'update-status-page',
|
|
766
|
+
type: StepType.TOOL,
|
|
767
|
+
toolName: 'statuspage_update',
|
|
768
|
+
arguments: {
|
|
769
|
+
incident_id: { $var: 'incident_id' },
|
|
770
|
+
status: 'resolved'
|
|
771
|
+
}
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
id: 'schedule-postmortem',
|
|
775
|
+
type: StepType.TOOL,
|
|
776
|
+
when: { $eq: [{ $var: 'classification.severity' }, 'critical'] },
|
|
777
|
+
toolName: 'calendar_create_event',
|
|
778
|
+
arguments: {
|
|
779
|
+
title: 'Postmortem: ${classification.title}',
|
|
780
|
+
duration: 60,
|
|
781
|
+
attendees: { $var: 'classification.stakeholders' }
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
]
|
|
785
|
+
}
|
|
786
|
+
],
|
|
787
|
+
{
|
|
788
|
+
description: 'Automated incident response with AI-powered diagnosis and remediation',
|
|
789
|
+
version: '1.0.0',
|
|
790
|
+
inputs: [
|
|
791
|
+
{ name: 'incident_id', type: 'string', required: true },
|
|
792
|
+
{ name: 'alert_data', type: 'object', required: true },
|
|
793
|
+
{ name: 'affected_service', type: 'string', required: true }
|
|
794
|
+
],
|
|
795
|
+
outputs: [
|
|
796
|
+
{ name: 'classification', from: 'classification' },
|
|
797
|
+
{ name: 'diagnosis', from: 'diagnosis' },
|
|
798
|
+
{ name: 'resolution_status', from: 'post_remediation_health' }
|
|
799
|
+
],
|
|
800
|
+
errorHandling: {
|
|
801
|
+
strategy: RecoveryStrategy.MANUAL
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
);
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Data Pipeline Workflow
|
|
808
|
+
*
|
|
809
|
+
* ETL/ELT pipeline with quality checks and monitoring
|
|
810
|
+
*/
|
|
811
|
+
const dataPipelineWorkflow = new WorkflowDefinition(
|
|
812
|
+
'data-pipeline',
|
|
813
|
+
'Data Pipeline Workflow',
|
|
814
|
+
[
|
|
815
|
+
// Extract
|
|
816
|
+
{
|
|
817
|
+
id: 'extract-data',
|
|
818
|
+
type: StepType.PARALLEL,
|
|
819
|
+
steps: [
|
|
820
|
+
{
|
|
821
|
+
id: 'extract-source-a',
|
|
822
|
+
type: StepType.TOOL,
|
|
823
|
+
toolName: 'data_extract',
|
|
824
|
+
arguments: {
|
|
825
|
+
source: { $var: 'source_a_config' },
|
|
826
|
+
query: { $var: 'source_a_query' }
|
|
827
|
+
},
|
|
828
|
+
outputVariable: 'data_a',
|
|
829
|
+
retry: { maxRetries: 3, backoffMs: 5000 }
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
id: 'extract-source-b',
|
|
833
|
+
type: StepType.TOOL,
|
|
834
|
+
toolName: 'data_extract',
|
|
835
|
+
arguments: {
|
|
836
|
+
source: { $var: 'source_b_config' },
|
|
837
|
+
query: { $var: 'source_b_query' }
|
|
838
|
+
},
|
|
839
|
+
outputVariable: 'data_b',
|
|
840
|
+
retry: { maxRetries: 3, backoffMs: 5000 }
|
|
841
|
+
}
|
|
842
|
+
]
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
id: 'extraction-checkpoint',
|
|
846
|
+
type: StepType.CHECKPOINT,
|
|
847
|
+
name: 'extraction-complete'
|
|
848
|
+
},
|
|
849
|
+
|
|
850
|
+
// Data quality checks
|
|
851
|
+
{
|
|
852
|
+
id: 'quality-checks',
|
|
853
|
+
type: StepType.PARALLEL,
|
|
854
|
+
steps: [
|
|
855
|
+
{
|
|
856
|
+
id: 'check-completeness',
|
|
857
|
+
type: StepType.SKILL,
|
|
858
|
+
skillId: 'data-quality',
|
|
859
|
+
input: {
|
|
860
|
+
check: 'completeness',
|
|
861
|
+
data: [{ $var: 'data_a' }, { $var: 'data_b' }],
|
|
862
|
+
thresholds: { $var: 'quality_thresholds' }
|
|
863
|
+
},
|
|
864
|
+
outputVariable: 'completeness_result'
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
id: 'check-consistency',
|
|
868
|
+
type: StepType.SKILL,
|
|
869
|
+
skillId: 'data-quality',
|
|
870
|
+
input: {
|
|
871
|
+
check: 'consistency',
|
|
872
|
+
data: [{ $var: 'data_a' }, { $var: 'data_b' }]
|
|
873
|
+
},
|
|
874
|
+
outputVariable: 'consistency_result'
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
id: 'check-freshness',
|
|
878
|
+
type: StepType.SKILL,
|
|
879
|
+
skillId: 'data-quality',
|
|
880
|
+
input: {
|
|
881
|
+
check: 'freshness',
|
|
882
|
+
data: [{ $var: 'data_a' }, { $var: 'data_b' }],
|
|
883
|
+
maxAge: { $var: 'max_data_age' }
|
|
884
|
+
},
|
|
885
|
+
outputVariable: 'freshness_result'
|
|
886
|
+
}
|
|
887
|
+
]
|
|
888
|
+
},
|
|
889
|
+
|
|
890
|
+
// Quality gate
|
|
891
|
+
{
|
|
892
|
+
id: 'quality-gate',
|
|
893
|
+
type: StepType.CONDITION,
|
|
894
|
+
condition: {
|
|
895
|
+
$and: [
|
|
896
|
+
{ $var: 'completeness_result.passed' },
|
|
897
|
+
{ $var: 'consistency_result.passed' },
|
|
898
|
+
{ $var: 'freshness_result.passed' }
|
|
899
|
+
]
|
|
900
|
+
},
|
|
901
|
+
thenSteps: [
|
|
902
|
+
// Transform
|
|
903
|
+
{
|
|
904
|
+
id: 'transform-data',
|
|
905
|
+
type: StepType.SKILL,
|
|
906
|
+
skillId: 'data-transform',
|
|
907
|
+
input: {
|
|
908
|
+
sources: {
|
|
909
|
+
a: { $var: 'data_a' },
|
|
910
|
+
b: { $var: 'data_b' }
|
|
911
|
+
},
|
|
912
|
+
transformations: { $var: 'transform_config' }
|
|
913
|
+
},
|
|
914
|
+
outputVariable: 'transformed_data'
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
id: 'transform-checkpoint',
|
|
918
|
+
type: StepType.CHECKPOINT,
|
|
919
|
+
name: 'transform-complete'
|
|
920
|
+
},
|
|
921
|
+
|
|
922
|
+
// Load
|
|
923
|
+
{
|
|
924
|
+
id: 'load-data',
|
|
925
|
+
type: StepType.TOOL,
|
|
926
|
+
toolName: 'data_load',
|
|
927
|
+
arguments: {
|
|
928
|
+
destination: { $var: 'destination_config' },
|
|
929
|
+
data: { $var: 'transformed_data' },
|
|
930
|
+
mode: { $var: 'load_mode' }
|
|
931
|
+
},
|
|
932
|
+
outputVariable: 'load_result',
|
|
933
|
+
onError: {
|
|
934
|
+
strategy: RecoveryStrategy.ROLLBACK,
|
|
935
|
+
rollbackTo: 'transform-complete'
|
|
936
|
+
}
|
|
937
|
+
},
|
|
938
|
+
|
|
939
|
+
// Post-load validation
|
|
940
|
+
{
|
|
941
|
+
id: 'validate-load',
|
|
942
|
+
type: StepType.TOOL,
|
|
943
|
+
toolName: 'data_validate',
|
|
944
|
+
arguments: {
|
|
945
|
+
destination: { $var: 'destination_config' },
|
|
946
|
+
expectedRows: { $var: 'transformed_data.rowCount' }
|
|
947
|
+
},
|
|
948
|
+
outputVariable: 'validation_result'
|
|
949
|
+
}
|
|
950
|
+
],
|
|
951
|
+
elseSteps: [
|
|
952
|
+
{
|
|
953
|
+
id: 'quality-failure-alert',
|
|
954
|
+
type: StepType.TOOL,
|
|
955
|
+
toolName: 'send_alert',
|
|
956
|
+
arguments: {
|
|
957
|
+
channel: '#data-alerts',
|
|
958
|
+
severity: 'high',
|
|
959
|
+
message: 'Data quality check failed',
|
|
960
|
+
details: {
|
|
961
|
+
completeness: { $var: 'completeness_result' },
|
|
962
|
+
consistency: { $var: 'consistency_result' },
|
|
963
|
+
freshness: { $var: 'freshness_result' }
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
},
|
|
967
|
+
{
|
|
968
|
+
id: 'quality-human-review',
|
|
969
|
+
type: StepType.HUMAN_REVIEW,
|
|
970
|
+
message: 'Data quality check failed. Review and decide:',
|
|
971
|
+
options: ['proceed-anyway', 'retry-extraction', 'abort']
|
|
972
|
+
}
|
|
973
|
+
]
|
|
974
|
+
},
|
|
975
|
+
|
|
976
|
+
// Metrics and reporting
|
|
977
|
+
{
|
|
978
|
+
id: 'record-metrics',
|
|
979
|
+
type: StepType.TOOL,
|
|
980
|
+
toolName: 'metrics_record',
|
|
981
|
+
arguments: {
|
|
982
|
+
pipeline: { $var: 'pipeline_name' },
|
|
983
|
+
metrics: {
|
|
984
|
+
rowsProcessed: { $var: 'load_result.rowsInserted' },
|
|
985
|
+
duration: { $var: '__duration' },
|
|
986
|
+
qualityScores: {
|
|
987
|
+
completeness: { $var: 'completeness_result.score' },
|
|
988
|
+
consistency: { $var: 'consistency_result.score' }
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
],
|
|
994
|
+
{
|
|
995
|
+
description: 'ETL/ELT data pipeline with quality gates and monitoring',
|
|
996
|
+
version: '1.0.0',
|
|
997
|
+
inputs: [
|
|
998
|
+
{ name: 'pipeline_name', type: 'string', required: true },
|
|
999
|
+
{ name: 'source_a_config', type: 'object', required: true },
|
|
1000
|
+
{ name: 'source_a_query', type: 'string', required: true },
|
|
1001
|
+
{ name: 'source_b_config', type: 'object', required: true },
|
|
1002
|
+
{ name: 'source_b_query', type: 'string', required: true },
|
|
1003
|
+
{ name: 'destination_config', type: 'object', required: true },
|
|
1004
|
+
{ name: 'transform_config', type: 'object', required: true },
|
|
1005
|
+
{ name: 'quality_thresholds', type: 'object', required: false },
|
|
1006
|
+
{ name: 'max_data_age', type: 'string', default: '24h' },
|
|
1007
|
+
{ name: 'load_mode', type: 'string', default: 'append' }
|
|
1008
|
+
],
|
|
1009
|
+
outputs: [
|
|
1010
|
+
{ name: 'load_result', from: 'load_result' },
|
|
1011
|
+
{ name: 'validation', from: 'validation_result' },
|
|
1012
|
+
{ name: 'quality_report', from: 'quality_gate_results' }
|
|
1013
|
+
],
|
|
1014
|
+
timeout: 7200000, // 2 hours
|
|
1015
|
+
errorHandling: {
|
|
1016
|
+
strategy: RecoveryStrategy.ROLLBACK,
|
|
1017
|
+
rollbackTo: 'extraction-complete'
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
);
|
|
1021
|
+
|
|
1022
|
+
/**
|
|
1023
|
+
* Workflow template factory
|
|
1024
|
+
*/
|
|
1025
|
+
function createWorkflowFromTemplate(templateName, customizations = {}) {
|
|
1026
|
+
const templates = {
|
|
1027
|
+
'feature-development': featureDevelopmentWorkflow,
|
|
1028
|
+
'cicd-pipeline': cicdPipelineWorkflow,
|
|
1029
|
+
'code-review': codeReviewWorkflow,
|
|
1030
|
+
'incident-response': incidentResponseWorkflow,
|
|
1031
|
+
'data-pipeline': dataPipelineWorkflow
|
|
1032
|
+
};
|
|
1033
|
+
|
|
1034
|
+
const template = templates[templateName];
|
|
1035
|
+
if (!template) {
|
|
1036
|
+
throw new Error(`Unknown workflow template: ${templateName}`);
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
// Clone and customize
|
|
1040
|
+
const workflow = new WorkflowDefinition(
|
|
1041
|
+
customizations.id || template.id,
|
|
1042
|
+
customizations.name || template.name,
|
|
1043
|
+
customizations.steps || template.steps,
|
|
1044
|
+
{
|
|
1045
|
+
description: customizations.description || template.description,
|
|
1046
|
+
version: customizations.version || template.version,
|
|
1047
|
+
inputs: customizations.inputs || template.inputs,
|
|
1048
|
+
outputs: customizations.outputs || template.outputs,
|
|
1049
|
+
errorHandling: customizations.errorHandling || template.errorHandling,
|
|
1050
|
+
timeout: customizations.timeout || template.timeout,
|
|
1051
|
+
retryPolicy: customizations.retryPolicy || template.retryPolicy
|
|
1052
|
+
}
|
|
1053
|
+
);
|
|
1054
|
+
|
|
1055
|
+
return workflow;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
module.exports = {
|
|
1059
|
+
// Individual workflows
|
|
1060
|
+
featureDevelopmentWorkflow,
|
|
1061
|
+
cicdPipelineWorkflow,
|
|
1062
|
+
codeReviewWorkflow,
|
|
1063
|
+
incidentResponseWorkflow,
|
|
1064
|
+
dataPipelineWorkflow,
|
|
1065
|
+
|
|
1066
|
+
// Factory
|
|
1067
|
+
createWorkflowFromTemplate,
|
|
1068
|
+
|
|
1069
|
+
// Re-export types
|
|
1070
|
+
StepType,
|
|
1071
|
+
RecoveryStrategy
|
|
1072
|
+
};
|