name: fix-rust-files-parallel
mode: mapreduce
setup:
- shell: |
echo '{
"files": [
{"path": "src/main.rs", "has_issues": true, "complexity": 15},
{"path": "src/lib.rs", "has_issues": false, "complexity": 8},
{"path": "src/cook/execution/mapreduce.rs", "has_issues": true, "complexity": 25},
{"path": "src/cook/workflow/executor.rs", "has_issues": true, "complexity": 20},
{"path": "README.md", "has_issues": false, "complexity": 0},
{"path": "Cargo.toml", "has_issues": false, "complexity": 0},
{"path": "src/analyze/context.rs", "has_issues": true, "complexity": 12},
{"path": "src/config/mod.rs", "has_issues": false, "complexity": 5},
{"path": "tests/integration_test.rs", "has_issues": true, "complexity": 10}
]
}' > file_issues.json
capture_output: false
map:
input: file_issues.json
json_path: "$.files[*]"
agent_template:
- claude: "/analyze-and-fix-file ${item.path} --complexity ${item.complexity}"
capture_output: true
timeout: 300
- shell: "cargo check --lib 2>&1 | grep -E '(error|warning)' | head -10 || echo 'No errors'"
capture_output: true
filter: "path matches '\\.rs$' && has_issues == true"
sort_by: "complexity DESC"
max_parallel: 4
reduce:
- shell: |
echo "=== Fixed Rust Files Summary ==="
echo "Total files processed: ${map.total}"
echo "Successfully fixed: ${map.successful}"
echo "Failed to fix: ${map.failed}"
# The regex filter should have excluded non-.rs files
echo ""
echo "Regex filter test: Only .rs files with issues should have been processed"
echo "================================"
capture_output: true
- shell: "cargo build --all-targets 2>&1 | tail -5"
capture_output: true
- shell: "cargo test --lib 2>&1 | grep 'test result'"
capture_output: true
- shell: "rm -f file_issues.json"
capture_output: false