Skip to content

Commit 54c3234

Browse files
author
catlog22
committed
fix: 为所有 skill 的 .workflow/ 路径添加 projectRoot 前缀
从子目录执行 skill 时,相对路径 .workflow/ 会导致产物落到错误位置。 通过 git rev-parse --show-toplevel || pwd 检测项目根目录, 所有 .workflow/ 路径引用统一加上 {projectRoot} 前缀确保路径正确。 涉及 72 个文件,覆盖 20+ 个 skill。
1 parent 71faaf4 commit 54c3234

72 files changed

Lines changed: 904 additions & 482 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
# Analyze Quick Execute
2+
3+
> **Trigger**: User selects "Quick Execute" after Phase 4 completion
4+
> **Prerequisites**: `conclusions.json` + `explorations.json`/`perspectives.json` already exist
5+
> **Core Principle**: No additional agent exploration - analysis phase has already gathered sufficient context
6+
7+
## Execution Flow
8+
9+
```
10+
conclusions.json → quick-plan.json → User Confirmation → Serial Execution → execution-log.md
11+
```
12+
13+
---
14+
15+
## Step 1: Generate quick-plan.json
16+
17+
Convert `conclusions.json` recommendations directly into executable tasks.
18+
19+
**Conversion Logic**:
20+
```javascript
21+
const quickPlan = {
22+
session_id: sessionId,
23+
source: "analysis",
24+
source_file: `${sessionFolder}/conclusions.json`,
25+
generated_at: new Date().toISOString(),
26+
27+
tasks: conclusions.recommendations.map((rec, index) => ({
28+
id: `TASK-${String(index + 1).padStart(3, '0')}`,
29+
title: rec.action,
30+
description: rec.rationale,
31+
priority: rec.priority, // high/medium/low
32+
status: "pending",
33+
files_to_modify: extractFilesFromEvidence(rec, explorations),
34+
depends_on: [], // Serial execution - no dependencies needed
35+
context: {
36+
source_conclusions: conclusions.key_conclusions,
37+
evidence: explorations.relevant_files || perspectives.aggregated_findings
38+
}
39+
})),
40+
41+
execution_mode: "serial",
42+
total_tasks: conclusions.recommendations.length
43+
}
44+
```
45+
46+
**File Extraction Logic**:
47+
- Parse evidence from `explorations.json` or `perspectives.json`
48+
- Match recommendation action keywords to relevant_files
49+
- If no specific files, use pattern matching from findings
50+
51+
**Output**: `${sessionFolder}/quick-plan.json`
52+
53+
---
54+
55+
## Step 2: User Confirmation
56+
57+
Present generated plan for user approval before execution.
58+
59+
**Confirmation Display**:
60+
- Total tasks to execute
61+
- Task list with IDs, titles, priorities
62+
- Files to be modified
63+
- Execution mode: Serial
64+
65+
**User Options** (ASK_USER - single select):
66+
67+
| Option | Action |
68+
|--------|--------|
69+
| **Start Execution** | Proceed with serial execution |
70+
| **Adjust Tasks** | Allow user to modify/remove tasks |
71+
| **Cancel** | Cancel execution, keep quick-plan.json |
72+
73+
**Adjustment Mode** (if selected):
74+
- Display task list with checkboxes
75+
- User can deselect tasks to skip
76+
- User can reorder priorities
77+
- Regenerate quick-plan.json with adjustments
78+
79+
---
80+
81+
## Step 3: Serial Task Execution
82+
83+
Execute tasks one by one without spawning subagents.
84+
85+
**IMPORTANT**: This phase does NOT use spawn_agent. Main process executes tasks directly via CLI.
86+
87+
**Execution Loop**:
88+
```
89+
For each task in quick-plan.tasks:
90+
├─ Update task status: "in_progress"
91+
├─ Execute via CLI (synchronous)
92+
├─ Record result to execution-log.md
93+
├─ Update task status: "completed" | "failed"
94+
└─ Continue to next task
95+
```
96+
97+
**CLI Execution Pattern**:
98+
```bash
99+
ccw cli -p "PURPOSE: Execute task from analysis
100+
TASK ID: ${task.id}
101+
TASK: ${task.title}
102+
DESCRIPTION: ${task.description}
103+
FILES: ${task.files_to_modify.join(', ')}
104+
CONTEXT: ${JSON.stringify(task.context)}
105+
MODE: write
106+
EXPECTED: Task completed, files modified as specified
107+
" --tool codex --mode write
108+
```
109+
110+
**Execution Behavior**:
111+
- One task at a time (serial, no parallel agents)
112+
- Wait for CLI completion before next task
113+
- Record result immediately after completion
114+
- Stop on critical failure (user can choose to continue)
115+
116+
---
117+
118+
## Step 4: Record Execution Log
119+
120+
Maintain `execution-log.md` as unified execution history.
121+
122+
**Output**: `${sessionFolder}/execution-log.md`
123+
124+
**execution-log.md Structure**:
125+
126+
```markdown
127+
# Execution Log
128+
129+
## Session Info
130+
- **Session ID**: ${sessionId}
131+
- **Plan Source**: quick-plan.json (from analysis)
132+
- **Started**: ${startTime}
133+
- **Mode**: Serial Execution
134+
135+
## Task Execution Timeline
136+
137+
### ${timestamp} - TASK-001: ${title}
138+
- **Status**: completed | failed
139+
- **Duration**: ${duration}s
140+
- **Files Modified**: ${files.join(', ')}
141+
- **Summary**: ${resultSummary}
142+
- **Notes**: ${issues or discoveries}
143+
144+
### ${timestamp} - TASK-002: ${title}
145+
...
146+
147+
## Execution Summary
148+
- **Total Tasks**: ${total}
149+
- **Completed**: ${completed}
150+
- **Failed**: ${failed}
151+
- **Success Rate**: ${rate}%
152+
- **Total Duration**: ${duration}
153+
```
154+
155+
**Log Entry Fields**:
156+
157+
| Field | Content |
158+
|-------|---------|
159+
| Timestamp | ISO format execution time |
160+
| Task ID | TASK-XXX identifier |
161+
| Title | Task title from plan |
162+
| Status | completed / failed |
163+
| Duration | Execution time in seconds |
164+
| Files Modified | List of changed files |
165+
| Summary | Brief result description |
166+
| Notes | Issues discovered or special conditions |
167+
168+
---
169+
170+
## Step 5: Update quick-plan.json
171+
172+
After each task, update plan with execution results.
173+
174+
**Task Status Updates**:
175+
```javascript
176+
task.status = "completed" | "failed"
177+
task.executed_at = timestamp
178+
task.duration = seconds
179+
task.result = {
180+
success: boolean,
181+
files_modified: string[],
182+
summary: string,
183+
error: string | null
184+
}
185+
```
186+
187+
---
188+
189+
## Step 6: Completion Summary
190+
191+
Present final execution results.
192+
193+
**Summary Display**:
194+
- Session ID and folder path
195+
- Execution statistics (completed/failed/total)
196+
- Success rate percentage
197+
- Failed tasks requiring attention (if any)
198+
- Link to execution-log.md for details
199+
200+
**Post-Execution Options** (ASK_USER - single select):
201+
202+
| Option | Action |
203+
|--------|--------|
204+
| **Retry Failed** | Re-execute only failed tasks |
205+
| **View Log** | Display execution-log.md content |
206+
| **Create Issue** | Create issue from failed tasks |
207+
| **Done** | End workflow |
208+
209+
**Retry Logic**:
210+
- Filter tasks with status: "failed"
211+
- Re-execute in original order
212+
- Append retry results to execution-log.md
213+
214+
---
215+
216+
## Output Structure
217+
218+
When Quick Execute is activated, session folder expands with:
219+
220+
```
221+
{projectRoot}/.workflow/.analysis/ANL-{slug}-{date}/
222+
├── ... # Phase 1-4 artifacts
223+
├── quick-plan.json # Executable task plan
224+
└── execution-log.md # Execution history
225+
```
226+
227+
---
228+
229+
## Error Handling
230+
231+
| Situation | Action | Recovery |
232+
|-----------|--------|----------|
233+
| Task execution fails | Record failure in execution-log.md, ask user | Retry, skip, or abort remaining tasks |
234+
| CLI timeout | Mark task as failed with timeout reason | User can retry or skip |
235+
| No recommendations in conclusions | Cannot generate quick-plan.json | Inform user, suggest using lite-plan instead |
236+
| File conflict during execution | Document in execution-log.md | Resolve manually or adjust task order |
237+
238+
---
239+
240+
## Success Criteria
241+
242+
- All tasks executed (or explicitly skipped)
243+
- `quick-plan.json` updated with final statuses
244+
- `execution-log.md` contains complete history
245+
- User informed of results and next steps

0 commit comments

Comments
 (0)