task-o-matic 0.0.3 → 0.0.4

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.
Files changed (105) hide show
  1. package/README.md +96 -40
  2. package/dist/commands/tasks/create.d.ts +3 -0
  3. package/dist/commands/tasks/create.d.ts.map +1 -0
  4. package/dist/commands/tasks/create.js +58 -0
  5. package/dist/commands/tasks/delete.d.ts +3 -0
  6. package/dist/commands/tasks/delete.d.ts.map +1 -0
  7. package/dist/commands/tasks/delete.js +40 -0
  8. package/dist/commands/tasks/document.d.ts +5 -0
  9. package/dist/commands/tasks/document.d.ts.map +1 -0
  10. package/dist/commands/tasks/document.js +118 -0
  11. package/dist/commands/tasks/enhance.d.ts +3 -0
  12. package/dist/commands/tasks/enhance.d.ts.map +1 -0
  13. package/dist/commands/tasks/enhance.js +86 -0
  14. package/dist/commands/tasks/execute.d.ts +3 -0
  15. package/dist/commands/tasks/execute.d.ts.map +1 -0
  16. package/dist/commands/tasks/execute.js +33 -0
  17. package/dist/commands/tasks/index.d.ts +16 -0
  18. package/dist/commands/tasks/index.d.ts.map +1 -0
  19. package/dist/commands/tasks/index.js +31 -0
  20. package/dist/commands/tasks/list.d.ts +3 -0
  21. package/dist/commands/tasks/list.d.ts.map +1 -0
  22. package/dist/commands/tasks/list.js +27 -0
  23. package/dist/commands/tasks/next.d.ts +3 -0
  24. package/dist/commands/tasks/next.d.ts.map +1 -0
  25. package/dist/commands/tasks/next.js +44 -0
  26. package/dist/commands/tasks/plan.d.ts +7 -0
  27. package/dist/commands/tasks/plan.d.ts.map +1 -0
  28. package/dist/commands/tasks/plan.js +131 -0
  29. package/dist/commands/tasks/show.d.ts +3 -0
  30. package/dist/commands/tasks/show.d.ts.map +1 -0
  31. package/dist/commands/tasks/show.js +23 -0
  32. package/dist/commands/tasks/split.d.ts +3 -0
  33. package/dist/commands/tasks/split.d.ts.map +1 -0
  34. package/dist/commands/tasks/split.js +95 -0
  35. package/dist/commands/tasks/status.d.ts +3 -0
  36. package/dist/commands/tasks/status.d.ts.map +1 -0
  37. package/dist/commands/tasks/status.js +26 -0
  38. package/dist/commands/tasks/subtasks.d.ts +3 -0
  39. package/dist/commands/tasks/subtasks.d.ts.map +1 -0
  40. package/dist/commands/tasks/subtasks.js +35 -0
  41. package/dist/commands/tasks/tags.d.ts +4 -0
  42. package/dist/commands/tasks/tags.d.ts.map +1 -0
  43. package/dist/commands/tasks/tags.js +37 -0
  44. package/dist/commands/tasks/tree.d.ts +3 -0
  45. package/dist/commands/tasks/tree.d.ts.map +1 -0
  46. package/dist/commands/tasks/tree.js +20 -0
  47. package/dist/commands/tasks/update.d.ts +3 -0
  48. package/dist/commands/tasks/update.d.ts.map +1 -0
  49. package/dist/commands/tasks/update.js +35 -0
  50. package/dist/commands/tasks.d.ts.map +1 -1
  51. package/dist/commands/tasks.js +23 -686
  52. package/dist/commands/workflow.d.ts +4 -0
  53. package/dist/commands/workflow.d.ts.map +1 -0
  54. package/dist/commands/workflow.js +434 -0
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +3 -1
  57. package/dist/lib/ai-service/ai-operations.d.ts.map +1 -1
  58. package/dist/lib/ai-service/ai-operations.js +54 -22
  59. package/dist/lib/ai-service/research-tools.d.ts.map +1 -1
  60. package/dist/lib/ai-service/research-tools.js +2 -2
  61. package/dist/lib/context-builder.d.ts +2 -1
  62. package/dist/lib/context-builder.d.ts.map +1 -1
  63. package/dist/lib/context-builder.js +3 -8
  64. package/dist/lib/hooks/logger.d.ts +2 -0
  65. package/dist/lib/hooks/logger.d.ts.map +1 -0
  66. package/dist/lib/hooks/logger.js +27 -0
  67. package/dist/lib/hooks.d.ts +64 -0
  68. package/dist/lib/hooks.d.ts.map +1 -0
  69. package/dist/lib/hooks.js +60 -0
  70. package/dist/lib/index.d.ts +18 -17
  71. package/dist/lib/index.d.ts.map +1 -1
  72. package/dist/lib/index.js +3 -3
  73. package/dist/lib/prompt-builder.d.ts.map +1 -1
  74. package/dist/lib/prompt-builder.js +16 -8
  75. package/dist/lib/{storage.d.ts → storage/file-system.d.ts} +4 -3
  76. package/dist/lib/storage/file-system.d.ts.map +1 -0
  77. package/dist/lib/{storage.js → storage/file-system.js} +141 -152
  78. package/dist/lib/storage/types.d.ts +43 -0
  79. package/dist/lib/storage/types.d.ts.map +1 -0
  80. package/dist/lib/storage/types.js +2 -0
  81. package/dist/lib/task-execution.d.ts.map +1 -1
  82. package/dist/lib/task-execution.js +22 -3
  83. package/dist/prompts/workflow-assistance.d.ts +32 -0
  84. package/dist/prompts/workflow-assistance.d.ts.map +1 -0
  85. package/dist/prompts/workflow-assistance.js +130 -0
  86. package/dist/services/tasks.d.ts +4 -6
  87. package/dist/services/tasks.d.ts.map +1 -1
  88. package/dist/services/tasks.js +115 -96
  89. package/dist/services/workflow-ai-assistant.d.ts +74 -0
  90. package/dist/services/workflow-ai-assistant.d.ts.map +1 -0
  91. package/dist/services/workflow-ai-assistant.js +223 -0
  92. package/dist/test/hooks.test.d.ts +2 -0
  93. package/dist/test/hooks.test.d.ts.map +1 -0
  94. package/dist/test/hooks.test.js +58 -0
  95. package/dist/test/storage.test.js +16 -16
  96. package/dist/types/options.d.ts +35 -0
  97. package/dist/types/options.d.ts.map +1 -1
  98. package/dist/utils/ai-service-factory.d.ts +5 -5
  99. package/dist/utils/ai-service-factory.d.ts.map +1 -1
  100. package/dist/utils/ai-service-factory.js +4 -3
  101. package/dist/utils/workflow-prompts.d.ts +17 -0
  102. package/dist/utils/workflow-prompts.d.ts.map +1 -0
  103. package/dist/utils/workflow-prompts.js +88 -0
  104. package/package.json +2 -2
  105. package/dist/lib/storage.d.ts.map +0 -1
