@exaudeus/workrail 3.27.0 → 3.29.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/dist/console/assets/{index-FtTaDku8.js → index-BZ6HkxGf.js} +1 -1
- package/dist/console/index.html +1 -1
- package/dist/manifest.json +3 -3
- package/docs/README.md +57 -0
- package/docs/adrs/001-hybrid-storage-backend.md +38 -0
- package/docs/adrs/002-four-layer-context-classification.md +38 -0
- package/docs/adrs/003-checkpoint-trigger-strategy.md +35 -0
- package/docs/adrs/004-opt-in-encryption-strategy.md +36 -0
- package/docs/adrs/005-agent-first-workflow-execution-tokens.md +105 -0
- package/docs/adrs/006-append-only-session-run-event-log.md +76 -0
- package/docs/adrs/007-resume-and-checkpoint-only-sessions.md +51 -0
- package/docs/adrs/008-blocked-nodes-architectural-upgrade.md +178 -0
- package/docs/adrs/009-bridge-mode-single-instance-mcp.md +195 -0
- package/docs/adrs/010-release-pipeline.md +89 -0
- package/docs/architecture/README.md +7 -0
- package/docs/architecture/refactor-audit.md +364 -0
- package/docs/authoring-v2.md +527 -0
- package/docs/authoring.md +873 -0
- package/docs/changelog-recent.md +201 -0
- package/docs/configuration.md +505 -0
- package/docs/ctc-mcp-proposal.md +518 -0
- package/docs/design/README.md +22 -0
- package/docs/design/agent-cascade-protocol.md +96 -0
- package/docs/design/autonomous-console-design-candidates.md +253 -0
- package/docs/design/autonomous-console-design-review.md +111 -0
- package/docs/design/autonomous-platform-mvp-discovery.md +525 -0
- package/docs/design/claude-code-source-deep-dive.md +713 -0
- package/docs/design/console-cyberpunk-ui-discovery.md +504 -0
- package/docs/design/console-execution-trace-candidates-final.md +160 -0
- package/docs/design/console-execution-trace-candidates.md +211 -0
- package/docs/design/console-execution-trace-design-candidates-v2.md +113 -0
- package/docs/design/console-execution-trace-design-review.md +74 -0
- package/docs/design/console-execution-trace-discovery.md +394 -0
- package/docs/design/console-execution-trace-final-review.md +77 -0
- package/docs/design/console-execution-trace-review.md +92 -0
- package/docs/design/console-performance-discovery.md +415 -0
- package/docs/design/console-ui-backlog.md +280 -0
- package/docs/design/daemon-architecture-discovery.md +853 -0
- package/docs/design/daemon-design-candidates.md +318 -0
- package/docs/design/daemon-design-review-findings.md +119 -0
- package/docs/design/daemon-engine-design-candidates.md +210 -0
- package/docs/design/daemon-engine-design-review.md +131 -0
- package/docs/design/daemon-execution-engine-discovery.md +280 -0
- package/docs/design/daemon-gap-analysis.md +554 -0
- package/docs/design/daemon-owns-console-plan.md +168 -0
- package/docs/design/daemon-owns-console-review.md +91 -0
- package/docs/design/daemon-owns-console.md +195 -0
- package/docs/design/data-model-erd.md +11 -0
- package/docs/design/design-candidates-consolidate-dev-staleness.md +98 -0
- package/docs/design/design-candidates-walk-cache-depth-limit.md +80 -0
- package/docs/design/design-review-consolidate-dev-staleness.md +54 -0
- package/docs/design/design-review-walk-cache-depth-limit.md +48 -0
- package/docs/design/implementation-plan-consolidate-dev-staleness.md +142 -0
- package/docs/design/implementation-plan-walk-cache-depth-limit.md +141 -0
- package/docs/design/layer3b-ghost-nodes-design-candidates.md +229 -0
- package/docs/design/layer3b-ghost-nodes-design-review.md +93 -0
- package/docs/design/layer3b-ghost-nodes-implementation-plan.md +219 -0
- package/docs/design/list-workflows-latency-fix-plan.md +128 -0
- package/docs/design/list-workflows-latency-fix-review.md +55 -0
- package/docs/design/list-workflows-latency-fix.md +109 -0
- package/docs/design/native-context-management-api.md +11 -0
- package/docs/design/performance-sweep-2026-04.md +96 -0
- package/docs/design/routines-guide.md +219 -0
- package/docs/design/sequence-diagrams.md +11 -0
- package/docs/design/subagent-design-principles.md +220 -0
- package/docs/design/temporal-patterns-design-candidates.md +312 -0
- package/docs/design/temporal-patterns-design-review-findings.md +163 -0
- package/docs/design/test-isolation-from-config-file.md +335 -0
- package/docs/design/v2-core-design-locks.md +2746 -0
- package/docs/design/v2-lock-registry.json +734 -0
- package/docs/design/workflow-authoring-v2.md +1044 -0
- package/docs/design/workflow-docs-spec.md +218 -0
- package/docs/design/workflow-extension-points.md +687 -0
- package/docs/design/workrail-auto-trigger-system.md +359 -0
- package/docs/design/workrail-config-file-discovery.md +513 -0
- package/docs/docker.md +110 -0
- package/docs/generated/v2-lock-closure-plan.md +26 -0
- package/docs/generated/v2-lock-coverage.json +797 -0
- package/docs/generated/v2-lock-coverage.md +177 -0
- package/docs/ideas/backlog.md +3927 -0
- package/docs/ideas/design-candidates-mcp-resilience.md +208 -0
- package/docs/ideas/design-review-findings-mcp-resilience.md +119 -0
- package/docs/ideas/implementation_plan.md +249 -0
- package/docs/ideas/third-party-workflow-setup-design-thinking.md +1948 -0
- package/docs/implementation/02-architecture.md +316 -0
- package/docs/implementation/04-testing-strategy.md +124 -0
- package/docs/implementation/09-simple-workflow-guide.md +835 -0
- package/docs/implementation/13-advanced-validation-guide.md +874 -0
- package/docs/implementation/README.md +21 -0
- package/docs/integrations/claude-code.md +300 -0
- package/docs/integrations/firebender.md +315 -0
- package/docs/migration/v0.1.0.md +147 -0
- package/docs/naming-conventions.md +45 -0
- package/docs/planning/README.md +104 -0
- package/docs/planning/github-ticketing-playbook.md +195 -0
- package/docs/plans/README.md +24 -0
- package/docs/plans/agent-managed-ticketing-design.md +605 -0
- package/docs/plans/agentic-orchestration-roadmap.md +112 -0
- package/docs/plans/assessment-gates-engine-handoff.md +536 -0
- package/docs/plans/content-coherence-and-references.md +151 -0
- package/docs/plans/library-extraction-plan.md +340 -0
- package/docs/plans/mr-review-workflow-redesign.md +1451 -0
- package/docs/plans/native-context-management-epic.md +11 -0
- package/docs/plans/perf-fixes-design-candidates.md +225 -0
- package/docs/plans/perf-fixes-design-review-findings.md +61 -0
- package/docs/plans/perf-fixes-new-issues-candidates.md +264 -0
- package/docs/plans/perf-fixes-new-issues-review.md +110 -0
- package/docs/plans/prompt-fragments.md +53 -0
- package/docs/plans/ui-ux-workflow-design-candidates.md +120 -0
- package/docs/plans/ui-ux-workflow-discovery.md +100 -0
- package/docs/plans/ui-ux-workflow-review.md +48 -0
- package/docs/plans/v2-followup-enhancements.md +587 -0
- package/docs/plans/workflow-categories-candidates.md +105 -0
- package/docs/plans/workflow-categories-discovery.md +110 -0
- package/docs/plans/workflow-categories-review.md +51 -0
- package/docs/plans/workflow-discovery-model-candidates.md +94 -0
- package/docs/plans/workflow-discovery-model-discovery.md +74 -0
- package/docs/plans/workflow-discovery-model-review.md +48 -0
- package/docs/plans/workflow-source-setup-phase-1.md +245 -0
- package/docs/plans/workflow-source-setup-phase-2.md +361 -0
- package/docs/plans/workflow-staleness-detection-candidates.md +104 -0
- package/docs/plans/workflow-staleness-detection-review.md +58 -0
- package/docs/plans/workflow-staleness-detection.md +80 -0
- package/docs/plans/workflow-v2-design.md +69 -0
- package/docs/plans/workflow-v2-roadmap.md +74 -0
- package/docs/plans/workflow-validation-design.md +98 -0
- package/docs/plans/workflow-validation-roadmap.md +108 -0
- package/docs/plans/workrail-platform-vision.md +420 -0
- package/docs/reference/agent-context-cleaner-snippet.md +94 -0
- package/docs/reference/agent-context-guidance.md +140 -0
- package/docs/reference/context-optimization.md +284 -0
- package/docs/reference/example-workflow-repository-template/.github/workflows/validate.yml +125 -0
- package/docs/reference/example-workflow-repository-template/README.md +268 -0
- package/docs/reference/example-workflow-repository-template/workflows/example-workflow.json +80 -0
- package/docs/reference/external-workflow-repositories.md +916 -0
- package/docs/reference/feature-flags-architecture.md +472 -0
- package/docs/reference/feature-flags.md +349 -0
- package/docs/reference/god-tier-workflow-validation.md +272 -0
- package/docs/reference/loop-optimization.md +209 -0
- package/docs/reference/loop-validation.md +176 -0
- package/docs/reference/loops.md +465 -0
- package/docs/reference/mcp-platform-constraints.md +59 -0
- package/docs/reference/recovery.md +88 -0
- package/docs/reference/releases.md +177 -0
- package/docs/reference/troubleshooting.md +105 -0
- package/docs/reference/workflow-execution-contract.md +998 -0
- package/docs/roadmap/README.md +22 -0
- package/docs/roadmap/legacy-planning-status.md +103 -0
- package/docs/roadmap/now-next-later.md +70 -0
- package/docs/roadmap/open-work-inventory.md +389 -0
- package/docs/tickets/README.md +39 -0
- package/docs/tickets/next-up.md +76 -0
- package/docs/workflow-management.md +317 -0
- package/docs/workflow-templates.md +423 -0
- package/docs/workflow-validation.md +184 -0
- package/docs/workflows.md +254 -0
- package/package.json +3 -1
- package/spec/authoring-spec.json +61 -16
- package/workflows/workflow-for-workflows.json +252 -93
- package/workflows/workflow-for-workflows.v2.json +188 -77
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
# Workflow Templates
|
|
2
|
+
|
|
3
|
+
The Template Registry provides pre-built templates for common workflow types, making it easy to get started quickly.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
### Using CLI
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# List available templates
|
|
11
|
+
node scripts/create-from-template.js --list
|
|
12
|
+
|
|
13
|
+
# Create from template
|
|
14
|
+
node scripts/create-from-template.js bug-investigation
|
|
15
|
+
|
|
16
|
+
# This creates: bug-investigation-workflow.json
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Using Programmatically
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
import { templateRegistry } from './template-registry.js';
|
|
23
|
+
|
|
24
|
+
// Create from template
|
|
25
|
+
const data = templateRegistry.createFromTemplate('bug-investigation', {
|
|
26
|
+
'dashboard.title': 'Auth Token Bug',
|
|
27
|
+
'bugSummary': 'Users unable to log in'
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Use in workflow
|
|
31
|
+
workrail.createSession('my-workflow', 'BUG-001', data);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Available Templates
|
|
35
|
+
|
|
36
|
+
### Bug Investigation
|
|
37
|
+
|
|
38
|
+
**ID:** `bug-investigation`
|
|
39
|
+
**Category:** Debugging
|
|
40
|
+
**Schema:** bug-investigation
|
|
41
|
+
|
|
42
|
+
Systematic bug investigation with hypotheses, timeline, and recommendations.
|
|
43
|
+
|
|
44
|
+
**Fields:**
|
|
45
|
+
- `dashboard` - Title, status, progress, confidence
|
|
46
|
+
- `bugSummary` - Detailed bug description
|
|
47
|
+
- `hypotheses` - Array of hypotheses with status
|
|
48
|
+
- `timeline` - Investigation timeline
|
|
49
|
+
- `phases` - Investigation phases
|
|
50
|
+
- `recommendations` - Suggested fixes
|
|
51
|
+
|
|
52
|
+
**Example:**
|
|
53
|
+
```javascript
|
|
54
|
+
{
|
|
55
|
+
dashboard: {
|
|
56
|
+
title: 'Auth Token Expiration Bug',
|
|
57
|
+
status: 'in_progress',
|
|
58
|
+
progress: 45,
|
|
59
|
+
confidence: 7
|
|
60
|
+
},
|
|
61
|
+
bugSummary: 'Users are being logged out unexpectedly',
|
|
62
|
+
hypotheses: [
|
|
63
|
+
{
|
|
64
|
+
description: 'Token expiration time misconfigured',
|
|
65
|
+
status: 'confirmed',
|
|
66
|
+
confidence: 9
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Code Review
|
|
73
|
+
|
|
74
|
+
**ID:** `code-review`
|
|
75
|
+
**Category:** Quality
|
|
76
|
+
**Schema:** code-review
|
|
77
|
+
|
|
78
|
+
Code review workflow with findings, severities, and approval tracking.
|
|
79
|
+
|
|
80
|
+
**Fields:**
|
|
81
|
+
- `dashboard` - Title, status, progress
|
|
82
|
+
- `summary` - Overall review summary
|
|
83
|
+
- `changes` - List of changed files
|
|
84
|
+
- `findings` - Issues found with severity
|
|
85
|
+
- `approved` - Approval status
|
|
86
|
+
|
|
87
|
+
**Example:**
|
|
88
|
+
```javascript
|
|
89
|
+
{
|
|
90
|
+
dashboard: {
|
|
91
|
+
title: 'PR #123: Add Authentication',
|
|
92
|
+
status: 'in_progress'
|
|
93
|
+
},
|
|
94
|
+
findings: [
|
|
95
|
+
{
|
|
96
|
+
severity: 'high',
|
|
97
|
+
description: 'SQL injection vulnerability',
|
|
98
|
+
file: 'auth.ts',
|
|
99
|
+
line: 45
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
approved: false
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Test Results
|
|
107
|
+
|
|
108
|
+
**ID:** `test-results`
|
|
109
|
+
**Category:** Testing
|
|
110
|
+
**Schema:** test-results
|
|
111
|
+
|
|
112
|
+
Test execution results with pass/fail tracking and trends.
|
|
113
|
+
|
|
114
|
+
**Fields:**
|
|
115
|
+
- `dashboard` - Title, status, progress
|
|
116
|
+
- `summary` - Test counts (total, passed, failed, skipped)
|
|
117
|
+
- `tests` - Individual test results
|
|
118
|
+
- `testResultsTrend` - Historical trend data
|
|
119
|
+
|
|
120
|
+
**Example:**
|
|
121
|
+
```javascript
|
|
122
|
+
{
|
|
123
|
+
dashboard: {
|
|
124
|
+
title: 'E2E Test Run',
|
|
125
|
+
status: 'passed'
|
|
126
|
+
},
|
|
127
|
+
summary: {
|
|
128
|
+
total: 50,
|
|
129
|
+
passed: 48,
|
|
130
|
+
failed: 2,
|
|
131
|
+
skipped: 0
|
|
132
|
+
},
|
|
133
|
+
testResultsTrend: [
|
|
134
|
+
{ label: 'Previous', value: 45 },
|
|
135
|
+
{ label: 'Current', value: 48 }
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Documentation
|
|
141
|
+
|
|
142
|
+
**ID:** `documentation`
|
|
143
|
+
**Category:** Documentation
|
|
144
|
+
|
|
145
|
+
Documentation generation with section tracking and coverage metrics.
|
|
146
|
+
|
|
147
|
+
**Fields:**
|
|
148
|
+
- `dashboard` - Title, status, progress
|
|
149
|
+
- `sections` - Documentation sections with status
|
|
150
|
+
- `coverage` - Coverage metrics
|
|
151
|
+
|
|
152
|
+
**Example:**
|
|
153
|
+
```javascript
|
|
154
|
+
{
|
|
155
|
+
dashboard: {
|
|
156
|
+
title: 'API Documentation',
|
|
157
|
+
progress: 75
|
|
158
|
+
},
|
|
159
|
+
sections: [
|
|
160
|
+
{ title: 'Overview', status: 'complete' },
|
|
161
|
+
{ title: 'Authentication', status: 'in_progress' }
|
|
162
|
+
],
|
|
163
|
+
coverage: [
|
|
164
|
+
{ label: 'API Coverage', value: 80 },
|
|
165
|
+
{ label: 'Examples', value: 60 }
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Performance Analysis
|
|
171
|
+
|
|
172
|
+
**ID:** `performance-analysis`
|
|
173
|
+
**Category:** Performance
|
|
174
|
+
|
|
175
|
+
Performance investigation and optimization tracking.
|
|
176
|
+
|
|
177
|
+
**Fields:**
|
|
178
|
+
- `dashboard` - Title, status, progress
|
|
179
|
+
- `metrics` - Performance metrics
|
|
180
|
+
- `findings` - Performance bottlenecks
|
|
181
|
+
- `performanceTrend` - Before/after comparison
|
|
182
|
+
|
|
183
|
+
**Example:**
|
|
184
|
+
```javascript
|
|
185
|
+
{
|
|
186
|
+
dashboard: {
|
|
187
|
+
title: 'Homepage Performance',
|
|
188
|
+
progress: 60
|
|
189
|
+
},
|
|
190
|
+
metrics: [
|
|
191
|
+
{ label: 'Load Time', value: 2.5 },
|
|
192
|
+
{ label: 'Bundle Size', value: 350 }
|
|
193
|
+
],
|
|
194
|
+
performanceTrend: [
|
|
195
|
+
{ label: 'Baseline', value: 3.8 },
|
|
196
|
+
{ label: 'Optimized', value: 2.5 }
|
|
197
|
+
]
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Generic Workflow
|
|
202
|
+
|
|
203
|
+
**ID:** `generic`
|
|
204
|
+
**Category:** General
|
|
205
|
+
|
|
206
|
+
Basic template for any workflow type.
|
|
207
|
+
|
|
208
|
+
**Fields:**
|
|
209
|
+
- `dashboard` - Title, status, progress
|
|
210
|
+
- `phases` - Workflow phases
|
|
211
|
+
- `timeline` - Event timeline
|
|
212
|
+
|
|
213
|
+
## Using Templates
|
|
214
|
+
|
|
215
|
+
### 1. Create Session from Template
|
|
216
|
+
|
|
217
|
+
```javascript
|
|
218
|
+
// In your workflow
|
|
219
|
+
import { templateRegistry } from '@workrail/template-registry';
|
|
220
|
+
|
|
221
|
+
const data = templateRegistry.createFromTemplate('bug-investigation', {
|
|
222
|
+
'dashboard.title': 'My Bug Investigation',
|
|
223
|
+
'bugSummary': 'Description of the bug'
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
workrail.createSession('workflow-id', 'session-id', data);
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### 2. Update During Workflow
|
|
230
|
+
|
|
231
|
+
```javascript
|
|
232
|
+
// Update hypothesis
|
|
233
|
+
workrail.updateSession('workflow-id', 'session-id', {
|
|
234
|
+
hypotheses: [
|
|
235
|
+
...existingHypotheses,
|
|
236
|
+
{
|
|
237
|
+
description: 'New hypothesis',
|
|
238
|
+
status: 'active',
|
|
239
|
+
confidence: 6
|
|
240
|
+
}
|
|
241
|
+
]
|
|
242
|
+
});
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### 3. Add to Timeline
|
|
246
|
+
|
|
247
|
+
```javascript
|
|
248
|
+
// Log investigation step
|
|
249
|
+
workrail.updateSession('workflow-id', 'session-id', {
|
|
250
|
+
timeline: [
|
|
251
|
+
...existingTimeline,
|
|
252
|
+
{
|
|
253
|
+
timestamp: new Date().toISOString(),
|
|
254
|
+
event: 'Found root cause in auth service',
|
|
255
|
+
reasoning: 'Token validation logic is incorrect'
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
});
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Custom Templates
|
|
262
|
+
|
|
263
|
+
You can create custom templates for your organization:
|
|
264
|
+
|
|
265
|
+
```javascript
|
|
266
|
+
import { templateRegistry } from '@workrail/template-registry';
|
|
267
|
+
|
|
268
|
+
templateRegistry.register('deployment', {
|
|
269
|
+
name: 'Deployment',
|
|
270
|
+
description: 'Deployment workflow',
|
|
271
|
+
category: 'operations',
|
|
272
|
+
workflowType: 'generic',
|
|
273
|
+
template: {
|
|
274
|
+
dashboard: {
|
|
275
|
+
title: 'Deployment: [Environment]',
|
|
276
|
+
status: 'pending'
|
|
277
|
+
},
|
|
278
|
+
environment: 'staging',
|
|
279
|
+
version: '1.0.0',
|
|
280
|
+
steps: []
|
|
281
|
+
},
|
|
282
|
+
guide: {
|
|
283
|
+
steps: [
|
|
284
|
+
'1. Set environment and version',
|
|
285
|
+
'2. Execute deployment steps',
|
|
286
|
+
'3. Verify deployment'
|
|
287
|
+
],
|
|
288
|
+
tips: [
|
|
289
|
+
'Track each deployment step',
|
|
290
|
+
'Include rollback procedures',
|
|
291
|
+
'Document any issues encountered'
|
|
292
|
+
]
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## Template API
|
|
298
|
+
|
|
299
|
+
### `templateRegistry.list(category)`
|
|
300
|
+
|
|
301
|
+
List all templates, optionally filtered by category.
|
|
302
|
+
|
|
303
|
+
```javascript
|
|
304
|
+
const all = templateRegistry.list();
|
|
305
|
+
const debugging = templateRegistry.list('debugging');
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### `templateRegistry.get(id)`
|
|
309
|
+
|
|
310
|
+
Get a template by ID.
|
|
311
|
+
|
|
312
|
+
```javascript
|
|
313
|
+
const template = templateRegistry.get('bug-investigation');
|
|
314
|
+
console.log(template.name, template.description);
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### `templateRegistry.createFromTemplate(id, customizations)`
|
|
318
|
+
|
|
319
|
+
Create data from template with customizations.
|
|
320
|
+
|
|
321
|
+
```javascript
|
|
322
|
+
const data = templateRegistry.createFromTemplate('code-review', {
|
|
323
|
+
'dashboard.title': 'PR #456',
|
|
324
|
+
'summary': 'Looks good overall'
|
|
325
|
+
});
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### `templateRegistry.getGuide(id)`
|
|
329
|
+
|
|
330
|
+
Get template usage guide.
|
|
331
|
+
|
|
332
|
+
```javascript
|
|
333
|
+
const guide = templateRegistry.getGuide('bug-investigation');
|
|
334
|
+
console.log(guide.steps);
|
|
335
|
+
console.log(guide.tips);
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### `templateRegistry.exportTemplate(id)`
|
|
339
|
+
|
|
340
|
+
Export template as JSON string.
|
|
341
|
+
|
|
342
|
+
```javascript
|
|
343
|
+
const json = templateRegistry.exportTemplate('bug-investigation');
|
|
344
|
+
fs.writeFileSync('template.json', json);
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## Best Practices
|
|
348
|
+
|
|
349
|
+
### 1. Start with a Template
|
|
350
|
+
|
|
351
|
+
Always start with the closest template to your workflow:
|
|
352
|
+
|
|
353
|
+
```javascript
|
|
354
|
+
// Instead of starting from scratch
|
|
355
|
+
const data = { dashboard: { title: '...' } };
|
|
356
|
+
|
|
357
|
+
// Use a template
|
|
358
|
+
const data = templateRegistry.createFromTemplate('bug-investigation');
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### 2. Customize Incrementally
|
|
362
|
+
|
|
363
|
+
Add fields as needed - templates are starting points:
|
|
364
|
+
|
|
365
|
+
```javascript
|
|
366
|
+
const data = templateRegistry.createFromTemplate('bug-investigation');
|
|
367
|
+
|
|
368
|
+
// Add custom field
|
|
369
|
+
data.reproductionSteps = [
|
|
370
|
+
'Step 1',
|
|
371
|
+
'Step 2'
|
|
372
|
+
];
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### 3. Follow Template Patterns
|
|
376
|
+
|
|
377
|
+
Templates use proven patterns that work well with the dashboard:
|
|
378
|
+
|
|
379
|
+
- Arrays with `label` + `value` → Charts
|
|
380
|
+
- Fields with `status` → Grouped lists
|
|
381
|
+
- Fields with `timestamp` → Timelines
|
|
382
|
+
- Fields with `severity` → Severity lists
|
|
383
|
+
|
|
384
|
+
### 4. Use Schemas
|
|
385
|
+
|
|
386
|
+
Templates specify recommended schemas - use them for validation:
|
|
387
|
+
|
|
388
|
+
```javascript
|
|
389
|
+
const template = templateRegistry.get('bug-investigation');
|
|
390
|
+
console.log(template.workflowType); // 'bug-investigation'
|
|
391
|
+
|
|
392
|
+
// Validate against schema
|
|
393
|
+
normalizer.normalize(data, {
|
|
394
|
+
workflowType: template.workflowType
|
|
395
|
+
});
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
## FAQ
|
|
399
|
+
|
|
400
|
+
**Q: Can I modify templates?**
|
|
401
|
+
A: Templates are cloned when used, so modifications don't affect the original.
|
|
402
|
+
|
|
403
|
+
**Q: Can I create my own templates?**
|
|
404
|
+
A: Yes! Use `templateRegistry.register()` to add custom templates.
|
|
405
|
+
|
|
406
|
+
**Q: Do I have to use all fields in a template?**
|
|
407
|
+
A: No, templates are starting points. Remove unused fields.
|
|
408
|
+
|
|
409
|
+
**Q: Can I add fields not in the template?**
|
|
410
|
+
A: Absolutely! Add any fields you need.
|
|
411
|
+
|
|
412
|
+
**Q: Are templates validated?**
|
|
413
|
+
A: Templates specify a recommended schema, but validation is optional.
|
|
414
|
+
|
|
415
|
+
## Examples
|
|
416
|
+
|
|
417
|
+
See `workflows/` directory for example workflows using templates.
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Workflow Validation
|
|
2
|
+
|
|
3
|
+
This document describes the workflow validation system and how to use it.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
All workflow JSON files must pass JSON Schema validation before they can be loaded by the system. Invalid workflows are rejected with clear error messages.
|
|
8
|
+
|
|
9
|
+
## Validation Layers
|
|
10
|
+
|
|
11
|
+
### 1. **Runtime Validation (Non-Silent)**
|
|
12
|
+
When the MCP server loads workflows, the `SchemaValidatingWorkflowStorage` validates each workflow against the schema. Invalid workflows are now **logged to console** with detailed error messages instead of being silently skipped.
|
|
13
|
+
|
|
14
|
+
Example error:
|
|
15
|
+
```
|
|
16
|
+
[SchemaValidation] Workflow 'my-workflow' failed validation:
|
|
17
|
+
/metaGuidance/19: must NOT have more than 256 characters
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 2. **CLI Validation**
|
|
21
|
+
Validate individual workflow files using the CLI:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Validate a single workflow
|
|
25
|
+
node dist/cli.js validate workflows/my-workflow.json
|
|
26
|
+
|
|
27
|
+
# Or with npm
|
|
28
|
+
workrail validate workflows/my-workflow.json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 3. **Batch Validation**
|
|
32
|
+
Validate all workflows at once:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Via npm script
|
|
36
|
+
npm run validate:workflows
|
|
37
|
+
|
|
38
|
+
# Or directly
|
|
39
|
+
bash scripts/validate-workflows.sh
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This will check all `.json` files in the `workflows/` directory and report:
|
|
43
|
+
- Which workflows passed
|
|
44
|
+
- Which workflows failed (with detailed errors)
|
|
45
|
+
- Overall success/failure status
|
|
46
|
+
|
|
47
|
+
### 4. **Pre-Commit Hook**
|
|
48
|
+
A git pre-commit hook automatically validates any workflow files you're about to commit.
|
|
49
|
+
|
|
50
|
+
**Installation:**
|
|
51
|
+
```bash
|
|
52
|
+
# Automatic (runs on npm install)
|
|
53
|
+
npm install
|
|
54
|
+
|
|
55
|
+
# Manual
|
|
56
|
+
bash scripts/setup-hooks.sh
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Behavior:**
|
|
60
|
+
- Only runs when workflow files (`.json` in `workflows/`) are being committed
|
|
61
|
+
- Validates each changed workflow file
|
|
62
|
+
- **Blocks the commit** if any workflow is invalid
|
|
63
|
+
- Provides detailed error messages
|
|
64
|
+
|
|
65
|
+
**Skip the hook (not recommended):**
|
|
66
|
+
```bash
|
|
67
|
+
git commit --no-verify
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 5. **CI/CD Pipeline (GitHub Actions)**
|
|
71
|
+
The `.github/workflows/validate-workflows.yml` workflow automatically runs on:
|
|
72
|
+
- Pushes to `main` or `develop` branches
|
|
73
|
+
- Pull requests targeting `main` or `develop`
|
|
74
|
+
- Only when workflow files or the schema changes
|
|
75
|
+
|
|
76
|
+
**What it does:**
|
|
77
|
+
- Installs dependencies
|
|
78
|
+
- Builds the project
|
|
79
|
+
- Validates all workflow files
|
|
80
|
+
- Fails the CI build if any workflow is invalid
|
|
81
|
+
|
|
82
|
+
## Common Validation Errors
|
|
83
|
+
|
|
84
|
+
### 1. **String Too Long**
|
|
85
|
+
```
|
|
86
|
+
/metaGuidance/19: must NOT have more than 256 characters
|
|
87
|
+
```
|
|
88
|
+
**Fix:** Shorten the string or split it into multiple items.
|
|
89
|
+
|
|
90
|
+
### 2. **Missing Required Field**
|
|
91
|
+
```
|
|
92
|
+
Missing required field 'steps' at root level
|
|
93
|
+
```
|
|
94
|
+
**Fix:** Add the required field to your workflow.
|
|
95
|
+
|
|
96
|
+
### 3. **Invalid ID Format**
|
|
97
|
+
```
|
|
98
|
+
/id: must match pattern "^[a-z0-9-]+$"
|
|
99
|
+
```
|
|
100
|
+
**Fix:** Use only lowercase letters, numbers, and hyphens in workflow IDs.
|
|
101
|
+
|
|
102
|
+
### 4. **Invalid Step Structure**
|
|
103
|
+
```
|
|
104
|
+
/steps/0: must have required property 'prompt'
|
|
105
|
+
```
|
|
106
|
+
**Fix:** Ensure all steps have required fields (id, title, prompt).
|
|
107
|
+
|
|
108
|
+
## Best Practices
|
|
109
|
+
|
|
110
|
+
1. **Validate Early**: Run `npm run validate:workflows` before committing
|
|
111
|
+
2. **Check CI**: Monitor GitHub Actions to catch validation issues
|
|
112
|
+
3. **Never Skip Hooks**: Use `--no-verify` only in emergencies
|
|
113
|
+
4. **Keep Strings Short**: metaGuidance and other string fields have 256-char limits
|
|
114
|
+
5. **Test Locally**: Use the CLI to validate before pushing
|
|
115
|
+
|
|
116
|
+
## Troubleshooting
|
|
117
|
+
|
|
118
|
+
### Hook Not Running
|
|
119
|
+
```bash
|
|
120
|
+
# Reinstall hooks
|
|
121
|
+
bash scripts/setup-hooks.sh
|
|
122
|
+
|
|
123
|
+
# Verify hook exists
|
|
124
|
+
ls -la .git/hooks/pre-commit
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Validation Script Fails
|
|
128
|
+
```bash
|
|
129
|
+
# Rebuild the project first
|
|
130
|
+
npm run build
|
|
131
|
+
|
|
132
|
+
# Then try again
|
|
133
|
+
npm run validate:workflows
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Silent Failures (Old Behavior)
|
|
137
|
+
If workflows are being silently rejected:
|
|
138
|
+
1. Check the MCP server console logs for `[SchemaValidation]` errors
|
|
139
|
+
2. Run `npm run validate:workflows` to see all validation errors
|
|
140
|
+
3. Update to the latest version with non-silent validation
|
|
141
|
+
|
|
142
|
+
## Schema Location
|
|
143
|
+
|
|
144
|
+
The workflow schema is located at:
|
|
145
|
+
```
|
|
146
|
+
spec/workflow.schema.json
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
To view the complete schema:
|
|
150
|
+
```bash
|
|
151
|
+
cat spec/workflow.schema.json
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Or get it programmatically:
|
|
155
|
+
```bash
|
|
156
|
+
workrail get-schema
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Workflow Development Workflow
|
|
160
|
+
|
|
161
|
+
Recommended workflow for creating/modifying workflows:
|
|
162
|
+
|
|
163
|
+
1. **Edit** your workflow JSON file
|
|
164
|
+
2. **Validate** locally: `npm run validate:workflows`
|
|
165
|
+
3. **Test** by loading it in the MCP server
|
|
166
|
+
4. **Commit** (hook will validate again)
|
|
167
|
+
5. **Push** and check CI
|
|
168
|
+
|
|
169
|
+
This multi-layer validation ensures invalid workflows never reach production.
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|