mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
- Created execution agent prompt for issue execution with detailed deliverables and validation criteria. - Developed planning agent prompt to analyze issues and generate structured solution plans. - Introduced issue handling specifications outlining the workflow and issue structure. - Established quality standards for evaluating completeness, consistency, correctness, and clarity of solutions. - Defined solution schema specification detailing the required structure and validation rules for solutions. - Documented subagent roles and responsibilities, emphasizing the dual-agent strategy for improved workflow efficiency.
87 lines
1.8 KiB
Markdown
87 lines
1.8 KiB
Markdown
# Action: Initialize
|
||
|
||
初始化 Skill 执行状态和工作目录。
|
||
|
||
## Purpose
|
||
|
||
设置初始状态,创建工作目录,准备执行环境。
|
||
|
||
## Preconditions
|
||
|
||
- [ ] `state.status === "pending"`
|
||
|
||
## Execution
|
||
|
||
```javascript
|
||
async function execute(state) {
|
||
// 创建工作目录
|
||
const timestamp = new Date().toISOString().slice(0,19).replace(/[-:T]/g, '');
|
||
const workDir = `.workflow/.scratchpad/codex-issue-${timestamp}`;
|
||
|
||
Bash(`mkdir -p "${workDir}/solutions" "${workDir}/snapshots"`);
|
||
|
||
// 初始化状态
|
||
const initialState = {
|
||
status: "running",
|
||
phase: "initialized",
|
||
work_dir: workDir,
|
||
issues: {},
|
||
queue: [],
|
||
completed_actions: ["action-init"],
|
||
context: {
|
||
total_issues: 0,
|
||
completed_count: 0,
|
||
failed_count: 0
|
||
},
|
||
errors: [],
|
||
created_at: new Date().toISOString(),
|
||
updated_at: new Date().toISOString()
|
||
};
|
||
|
||
// 保存初始状态
|
||
Write(`${workDir}/state.json`, JSON.stringify(initialState, null, 2));
|
||
Write(`${workDir}/state-history.json`, JSON.stringify([{
|
||
timestamp: initialState.created_at,
|
||
phase: "init",
|
||
completed_actions: 1,
|
||
issues_count: 0
|
||
}], null, 2));
|
||
|
||
console.log(`✓ Initialized: ${workDir}`);
|
||
|
||
return {
|
||
stateUpdates: {
|
||
status: "running",
|
||
phase: "initialized",
|
||
work_dir: workDir,
|
||
completed_actions: ["action-init"]
|
||
}
|
||
};
|
||
}
|
||
```
|
||
|
||
## State Updates
|
||
|
||
```javascript
|
||
return {
|
||
stateUpdates: {
|
||
status: "running",
|
||
phase: "initialized",
|
||
work_dir: workDir,
|
||
completed_actions: ["action-init"]
|
||
}
|
||
};
|
||
```
|
||
|
||
## Error Handling
|
||
|
||
| Error Type | Recovery |
|
||
|------------|----------|
|
||
| 目录创建失败 | 检查权限,使用临时目录 |
|
||
| 文件写入失败 | 重试或切换存储位置 |
|
||
|
||
## Next Actions (Hints)
|
||
|
||
- 成功:进入 listing phase,执行 action-list
|
||
- 失败:中止工作流
|