package/README.md CHANGED
@@ -5,6 +5,7 @@ AI-powered task management for CLI, TUI, and web applications. Parse PRDs, enhan
5
5
  ## ✨ Features
6
6
 
7
7
  - 🤖 **AI-Powered**: Parse PRDs and enhance tasks using multiple AI providers
8
+ - 🎭 **Interactive Workflow**: Guided setup from project init to task generation with AI assistance
8
9
  - 📦 **Multi-Purpose Package**: Use as CLI tool, library, or MCP server
9
10
  - 📁 **Project-Local Storage**: All data stored locally in `.task-o-matic/` directory
10
11
  - 🎯 **Task Management**: Full CRUD operations with AI enhancement
@@ -102,36 +103,41 @@ npm install task-o-matic
102
103
  #### Basic Example
103
104
 
104
105
  ```typescript
105
- import { TaskService, PRDService, type Task, type AIConfig } from 'task-o-matic';
106
+ import {
107
+ TaskService,
108
+ PRDService,
109
+ type Task,
110
+ type AIConfig,
111
+ } from "task-o-matic";
106
112
 
107
113
  // Initialize the service
108
114
  const taskService = new TaskService();
109
115
 
110
116
  // Create a task with AI enhancement
111
117
  const result = await taskService.createTask({
112
- title: 'Implement user authentication',
113
- content: 'Add login and signup functionality',
118
+ title: "Implement user authentication",
119
+ content: "Add login and signup functionality",
114
120
  aiEnhance: true,
115
121
  aiOptions: {
116
- provider: 'anthropic',
117
- model: 'claude-3-5-sonnet',
118
- apiKey: process.env.ANTHROPIC_API_KEY
122
+ provider: "anthropic",
123
+ model: "claude-3-5-sonnet",
124
+ apiKey: process.env.ANTHROPIC_API_KEY,
119
125
  },
120
126
  callbacks: {
121
127
  onProgress: (event) => {
122
128
  console.log(`Progress: ${event.message}`);
123
- }
124
- }
129
+ },
130
+ },
125
131
  });
126
132
 
127
- console.log('Task created:', result.task);
133
+ console.log("Task created:", result.task);
128
134
  ```
