@e0ipso/ai-task-manager 1.26.3 → 1.26.5
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/package.json +1 -1
- package/templates/ai-task-manager/config/scripts/check-task-dependencies.cjs +212 -274
- package/templates/ai-task-manager/config/scripts/find-root.cjs +10 -0
- package/templates/ai-task-manager/config/scripts/get-next-plan-id.cjs +22 -59
- package/templates/ai-task-manager/config/scripts/get-next-task-id.cjs +29 -48
- package/templates/ai-task-manager/config/scripts/shared-utils.cjs +332 -85
- package/templates/ai-task-manager/config/scripts/validate-plan-blueprint.cjs +80 -188
- package/templates/assistant/commands/tasks/create-plan.md +51 -20
- package/templates/assistant/commands/tasks/execute-blueprint.md +62 -30
- package/templates/assistant/commands/tasks/execute-task.md +46 -16
- package/templates/assistant/commands/tasks/fix-broken-tests.md +1 -13
- package/templates/assistant/commands/tasks/full-workflow.md +68 -36
- package/templates/assistant/commands/tasks/generate-tasks.md +48 -18
- package/templates/assistant/commands/tasks/refine-plan.md +52 -22
|
@@ -2,245 +2,137 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
|
-
const
|
|
5
|
+
const sharedUtils = require('./shared-utils.cjs');
|
|
6
|
+
const {
|
|
7
|
+
findTaskManagerRoot,
|
|
8
|
+
findPlanById,
|
|
9
|
+
countTasks,
|
|
10
|
+
checkBlueprintExists,
|
|
11
|
+
getAllPlans,
|
|
12
|
+
validatePlanFile,
|
|
13
|
+
checkStandardRootShortcut,
|
|
14
|
+
resolvePlan
|
|
15
|
+
} = sharedUtils;
|
|
6
16
|
|
|
7
17
|
/**
|
|
8
18
|
* Error logging utility
|
|
19
|
+
* @private
|
|
9
20
|
* @param {string} message - Error message
|
|
10
21
|
* @param {...any} args - Additional arguments to log
|
|
11
22
|
*/
|
|
12
|
-
function
|
|
23
|
+
function _errorLog(message, ...args) {
|
|
13
24
|
console.error(`[ERROR] ${message}`, ...args);
|
|
14
25
|
}
|
|
15
26
|
|
|
16
|
-
/**
|
|
17
|
-
* Find plan file and directory for a given plan ID
|
|
18
|
-
* @param {string|number} planId - Plan ID to search for
|
|
19
|
-
* @returns {Object|null} Object with planFile and planDir, or null if not found
|
|
20
|
-
*/
|
|
21
|
-
function findPlanById(planId) {
|
|
22
|
-
const taskManagerRoot = findTaskManagerRoot();
|
|
23
|
-
|
|
24
|
-
if (!taskManagerRoot) {
|
|
25
|
-
errorLog('No .ai/task-manager directory found in current directory or any parent directory.');
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Convert planId to numeric for flexible matching (handles both "2" and "02")
|
|
30
|
-
const numericPlanId = parseInt(planId, 10);
|
|
31
|
-
|
|
32
|
-
if (isNaN(numericPlanId)) {
|
|
33
|
-
errorLog(`Invalid plan ID: ${planId}. Plan ID must be numeric.`);
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const plansDir = path.join(taskManagerRoot, 'plans');
|
|
38
|
-
const archiveDir = path.join(taskManagerRoot, 'archive');
|
|
39
|
-
|
|
40
|
-
// Search both plans and archive directories
|
|
41
|
-
for (const dir of [plansDir, archiveDir]) {
|
|
42
|
-
if (!fs.existsSync(dir)) {
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
try {
|
|
47
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
48
|
-
|
|
49
|
-
for (const entry of entries) {
|
|
50
|
-
// Match directory pattern: [plan-id]--* (with flexible ID matching)
|
|
51
|
-
if (entry.isDirectory()) {
|
|
52
|
-
// Extract numeric ID from directory name, stripping leading zeros
|
|
53
|
-
const dirMatch = entry.name.match(/^0*(\d+)--/);
|
|
54
|
-
if (dirMatch && parseInt(dirMatch[1], 10) === numericPlanId) {
|
|
55
|
-
const planDirPath = path.join(dir, entry.name);
|
|
56
|
-
|
|
57
|
-
try {
|
|
58
|
-
const planDirEntries = fs.readdirSync(planDirPath, { withFileTypes: true });
|
|
59
|
-
|
|
60
|
-
// Look for plan file: plan-[plan-id]--*.md (with flexible ID matching)
|
|
61
|
-
for (const planEntry of planDirEntries) {
|
|
62
|
-
if (planEntry.isFile()) {
|
|
63
|
-
// Extract numeric ID from filename, stripping leading zeros
|
|
64
|
-
const fileMatch = planEntry.name.match(/^plan-0*(\d+)--.*\.md$/);
|
|
65
|
-
if (fileMatch && parseInt(fileMatch[1], 10) === numericPlanId) {
|
|
66
|
-
const planFilePath = path.join(planDirPath, planEntry.name);
|
|
67
|
-
|
|
68
|
-
return {
|
|
69
|
-
planFile: planFilePath,
|
|
70
|
-
planDir: planDirPath
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
} catch (err) {
|
|
76
|
-
errorLog(`Failed to read plan directory ${planDirPath}: ${err.message}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
} catch (err) {
|
|
82
|
-
errorLog(`Failed to read directory ${dir}: ${err.message}`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Count task files in a plan's tasks directory
|
|
91
|
-
* @param {string} planDir - Plan directory path
|
|
92
|
-
* @returns {number} Number of task files found
|
|
93
|
-
*/
|
|
94
|
-
function countTasks(planDir) {
|
|
95
|
-
const tasksDir = path.join(planDir, 'tasks');
|
|
96
|
-
|
|
97
|
-
if (!fs.existsSync(tasksDir)) {
|
|
98
|
-
return 0;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
try {
|
|
102
|
-
const stats = fs.lstatSync(tasksDir);
|
|
103
|
-
if (!stats.isDirectory()) {
|
|
104
|
-
return 0;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const files = fs.readdirSync(tasksDir).filter(f => f.endsWith('.md'));
|
|
108
|
-
return files.length;
|
|
109
|
-
} catch (err) {
|
|
110
|
-
errorLog(`Failed to read tasks directory ${tasksDir}: ${err.message}`);
|
|
111
|
-
return 0;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Check if execution blueprint section exists in plan file
|
|
117
|
-
* @param {string} planFile - Path to plan file
|
|
118
|
-
* @returns {boolean} True if blueprint section exists, false otherwise
|
|
119
|
-
*/
|
|
120
|
-
function checkBlueprintExists(planFile) {
|
|
121
|
-
try {
|
|
122
|
-
const planContent = fs.readFileSync(planFile, 'utf8');
|
|
123
|
-
const blueprintExists = /^## Execution Blueprint/m.test(planContent);
|
|
124
|
-
return blueprintExists;
|
|
125
|
-
} catch (err) {
|
|
126
|
-
errorLog(`Failed to read plan file ${planFile}: ${err.message}`);
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
27
|
/**
|
|
132
28
|
* List available plans for error messaging
|
|
29
|
+
* @private
|
|
30
|
+
* @param {string} [taskManagerRoot] - Optional task manager root path
|
|
133
31
|
* @returns {string[]} Array of plan directory names
|
|
134
32
|
*/
|
|
135
|
-
function
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
for (const dir of [plansDir, archiveDir]) {
|
|
147
|
-
if (!fs.existsSync(dir)) {
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
try {
|
|
152
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
153
|
-
for (const entry of entries) {
|
|
154
|
-
if (entry.isDirectory() && entry.name.match(/^\d+--/)) {
|
|
155
|
-
plans.push(entry.name);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
} catch (err) {
|
|
159
|
-
// Silently continue
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return plans.sort((a, b) => {
|
|
164
|
-
const aId = parseInt(a.match(/^(\d+)--/)[1], 10);
|
|
165
|
-
const bId = parseInt(b.match(/^(\d+)--/)[1], 10);
|
|
166
|
-
return aId - bId;
|
|
167
|
-
});
|
|
33
|
+
function _listAvailablePlans(taskManagerRoot) {
|
|
34
|
+
const plans = getAllPlans(taskManagerRoot);
|
|
35
|
+
return plans
|
|
36
|
+
.map(p => p.name)
|
|
37
|
+
.sort((a, b) => {
|
|
38
|
+
const aIdMatch = a.match(/^(\d+)--/);
|
|
39
|
+
const bIdMatch = b.match(/^(\d+)--/);
|
|
40
|
+
if (!aIdMatch || !bIdMatch) return 0;
|
|
41
|
+
return parseInt(aIdMatch[1], 10) - parseInt(bIdMatch[1], 10);
|
|
42
|
+
});
|
|
168
43
|
}
|
|
169
44
|
|
|
170
45
|
/**
|
|
171
46
|
* Validate plan blueprint and output JSON or specific field
|
|
172
|
-
* @
|
|
173
|
-
* @param {string}
|
|
47
|
+
* @private
|
|
48
|
+
* @param {string|number} inputId - Plan ID or absolute path to validate
|
|
49
|
+
* @param {string} [fieldName] - Optional field name to extract (planFile, planDir, taskCount, blueprintExists, taskManagerRoot, planId)
|
|
50
|
+
* @param {string} [startPath] - Optional start path for finding task manager root
|
|
174
51
|
*/
|
|
175
|
-
function
|
|
176
|
-
if (!
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
52
|
+
function _validatePlanBlueprint(inputId, fieldName, startPath = process.cwd()) {
|
|
53
|
+
if (!inputId) {
|
|
54
|
+
_errorLog('Plan ID or absolute path is required');
|
|
55
|
+
_errorLog('');
|
|
56
|
+
_errorLog('Usage: node validate-plan-blueprint.cjs <plan-id-or-path> [field-name]');
|
|
57
|
+
_errorLog('');
|
|
58
|
+
_errorLog('Examples:');
|
|
59
|
+
_errorLog(' node validate-plan-blueprint.cjs 47 # Output full JSON');
|
|
60
|
+
_errorLog(' node validate-plan-blueprint.cjs /path/to/plan.md # Output full JSON for specific file');
|
|
61
|
+
_errorLog(' node validate-plan-blueprint.cjs 47 planFile # Output just the plan file path');
|
|
62
|
+
_errorLog(' node validate-plan-blueprint.cjs 47 blueprintExists # Output yes/no');
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Check if input is numeric (allowing padded zeros) - if not a number or path, it's invalid
|
|
67
|
+
const numericInput = parseInt(inputId, 10);
|
|
68
|
+
const isNumeric = !isNaN(numericInput);
|
|
69
|
+
const isAbsolutePath = inputId.startsWith('/');
|
|
70
|
+
|
|
71
|
+
if (!isNumeric && !isAbsolutePath) {
|
|
72
|
+
_errorLog(`Invalid plan ID: "${inputId}" is not a valid number`);
|
|
187
73
|
process.exit(1);
|
|
188
74
|
}
|
|
189
75
|
|
|
190
|
-
const
|
|
76
|
+
const resolved = resolvePlan(inputId, startPath);
|
|
191
77
|
|
|
192
|
-
if (!
|
|
193
|
-
|
|
194
|
-
|
|
78
|
+
if (!resolved) {
|
|
79
|
+
_errorLog(`Plan ID ${inputId} not found or invalid`);
|
|
80
|
+
_errorLog('');
|
|
195
81
|
|
|
196
|
-
const
|
|
82
|
+
const tmRoot = findTaskManagerRoot(startPath);
|
|
83
|
+
const availablePlans = _listAvailablePlans(tmRoot);
|
|
197
84
|
if (availablePlans.length > 0) {
|
|
198
|
-
|
|
85
|
+
_errorLog('Available plans:');
|
|
199
86
|
availablePlans.forEach(plan => {
|
|
200
|
-
|
|
87
|
+
_errorLog(` ${plan}`);
|
|
201
88
|
});
|
|
202
|
-
} else {
|
|
203
|
-
errorLog('No plans found in .ai/task-manager/{plans,archive}/');
|
|
204
89
|
}
|
|
205
90
|
|
|
206
|
-
errorLog('');
|
|
207
|
-
errorLog('Please verify:');
|
|
208
|
-
errorLog(' 1. You are in the correct project directory');
|
|
209
|
-
errorLog(' 2. The plan exists in .ai/task-manager/plans/ or .ai/task-manager/archive/');
|
|
210
|
-
errorLog(' 3. The plan directory follows the naming pattern: [plan-id]--[name]');
|
|
211
|
-
errorLog(' 4. The plan file follows the naming pattern: plan-[plan-id]--[name].md');
|
|
212
91
|
process.exit(1);
|
|
213
92
|
}
|
|
214
93
|
|
|
215
|
-
const {
|
|
94
|
+
const {
|
|
95
|
+
planFile,
|
|
96
|
+
planDir,
|
|
97
|
+
taskManagerRoot,
|
|
98
|
+
planId
|
|
99
|
+
} = resolved;
|
|
100
|
+
|
|
216
101
|
const taskCount = countTasks(planDir);
|
|
217
102
|
const blueprintExists = checkBlueprintExists(planFile);
|
|
218
103
|
|
|
219
104
|
const result = {
|
|
220
105
|
planFile,
|
|
221
106
|
planDir,
|
|
107
|
+
taskManagerRoot,
|
|
108
|
+
planId,
|
|
222
109
|
taskCount,
|
|
223
110
|
blueprintExists: blueprintExists ? 'yes' : 'no'
|
|
224
111
|
};
|
|
225
112
|
|
|
226
113
|
// If field name is provided, output just that field
|
|
227
114
|
if (fieldName) {
|
|
228
|
-
const validFields = ['planFile', 'planDir', 'taskCount', 'blueprintExists'];
|
|
115
|
+
const validFields = ['planFile', 'planDir', 'taskCount', 'blueprintExists', 'taskManagerRoot', 'planId'];
|
|
229
116
|
if (!validFields.includes(fieldName)) {
|
|
230
|
-
|
|
231
|
-
|
|
117
|
+
_errorLog(`Invalid field name: ${fieldName}`);
|
|
118
|
+
_errorLog(`Valid fields: ${validFields.join(', ')}`);
|
|
232
119
|
process.exit(1);
|
|
233
120
|
}
|
|
234
121
|
// Use process.stdout.write to avoid util.inspect colorization
|
|
235
|
-
// Convert to string explicitly to ensure plain text output
|
|
236
122
|
process.stdout.write(String(result[fieldName]) + '\n');
|
|
237
123
|
} else {
|
|
238
|
-
// Output full JSON
|
|
124
|
+
// Output full JSON
|
|
239
125
|
console.log(JSON.stringify(result, null, 2));
|
|
240
126
|
}
|
|
241
127
|
}
|
|
242
128
|
|
|
243
129
|
// Main execution
|
|
244
|
-
|
|
245
|
-
const
|
|
246
|
-
|
|
130
|
+
if (require.main === module) {
|
|
131
|
+
const planId = process.argv[2];
|
|
132
|
+
const fieldName = process.argv[3];
|
|
133
|
+
_validatePlanBlueprint(planId, fieldName);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
module.exports = {
|
|
137
|
+
_validatePlanBlueprint
|
|
138
|
+
};
|
|
@@ -4,29 +4,59 @@ description: Create a comprehensive plan to accomplish the request from the user
|
|
|
4
4
|
---
|
|
5
5
|
# Comprehensive Plan Creation
|
|
6
6
|
|
|
7
|
-
You are a strategic planning specialist who creates actionable plan documents that balance comprehensive context with
|
|
8
|
-
disciplined scope control. Your role is to think hard to create detailed, actionable plans based on user input while
|
|
7
|
+
You are a strategic planning specialist who creates actionable plan documents that balance comprehensive context with
|
|
8
|
+
disciplined scope control. Your role is to think hard to create detailed, actionable plans based on user input while
|
|
9
9
|
ensuring you have all necessary context before proceeding. Use the plan-creator sub-agent for this if it is available.
|
|
10
10
|
|
|
11
|
-
## Assistant Configuration
|
|
12
|
-
|
|
13
|
-
Before proceeding with this command, you MUST load and respect the assistant's configuration:
|
|
14
|
-
|
|
15
|
-
Load the following configuration files in order of precedence (later files override earlier ones):
|
|
16
|
-
1. `/workspace/AGENTS.md` - Project-level task management guidance
|
|
17
|
-
2. `/workspace/CLAUDE.md` - Claude-specific assistant configuration (if it exists)
|
|
18
|
-
3. `/home/node/.claude/CLAUDE.md` - Global Claude configuration from your home directory (if it exists)
|
|
19
|
-
|
|
20
|
-
These files contain your global and project-level configuration rules. You MUST keep these rules and guidelines in mind during all subsequent operations in this command.
|
|
21
|
-
|
|
22
11
|
---
|
|
23
12
|
|
|
24
|
-
|
|
13
|
+
Ultrathink, think harder, and use tools.
|
|
14
|
+
|
|
15
|
+
## Find the AI Task Manager root
|
|
25
16
|
|
|
26
|
-
|
|
17
|
+
```bash
|
|
18
|
+
if [ ! -f /tmp/find-ai-task-manager-root.js ]; then
|
|
19
|
+
cat << 'EOF' > /tmp/find-ai-task-manager-root.js
|
|
20
|
+
const fs = require('fs');
|
|
21
|
+
const path = require('path');
|
|
22
|
+
|
|
23
|
+
const findRoot = (currentDir) => {
|
|
24
|
+
const taskManagerPath = path.join(currentDir, '.ai/task-manager');
|
|
25
|
+
const metadataPath = path.join(taskManagerPath, '.init-metadata.json');
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
if (fs.existsSync(metadataPath) && JSON.parse(fs.readFileSync(metadataPath, 'utf8')).version) {
|
|
29
|
+
console.log(path.resolve(taskManagerPath));
|
|
30
|
+
process.exit(0);
|
|
31
|
+
}
|
|
32
|
+
} catch (e) {
|
|
33
|
+
// Continue searching
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const parentDir = path.dirname(currentDir);
|
|
37
|
+
if (parentDir !== currentDir) {
|
|
38
|
+
findRoot(parentDir);
|
|
39
|
+
} else {
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
findRoot(process.cwd());
|
|
45
|
+
EOF
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
root=$(node /tmp/find-ai-task-manager-root.js)
|
|
49
|
+
|
|
50
|
+
if [ -z "$root" ]; then
|
|
51
|
+
echo "Error: Could not find task manager root directory (.ai/task-manager)"
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
```
|
|
27
55
|
|
|
28
56
|
## Instructions
|
|
29
57
|
|
|
58
|
+
Include $root/ $root/.ai/task-manager/config/TASK_MANAGER.md for the directory structure of tasks.
|
|
59
|
+
|
|
30
60
|
The user input is:
|
|
31
61
|
|
|
32
62
|
<user-input>
|
|
@@ -39,11 +69,11 @@ If no user input is provided stop immediately and show an error message to the u
|
|
|
39
69
|
|
|
40
70
|
Use your internal Todo task tool to track the following plan generation:
|
|
41
71
|
|
|
42
|
-
- [ ] Read and execute
|
|
72
|
+
- [ ] Read and execute $root/ $root/.ai/task-manager/config/hooks/PRE_PLAN.md
|
|
43
73
|
- [ ] User input and context analysis
|
|
44
74
|
- [ ] Clarification questions
|
|
45
75
|
- [ ] Plan generation
|
|
46
|
-
- [ ] Read and execute
|
|
76
|
+
- [ ] Read and execute $root/ $root/.ai/task-manager/config/hooks/POST_PLAN.md
|
|
47
77
|
|
|
48
78
|
#### Step 1: Context Analysis
|
|
49
79
|
Before creating any plan, analyze the user's request for:
|
|
@@ -66,7 +96,7 @@ Try to answer your own questions first by inspecting the codebase, docs, and ass
|
|
|
66
96
|
IMPORTANT: Once you have the user's answers go back to Step 2. Do this in a loop until you have no more questions. Ask as many rounds of questions as necessary, it is very important you have all the information you need to achieve your task.
|
|
67
97
|
|
|
68
98
|
#### Step 3: Plan Generation
|
|
69
|
-
Only after confirming sufficient context, create a plan according the the
|
|
99
|
+
Only after confirming sufficient context, create a plan according the the $root/ $root/.ai/task-manager/config/templates/PLAN_TEMPLATE.md
|
|
70
100
|
|
|
71
101
|
##### CRITICAL: Output Format
|
|
72
102
|
|
|
@@ -88,7 +118,7 @@ This structured output enables automated workflow coordination and must be inclu
|
|
|
88
118
|
|
|
89
119
|
###### Plan Template
|
|
90
120
|
|
|
91
|
-
Use the template in
|
|
121
|
+
Use the template in $root/ $root/.ai/task-manager/config/templates/PLAN_TEMPLATE.md
|
|
92
122
|
|
|
93
123
|
###### Patterns to Avoid
|
|
94
124
|
Do not include the following in your plan output.
|
|
@@ -132,10 +162,11 @@ The schema for this frontmatter is:
|
|
|
132
162
|
```
|
|
133
163
|
|
|
134
164
|
### Plan ID Generation
|
|
165
|
+
|
|
135
166
|
Execute this script to determine the plan ID:
|
|
136
167
|
|
|
137
168
|
```bash
|
|
138
|
-
node
|
|
169
|
+
next_id=$(node $root/config/scripts/get-next-plan-id.cjs)
|
|
139
170
|
```
|
|
140
171
|
|
|
141
172
|
**Key formatting:**
|
|
@@ -4,17 +4,6 @@ description: Execute the task in the plan.
|
|
|
4
4
|
---
|
|
5
5
|
# Task Execution
|
|
6
6
|
|
|
7
|
-
## Assistant Configuration
|
|
8
|
-
|
|
9
|
-
Before proceeding with this command, you MUST load and respect the assistant's configuration:
|
|
10
|
-
|
|
11
|
-
Load the following configuration files in order of precedence (later files override earlier ones):
|
|
12
|
-
1. `/workspace/AGENTS.md` - Project-level task management guidance
|
|
13
|
-
2. `/workspace/CLAUDE.md` - Claude-specific assistant configuration (if it exists)
|
|
14
|
-
3. `/home/node/.claude/CLAUDE.md` - Global Claude configuration from your home directory (if it exists)
|
|
15
|
-
|
|
16
|
-
These files contain your global and project-level configuration rules. You MUST keep these rules and guidelines in mind during all subsequent operations in this command.
|
|
17
|
-
|
|
18
7
|
---
|
|
19
8
|
|
|
20
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.
|
|
@@ -44,12 +33,55 @@ Before proceeding with execution, validate that tasks exist and the execution bl
|
|
|
44
33
|
|
|
45
34
|
**Validation Steps:**
|
|
46
35
|
|
|
36
|
+
First, discover the task manager root directory:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
if [ ! -f /tmp/find-ai-task-manager-root.cjs ]; then
|
|
40
|
+
cat << 'EOF' > /tmp/find-ai-task-manager-root.cjs
|
|
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 !== currentDir) {
|
|
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
|
+
|
|
47
79
|
```bash
|
|
48
80
|
# Extract validation results directly from script
|
|
49
|
-
plan_file=$(node
|
|
50
|
-
plan_dir=$(node
|
|
51
|
-
task_count=$(node
|
|
52
|
-
blueprint_exists=$(node
|
|
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)
|
|
53
85
|
```
|
|
54
86
|
|
|
55
87
|
4. **Automatic task generation**:
|
|
@@ -82,21 +114,21 @@ Use your internal Todo task tool to track the execution of all phases, and the f
|
|
|
82
114
|
|
|
83
115
|
- [ ] Create feature branch from the main branch.
|
|
84
116
|
- [ ] Validate or auto-generate tasks and execution blueprint if missing.
|
|
85
|
-
- [ ] Execute
|
|
117
|
+
- [ ] Execute $root/.ai/task-manager/config/hooks/PRE_PHASE.md hook before Phase 1.
|
|
86
118
|
- [ ] Phase 1: Execute 1 task(s) in parallel.
|
|
87
|
-
- [ ] Execute
|
|
88
|
-
- [ ] Execute
|
|
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.
|
|
89
121
|
- [ ] Phase 2: Execute 3 task(s) in parallel.
|
|
90
|
-
- [ ] Execute
|
|
91
|
-
- [ ] Execute
|
|
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.
|
|
92
124
|
- [ ] Phase 3: Execute 1 task(s) in parallel.
|
|
93
|
-
- [ ] Execute
|
|
94
|
-
- [ ] Update the Plan 7 with execution summary using
|
|
125
|
+
- [ ] Execute $root/.ai/task-manager/config/hooks/POST_PHASE.md hook after Phase 3.
|
|
126
|
+
- [ ] Update the Plan 7 with execution summary using $root/.ai/task-manager/config/hooks/EXECUTION_SUMMARY_TEMPLATE.md.
|
|
95
127
|
- [ ] Archive Plan 7.
|
|
96
128
|
|
|
97
129
|
### Phase Pre-Execution
|
|
98
130
|
|
|
99
|
-
Read and execute
|
|
131
|
+
Read and execute $root/.ai/task-manager/config/hooks/PRE_PHASE.md
|
|
100
132
|
|
|
101
133
|
### Phase Execution Workflow
|
|
102
134
|
|
|
@@ -105,7 +137,7 @@ Read and execute .ai/task-manager/config/hooks/PRE_PHASE.md
|
|
|
105
137
|
- List all tasks scheduled for parallel execution in this phase
|
|
106
138
|
|
|
107
139
|
2. **Agent Selection and Task Assignment**
|
|
108
|
-
Read and execute
|
|
140
|
+
Read and execute $root/.ai/task-manager/config/hooks/PRE_TASK_ASSIGNMENT.md
|
|
109
141
|
|
|
110
142
|
3. **Parallel Execution**
|
|
111
143
|
- Deploy all selected agents simultaneously using your internal Task tool
|
|
@@ -120,7 +152,7 @@ Read and execute .ai/task-manager/config/hooks/PRE_TASK_ASSIGNMENT.md
|
|
|
120
152
|
|
|
121
153
|
### Phase Post-Execution
|
|
122
154
|
|
|
123
|
-
Read and execute
|
|
155
|
+
Read and execute $root/.ai/task-manager/config/hooks/POST_PHASE.md
|
|
124
156
|
|
|
125
157
|
|
|
126
158
|
### Phase Transition
|
|
@@ -132,14 +164,14 @@ Read and execute .ai/task-manager/config/hooks/POST_PHASE.md
|
|
|
132
164
|
### Error Handling
|
|
133
165
|
|
|
134
166
|
#### Validation Gate Failures
|
|
135
|
-
Read and execute
|
|
167
|
+
Read and execute $root/.ai/task-manager/config/hooks/POST_ERROR_DETECTION.md
|
|
136
168
|
|
|
137
169
|
### Output Requirements
|
|
138
170
|
|
|
139
171
|
**Output Behavior:**
|
|
140
172
|
|
|
141
173
|
Provide a concise execution summary:
|
|
142
|
-
- Example: "Execution completed. Review summary:
|
|
174
|
+
- Example: "Execution completed. Review summary: `$root/.ai/task-manager/archive/[plan]/plan-[id].md`"
|
|
143
175
|
|
|
144
176
|
**CRITICAL - Structured Output for Command Coordination:**
|
|
145
177
|
|
|
@@ -150,7 +182,7 @@ Always end your output with a standardized summary in this exact format:
|
|
|
150
182
|
Execution Summary:
|
|
151
183
|
- Plan ID: [numeric-id]
|
|
152
184
|
- Status: Archived
|
|
153
|
-
- Location:
|
|
185
|
+
- Location: $root/.ai/task-manager/archive/[plan-id]--[plan-name]/
|
|
154
186
|
```
|
|
155
187
|
|
|
156
188
|
This structured output enables automated workflow coordination and must be included even when running standalone.
|
|
@@ -171,7 +203,7 @@ Upon successful completion of all phases and validation gates, perform the follo
|
|
|
171
203
|
|
|
172
204
|
### 1. Execution Summary Generation
|
|
173
205
|
|
|
174
|
-
Append an execution summary section to the plan document with the format described in
|
|
206
|
+
Append an execution summary section to the plan document with the format described in $root/.ai/task-manager/config/templates/[EXECUTION_SUMMARY_TEMPLATE.md
|
|
175
207
|
|
|
176
208
|
### 2. Plan Archival
|
|
177
209
|
|
|
@@ -179,7 +211,7 @@ After successfully appending the execution summary:
|
|
|
179
211
|
|
|
180
212
|
**Move completed plan to archive**:
|
|
181
213
|
```bash
|
|
182
|
-
mv
|
|
214
|
+
mv $root/.ai/task-manager/plans/[plan-folder] $root/.ai/task-manager/archive/
|
|
183
215
|
```
|
|
184
216
|
|
|
185
217
|
### Important Notes
|