wogiflow 1.0.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.
Files changed (221) hide show
  1. package/.workflow/agents/reviewer.md +81 -0
  2. package/.workflow/agents/security.md +94 -0
  3. package/.workflow/agents/story-writer.md +58 -0
  4. package/.workflow/bridges/base-bridge.js +395 -0
  5. package/.workflow/bridges/claude-bridge.js +434 -0
  6. package/.workflow/bridges/index.js +130 -0
  7. package/.workflow/lib/assumption-detector.js +481 -0
  8. package/.workflow/lib/config-substitution.js +371 -0
  9. package/.workflow/lib/failure-categories.js +478 -0
  10. package/.workflow/state/app-map.md.template +15 -0
  11. package/.workflow/state/architecture.md.template +24 -0
  12. package/.workflow/state/component-index.json.template +5 -0
  13. package/.workflow/state/decisions.md.template +15 -0
  14. package/.workflow/state/feedback-patterns.md.template +9 -0
  15. package/.workflow/state/knowledge-sync.json.template +6 -0
  16. package/.workflow/state/progress.md.template +14 -0
  17. package/.workflow/state/ready.json.template +7 -0
  18. package/.workflow/state/request-log.md.template +14 -0
  19. package/.workflow/state/session-state.json.template +11 -0
  20. package/.workflow/state/stack.md.template +33 -0
  21. package/.workflow/state/testing.md.template +36 -0
  22. package/.workflow/templates/claude-md.hbs +257 -0
  23. package/.workflow/templates/correction-report.md +67 -0
  24. package/.workflow/templates/gemini-md.hbs +52 -0
  25. package/README.md +1802 -0
  26. package/bin/flow +205 -0
  27. package/lib/index.js +33 -0
  28. package/lib/installer.js +467 -0
  29. package/lib/release-channel.js +269 -0
  30. package/lib/skill-registry.js +526 -0
  31. package/lib/upgrader.js +401 -0
  32. package/lib/utils.js +305 -0
  33. package/package.json +64 -0
  34. package/scripts/flow +985 -0
  35. package/scripts/flow-adaptive-learning.js +1259 -0
  36. package/scripts/flow-aggregate.js +488 -0
  37. package/scripts/flow-archive +133 -0
  38. package/scripts/flow-auto-context.js +1015 -0
  39. package/scripts/flow-auto-learn.js +615 -0
  40. package/scripts/flow-bridge.js +223 -0
  41. package/scripts/flow-browser-suggest.js +316 -0
  42. package/scripts/flow-bug.js +247 -0
  43. package/scripts/flow-cascade.js +711 -0
  44. package/scripts/flow-changelog +85 -0
  45. package/scripts/flow-checkpoint.js +483 -0
  46. package/scripts/flow-cli.js +403 -0
  47. package/scripts/flow-code-intelligence.js +760 -0
  48. package/scripts/flow-complexity.js +502 -0
  49. package/scripts/flow-config-set.js +152 -0
  50. package/scripts/flow-constants.js +157 -0
  51. package/scripts/flow-context +152 -0
  52. package/scripts/flow-context-init.js +482 -0
  53. package/scripts/flow-context-monitor.js +384 -0
  54. package/scripts/flow-context-scoring.js +886 -0
  55. package/scripts/flow-correct.js +458 -0
  56. package/scripts/flow-damage-control.js +985 -0
  57. package/scripts/flow-deps +101 -0
  58. package/scripts/flow-diff.js +700 -0
  59. package/scripts/flow-done +151 -0
  60. package/scripts/flow-done.js +489 -0
  61. package/scripts/flow-durable-session.js +1541 -0
  62. package/scripts/flow-entropy-monitor.js +345 -0
  63. package/scripts/flow-export-profile +349 -0
  64. package/scripts/flow-export-scanner.js +1046 -0
  65. package/scripts/flow-figma-confirm.js +400 -0
  66. package/scripts/flow-figma-extract.js +496 -0
  67. package/scripts/flow-figma-generate.js +683 -0
  68. package/scripts/flow-figma-index.js +909 -0
  69. package/scripts/flow-figma-match.js +617 -0
  70. package/scripts/flow-figma-mcp-server.js +518 -0
  71. package/scripts/flow-figma-pipeline.js +414 -0
  72. package/scripts/flow-file-ops.js +301 -0
  73. package/scripts/flow-gate-confidence.js +825 -0
  74. package/scripts/flow-guided-edit.js +659 -0
  75. package/scripts/flow-health +185 -0
  76. package/scripts/flow-health.js +413 -0
  77. package/scripts/flow-hooks.js +556 -0
  78. package/scripts/flow-http-client.js +249 -0
  79. package/scripts/flow-hybrid-detect.js +167 -0
  80. package/scripts/flow-hybrid-interactive.js +591 -0
  81. package/scripts/flow-hybrid-test.js +152 -0
  82. package/scripts/flow-import-profile +439 -0
  83. package/scripts/flow-init +253 -0
  84. package/scripts/flow-instruction-richness.js +827 -0
  85. package/scripts/flow-jira-integration.js +579 -0
  86. package/scripts/flow-knowledge-router.js +522 -0
  87. package/scripts/flow-knowledge-sync.js +589 -0
  88. package/scripts/flow-linear-integration.js +631 -0
  89. package/scripts/flow-links.js +774 -0
  90. package/scripts/flow-log-manager.js +559 -0
  91. package/scripts/flow-loop-enforcer.js +1246 -0
  92. package/scripts/flow-loop-retry-learning.js +630 -0
  93. package/scripts/flow-lsp.js +923 -0
  94. package/scripts/flow-map-index +348 -0
  95. package/scripts/flow-map-sync +201 -0
  96. package/scripts/flow-memory-blocks.js +668 -0
  97. package/scripts/flow-memory-compactor.js +350 -0
  98. package/scripts/flow-memory-db.js +1110 -0
  99. package/scripts/flow-memory-sync.js +484 -0
  100. package/scripts/flow-metrics.js +353 -0
  101. package/scripts/flow-migrate-ids.js +370 -0
  102. package/scripts/flow-model-adapter.js +802 -0
  103. package/scripts/flow-model-router.js +884 -0
  104. package/scripts/flow-models.js +1231 -0
  105. package/scripts/flow-morning.js +517 -0
  106. package/scripts/flow-multi-approach.js +660 -0
  107. package/scripts/flow-new-feature +86 -0
  108. package/scripts/flow-onboard +1042 -0
  109. package/scripts/flow-orchestrate-llm.js +459 -0
  110. package/scripts/flow-orchestrate.js +3592 -0
  111. package/scripts/flow-output.js +123 -0
  112. package/scripts/flow-parallel-detector.js +399 -0
  113. package/scripts/flow-parallel-dispatch.js +987 -0
  114. package/scripts/flow-parallel.js +428 -0
  115. package/scripts/flow-pattern-enforcer.js +600 -0
  116. package/scripts/flow-prd-manager.js +282 -0
  117. package/scripts/flow-progress.js +323 -0
  118. package/scripts/flow-project-analyzer.js +975 -0
  119. package/scripts/flow-prompt-composer.js +487 -0
  120. package/scripts/flow-providers.js +1381 -0
  121. package/scripts/flow-queue.js +308 -0
  122. package/scripts/flow-ready +82 -0
  123. package/scripts/flow-ready.js +189 -0
  124. package/scripts/flow-regression.js +396 -0
  125. package/scripts/flow-response-parser.js +450 -0
  126. package/scripts/flow-resume.js +284 -0
  127. package/scripts/flow-rules-sync.js +439 -0
  128. package/scripts/flow-run-trace.js +718 -0
  129. package/scripts/flow-safety.js +587 -0
  130. package/scripts/flow-search +104 -0
  131. package/scripts/flow-security.js +481 -0
  132. package/scripts/flow-session-end +106 -0
  133. package/scripts/flow-session-end.js +437 -0
  134. package/scripts/flow-session-state.js +671 -0
  135. package/scripts/flow-setup-hooks +216 -0
  136. package/scripts/flow-setup-hooks.js +377 -0
  137. package/scripts/flow-skill-create.js +329 -0
  138. package/scripts/flow-skill-creator.js +572 -0
  139. package/scripts/flow-skill-generator.js +1046 -0
  140. package/scripts/flow-skill-learn.js +880 -0
  141. package/scripts/flow-skill-matcher.js +578 -0
  142. package/scripts/flow-spec-generator.js +820 -0
  143. package/scripts/flow-stack-wizard.js +895 -0
  144. package/scripts/flow-standup +162 -0
  145. package/scripts/flow-start +74 -0
  146. package/scripts/flow-start.js +235 -0
  147. package/scripts/flow-status +110 -0
  148. package/scripts/flow-status.js +301 -0
  149. package/scripts/flow-step-browser.js +83 -0
  150. package/scripts/flow-step-changelog.js +217 -0
  151. package/scripts/flow-step-comments.js +306 -0
  152. package/scripts/flow-step-complexity.js +234 -0
  153. package/scripts/flow-step-coverage.js +218 -0
  154. package/scripts/flow-step-knowledge.js +193 -0
  155. package/scripts/flow-step-pr-tests.js +364 -0
  156. package/scripts/flow-step-regression.js +89 -0
  157. package/scripts/flow-step-review.js +516 -0
  158. package/scripts/flow-step-security.js +162 -0
  159. package/scripts/flow-step-silent-failures.js +290 -0
  160. package/scripts/flow-step-simplifier.js +346 -0
  161. package/scripts/flow-story +105 -0
  162. package/scripts/flow-story.js +500 -0
  163. package/scripts/flow-suspend.js +252 -0
  164. package/scripts/flow-sync-daemon.js +654 -0
  165. package/scripts/flow-task-analyzer.js +606 -0
  166. package/scripts/flow-team-dashboard.js +748 -0
  167. package/scripts/flow-team-sync.js +752 -0
  168. package/scripts/flow-team.js +977 -0
  169. package/scripts/flow-tech-options.js +528 -0
  170. package/scripts/flow-templates.js +812 -0
  171. package/scripts/flow-tiered-learning.js +728 -0
  172. package/scripts/flow-trace +204 -0
  173. package/scripts/flow-transcript-chunking.js +1106 -0
  174. package/scripts/flow-transcript-digest.js +7918 -0
  175. package/scripts/flow-transcript-language.js +465 -0
  176. package/scripts/flow-transcript-parsing.js +1085 -0
  177. package/scripts/flow-transcript-stories.js +2194 -0
  178. package/scripts/flow-update-map +224 -0
  179. package/scripts/flow-utils.js +2242 -0
  180. package/scripts/flow-verification.js +644 -0
  181. package/scripts/flow-verify.js +1177 -0
  182. package/scripts/flow-voice-input.js +638 -0
  183. package/scripts/flow-watch +168 -0
  184. package/scripts/flow-workflow-steps.js +521 -0
  185. package/scripts/flow-workflow.js +1029 -0
  186. package/scripts/flow-worktree.js +489 -0
  187. package/scripts/hooks/adapters/base-adapter.js +102 -0
  188. package/scripts/hooks/adapters/claude-code.js +359 -0
  189. package/scripts/hooks/adapters/index.js +79 -0
  190. package/scripts/hooks/core/component-check.js +341 -0
  191. package/scripts/hooks/core/index.js +35 -0
  192. package/scripts/hooks/core/loop-check.js +241 -0
  193. package/scripts/hooks/core/session-context.js +294 -0
  194. package/scripts/hooks/core/task-gate.js +177 -0
  195. package/scripts/hooks/core/validation.js +230 -0
  196. package/scripts/hooks/entry/claude-code/post-tool-use.js +65 -0
  197. package/scripts/hooks/entry/claude-code/pre-tool-use.js +89 -0
  198. package/scripts/hooks/entry/claude-code/session-end.js +87 -0
  199. package/scripts/hooks/entry/claude-code/session-start.js +46 -0
  200. package/scripts/hooks/entry/claude-code/stop.js +43 -0
  201. package/scripts/postinstall.js +139 -0
  202. package/templates/browser-test-flow.json +56 -0
  203. package/templates/bug-report.md +43 -0
  204. package/templates/component-detail.md +42 -0
  205. package/templates/component.stories.tsx +49 -0
  206. package/templates/context/constraints.md +83 -0
  207. package/templates/context/conventions.md +177 -0
  208. package/templates/context/stack.md +60 -0
  209. package/templates/correction-report.md +90 -0
  210. package/templates/feature-proposal.md +35 -0
  211. package/templates/hybrid/_base.md +254 -0
  212. package/templates/hybrid/_patterns.md +45 -0
  213. package/templates/hybrid/create-component.md +127 -0
  214. package/templates/hybrid/create-file.md +56 -0
  215. package/templates/hybrid/create-hook.md +145 -0
  216. package/templates/hybrid/create-service.md +70 -0
  217. package/templates/hybrid/fix-bug.md +33 -0
  218. package/templates/hybrid/modify-file.md +55 -0
  219. package/templates/story.md +68 -0
  220. package/templates/task.json +56 -0
  221. package/templates/trace.md +69 -0
