wogiflow 1.0.42 → 1.0.44
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/package.json +1 -1
- package/scripts/flow-bug.js +117 -21
- package/scripts/flow-start.js +9 -6
- package/scripts/hooks/core/implementation-gate.js +12 -22
- package/templates/bug-report.md +113 -20
package/package.json
CHANGED
package/scripts/flow-bug.js
CHANGED
|
@@ -22,6 +22,7 @@ const {
|
|
|
22
22
|
fileExists,
|
|
23
23
|
dirExists,
|
|
24
24
|
writeFile,
|
|
25
|
+
writeJson,
|
|
25
26
|
generateTaskId,
|
|
26
27
|
parseFlags,
|
|
27
28
|
outputJson,
|
|
@@ -56,7 +57,10 @@ function getCurrentTask() {
|
|
|
56
57
|
try {
|
|
57
58
|
const sessionState = loadSessionState();
|
|
58
59
|
return sessionState.currentTask || null;
|
|
59
|
-
} catch {
|
|
60
|
+
} catch (err) {
|
|
61
|
+
if (process.env.DEBUG) {
|
|
62
|
+
console.error(`[DEBUG] getCurrentTask error: ${err.message}`);
|
|
63
|
+
}
|
|
60
64
|
return null;
|
|
61
65
|
}
|
|
62
66
|
}
|
|
@@ -77,7 +81,7 @@ function createBugContent(bug) {
|
|
|
77
81
|
|
|
78
82
|
const date = createdAt.split('T')[0];
|
|
79
83
|
const discoveredSection = discoveredFrom
|
|
80
|
-
? `**Discovered From**: ${discoveredFrom}\n**Discovered During**: ${discoveredDuring}\n`
|
|
84
|
+
? `**Discovered From**: ${discoveredFrom}\n**Discovered During**: ${discoveredDuring || 'implementation'}\n`
|
|
81
85
|
: '';
|
|
82
86
|
|
|
83
87
|
return `# ${id}: ${title}
|
|
@@ -88,30 +92,120 @@ function createBugContent(bug) {
|
|
|
88
92
|
**Priority**: ${priority}
|
|
89
93
|
**Tags**: #bug
|
|
90
94
|
${discoveredSection}
|
|
91
|
-
##
|
|
92
|
-
[
|
|
95
|
+
## Bug Summary
|
|
96
|
+
[1-2 sentences: What is broken and what is the impact?]
|
|
93
97
|
|
|
94
|
-
##
|
|
98
|
+
## Reproduction
|
|
99
|
+
|
|
100
|
+
### Steps to Reproduce
|
|
95
101
|
1. [Step 1]
|
|
96
102
|
2. [Step 2]
|
|
97
103
|
3. [Step 3]
|
|
98
104
|
|
|
99
|
-
|
|
105
|
+
### Expected Behavior
|
|
100
106
|
[What should happen]
|
|
101
107
|
|
|
102
|
-
|
|
108
|
+
### Actual Behavior
|
|
103
109
|
[What actually happens]
|
|
104
110
|
|
|
105
|
-
|
|
106
|
-
- Browser:
|
|
107
|
-
- OS:
|
|
108
|
-
- Version:
|
|
111
|
+
### Environment
|
|
112
|
+
- Browser: [if applicable]
|
|
113
|
+
- OS: [if applicable]
|
|
114
|
+
- Version: [app version]
|
|
115
|
+
- Node/Runtime: [if applicable]
|
|
116
|
+
|
|
117
|
+
### Screenshots/Logs
|
|
118
|
+
[Attach screenshots, error logs, or stack traces]
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Root Cause Analysis
|
|
123
|
+
|
|
124
|
+
### What Went Wrong?
|
|
125
|
+
[Technical explanation of the bug - what part of the code/logic is failing and why]
|
|
126
|
+
|
|
127
|
+
### Why Did This Happen?
|
|
128
|
+
[Choose one or more]
|
|
129
|
+
- [ ] Logic error in implementation
|
|
130
|
+
- [ ] Missing edge case handling
|
|
131
|
+
- [ ] Incorrect assumption about inputs/state
|
|
132
|
+
- [ ] Race condition / timing issue
|
|
133
|
+
- [ ] External dependency failure
|
|
134
|
+
- [ ] Configuration/environment issue
|
|
135
|
+
- [ ] Prompt/instruction unclear or ambiguous
|
|
136
|
+
- [ ] Other: [explain]
|
|
137
|
+
|
|
138
|
+
### Source of the Problem
|
|
139
|
+
<!-- For AI-assisted development, this helps us learn -->
|
|
140
|
+
- **Prompt issue**: [Was the original request ambiguous or missing context?]
|
|
141
|
+
- **Logic gap**: [What reasoning led to the bug?]
|
|
142
|
+
- **Missing context**: [What information would have prevented this?]
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Fix Approaches
|
|
147
|
+
|
|
148
|
+
### Approach 1: [Name] (Recommended)
|
|
149
|
+
**Description**: [How this approach fixes the bug]
|
|
150
|
+
**Pros**: [Benefits]
|
|
151
|
+
**Cons**: [Drawbacks]
|
|
152
|
+
**Files affected**: [List files]
|
|
153
|
+
|
|
154
|
+
### Approach 2: [Name] (Alternative)
|
|
155
|
+
**Description**: [How this approach fixes the bug]
|
|
156
|
+
**Pros**: [Benefits]
|
|
157
|
+
**Cons**: [Drawbacks]
|
|
158
|
+
**Files affected**: [List files]
|
|
159
|
+
|
|
160
|
+
### Chosen Approach
|
|
161
|
+
[Which approach and why]
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Acceptance Criteria
|
|
166
|
+
|
|
167
|
+
### Scenario 1: Bug is fixed
|
|
168
|
+
**Given** [the conditions that previously triggered the bug]
|
|
169
|
+
**When** [the action that caused the bug]
|
|
170
|
+
**Then** [the expected correct behavior]
|
|
171
|
+
|
|
172
|
+
### Scenario 2: No regression
|
|
173
|
+
**Given** [related functionality]
|
|
174
|
+
**When** [normal usage]
|
|
175
|
+
**Then** [existing behavior is preserved]
|
|
176
|
+
|
|
177
|
+
### Scenario 3: Edge case handling
|
|
178
|
+
**Given** [edge case conditions]
|
|
179
|
+
**When** [edge case action]
|
|
180
|
+
**Then** [graceful handling]
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Test Strategy
|
|
185
|
+
- [ ] Unit test: [What to test]
|
|
186
|
+
- [ ] Integration test: [What to test]
|
|
187
|
+
- [ ] Manual verification: [Steps to verify fix]
|
|
188
|
+
|
|
189
|
+
## Verification Checklist
|
|
190
|
+
<!-- Quick steps to confirm the bug is fixed -->
|
|
191
|
+
1. [ ] [Step to verify the bug no longer occurs]
|
|
192
|
+
2. [ ] [Step to verify no regression]
|
|
193
|
+
3. [ ] [Step to verify edge cases]
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Prevention & Learning
|
|
198
|
+
|
|
199
|
+
### How to Prevent Similar Bugs
|
|
200
|
+
[What changes to process, prompts, or code patterns would prevent this?]
|
|
109
201
|
|
|
110
|
-
|
|
111
|
-
|
|
202
|
+
### Learnings to Capture
|
|
203
|
+
<!-- These should be added to decisions.md or skill learnings -->
|
|
204
|
+
- [ ] Pattern to add to decisions.md: [describe]
|
|
205
|
+
- [ ] Skill learning to record: [describe]
|
|
206
|
+
- [ ] Prompt improvement: [describe]
|
|
112
207
|
|
|
113
|
-
|
|
114
|
-
[If you have ideas about what's causing it or how to fix]
|
|
208
|
+
---
|
|
115
209
|
|
|
116
210
|
## Related
|
|
117
211
|
- [Related request-log entries]
|
|
@@ -119,9 +213,11 @@ ${discoveredSection}
|
|
|
119
213
|
${discoveredFrom ? `- Discovered while working on: ${discoveredFrom}` : ''}
|
|
120
214
|
|
|
121
215
|
## Resolution
|
|
122
|
-
|
|
123
|
-
- Fixed in
|
|
124
|
-
- Root cause
|
|
216
|
+
<!-- Fill in when fixed -->
|
|
217
|
+
- **Fixed in**: [commit hash or PR]
|
|
218
|
+
- **Root cause confirmed**: [yes/no - was initial analysis correct?]
|
|
219
|
+
- **Learnings applied**: [what was added to decisions.md/skills?]
|
|
220
|
+
- **Tests added**: [what tests were added?]
|
|
125
221
|
`;
|
|
126
222
|
}
|
|
127
223
|
|
|
@@ -245,14 +341,14 @@ Examples:
|
|
|
245
341
|
specPath: bugPath
|
|
246
342
|
});
|
|
247
343
|
|
|
248
|
-
|
|
344
|
+
writeJson(PATHS.ready, ready);
|
|
249
345
|
addedToReady = true;
|
|
250
346
|
}
|
|
251
347
|
});
|
|
252
|
-
} catch (
|
|
348
|
+
} catch (err) {
|
|
253
349
|
// Non-fatal: bug file was created, just couldn't add to ready.json
|
|
254
350
|
if (process.env.DEBUG) {
|
|
255
|
-
console.error(`[DEBUG] Could not add to ready.json: ${
|
|
351
|
+
console.error(`[DEBUG] Could not add to ready.json: ${err.message}`);
|
|
256
352
|
}
|
|
257
353
|
}
|
|
258
354
|
|
package/scripts/flow-start.js
CHANGED
|
@@ -16,7 +16,8 @@ const {
|
|
|
16
16
|
findTask,
|
|
17
17
|
color,
|
|
18
18
|
error,
|
|
19
|
-
getConfig
|
|
19
|
+
getConfig,
|
|
20
|
+
safeJsonParse
|
|
20
21
|
} = require('./flow-utils');
|
|
21
22
|
// Auto-context module (optional - graceful degradation)
|
|
22
23
|
let autoContext = null;
|
|
@@ -49,7 +50,7 @@ try {
|
|
|
49
50
|
const assessTaskComplexity = complexityModule?.assessTaskComplexity || (() => ({ level: 'unknown' }));
|
|
50
51
|
|
|
51
52
|
// v1.7.0 context memory management
|
|
52
|
-
const { warnIfContextHigh
|
|
53
|
+
const { warnIfContextHigh } = require('./flow-context-monitor');
|
|
53
54
|
const { setCurrentTask } = require('./flow-memory-blocks');
|
|
54
55
|
const { trackTaskStart, checkAndDisplayResumeContext } = require('./flow-session-state');
|
|
55
56
|
|
|
@@ -137,20 +138,22 @@ function getRegistrySummary(registryPath, type) {
|
|
|
137
138
|
try {
|
|
138
139
|
if (!fs.existsSync(registryPath)) return null;
|
|
139
140
|
|
|
140
|
-
|
|
141
|
+
// Use safeJsonParse for prototype pollution protection
|
|
142
|
+
const registry = safeJsonParse(registryPath, null);
|
|
143
|
+
if (!registry) return null;
|
|
144
|
+
|
|
141
145
|
if (type === 'function') {
|
|
142
|
-
const registry = JSON.parse(content);
|
|
143
146
|
const count = registry.functions?.length || 0;
|
|
144
147
|
const categories = Object.keys(registry.categories || {});
|
|
145
148
|
return { count, categories };
|
|
146
149
|
} else if (type === 'api') {
|
|
147
|
-
const registry = JSON.parse(content);
|
|
148
150
|
const funcCount = registry.clientFunctions?.length || 0;
|
|
149
151
|
const endpointCount = registry.endpoints?.length || 0;
|
|
150
152
|
const services = Object.keys(registry.services || {});
|
|
151
153
|
return { funcCount, endpointCount, services };
|
|
152
154
|
}
|
|
153
|
-
} catch {
|
|
155
|
+
} catch (err) {
|
|
156
|
+
if (process.env.DEBUG) console.error(`[DEBUG] Registry read error: ${err.message}`);
|
|
154
157
|
return null;
|
|
155
158
|
}
|
|
156
159
|
return null;
|
|
@@ -113,12 +113,11 @@ function isImplementationGateEnabled() {
|
|
|
113
113
|
return true;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
* @returns {boolean}
|
|
119
|
-
*/
|
|
116
|
+
// NOTE: softMode is deprecated. Use hooks.rules.implementationGate.mode = 'warn' instead.
|
|
117
|
+
// Kept for backwards compatibility - maps to mode='warn'
|
|
120
118
|
function isSoftModeEnabled() {
|
|
121
119
|
const config = getConfig();
|
|
120
|
+
// Check legacy softMode, map to mode='warn'
|
|
122
121
|
return config.hooks?.rules?.implementationGate?.softMode === true ||
|
|
123
122
|
config.enforcement?.softMode === true;
|
|
124
123
|
}
|
|
@@ -264,25 +263,16 @@ function checkImplementationGate(options = {}) {
|
|
|
264
263
|
}
|
|
265
264
|
|
|
266
265
|
// No active task and implementation intent detected
|
|
267
|
-
|
|
266
|
+
// v4.2: Use 'mode' config as canonical control (softMode is deprecated fallback)
|
|
267
|
+
const config = getConfig();
|
|
268
|
+
let mode = config.hooks?.rules?.implementationGate?.mode;
|
|
268
269
|
|
|
269
|
-
if
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
message: generateWarningMessage(prompt),
|
|
274
|
-
reason: 'warn_only',
|
|
275
|
-
confidence,
|
|
276
|
-
suggestedAction: 'create-story',
|
|
277
|
-
matches
|
|
278
|
-
};
|
|
270
|
+
// Backward compatibility: if mode not set, check legacy softMode
|
|
271
|
+
if (!mode) {
|
|
272
|
+
const softMode = isSoftModeEnabled();
|
|
273
|
+
mode = softMode ? 'warn' : 'block';
|
|
279
274
|
}
|
|
280
275
|
|
|
281
|
-
// v4.2: Block and route through /wogi-start
|
|
282
|
-
// /wogi-start will triage: operational (execute directly), small fix (execute + log), or implementation (create task)
|
|
283
|
-
const config = getConfig();
|
|
284
|
-
const mode = config.hooks?.rules?.implementationGate?.mode || 'block';
|
|
285
|
-
|
|
286
276
|
if (mode === 'off') {
|
|
287
277
|
return {
|
|
288
278
|
allowed: true,
|
|
@@ -343,10 +333,10 @@ Use: /wogi-start "${truncatePrompt(prompt)}"
|
|
|
343
333
|
}
|
|
344
334
|
|
|
345
335
|
/**
|
|
346
|
-
*
|
|
336
|
+
* @deprecated Use generateBlockingMessage instead. Kept for backwards compatibility.
|
|
347
337
|
*/
|
|
348
338
|
function generateBlockMessage(prompt) {
|
|
349
|
-
return
|
|
339
|
+
return generateBlockingMessage(prompt);
|
|
350
340
|
}
|
|
351
341
|
|
|
352
342
|
/**
|
package/templates/bug-report.md
CHANGED
|
@@ -1,43 +1,136 @@
|
|
|
1
|
-
# wf-XXXXXXXX
|
|
1
|
+
# [wf-XXXXXXXX] [Title]
|
|
2
2
|
|
|
3
3
|
**Created**: [date]
|
|
4
|
-
**Status**: Open
|
|
5
|
-
**Severity**: Critical
|
|
4
|
+
**Status**: Open | In Progress | Fixed | Closed
|
|
5
|
+
**Severity**: Critical | High | Medium | Low
|
|
6
6
|
**Priority**: P0-P4
|
|
7
7
|
**Tags**: #bug #component:[name] #screen:[name]
|
|
8
8
|
**Discovered From**: [wf-XXXXXXXX or empty if not during task]
|
|
9
|
-
**Discovered During**: implementation
|
|
9
|
+
**Discovered During**: implementation | testing | review | production
|
|
10
10
|
|
|
11
|
-
##
|
|
12
|
-
[
|
|
11
|
+
## Bug Summary
|
|
12
|
+
[1-2 sentences: What is broken and what is the impact?]
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Reproduction
|
|
15
|
+
|
|
16
|
+
### Steps to Reproduce
|
|
15
17
|
1. [Step 1]
|
|
16
18
|
2. [Step 2]
|
|
17
19
|
3. [Step 3]
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
### Expected Behavior
|
|
20
22
|
[What should happen]
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
### Actual Behavior
|
|
23
25
|
[What actually happens]
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
- Browser:
|
|
27
|
-
- OS:
|
|
28
|
-
- Version:
|
|
27
|
+
### Environment
|
|
28
|
+
- Browser: [if applicable]
|
|
29
|
+
- OS: [if applicable]
|
|
30
|
+
- Version: [app version]
|
|
31
|
+
- Node/Runtime: [if applicable]
|
|
32
|
+
|
|
33
|
+
### Screenshots/Logs
|
|
34
|
+
[Attach screenshots, error logs, or stack traces]
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Root Cause Analysis
|
|
39
|
+
|
|
40
|
+
### What Went Wrong?
|
|
41
|
+
[Technical explanation of the bug - what part of the code/logic is failing and why]
|
|
42
|
+
|
|
43
|
+
### Why Did This Happen?
|
|
44
|
+
[Choose one or more]
|
|
45
|
+
- [ ] Logic error in implementation
|
|
46
|
+
- [ ] Missing edge case handling
|
|
47
|
+
- [ ] Incorrect assumption about inputs/state
|
|
48
|
+
- [ ] Race condition / timing issue
|
|
49
|
+
- [ ] External dependency failure
|
|
50
|
+
- [ ] Configuration/environment issue
|
|
51
|
+
- [ ] Prompt/instruction unclear or ambiguous
|
|
52
|
+
- [ ] Other: [explain]
|
|
53
|
+
|
|
54
|
+
### Source of the Problem
|
|
55
|
+
<!-- For AI-assisted development, this helps us learn -->
|
|
56
|
+
- **Prompt issue**: [Was the original request ambiguous or missing context?]
|
|
57
|
+
- **Logic gap**: [What reasoning led to the bug?]
|
|
58
|
+
- **Missing context**: [What information would have prevented this?]
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Fix Approaches
|
|
63
|
+
|
|
64
|
+
### Approach 1: [Name] (Recommended)
|
|
65
|
+
**Description**: [How this approach fixes the bug]
|
|
66
|
+
**Pros**: [Benefits]
|
|
67
|
+
**Cons**: [Drawbacks]
|
|
68
|
+
**Files affected**: [List files]
|
|
69
|
+
|
|
70
|
+
### Approach 2: [Name] (Alternative)
|
|
71
|
+
**Description**: [How this approach fixes the bug]
|
|
72
|
+
**Pros**: [Benefits]
|
|
73
|
+
**Cons**: [Drawbacks]
|
|
74
|
+
**Files affected**: [List files]
|
|
75
|
+
|
|
76
|
+
### Chosen Approach
|
|
77
|
+
[Which approach and why]
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Acceptance Criteria
|
|
82
|
+
|
|
83
|
+
### Scenario 1: Bug is fixed
|
|
84
|
+
**Given** [the conditions that previously triggered the bug]
|
|
85
|
+
**When** [the action that caused the bug]
|
|
86
|
+
**Then** [the expected correct behavior]
|
|
87
|
+
|
|
88
|
+
### Scenario 2: No regression
|
|
89
|
+
**Given** [related functionality]
|
|
90
|
+
**When** [normal usage]
|
|
91
|
+
**Then** [existing behavior is preserved]
|
|
92
|
+
|
|
93
|
+
### Scenario 3: Edge case handling
|
|
94
|
+
**Given** [edge case conditions]
|
|
95
|
+
**When** [edge case action]
|
|
96
|
+
**Then** [graceful handling]
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Test Strategy
|
|
101
|
+
- [ ] Unit test: [What to test]
|
|
102
|
+
- [ ] Integration test: [What to test]
|
|
103
|
+
- [ ] Manual verification: [Steps to verify fix]
|
|
104
|
+
|
|
105
|
+
## Verification Checklist
|
|
106
|
+
<!-- Quick steps to confirm the bug is fixed -->
|
|
107
|
+
1. [ ] [Step to verify the bug no longer occurs]
|
|
108
|
+
2. [ ] [Step to verify no regression]
|
|
109
|
+
3. [ ] [Step to verify edge cases]
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Prevention & Learning
|
|
114
|
+
|
|
115
|
+
### How to Prevent Similar Bugs
|
|
116
|
+
[What changes to process, prompts, or code patterns would prevent this?]
|
|
29
117
|
|
|
30
|
-
|
|
31
|
-
|
|
118
|
+
### Learnings to Capture
|
|
119
|
+
<!-- These should be added to decisions.md or skill learnings -->
|
|
120
|
+
- [ ] Pattern to add to decisions.md: [describe]
|
|
121
|
+
- [ ] Skill learning to record: [describe]
|
|
122
|
+
- [ ] Prompt improvement: [describe]
|
|
32
123
|
|
|
33
|
-
|
|
34
|
-
[If you have ideas about what's causing it or how to fix]
|
|
124
|
+
---
|
|
35
125
|
|
|
36
126
|
## Related
|
|
37
127
|
- [Related request-log entries]
|
|
38
128
|
- [Related components from app-map]
|
|
129
|
+
- [Related tasks/stories]
|
|
39
130
|
|
|
40
131
|
## Resolution
|
|
41
|
-
|
|
42
|
-
- Fixed in
|
|
43
|
-
- Root cause
|
|
132
|
+
<!-- Fill in when fixed -->
|
|
133
|
+
- **Fixed in**: [commit hash or PR]
|
|
134
|
+
- **Root cause confirmed**: [yes/no - was initial analysis correct?]
|
|
135
|
+
- **Learnings applied**: [what was added to decisions.md/skills?]
|
|
136
|
+
- **Tests added**: [what tests were added?]
|