Skip to content

Commit e3a6c88

Browse files
author
catlog22
committed
refactor: 更新模块文档更新流程,简化任务描述并增强执行脚本的失败处理
1 parent eb9b10c commit e3a6c88

File tree

1 file changed

+41
-15
lines changed

1 file changed

+41
-15
lines changed

.claude/commands/memory/update-full.md

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -233,28 +233,54 @@ for (let layer of [3, 2, 1]) {
233233

234234
**Batch Worker Prompt Template**:
235235
```
236-
PURPOSE: Update CLAUDE.md for assigned modules with tool fallback and auto-strategy selection
236+
PURPOSE: Update CLAUDE.md for assigned modules with tool fallback
237237
238-
TASK: Update documentation for modules with auto-determined strategy based on directory depth.
238+
TASK: Update documentation for assigned modules using specified strategies.
239239
240240
MODULES:
241-
{{module_path_1}} (depth: {{depth_1}}, layer: {{layer_1}})
242-
{{module_path_2}} (depth: {{depth_2}}, layer: {{layer_2}})
241+
{{module_path_1}} (strategy: {{strategy_1}})
242+
{{module_path_2}} (strategy: {{strategy_2}})
243243
...
244244
245245
TOOLS (try in order): {{tool_1}}, {{tool_2}}, {{tool_3}}
246246
247-
EXECUTION:
248-
For each module:
249-
1. Auto-determine strategy: strategy = (depth >= 3) ? "multi-layer" : "single-layer"
250-
2. Try tools in order until success:
251-
bash(cd "{{module_path}}" && ~/.claude/scripts/update_module_claude.sh "${strategy}" "." "${tool}")
252-
253-
CONTEXT SELECTION (automatically handled by script):
254-
- multi-layer strategy (depth ≥3): @**/* (all files)
255-
- single-layer strategy (depth 0-2): @*/CLAUDE.md + current code files
247+
EXECUTION SCRIPT: ~/.claude/scripts/update_module_claude.sh
248+
- Accepts strategy parameter: multi-layer | single-layer
249+
- Tool execution via CLI wrapper (gemini/qwen/codex)
250+
251+
EXECUTION FLOW (for each module):
252+
1. Tool fallback loop (exit on first success):
253+
for tool in {{tool_1}} {{tool_2}} {{tool_3}}; do
254+
bash(cd "{{module_path}}" && ~/.claude/scripts/update_module_claude.sh "{{strategy}}" "." "${tool}")
255+
exit_code=$?
256+
257+
if [ $exit_code -eq 0 ]; then
258+
report "✅ {{module_path}} updated with $tool"
259+
break
260+
else
261+
report "⚠️ {{module_path}} failed with $tool, trying next..."
262+
continue
263+
fi
264+
done
265+
266+
2. Handle complete failure (all tools failed):
267+
if [ $exit_code -ne 0 ]; then
268+
report "❌ FAILED: {{module_path}} - all tools exhausted"
269+
# Continue to next module (do not abort batch)
270+
fi
271+
272+
FAILURE HANDLING:
273+
- Module-level isolation: One module's failure does not affect others
274+
- Exit code detection: Non-zero exit code triggers next tool
275+
- Exhaustion reporting: Log modules where all tools failed
276+
- Batch continuation: Always process remaining modules
277+
278+
REPORTING FORMAT:
279+
Per-module status:
280+
✅ path/to/module updated with {tool}
281+
⚠️ path/to/module failed with {tool}, trying next...
282+
❌ FAILED: path/to/module - all tools exhausted
256283
```
257-
258284
### Phase 4: Safety Verification
259285

260286
```bash
@@ -300,4 +326,4 @@ Update Summary:
300326
- **Resilience**: 3-tier tool fallback per module
301327
- **Performance**: Parallel batches, no concurrency limits
302328
- **Observability**: Per-module tool usage, batch-level metrics
303-
- **Automation**: Zero configuration - strategy auto-selected by directory depth
329+
- **Automation**: Zero configuration - strategy auto-selected by directory depth

0 commit comments

Comments
 (0)