claude-flow-novice 2.18.35 → 2.18.37
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 +146 -333
- package/package.json +1 -1
|
@@ -6,423 +6,236 @@ allowed-tools: ["Task", "TaskOutput", "TodoWrite", "Read", "Bash"]
|
|
|
6
6
|
|
|
7
7
|
# CFN Fix Errors - Agent Coordination Mode
|
|
8
8
|
|
|
9
|
-
**Version:**
|
|
10
|
-
|
|
11
|
-
## Quick Overview
|
|
12
|
-
|
|
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
|
|
17
|
-
|
|
18
|
-
### Key Features
|
|
19
|
-
- **Phase 0 strategic fixes** - identify and fix root-cause files first
|
|
20
|
-
- **Max 5 parallel agents** with continuous spawning in Phase 1
|
|
21
|
-
- **Single-file focus** - each agent fixes one file only
|
|
22
|
-
- **Post-edit validation** confirms fixes are correct
|
|
23
|
-
- **Agents solve independently** - no external tools, just expertise
|
|
24
|
-
- **Automatic Phase 2** transition at <40 errors
|
|
25
|
-
|
|
26
|
-
### When to Use
|
|
27
|
-
- 20+ compilation errors
|
|
28
|
-
- Errors may have cascading dependencies
|
|
29
|
-
- Want visibility into agent progress
|
|
30
|
-
- Need systematic error reduction
|
|
9
|
+
**Version:** 3.1.0 | **Date:** 2025-12-21 | **Status:** Production Ready
|
|
31
10
|
|
|
32
11
|
---
|
|
33
12
|
|
|
34
|
-
##
|
|
35
|
-
|
|
36
|
-
### Step 1: Parse Arguments and Initialize
|
|
13
|
+
## QUICK REFERENCE
|
|
37
14
|
|
|
38
|
-
|
|
15
|
+
### Get Errors (with caching for speed)
|
|
39
16
|
|
|
17
|
+
**TypeScript (tsc) - use incremental:**
|
|
40
18
|
```bash
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
# Parse optional flags (use defaults if not provided)
|
|
45
|
-
MAX_PARALLEL=5
|
|
46
|
-
MAX_CYCLES=10
|
|
47
|
-
|
|
48
|
-
# Generate unique session ID
|
|
49
|
-
SESSION_ID="cfn-fix-$(date +%s | tail -c 6)-${RANDOM}"
|
|
50
|
-
echo "Session ID: $SESSION_ID | Language: $LANGUAGE | Max Parallel: $MAX_PARALLEL"
|
|
19
|
+
npm run typecheck 2>&1 | tee /tmp/tsc-errors.txt
|
|
20
|
+
# Ensure tsconfig.json has: "incremental": true, "tsBuildInfoFile": ".tsbuildinfo"
|
|
51
21
|
```
|
|
52
22
|
|
|
53
|
-
**
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
### Step 2: Get Error Files and Analyze
|
|
58
|
-
|
|
59
|
-
**YOU SHOULD:** Run the appropriate type checker and get files with errors.
|
|
60
|
-
|
|
61
|
-
**For Rust:**
|
|
23
|
+
**TypeScript (ESLint) - use cache:**
|
|
62
24
|
```bash
|
|
63
|
-
|
|
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
|
|
25
|
+
npx eslint . --ext .ts,.tsx --cache --cache-location /tmp/.eslintcache 2>&1 | tee /tmp/eslint-errors.txt
|
|
66
26
|
```
|
|
67
27
|
|
|
68
|
-
**
|
|
28
|
+
**Rust (incremental by default):**
|
|
69
29
|
```bash
|
|
70
|
-
|
|
71
|
-
npm run typecheck 2>&1 | tee /tmp/tsc-errors.txt | grep "error TS" | awk -F'(' '{print $1}' | sort | uniq -c | sort -rn
|
|
30
|
+
SQLX_OFFLINE=true cargo check 2>&1 | tee /tmp/cargo-errors.txt
|
|
72
31
|
```
|
|
73
32
|
|
|
74
|
-
|
|
33
|
+
### Find Files with Most Errors
|
|
34
|
+
|
|
35
|
+
**TypeScript (tsc):**
|
|
75
36
|
```bash
|
|
76
|
-
|
|
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
|
|
37
|
+
grep "error TS" /tmp/tsc-errors.txt | awk -F'(' '{print $1}' | sort | uniq -c | sort -rn | head -20
|
|
79
38
|
```
|
|
80
39
|
|
|
81
|
-
**
|
|
40
|
+
**TypeScript (ESLint):**
|
|
82
41
|
```bash
|
|
83
|
-
|
|
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
|
|
42
|
+
grep -B1 "error" /tmp/eslint-errors.txt | grep "\.tsx\?$" | sort | uniq -c | sort -rn | head -20
|
|
104
43
|
```
|
|
105
44
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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:**
|
|
45
|
+
**Rust:**
|
|
46
|
+
```bash
|
|
47
|
+
grep "^\s*-->" /tmp/cargo-errors.txt | awk '{print $2}' | awk -F':' '{print $1}' | sort | uniq -c | sort -rn | head -20
|
|
137
48
|
```
|
|
138
|
-
ERROR ANALYSIS:
|
|
139
|
-
- 15 files have "Cannot find module './types/api'"
|
|
140
|
-
→ Fix: src/types/api.ts FIRST (root cause)
|
|
141
49
|
|
|
142
|
-
|
|
143
|
-
→ Fix: src/models/user.ts FIRST (type definition issue)
|
|
50
|
+
Output: files sorted by error count (fix highest counts first)
|
|
144
51
|
|
|
145
|
-
-
|
|
146
|
-
→ Fix: src/utils/index.ts FIRST (cascading imports)
|
|
52
|
+
### Three-Phase Execution
|
|
147
53
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
54
|
+
| Phase | Files | Mode | Rule |
|
|
55
|
+
|-------|-------|------|------|
|
|
56
|
+
| 0 | Strategic root-causes | Sequential | `run_in_background: false` |
|
|
57
|
+
| 1 | Remaining files | Up to 5 parallel | `run_in_background: true` |
|
|
58
|
+
| 2 | Cross-file errors | Sequential | `run_in_background: false` |
|
|
153
59
|
|
|
154
|
-
|
|
60
|
+
**Triggers:** Phase 0 completes → Phase 1 spawns → <40 errors remain → Phase 2 spawns
|
|
155
61
|
|
|
156
|
-
###
|
|
62
|
+
### Critical Rules
|
|
157
63
|
|
|
158
|
-
**
|
|
64
|
+
- **Background ONLY for Phase 1:** Agents restart chat when done. Spawn next immediately.
|
|
65
|
+
- **Single file per agent:** Each agent fixes one file, validates, then exits.
|
|
66
|
+
- **Commits via background agent:** Spawn commit agent every 20 files / after each phase.
|
|
67
|
+
- **Refresh errors at 15 files:** After 15 fixes, spawn background agent to re-run error gathering.
|
|
68
|
+
- **No full checks:** Agents forbidden: `eslint .` `cargo check` `npm run lint` `npm run typecheck` (full project)
|
|
69
|
+
- **Report facts only:** Files fixed, errors remaining. No CFN effectiveness commentary.
|
|
159
70
|
|
|
160
|
-
|
|
71
|
+
### Spawn Templates
|
|
161
72
|
|
|
162
|
-
|
|
73
|
+
**Phase 0 & 2 (blocking):**
|
|
163
74
|
```typescript
|
|
164
|
-
Task("
|
|
75
|
+
Task("typescript-specialist" /* or "rust-developer" */,
|
|
165
76
|
`Fix errors in: [FILE_PATH]
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|
|
77
|
+
PROJECT: [ROOT]
|
|
78
|
+
Read errors from /tmp/[errors].txt
|
|
79
|
+
Context: Phase [0|2] strategic work.
|
|
80
|
+
Report: fixes made, remaining errors.`,
|
|
81
|
+
{run_in_background: false}
|
|
186
82
|
);
|
|
187
83
|
```
|
|
188
84
|
|
|
189
|
-
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
85
|
+
**Phase 1 (background):**
|
|
86
|
+
```typescript
|
|
87
|
+
Task("typescript-specialist" /* or "rust-developer" */,
|
|
88
|
+
`Fix errors in: [FILE_PATH]
|
|
89
|
+
PROJECT: [ROOT]
|
|
90
|
+
Read errors from /tmp/[errors].txt
|
|
91
|
+
Validate: .claude/hooks/cfn-invoke-post-edit.sh [FILE_PATH] --agent-id [ID]
|
|
92
|
+
Report: SUMMARY, FIXES APPLIED, ERRORS FIXED, VALIDATION, REMAINING ERRORS.`,
|
|
93
|
+
{run_in_background: true}
|
|
94
|
+
);
|
|
195
95
|
```
|
|
196
96
|
|
|
197
|
-
3. **Update file queue** - remove files that no longer have errors
|
|
198
|
-
|
|
199
|
-
**PHASE 0 COMPLETE when:** All strategic files are fixed.
|
|
200
|
-
|
|
201
97
|
---
|
|
202
98
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
**YOU SHOULD:** Spawn agents continuously, maintaining exactly 5 active agents at any time.
|
|
99
|
+
## Setup
|
|
206
100
|
|
|
207
|
-
|
|
101
|
+
### Parse Arguments
|
|
208
102
|
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
while (activeAgents.length < MAX_PARALLEL && fileQueue.length > 0) {
|
|
215
|
-
const file = fileQueue.shift();
|
|
216
|
-
const agentId = `${LANGUAGE}-fixer-${SESSION_ID}-${sanitize(file)}`;
|
|
217
|
-
|
|
218
|
-
// Use Task tool with background=true
|
|
219
|
-
const taskId = Task("rust-developer" OR "typescript-specialist",
|
|
220
|
-
`[SEE AGENT PROMPT BELOW]`,
|
|
221
|
-
{run_in_background: true}
|
|
222
|
-
);
|
|
223
|
-
|
|
224
|
-
// Track this agent
|
|
225
|
-
activeAgents.push({file, agentId, taskId, attempts: 1});
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// Monitor agents (non-blocking check)
|
|
229
|
-
for (const agent of activeAgents) {
|
|
230
|
-
const result = TaskOutput(agent.taskId, {block: false, timeout: 0});
|
|
231
|
-
|
|
232
|
-
if (result.status === "completed") {
|
|
233
|
-
if (result.success) {
|
|
234
|
-
markFileComplete(agent.file);
|
|
235
|
-
} else if (agent.attempts < 2) {
|
|
236
|
-
// Retry once
|
|
237
|
-
agent.attempts++;
|
|
238
|
-
requeue(agent.file);
|
|
239
|
-
} else {
|
|
240
|
-
// Defer to Phase 2
|
|
241
|
-
markFileDeferred(agent.file);
|
|
242
|
-
}
|
|
243
|
-
removeFromActive(agent);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// Brief pause before next check
|
|
248
|
-
sleep(2000);
|
|
249
|
-
}
|
|
103
|
+
```bash
|
|
104
|
+
LANGUAGE="${1:-typescript}" # typescript|rust
|
|
105
|
+
MAX_PARALLEL="${2:-5}"
|
|
106
|
+
MAX_CYCLES="${3:-10}"
|
|
107
|
+
SESSION_ID="cfn-fix-$(date +%s | tail -c 6)-${RANDOM}"
|
|
250
108
|
```
|
|
251
109
|
|
|
110
|
+
Validate: language ∈ {rust, typescript, ts}
|
|
111
|
+
|
|
252
112
|
---
|
|
253
113
|
|
|
254
|
-
|
|
114
|
+
## Phase 0: Identify Root-Cause Files
|
|
255
115
|
|
|
256
|
-
|
|
116
|
+
Analyze errors to find files that block others:
|
|
257
117
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
AGENT_ID: [GENERATED_AGENT_ID]
|
|
264
|
-
|
|
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
|
|
270
|
-
|
|
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/checkers on the entire codebase:
|
|
281
|
-
- `eslint .` is FORBIDDEN
|
|
282
|
-
- `cargo check` (full project) is FORBIDDEN
|
|
283
|
-
- `npm run lint` (full project) is FORBIDDEN
|
|
284
|
-
- `npm run typecheck` (full project) is FORBIDDEN
|
|
285
|
-
- Use errors from /tmp/ output files - do NOT regenerate them
|
|
286
|
-
- Do NOT add unnecessary dependencies
|
|
287
|
-
- Preserve existing functionality
|
|
288
|
-
- Keep fixes minimal and targeted
|
|
289
|
-
|
|
290
|
-
COMMON FIX PATTERNS:
|
|
291
|
-
- Missing imports: Add the import statement
|
|
292
|
-
- Type errors: Add proper type annotations
|
|
293
|
-
- Unused variables: Prefix with _ or remove if truly unused
|
|
294
|
-
- Missing exports: Add export keyword
|
|
295
|
-
- Null checks: Add optional chaining or null guards
|
|
296
|
-
|
|
297
|
-
REPORT FORMAT:
|
|
298
|
-
```
|
|
299
|
-
SUMMARY: [2 sentence summary of what was fixed and outcome]
|
|
118
|
+
**Priority indicators:**
|
|
119
|
+
1. **Type definitions:** `*.d.ts`, `types.ts`, `types/*.ts`, `interfaces.ts`, `models.ts`
|
|
120
|
+
2. **Core modules:** `index.ts` with re-exports, imported by 5+ error files
|
|
121
|
+
3. **Config files:** `config.ts`, `constants.ts`
|
|
122
|
+
4. **Error patterns:** "Cannot find module './X'" (fix X first) / "Type 'X' not assignable" (fix definition) / "Property missing on type 'Y'" (fix Y)
|
|
300
123
|
|
|
301
|
-
|
|
302
|
-
- Line X: [description of fix]
|
|
303
|
-
- Line Y: [description of fix]
|
|
124
|
+
**Build Phase 0 queue** (3-8 files, in dependency order):
|
|
304
125
|
|
|
305
|
-
ROUNDS: [number of fix iterations attempted]
|
|
306
|
-
ERRORS FIXED: [count of errors resolved in this file]
|
|
307
|
-
VALIDATION: [PASS/FAIL]
|
|
308
|
-
POST-EDIT RESPONSE: [final output from post-edit pipeline]
|
|
309
|
-
REMAINING ERRORS: [count or "none"]
|
|
310
126
|
```
|
|
127
|
+
- src/types/api.ts (15 files blocked by this)
|
|
128
|
+
- src/models/user.ts (8 files blocked)
|
|
129
|
+
- src/utils/index.ts (12 files blocked)
|
|
311
130
|
```
|
|
312
131
|
|
|
132
|
+
### Execute Phase 0
|
|
133
|
+
|
|
134
|
+
For each file:
|
|
135
|
+
1. Spawn agent (blocking mode)
|
|
136
|
+
2. Agent reads file, checks `/tmp/[errors].txt`, fixes ALL errors in file
|
|
137
|
+
3. Agent runs: `.claude/hooks/cfn-invoke-post-edit.sh [FILE_PATH]`
|
|
138
|
+
4. Recheck total error count to see cascading improvements
|
|
139
|
+
5. Remove from queue if no more errors
|
|
140
|
+
|
|
141
|
+
**Commit after Phase 0 completes.**
|
|
142
|
+
|
|
313
143
|
---
|
|
314
144
|
|
|
315
|
-
|
|
145
|
+
## Phase 1: Parallel Fixes
|
|
146
|
+
|
|
147
|
+
Spawn continuous waves (max 5 concurrent):
|
|
148
|
+
1. Spawn agent with background mode
|
|
149
|
+
2. Agent fixes [FILE_PATH], validates, exits → chat restarts
|
|
150
|
+
3. Check which agent finished, spawn next file immediately
|
|
151
|
+
4. Continue until file queue empty
|
|
316
152
|
|
|
317
|
-
**
|
|
153
|
+
**Continuous Error Tracking (no full recheck needed):**
|
|
318
154
|
|
|
319
|
-
|
|
155
|
+
Each agent's post-edit hook updates `/tmp/error-tracker.json`:
|
|
320
156
|
```bash
|
|
321
|
-
#
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
157
|
+
# Post-edit hook appends per-file error count
|
|
158
|
+
# Query anytime: jq '.totalErrors' /tmp/error-tracker.json
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**Background tasks during Phase 1:**
|
|
162
|
+
```
|
|
163
|
+
Every 5 files → Query error tracker (instant, no recheck):
|
|
164
|
+
ERRORS=$(jq '.totalErrors' /tmp/error-tracker.json)
|
|
165
|
+
|
|
166
|
+
At 15 files → Spawn background agent for incremental recheck (uses cache, ~5-10s):
|
|
167
|
+
Task("general-purpose",
|
|
168
|
+
`Run incremental typecheck (cached): npm run typecheck 2>&1 > /tmp/tsc-errors-refresh.txt
|
|
169
|
+
Update /tmp/error-tracker.json with actual count
|
|
170
|
+
Report: synced error count`,
|
|
171
|
+
{run_in_background: true});
|
|
172
|
+
|
|
173
|
+
At 20 files → Spawn background commit agent:
|
|
174
|
+
Task("general-purpose",
|
|
175
|
+
`Run: git add -A && git commit -m "fix: batch of 20 error fixes"
|
|
176
|
+
Report: commit hash`,
|
|
177
|
+
{run_in_background: true});
|
|
325
178
|
```
|
|
326
179
|
|
|
327
|
-
**
|
|
328
|
-
-
|
|
329
|
-
-
|
|
330
|
-
-
|
|
331
|
-
- Remaining errors require cross-file coordination
|
|
180
|
+
**Benefits of incremental + cache:**
|
|
181
|
+
- First full check: 30-60s
|
|
182
|
+
- Cached incremental check (15 files changed): 5-10s (80%+ faster)
|
|
183
|
+
- Error tracker query: <0.1s (instant)
|
|
332
184
|
|
|
333
185
|
---
|
|
334
186
|
|
|
335
|
-
|
|
187
|
+
## Phase 2: Cross-File Cleanup
|
|
336
188
|
|
|
337
|
-
|
|
189
|
+
Trigger when: error count <40 OR 3 cycles no improvement OR all files attempted twice
|
|
338
190
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
PROJECT: [PROJECT_ROOT]
|
|
344
|
-
REMAINING_ERRORS: [error count]
|
|
345
|
-
DEFERRED_FILES: [list of files that couldn't be fixed in Phase 1]
|
|
346
|
-
|
|
347
|
-
CONTEXT:
|
|
348
|
-
Phase 0 fixed strategic root-cause files.
|
|
349
|
-
Phase 1 fixed [X] files with single-file errors.
|
|
350
|
-
Now fix remaining errors that require cross-file understanding.
|
|
351
|
-
|
|
352
|
-
YOUR TASK:
|
|
353
|
-
1. Run full type check to get current errors
|
|
354
|
-
2. Analyze error patterns across files
|
|
355
|
-
3. Fix errors that span multiple files
|
|
356
|
-
4. Ensure type consistency across modules
|
|
357
|
-
|
|
358
|
-
APPROACH:
|
|
359
|
-
- Group related errors by type/module
|
|
360
|
-
- Fix shared types/interfaces first
|
|
361
|
-
- Then fix usage sites
|
|
362
|
-
- Run validation after each group of fixes
|
|
363
|
-
|
|
364
|
-
REPORT: Summary of remaining errors and fixes applied.`,
|
|
365
|
-
{run_in_background: false}
|
|
366
|
-
);
|
|
367
|
-
```
|
|
191
|
+
1. Spawn single cleanup agent (blocking mode)
|
|
192
|
+
2. Agent analyzes remaining errors across files
|
|
193
|
+
3. Groups errors by type/module, fixes shared types first, then usage sites
|
|
194
|
+
4. Commit after completion
|
|
368
195
|
|
|
369
196
|
---
|
|
370
197
|
|
|
371
|
-
## State
|
|
198
|
+
## State Tracking (Optional)
|
|
372
199
|
|
|
373
|
-
|
|
200
|
+
Maintain `/tmp/phase-state.json`:
|
|
374
201
|
|
|
375
202
|
```json
|
|
376
203
|
{
|
|
377
|
-
"sessionId": "cfn-fix-123456
|
|
204
|
+
"sessionId": "cfn-fix-123456",
|
|
378
205
|
"language": "typescript",
|
|
379
|
-
"
|
|
206
|
+
"phase": "1",
|
|
380
207
|
"initialErrors": 150,
|
|
381
208
|
"currentErrors": 45,
|
|
382
|
-
"
|
|
383
|
-
"
|
|
384
|
-
{"file": "src/types/api.ts", "status": "completed", "dependents": 15}
|
|
385
|
-
],
|
|
386
|
-
"phase1Files": [
|
|
387
|
-
{"file": "src/api/handler.ts", "attempts": 1, "status": "in_progress", "agentId": "abc123"}
|
|
388
|
-
],
|
|
389
|
-
"deferredFiles": [],
|
|
390
|
-
"activeAgents": ["abc123", "def456"]
|
|
209
|
+
"phase0Files": [{"file": "src/types/api.ts", "status": "completed"}],
|
|
210
|
+
"activeAgents": ["abc123"]
|
|
391
211
|
}
|
|
392
212
|
```
|
|
393
213
|
|
|
394
214
|
---
|
|
395
215
|
|
|
396
|
-
##
|
|
397
|
-
|
|
398
|
-
| Phase | Purpose | Execution | Agent Count |
|
|
399
|
-
|-------|---------|-----------|-------------|
|
|
400
|
-
| 0 | Root-cause files | Sequential | 1 at a time |
|
|
401
|
-
| 1 | Parallel fixes | Continuous spawn | Up to 5 |
|
|
402
|
-
| 2 | Cross-file cleanup | Sequential | 1 dedicated |
|
|
403
|
-
|
|
404
|
-
**Agent Types:**
|
|
405
|
-
- Rust: `rust-developer`
|
|
406
|
-
- TypeScript: `typescript-specialist`
|
|
216
|
+
## Reference
|
|
407
217
|
|
|
408
|
-
**
|
|
218
|
+
**Post-edit validation:**
|
|
409
219
|
```bash
|
|
410
220
|
.claude/hooks/cfn-invoke-post-edit.sh [FILE] --agent-id [ID]
|
|
411
221
|
```
|
|
412
222
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
-
|
|
418
|
-
|
|
419
|
-
|
|
223
|
+
**Agent report format:**
|
|
224
|
+
```
|
|
225
|
+
SUMMARY: [2 sentences: what was fixed, outcome]
|
|
226
|
+
FIXES APPLIED: [count]
|
|
227
|
+
- Line X: [fix description]
|
|
228
|
+
ERRORS FIXED: [count]
|
|
229
|
+
VALIDATION: [PASS/FAIL]
|
|
230
|
+
REMAINING ERRORS: [count or "none"]
|
|
231
|
+
```
|
|
420
232
|
|
|
421
233
|
---
|
|
422
234
|
|
|
423
235
|
## Version History
|
|
424
|
-
|
|
425
|
-
-
|
|
426
|
-
-
|
|
427
|
-
-
|
|
428
|
-
-
|
|
236
|
+
- v3.1.0 (2025-12-21) - Continuous error tracking, incremental/cached builds, background commits
|
|
237
|
+
- v3.0.0 (2025-12-21) - Sparse rewrite: removed 200 lines, consolidated duplicates, moved quick reference to top
|
|
238
|
+
- v2.2.0 (2025-12-21) - Clarified background mode (Phase 1 only), no manual monitoring
|
|
239
|
+
- v2.1.0 (2025-12-21) - Added quick reference, commit every 20 files
|
|
240
|
+
- v2.0.0 (2025-12-21) - Added Phase 0 strategic root-cause files
|
|
241
|
+
- v1.0.0 (2025-12-21) - Initial implementation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow-novice",
|
|
3
|
-
"version": "2.18.
|
|
3
|
+
"version": "2.18.37",
|
|
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",
|