claude-flow-novice 2.18.30 → 2.18.33
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.
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Coordinate agents to fix compilation errors
|
|
2
|
+
description: "Coordinate agents to fix compilation errors with strategic Phase 0 and parallel Phase 1"
|
|
3
3
|
argument-hint: "<language> [--max-parallel=5] [--max-cycles=10]"
|
|
4
4
|
allowed-tools: ["Task", "TaskOutput", "TodoWrite", "Read", "Bash"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# CFN Fix Errors - Agent Coordination Mode
|
|
8
8
|
|
|
9
|
-
**Version:**
|
|
9
|
+
**Version:** 2.0.0 | **Date:** 2025-12-21 | **Status:** Production Ready
|
|
10
10
|
|
|
11
11
|
## Quick Overview
|
|
12
12
|
|
|
13
|
-
Main chat coordinates
|
|
13
|
+
Main chat coordinates error fixing in two phases:
|
|
14
|
+
- **Phase 0**: Fix strategic root-cause files first (prevents cascading errors)
|
|
15
|
+
- **Phase 1**: Parallel agents fix remaining files (up to 5 concurrent)
|
|
16
|
+
- **Phase 2**: Cleanup of cross-file errors
|
|
14
17
|
|
|
15
18
|
### Key Features
|
|
16
|
-
- **
|
|
19
|
+
- **Phase 0 strategic fixes** - identify and fix root-cause files first
|
|
20
|
+
- **Max 5 parallel agents** with continuous spawning in Phase 1
|
|
17
21
|
- **Single-file focus** - each agent fixes one file only
|
|
18
|
-
- **2-attempt retry** logic per file before deferring to Phase 2
|
|
19
22
|
- **Post-edit validation** confirms fixes are correct
|
|
20
|
-
- **
|
|
23
|
+
- **Agents solve independently** - no external tools, just expertise
|
|
21
24
|
- **Automatic Phase 2** transition at <40 errors
|
|
22
25
|
|
|
23
26
|
### When to Use
|
|
24
27
|
- 20+ compilation errors
|
|
25
|
-
- Errors
|
|
28
|
+
- Errors may have cascading dependencies
|
|
26
29
|
- Want visibility into agent progress
|
|
27
|
-
- Need
|
|
30
|
+
- Need systematic error reduction
|
|
28
31
|
|
|
29
32
|
---
|
|
30
33
|
|
|
@@ -51,38 +54,153 @@ echo "Session ID: $SESSION_ID | Language: $LANGUAGE | Max Parallel: $MAX_PARALLE
|
|
|
51
54
|
|
|
52
55
|
---
|
|
53
56
|
|
|
54
|
-
### Step 2: Get Error Files
|
|
57
|
+
### Step 2: Get Error Files and Analyze
|
|
55
58
|
|
|
56
59
|
**YOU SHOULD:** Run the appropriate type checker and get files with errors.
|
|
57
60
|
|
|
58
61
|
**For Rust:**
|
|
59
62
|
```bash
|
|
60
63
|
cd [PROJECT_ROOT]
|
|
61
|
-
|
|
64
|
+
# Cargo errors: file paths are on lines starting with "-->"
|
|
65
|
+
SQLX_OFFLINE=true cargo check 2>&1 | tee /tmp/cargo-errors.txt | grep "^\s*-->" | awk '{print $2}' | awk -F':' '{print $1}' | sort | uniq -c | sort -rn
|
|
62
66
|
```
|
|
63
67
|
|
|
64
|
-
**For TypeScript:**
|
|
68
|
+
**For TypeScript (tsc):**
|
|
65
69
|
```bash
|
|
66
70
|
cd [PROJECT_ROOT]
|
|
67
|
-
|
|
68
|
-
npm run typecheck 2>&1 | grep "error TS" | awk -F'(' '{print $1}' | sort | uniq -c | sort -rn
|
|
71
|
+
npm run typecheck 2>&1 | tee /tmp/tsc-errors.txt | grep "error TS" | awk -F'(' '{print $1}' | sort | uniq -c | sort -rn
|
|
69
72
|
```
|
|
70
73
|
|
|
71
|
-
**
|
|
74
|
+
**For TypeScript (ESLint):**
|
|
75
|
+
```bash
|
|
76
|
+
cd [PROJECT_ROOT]
|
|
77
|
+
npm run lint 2>&1 > /tmp/eslint-output.txt
|
|
78
|
+
grep -B1 "error" /tmp/eslint-output.txt | grep -v "error\|--" | grep "\.tsx\?$" | sort | uniq -c | sort -rn
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Alternative (Universal TypeScript/ESLint parser):**
|
|
82
|
+
```bash
|
|
83
|
+
npm run lint 2>&1 > /tmp/lint-output.txt || npm run typecheck 2>&1 > /tmp/lint-output.txt
|
|
84
|
+
|
|
85
|
+
python3 << 'PARSE_SCRIPT'
|
|
86
|
+
import re
|
|
87
|
+
from collections import defaultdict
|
|
88
|
+
|
|
89
|
+
error_counts = defaultdict(int)
|
|
90
|
+
current_file = None
|
|
91
|
+
|
|
92
|
+
with open('/tmp/lint-output.txt', 'r') as f:
|
|
93
|
+
for line in f:
|
|
94
|
+
if line.strip().endswith('.ts') or line.strip().endswith('.tsx'):
|
|
95
|
+
current_file = line.strip()
|
|
96
|
+
elif re.search(r'^\s+\d+:\d+\s+(error|warning)', line) and current_file:
|
|
97
|
+
error_counts[current_file] += 1
|
|
98
|
+
elif match := re.match(r'^(.+\.tsx?)\(\d+,\d+\):\s+error', line):
|
|
99
|
+
error_counts[match.group(1)] += 1
|
|
100
|
+
|
|
101
|
+
for file, count in sorted(error_counts.items(), key=lambda x: -x[1])[:30]:
|
|
102
|
+
print(f"{count:6d} {file}")
|
|
103
|
+
PARSE_SCRIPT
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### Step 3: Phase 0 - Identify Strategic Root-Cause Files
|
|
109
|
+
|
|
110
|
+
**YOU SHOULD:** Analyze the error output to identify files that should be fixed FIRST because they cause cascading errors.
|
|
111
|
+
|
|
112
|
+
**Root-Cause File Indicators:**
|
|
113
|
+
|
|
114
|
+
1. **Type Definition Files** (highest priority):
|
|
115
|
+
- `*.d.ts` files
|
|
116
|
+
- `types.ts`, `types/*.ts`
|
|
117
|
+
- `interfaces.ts`, `models.ts`
|
|
118
|
+
- Files with "Cannot find type" errors pointing to them
|
|
119
|
+
|
|
120
|
+
2. **Core/Base Modules**:
|
|
121
|
+
- `index.ts` files that re-export many modules
|
|
122
|
+
- Files imported by 5+ other error files
|
|
123
|
+
- Base classes/interfaces extended by other files
|
|
124
|
+
|
|
125
|
+
3. **Configuration Files**:
|
|
126
|
+
- `config.ts`, `constants.ts`
|
|
127
|
+
- Environment/settings files
|
|
128
|
+
|
|
129
|
+
4. **Dependency Analysis** (from error messages):
|
|
130
|
+
- Look for patterns like "Cannot find module './X'" - fix X first
|
|
131
|
+
- Look for "Type 'X' is not assignable" where X is defined elsewhere
|
|
132
|
+
- Look for "Property 'X' does not exist on type 'Y'" - fix Y's definition first
|
|
133
|
+
|
|
134
|
+
**YOU SHOULD:** Create a Phase 0 queue of 3-8 strategic files to fix first.
|
|
135
|
+
|
|
136
|
+
**Example Analysis:**
|
|
137
|
+
```
|
|
138
|
+
ERROR ANALYSIS:
|
|
139
|
+
- 15 files have "Cannot find module './types/api'"
|
|
140
|
+
→ Fix: src/types/api.ts FIRST (root cause)
|
|
141
|
+
|
|
142
|
+
- 8 files have "Type 'UserData' is not assignable"
|
|
143
|
+
→ Fix: src/models/user.ts FIRST (type definition issue)
|
|
144
|
+
|
|
145
|
+
- 12 files import from src/utils/index.ts which has errors
|
|
146
|
+
→ Fix: src/utils/index.ts FIRST (cascading imports)
|
|
147
|
+
|
|
148
|
+
PHASE 0 QUEUE (fix in order):
|
|
149
|
+
1. src/types/api.ts (15 dependents)
|
|
150
|
+
2. src/models/user.ts (8 dependents)
|
|
151
|
+
3. src/utils/index.ts (12 dependents)
|
|
72
152
|
```
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### Step 4: Execute Phase 0 - Strategic Fixes (Sequential)
|
|
157
|
+
|
|
158
|
+
**YOU SHOULD:** Fix Phase 0 files ONE AT A TIME with full cross-file context.
|
|
159
|
+
|
|
160
|
+
**For EACH file in Phase 0 queue:**
|
|
161
|
+
|
|
162
|
+
1. **Spawn a dedicated agent** (NOT in background):
|
|
163
|
+
```typescript
|
|
164
|
+
Task("rust-developer" OR "typescript-specialist",
|
|
165
|
+
`Fix errors in: [FILE_PATH]
|
|
166
|
+
|
|
167
|
+
PROJECT: [PROJECT_ROOT]
|
|
168
|
+
CONTEXT: This is a Phase 0 strategic file that other files depend on.
|
|
169
|
+
|
|
170
|
+
YOUR TASK:
|
|
171
|
+
1. Read the file and understand its purpose
|
|
172
|
+
2. Check the error output in /tmp/[cargo-errors|tsc-errors|eslint-output].txt
|
|
173
|
+
3. Fix ALL errors in this file
|
|
174
|
+
4. Consider how your fixes affect files that import/use this file
|
|
175
|
+
5. Run post-edit validation: .claude/hooks/cfn-invoke-post-edit.sh [FILE_PATH]
|
|
176
|
+
6. If validation fails, adjust your fix
|
|
177
|
+
|
|
178
|
+
IMPORTANT:
|
|
179
|
+
- This file is a root cause - other files depend on it
|
|
180
|
+
- Ensure exports/types remain compatible
|
|
181
|
+
- Do NOT change the public API unless necessary to fix errors
|
|
182
|
+
- Focus on type correctness and import resolution
|
|
183
|
+
|
|
184
|
+
Report: List of fixes made and any breaking changes.`,
|
|
185
|
+
{run_in_background: false} // BLOCKING - wait for completion
|
|
186
|
+
);
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
2. **After each Phase 0 fix, recheck errors:**
|
|
190
|
+
```bash
|
|
191
|
+
# Rerun type checker to see cascading improvements
|
|
192
|
+
npm run typecheck 2>&1 | grep "error" | wc -l
|
|
193
|
+
# or for Rust:
|
|
194
|
+
SQLX_OFFLINE=true cargo check 2>&1 | grep "^error" | wc -l
|
|
76
195
|
```
|
|
77
196
|
|
|
78
|
-
**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
- `agentId`: null | "agent-session-file"
|
|
197
|
+
3. **Update file queue** - remove files that no longer have errors
|
|
198
|
+
|
|
199
|
+
**PHASE 0 COMPLETE when:** All strategic files are fixed.
|
|
82
200
|
|
|
83
201
|
---
|
|
84
202
|
|
|
85
|
-
### Step
|
|
203
|
+
### Step 5: Execute Phase 1 - Parallel Agent Spawning
|
|
86
204
|
|
|
87
205
|
**YOU SHOULD:** Spawn agents continuously, maintaining exactly 5 active agents at any time.
|
|
88
206
|
|
|
@@ -108,193 +226,193 @@ while (fileQueue.length > 0 || activeAgents.length > 0) {
|
|
|
108
226
|
}
|
|
109
227
|
|
|
110
228
|
// Monitor agents (non-blocking check)
|
|
111
|
-
for
|
|
229
|
+
for (const agent of activeAgents) {
|
|
112
230
|
const result = TaskOutput(agent.taskId, {block: false, timeout: 0});
|
|
113
231
|
|
|
114
|
-
if (result.status ===
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// File fixed! Remove from queue
|
|
232
|
+
if (result.status === "completed") {
|
|
233
|
+
if (result.success) {
|
|
234
|
+
markFileComplete(agent.file);
|
|
118
235
|
} else if (agent.attempts < 2) {
|
|
119
|
-
// Retry
|
|
120
|
-
|
|
121
|
-
|
|
236
|
+
// Retry once
|
|
237
|
+
agent.attempts++;
|
|
238
|
+
requeue(agent.file);
|
|
122
239
|
} else {
|
|
123
|
-
//
|
|
124
|
-
|
|
240
|
+
// Defer to Phase 2
|
|
241
|
+
markFileDeferred(agent.file);
|
|
125
242
|
}
|
|
126
|
-
|
|
127
|
-
// Remove from active agents (frees slot for next file)
|
|
128
|
-
activeAgents.remove(agent);
|
|
243
|
+
removeFromActive(agent);
|
|
129
244
|
}
|
|
130
245
|
}
|
|
131
246
|
|
|
132
|
-
//
|
|
133
|
-
sleep(
|
|
247
|
+
// Brief pause before next check
|
|
248
|
+
sleep(2000);
|
|
134
249
|
}
|
|
135
250
|
```
|
|
136
251
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
Use this exact prompt structure for spawned agents:
|
|
140
|
-
|
|
141
|
-
```
|
|
142
|
-
AGENT_ID="${agentId}"
|
|
143
|
-
FILE_PATH="${file}"
|
|
144
|
-
SESSION_ID="${SESSION_ID}"
|
|
145
|
-
ATTEMPT=${attempts}/2
|
|
146
|
-
|
|
147
|
-
TASK: Fix compilation errors in a single file using Cerebras acceleration.
|
|
148
|
-
|
|
149
|
-
WORKFLOW:
|
|
150
|
-
1. Read file: ${file}
|
|
151
|
-
|
|
152
|
-
2. Call Cerebras single-file fixer:
|
|
153
|
-
[FOR RUST]
|
|
154
|
-
npx tsx /path/to/cerebras-gated-fixer-v2.ts --file="${file}" --agent-id="${agentId}"
|
|
252
|
+
---
|
|
155
253
|
|
|
156
|
-
|
|
157
|
-
npx tsx /path/to/typescript-gated-fixer-v2.ts --file="${file}" --agent-id="${agentId}"
|
|
254
|
+
### Step 6: Phase 1 Agent Prompt
|
|
158
255
|
|
|
159
|
-
|
|
160
|
-
./.claude/hooks/cfn-invoke-post-edit.sh "${file}" --agent-id "${agentId}"
|
|
256
|
+
**USE THIS PROMPT for each Phase 1 agent:**
|
|
161
257
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
- If post-edit validation FAILS (exit 1): Return "RETRY" (attempt 1) or "DEFER" (attempt 2)
|
|
258
|
+
```
|
|
259
|
+
Fix compilation errors in: [FILE_PATH]
|
|
165
260
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
- Up to 3 retries per gate rejection
|
|
261
|
+
PROJECT: [PROJECT_ROOT]
|
|
262
|
+
LANGUAGE: [typescript|rust]
|
|
263
|
+
AGENT_ID: [GENERATED_AGENT_ID]
|
|
170
264
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
265
|
+
YOUR TASK:
|
|
266
|
+
1. Read the file to understand context
|
|
267
|
+
2. Identify all errors in this file from the type checker output
|
|
268
|
+
3. Fix each error using your expertise
|
|
269
|
+
4. Run post-edit validation after fixes
|
|
176
270
|
|
|
177
|
-
|
|
178
|
-
|
|
271
|
+
WORKFLOW:
|
|
272
|
+
1. Read the file: cat [FILE_PATH]
|
|
273
|
+
2. Get specific errors for this file from /tmp/[tsc-errors|cargo-errors|eslint-output].txt
|
|
274
|
+
3. Make targeted fixes - edit only what's needed
|
|
275
|
+
4. Validate: .claude/hooks/cfn-invoke-post-edit.sh [FILE_PATH] --agent-id [AGENT_ID]
|
|
276
|
+
5. If validation shows new errors, adjust
|
|
277
|
+
|
|
278
|
+
CONSTRAINTS:
|
|
279
|
+
- Fix ONLY errors in [FILE_PATH] - do not modify other files
|
|
280
|
+
- Do NOT run linters on the entire codebase (eslint . is FORBIDDEN)
|
|
281
|
+
- Do NOT add unnecessary dependencies
|
|
282
|
+
- Preserve existing functionality
|
|
283
|
+
- Keep fixes minimal and targeted
|
|
284
|
+
|
|
285
|
+
COMMON FIX PATTERNS:
|
|
286
|
+
- Missing imports: Add the import statement
|
|
287
|
+
- Type errors: Add proper type annotations
|
|
288
|
+
- Unused variables: Prefix with _ or remove if truly unused
|
|
289
|
+
- Missing exports: Add export keyword
|
|
290
|
+
- Null checks: Add optional chaining or null guards
|
|
291
|
+
|
|
292
|
+
REPORT FORMAT:
|
|
293
|
+
```
|
|
294
|
+
FIXES APPLIED:
|
|
295
|
+
- Line X: [description of fix]
|
|
296
|
+
- Line Y: [description of fix]
|
|
179
297
|
|
|
180
|
-
|
|
298
|
+
VALIDATION: [PASS/FAIL]
|
|
299
|
+
REMAINING ERRORS: [count or "none"]
|
|
300
|
+
```
|
|
181
301
|
```
|
|
182
302
|
|
|
183
303
|
---
|
|
184
304
|
|
|
185
|
-
### Step
|
|
305
|
+
### Step 7: Monitor Progress and Transition
|
|
186
306
|
|
|
187
|
-
**YOU SHOULD:**
|
|
188
|
-
|
|
189
|
-
**Recheck Error Count:**
|
|
307
|
+
**YOU SHOULD:** Track progress and decide when to transition to Phase 2.
|
|
190
308
|
|
|
309
|
+
**Progress Tracking:**
|
|
191
310
|
```bash
|
|
192
|
-
#
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
npm run typecheck 2>&1 | grep -c "error TS"
|
|
311
|
+
# Check current error count
|
|
312
|
+
npm run typecheck 2>&1 | grep "error" | wc -l
|
|
313
|
+
# or
|
|
314
|
+
SQLX_OFFLINE=true cargo check 2>&1 | grep "^error" | wc -l
|
|
197
315
|
```
|
|
198
316
|
|
|
199
|
-
**Phase 2
|
|
317
|
+
**Transition to Phase 2 when ANY of these conditions are met:**
|
|
200
318
|
- Error count < 40
|
|
201
|
-
-
|
|
202
|
-
-
|
|
203
|
-
-
|
|
319
|
+
- 3 consecutive cycles with no improvement
|
|
320
|
+
- All files have been attempted twice
|
|
321
|
+
- Remaining errors require cross-file coordination
|
|
322
|
+
|
|
323
|
+
---
|
|
204
324
|
|
|
205
|
-
|
|
325
|
+
### Step 8: Phase 2 - Cross-File Cleanup
|
|
326
|
+
|
|
327
|
+
**YOU SHOULD:** Spawn a dedicated cleanup agent for remaining errors.
|
|
206
328
|
|
|
207
329
|
```typescript
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
AGENT_ID="${LANGUAGE}-phase2-${SESSION_ID}"
|
|
330
|
+
Task("rust-developer" OR "typescript-specialist",
|
|
331
|
+
`Phase 2 Cleanup: Fix remaining cross-file errors
|
|
211
332
|
|
|
212
|
-
|
|
333
|
+
PROJECT: [PROJECT_ROOT]
|
|
334
|
+
REMAINING_ERRORS: [error count]
|
|
335
|
+
DEFERRED_FILES: [list of files that couldn't be fixed in Phase 1]
|
|
213
336
|
|
|
214
337
|
CONTEXT:
|
|
215
|
-
|
|
216
|
-
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
- Read FULL file before editing
|
|
235
|
-
- Preserve ALL existing imports
|
|
236
|
-
- Fix root causes first
|
|
237
|
-
- Verify after EACH file
|
|
238
|
-
- Run post-edit pipeline after EACH edit
|
|
239
|
-
|
|
240
|
-
RESTRICTIONS:
|
|
241
|
-
- DO NOT run linters on entire codebase
|
|
242
|
-
- Work on one file at a time
|
|
243
|
-
|
|
244
|
-
Report final error count when done.
|
|
245
|
-
`)
|
|
338
|
+
Phase 0 fixed strategic root-cause files.
|
|
339
|
+
Phase 1 fixed [X] files with single-file errors.
|
|
340
|
+
Now fix remaining errors that require cross-file understanding.
|
|
341
|
+
|
|
342
|
+
YOUR TASK:
|
|
343
|
+
1. Run full type check to get current errors
|
|
344
|
+
2. Analyze error patterns across files
|
|
345
|
+
3. Fix errors that span multiple files
|
|
346
|
+
4. Ensure type consistency across modules
|
|
347
|
+
|
|
348
|
+
APPROACH:
|
|
349
|
+
- Group related errors by type/module
|
|
350
|
+
- Fix shared types/interfaces first
|
|
351
|
+
- Then fix usage sites
|
|
352
|
+
- Run validation after each group of fixes
|
|
353
|
+
|
|
354
|
+
REPORT: Summary of remaining errors and fixes applied.`,
|
|
355
|
+
{run_in_background: false}
|
|
356
|
+
);
|
|
246
357
|
```
|
|
247
358
|
|
|
248
359
|
---
|
|
249
360
|
|
|
250
|
-
##
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
"
|
|
260
|
-
"
|
|
361
|
+
## State Management
|
|
362
|
+
|
|
363
|
+
**YOU SHOULD:** Maintain state in /tmp/phase-state.json:
|
|
364
|
+
|
|
365
|
+
```json
|
|
366
|
+
{
|
|
367
|
+
"sessionId": "cfn-fix-123456-7890",
|
|
368
|
+
"language": "typescript",
|
|
369
|
+
"startTime": "2025-12-21T10:00:00Z",
|
|
370
|
+
"initialErrors": 150,
|
|
371
|
+
"currentErrors": 45,
|
|
372
|
+
"phase": "1",
|
|
373
|
+
"phase0Files": [
|
|
374
|
+
{"file": "src/types/api.ts", "status": "completed", "dependents": 15}
|
|
375
|
+
],
|
|
376
|
+
"phase1Files": [
|
|
377
|
+
{"file": "src/api/handler.ts", "attempts": 1, "status": "in_progress", "agentId": "abc123"}
|
|
378
|
+
],
|
|
379
|
+
"deferredFiles": [],
|
|
380
|
+
"activeAgents": ["abc123", "def456"]
|
|
261
381
|
}
|
|
262
|
-
|
|
263
|
-
// Active agents
|
|
264
|
-
activeAgents = [
|
|
265
|
-
{file: "src/api.ts", agentId: "ts-fixer-123-api", taskId: "abc123", attempts: 1}
|
|
266
|
-
]
|
|
267
|
-
|
|
268
|
-
// Phase 2 queue
|
|
269
|
-
phase2Queue = ["src/db.ts", "src/models.ts"]
|
|
270
382
|
```
|
|
271
383
|
|
|
272
|
-
|
|
384
|
+
---
|
|
273
385
|
|
|
274
|
-
|
|
275
|
-
- If TaskOutput times out: Treat as DEFER, add to Phase 2
|
|
276
|
-
- If post-edit hook missing: Warn user, continue without validation
|
|
386
|
+
## Quick Reference
|
|
277
387
|
|
|
278
|
-
|
|
388
|
+
| Phase | Purpose | Execution | Agent Count |
|
|
389
|
+
|-------|---------|-----------|-------------|
|
|
390
|
+
| 0 | Root-cause files | Sequential | 1 at a time |
|
|
391
|
+
| 1 | Parallel fixes | Continuous spawn | Up to 5 |
|
|
392
|
+
| 2 | Cross-file cleanup | Sequential | 1 dedicated |
|
|
279
393
|
|
|
280
|
-
**
|
|
281
|
-
-
|
|
282
|
-
-
|
|
283
|
-
|
|
284
|
-
|
|
394
|
+
**Agent Types:**
|
|
395
|
+
- Rust: `rust-developer`
|
|
396
|
+
- TypeScript: `typescript-specialist`
|
|
397
|
+
|
|
398
|
+
**Validation Hook:**
|
|
399
|
+
```bash
|
|
400
|
+
.claude/hooks/cfn-invoke-post-edit.sh [FILE] --agent-id [ID]
|
|
401
|
+
```
|
|
285
402
|
|
|
286
403
|
---
|
|
287
404
|
|
|
288
405
|
## Related Documentation
|
|
289
406
|
|
|
290
|
-
- **
|
|
291
|
-
- **
|
|
292
|
-
- **Post-Edit Pipeline**: `.claude/hooks/cfn-invoke-post-edit.sh`
|
|
407
|
+
- **Post-Edit Hooks**: `.claude/hooks/cfn-invoke-post-edit.sh`
|
|
408
|
+
- **Agent Templates**: `.claude/agents/cfn-dev-team/developers/`
|
|
293
409
|
- **Task Mode Reference**: `.claude/commands/cfn-loop-task.md`
|
|
294
410
|
|
|
295
411
|
---
|
|
296
412
|
|
|
297
413
|
## Version History
|
|
298
414
|
|
|
415
|
+
- v2.0.0 (2025-12-21) - Removed Cerebras, added Phase 0 for strategic root-cause files
|
|
416
|
+
- v1.2.0 (2025-12-21) - Fixed error file extraction patterns for Rust and TypeScript/ESLint
|
|
299
417
|
- v1.1.0 (2025-12-21) - Clarified instructions, removed pseudocode confusion
|
|
300
418
|
- v1.0.0 (2025-12-21) - Initial coordination mode implementation
|
|
@@ -12,11 +12,15 @@
|
|
|
12
12
|
* - Targeted crate compile testing
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
import * as dotenv from 'dotenv';
|
|
15
16
|
import createCerebrasClient from './cerebras-wrapper.js';
|
|
16
17
|
import * as fs from 'fs';
|
|
17
18
|
import * as path from 'path';
|
|
18
19
|
import { execSync } from 'child_process';
|
|
19
20
|
|
|
21
|
+
// Load environment variables from .env file
|
|
22
|
+
dotenv.config();
|
|
23
|
+
|
|
20
24
|
// ============== CONFIGURATION ==============
|
|
21
25
|
|
|
22
26
|
// Parse --file and --agent-id parameters
|
|
@@ -9,10 +9,14 @@
|
|
|
9
9
|
* - Phase 2: Dedicated agent cleanup (high quality)
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import * as dotenv from 'dotenv';
|
|
12
13
|
import Cerebras from '@cerebras/cerebras_cloud_sdk';
|
|
13
14
|
import * as fs from 'fs';
|
|
14
15
|
import * as path from 'path';
|
|
15
16
|
import { execFileSync, spawnSync } from 'child_process';
|
|
17
|
+
|
|
18
|
+
// Load environment variables from .env file
|
|
19
|
+
dotenv.config();
|
|
16
20
|
import {
|
|
17
21
|
gateLineCountDelta,
|
|
18
22
|
gateMethodSignature,
|
|
@@ -167,9 +171,9 @@ function validateApiKey(apiKey: string | undefined): boolean {
|
|
|
167
171
|
return false;
|
|
168
172
|
}
|
|
169
173
|
|
|
170
|
-
// Check for basic format (starts with sk- and reasonable length)
|
|
171
|
-
if (!apiKey.startsWith('sk-') || apiKey.length < 20) {
|
|
172
|
-
console.error('❌ Security: Invalid API key format');
|
|
174
|
+
// Check for basic format (starts with sk- or csk- and reasonable length)
|
|
175
|
+
if ((!apiKey.startsWith('sk-') && !apiKey.startsWith('csk-')) || apiKey.length < 20) {
|
|
176
|
+
console.error('❌ Security: Invalid API key format (expected sk-* or csk-*)');
|
|
173
177
|
return false;
|
|
174
178
|
}
|
|
175
179
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow-novice",
|
|
3
|
-
"version": "2.18.
|
|
3
|
+
"version": "2.18.33",
|
|
4
4
|
"description": "Claude Flow Novice - Advanced orchestration platform for multi-agent AI workflows with CFN Loop architecture\n\nIncludes Local RuVector Accelerator and all CFN skills for complete functionality.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|