claude-flow-novice 2.18.27 → 2.18.29
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/.claude/commands/cfn-fix-errors.md +426 -0
- package/.claude/skills/cfn-compilation-error-fixer/lib/fixer/cerebras-gated-fixer-v2.ts +23 -1
- package/.claude/skills/cfn-compilation-error-fixer/lib/fixer/typescript-gated-fixer-v2.ts +37 -0
- package/config/hooks/post-edit-pipeline.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Coordinate agents to fix compilation errors using post-edit validation and Cerebras gates"
|
|
3
|
+
argument-hint: "<language> [--max-parallel=5] [--max-cycles=10]"
|
|
4
|
+
allowed-tools: ["Task", "TaskOutput", "TodoWrite", "Read", "Bash"]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# CFN Fix Errors - Coordination Mode
|
|
8
|
+
|
|
9
|
+
**Version:** 1.0.0 | **Date:** 2025-12-21 | **Status:** Production Ready
|
|
10
|
+
|
|
11
|
+
## Quick Overview
|
|
12
|
+
|
|
13
|
+
Coordination mode for fixing compilation errors using agent-driven post-edit validation with Cerebras acceleration.
|
|
14
|
+
|
|
15
|
+
### Key Features
|
|
16
|
+
- **Agent Coordination:** Main chat spawns agents with `background=true`
|
|
17
|
+
- **Parallel Processing:** Max 5 agents working simultaneously
|
|
18
|
+
- **Single-File Focus:** Each agent fixes 1 file only
|
|
19
|
+
- **Post-Edit Validation:** Mandatory validation after each fix
|
|
20
|
+
- **Cerebras Gates:** 12 structural validations prevent semantic changes
|
|
21
|
+
- **Smart Retry:** 2 attempts per file before deferring to Phase 2
|
|
22
|
+
- **Continuous Spawning:** New agent launches immediately when slot opens
|
|
23
|
+
|
|
24
|
+
### When to Use
|
|
25
|
+
- 20+ compilation errors
|
|
26
|
+
- Need fast bulk reduction
|
|
27
|
+
- Errors are mostly mechanical (type mismatches, imports, syntax)
|
|
28
|
+
- Want visibility into agent progress
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Execution Instructions (AUTO-EXECUTE)
|
|
33
|
+
|
|
34
|
+
### Step 1: Parse Arguments
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Parse command
|
|
38
|
+
LANGUAGE="$ARGUMENTS"
|
|
39
|
+
LANGUAGE=$(echo "$LANGUAGE" | sed 's/--max-parallel[[:space:]]*[0-9]*//' | sed 's/--max-cycles[[:space:]]*[0-9]*//' | xargs)
|
|
40
|
+
|
|
41
|
+
MAX_PARALLEL=5
|
|
42
|
+
MAX_CYCLES=10
|
|
43
|
+
|
|
44
|
+
for arg in $ARGUMENTS; do
|
|
45
|
+
case $arg in
|
|
46
|
+
--max-parallel=*) MAX_PARALLEL="${arg#*=}" ;;
|
|
47
|
+
--max-cycles=*) MAX_CYCLES="${arg#*=}" ;;
|
|
48
|
+
esac
|
|
49
|
+
done
|
|
50
|
+
|
|
51
|
+
# Validate language
|
|
52
|
+
if [[ ! "$LANGUAGE" =~ ^(rust|typescript|ts)$ ]]; then
|
|
53
|
+
echo "ERROR: Language must be: rust, typescript, ts"
|
|
54
|
+
exit 1
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# Normalize typescript
|
|
58
|
+
if [[ "$LANGUAGE" == "ts" ]]; then
|
|
59
|
+
LANGUAGE="typescript"
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
SESSION_ID="cfn-fix-$(date +%s%N | tail -c 7)-${RANDOM}"
|
|
63
|
+
echo "Session ID: $SESSION_ID | Language: $LANGUAGE | Max Parallel: $MAX_PARALLEL"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Step 2: Initialize State
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// State tracking
|
|
70
|
+
const fileState = new Map<string, {
|
|
71
|
+
attempts: number;
|
|
72
|
+
status: 'queued' | 'in_progress' | 'success' | 'defer_to_phase2';
|
|
73
|
+
agentId: string | null;
|
|
74
|
+
lastError: string | null;
|
|
75
|
+
}>();
|
|
76
|
+
|
|
77
|
+
const activeAgents = new Map<string, {
|
|
78
|
+
file: string;
|
|
79
|
+
agentId: string;
|
|
80
|
+
taskId: string;
|
|
81
|
+
}>();
|
|
82
|
+
|
|
83
|
+
const phase2Queue: string[] = [];
|
|
84
|
+
let currentCycle = 0;
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Step 3: Get Error Files (Sorted by Error Count)
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Rust
|
|
91
|
+
if [[ "$LANGUAGE" == "rust" ]]; then
|
|
92
|
+
ERROR_FILES=$(SQLX_OFFLINE=true cargo check 2>&1 | \
|
|
93
|
+
grep "^error\[" | \
|
|
94
|
+
awk -F':' '{print $1}' | \
|
|
95
|
+
sort | uniq -c | sort -rn | \
|
|
96
|
+
awk '{print $2}')
|
|
97
|
+
|
|
98
|
+
TOTAL_ERRORS=$(SQLX_OFFLINE=true cargo check 2>&1 | grep -c "^error\[")
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# TypeScript
|
|
102
|
+
if [[ "$LANGUAGE" == "typescript" ]]; then
|
|
103
|
+
ERROR_FILES=$(npm run type-check 2>&1 | \
|
|
104
|
+
grep "error TS" | \
|
|
105
|
+
awk -F'(' '{print $1}' | \
|
|
106
|
+
sort | uniq -c | sort -rn | \
|
|
107
|
+
awk '{print $2}')
|
|
108
|
+
|
|
109
|
+
TOTAL_ERRORS=$(npm run type-check 2>&1 | grep -c "error TS")
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
echo "Found $TOTAL_ERRORS errors across $(echo "$ERROR_FILES" | wc -l) files"
|
|
113
|
+
|
|
114
|
+
# Initialize file state
|
|
115
|
+
for file in $ERROR_FILES; do
|
|
116
|
+
fileState.set(file, {
|
|
117
|
+
attempts: 0,
|
|
118
|
+
status: 'queued',
|
|
119
|
+
agentId: null,
|
|
120
|
+
lastError: null
|
|
121
|
+
});
|
|
122
|
+
done
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Step 4: Agent Spawn Loop (Continuous)
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
// Main coordination loop
|
|
129
|
+
while (fileQueue.length > 0 || activeAgents.size > 0) {
|
|
130
|
+
|
|
131
|
+
// Spawn agents up to max parallel
|
|
132
|
+
while (activeAgents.size < MAX_PARALLEL && fileQueue.length > 0) {
|
|
133
|
+
const file = fileQueue.shift();
|
|
134
|
+
const state = fileState.get(file);
|
|
135
|
+
|
|
136
|
+
// Skip if already succeeded or deferred
|
|
137
|
+
if (state.status === 'success' || state.status === 'defer_to_phase2') {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Spawn agent for this file
|
|
142
|
+
const agentId = `${LANGUAGE}-fixer-${SESSION_ID}-${file.replace(/\W/g, '_')}`;
|
|
143
|
+
state.attempts++;
|
|
144
|
+
state.status = 'in_progress';
|
|
145
|
+
state.agentId = agentId;
|
|
146
|
+
|
|
147
|
+
const agentType = LANGUAGE === 'rust' ? 'rust-developer' : 'typescript-specialist';
|
|
148
|
+
|
|
149
|
+
const taskId = Task(agentType, `
|
|
150
|
+
AGENT_ID="${agentId}"
|
|
151
|
+
FILE_PATH="${file}"
|
|
152
|
+
SESSION_ID="${SESSION_ID}"
|
|
153
|
+
ATTEMPT=${state.attempts}/2
|
|
154
|
+
|
|
155
|
+
TASK: Fix compilation errors in a single file using Cerebras acceleration and post-edit validation.
|
|
156
|
+
|
|
157
|
+
WORKFLOW:
|
|
158
|
+
1. Read file: ${file}
|
|
159
|
+
|
|
160
|
+
2. Call single-file Cerebras fixer:
|
|
161
|
+
${LANGUAGE === 'rust'
|
|
162
|
+
? 'npx tsx ./.claude/skills/cfn-compilation-error-fixer/lib/fixer/cerebras-gated-fixer-v2.ts --file="${FILE_PATH}" --agent-id="${AGENT_ID}"'
|
|
163
|
+
: 'npx tsx ./.claude/skills/cfn-compilation-error-fixer/lib/fixer/typescript-gated-fixer-v2.ts --file="${FILE_PATH}" --agent-id="${AGENT_ID}"'}
|
|
164
|
+
|
|
165
|
+
3. Validate with post-edit pipeline:
|
|
166
|
+
./.claude/hooks/cfn-invoke-post-edit.sh "${FILE_PATH}" --agent-id "${AGENT_ID}"
|
|
167
|
+
|
|
168
|
+
4. Return status:
|
|
169
|
+
- If post-edit validation PASSES (exit 0): Return "SUCCESS"
|
|
170
|
+
- If post-edit validation FAILS (exit 1): Return "RETRY" (if attempt 1) or "DEFER" (if attempt 2)
|
|
171
|
+
|
|
172
|
+
CEREBRAS GATES (12 Structural Validations):
|
|
173
|
+
- Phase 1a: Cerebras generates fix
|
|
174
|
+
- Phase 1b: Gates validate (LineCount, FnSignature, ImportDup, BraceBalance, SemanticDiff, OrphanedCode, ImportPath, PatternDup, ImplLocation, TypeCast, MatchArm, Regression)
|
|
175
|
+
- Up to 3 retries with feedback per gate rejection
|
|
176
|
+
|
|
177
|
+
CRITICAL RESTRICTIONS:
|
|
178
|
+
- DO NOT run eslint, cargo clippy, cargo fmt, rustfmt, or any linter on the ENTIRE codebase
|
|
179
|
+
- DO NOT run cargo check on the entire project
|
|
180
|
+
- DO NOT run npm run type-check on the entire project
|
|
181
|
+
- Work ONLY on file: ${file}
|
|
182
|
+
- Use Cerebras tool for speed, not manual fixes
|
|
183
|
+
- Post-edit validation runs on this file only
|
|
184
|
+
|
|
185
|
+
POST-EDIT VALIDATION (MANDATORY):
|
|
186
|
+
After Cerebras applies fixes, run:
|
|
187
|
+
./.claude/hooks/cfn-invoke-post-edit.sh "${FILE_PATH}" --agent-id "${AGENT_ID}"
|
|
188
|
+
|
|
189
|
+
SUCCESS CRITERIA:
|
|
190
|
+
Post-edit pipeline returns exit code 0
|
|
191
|
+
|
|
192
|
+
RETURN FORMAT:
|
|
193
|
+
{
|
|
194
|
+
"status": "SUCCESS" | "RETRY" | "DEFER",
|
|
195
|
+
"file": "${file}",
|
|
196
|
+
"attempts": ${state.attempts},
|
|
197
|
+
"errors_fixed": <number>,
|
|
198
|
+
"validation_passed": <boolean>
|
|
199
|
+
}
|
|
200
|
+
`, {run_in_background: true});
|
|
201
|
+
|
|
202
|
+
// Track active agent
|
|
203
|
+
activeAgents.set(taskId, {
|
|
204
|
+
file,
|
|
205
|
+
agentId,
|
|
206
|
+
taskId
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
echo(`Spawned agent ${agentId} for ${file} (attempt ${state.attempts}/2)`);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Monitor active agents (continuous)
|
|
213
|
+
if (activeAgents.size > 0) {
|
|
214
|
+
// Check for completed agents (non-blocking)
|
|
215
|
+
for (const [taskId, agent] of activeAgents.entries()) {
|
|
216
|
+
const result = TaskOutput(taskId, {block: false, timeout: 0});
|
|
217
|
+
|
|
218
|
+
if (result.status === 'completed') {
|
|
219
|
+
const state = fileState.get(agent.file);
|
|
220
|
+
|
|
221
|
+
// Parse result
|
|
222
|
+
if (result.output.includes('SUCCESS')) {
|
|
223
|
+
state.status = 'success';
|
|
224
|
+
echo(`✓ ${agent.file} - Fixed successfully`);
|
|
225
|
+
} else if (result.output.includes('DEFER') || state.attempts >= 2) {
|
|
226
|
+
state.status = 'defer_to_phase2';
|
|
227
|
+
phase2Queue.push(agent.file);
|
|
228
|
+
echo(`→ ${agent.file} - Deferred to Phase 2 (${state.attempts} attempts)`);
|
|
229
|
+
} else {
|
|
230
|
+
// Retry
|
|
231
|
+
state.status = 'queued';
|
|
232
|
+
fileQueue.push(agent.file);
|
|
233
|
+
echo(`↻ ${agent.file} - Retrying (attempt ${state.attempts + 1}/2)`);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Remove from active agents
|
|
237
|
+
activeAgents.delete(taskId);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Small delay to prevent tight loop
|
|
242
|
+
await sleep(1000);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Step 5: Cycle Check (After All Agents Complete)
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
# Wait for all agents to complete
|
|
251
|
+
echo "Waiting for all agents to complete cycle $currentCycle..."
|
|
252
|
+
|
|
253
|
+
while activeAgents.size > 0; do
|
|
254
|
+
# Block until any agent completes
|
|
255
|
+
for (const [taskId, agent] of activeAgents.entries()) {
|
|
256
|
+
const result = TaskOutput(taskId, {block: true, timeout: 30000});
|
|
257
|
+
|
|
258
|
+
if (result.status === 'completed') {
|
|
259
|
+
// Process result (same as Step 4)
|
|
260
|
+
activeAgents.delete(taskId);
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
done
|
|
265
|
+
|
|
266
|
+
# Rerun error check
|
|
267
|
+
echo "Cycle $currentCycle complete. Rechecking errors..."
|
|
268
|
+
|
|
269
|
+
if [[ "$LANGUAGE" == "rust" ]]; then
|
|
270
|
+
NEW_ERROR_COUNT=$(SQLX_OFFLINE=true cargo check 2>&1 | grep -c "^error\[")
|
|
271
|
+
else
|
|
272
|
+
NEW_ERROR_COUNT=$(npm run type-check 2>&1 | grep -c "error TS")
|
|
273
|
+
fi
|
|
274
|
+
|
|
275
|
+
echo "Errors: $TOTAL_ERRORS → $NEW_ERROR_COUNT"
|
|
276
|
+
|
|
277
|
+
# Update total for next cycle
|
|
278
|
+
PREV_ERROR_COUNT=$TOTAL_ERRORS
|
|
279
|
+
TOTAL_ERRORS=$NEW_ERROR_COUNT
|
|
280
|
+
currentCycle=$((currentCycle + 1))
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Step 6: Phase Transition Logic
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Check if should proceed to Phase 2
|
|
287
|
+
PROCEED_TO_PHASE2=false
|
|
288
|
+
|
|
289
|
+
# Condition 1: Error count below threshold
|
|
290
|
+
if [ $TOTAL_ERRORS -lt 40 ]; then
|
|
291
|
+
echo "Error count below 40 - proceeding to Phase 2"
|
|
292
|
+
PROCEED_TO_PHASE2=true
|
|
293
|
+
fi
|
|
294
|
+
|
|
295
|
+
# Condition 2: No progress made
|
|
296
|
+
if [ $TOTAL_ERRORS -eq $PREV_ERROR_COUNT ] && [ $currentCycle -gt 1 ]; then
|
|
297
|
+
echo "No progress made - proceeding to Phase 2"
|
|
298
|
+
PROCEED_TO_PHASE2=true
|
|
299
|
+
fi
|
|
300
|
+
|
|
301
|
+
# Condition 3: Max cycles reached
|
|
302
|
+
if [ $currentCycle -ge $MAX_CYCLES ]; then
|
|
303
|
+
echo "Max cycles reached - proceeding to Phase 2"
|
|
304
|
+
PROCEED_TO_PHASE2=true
|
|
305
|
+
fi
|
|
306
|
+
|
|
307
|
+
# Condition 4: All files processed
|
|
308
|
+
if [ ${#fileQueue[@]} -eq 0 ] && [ ${#phase2Queue[@]} -eq 0 ]; then
|
|
309
|
+
echo "All files processed successfully!"
|
|
310
|
+
PROCEED_TO_PHASE2=false
|
|
311
|
+
fi
|
|
312
|
+
|
|
313
|
+
if [ "$PROCEED_TO_PHASE2" = true ]; then
|
|
314
|
+
# Proceed to Phase 2
|
|
315
|
+
echo "=== PHASE 2: Dedicated Agent Cleanup ==="
|
|
316
|
+
else
|
|
317
|
+
# Continue next cycle
|
|
318
|
+
echo "=== Continuing Phase 1: Cycle $currentCycle ==="
|
|
319
|
+
# Go back to Step 3 (get new error files)
|
|
320
|
+
fi
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Step 7: Phase 2 (Dedicated Agent Cleanup)
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
if [ "$PROCEED_TO_PHASE2" = true ]; then
|
|
327
|
+
|
|
328
|
+
echo "Spawning dedicated ${LANGUAGE}-developer agent for remaining errors..."
|
|
329
|
+
|
|
330
|
+
# Get files with remaining errors
|
|
331
|
+
PHASE2_FILES=$(echo "$ERROR_FILES" | head -20)
|
|
332
|
+
|
|
333
|
+
# Spawn dedicated agent (NOT background - visible progress)
|
|
334
|
+
Task(${agentType}, `
|
|
335
|
+
AGENT_ID="${LANGUAGE}-phase2-${SESSION_ID}"
|
|
336
|
+
|
|
337
|
+
TASK: Fix remaining compilation errors after Phase 1 bulk processing.
|
|
338
|
+
|
|
339
|
+
CONTEXT:
|
|
340
|
+
- Phase 1 (agent coordination) processed files with Cerebras acceleration
|
|
341
|
+
- Remaining errors require high-quality, context-aware fixes
|
|
342
|
+
- ${TOTAL_ERRORS} errors remaining
|
|
343
|
+
|
|
344
|
+
WORKING DIRECTORY:
|
|
345
|
+
${LANGUAGE === 'rust' ? 'RUST_PROJECT_PATH' : 'TYPESCRIPT_PROJECT_PATH'}
|
|
346
|
+
|
|
347
|
+
STEP 1: Get current error locations
|
|
348
|
+
${LANGUAGE === 'rust'
|
|
349
|
+
? 'SQLX_OFFLINE=true cargo check 2>&1 | grep -E "^error\\[E" | sort | uniq -c | sort -rn'
|
|
350
|
+
: 'npm run type-check 2>&1 | grep -E "error TS" | sort | uniq -c | sort -rn'}
|
|
351
|
+
|
|
352
|
+
STEP 2: Fix each error file in dependency order
|
|
353
|
+
1. Read FULL file for context
|
|
354
|
+
2. Identify root cause (not just symptom)
|
|
355
|
+
3. Apply minimal fix preserving semantics
|
|
356
|
+
4. Run post-edit validation:
|
|
357
|
+
./.claude/hooks/cfn-invoke-post-edit.sh "\$FILE" --agent-id "${AGENT_ID}"
|
|
358
|
+
5. Verify with compiler after EACH file
|
|
359
|
+
|
|
360
|
+
RULES:
|
|
361
|
+
- Read FULL file before editing
|
|
362
|
+
- Preserve ALL existing imports, don't duplicate
|
|
363
|
+
- Use proper ${LANGUAGE} idioms
|
|
364
|
+
- Fix root causes first (cascading errors will resolve)
|
|
365
|
+
- Verify after EACH file
|
|
366
|
+
- Run post-edit pipeline after EACH edit
|
|
367
|
+
|
|
368
|
+
RESTRICTIONS:
|
|
369
|
+
- DO NOT run eslint/cargo clippy on entire codebase
|
|
370
|
+
- Work on one file at a time
|
|
371
|
+
- Validate each fix before moving to next
|
|
372
|
+
|
|
373
|
+
COMMON ERROR TYPES:
|
|
374
|
+
${LANGUAGE === 'rust'
|
|
375
|
+
? '- E0308 (type mismatch): Add explicit casts or fix generics\n- E0412/E0433/E0425 (missing type/import): Add use statements\n- E0599 (wrong method): Fix method chain\n- E0277 (trait not implemented): Add trait implementations\n- E0382 (borrow checker): Fix ownership issues'
|
|
376
|
+
: '- TS2307 (module not found): Fix import paths\n- TS2322 (type mismatch): Add type annotations\n- TS2339 (property not exists): Add interface definitions\n- TS7006 (implicit any): Add explicit types\n- TS2688 (cannot find type): Install @types packages'}
|
|
377
|
+
|
|
378
|
+
Report final error count when done.
|
|
379
|
+
`)
|
|
380
|
+
|
|
381
|
+
fi
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## State Management
|
|
387
|
+
|
|
388
|
+
### File State Structure
|
|
389
|
+
|
|
390
|
+
```typescript
|
|
391
|
+
interface FileState {
|
|
392
|
+
attempts: number; // 0-2
|
|
393
|
+
status: 'queued' | 'in_progress' | 'success' | 'defer_to_phase2';
|
|
394
|
+
agentId: string | null; // Current/last agent ID
|
|
395
|
+
lastError: string | null; // Last error message
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const fileState = new Map<string, FileState>();
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### Active Agent Tracking
|
|
402
|
+
|
|
403
|
+
```typescript
|
|
404
|
+
interface ActiveAgent {
|
|
405
|
+
file: string; // File being processed
|
|
406
|
+
agentId: string; // Agent identifier
|
|
407
|
+
taskId: string; // TaskOutput ID for monitoring
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
const activeAgents = new Map<string, ActiveAgent>();
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
## Related Documentation
|
|
416
|
+
|
|
417
|
+
- **Compilation Error Fixer Skill**: `.claude/skills/cfn-compilation-error-fixer/SKILL.md`
|
|
418
|
+
- **Post-Edit Pipeline**: `.claude/hooks/cfn-invoke-post-edit.sh`
|
|
419
|
+
- **Cerebras Gated Fixer (Rust)**: `.claude/skills/cfn-compilation-error-fixer/lib/fixer/cerebras-gated-fixer-v2.ts`
|
|
420
|
+
- **Cerebras Gated Fixer (TypeScript)**: `.claude/skills/cfn-compilation-error-fixer/lib/fixer/typescript-gated-fixer-v2.ts`
|
|
421
|
+
- **Task Mode Reference**: `.claude/commands/cfn-loop-task.md`
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
**Version History:**
|
|
426
|
+
- v1.0.0 (2025-12-21) - Initial coordination mode implementation
|
|
@@ -19,6 +19,10 @@ import { execSync } from 'child_process';
|
|
|
19
19
|
|
|
20
20
|
// ============== CONFIGURATION ==============
|
|
21
21
|
|
|
22
|
+
// Parse --file and --agent-id parameters
|
|
23
|
+
const fileArg = process.argv.find(arg => arg.startsWith('--file='));
|
|
24
|
+
const agentIdArg = process.argv.find(arg => arg.startsWith('--agent-id='));
|
|
25
|
+
|
|
22
26
|
const CONFIG = {
|
|
23
27
|
maxGlobalIterations: 5,
|
|
24
28
|
maxFileRetries: 2,
|
|
@@ -32,6 +36,8 @@ const CONFIG = {
|
|
|
32
36
|
dryRun: process.argv.includes('--dry-run'),
|
|
33
37
|
patchDir: '/tmp/rust-fix-patches',
|
|
34
38
|
verbose: process.argv.includes('--verbose'),
|
|
39
|
+
singleFile: fileArg ? fileArg.split('=')[1] : null, // Single-file mode
|
|
40
|
+
agentId: agentIdArg ? agentIdArg.split('=')[1] : null, // Agent ID for coordination mode
|
|
35
41
|
};
|
|
36
42
|
|
|
37
43
|
// ============== TYPE DEFINITIONS ==============
|
|
@@ -1342,6 +1348,12 @@ async function main() {
|
|
|
1342
1348
|
console.log(`Layer 3 LLM Review: ${CONFIG.enableLayer3 ? 'ON' : 'OFF'}`);
|
|
1343
1349
|
console.log(`Clippy: ${CONFIG.enableClippy ? 'ON' : 'OFF'}`);
|
|
1344
1350
|
console.log(`Dry-Run: ${CONFIG.dryRun ? 'ON' : 'OFF'}`);
|
|
1351
|
+
if (CONFIG.singleFile) {
|
|
1352
|
+
console.log(`Single-File Mode: ${CONFIG.singleFile}`);
|
|
1353
|
+
if (CONFIG.agentId) {
|
|
1354
|
+
console.log(`Agent ID: ${CONFIG.agentId}`);
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1345
1357
|
console.log();
|
|
1346
1358
|
|
|
1347
1359
|
const apiKey = loadCerebrasKey();
|
|
@@ -1380,7 +1392,17 @@ async function main() {
|
|
|
1380
1392
|
const fileFeedback = new Map<string, Map<number, string>>();
|
|
1381
1393
|
|
|
1382
1394
|
let totalApplied = 0;
|
|
1383
|
-
|
|
1395
|
+
let files = [...allErrors.entries()];
|
|
1396
|
+
|
|
1397
|
+
// Single-file mode: filter to only the specified file
|
|
1398
|
+
if (CONFIG.singleFile) {
|
|
1399
|
+
files = files.filter(([filePath]) => filePath === CONFIG.singleFile);
|
|
1400
|
+
if (files.length === 0) {
|
|
1401
|
+
console.log(`\nSingle-file mode: No errors found in ${CONFIG.singleFile}`);
|
|
1402
|
+
console.log('File may have already been fixed or has no compilation errors.');
|
|
1403
|
+
break;
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1384
1406
|
|
|
1385
1407
|
for (const [filePath, errors] of files) {
|
|
1386
1408
|
const fullPath = path.join(CONFIG.projectPath, filePath);
|
|
@@ -33,6 +33,10 @@ import {
|
|
|
33
33
|
|
|
34
34
|
// ============== CONFIGURATION ==============
|
|
35
35
|
|
|
36
|
+
// Parse --file and --agent-id parameters
|
|
37
|
+
const fileArg = process.argv.find(arg => arg.startsWith('--file='));
|
|
38
|
+
const agentIdArg = process.argv.find(arg => arg.startsWith('--agent-id='));
|
|
39
|
+
|
|
36
40
|
const CONFIG = {
|
|
37
41
|
maxGlobalIterations: 5,
|
|
38
42
|
maxFileRetries: 2,
|
|
@@ -47,6 +51,8 @@ const CONFIG = {
|
|
|
47
51
|
verbose: process.argv.includes('--verbose'),
|
|
48
52
|
includeTypes: process.argv.includes('--types') ? ['ts', 'tsx'] : ['ts', 'tsx'],
|
|
49
53
|
excludePattern: process.env.TS_EXCLUDE_PATTERN || 'node_modules|dist|build|\\.git',
|
|
54
|
+
singleFile: fileArg ? fileArg.split('=')[1] : null, // Single-file mode
|
|
55
|
+
agentId: agentIdArg ? agentIdArg.split('=')[1] : null, // Agent ID for coordination mode
|
|
50
56
|
// Security limits
|
|
51
57
|
maxFileSize: 1024 * 1024, // 1MB
|
|
52
58
|
maxLineLength: 1000,
|
|
@@ -867,6 +873,13 @@ async function main() {
|
|
|
867
873
|
console.log(` Model: ${CONFIG.model}`);
|
|
868
874
|
console.log(` Dry run: ${CONFIG.dryRun}`);
|
|
869
875
|
|
|
876
|
+
if (CONFIG.singleFile) {
|
|
877
|
+
console.log(` Single-File Mode: ${CONFIG.singleFile}`);
|
|
878
|
+
if (CONFIG.agentId) {
|
|
879
|
+
console.log(` Agent ID: ${CONFIG.agentId}`);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
|
|
870
883
|
if (CONFIG.dryRun) {
|
|
871
884
|
console.log(` Patch dir: ${CONFIG.patchDir}`);
|
|
872
885
|
}
|
|
@@ -900,6 +913,30 @@ async function main() {
|
|
|
900
913
|
errorsByFile.get(error.file)!.push(error);
|
|
901
914
|
}
|
|
902
915
|
|
|
916
|
+
// Single-file mode: filter to only the specified file
|
|
917
|
+
if (CONFIG.singleFile) {
|
|
918
|
+
const normalizedPath = path.normalize(CONFIG.singleFile);
|
|
919
|
+
const matchingFiles = Array.from(errorsByFile.keys()).filter(f =>
|
|
920
|
+
f === normalizedPath || f.endsWith(normalizedPath) || normalizedPath.endsWith(f)
|
|
921
|
+
);
|
|
922
|
+
|
|
923
|
+
if (matchingFiles.length === 0) {
|
|
924
|
+
console.log(`\n✅ Single-file mode: No errors found in ${CONFIG.singleFile}`);
|
|
925
|
+
console.log(' File may have already been fixed or has no compilation errors.');
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
// Keep only the matching file
|
|
930
|
+
const singleFileErrors = new Map<string, TypeScriptError[]>();
|
|
931
|
+
for (const file of matchingFiles) {
|
|
932
|
+
singleFileErrors.set(file, errorsByFile.get(file)!);
|
|
933
|
+
}
|
|
934
|
+
errorsByFile.clear();
|
|
935
|
+
for (const [k, v] of singleFileErrors) {
|
|
936
|
+
errorsByFile.set(k, v);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
|
|
903
940
|
console.log(` Across ${errorsByFile.size} files\n`);
|
|
904
941
|
|
|
905
942
|
// Process errors
|
|
@@ -922,7 +922,9 @@ if (ext === '.rs') {
|
|
|
922
922
|
});
|
|
923
923
|
}
|
|
924
924
|
|
|
925
|
+
// Merge with Phase 1.5 results - don't overwrite passed/severity from cargo check
|
|
925
926
|
results.rust = {
|
|
927
|
+
...results.rust, // Preserve Phase 1.5 cargo check results (passed, severity, errors)
|
|
926
928
|
available: cargoAvailable,
|
|
927
929
|
clippy: null,
|
|
928
930
|
rustfmt: null
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow-novice",
|
|
3
|
-
"version": "2.18.
|
|
3
|
+
"version": "2.18.29",
|
|
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",
|