task-o-matic 0.0.3 → 0.0.6
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 +96 -40
- package/dist/cli/bin.js +0 -0
- package/dist/commands/tasks/create.d.ts +3 -0
- package/dist/commands/tasks/create.d.ts.map +1 -0
- package/dist/commands/tasks/create.js +58 -0
- package/dist/commands/tasks/delete.d.ts +3 -0
- package/dist/commands/tasks/delete.d.ts.map +1 -0
- package/dist/commands/tasks/delete.js +40 -0
- package/dist/commands/tasks/document.d.ts +5 -0
- package/dist/commands/tasks/document.d.ts.map +1 -0
- package/dist/commands/tasks/document.js +118 -0
- package/dist/commands/tasks/enhance.d.ts +3 -0
- package/dist/commands/tasks/enhance.d.ts.map +1 -0
- package/dist/commands/tasks/enhance.js +86 -0
- package/dist/commands/tasks/execute.d.ts +3 -0
- package/dist/commands/tasks/execute.d.ts.map +1 -0
- package/dist/commands/tasks/execute.js +33 -0
- package/dist/commands/tasks/index.d.ts +16 -0
- package/dist/commands/tasks/index.d.ts.map +1 -0
- package/dist/commands/tasks/index.js +31 -0
- package/dist/commands/tasks/list.d.ts +3 -0
- package/dist/commands/tasks/list.d.ts.map +1 -0
- package/dist/commands/tasks/list.js +27 -0
- package/dist/commands/tasks/next.d.ts +3 -0
- package/dist/commands/tasks/next.d.ts.map +1 -0
- package/dist/commands/tasks/next.js +44 -0
- package/dist/commands/tasks/plan.d.ts +7 -0
- package/dist/commands/tasks/plan.d.ts.map +1 -0
- package/dist/commands/tasks/plan.js +131 -0
- package/dist/commands/tasks/show.d.ts +3 -0
- package/dist/commands/tasks/show.d.ts.map +1 -0
- package/dist/commands/tasks/show.js +23 -0
- package/dist/commands/tasks/split.d.ts +3 -0
- package/dist/commands/tasks/split.d.ts.map +1 -0
- package/dist/commands/tasks/split.js +95 -0
- package/dist/commands/tasks/status.d.ts +3 -0
- package/dist/commands/tasks/status.d.ts.map +1 -0
- package/dist/commands/tasks/status.js +26 -0
- package/dist/commands/tasks/subtasks.d.ts +3 -0
- package/dist/commands/tasks/subtasks.d.ts.map +1 -0
- package/dist/commands/tasks/subtasks.js +35 -0
- package/dist/commands/tasks/tags.d.ts +4 -0
- package/dist/commands/tasks/tags.d.ts.map +1 -0
- package/dist/commands/tasks/tags.js +37 -0
- package/dist/commands/tasks/tree.d.ts +3 -0
- package/dist/commands/tasks/tree.d.ts.map +1 -0
- package/dist/commands/tasks/tree.js +20 -0
- package/dist/commands/tasks/update.d.ts +3 -0
- package/dist/commands/tasks/update.d.ts.map +1 -0
- package/dist/commands/tasks/update.js +35 -0
- package/dist/commands/tasks.d.ts.map +1 -1
- package/dist/commands/tasks.js +23 -686
- package/dist/commands/workflow.d.ts +4 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +503 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/ai-service/ai-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/ai-operations.js +54 -22
- package/dist/lib/ai-service/research-tools.d.ts.map +1 -1
- package/dist/lib/ai-service/research-tools.js +2 -2
- package/dist/lib/better-t-stack-cli.d.ts +1 -0
- package/dist/lib/better-t-stack-cli.d.ts.map +1 -1
- package/dist/lib/better-t-stack-cli.js +8 -2
- package/dist/lib/context-builder.d.ts +2 -1
- package/dist/lib/context-builder.d.ts.map +1 -1
- package/dist/lib/context-builder.js +3 -8
- package/dist/lib/hooks/logger.d.ts +2 -0
- package/dist/lib/hooks/logger.d.ts.map +1 -0
- package/dist/lib/hooks/logger.js +27 -0
- package/dist/lib/hooks.d.ts +64 -0
- package/dist/lib/hooks.d.ts.map +1 -0
- package/dist/lib/hooks.js +60 -0
- package/dist/lib/index.d.ts +18 -17
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +3 -3
- package/dist/lib/prompt-builder.d.ts.map +1 -1
- package/dist/lib/prompt-builder.js +16 -8
- package/dist/lib/{storage.d.ts → storage/file-system.d.ts} +4 -3
- package/dist/lib/storage/file-system.d.ts.map +1 -0
- package/dist/lib/{storage.js → storage/file-system.js} +141 -152
- package/dist/lib/storage/types.d.ts +43 -0
- package/dist/lib/storage/types.d.ts.map +1 -0
- package/dist/lib/storage/types.js +2 -0
- package/dist/lib/task-execution.d.ts.map +1 -1
- package/dist/lib/task-execution.js +22 -3
- package/dist/mcp/server.js +0 -0
- package/dist/prompts/workflow-assistance.d.ts +32 -0
- package/dist/prompts/workflow-assistance.d.ts.map +1 -0
- package/dist/prompts/workflow-assistance.js +130 -0
- package/dist/services/tasks.d.ts +4 -6
- package/dist/services/tasks.d.ts.map +1 -1
- package/dist/services/tasks.js +115 -96
- package/dist/services/workflow-ai-assistant.d.ts +74 -0
- package/dist/services/workflow-ai-assistant.d.ts.map +1 -0
- package/dist/services/workflow-ai-assistant.js +223 -0
- package/dist/test/hooks.test.d.ts +2 -0
- package/dist/test/hooks.test.d.ts.map +1 -0
- package/dist/test/hooks.test.js +58 -0
- package/dist/test/storage.test.js +16 -16
- package/dist/types/options.d.ts +35 -0
- package/dist/types/options.d.ts.map +1 -1
- package/dist/utils/ai-service-factory.d.ts +5 -5
- package/dist/utils/ai-service-factory.d.ts.map +1 -1
- package/dist/utils/ai-service-factory.js +4 -3
- package/dist/utils/workflow-prompts.d.ts +17 -0
- package/dist/utils/workflow-prompts.d.ts.map +1 -0
- package/dist/utils/workflow-prompts.js +88 -0
- package/package.json +4 -4
- package/dist/lib/storage.d.ts.map +0 -1
package/dist/commands/tasks.js
CHANGED
|
@@ -1,691 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.tasksCommand = void 0;
|
|
7
4
|
const commander_1 = require("commander");
|
|
8
|
-
const
|
|
9
|
-
const tasks_1 = require("../services/tasks");
|
|
10
|
-
const task_execution_1 = require("../lib/task-execution");
|
|
11
|
-
const streaming_options_1 = require("../utils/streaming-options");
|
|
12
|
-
const progress_1 = require("../cli/display/progress");
|
|
13
|
-
const task_1 = require("../cli/display/task");
|
|
14
|
-
const plan_1 = require("../cli/display/plan");
|
|
15
|
-
const common_1 = require("../cli/display/common");
|
|
5
|
+
const index_1 = require("./tasks/index");
|
|
16
6
|
exports.tasksCommand = new commander_1.Command("tasks");
|
|
17
|
-
|
|
18
|
-
exports.tasksCommand
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// Create task
|
|
40
|
-
exports.tasksCommand
|
|
41
|
-
.command("create")
|
|
42
|
-
.description("Create a new task with AI enhancement using Context7")
|
|
43
|
-
.requiredOption("--title <title>", "Task title")
|
|
44
|
-
.option("--content <content>", "Task content (supports markdown)")
|
|
45
|
-
.option("--effort <effort>", "Estimated effort (small/medium/large)")
|
|
46
|
-
.option("--parent-id <id>", "Parent task ID (creates subtask)")
|
|
47
|
-
.option("--ai-enhance", "Enhance task with AI using Context7 documentation")
|
|
48
|
-
.option("--stream", "Show streaming AI output during enhancement")
|
|
49
|
-
.option("--ai-provider <provider>", "AI provider override")
|
|
50
|
-
.option("--ai-model <model>", "AI model override")
|
|
51
|
-
.option("--ai-key <key>", "AI API key override")
|
|
52
|
-
.option("--ai-provider-url <url>", "AI provider URL override")
|
|
53
|
-
.option("--reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
|
|
54
|
-
.action(async (options) => {
|
|
55
|
-
try {
|
|
56
|
-
const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.aiEnhance && options.stream, "Enhancement");
|
|
57
|
-
const result = await tasks_1.taskService.createTask({
|
|
58
|
-
title: options.title,
|
|
59
|
-
content: options.content,
|
|
60
|
-
parentId: options.parentId,
|
|
61
|
-
effort: options.effort,
|
|
62
|
-
aiEnhance: options.aiEnhance,
|
|
63
|
-
aiOptions: {
|
|
64
|
-
aiProvider: options.aiProvider,
|
|
65
|
-
aiModel: options.aiModel,
|
|
66
|
-
aiKey: options.aiKey,
|
|
67
|
-
aiProviderUrl: options.aiProviderUrl,
|
|
68
|
-
aiReasoning: options.reasoning,
|
|
69
|
-
},
|
|
70
|
-
streamingOptions,
|
|
71
|
-
callbacks: {
|
|
72
|
-
onProgress: progress_1.displayProgress,
|
|
73
|
-
onError: progress_1.displayError,
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
(0, common_1.displayEnhancementResult)(options.aiEnhance && options.stream);
|
|
77
|
-
(0, task_1.displayCreatedTask)(result.task, result.aiMetadata);
|
|
78
|
-
}
|
|
79
|
-
catch (error) {
|
|
80
|
-
(0, progress_1.displayError)(error);
|
|
81
|
-
process.exit(1);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
// Show task details
|
|
85
|
-
exports.tasksCommand
|
|
86
|
-
.command("show")
|
|
87
|
-
.description("Show detailed information about a task")
|
|
88
|
-
.requiredOption("--id <id>", "Task ID")
|
|
89
|
-
.action(async (options) => {
|
|
90
|
-
try {
|
|
91
|
-
const task = await tasks_1.taskService.getTask(options.id);
|
|
92
|
-
if (!task) {
|
|
93
|
-
throw new Error(`Task with ID ${options.id} not found`);
|
|
94
|
-
}
|
|
95
|
-
await (0, task_1.displayTaskDetails)(task);
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
(0, progress_1.displayError)(error);
|
|
99
|
-
process.exit(1);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
// Document task
|
|
103
|
-
exports.tasksCommand
|
|
104
|
-
.command("document")
|
|
105
|
-
.description("Analyze and fetch documentation for a task using AI with Context7")
|
|
106
|
-
.requiredOption("--task-id <id>", "Task ID")
|
|
107
|
-
.option("--force", "Force refresh documentation even if recent")
|
|
108
|
-
.option("--stream", "Show streaming AI output during analysis")
|
|
109
|
-
.option("--ai-provider <provider>", "AI provider override")
|
|
110
|
-
.option("--ai-model <model>", "AI model override")
|
|
111
|
-
.option("--ai-key <key>", "AI API key override")
|
|
112
|
-
.option("--ai-provider-url <url>", "AI provider URL override")
|
|
113
|
-
.option("--reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
|
|
114
|
-
.action(async (options) => {
|
|
115
|
-
try {
|
|
116
|
-
const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.stream, "Analysis");
|
|
117
|
-
const result = await tasks_1.taskService.documentTask(options.taskId, options.force, {
|
|
118
|
-
aiProvider: options.aiProvider,
|
|
119
|
-
aiModel: options.aiModel,
|
|
120
|
-
aiKey: options.aiKey,
|
|
121
|
-
aiProviderUrl: options.aiProviderUrl,
|
|
122
|
-
aiReasoning: options.reasoning,
|
|
123
|
-
}, streamingOptions, {
|
|
124
|
-
onProgress: progress_1.displayProgress,
|
|
125
|
-
onError: progress_1.displayError,
|
|
126
|
-
});
|
|
127
|
-
if (result.documentation && !options.force) {
|
|
128
|
-
const daysSinceFetch = (Date.now() - result.documentation.lastFetched) / (24 * 60 * 60 * 1000);
|
|
129
|
-
console.log(chalk_1.default.green(`✓ Documentation is fresh (${Math.round(daysSinceFetch)} days old)`));
|
|
130
|
-
console.log(chalk_1.default.cyan(`Recap: ${result.documentation.recap}`));
|
|
131
|
-
console.log(chalk_1.default.blue(`Libraries: ${result.documentation.libraries.join(", ")}`));
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
if (result.analysis) {
|
|
135
|
-
(0, common_1.displayDocumentationAnalysis)(result.analysis);
|
|
136
|
-
}
|
|
137
|
-
if (result.documentation?.research) {
|
|
138
|
-
(0, common_1.displayResearchSummary)(result.documentation);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
catch (error) {
|
|
142
|
-
(0, progress_1.displayError)(error);
|
|
143
|
-
process.exit(1);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
// Enhance existing task
|
|
147
|
-
exports.tasksCommand
|
|
148
|
-
.command("enhance")
|
|
149
|
-
.description("Enhance an existing task with AI using Context7 documentation")
|
|
150
|
-
.option("--task-id <id>", "Task ID to enhance")
|
|
151
|
-
.option("--all", "Enhance all existing tasks")
|
|
152
|
-
.option("--stream", "Show streaming AI output during enhancement")
|
|
153
|
-
.option("--ai-provider <provider>", "AI provider override")
|
|
154
|
-
.option("--ai-model <model>", "AI model override")
|
|
155
|
-
.option("--ai-key <key>", "AI API key override")
|
|
156
|
-
.option("--ai-provider-url <url>", "AI provider URL override")
|
|
157
|
-
.option("--reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
|
|
158
|
-
.action(async (options) => {
|
|
159
|
-
try {
|
|
160
|
-
if (!options.taskId && !options.all) {
|
|
161
|
-
throw new Error("Either --task-id or --all must be specified");
|
|
162
|
-
}
|
|
163
|
-
if (options.taskId && options.all) {
|
|
164
|
-
throw new Error("Cannot specify both --task-id and --all");
|
|
165
|
-
}
|
|
166
|
-
const enhanceSingleTask = async (taskId) => {
|
|
167
|
-
const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.stream, "Enhancement");
|
|
168
|
-
const result = await tasks_1.taskService.enhanceTask(taskId, {
|
|
169
|
-
aiProvider: options.aiProvider,
|
|
170
|
-
aiModel: options.aiModel,
|
|
171
|
-
aiKey: options.aiKey,
|
|
172
|
-
aiProviderUrl: options.aiProviderUrl,
|
|
173
|
-
aiReasoning: options.reasoning,
|
|
174
|
-
}, streamingOptions, {
|
|
175
|
-
onProgress: progress_1.displayProgress,
|
|
176
|
-
onError: progress_1.displayError,
|
|
177
|
-
});
|
|
178
|
-
if (result.enhancedContent.length > 200) {
|
|
179
|
-
console.log(chalk_1.default.cyan(` Enhanced content saved to file.`));
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
console.log(chalk_1.default.cyan(` Enhanced content updated in task description.`));
|
|
183
|
-
}
|
|
184
|
-
console.log(chalk_1.default.green("✓ Task enhanced with Context7 documentation"));
|
|
185
|
-
console.log(chalk_1.default.magenta(` 🤖 Enhanced using Context7 MCP tools`));
|
|
186
|
-
};
|
|
187
|
-
if (options.taskId) {
|
|
188
|
-
await enhanceSingleTask(options.taskId);
|
|
189
|
-
}
|
|
190
|
-
else if (options.all) {
|
|
191
|
-
const allTasks = await tasks_1.taskService.listTasks({});
|
|
192
|
-
if (allTasks.length === 0) {
|
|
193
|
-
console.log(chalk_1.default.yellow("No tasks found to enhance."));
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
console.log(chalk_1.default.blue(`🤖 Enhancing ${allTasks.length} tasks in order...`));
|
|
197
|
-
for (let i = 0; i < allTasks.length; i++) {
|
|
198
|
-
const task = allTasks[i];
|
|
199
|
-
console.log(chalk_1.default.cyan(`\n[${i + 1}/${allTasks.length}] Enhancing: ${task.title} (${task.id})`));
|
|
200
|
-
try {
|
|
201
|
-
await enhanceSingleTask(task.id);
|
|
202
|
-
console.log(chalk_1.default.green(`✓ Enhanced task ${task.id}`));
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
console.log(chalk_1.default.red(`❌ Failed to enhance task ${task.id}: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
console.log(chalk_1.default.green(`\n✓ Bulk enhancement complete! Processed ${allTasks.length} tasks.`));
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
catch (error) {
|
|
212
|
-
(0, progress_1.displayError)(error);
|
|
213
|
-
process.exit(1);
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
// Split task into subtasks
|
|
217
|
-
exports.tasksCommand
|
|
218
|
-
.command("split")
|
|
219
|
-
.description("Split a task into smaller subtasks using AI")
|
|
220
|
-
.option("--task-id <id>", "Task ID to split")
|
|
221
|
-
.option("--all", "Split all existing tasks that don't have subtasks")
|
|
222
|
-
.option("--stream", "Show streaming AI output during breakdown")
|
|
223
|
-
.option("--ai-provider <provider>", "AI provider override")
|
|
224
|
-
.option("--ai-model <model>", "AI model override")
|
|
225
|
-
.option("--ai-key <key>", "AI API key override")
|
|
226
|
-
.option("--ai-provider-url <url>", "AI provider URL override")
|
|
227
|
-
.option("--reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
|
|
228
|
-
.option("--tools", "Enable filesystem tools for project analysis")
|
|
229
|
-
.action(async (options) => {
|
|
230
|
-
try {
|
|
231
|
-
if (!options.taskId && !options.all) {
|
|
232
|
-
throw new Error("Either --task-id or --all must be specified");
|
|
233
|
-
}
|
|
234
|
-
if (options.taskId && options.all) {
|
|
235
|
-
throw new Error("Cannot specify both --task-id and --all");
|
|
236
|
-
}
|
|
237
|
-
const splitSingleTask = async (taskId) => {
|
|
238
|
-
const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.stream, "Task breakdown");
|
|
239
|
-
try {
|
|
240
|
-
const result = await tasks_1.taskService.splitTask(taskId, {
|
|
241
|
-
aiProvider: options.aiProvider,
|
|
242
|
-
aiModel: options.aiModel,
|
|
243
|
-
aiKey: options.aiKey,
|
|
244
|
-
aiProviderUrl: options.aiProviderUrl,
|
|
245
|
-
aiReasoning: options.reasoning,
|
|
246
|
-
}, undefined, undefined, streamingOptions, {
|
|
247
|
-
onProgress: progress_1.displayProgress,
|
|
248
|
-
onError: progress_1.displayError,
|
|
249
|
-
}, options.tools);
|
|
250
|
-
(0, task_1.displaySubtaskCreation)(result.subtasks);
|
|
251
|
-
// Display AI metadata
|
|
252
|
-
console.log(chalk_1.default.gray(`\n📊 AI Splitting Details:`));
|
|
253
|
-
console.log(chalk_1.default.gray(` Provider: ${result.metadata.aiProvider}`));
|
|
254
|
-
console.log(chalk_1.default.gray(` Model: ${result.metadata.aiModel}`));
|
|
255
|
-
console.log(chalk_1.default.gray(` Subtasks created: ${result.subtasks.length}`));
|
|
256
|
-
console.log(chalk_1.default.gray(` Confidence: ${result.metadata.confidence ? (result.metadata.confidence * 100).toFixed(1) : "N/A"}%`));
|
|
257
|
-
}
|
|
258
|
-
catch (error) {
|
|
259
|
-
if (error instanceof Error && error.message.includes("already has")) {
|
|
260
|
-
console.log(chalk_1.default.yellow(`⚠️ ${error.message}`));
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
throw error;
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
if (options.taskId) {
|
|
267
|
-
await splitSingleTask(options.taskId);
|
|
268
|
-
}
|
|
269
|
-
else if (options.all) {
|
|
270
|
-
const allTasks = await tasks_1.taskService.listTasks({});
|
|
271
|
-
if (allTasks.length === 0) {
|
|
272
|
-
console.log(chalk_1.default.yellow("No tasks found to split."));
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
console.log(chalk_1.default.blue(`🔧 Splitting ${allTasks.length} tasks...`));
|
|
276
|
-
for (let i = 0; i < allTasks.length; i++) {
|
|
277
|
-
const task = allTasks[i];
|
|
278
|
-
console.log(chalk_1.default.cyan(`\n[${i + 1}/${allTasks.length}] Splitting: ${task.title}`));
|
|
279
|
-
try {
|
|
280
|
-
await splitSingleTask(task.id);
|
|
281
|
-
}
|
|
282
|
-
catch (error) {
|
|
283
|
-
console.log(chalk_1.default.red(`❌ Failed to split task ${task.id}: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
console.log(chalk_1.default.green(`\n✓ Bulk splitting complete! Processed ${allTasks.length} tasks.`));
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
catch (error) {
|
|
290
|
-
(0, progress_1.displayError)(error);
|
|
291
|
-
process.exit(1);
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
// Plan task implementation
|
|
295
|
-
exports.tasksCommand
|
|
296
|
-
.command("plan")
|
|
297
|
-
.description("Create detailed implementation plan for a task or subtask")
|
|
298
|
-
.requiredOption("--id <id>", "Task or subtask ID to plan")
|
|
299
|
-
.option("--stream", "Show streaming AI output during planning")
|
|
300
|
-
.option("--ai-provider <provider>", "AI provider override")
|
|
301
|
-
.option("--ai-model <model>", "AI model override")
|
|
302
|
-
.option("--ai-key <key>", "AI API key override")
|
|
303
|
-
.option("--ai-provider-url <url>", "AI provider URL override")
|
|
304
|
-
.option("--reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
|
|
305
|
-
.action(async (options) => {
|
|
306
|
-
try {
|
|
307
|
-
const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.stream, "Planning");
|
|
308
|
-
const result = await tasks_1.taskService.planTask(options.id, {
|
|
309
|
-
aiProvider: options.aiProvider,
|
|
310
|
-
aiModel: options.aiModel,
|
|
311
|
-
aiKey: options.aiKey,
|
|
312
|
-
aiProviderUrl: options.aiProviderUrl,
|
|
313
|
-
aiReasoning: options.reasoning,
|
|
314
|
-
}, streamingOptions, {
|
|
315
|
-
onProgress: progress_1.displayProgress,
|
|
316
|
-
onError: progress_1.displayError,
|
|
317
|
-
});
|
|
318
|
-
// Display the plan
|
|
319
|
-
(0, plan_1.displayPlanCreation)(options.id, result.task.title);
|
|
320
|
-
console.log(chalk_1.default.cyan(result.plan));
|
|
321
|
-
}
|
|
322
|
-
catch (error) {
|
|
323
|
-
(0, progress_1.displayError)(error);
|
|
324
|
-
process.exit(1);
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
// Get plan command
|
|
328
|
-
exports.tasksCommand
|
|
329
|
-
.command("get-plan")
|
|
330
|
-
.description("View existing implementation plan for a task or subtask")
|
|
331
|
-
.requiredOption("--id <id>", "Task or subtask ID")
|
|
332
|
-
.action(async (options) => {
|
|
333
|
-
try {
|
|
334
|
-
const plan = await tasks_1.taskService.getTaskPlan(options.id);
|
|
335
|
-
if (!plan) {
|
|
336
|
-
console.log(chalk_1.default.yellow(`⚠️ No plan found for task/subtask ${options.id}`));
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
const task = await tasks_1.taskService.getTask(options.id);
|
|
340
|
-
const taskTitle = task ? task.title : options.id;
|
|
341
|
-
(0, plan_1.displayPlanView)(taskTitle, options.id, plan.plan, plan.createdAt, plan.updatedAt);
|
|
342
|
-
}
|
|
343
|
-
catch (error) {
|
|
344
|
-
(0, progress_1.displayError)(error);
|
|
345
|
-
process.exit(1);
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
// List plans command
|
|
349
|
-
exports.tasksCommand
|
|
350
|
-
.command("list-plan")
|
|
351
|
-
.description("List all available implementation plans")
|
|
352
|
-
.action(async () => {
|
|
353
|
-
try {
|
|
354
|
-
const plans = await tasks_1.taskService.listTaskPlans();
|
|
355
|
-
// Get task titles for each plan
|
|
356
|
-
const plansWithTitles = await Promise.all(plans.map(async (plan) => {
|
|
357
|
-
const task = await tasks_1.taskService.getTask(plan.taskId);
|
|
358
|
-
return {
|
|
359
|
-
...plan,
|
|
360
|
-
taskTitle: task ? task.title : plan.taskId,
|
|
361
|
-
};
|
|
362
|
-
}));
|
|
363
|
-
(0, plan_1.displayPlanList)(plansWithTitles);
|
|
364
|
-
}
|
|
365
|
-
catch (error) {
|
|
366
|
-
(0, progress_1.displayError)(error);
|
|
367
|
-
process.exit(1);
|
|
368
|
-
}
|
|
369
|
-
});
|
|
370
|
-
// Update task command
|
|
371
|
-
exports.tasksCommand
|
|
372
|
-
.command("update")
|
|
373
|
-
.description("Update an existing task")
|
|
374
|
-
.requiredOption("--id <id>", "Task ID to update")
|
|
375
|
-
.option("--title <title>", "New task title")
|
|
376
|
-
.option("--description <description>", "New task description")
|
|
377
|
-
.option("--status <status>", "New status (todo/in-progress/completed)")
|
|
378
|
-
.option("--effort <effort>", "New estimated effort (small/medium/large)")
|
|
379
|
-
.option("--tags <tags>", "New tags (comma-separated)")
|
|
380
|
-
.action(async (options) => {
|
|
381
|
-
try {
|
|
382
|
-
const { id, ...updates } = options;
|
|
383
|
-
if (Object.keys(updates).length === 0) {
|
|
384
|
-
throw new Error("At least one field must be specified for update");
|
|
385
|
-
}
|
|
386
|
-
const updatedTask = await tasks_1.taskService.updateTask(id, {
|
|
387
|
-
title: updates.title,
|
|
388
|
-
description: updates.description,
|
|
389
|
-
status: updates.status,
|
|
390
|
-
effort: updates.effort,
|
|
391
|
-
tags: updates.tags,
|
|
392
|
-
});
|
|
393
|
-
(0, task_1.displayTaskUpdate)(updatedTask, updates);
|
|
394
|
-
}
|
|
395
|
-
catch (error) {
|
|
396
|
-
(0, progress_1.displayError)(error);
|
|
397
|
-
process.exit(1);
|
|
398
|
-
}
|
|
399
|
-
});
|
|
400
|
-
// Delete task command
|
|
401
|
-
exports.tasksCommand
|
|
402
|
-
.command("delete")
|
|
403
|
-
.description("Delete a task")
|
|
404
|
-
.requiredOption("--id <id>", "Task ID to delete")
|
|
405
|
-
.option("--force", "Skip confirmation and delete anyway")
|
|
406
|
-
.option("--cascade", "Delete all subtasks as well")
|
|
407
|
-
.action(async (options) => {
|
|
408
|
-
try {
|
|
409
|
-
if (!options.force) {
|
|
410
|
-
const task = await tasks_1.taskService.getTask(options.id);
|
|
411
|
-
if (!task) {
|
|
412
|
-
throw new Error(`Task with ID ${options.id} not found`);
|
|
413
|
-
}
|
|
414
|
-
console.log(chalk_1.default.red(`\n⚠️ Are you sure you want to delete task: ${task.title} (${task.id})?`));
|
|
415
|
-
console.log(chalk_1.default.red("This action cannot be undone."));
|
|
416
|
-
// Simple confirmation - in a real CLI you might want a proper prompt
|
|
417
|
-
console.log(chalk_1.default.yellow("Use --force to confirm deletion."));
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
const result = await tasks_1.taskService.deleteTask(options.id, {
|
|
421
|
-
cascade: options.cascade,
|
|
422
|
-
force: options.force,
|
|
423
|
-
});
|
|
424
|
-
(0, task_1.displayTaskDelete)(result.deleted, result.orphanedSubtasks);
|
|
425
|
-
}
|
|
426
|
-
catch (error) {
|
|
427
|
-
(0, progress_1.displayError)(error);
|
|
428
|
-
process.exit(1);
|
|
429
|
-
}
|
|
430
|
-
});
|
|
431
|
-
// Set status command
|
|
432
|
-
exports.tasksCommand
|
|
433
|
-
.command("status")
|
|
434
|
-
.description("Set task status")
|
|
435
|
-
.requiredOption("--id <id>", "Task ID")
|
|
436
|
-
.requiredOption("--status <status>", "New status (todo/in-progress/completed)")
|
|
437
|
-
.action(async (options) => {
|
|
438
|
-
try {
|
|
439
|
-
const task = await tasks_1.taskService.getTask(options.id);
|
|
440
|
-
if (!task) {
|
|
441
|
-
throw new Error(`Task with ID ${options.id} not found`);
|
|
442
|
-
}
|
|
443
|
-
const oldStatus = task.status;
|
|
444
|
-
const updatedTask = await tasks_1.taskService.setTaskStatus(options.id, options.status);
|
|
445
|
-
(0, task_1.displayTaskStatusChange)(updatedTask, oldStatus, options.status);
|
|
446
|
-
}
|
|
447
|
-
catch (error) {
|
|
448
|
-
(0, progress_1.displayError)(error);
|
|
449
|
-
process.exit(1);
|
|
450
|
-
}
|
|
451
|
-
});
|
|
452
|
-
// Add tags command
|
|
453
|
-
exports.tasksCommand
|
|
454
|
-
.command("add-tags")
|
|
455
|
-
.description("Add tags to a task")
|
|
456
|
-
.requiredOption("--id <id>", "Task ID")
|
|
457
|
-
.requiredOption("--tags <tags>", "Tags to add (comma-separated)")
|
|
458
|
-
.action(async (options) => {
|
|
459
|
-
try {
|
|
460
|
-
const tags = options.tags.split(',').map((tag) => tag.trim());
|
|
461
|
-
const updatedTask = await tasks_1.taskService.addTags(options.id, tags);
|
|
462
|
-
(0, task_1.displayTagsUpdate)(updatedTask, tags, []);
|
|
463
|
-
}
|
|
464
|
-
catch (error) {
|
|
465
|
-
(0, progress_1.displayError)(error);
|
|
466
|
-
process.exit(1);
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
// Remove tags command
|
|
470
|
-
exports.tasksCommand
|
|
471
|
-
.command("remove-tags")
|
|
472
|
-
.description("Remove tags from a task")
|
|
473
|
-
.requiredOption("--id <id>", "Task ID")
|
|
474
|
-
.requiredOption("--tags <tags>", "Tags to remove (comma-separated)")
|
|
475
|
-
.action(async (options) => {
|
|
476
|
-
try {
|
|
477
|
-
const tags = options.tags.split(',').map((tag) => tag.trim());
|
|
478
|
-
const updatedTask = await tasks_1.taskService.removeTags(options.id, tags);
|
|
479
|
-
(0, task_1.displayTagsUpdate)(updatedTask, [], tags);
|
|
480
|
-
}
|
|
481
|
-
catch (error) {
|
|
482
|
-
(0, progress_1.displayError)(error);
|
|
483
|
-
process.exit(1);
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
// Delete plan command
|
|
487
|
-
exports.tasksCommand
|
|
488
|
-
.command("delete-plan")
|
|
489
|
-
.description("Delete implementation plan for a task")
|
|
490
|
-
.requiredOption("--id <id>", "Task ID")
|
|
491
|
-
.action(async (options) => {
|
|
492
|
-
try {
|
|
493
|
-
const success = await tasks_1.taskService.deleteTaskPlan(options.id);
|
|
494
|
-
(0, plan_1.displayPlanDeletion)(options.id, success);
|
|
495
|
-
}
|
|
496
|
-
catch (error) {
|
|
497
|
-
(0, progress_1.displayError)(error);
|
|
498
|
-
process.exit(1);
|
|
499
|
-
}
|
|
500
|
-
});
|
|
501
|
-
// List subtasks command
|
|
502
|
-
exports.tasksCommand
|
|
503
|
-
.command("subtasks")
|
|
504
|
-
.description("List subtasks for a task")
|
|
505
|
-
.requiredOption("--id <id>", "Parent task ID")
|
|
506
|
-
.action(async (options) => {
|
|
507
|
-
try {
|
|
508
|
-
const subtasks = await tasks_1.taskService.getSubtasks(options.id);
|
|
509
|
-
if (subtasks.length === 0) {
|
|
510
|
-
console.log(chalk_1.default.yellow(`No subtasks found for task ${options.id}`));
|
|
511
|
-
return;
|
|
512
|
-
}
|
|
513
|
-
const parentTask = await tasks_1.taskService.getTask(options.id);
|
|
514
|
-
const parentTitle = parentTask ? parentTask.title : options.id;
|
|
515
|
-
console.log(chalk_1.default.blue(`\n📋 Subtasks for ${parentTitle} (${options.id}):`));
|
|
516
|
-
console.log("");
|
|
517
|
-
for (let i = 0; i < subtasks.length; i++) {
|
|
518
|
-
const subtask = subtasks[i];
|
|
519
|
-
await (0, task_1.displayTask)(subtask, { indent: ' ', showSubtasks: false });
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
catch (error) {
|
|
523
|
-
(0, progress_1.displayError)(error);
|
|
524
|
-
process.exit(1);
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
// Task tree command
|
|
528
|
-
exports.tasksCommand
|
|
529
|
-
.command("tree")
|
|
530
|
-
.description("Display hierarchical task tree")
|
|
531
|
-
.option("--id <id>", "Root task ID (optional - shows full tree if not specified)")
|
|
532
|
-
.action(async (options) => {
|
|
533
|
-
try {
|
|
534
|
-
const tasks = await tasks_1.taskService.getTaskTree(options.id);
|
|
535
|
-
await (0, task_1.displayTaskTree)(tasks, options.id);
|
|
536
|
-
}
|
|
537
|
-
catch (error) {
|
|
538
|
-
(0, progress_1.displayError)(error);
|
|
539
|
-
process.exit(1);
|
|
540
|
-
}
|
|
541
|
-
});
|
|
542
|
-
// Get next task command
|
|
543
|
-
exports.tasksCommand
|
|
544
|
-
.command("get-next")
|
|
545
|
-
.description("Get the next task to work on (defaults to hierarchical order)")
|
|
546
|
-
.option("--status <status>", "Filter by status (todo/in-progress)")
|
|
547
|
-
.option("--tag <tag>", "Filter by tag")
|
|
548
|
-
.option("--effort <effort>", "Filter by effort (small/medium/large)")
|
|
549
|
-
.option("--priority <priority>", "Sort priority (newest/oldest/effort)", "hierarchical")
|
|
550
|
-
.action(async (options) => {
|
|
551
|
-
try {
|
|
552
|
-
// Default to todo status if not specified
|
|
553
|
-
const searchOptions = {
|
|
554
|
-
...options,
|
|
555
|
-
status: options.status || "todo"
|
|
556
|
-
};
|
|
557
|
-
const nextTask = await tasks_1.taskService.getNextTask(searchOptions);
|
|
558
|
-
if (!nextTask) {
|
|
559
|
-
console.log(chalk_1.default.yellow("No tasks found matching the criteria."));
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
const criteria = [
|
|
563
|
-
searchOptions.status && `status: ${searchOptions.status}`,
|
|
564
|
-
options.tag && `tag: ${options.tag}`,
|
|
565
|
-
options.effort && `effort: ${options.effort}`,
|
|
566
|
-
options.priority && `priority: ${options.priority}`
|
|
567
|
-
].filter(Boolean).join(", ");
|
|
568
|
-
(0, task_1.displayNextTask)(nextTask, criteria || "next todo task");
|
|
569
|
-
}
|
|
570
|
-
catch (error) {
|
|
571
|
-
(0, progress_1.displayError)(error);
|
|
572
|
-
process.exit(1);
|
|
573
|
-
}
|
|
574
|
-
});
|
|
575
|
-
// Execute task command
|
|
576
|
-
exports.tasksCommand
|
|
577
|
-
.command("execute")
|
|
578
|
-
.description("Execute a task using an external coding assistant")
|
|
579
|
-
.requiredOption("--id <id>", "Task ID to execute")
|
|
580
|
-
.option("--tool <tool>", "External tool to use (opencode/claude/gemini/codex)", "opencode")
|
|
581
|
-
.option("--message <message>", "Custom message to send to the tool (uses task plan if not provided)")
|
|
582
|
-
.option("--dry", "Show what would be executed without running it")
|
|
583
|
-
.option("--validate <command>", "Validation command to run after execution (can be used multiple times)", (value, previous = []) => {
|
|
584
|
-
return [...previous, value];
|
|
585
|
-
})
|
|
586
|
-
.action(async (options) => {
|
|
587
|
-
try {
|
|
588
|
-
await (0, task_execution_1.executeTask)({
|
|
589
|
-
taskId: options.id,
|
|
590
|
-
tool: options.tool,
|
|
591
|
-
message: options.message,
|
|
592
|
-
dry: options.dry,
|
|
593
|
-
validate: options.validate || [],
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
catch (error) {
|
|
597
|
-
console.error(chalk_1.default.red("Execution failed:"), error instanceof Error ? error.message : "Unknown error");
|
|
598
|
-
process.exit(1);
|
|
599
|
-
}
|
|
600
|
-
});
|
|
601
|
-
// Get task documentation
|
|
602
|
-
exports.tasksCommand
|
|
603
|
-
.command("get-documentation")
|
|
604
|
-
.description("Get existing documentation for a task")
|
|
605
|
-
.requiredOption("--id <id>", "Task ID")
|
|
606
|
-
.action(async (options) => {
|
|
607
|
-
try {
|
|
608
|
-
const task = await tasks_1.taskService.getTask(options.id);
|
|
609
|
-
if (!task) {
|
|
610
|
-
throw new Error(`Task with ID ${options.id} not found`);
|
|
611
|
-
}
|
|
612
|
-
const documentation = await tasks_1.taskService.getTaskDocumentation(options.id);
|
|
613
|
-
if (!documentation) {
|
|
614
|
-
console.log(chalk_1.default.yellow(`⚠️ No documentation found for task ${options.id}`));
|
|
615
|
-
console.log(chalk_1.default.gray(` Task: ${task.title}`));
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
|
-
console.log(chalk_1.default.blue(`\n📖 Documentation for Task: ${task.title} (${options.id})`));
|
|
619
|
-
console.log(chalk_1.default.gray(` File: .task-o-matic/docs/tasks/${options.id}.md`));
|
|
620
|
-
console.log("");
|
|
621
|
-
console.log(documentation);
|
|
622
|
-
}
|
|
623
|
-
catch (error) {
|
|
624
|
-
(0, progress_1.displayError)(error);
|
|
625
|
-
process.exit(1);
|
|
626
|
-
}
|
|
627
|
-
});
|
|
628
|
-
// Add documentation from file
|
|
629
|
-
exports.tasksCommand
|
|
630
|
-
.command("add-documentation")
|
|
631
|
-
.description("Add documentation to a task from a file")
|
|
632
|
-
.requiredOption("--id <id>", "Task ID")
|
|
633
|
-
.requiredOption("--doc-file <path>", "Path to documentation file")
|
|
634
|
-
.option("--overwrite", "Overwrite existing documentation")
|
|
635
|
-
.action(async (options) => {
|
|
636
|
-
try {
|
|
637
|
-
const task = await tasks_1.taskService.getTask(options.id);
|
|
638
|
-
if (!task) {
|
|
639
|
-
throw new Error(`Task with ID ${options.id} not found`);
|
|
640
|
-
}
|
|
641
|
-
// Check if documentation already exists
|
|
642
|
-
const existingDoc = await tasks_1.taskService.getTaskDocumentation(options.id);
|
|
643
|
-
if (existingDoc && !options.overwrite) {
|
|
644
|
-
console.log(chalk_1.default.yellow(`⚠️ Documentation already exists for task ${options.id}`));
|
|
645
|
-
console.log(chalk_1.default.gray(` Use --overwrite to replace existing documentation`));
|
|
646
|
-
return;
|
|
647
|
-
}
|
|
648
|
-
const result = await tasks_1.taskService.addTaskDocumentationFromFile(options.id, options.docFile);
|
|
649
|
-
console.log(chalk_1.default.green(`✓ Documentation added to task: ${task.title} (${options.id})`));
|
|
650
|
-
console.log(chalk_1.default.gray(` Source file: ${options.docFile}`));
|
|
651
|
-
console.log(chalk_1.default.gray(` Saved to: ${result.filePath}`));
|
|
652
|
-
if (options.overwrite) {
|
|
653
|
-
console.log(chalk_1.default.cyan(` Previous documentation was overwritten`));
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
catch (error) {
|
|
657
|
-
(0, progress_1.displayError)(error);
|
|
658
|
-
process.exit(1);
|
|
659
|
-
}
|
|
660
|
-
});
|
|
661
|
-
// Set task plan
|
|
662
|
-
exports.tasksCommand
|
|
663
|
-
.command("set-plan")
|
|
664
|
-
.description("Set implementation plan for a task")
|
|
665
|
-
.requiredOption("--id <id>", "Task ID")
|
|
666
|
-
.option("--plan <text>", "Plan text (use quotes for multi-line)")
|
|
667
|
-
.option("--plan-file <path>", "Path to file containing the plan")
|
|
668
|
-
.action(async (options) => {
|
|
669
|
-
try {
|
|
670
|
-
const task = await tasks_1.taskService.getTask(options.id);
|
|
671
|
-
if (!task) {
|
|
672
|
-
throw new Error(`Task with ID ${options.id} not found`);
|
|
673
|
-
}
|
|
674
|
-
if (!options.plan && !options.planFile) {
|
|
675
|
-
throw new Error("Either --plan or --plan-file must be specified");
|
|
676
|
-
}
|
|
677
|
-
if (options.plan && options.planFile) {
|
|
678
|
-
throw new Error("Cannot specify both --plan and --plan-file");
|
|
679
|
-
}
|
|
680
|
-
const result = await tasks_1.taskService.setTaskPlan(options.id, options.plan || undefined, options.planFile || undefined);
|
|
681
|
-
console.log(chalk_1.default.green(`✓ Plan set for task: ${task.title} (${options.id})`));
|
|
682
|
-
console.log(chalk_1.default.gray(` Plan file: ${result.planFile}`));
|
|
683
|
-
if (options.planFile) {
|
|
684
|
-
console.log(chalk_1.default.gray(` Source file: ${options.planFile}`));
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
catch (error) {
|
|
688
|
-
(0, progress_1.displayError)(error);
|
|
689
|
-
process.exit(1);
|
|
690
|
-
}
|
|
691
|
-
});
|
|
7
|
+
exports.tasksCommand.addCommand(index_1.listCommand);
|
|
8
|
+
exports.tasksCommand.addCommand(index_1.createCommand);
|
|
9
|
+
exports.tasksCommand.addCommand(index_1.showCommand);
|
|
10
|
+
exports.tasksCommand.addCommand(index_1.updateCommand);
|
|
11
|
+
exports.tasksCommand.addCommand(index_1.deleteCommand);
|
|
12
|
+
exports.tasksCommand.addCommand(index_1.statusCommand);
|
|
13
|
+
exports.tasksCommand.addCommand(index_1.addTagsCommand);
|
|
14
|
+
exports.tasksCommand.addCommand(index_1.removeTagsCommand);
|
|
15
|
+
exports.tasksCommand.addCommand(index_1.planCommand);
|
|
16
|
+
exports.tasksCommand.addCommand(index_1.getPlanCommand);
|
|
17
|
+
exports.tasksCommand.addCommand(index_1.listPlanCommand);
|
|
18
|
+
exports.tasksCommand.addCommand(index_1.deletePlanCommand);
|
|
19
|
+
exports.tasksCommand.addCommand(index_1.setPlanCommand);
|
|
20
|
+
exports.tasksCommand.addCommand(index_1.enhanceCommand);
|
|
21
|
+
exports.tasksCommand.addCommand(index_1.splitCommand);
|
|
22
|
+
exports.tasksCommand.addCommand(index_1.documentCommand);
|
|
23
|
+
exports.tasksCommand.addCommand(index_1.getDocumentationCommand);
|
|
24
|
+
exports.tasksCommand.addCommand(index_1.addDocumentationCommand);
|
|
25
|
+
exports.tasksCommand.addCommand(index_1.executeCommand);
|
|
26
|
+
exports.tasksCommand.addCommand(index_1.subtasksCommand);
|
|
27
|
+
exports.tasksCommand.addCommand(index_1.treeCommand);
|
|
28
|
+
exports.tasksCommand.addCommand(index_1.nextCommand);
|