129
135
 
130
136
  #### TUI Integration Example
131
137
 
132
138
  ```typescript
133
- import { TaskService } from 'task-o-matic';
134
- import type { ProgressCallback } from 'task-o-matic';
139
+ import { TaskService } from "task-o-matic";
140
+ import type { ProgressCallback } from "task-o-matic";
135
141
 
136
142
  const taskService = new TaskService();
137
143
 
@@ -140,12 +146,12 @@ const progressCallback: ProgressCallback = {
140
146
  onProgress: (event) => {
141
147
  // Update your TUI with progress
142
148
  tuiStatusBar.update(event.message);
143
- }
149
+ },
144
150
  };
145
151
 
146
152
  // Create task with streaming
147
153
  const result = await taskService.createTask({
148
- title: 'Add payment integration',
154
+ title: "Add payment integration",
149
155
  aiEnhance: true,
150
156
  streamingOptions: {
151
157
  enabled: true,
@@ -154,37 +160,37 @@ const result = await taskService.createTask({
154
160
  tuiTextArea.append(chunk);
155
161
  },
156
162
  onFinish: ({ text }) => {
157
- tuiStatusBar.success('Task enhanced!');
158
- }
163
+ tuiStatusBar.success("Task enhanced!");
164
+ },
159
165
  },
160
- callbacks: progressCallback
166
+ callbacks: progressCallback,
161
167
  });
162
168
  ```
163
169
 
164
170
  #### PRD Parsing Example
165
171
 
166
172
  ```typescript
167
- import { PRDService } from 'task-o-matic';
173
+ import { PRDService } from "task-o-matic";
168
174
 
169
175
  const prdService = new PRDService();
170
176
 
171
177
  const result = await prdService.parsePRD({
172
- file: './requirements.md',
178
+ file: "./requirements.md",
173
179
  workingDirectory: process.cwd(),
174
180
  aiOptions: {
175
- provider: 'openrouter',
176
- model: 'anthropic/claude-3.5-sonnet',
177
- apiKey: process.env.OPENROUTER_API_KEY
181
+ provider: "openrouter",
182
+ model: "anthropic/claude-3.5-sonnet",
183
+ apiKey: process.env.OPENROUTER_API_KEY,
178
184
  },
179
185
  callbacks: {
180
186
  onProgress: (event) => {
181
187
  console.log(event.message);
182
- }
183
- }
188
+ },
189
+ },
184
190
  });
185
191
 
186
192
  console.log(`Created ${result.tasks.length} tasks from PRD`);
187
- result.tasks.forEach(task => {
193
+ result.tasks.forEach((task) => {
188
194
  console.log(`- ${task.title}`);
189
195
  });
190
196
  ```
