mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-13 02:41:50 +08:00
- Implemented orchestrator logic to manage code review phases, including state reading, action selection, and execution loop. - Defined state schema for review process, including metadata, context, findings, and execution tracking. - Created action catalog detailing actions for context collection, quick scan, deep review, report generation, and completion. - Established error recovery strategies and termination conditions for robust review handling. - Developed issue classification and quality standards documentation to guide review severity and categorization. - Introduced review dimensions with detailed checklists for correctness, security, performance, readability, testing, and architecture. - Added templates for issue reporting and review reports to standardize output and improve clarity.
116 lines
2.8 KiB
Markdown
116 lines
2.8 KiB
Markdown
# Action: Complete
|
|
|
|
完成审查,保存最终状态。
|
|
|
|
## Purpose
|
|
|
|
结束代码审查流程:
|
|
- 保存最终状态
|
|
- 输出审查摘要
|
|
- 提供报告路径
|
|
|
|
## Preconditions
|
|
|
|
- [ ] state.status === 'running'
|
|
- [ ] state.report_generated === true
|
|
|
|
## Execution
|
|
|
|
```javascript
|
|
async function execute(state, workDir) {
|
|
// 1. 计算审查时长
|
|
const duration = Date.now() - new Date(state.started_at).getTime();
|
|
const durationMinutes = Math.round(duration / 60000);
|
|
|
|
// 2. 生成最终摘要
|
|
const summary = {
|
|
...state.summary,
|
|
review_duration_ms: duration,
|
|
completed_at: new Date().toISOString()
|
|
};
|
|
|
|
// 3. 保存最终状态
|
|
const finalState = {
|
|
...state,
|
|
status: 'completed',
|
|
completed_at: summary.completed_at,
|
|
summary: summary
|
|
};
|
|
|
|
Write(`${workDir}/state.json`, JSON.stringify(finalState, null, 2));
|
|
|
|
// 4. 输出摘要信息
|
|
console.log('========================================');
|
|
console.log(' CODE REVIEW COMPLETED');
|
|
console.log('========================================');
|
|
console.log('');
|
|
console.log(`📁 审查目标: ${state.context.target_path}`);
|
|
console.log(`📄 文件数量: ${state.context.file_count}`);
|
|
console.log(`📝 代码行数: ${state.context.total_lines}`);
|
|
console.log('');
|
|
console.log('--- 问题统计 ---');
|
|
console.log(`🔴 Critical: ${summary.critical}`);
|
|
console.log(`🟠 High: ${summary.high}`);
|
|
console.log(`🟡 Medium: ${summary.medium}`);
|
|
console.log(`🔵 Low: ${summary.low}`);
|
|
console.log(`⚪ Info: ${summary.info}`);
|
|
console.log(`📊 Total: ${summary.total_issues}`);
|
|
console.log('');
|
|
console.log(`⏱️ 审查用时: ${durationMinutes} 分钟`);
|
|
console.log('');
|
|
console.log(`📋 报告位置: ${state.report_path}`);
|
|
console.log('========================================');
|
|
|
|
// 5. 返回状态更新
|
|
return {
|
|
stateUpdates: {
|
|
status: 'completed',
|
|
completed_at: summary.completed_at,
|
|
summary: summary
|
|
}
|
|
};
|
|
}
|
|
```
|
|
|
|
## State Updates
|
|
|
|
```javascript
|
|
return {
|
|
stateUpdates: {
|
|
status: 'completed',
|
|
completed_at: new Date().toISOString(),
|
|
summary: {
|
|
total_issues: state.summary.total_issues,
|
|
critical: state.summary.critical,
|
|
high: state.summary.high,
|
|
medium: state.summary.medium,
|
|
low: state.summary.low,
|
|
info: state.summary.info,
|
|
review_duration_ms: duration
|
|
}
|
|
}
|
|
};
|
|
```
|
|
|
|
## Output
|
|
|
|
- **Console**: 审查完成摘要
|
|
- **State**: 最终状态保存到 `state.json`
|
|
|
|
## Error Handling
|
|
|
|
| Error Type | Recovery |
|
|
|------------|----------|
|
|
| 状态保存失败 | 输出到控制台 |
|
|
|
|
## Next Actions
|
|
|
|
- 无(终止状态)
|
|
|
|
## Post-Completion
|
|
|
|
用户可以:
|
|
1. 查看完整报告: `cat ${workDir}/review-report.md`
|
|
2. 查看问题详情: `cat ${workDir}/findings/*.json`
|
|
3. 导出报告到其他位置
|