@@ -0,0 +1,478 @@
1
+ /**
2
+ * Wogi Flow - Centralized Failure Categories
3
+ *
4
+ * Provides standardized failure categorization used across the system:
5
+ * - Model Stats: Track failures by type
6
+ * - Cascade Fallback: Decide when to escalate to more capable models
7
+ * - Adaptive Learning: Categorize what went wrong
8
+ * - Loop Retry Learning: Identify root causes
9
+ *
10
+ * Each category has:
11
+ * - code: Machine-readable identifier
12
+ * - description: Human-readable explanation
13
+ * - severity: low | medium | high | critical
14
+ * - escalate: Whether to trigger model escalation
15
+ * - patterns: Regex patterns for detection
16
+ * - strategy: Refinement strategy key
17
+ */
18
+
19
+ /**
20
+ * Severity levels for failure categories
21
+ */
22
+ const Severity = {
23
+ LOW: 'low',
24
+ MEDIUM: 'medium',
25
+ HIGH: 'high',
26
+ CRITICAL: 'critical'
27
+ };
28
+
29
+ /**
30
+ * Failure categories with detection patterns, severity, and escalation rules
31
+ */
32
+ const FailureCategory = {
33
+ // ============================================================
34
+ // Parse/Syntax Errors - Usually fixable with retry
35
+ // ============================================================
36
+
37
+ PARSE_ERROR: {
38
+ code: 'parse_error',
39
+ description: 'Failed to parse response or output',
40
+ severity: Severity.MEDIUM,
41
+ escalate: false,
42
+ patterns: [
43
+ /parse error/i,
44
+ /json parse/i,
45
+ /invalid json/i,
46
+ /unexpected end of json/i,
47
+ /failed to parse/i
48
+ ],
49
+ strategy: 'format_fix'
50
+ },
51
+
52
+ SYNTAX_ERROR: {
53
+ code: 'syntax_error',
54
+ description: 'Invalid syntax in generated code',
55
+ severity: Severity.HIGH,
56
+ escalate: false,
57
+ patterns: [
58
+ /unexpected token/i,
59
+ /parsing error/i,
60
+ /syntax error/i,
61
+ /unterminated string/i,
62
+ /expected.*but got/i,
63
+ /missing.*after/i
64
+ ],
65
+ strategy: 'syntax_fix'
66
+ },
67
+
68
+ // ============================================================
69
+ // Import/Module Errors - Context issue, rarely needs escalation
70
+ // ============================================================
71
+
72
+ IMPORT_ERROR: {
73
+ code: 'import_error',
74
+ description: 'Module import failed or incorrect path',
75
+ severity: Severity.HIGH,
76
+ escalate: false,
77
+ patterns: [
78
+ /cannot find module/i,
79
+ /module not found/i,
80
+ /no exported member/i,
81
+ /has no exported member/i,
82
+ /cannot resolve/i,
83
+ /failed to resolve import/i,
84
+ /missing import/i
85
+ ],
86
+ strategy: 'import_fix'
87
+ },
88
+
89
+ // ============================================================
90
+ // Type Errors - Common, usually fixable with better context
91
+ // ============================================================
92
+
93
+ TYPE_ERROR: {
94
+ code: 'type_error',
95
+ description: 'TypeScript/type mismatch',
96
+ severity: Severity.MEDIUM,
97
+ escalate: false,
98
+ patterns: [
99
+ /type '.*' is not assignable/i,
100
+ /property '.*' does not exist/i,
101
+ /argument of type/i,
102
+ /expected \d+ arguments/i,
103
+ /missing property/i,
104
+ /is not a valid/i,
105
+ /typescript error/i,
106
+ /TS\d{4}/
107
+ ],
108
+ strategy: 'type_fix'
109
+ },
110
+
111
+ // ============================================================
112
+ // Runtime Errors - Execution-time failures
113
+ // ============================================================
114
+
115
+ RUNTIME_ERROR: {
116
+ code: 'runtime_error',
117
+ description: 'Error during execution',
118
+ severity: Severity.MEDIUM,
119
+ escalate: false,
120
+ patterns: [
121
+ /runtime error/i,
122
+ /execution failed/i,
123
+ /uncaught exception/i,
124
+ /unhandled rejection/i,
125
+ /crash/i
126
+ ],
127
+ strategy: 'generic_fix'
128
+ },
129
+
130
+ // ============================================================
131
+ // API/Rate Limit Errors - External constraints
132
+ // ============================================================
133
+
134
+ RATE_LIMIT: {
135
+ code: 'rate_limit',
136
+ description: 'API rate limit exceeded',
137
+ severity: Severity.LOW,
138
+ escalate: false,
139
+ patterns: [
140
+ /rate limit/i,
141
+ /too many requests/i,
142
+ /429/,
143
+ /quota exceeded/i,
144
+ /throttled/i
145
+ ],
146
+ strategy: 'wait_retry'
147
+ },
148
+
149
+ API_ERROR: {
150
+ code: 'api_error',
151
+ description: 'External API call failed',
152
+ severity: Severity.MEDIUM,
153
+ escalate: false,
154
+ patterns: [
155
+ /api error/i,
156
+ /request failed/i,
157
+ /network error/i,
158
+ /timeout/i,
159
+ /connection refused/i,
160
+ /ECONNREFUSED/,
161
+ /ETIMEDOUT/
162
+ ],
163
+ strategy: 'retry'
164
+ },
165
+
166
+ // ============================================================
167
+ // Context/Capability Issues - May need model escalation
168
+ // ============================================================
169
+
170
+ CONTEXT_OVERFLOW: {
171
+ code: 'context_overflow',
172
+ description: 'Context window exceeded',
173
+ severity: Severity.HIGH,
174
+ escalate: true,
175
+ patterns: [
176
+ /context.*overflow/i,
177
+ /context.*exceeded/i,
178
+ /too many tokens/i,
179
+ /maximum context length/i,
180
+ /context window/i,
181
+ /token limit/i
182
+ ],
183
+ strategy: 'context_reduction'
184
+ },
185
+
186
+ CAPABILITY_MISMATCH: {
187
+ code: 'capability_mismatch',
188
+ description: 'Model lacks required capability for this task',
189
+ severity: Severity.HIGH,
190
+ escalate: true,
191
+ patterns: [
192
+ /capability.*mismatch/i,
193
+ /not capable/i,
194
+ /cannot perform/i,
195
+ /unsupported.*operation/i,
196
+ /model.*limitation/i,
197
+ /beyond.*capabilities/i
198
+ ],
199
+ strategy: 'escalate'
200
+ },
201
+
202
+ // ============================================================
203
+ // Output Quality Issues - Model may need escalation
204
+ // ============================================================
205
+
206
+ HALLUCINATION: {
207
+ code: 'hallucination',
208
+ description: 'Model produced incorrect/fabricated output',
209
+ severity: Severity.HIGH,
210
+ escalate: true,
211
+ patterns: [
212
+ /does not exist/i,
213
+ /is not defined/i,
214
+ /cannot read property/i,
215
+ /undefined is not/i,
216
+ /hallucination/i,
217
+ /fabricated/i,
218
+ /invented/i
219
+ ],
220
+ strategy: 'context_fix'
221
+ },
222
+
223
+ INCOMPLETE_OUTPUT: {
224
+ code: 'incomplete_output',
225
+ description: 'Response was truncated or incomplete',
226
+ severity: Severity.MEDIUM,
227
+ escalate: false,
228
+ patterns: [
229
+ /unexpected end of/i,
230
+ /\.\.\./,
231
+ /\/\/ \.\.\./,
232
+ /TODO:/i,
233
+ /FIXME:/i,
234
+ /incomplete/i,
235
+ /truncated/i
236
+ ],
237
+ strategy: 'completion_fix'
238
+ },
239
+
240
+ MARKDOWN_POLLUTION: {
241
+ code: 'markdown_pollution',
242
+ description: 'Model included markdown or explanatory text in code',
243
+ severity: Severity.MEDIUM,
244
+ escalate: false,
245
+ patterns: [
246
+ /```typescript/,
247
+ /```jsx/,
248
+ /```tsx/,
249
+ /```javascript/,
250
+ /Here's the/i,
251
+ /Here is the/i,
252
+ /I'll create/i,
253
+ /Let me/i
254
+ ],
255
+ strategy: 'format_fix'
256
+ },
257
+
258
+ // ============================================================
259
+ // Task/Context Issues - Process problems, not model issues
260
+ // ============================================================
261
+
262
+ MISSING_CONTEXT: {
263
+ code: 'missing_context',
264
+ description: 'Task needed more context loading',
265
+ severity: Severity.MEDIUM,
266
+ escalate: false,
267
+ patterns: [
268
+ /context not loaded/i,
269
+ /file not found/i,
270
+ /component not in app-map/i,
271
+ /unknown component/i
272
+ ],
273
+ strategy: 'context_load'
274
+ },
275
+
276
+ INCOMPLETE_REQUIREMENTS: {
277
+ code: 'incomplete_requirements',
278
+ description: 'Acceptance criteria were unclear',
279
+ severity: Severity.MEDIUM,
280
+ escalate: false,
281
+ patterns: [
282
+ /acceptance criteria unclear/i,
283
+ /missing acceptance/i,
284
+ /requirements not defined/i,
285
+ /scope unclear/i,
286
+ /what should.*do/i
287
+ ],
288
+ strategy: 'clarify'
289
+ },
290
+
291
+ COMPONENT_REUSE_MISS: {
292
+ code: 'component_reuse_miss',
293
+ description: 'Should have reused existing component',
294
+ severity: Severity.LOW,
295
+ escalate: false,
296
+ patterns: [
297
+ /component already exists/i,
298
+ /duplicate component/i,
299
+ /use existing/i,
300
+ /similar component/i,
301
+ /app-map has/i
302
+ ],
303
+ strategy: 'context_load'
304
+ },
305
+
306
+ PATTERN_VIOLATION: {
307
+ code: 'pattern_violation',
308
+ description: 'Did not follow project patterns',
309
+ severity: Severity.LOW,
310
+ escalate: false,
311
+ patterns: [
312
+ /pattern violation/i,
313
+ /convention not followed/i,
314
+ /style mismatch/i,
315
+ /naming convention/i,
316
+ /project pattern/i,
317
+ /lint error/i,
318
+ /eslint/i
319
+ ],
320
+ strategy: 'pattern_fix'
321
+ },
322
+
323
+ EXTERNAL_DEPENDENCY: {
324
+ code: 'external_dependency',
325
+ description: 'Waiting on CI/tests/external systems',
326
+ severity: Severity.LOW,
327
+ escalate: false,
328
+ patterns: [
329
+ /ci failed/i,
330
+ /test failed/i,
331
+ /waiting for/i,
332
+ /external api/i
333
+ ],
334
+ strategy: 'wait_retry'
335
+ },
336
+
337
+ // ============================================================
338
+ // Unknown/Catch-all
339
+ // ============================================================
340
+
341
+ UNKNOWN: {
342
+ code: 'unknown',
343
+ description: 'Unclassified error',
344
+ severity: Severity.MEDIUM,
345
+ escalate: false,
346
+ patterns: [],
347
+ strategy: 'generic_fix'
348
+ }
349
+ };
350
+
351
+ // ============================================================
352
+ // Utility Functions
353
+ // ============================================================
354
+
355
+ /**
356
+ * Detect failure category from error string
357
+ * @param {string} error - Error message or output
358
+ * @param {string} output - Optional model output to check
359
+ * @returns {Object} Detection result with category and matches
360
+ */
361
+ function detectCategory(error, output = '') {
362
+ const errorStr = String(error || '');
363
+ const outputStr = String(output || '');
364
+ const combined = errorStr + '\n' + outputStr;
365
+
366
+ const matches = [];
367
+
368
+ for (const [key, category] of Object.entries(FailureCategory)) {
369
+ if (key === 'UNKNOWN') continue;
370
+
371
+ for (const pattern of category.patterns) {
372
+ if (pattern.test(combined)) {
373
+ matches.push({
374
+ category: key,
375
+ code: category.code,
376
+ severity: category.severity,
377
+ escalate: category.escalate,
378
+ description: category.description,
379
+ strategy: category.strategy,
380
+ matchedPattern: pattern.toString()
381
+ });
382
+ break; // Only count first pattern match per category
383
+ }
384
+ }
385
+ }
386
+
387
+ // Sort by severity (critical > high > medium > low)
388
+ const severityOrder = { critical: 0, high: 1, medium: 2, low: 3 };
389
+ matches.sort((a, b) => severityOrder[a.severity] - severityOrder[b.severity]);
390
+
391
+ const primary = matches[0] || {
392
+ category: 'UNKNOWN',
393
+ code: 'unknown',
394
+ severity: Severity.MEDIUM,
395
+ escalate: false,
396
+ description: 'Unclassified error',
397
+ strategy: 'generic_fix',
398
+ matchedPattern: null
399
+ };
400
+
401
+ return {
402
+ primary,
403
+ all: matches,
404
+ shouldEscalate: matches.some(m => m.escalate)
405
+ };
406
+ }
407
+
408
+ /**
409
+ * Get all categories that suggest escalation
410
+ * @returns {Array} Category keys that have escalate: true
411
+ */
412
+ function getEscalationCategories() {
413
+ return Object.entries(FailureCategory)
414
+ .filter(([_, cat]) => cat.escalate)
415
+ .map(([key, _]) => key);
416
+ }
417
+
418
+ /**
419
+ * Get category by code
420
+ * @param {string} code - Category code (e.g., 'parse_error')
421
+ * @returns {Object|null} Category definition or null
422
+ */
423
+ function getCategoryByCode(code) {
424
+ for (const [key, category] of Object.entries(FailureCategory)) {
425
+ if (category.code === code) {
426
+ return { key, ...category };
427
+ }
428
+ }
429
+ return null;
430
+ }
431
+
432
+ /**
433
+ * Get all category codes
434
+ * @returns {Array} List of all category codes
435
+ */
436
+ function getAllCodes() {
437
+ return Object.values(FailureCategory).map(cat => cat.code);
438
+ }
439
+
440
+ /**
441
+ * Check if a category should trigger model escalation
442
+ * @param {string} categoryKey - Category key (e.g., 'CONTEXT_OVERFLOW')
443
+ * @returns {boolean}
444
+ */
445
+ function shouldEscalate(categoryKey) {
446
+ const category = FailureCategory[categoryKey];
447
+ return category ? category.escalate : false;
448
+ }
449
+
450
+ /**
451
+ * Get severity level for a category
452
+ * @param {string} categoryKey - Category key
453
+ * @returns {string} Severity level
454
+ */
455
+ function getSeverity(categoryKey) {
456
+ const category = FailureCategory[categoryKey];
457
+ return category ? category.severity : Severity.MEDIUM;
458
+ }
459
+
460
+ // ============================================================
461
+ // Exports
462
+ // ============================================================
463
+
464
+ module.exports = {
465
+ // Core definitions
466
+ FailureCategory,
467
+ Severity,
468
+
469
+ // Detection
470
+ detectCategory,
471
+
472
+ // Utilities
473
+ getEscalationCategories,
474
+ getCategoryByCode,
475
+ getAllCodes,
476
+ shouldEscalate,
477
+ getSeverity
478
+ };
@@ -0,0 +1,15 @@
1
+ # Application Map
2
+
3
+ Component registry for the project. Check here before creating new components.
4
+
5
+ ## Components
6
+
7
+ <!-- Add components as they are created -->
8
+
9
+ ## Utilities
10
+
11
+ <!-- Add utility functions here -->
12
+
13
+ ## Patterns
14
+
15
+ <!-- Document reusable patterns here -->
@@ -0,0 +1,24 @@
1
+ # Architecture
2
+
3
+ ## Pattern
4
+
5
+ <!-- Detected during onboarding -->
6
+ <!-- Examples: MVC, Clean Architecture, DDD, Microservices, Monolith -->
7
+
8
+ ## Structure
9
+
10
+ <!-- Project structure overview -->
11
+ <!-- Key directories and their purposes -->
12
+
13
+ ## Key Decisions
14
+
15
+ <!-- Architecture decisions made for this project -->
16
+ <!-- Trade-offs and rationale -->
17
+
18
+ ## Dependencies
19
+
20
+ <!-- Major dependencies and their purposes -->
21
+
22
+ ---
23
+
24
+ *This file is auto-populated during `flow onboard`. Update manually as architecture evolves.*
@@ -0,0 +1,5 @@
1
+ {
2
+ "version": "1.0",
3
+ "lastUpdated": null,
4
+ "components": {}
5
+ }
@@ -0,0 +1,15 @@
1
+ # Project Decisions
2
+
3
+ Coding patterns, architectural decisions, and conventions.
4
+
5
+ ## Conventions
6
+
7
+ <!-- Add project conventions here -->
8
+
9
+ ## Patterns
10
+
11
+ <!-- Add coding patterns here -->
12
+
13
+ ## Tech Stack
14
+
15
+ <!-- Document tech stack decisions here -->
@@ -0,0 +1,9 @@
1
+ # Feedback Patterns
2
+
3
+ Patterns learned from corrections and feedback.
4
+
5
+ ## Patterns
6
+
7
+ | Pattern | Source | Applied |
8
+ |---------|--------|---------|
9
+ | - | - | - |
@@ -0,0 +1,6 @@
1
+ {
2
+ "lastSync": null,
3
+ "syncedFiles": [],
4
+ "pendingChanges": [],
5
+ "version": "1.0.0"
6
+ }
@@ -0,0 +1,14 @@
1
+ # Progress
2
+
3
+ Current session progress and context for resumption.
4
+
5
+ ## Current Focus
6
+ None - start with `/wogi-ready` to see available tasks.
7
+
8
+ ## Recent Changes
9
+ None yet.
10
+
11
+ ## Next Steps
12
+ 1. Run `/wogi-status` to see project overview
13
+ 2. Run `/wogi-ready` to see available tasks
14
+ 3. Run `/wogi-start TASK-ID` to begin work
@@ -0,0 +1,7 @@
1
+ {
2
+ "lastUpdated": null,
3
+ "ready": [],
4
+ "inProgress": [],
5
+ "blocked": [],
6
+ "recentlyCompleted": []
7
+ }
@@ -0,0 +1,14 @@
1
+ # Request Log
2
+
3
+ Automatic log of all requests that changed files. Searchable by tags.
4
+
5
+ **Search examples:**
6
+ ```bash
7
+ grep -A5 "#screen:login" .workflow/state/request-log.md
8
+ grep -A5 "#component:Button" .workflow/state/request-log.md
9
+ grep -A5 "Type: fix" .workflow/state/request-log.md
10
+ ```
11
+
12
+ ---
13
+
14
+ <!-- Entries below. Format: R-001, R-002, etc. -->
@@ -0,0 +1,11 @@
1
+ {
2
+ "currentTask": null,
3
+ "sessionId": null,
4
+ "startedAt": null,
5
+ "lastActivity": null,
6
+ "tasksCompleted": [],
7
+ "contextUsage": {
8
+ "percent": 0,
9
+ "lastChecked": null
10
+ }
11
+ }
@@ -0,0 +1,33 @@
1
+ # Tech Stack
2
+
3
+ ## Framework
4
+
5
+ <!-- Primary framework (e.g., Next.js, NestJS, FastAPI) -->
6
+
7
+ ## Language
8
+
9
+ <!-- Primary language (e.g., TypeScript, Python, Go) -->
10
+
11
+ ## Database
12
+
13
+ <!-- Database system if applicable (e.g., PostgreSQL, MongoDB) -->
14
+
15
+ ## Package Manager
16
+
17
+ <!-- npm, yarn, pnpm, pip, etc. -->
18
+
19
+ ## Build Tools
20
+
21
+ <!-- Build and bundling tools (e.g., Vite, Webpack, esbuild) -->
22
+
23
+ ## Testing
24
+
25
+ <!-- Test frameworks (e.g., Jest, Vitest, pytest) -->
26
+
27
+ ## Other Tools
28
+
29
+ <!-- Linters, formatters, CI/CD tools -->
30
+
31
+ ---
32
+
33
+ *This file is auto-populated during `flow onboard`. Update manually as stack evolves.*
@@ -0,0 +1,36 @@
1
+ # Testing
2
+
3
+ ## Test Framework
4
+
5
+ <!-- Primary test framework (e.g., Jest, Vitest, pytest) -->
6
+
7
+ ## Test Commands
8
+
9
+ ```bash
10
+ # Run all tests
11
+ npm test
12
+
13
+ # Run tests in watch mode
14
+ npm run test:watch
15
+
16
+ # Run specific test file
17
+ npm test -- path/to/test.ts
18
+ ```
19
+
20
+ ## Test Structure
21
+
22
+ <!-- Where tests are located -->
23
+ <!-- Naming conventions -->
24
+
25
+ ## Coverage
26
+
27
+ <!-- Coverage requirements if any -->
28
+ <!-- Coverage commands -->
29
+
30
+ ## E2E Testing
31
+
32
+ <!-- E2E framework if used (e.g., Playwright, Cypress) -->
33
+
34
+ ---
35
+
36
+ *This file is auto-populated during `flow onboard`. Update manually as testing strategy evolves.*