@@ -192,11 +198,7 @@ result.tasks.forEach(task => {
192
198
  #### Using Utility Factories
193
199
 
194
200
  ```typescript
195
- import {
196
- getStorage,
197
- getAIOperations,
198
- buildAIConfig
199
- } from 'task-o-matic';
201
+ import { getStorage, getAIOperations, buildAIConfig } from "task-o-matic";
200
202
 
201
203
  // Get singleton instances
202
204
  const storage = getStorage();
@@ -204,9 +206,9 @@ const aiOps = getAIOperations();
204
206
 
205
207
  // Build AI configuration
206
208
  const aiConfig = buildAIConfig({
207
- provider: 'openai',
208
- model: 'gpt-4',
209
- apiKey: process.env.OPENAI_API_KEY
209
+ provider: "openai",
210
+ model: "gpt-4",
211
+ apiKey: process.env.OPENAI_API_KEY,
210
212
  });
211
213
 
212
214
  // Use storage directly
@@ -224,8 +226,8 @@ import type {
224
226
  StreamingOptions,
225
227
  CreateTaskOptions,
226
228
  PRDParseResult,
227
- TaskAIMetadata
228
- } from 'task-o-matic';
229
+ TaskAIMetadata,
230
+ } from "task-o-matic";
229
231
  ```
230
232
 
231
233
  ### CLI Usage
@@ -298,17 +300,71 @@ task-o-matic prd parse --file my-prd.md --stream
298
300
  task-o-matic tasks list
299
301
  ```
300
302
 
303
+ ### 7. Interactive Workflow (Recommended for New Projects)
304
+
305
+ The interactive workflow guides you through the entire setup process:
306
+
307
+ ```bash
308
+ # Start the interactive workflow
309
+ task-o-matic workflow
310
+
311
+ # With streaming AI output
312
+ task-o-matic workflow --stream
313
+ ```
314
+
315
+ **The workflow will guide you through:**
316
+
317
+ 1. **Project Initialization** - Choose quick start, custom, or AI-assisted configuration
318
+ 2. **PRD Definition** - Upload file, write manually, or use AI to generate from description
319
+ 3. **PRD Refinement** - Optional AI-assisted improvements
320
+ 4. **Task Generation** - Parse PRD into actionable tasks
321
+ 5. **Task Splitting** - Break down complex tasks into subtasks
322
+
323
+ **AI Assistance at Every Step:**
324
+
325
+ At each step, you can choose "AI-assisted" to describe your needs in natural language:
326
+
327
+ ```bash
328
+ # Example AI-assisted workflow
329
+ task-o-matic workflow --stream
330
+
331
+ # Step 1: "I want to build a SaaS platform for team collaboration"
332
+ # Step 2: "Real-time chat, file sharing, and task management features"
333
+ # Step 3: "Add more details about authentication and security"
334
+ # Step 4: "Focus on MVP features first"
335
+ # Step 5: "Break tasks into 2-4 hour chunks"
336
+ ```
337
+
301
338
  ## 📚 Documentation
302
339
 
303
340
  - [Configuration](docs/configuration.md) - AI providers and settings
304
341
  - [Task Management](docs/tasks.md) - Full task lifecycle with AI features
305
342
  - [PRD Processing](docs/prd.md) - Parse and rework Product Requirements Documents
343
+ - [Interactive Workflow](docs/workflow-command.md) - Guided setup with AI assistance
306
344
  - [AI Integration](docs/ai-integration.md) - AI providers and prompt engineering
307
345
  - [Project Initialization](docs/projects.md) - Project setup and bootstrapping
308
346
  - [Streaming Output](docs/streaming.md) - Real-time AI streaming capabilities
309
347
 
310
348
  ## 🎯 Common Workflows
311
349
 
350
+ ### Workflow 0: Interactive Guided Setup (Recommended)
351
+
352
+ ```bash
353
+ # One command to rule them all
354
+ task-o-matic workflow --stream
355
+
356
+ # The workflow will guide you through:
357
+ # 1. Project initialization with AI-assisted configuration
358
+ # 2. PRD creation (manual, upload, or AI-generated)
359
+ # 3. PRD refinement with AI feedback
360
+ # 4. Task generation from PRD
361
+ # 5. Complex task splitting
362
+
363
+ # After completion:
364
+ task-o-matic tasks list
365
+ task-o-matic tasks tree
366
+ ```
367
+
312
368
  ### Workflow 1: From PRD to Tasks
313
369
 
314
370
  ```bash
@@ -467,15 +523,15 @@ The package is structured for both CLI and library use:
467
523
 
468
524
  ```json
469
525
  {
470
- "main": "./dist/lib/index.js", // CommonJS library entry
471
- "types": "./dist/lib/index.d.ts", // TypeScript definitions
526
+ "main": "./dist/lib/index.js", // CommonJS library entry
527
+ "types": "./dist/lib/index.d.ts", // TypeScript definitions
472
528
  "bin": {
473
- "task-o-matic": "./dist/cli/bin.js", // CLI binary
474
- "task-o-matic-mcp": "./dist/mcp/server.js" // MCP server binary
529
+ "task-o-matic": "./dist/cli/bin.js", // CLI binary
530
+ "task-o-matic-mcp": "./dist/mcp/server.js" // MCP server binary
475
531
  },
476
532
  "exports": {
477
- ".": "./dist/lib/index.js", // Main library export
478
- "./types": "./dist/types/index.js" // Type-only exports
533
+ ".": "./dist/lib/index.js", // Main library export
534
+ "./types": "./dist/types/index.js" // Type-only exports
479
535
  }
480
536
  }
481
537
  ```
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare const createCommand: Command;
3
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,eAAO,MAAM,aAAa,SAsDtB,CAAC"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCommand = void 0;
4
+ const commander_1 = require("commander");
5
+ const tasks_1 = require("../../services/tasks");
6
+ const hooks_1 = require("../../lib/hooks");
7
+ const streaming_options_1 = require("../../utils/streaming-options");
8
+ const progress_1 = require("../../cli/display/progress");
9
+ const common_1 = require("../../cli/display/common");
10
+ const task_1 = require("../../cli/display/task");
11
+ exports.createCommand = new commander_1.Command("create")
12
+ .description("Create a new task with AI enhancement using Context7")
13
+ .requiredOption("--title <title>", "Task title")
14
+ .option("--content <content>", "Task content (supports markdown)")
15
+ .option("--effort <effort>", "Estimated effort (small/medium/large)")
16
+ .option("--parent-id <id>", "Parent task ID (creates subtask)")
17
+ .option("--ai-enhance", "Enhance task with AI using Context7 documentation")
18
+ .option("--stream", "Show streaming AI output during enhancement")
19
+ .option("--ai-provider <provider>", "AI provider override")
20
+ .option("--ai-model <model>", "AI model override")
21
+ .option("--ai-key <key>", "AI API key override")
22
+ .option("--ai-provider-url <url>", "AI provider URL override")
23
+ .option("--reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
24
+ .action(async (options) => {
25
+ try {
26
+ const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.aiEnhance && options.stream, "Enhancement");
27
+ const progressHandler = (payload) => {
28
+ (0, progress_1.displayProgress)(payload);
29
+ };
30
+ hooks_1.hooks.on("task:progress", progressHandler);
31
+ try {
32
+ const result = await tasks_1.taskService.createTask({
33
+ title: options.title,
34
+ content: options.content,
35
+ parentId: options.parentId,
36
+ effort: options.effort,
37
+ aiEnhance: options.aiEnhance,
38
+ aiOptions: {
39
+ aiProvider: options.aiProvider,
40
+ aiModel: options.aiModel,
41
+ aiKey: options.aiKey,
42
+ aiProviderUrl: options.aiProviderUrl,
43
+ aiReasoning: options.reasoning,
44
+ },
45
+ streamingOptions,
46
+ });
47
+ (0, common_1.displayEnhancementResult)(options.aiEnhance && options.stream);
48
+ (0, task_1.displayCreatedTask)(result.task, result.aiMetadata);
49
+ }
50
+ finally {
51
+ hooks_1.hooks.off("task:progress", progressHandler);
52
+ }
53
+ }
54
+ catch (error) {
55
+ (0, progress_1.displayError)(error);
56
+ process.exit(1);
57
+ }
58
+ });
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare const deleteCommand: Command;
3
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,eAAO,MAAM,aAAa,SAmCtB,CAAC"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.deleteCommand = void 0;
7
+ const commander_1 = require("commander");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const tasks_1 = require("../../services/tasks");
10
+ const task_1 = require("../../cli/display/task");
11
+ const progress_1 = require("../../cli/display/progress");
12
+ exports.deleteCommand = new commander_1.Command("delete")
13
+ .description("Delete a task")
14
+ .requiredOption("--id <id>", "Task ID to delete")
15
+ .option("--force", "Skip confirmation and delete anyway")
16
+ .option("--cascade", "Delete all subtasks as well")
17
+ .action(async (options) => {
18
+ try {
19
+ if (!options.force) {
20
+ const task = await tasks_1.taskService.getTask(options.id);
21
+ if (!task) {
22
+ throw new Error(`Task with ID ${options.id} not found`);
23
+ }
24
+ console.log(chalk_1.default.red(`\n⚠️ Are you sure you want to delete task: ${task.title} (${task.id})?`));
25
+ console.log(chalk_1.default.red("This action cannot be undone."));
26
+ // Simple confirmation - in a real CLI you might want a proper prompt
27
+ console.log(chalk_1.default.yellow("Use --force to confirm deletion."));
28
+ return;
29
+ }
30
+ const result = await tasks_1.taskService.deleteTask(options.id, {
31
+ cascade: options.cascade,
32
+ force: options.force,
33
+ });
34
+ (0, task_1.displayTaskDelete)(result.deleted, result.orphanedSubtasks);
35
+ }
36
+ catch (error) {
37
+ (0, progress_1.displayError)(error);
38
+ process.exit(1);
39
+ }
40
+ });
@@ -0,0 +1,5 @@
1
+ import { Command } from "commander";
2
+ export declare const documentCommand: Command;
3
+ export declare const getDocumentationCommand: Command;
4
+ export declare const addDocumentationCommand: Command;
5
+ //# sourceMappingURL=document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,eAAO,MAAM,eAAe,SA2ExB,CAAC;AAEL,eAAO,MAAM,uBAAuB,SAgChC,CAAC;AAEL,eAAO,MAAM,uBAAuB,SA8ChC,CAAC"}
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.addDocumentationCommand = exports.getDocumentationCommand = exports.documentCommand = void 0;
7
+ const commander_1 = require("commander");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const tasks_1 = require("../../services/tasks");
10
+ const hooks_1 = require("../../lib/hooks");
11
+ const streaming_options_1 = require("../../utils/streaming-options");
12
+ const progress_1 = require("../../cli/display/progress");
13
+ const common_1 = require("../../cli/display/common");
14
+ exports.documentCommand = new commander_1.Command("document")
15
+ .description("Analyze and fetch documentation for a task using AI with Context7")
16
+ .requiredOption("--task-id <id>", "Task ID")
17
+ .option("--force", "Force refresh documentation even if recent")
18
+ .option("--stream", "Show streaming AI output during analysis")
19
+ .option("--ai-provider <provider>", "AI provider override")
20
+ .option("--ai-model <model>", "AI model override")
21
+ .option("--ai-key <key>", "AI API key override")
22
+ .option("--ai-provider-url <url>", "AI provider URL override")
23
+ .option("--reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
24
+ .action(async (options) => {
25
+ try {
26
+ const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.stream, "Analysis");
27
+ const progressHandler = (payload) => {
28
+ (0, progress_1.displayProgress)(payload);
29
+ };
30
+ hooks_1.hooks.on("task:progress", progressHandler);
31
+ try {
32
+ const result = await tasks_1.taskService.documentTask(options.taskId, options.force, {
33
+ aiProvider: options.aiProvider,
34
+ aiModel: options.aiModel,
35
+ aiKey: options.aiKey,
36
+ aiProviderUrl: options.aiProviderUrl,
37
+ aiReasoning: options.reasoning,
38
+ }, streamingOptions);
39
+ if (result.documentation && !options.force) {
40
+ const daysSinceFetch = (Date.now() - result.documentation.lastFetched) /
41
+ (24 * 60 * 60 * 1000);
42
+ console.log(chalk_1.default.green(`✓ Documentation is fresh (${Math.round(daysSinceFetch)} days old)`));
43
+ console.log(chalk_1.default.cyan(`Recap: ${result.documentation.recap}`));
44
+ console.log(chalk_1.default.blue(`Libraries: ${result.documentation.libraries.join(", ")}`));
45
+ return;
46
+ }
47
+ if (result.analysis) {
48
+ (0, common_1.displayDocumentationAnalysis)(result.analysis);
49
+ }
50
+ if (result.documentation?.research) {
51
+ (0, common_1.displayResearchSummary)(result.documentation);
52
+ }
53
+ }
54
+ finally {
55
+ hooks_1.hooks.off("task:progress", progressHandler);
56
+ }
57
+ }
58
+ catch (error) {
59
+ (0, progress_1.displayError)(error);
60
+ process.exit(1);
61
+ }
62
+ });
63
+ exports.getDocumentationCommand = new commander_1.Command("get-documentation")
64
+ .description("Get existing documentation for a task")
65
+ .requiredOption("--id <id>", "Task ID")
66
+ .action(async (options) => {
67
+ try {
68
+ const task = await tasks_1.taskService.getTask(options.id);
69
+ if (!task) {
70
+ throw new Error(`Task with ID ${options.id} not found`);
71
+ }
72
+ const documentation = await tasks_1.taskService.getTaskDocumentation(options.id);
73
+ if (!documentation) {
74
+ console.log(chalk_1.default.yellow(`⚠️ No documentation found for task ${options.id}`));
75
+ console.log(chalk_1.default.gray(` Task: ${task.title}`));
76
+ return;
77
+ }
78
+ console.log(chalk_1.default.blue(`\n📖 Documentation for Task: ${task.title} (${options.id})`));
79
+ console.log(chalk_1.default.gray(` File: .task-o-matic/docs/tasks/${options.id}.md`));
80
+ console.log("");
81
+ console.log(documentation);
82
+ }
83
+ catch (error) {
84
+ (0, progress_1.displayError)(error);
85
+ process.exit(1);
86
+ }
87
+ });
88
+ exports.addDocumentationCommand = new commander_1.Command("add-documentation")
89
+ .description("Add documentation to a task from a file")
90
+ .requiredOption("--id <id>", "Task ID")
91
+ .requiredOption("--doc-file <path>", "Path to documentation file")
92
+ .option("--overwrite", "Overwrite existing documentation")
93
+ .action(async (options) => {
94
+ try {
95
+ const task = await tasks_1.taskService.getTask(options.id);
96
+ if (!task) {
97
+ throw new Error(`Task with ID ${options.id} not found`);
98
+ }
99
+ // Check if documentation already exists
100
+ const existingDoc = await tasks_1.taskService.getTaskDocumentation(options.id);
101
+ if (existingDoc && !options.overwrite) {
102
+ console.log(chalk_1.default.yellow(`⚠️ Documentation already exists for task ${options.id}`));
103
+ console.log(chalk_1.default.gray(` Use --overwrite to replace existing documentation`));
104
+ return;
105
+ }
106
+ const result = await tasks_1.taskService.addTaskDocumentationFromFile(options.id, options.docFile);
107
+ console.log(chalk_1.default.green(`✓ Documentation added to task: ${task.title} (${options.id})`));
108
+ console.log(chalk_1.default.gray(` Source file: ${options.docFile}`));
109
+ console.log(chalk_1.default.gray(` Saved to: ${result.filePath}`));
110
+ if (options.overwrite) {
111
+ console.log(chalk_1.default.cyan(` Previous documentation was overwritten`));
112
+ }
113
+ }
114
+ catch (error) {
115
+ (0, progress_1.displayError)(error);
116
+ process.exit(1);
117
+ }
118
+ });
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare const enhanceCommand: Command;
3
+ //# sourceMappingURL=enhance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enhance.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/enhance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,eAAO,MAAM,cAAc,SA8GvB,CAAC"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.enhanceCommand = void 0;
7
+ const commander_1 = require("commander");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const tasks_1 = require("../../services/tasks");
10
+ const hooks_1 = require("../../lib/hooks");
11
+ const streaming_options_1 = require("../../utils/streaming-options");
12
+ const progress_1 = require("../../cli/display/progress");
13
+ exports.enhanceCommand = new commander_1.Command("enhance")
14
+ .description("Enhance an existing task with AI using Context7 documentation")
15
+ .option("--task-id <id>", "Task ID to enhance")
16
+ .option("--all", "Enhance all existing tasks")
17
+ .option("--stream", "Show streaming AI output during enhancement")
18
+ .option("--ai-provider <provider>", "AI provider override")
19
+ .option("--ai-model <model>", "AI model override")
20
+ .option("--ai-key <key>", "AI API key override")
21
+ .option("--ai-provider-url <url>", "AI provider URL override")
22
+ .option("--reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
23
+ .action(async (options) => {
24
+ try {
25
+ if (!options.taskId && !options.all) {
26
+ throw new Error("Either --task-id or --all must be specified");
27
+ }
28
+ if (options.taskId && options.all) {
29
+ throw new Error("Cannot specify both --task-id and --all");
30
+ }
31
+ const enhanceSingleTask = async (taskId) => {
32
+ const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.stream, "Enhancement");
33
+ const progressHandler = (payload) => {
34
+ (0, progress_1.displayProgress)(payload);
35
+ };
36
+ hooks_1.hooks.on("task:progress", progressHandler);
37
+ try {
38
+ const result = await tasks_1.taskService.enhanceTask(taskId, {
39
+ aiProvider: options.aiProvider,
40
+ aiModel: options.aiModel,
41
+ aiKey: options.aiKey,
42
+ aiProviderUrl: options.aiProviderUrl,
43
+ aiReasoning: options.reasoning,
44
+ }, streamingOptions);
45
+ if (result.enhancedContent.length > 200) {
46
+ console.log(chalk_1.default.cyan(` Enhanced content saved to file.`));
47
+ }
48
+ else {
49
+ console.log(chalk_1.default.cyan(` Enhanced content updated in task description.`));
50
+ }
51
+ console.log(chalk_1.default.green("✓ Task enhanced with Context7 documentation"));
52
+ console.log(chalk_1.default.magenta(` 🤖 Enhanced using Context7 MCP tools`));
53
+ }
54
+ finally {
55
+ hooks_1.hooks.off("task:progress", progressHandler);
56
+ }
57
+ };
58
+ if (options.taskId) {
59
+ await enhanceSingleTask(options.taskId);
60
+ }
61
+ else if (options.all) {
62
+ const allTasks = await tasks_1.taskService.listTasks({});
63
+ if (allTasks.length === 0) {
64
+ console.log(chalk_1.default.yellow("No tasks found to enhance."));
65
+ return;
66
+ }
67
+ console.log(chalk_1.default.blue(`🤖 Enhancing ${allTasks.length} tasks in order...`));
68
+ for (let i = 0; i < allTasks.length; i++) {
69
+ const task = allTasks[i];
70
+ console.log(chalk_1.default.cyan(`\n[${i + 1}/${allTasks.length}] Enhancing: ${task.title} (${task.id})`));
71
+ try {
72
+ await enhanceSingleTask(task.id);
73
+ console.log(chalk_1.default.green(`✓ Enhanced task ${task.id}`));
74
+ }
75
+ catch (error) {
76
+ console.log(chalk_1.default.red(`❌ Failed to enhance task ${task.id}: ${error instanceof Error ? error.message : "Unknown error"}`));
77
+ }
78
+ }
79
+ console.log(chalk_1.default.green(`\n✓ Bulk enhancement complete! Processed ${allTasks.length} tasks.`));
80
+ }
81
+ }
82
+ catch (error) {
83
+ (0, progress_1.displayError)(error);
84
+ process.exit(1);
85
+ }
86
+ });
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare const executeCommand: Command;
3
+ //# sourceMappingURL=execute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,cAAc,SAoCvB,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.executeCommand = void 0;
7
+ const commander_1 = require("commander");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const task_execution_1 = require("../../lib/task-execution");
10
+ exports.executeCommand = new commander_1.Command("execute")
11
+ .description("Execute a task using an external coding assistant")
12
+ .requiredOption("--id <id>", "Task ID to execute")
13
+ .option("--tool <tool>", "External tool to use (opencode/claude/gemini/codex)", "opencode")
14
+ .option("--message <message>", "Custom message to send to the tool (uses task plan if not provided)")
15
+ .option("--dry", "Show what would be executed without running it")
16
+ .option("--validate <command>", "Validation command to run after execution (can be used multiple times)", (value, previous = []) => {
17
+ return [...previous, value];
18
+ })
19
+ .action(async (options) => {
20
+ try {
21
+ await (0, task_execution_1.executeTask)({
22
+ taskId: options.id,
23
+ tool: options.tool,
24
+ message: options.message,
25
+ dry: options.dry,
26
+ validate: options.validate || [],
27
+ });
28
+ }
29
+ catch (error) {
30
+ console.error(chalk_1.default.red("Execution failed:"), error instanceof Error ? error.message : "Unknown error");
31
+ process.exit(1);
32
+ }
33
+ });
@@ -0,0 +1,16 @@
1
+ export * from "./list";
2
+ export * from "./create";
3
+ export * from "./show";
4
+ export * from "./update";
5
+ export * from "./delete";
6
+ export * from "./status";
7
+ export * from "./tags";
8
+ export * from "./plan";
9
+ export * from "./enhance";
10
+ export * from "./split";
11
+ export * from "./document";
12
+ export * from "./execute";
13
+ export * from "./subtasks";
14
+ export * from "./tree";
15
+ export * from "./next";
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/tasks/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}