mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-14 02:42:04 +08:00
refactor: 更新模块文档更新流程,简化任务描述并增强执行脚本的失败处理
This commit is contained in:
@@ -233,28 +233,54 @@ for (let layer of [3, 2, 1]) {
|
|||||||
|
|
||||||
**Batch Worker Prompt Template**:
|
**Batch Worker Prompt Template**:
|
||||||
```
|
```
|
||||||
PURPOSE: Update CLAUDE.md for assigned modules with tool fallback and auto-strategy selection
|
PURPOSE: Update CLAUDE.md for assigned modules with tool fallback
|
||||||
|
|
||||||
TASK: Update documentation for modules with auto-determined strategy based on directory depth.
|
TASK: Update documentation for assigned modules using specified strategies.
|
||||||
|
|
||||||
MODULES:
|
MODULES:
|
||||||
{{module_path_1}} (depth: {{depth_1}}, layer: {{layer_1}})
|
{{module_path_1}} (strategy: {{strategy_1}})
|
||||||
{{module_path_2}} (depth: {{depth_2}}, layer: {{layer_2}})
|
{{module_path_2}} (strategy: {{strategy_2}})
|
||||||
...
|
...
|
||||||
|
|
||||||
TOOLS (try in order): {{tool_1}}, {{tool_2}}, {{tool_3}}
|
TOOLS (try in order): {{tool_1}}, {{tool_2}}, {{tool_3}}
|
||||||
|
|
||||||
EXECUTION:
|
EXECUTION SCRIPT: ~/.claude/scripts/update_module_claude.sh
|
||||||
For each module:
|
- Accepts strategy parameter: multi-layer | single-layer
|
||||||
1. Auto-determine strategy: strategy = (depth >= 3) ? "multi-layer" : "single-layer"
|
- Tool execution via CLI wrapper (gemini/qwen/codex)
|
||||||
2. Try tools in order until success:
|
|
||||||
bash(cd "{{module_path}}" && ~/.claude/scripts/update_module_claude.sh "${strategy}" "." "${tool}")
|
|
||||||
|
|
||||||
CONTEXT SELECTION (automatically handled by script):
|
EXECUTION FLOW (for each module):
|
||||||
- multi-layer strategy (depth ≥3): @**/* (all files)
|
1. Tool fallback loop (exit on first success):
|
||||||
- single-layer strategy (depth 0-2): @*/CLAUDE.md + current code files
|
for tool in {{tool_1}} {{tool_2}} {{tool_3}}; do
|
||||||
|
bash(cd "{{module_path}}" && ~/.claude/scripts/update_module_claude.sh "{{strategy}}" "." "${tool}")
|
||||||
|
exit_code=$?
|
||||||
|
|
||||||
|
if [ $exit_code -eq 0 ]; then
|
||||||
|
report "✅ {{module_path}} updated with $tool"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
report "⚠️ {{module_path}} failed with $tool, trying next..."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
2. Handle complete failure (all tools failed):
|
||||||
|
if [ $exit_code -ne 0 ]; then
|
||||||
|
report "❌ FAILED: {{module_path}} - all tools exhausted"
|
||||||
|
# Continue to next module (do not abort batch)
|
||||||
|
fi
|
||||||
|
|
||||||
|
FAILURE HANDLING:
|
||||||
|
- Module-level isolation: One module's failure does not affect others
|
||||||
|
- Exit code detection: Non-zero exit code triggers next tool
|
||||||
|
- Exhaustion reporting: Log modules where all tools failed
|
||||||
|
- Batch continuation: Always process remaining modules
|
||||||
|
|
||||||
|
REPORTING FORMAT:
|
||||||
|
Per-module status:
|
||||||
|
✅ path/to/module updated with {tool}
|
||||||
|
⚠️ path/to/module failed with {tool}, trying next...
|
||||||
|
❌ FAILED: path/to/module - all tools exhausted
|
||||||
```
|
```
|
||||||
|
|
||||||
### Phase 4: Safety Verification
|
### Phase 4: Safety Verification
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
Reference in New Issue
Block a user