@e0ipso/ai-task-manager 1.36.1 → 1.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -21
- package/dist/cli.js +1 -32
- package/dist/cli.js.map +1 -1
- package/dist/conflict-detector.d.ts.map +1 -1
- package/dist/conflict-detector.js +0 -4
- package/dist/conflict-detector.js.map +1 -1
- package/dist/index.d.ts +3 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -245
- package/dist/index.js.map +1 -1
- package/dist/metadata.d.ts +9 -0
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +14 -0
- package/dist/metadata.js.map +1 -1
- package/dist/types.d.ts +18 -18
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +27 -58
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +93 -219
- package/dist/utils.js.map +1 -1
- package/package.json +4 -2
- package/templates/ai-task-manager/config/TASK_MANAGER.md +3 -3
- package/templates/ai-task-manager/config/hooks/PRE_PHASE.md +6 -26
- package/templates/ai-task-manager/config/hooks/PRE_TASK_ASSIGNMENT.md +6 -24
- package/templates/ai-task-manager/config/templates/PLAN_TEMPLATE.md +1 -1
- package/templates/{assistant → harness}/agents/plan-creator.md +2 -2
- package/templates/harness/skills/task-create-plan/SKILL.md +120 -0
- package/templates/harness/skills/task-create-plan/scripts/find-task-manager-root.cjs +116 -0
- package/templates/harness/skills/task-create-plan/scripts/get-next-plan-id.cjs +214 -0
- package/templates/harness/skills/task-execute-blueprint/SKILL.md +139 -0
- package/templates/harness/skills/task-execute-blueprint/scripts/create-feature-branch.cjs +376 -0
- package/templates/harness/skills/task-execute-blueprint/scripts/find-task-manager-root.cjs +116 -0
- package/templates/harness/skills/task-execute-blueprint/scripts/validate-plan-blueprint.cjs +375 -0
- package/templates/harness/skills/task-execute-task/SKILL.md +195 -0
- package/templates/harness/skills/task-execute-task/scripts/check-task-dependencies.cjs +437 -0
- package/templates/harness/skills/task-execute-task/scripts/find-task-manager-root.cjs +116 -0
- package/templates/harness/skills/task-execute-task/scripts/validate-plan-blueprint.cjs +375 -0
- package/templates/harness/skills/task-full-workflow/SKILL.md +378 -0
- package/templates/harness/skills/task-full-workflow/scripts/create-feature-branch.cjs +376 -0
- package/templates/harness/skills/task-full-workflow/scripts/find-task-manager-root.cjs +116 -0
- package/templates/harness/skills/task-full-workflow/scripts/get-next-plan-id.cjs +214 -0
- package/templates/harness/skills/task-full-workflow/scripts/get-next-task-id.cjs +312 -0
- package/templates/harness/skills/task-full-workflow/scripts/validate-plan-blueprint.cjs +375 -0
- package/templates/harness/skills/task-generate-tasks/SKILL.md +244 -0
- package/templates/harness/skills/task-generate-tasks/scripts/find-task-manager-root.cjs +116 -0
- package/templates/harness/skills/task-generate-tasks/scripts/get-next-task-id.cjs +312 -0
- package/templates/harness/skills/task-generate-tasks/scripts/validate-plan-blueprint.cjs +375 -0
- package/templates/harness/skills/task-refine-plan/SKILL.md +205 -0
- package/templates/harness/skills/task-refine-plan/scripts/find-task-manager-root.cjs +116 -0
- package/templates/harness/skills/task-refine-plan/scripts/validate-plan-blueprint.cjs +375 -0
- package/dist/exec.d.ts +0 -13
- package/dist/exec.d.ts.map +0 -1
- package/dist/exec.js +0 -261
- package/dist/exec.js.map +0 -1
- package/templates/ai-task-manager/config/scripts/check-task-dependencies.cjs +0 -240
- package/templates/ai-task-manager/config/scripts/compose-prompt.cjs +0 -234
- package/templates/ai-task-manager/config/scripts/create-feature-branch.cjs +0 -204
- package/templates/ai-task-manager/config/scripts/extract-task-skills.cjs +0 -84
- package/templates/ai-task-manager/config/scripts/find-root.cjs +0 -10
- package/templates/ai-task-manager/config/scripts/get-next-plan-id.cjs +0 -49
- package/templates/ai-task-manager/config/scripts/get-next-task-id.cjs +0 -81
- package/templates/ai-task-manager/config/scripts/shared-utils.cjs +0 -418
- package/templates/ai-task-manager/config/scripts/validate-plan-blueprint.cjs +0 -138
- package/templates/assistant/commands/tasks/create-plan-auto.md +0 -174
- package/templates/assistant/commands/tasks/create-plan.md +0 -175
- package/templates/assistant/commands/tasks/execute-blueprint.md +0 -233
- package/templates/assistant/commands/tasks/execute-task.md +0 -351
- package/templates/assistant/commands/tasks/fix-broken-tests.md +0 -44
- package/templates/assistant/commands/tasks/full-workflow.md +0 -849
- package/templates/assistant/commands/tasks/generate-tasks.md +0 -348
- package/templates/assistant/commands/tasks/refine-plan-auto.md +0 -172
- package/templates/assistant/commands/tasks/refine-plan.md +0 -163
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
argument-hint: "[planId]"
|
|
3
|
-
description: Execute the task in the plan.
|
|
4
|
-
---
|
|
5
|
-
# Task Execution
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
You are the coordinator responsible for executing all tasks defined in the execution blueprint of a plan document, so choose an appropriate sub-agent for this role. Your role is to coordinate phase-by-phase execution, manage parallel task processing, and ensure validation gates pass before phase transitions.
|
|
10
|
-
|
|
11
|
-
## Critical Rules
|
|
12
|
-
|
|
13
|
-
1. **Never skip validation gates** - Phase progression requires successful validation
|
|
14
|
-
2. **Maintain task isolation** - Parallel tasks must not interfere with each other
|
|
15
|
-
3. **Preserve dependency order** - Never execute a task before its dependencies
|
|
16
|
-
4. **Document everything** - All decisions, issues, and outcomes must be recorded in the "Execution Summary", under "Noteworthy Events"
|
|
17
|
-
5. **Fail safely** - Better to halt and request help than corrupt the execution state
|
|
18
|
-
|
|
19
|
-
## Input Requirements
|
|
20
|
-
- A plan document with an execution blueprint section. See /TASK_MANAGER.md to find the plan with ID $1
|
|
21
|
-
- Task files with frontmatter metadata (id, group, dependencies, status)
|
|
22
|
-
- Validation gates document: `/config/hooks/POST_PHASE.md`
|
|
23
|
-
|
|
24
|
-
### Input Error Handling
|
|
25
|
-
|
|
26
|
-
If the plan does not exist, stop immediately and show an error to the user.
|
|
27
|
-
|
|
28
|
-
**Note**: If tasks or the execution blueprint section are missing, they will be automatically generated before execution begins (see Task and Blueprint Validation below).
|
|
29
|
-
|
|
30
|
-
### Task and Blueprint Validation
|
|
31
|
-
|
|
32
|
-
Before proceeding with execution, validate that tasks exist and the execution blueprint has been generated. If either is missing, automatically invoke task generation.
|
|
33
|
-
|
|
34
|
-
**Validation Steps:**
|
|
35
|
-
|
|
36
|
-
First, discover the task manager root directory:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
if [ ! -f /tmp/find-ai-task-manager-root.js ]; then
|
|
40
|
-
cat << 'EOF' > /tmp/find-ai-task-manager-root.js
|
|
41
|
-
const fs = require('fs');
|
|
42
|
-
const path = require('path');
|
|
43
|
-
|
|
44
|
-
const findRoot = (currentDir) => {
|
|
45
|
-
const taskManagerPath = path.join(currentDir, '.ai/task-manager');
|
|
46
|
-
const metadataPath = path.join(taskManagerPath, '.init-metadata.json');
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
if (fs.existsSync(metadataPath) && JSON.parse(fs.readFileSync(metadataPath, 'utf8')).version) {
|
|
50
|
-
console.log(path.resolve(taskManagerPath));
|
|
51
|
-
process.exit(0);
|
|
52
|
-
}
|
|
53
|
-
} catch (e) {
|
|
54
|
-
// Continue searching
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const parentDir = path.dirname(currentDir);
|
|
58
|
-
if (parentDir.length < currentDir.length) {
|
|
59
|
-
findRoot(parentDir);
|
|
60
|
-
} else {
|
|
61
|
-
process.exit(1);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
findRoot(process.cwd());
|
|
66
|
-
EOF
|
|
67
|
-
fi
|
|
68
|
-
|
|
69
|
-
root=$(node /tmp/find-ai-task-manager-root.js)
|
|
70
|
-
|
|
71
|
-
if [ -z "$root" ]; then
|
|
72
|
-
echo "Error: Could not find task manager root directory (.ai/task-manager)"
|
|
73
|
-
exit 1
|
|
74
|
-
fi
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Then extract validation results:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
# Extract validation results directly from script
|
|
81
|
-
plan_file=$(node $root/config/scripts/validate-plan-blueprint.cjs $1 planFile)
|
|
82
|
-
plan_dir=$(node $root/config/scripts/validate-plan-blueprint.cjs $1 planDir)
|
|
83
|
-
task_count=$(node $root/config/scripts/validate-plan-blueprint.cjs $1 taskCount)
|
|
84
|
-
blueprint_exists=$(node $root/config/scripts/validate-plan-blueprint.cjs $1 blueprintExists)
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
4. **Automatic task generation**:
|
|
88
|
-
|
|
89
|
-
If either `$task_count` is 0 or `$blueprint_exists` is "no":
|
|
90
|
-
- Display notification to user: "⚠️ Tasks or execution blueprint not found. Generating tasks automatically..."
|
|
91
|
-
- Execute the embedded task generation process below
|
|
92
|
-
|
|
93
|
-
## Embedded Task Generation
|
|
94
|
-
|
|
95
|
-
Follow ALL instructions from `.*/**/generate-tasks.md` exactly for plan ID $1. It is important that you find and read the `generate-tasks.md` command first.
|
|
96
|
-
|
|
97
|
-
This includes:
|
|
98
|
-
- Reading and processing the plan document
|
|
99
|
-
- Applying task minimization principles (20-30% reduction target)
|
|
100
|
-
- Creating atomic tasks with 1-2 skills each
|
|
101
|
-
- Generating proper task files with frontmatter and body structure
|
|
102
|
-
- Running all validation checklists
|
|
103
|
-
- Executing the POST_TASK_GENERATION_ALL hook
|
|
104
|
-
|
|
105
|
-
## Resume Blueprint Execution
|
|
106
|
-
|
|
107
|
-
After task generation completes, continue with execution below.
|
|
108
|
-
|
|
109
|
-
Otherwise, if tasks exist, proceed directly to execution.
|
|
110
|
-
|
|
111
|
-
## Execution Process
|
|
112
|
-
|
|
113
|
-
Use your internal Todo task tool to track the execution of all phases, and the final update of the plan with the summary. Example:
|
|
114
|
-
|
|
115
|
-
- [ ] Create feature branch via `node $root/config/scripts/create-feature-branch.cjs $1`
|
|
116
|
-
- [ ] Validate or auto-generate tasks and execution blueprint if missing.
|
|
117
|
-
- [ ] Execute $root/.ai/task-manager/config/hooks/PRE_PHASE.md hook before Phase 1.
|
|
118
|
-
- [ ] Phase 1: Execute 1 task(s) in parallel.
|
|
119
|
-
- [ ] Execute $root/.ai/task-manager/config/hooks/POST_PHASE.md hook after Phase 1.
|
|
120
|
-
- [ ] Execute $root/.ai/task-manager/config/hooks/PRE_PHASE.md hook before Phase 2.
|
|
121
|
-
- [ ] Phase 2: Execute 3 task(s) in parallel.
|
|
122
|
-
- [ ] Execute $root/.ai/task-manager/config/hooks/POST_PHASE.md hook after Phase 2.
|
|
123
|
-
- [ ] Execute $root/.ai/task-manager/config/hooks/PRE_PHASE.md hook before Phase 3.
|
|
124
|
-
- [ ] Phase 3: Execute 1 task(s) in parallel.
|
|
125
|
-
- [ ] Execute $root/.ai/task-manager/config/hooks/POST_PHASE.md hook after Phase 3.
|
|
126
|
-
- [ ] Execute $root/.ai/task-manager/config/hooks/POST_EXECUTION.md hook after all phases complete.
|
|
127
|
-
- [ ] Update the Plan 7 with execution summary using $root/.ai/task-manager/config/hooks/EXECUTION_SUMMARY_TEMPLATE.md.
|
|
128
|
-
- [ ] Archive Plan 7.
|
|
129
|
-
|
|
130
|
-
### Phase Pre-Execution
|
|
131
|
-
|
|
132
|
-
Read and execute $root/.ai/task-manager/config/hooks/PRE_PHASE.md
|
|
133
|
-
|
|
134
|
-
### Phase Execution Workflow
|
|
135
|
-
|
|
136
|
-
1. **Phase Initialization**
|
|
137
|
-
- Identify current phase from the execution blueprint
|
|
138
|
-
- List all tasks scheduled for parallel execution in this phase
|
|
139
|
-
|
|
140
|
-
2. **Agent Selection and Task Assignment**
|
|
141
|
-
Read and execute $root/.ai/task-manager/config/hooks/PRE_TASK_ASSIGNMENT.md
|
|
142
|
-
|
|
143
|
-
3. **Parallel Execution**
|
|
144
|
-
- Deploy all selected agents simultaneously using your internal Task tool
|
|
145
|
-
- **Each agent MUST perform these steps in order:**
|
|
146
|
-
1. Read and execute `$root/.ai/task-manager/config/hooks/PRE_TASK_EXECUTION.md` before starting any implementation work
|
|
147
|
-
2. Execute the task according to its requirements
|
|
148
|
-
- Monitor execution progress for each task
|
|
149
|
-
- Capture outputs and artifacts from each agent
|
|
150
|
-
- Update task status in real-time
|
|
151
|
-
|
|
152
|
-
4. **Phase Completion Verification**
|
|
153
|
-
- Ensure all tasks in the phase have status: "completed"
|
|
154
|
-
- Collect and review all task outputs
|
|
155
|
-
- Document any issues or exceptions encountered
|
|
156
|
-
|
|
157
|
-
### Phase Post-Execution
|
|
158
|
-
|
|
159
|
-
Read and execute $root/.ai/task-manager/config/hooks/POST_PHASE.md
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
### Phase Transition
|
|
163
|
-
|
|
164
|
-
- Update phase status to "completed" in the Blueprint section of the plan $1 document.
|
|
165
|
-
- Initialize next phase
|
|
166
|
-
- Repeat process until all phases are complete
|
|
167
|
-
|
|
168
|
-
### Error Handling
|
|
169
|
-
|
|
170
|
-
#### Validation Gate Failures
|
|
171
|
-
Read and execute $root/.ai/task-manager/config/hooks/POST_ERROR_DETECTION.md
|
|
172
|
-
|
|
173
|
-
### Output Requirements
|
|
174
|
-
|
|
175
|
-
**Output Behavior:**
|
|
176
|
-
|
|
177
|
-
Provide a concise execution summary:
|
|
178
|
-
- Example: "Execution completed. Review summary: `$root/.ai/task-manager/archive/[plan]/plan-[id].md`"
|
|
179
|
-
|
|
180
|
-
**CRITICAL - Structured Output for Command Coordination:**
|
|
181
|
-
|
|
182
|
-
Always end your output with a standardized summary in this exact format:
|
|
183
|
-
|
|
184
|
-
```
|
|
185
|
-
---
|
|
186
|
-
Execution Summary:
|
|
187
|
-
- Plan ID: [numeric-id]
|
|
188
|
-
- Status: Archived
|
|
189
|
-
- Location: $root/.ai/task-manager/archive/[plan-id]--[plan-name]/
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
This structured output enables automated workflow coordination and must be included even when running standalone.
|
|
193
|
-
|
|
194
|
-
## Optimization Guidelines
|
|
195
|
-
|
|
196
|
-
- **Maximize parallelism**: Always run all available tasks in a phase simultaneously
|
|
197
|
-
- **Resource awareness**: Balance agent allocation with system capabilities
|
|
198
|
-
- **Early failure detection**: Monitor tasks actively to catch issues quickly
|
|
199
|
-
- **Continuous improvement**: Note patterns for future blueprint optimization
|
|
200
|
-
|
|
201
|
-
## Post-Execution Processing
|
|
202
|
-
|
|
203
|
-
Upon successful completion of all phases and validation gates, perform the following additional steps:
|
|
204
|
-
|
|
205
|
-
- [ ] Post-Execution Validation
|
|
206
|
-
- [ ] Execution Summary Generation
|
|
207
|
-
- [ ] Plan Archival
|
|
208
|
-
|
|
209
|
-
### 0. Post-Execution Validation
|
|
210
|
-
|
|
211
|
-
Read and execute $root/.ai/task-manager/config/hooks/POST_EXECUTION.md
|
|
212
|
-
|
|
213
|
-
If validation fails, halt execution. The plan remains in `plans/` for debugging.
|
|
214
|
-
|
|
215
|
-
### 1. Execution Summary Generation
|
|
216
|
-
|
|
217
|
-
Append an execution summary section to the plan document with the format described in $root/.ai/task-manager/config/templates/EXECUTION_SUMMARY_TEMPLATE.md
|
|
218
|
-
|
|
219
|
-
### 2. Plan Archival
|
|
220
|
-
|
|
221
|
-
After successfully appending the execution summary:
|
|
222
|
-
|
|
223
|
-
**Move completed plan to archive**:
|
|
224
|
-
```bash
|
|
225
|
-
mv $root/.ai/task-manager/plans/[plan-folder] $root/.ai/task-manager/archive/
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### Important Notes
|
|
229
|
-
|
|
230
|
-
- **Only archive on complete success**: Archive operations should only occur when ALL phases are completed and ALL validation gates have passed
|
|
231
|
-
- **Failed executions remain active**: Plans that fail execution or validation should remain in the `plans/` directory for debugging and potential re-execution
|
|
232
|
-
- **Error handling**: If archival fails, log the error but do not fail the overall execution - the implementation work is complete
|
|
233
|
-
- **Preserve structure**: The entire plan folder (including all tasks and subdirectories) should be moved as-is to maintain referential integrity
|
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
argument-hint: "[planId] [taskId]"
|
|
3
|
-
description: Execute a single task with dependency validation and status management.
|
|
4
|
-
---
|
|
5
|
-
# Single Task Execution
|
|
6
|
-
|
|
7
|
-
You are responsible for executing a single task within a plan while maintaining strict dependency validation and proper status management. Your role is to ensure the task is ready for execution, deploy the appropriate agent, and track execution progress.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Find the AI Task Manager root
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
if [ ! -f /tmp/find-ai-task-manager-root.js ]; then
|
|
15
|
-
cat << 'EOF' > /tmp/find-ai-task-manager-root.js
|
|
16
|
-
const fs = require('fs');
|
|
17
|
-
const path = require('path');
|
|
18
|
-
|
|
19
|
-
const findRoot = (currentDir) => {
|
|
20
|
-
const taskManagerPath = path.join(currentDir, '.ai/task-manager');
|
|
21
|
-
const metadataPath = path.join(taskManagerPath, '.init-metadata.json');
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
if (fs.existsSync(metadataPath) && JSON.parse(fs.readFileSync(metadataPath, 'utf8')).version) {
|
|
25
|
-
console.log(path.resolve(taskManagerPath));
|
|
26
|
-
process.exit(0);
|
|
27
|
-
}
|
|
28
|
-
} catch (e) {
|
|
29
|
-
// Continue searching
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const parentDir = path.dirname(currentDir);
|
|
33
|
-
if (parentDir.length < currentDir.length) {
|
|
34
|
-
findRoot(parentDir);
|
|
35
|
-
} else {
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
findRoot(process.cwd());
|
|
41
|
-
EOF
|
|
42
|
-
fi
|
|
43
|
-
|
|
44
|
-
root=$(node /tmp/find-ai-task-manager-root.js)
|
|
45
|
-
|
|
46
|
-
if [ -z "$root" ]; then
|
|
47
|
-
echo "Error: Could not find task manager root directory (.ai/task-manager)"
|
|
48
|
-
exit 1
|
|
49
|
-
fi
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Use your internal Todo task tool to track the execution of all parts of the task. Example:
|
|
53
|
-
|
|
54
|
-
- [ ] Validate task: file, status (including needs-clarification), and dependencies.
|
|
55
|
-
- [ ] Set task status to in-progress.
|
|
56
|
-
- [ ] Execute the task (agent runs PRE_TASK_EXECUTION hook, then implements).
|
|
57
|
-
- [ ] Update task status to completed or failed.
|
|
58
|
-
- [ ] Document noteworthy events (if any).
|
|
59
|
-
- [ ] Emit structured output for orchestrator.
|
|
60
|
-
|
|
61
|
-
## Critical Rules
|
|
62
|
-
|
|
63
|
-
1. **Never skip dependency validation** - Task execution requires all dependencies to be completed
|
|
64
|
-
2. **Validate task status** - Never execute tasks that are already completed, in-progress, or needs-clarification
|
|
65
|
-
3. **Maintain status integrity** - Update task status throughout the execution lifecycle
|
|
66
|
-
4. **Document execution** - Record all outcomes and issues encountered
|
|
67
|
-
5. **Provide structured output** - Always emit the structured result block for orchestrator parsing
|
|
68
|
-
|
|
69
|
-
## Input Requirements
|
|
70
|
-
- Plan ID: $1 (required)
|
|
71
|
-
- Task ID: $2 (required)
|
|
72
|
-
- Task management directory structure: `/`
|
|
73
|
-
- Dependency checking script: `$root/.ai/task-manager/config/scripts/check-task-dependencies.cjs`
|
|
74
|
-
|
|
75
|
-
### Input Validation
|
|
76
|
-
|
|
77
|
-
First, validate that both arguments are provided:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
if [ -z "$1" ] || [ -z "$2" ]; then
|
|
81
|
-
echo "Error: Both plan ID and task ID are required"
|
|
82
|
-
echo "Usage: /tasks:execute-task [planId] [taskId]"
|
|
83
|
-
echo "Example: /tasks:execute-task 16 03"
|
|
84
|
-
exit 1
|
|
85
|
-
fi
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## Execution Process
|
|
89
|
-
|
|
90
|
-
### 1. Plan Location
|
|
91
|
-
|
|
92
|
-
Locate the plan directory using the discovered root:
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
plan_id="$1"
|
|
96
|
-
task_id="$2"
|
|
97
|
-
|
|
98
|
-
# Find plan directory
|
|
99
|
-
plan_dir=$(find $root/{plans,archive} -type d -name "${plan_id}--*" 2>/dev/null | head -1)
|
|
100
|
-
|
|
101
|
-
if [ -z "$plan_dir" ]; then
|
|
102
|
-
echo "Error: Plan with ID ${plan_id} not found"
|
|
103
|
-
echo "Available plans:"
|
|
104
|
-
find $root/plans -name "*--*" -type d | head -5
|
|
105
|
-
exit 1
|
|
106
|
-
fi
|
|
107
|
-
|
|
108
|
-
echo "Found plan: $plan_dir"
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### 2. Task File Validation
|
|
112
|
-
|
|
113
|
-
Locate and validate the specific task file:
|
|
114
|
-
|
|
115
|
-
```bash
|
|
116
|
-
# Handle both padded (01, 02) and unpadded (1, 2) task IDs
|
|
117
|
-
task_file=""
|
|
118
|
-
if [ -f "${plan_dir}/tasks/${task_id}--"*.md ]; then
|
|
119
|
-
task_file=$(ls "${plan_dir}/tasks/${task_id}--"*.md 2>/dev/null | head -1)
|
|
120
|
-
elif [ -f "${plan_dir}/tasks/0${task_id}--"*.md ]; then
|
|
121
|
-
task_file=$(ls "${plan_dir}/tasks/0${task_id}--"*.md 2>/dev/null | head -1)
|
|
122
|
-
fi
|
|
123
|
-
|
|
124
|
-
if [ -z "$task_file" ] || [ ! -f "$task_file" ]; then
|
|
125
|
-
echo "Error: Task with ID ${task_id} not found in plan ${plan_id}"
|
|
126
|
-
echo "Available tasks in plan:"
|
|
127
|
-
find "$plan_dir/tasks" -name "*.md" -type f | head -5
|
|
128
|
-
exit 1
|
|
129
|
-
fi
|
|
130
|
-
|
|
131
|
-
echo "Found task: $(basename "$task_file")"
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### 3. Task Status Validation
|
|
135
|
-
|
|
136
|
-
Check current task status to ensure it can be executed:
|
|
137
|
-
|
|
138
|
-
```bash
|
|
139
|
-
# Extract current status from task frontmatter
|
|
140
|
-
current_status=$(awk '
|
|
141
|
-
/^---$/ { if (++delim == 2) exit }
|
|
142
|
-
/^status:/ {
|
|
143
|
-
gsub(/^status:[ \t]*/, "")
|
|
144
|
-
gsub(/^["'\'']/, "")
|
|
145
|
-
gsub(/["'\'']$/, "")
|
|
146
|
-
print
|
|
147
|
-
exit
|
|
148
|
-
}
|
|
149
|
-
' "$task_file")
|
|
150
|
-
|
|
151
|
-
echo "Current task status: ${current_status:-unknown}"
|
|
152
|
-
|
|
153
|
-
# Validate status allows execution
|
|
154
|
-
case "$current_status" in
|
|
155
|
-
"completed")
|
|
156
|
-
echo "Error: Task ${task_id} is already completed"
|
|
157
|
-
echo "Use execute-blueprint to re-execute the entire plan if needed"
|
|
158
|
-
exit 1
|
|
159
|
-
;;
|
|
160
|
-
"in-progress")
|
|
161
|
-
echo "Error: Task ${task_id} is already in progress"
|
|
162
|
-
echo "Wait for current execution to complete or check for stale processes"
|
|
163
|
-
exit 1
|
|
164
|
-
;;
|
|
165
|
-
"needs-clarification")
|
|
166
|
-
echo "Error: Task ${task_id} is marked as 'needs-clarification'"
|
|
167
|
-
echo "Resolve clarification questions in the task file before execution"
|
|
168
|
-
exit 1
|
|
169
|
-
;;
|
|
170
|
-
"pending"|"failed"|"")
|
|
171
|
-
echo "Task status allows execution - proceeding..."
|
|
172
|
-
;;
|
|
173
|
-
*)
|
|
174
|
-
echo "Warning: Unknown task status '${current_status}' - proceeding with caution..."
|
|
175
|
-
;;
|
|
176
|
-
esac
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
#### Valid Status Transitions
|
|
180
|
-
|
|
181
|
-
Reference for orchestrators and execution flow:
|
|
182
|
-
|
|
183
|
-
- `pending` → `in-progress` (execution starts)
|
|
184
|
-
- `in-progress` → `completed` (successful execution)
|
|
185
|
-
- `in-progress` → `failed` (execution error)
|
|
186
|
-
- `failed` → `in-progress` (retry attempt)
|
|
187
|
-
- `pending` → `needs-clarification` (set externally by orchestrator or reviewer)
|
|
188
|
-
- `needs-clarification` → `pending` (clarification resolved, set externally)
|
|
189
|
-
|
|
190
|
-
### 4. Dependency Validation
|
|
191
|
-
|
|
192
|
-
Use the dependency checking script to validate all dependencies:
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
|
-
# Call the dependency checking script
|
|
196
|
-
if ! node $root/config/scripts/check-task-dependencies.cjs "$plan_id" "$task_id"; then
|
|
197
|
-
echo ""
|
|
198
|
-
echo "Task execution blocked by unresolved dependencies."
|
|
199
|
-
echo "Please complete the required dependencies first."
|
|
200
|
-
exit 1
|
|
201
|
-
fi
|
|
202
|
-
|
|
203
|
-
echo ""
|
|
204
|
-
echo "✓ All dependencies resolved - proceeding with execution"
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### 5. Agent Selection
|
|
208
|
-
|
|
209
|
-
Read task skills and select appropriate task-specific agent:
|
|
210
|
-
|
|
211
|
-
Read and execute $root/.ai/task-manager/config/hooks/PRE_TASK_ASSIGNMENT.md
|
|
212
|
-
|
|
213
|
-
### 6. Status Update to In-Progress
|
|
214
|
-
|
|
215
|
-
Update task status before execution:
|
|
216
|
-
|
|
217
|
-
```bash
|
|
218
|
-
echo "Updating task status to in-progress..."
|
|
219
|
-
|
|
220
|
-
# Create temporary file with updated status
|
|
221
|
-
temp_file=$(mktemp)
|
|
222
|
-
awk '
|
|
223
|
-
/^---$/ {
|
|
224
|
-
if (++delim == 1) {
|
|
225
|
-
print
|
|
226
|
-
next
|
|
227
|
-
} else if (delim == 2) {
|
|
228
|
-
print "status: \"in-progress\""
|
|
229
|
-
print
|
|
230
|
-
next
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
/^status:/ && delim == 1 {
|
|
234
|
-
print "status: \"in-progress\""
|
|
235
|
-
next
|
|
236
|
-
}
|
|
237
|
-
{ print }
|
|
238
|
-
' "$task_file" > "$temp_file"
|
|
239
|
-
|
|
240
|
-
# Replace original file
|
|
241
|
-
mv "$temp_file" "$task_file"
|
|
242
|
-
|
|
243
|
-
echo "✓ Task status updated to in-progress"
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
### 7. Task Execution
|
|
247
|
-
|
|
248
|
-
Deploy the task using the Task tool with full context:
|
|
249
|
-
|
|
250
|
-
**Task Deployment**: Use your internal Task tool to execute the task with the following context:
|
|
251
|
-
- Task file path: `$task_file`
|
|
252
|
-
- Plan directory: `$plan_dir`
|
|
253
|
-
- Required skills: `$task_skills`
|
|
254
|
-
- Agent selection: Based on skills analysis or general-purpose agent
|
|
255
|
-
|
|
256
|
-
**The agent MUST perform these steps in order:**
|
|
257
|
-
|
|
258
|
-
1. **Pre-flight validation**: Read and execute `$root/.ai/task-manager/config/hooks/PRE_TASK_EXECUTION.md` before starting any implementation work.
|
|
259
|
-
2. **Execute the task**: Read the complete task file and implement according to its requirements, including:
|
|
260
|
-
- Objective and acceptance criteria
|
|
261
|
-
- Technical requirements and implementation notes
|
|
262
|
-
- Input dependencies and expected output artifacts
|
|
263
|
-
|
|
264
|
-
### 8. Post-Execution Status Management
|
|
265
|
-
|
|
266
|
-
After task completion, update the status based on execution outcome:
|
|
267
|
-
|
|
268
|
-
```bash
|
|
269
|
-
temp_file=$(mktemp)
|
|
270
|
-
awk '
|
|
271
|
-
/^---$/ {
|
|
272
|
-
if (++delim == 1) {
|
|
273
|
-
print
|
|
274
|
-
next
|
|
275
|
-
} else if (delim == 2) {
|
|
276
|
-
print "status: \"completed\""
|
|
277
|
-
print
|
|
278
|
-
next
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
/^status:/ && delim == 1 {
|
|
282
|
-
print "status: \"completed\""
|
|
283
|
-
next
|
|
284
|
-
}
|
|
285
|
-
{ print }
|
|
286
|
-
' "$task_file" > "$temp_file"
|
|
287
|
-
|
|
288
|
-
mv "$temp_file" "$task_file"
|
|
289
|
-
|
|
290
|
-
echo "✓ Task ${task_id} status updated to completed"
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
### 9. Noteworthy Events Documentation
|
|
294
|
-
|
|
295
|
-
After task execution (whether successful or failed), append a "Noteworthy Events" section to the task file body if anything noteworthy occurred during execution.
|
|
296
|
-
|
|
297
|
-
Append to the end of the task file:
|
|
298
|
-
|
|
299
|
-
```markdown
|
|
300
|
-
## Noteworthy Events
|
|
301
|
-
- [YYYY-MM-DD] [Event description with sufficient context for the orchestrator]
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
If no noteworthy events occurred, do not add the section.
|
|
305
|
-
|
|
306
|
-
## Error Handling
|
|
307
|
-
|
|
308
|
-
Read and execute $root/.ai/task-manager/config/hooks/POST_ERROR_DETECTION.md
|
|
309
|
-
|
|
310
|
-
On any error, ensure you still emit the structured output block (see Output Requirements) with `Exit Code: 1`.
|
|
311
|
-
|
|
312
|
-
## Output Requirements
|
|
313
|
-
|
|
314
|
-
**CRITICAL - Structured Output for Orchestrator Coordination:**
|
|
315
|
-
|
|
316
|
-
Always end your output with a standardized summary in this exact format:
|
|
317
|
-
|
|
318
|
-
```
|
|
319
|
-
---
|
|
320
|
-
Task Execution Result:
|
|
321
|
-
- Plan ID: [plan-id]
|
|
322
|
-
- Task ID: [task-id]
|
|
323
|
-
- Exit Code: [0 for success, 1 for failure]
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
This structured output enables automated orchestration pipelines to parse results and determine next steps. It MUST be included regardless of success or failure.
|
|
327
|
-
|
|
328
|
-
## Usage Examples
|
|
329
|
-
|
|
330
|
-
```bash
|
|
331
|
-
# Execute a specific task
|
|
332
|
-
/tasks:execute-task 16 1
|
|
333
|
-
|
|
334
|
-
# Execute task with zero-padded ID
|
|
335
|
-
/tasks:execute-task 16 03
|
|
336
|
-
|
|
337
|
-
# Execute task from archived plan
|
|
338
|
-
/tasks:execute-task 12 05
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
## Integration Notes
|
|
342
|
-
|
|
343
|
-
This command is designed for scripting contexts where an external orchestrator manages task sequencing, commits, feature branches, linting, test execution, and plan archival. It integrates with the task management system by:
|
|
344
|
-
- Using established plan and task location patterns
|
|
345
|
-
- Leveraging the dependency checking script for validation
|
|
346
|
-
- Following status management conventions (see Valid Status Transitions)
|
|
347
|
-
- Providing structured machine-parseable output for orchestrator pipelines
|
|
348
|
-
- Maintaining compatibility with execute-blueprint workflows
|
|
349
|
-
- Preserving task isolation and dependency order
|
|
350
|
-
|
|
351
|
-
The command complements execute-blueprint by providing granular single-task control while maintaining the same validation standards.
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
argument-hint: "[testCommand]"
|
|
3
|
-
description: Fix the tests your task execution broke.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Fix all failing tests in this repository.
|
|
7
|
-
|
|
8
|
-
Use tools for debugging. You are encouraged to write your own specialized tools to research, analyze, and debug
|
|
9
|
-
failing tests. You are not restricted to the stack of the current project to create your own
|
|
10
|
-
specialized tools.
|
|
11
|
-
|
|
12
|
-
Execute this command to run the tests:
|
|
13
|
-
|
|
14
|
-
<test-command>
|
|
15
|
-
$1
|
|
16
|
-
</test-command>
|
|
17
|
-
|
|
18
|
-
If the test command is empty, read CLAUDE.md for test execution instructions.
|
|
19
|
-
|
|
20
|
-
⚠️ **CRITICAL INTEGRITY REQUIREMENT** ⚠️
|
|
21
|
-
You MUST fix the actual bugs in the source code. Green tests are worthless if achieved through cheating.
|
|
22
|
-
|
|
23
|
-
**This is CHEATING (absolutely forbidden):**
|
|
24
|
-
- Skipping tests with conditionals
|
|
25
|
-
- Modifying test assertions to pass
|
|
26
|
-
- Adding test-environment-specific code to source
|
|
27
|
-
- Disabling or commenting out tests
|
|
28
|
-
- ANY workaround that doesn't fix the real bug
|
|
29
|
-
|
|
30
|
-
**This is THE RIGHT WAY:**
|
|
31
|
-
- Find the root cause in the source code
|
|
32
|
-
- Fix the actual bug
|
|
33
|
-
- Ensure tests pass because the code truly works
|
|
34
|
-
|
|
35
|
-
**Process:**
|
|
36
|
-
1. Run all tests to identify failures
|
|
37
|
-
2. Fix EVERY failing test iteratively
|
|
38
|
-
3. Verify all tests pass legitimately
|
|
39
|
-
|
|
40
|
-
DO NOT STOP after fixing some tests - fix ALL of them.
|
|
41
|
-
|
|
42
|
-
Remember: The entire point of tests is to ensure code robustness. If you cheat in ANY way, the tests become meaningless and I cannot trust that the code actually works.
|
|
43
|
-
|
|
44
|
-
If you get stuck and cannot fix a test properly, ask for help rather than resorting to shortcuts.
|