task-o-matic 0.0.13 → 0.0.15
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/dist/cli/display/progress.d.ts +15 -2
- package/dist/cli/display/progress.d.ts.map +1 -1
- package/dist/cli/display/progress.js +72 -4
- package/dist/commands/benchmark.d.ts.map +1 -1
- package/dist/commands/benchmark.js +11 -3
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +60 -12
- package/dist/commands/prd.js +7 -1
- package/dist/commands/tasks/delete.d.ts.map +1 -1
- package/dist/commands/tasks/delete.js +2 -1
- package/dist/commands/tasks/document/add.d.ts.map +1 -1
- package/dist/commands/tasks/document/add.js +5 -4
- package/dist/commands/tasks/document/get.d.ts.map +1 -1
- package/dist/commands/tasks/document/get.js +2 -1
- package/dist/commands/tasks/list.js +2 -2
- package/dist/commands/tasks/next.js +4 -4
- package/dist/commands/tasks/plan/set.d.ts.map +1 -1
- package/dist/commands/tasks/plan/set.js +11 -3
- package/dist/commands/tasks/show.d.ts.map +1 -1
- package/dist/commands/tasks/show.js +2 -1
- package/dist/commands/tasks/status.d.ts.map +1 -1
- package/dist/commands/tasks/status.js +4 -3
- package/dist/commands/tasks/update.d.ts.map +1 -1
- package/dist/commands/tasks/update.js +7 -1
- package/dist/lib/ai-service/ai-operations.d.ts +1 -1
- package/dist/lib/ai-service/ai-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/base-operations.d.ts +22 -0
- package/dist/lib/ai-service/base-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/base-operations.js +29 -1
- package/dist/lib/ai-service/model-provider.d.ts.map +1 -1
- package/dist/lib/ai-service/model-provider.js +37 -6
- package/dist/lib/ai-service/task-operations.d.ts +2 -1
- package/dist/lib/ai-service/task-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/task-operations.js +135 -173
- package/dist/lib/benchmark/registry.d.ts.map +1 -1
- package/dist/lib/benchmark/registry.js +6 -10
- package/dist/lib/better-t-stack-cli.d.ts +36 -21
- package/dist/lib/better-t-stack-cli.d.ts.map +1 -1
- package/dist/lib/better-t-stack-cli.js +212 -33
- package/dist/lib/bootstrap/cli-bootstrap.d.ts +14 -0
- package/dist/lib/bootstrap/cli-bootstrap.d.ts.map +1 -0
- package/dist/lib/bootstrap/cli-bootstrap.js +325 -0
- package/dist/lib/bootstrap/index.d.ts +4 -0
- package/dist/lib/bootstrap/index.d.ts.map +1 -0
- package/dist/lib/bootstrap/index.js +19 -0
- package/dist/lib/bootstrap/medusa-bootstrap.d.ts +14 -0
- package/dist/lib/bootstrap/medusa-bootstrap.d.ts.map +1 -0
- package/dist/lib/bootstrap/medusa-bootstrap.js +218 -0
- package/dist/lib/bootstrap/opentui-bootstrap.d.ts +11 -0
- package/dist/lib/bootstrap/opentui-bootstrap.d.ts.map +1 -0
- package/dist/lib/bootstrap/opentui-bootstrap.js +342 -0
- package/dist/lib/config-validation.d.ts +215 -0
- package/dist/lib/config-validation.d.ts.map +1 -0
- package/dist/lib/config-validation.js +246 -0
- package/dist/lib/config.d.ts +14 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +37 -5
- package/dist/lib/storage/file-system.d.ts.map +1 -1
- package/dist/lib/storage/file-system.js +81 -21
- package/dist/lib/task-execution-core.d.ts.map +1 -1
- package/dist/lib/task-execution-core.js +3 -2
- package/dist/services/prd.d.ts +17 -0
- package/dist/services/prd.d.ts.map +1 -1
- package/dist/services/prd.js +67 -60
- package/dist/services/tasks.d.ts +317 -3
- package/dist/services/tasks.d.ts.map +1 -1
- package/dist/services/tasks.js +531 -185
- package/dist/services/workflow-ai-assistant.d.ts.map +1 -1
- package/dist/services/workflow-ai-assistant.js +19 -6
- package/dist/test/lib/ai-service/task-operations.test.d.ts +2 -0
- package/dist/test/lib/ai-service/task-operations.test.d.ts.map +1 -0
- package/dist/test/lib/ai-service/task-operations.test.js +362 -0
- package/dist/test/mocks/mock-ai-operations.d.ts +15 -0
- package/dist/test/mocks/mock-ai-operations.d.ts.map +1 -0
- package/dist/test/mocks/mock-ai-operations.js +107 -0
- package/dist/test/mocks/mock-context-builder.d.ts +10 -0
- package/dist/test/mocks/mock-context-builder.d.ts.map +1 -0
- package/dist/test/mocks/mock-context-builder.js +81 -0
- package/dist/test/mocks/mock-model-provider.d.ts +7 -0
- package/dist/test/mocks/mock-model-provider.d.ts.map +1 -0
- package/dist/test/mocks/mock-model-provider.js +21 -0
- package/dist/test/mocks/mock-service-factory.d.ts +11 -0
- package/dist/test/mocks/mock-service-factory.d.ts.map +1 -0
- package/dist/test/mocks/mock-service-factory.js +61 -0
- package/dist/test/mocks/mock-storage.d.ts +50 -0
- package/dist/test/mocks/mock-storage.d.ts.map +1 -0
- package/dist/test/mocks/mock-storage.js +145 -0
- package/dist/test/services/task-service.test.d.ts +2 -0
- package/dist/test/services/task-service.test.d.ts.map +1 -0
- package/dist/test/services/task-service.test.js +352 -0
- package/dist/test/test-mock-setup.d.ts +26 -0
- package/dist/test/test-mock-setup.d.ts.map +1 -0
- package/dist/test/test-mock-setup.js +41 -0
- package/dist/test/test-setup.d.ts +9 -0
- package/dist/test/test-setup.d.ts.map +1 -0
- package/dist/test/test-setup.js +44 -0
- package/dist/test/test-utils.d.ts +22 -0
- package/dist/test/test-utils.d.ts.map +1 -0
- package/dist/test/test-utils.js +37 -0
- package/dist/test/utils/ai-operation-utility.test.d.ts +2 -0
- package/dist/test/utils/ai-operation-utility.test.d.ts.map +1 -0
- package/dist/test/utils/ai-operation-utility.test.js +290 -0
- package/dist/test/utils/error-handling.test.d.ts +2 -0
- package/dist/test/utils/error-handling.test.d.ts.map +1 -0
- package/dist/test/utils/error-handling.test.js +231 -0
- package/dist/types/index.d.ts +36 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/results.d.ts +60 -6
- package/dist/types/results.d.ts.map +1 -1
- package/dist/utils/ai-operation-utility.d.ts +142 -0
- package/dist/utils/ai-operation-utility.d.ts.map +1 -0
- package/dist/utils/ai-operation-utility.js +288 -0
- package/dist/utils/ai-service-factory.d.ts +10 -0
- package/dist/utils/ai-service-factory.d.ts.map +1 -1
- package/dist/utils/ai-service-factory.js +19 -1
- package/dist/utils/cli-validators.d.ts +2 -2
- package/dist/utils/cli-validators.d.ts.map +1 -1
- package/dist/utils/cli-validators.js +7 -6
- package/dist/utils/error-utils.d.ts +70 -0
- package/dist/utils/error-utils.d.ts.map +1 -0
- package/dist/utils/error-utils.js +104 -0
- package/dist/utils/file-utils.d.ts +49 -0
- package/dist/utils/file-utils.d.ts.map +1 -0
- package/dist/utils/file-utils.js +82 -0
- package/dist/utils/id-generator.d.ts +92 -0
- package/dist/utils/id-generator.d.ts.map +1 -0
- package/dist/utils/id-generator.js +146 -0
- package/dist/utils/model-executor-parser.d.ts +1 -1
- package/dist/utils/model-executor-parser.d.ts.map +1 -1
- package/dist/utils/model-executor-parser.js +3 -2
- package/dist/utils/stack-formatter.d.ts +2 -1
- package/dist/utils/stack-formatter.d.ts.map +1 -1
- package/dist/utils/stack-formatter.js +8 -2
- package/dist/utils/storage-utils.d.ts +49 -0
- package/dist/utils/storage-utils.d.ts.map +1 -0
- package/dist/utils/storage-utils.js +80 -0
- package/dist/utils/streaming-utils.d.ts +38 -0
- package/dist/utils/streaming-utils.d.ts.map +1 -0
- package/dist/utils/streaming-utils.js +56 -0
- package/dist/utils/task-o-matic-error.d.ts +206 -0
- package/dist/utils/task-o-matic-error.d.ts.map +1 -0
- package/dist/utils/task-o-matic-error.js +304 -0
- package/docs/agents/cli.md +58 -149
- package/package.json +2 -2
package/dist/services/tasks.d.ts
CHANGED
|
@@ -1,11 +1,115 @@
|
|
|
1
|
+
import { getAIOperations, getModelProvider, getStorage, getContextBuilder } from "../utils/ai-service-factory";
|
|
1
2
|
import { AIOptions } from "../utils/ai-config-builder";
|
|
2
|
-
import { Task, StreamingOptions } from "../types";
|
|
3
|
+
import { Task, StreamingOptions, TaskAIMetadata } from "../types";
|
|
3
4
|
import { CreateTaskResult, EnhanceTaskResult, SplitTaskResult, PlanTaskResult, DocumentTaskResult, DeleteTaskResult } from "../types/results";
|
|
5
|
+
import { hooks } from "../lib/hooks";
|
|
6
|
+
/**
|
|
7
|
+
* Dependencies for TaskService
|
|
8
|
+
*/
|
|
9
|
+
export interface TaskServiceDependencies {
|
|
10
|
+
storage?: ReturnType<typeof getStorage>;
|
|
11
|
+
aiOperations?: ReturnType<typeof getAIOperations>;
|
|
12
|
+
modelProvider?: ReturnType<typeof getModelProvider>;
|
|
13
|
+
contextBuilder?: ReturnType<typeof getContextBuilder>;
|
|
14
|
+
hooks?: typeof hooks;
|
|
15
|
+
}
|
|
4
16
|
/**
|
|
5
17
|
* TaskService - Centralized business logic for all task operations
|
|
6
|
-
*
|
|
18
|
+
*
|
|
19
|
+
* This service provides a comprehensive API for task management with AI-powered features.
|
|
20
|
+
* It's framework-agnostic and can be used by CLI, TUI, or Web applications.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { TaskService } from "task-o-matic";
|
|
25
|
+
*
|
|
26
|
+
* // Initialize with default configuration
|
|
27
|
+
* const taskService = new TaskService();
|
|
28
|
+
*
|
|
29
|
+
* // Create a task with AI enhancement
|
|
30
|
+
* const result = await taskService.createTask({
|
|
31
|
+
* title: "Implement feature",
|
|
32
|
+
* content: "Feature description",
|
|
33
|
+
* aiEnhance: true,
|
|
34
|
+
* aiOptions: {
|
|
35
|
+
* provider: "anthropic",
|
|
36
|
+
* model: "claude-3-5-sonnet"
|
|
37
|
+
* }
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // Or inject dependencies for testing
|
|
41
|
+
* const taskService = new TaskService({
|
|
42
|
+
* storage: mockStorage,
|
|
43
|
+
* aiOperations: mockAI,
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
7
46
|
*/
|
|
8
47
|
export declare class TaskService {
|
|
48
|
+
private storage;
|
|
49
|
+
private aiOperations;
|
|
50
|
+
private modelProvider;
|
|
51
|
+
private contextBuilder;
|
|
52
|
+
private hooks;
|
|
53
|
+
/**
|
|
54
|
+
* Create a new TaskService
|
|
55
|
+
*
|
|
56
|
+
* @param dependencies - Optional dependencies to inject (for testing)
|
|
57
|
+
*/
|
|
58
|
+
constructor(dependencies?: TaskServiceDependencies);
|
|
59
|
+
/**
|
|
60
|
+
* Creates a new task with optional AI enhancement
|
|
61
|
+
*
|
|
62
|
+
* @param input - Task creation parameters
|
|
63
|
+
* @param input.title - Task title (required, 1-255 characters)
|
|
64
|
+
* @param input.content - Task content/description (optional)
|
|
65
|
+
* @param input.parentId - Parent task ID for creating subtasks
|
|
66
|
+
* @param input.effort - Estimated effort ("small" | "medium" | "large")
|
|
67
|
+
* @param input.aiEnhance - Enable AI enhancement with Context7 documentation
|
|
68
|
+
* @param input.aiOptions - AI configuration override
|
|
69
|
+
* @param input.streamingOptions - Real-time streaming options
|
|
70
|
+
*
|
|
71
|
+
* @returns Promise resolving to task creation result
|
|
72
|
+
*
|
|
73
|
+
* @throws {TaskOMaticError} If task creation fails (e.g., AI operation errors, storage errors)
|
|
74
|
+
* @throws {Error} If input validation fails
|
|
75
|
+
*
|
|
76
|
+
* @example Basic task creation
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const task = await taskService.createTask({
|
|
79
|
+
* title: "Fix authentication bug",
|
|
80
|
+
* content: "Users cannot login with valid credentials",
|
|
81
|
+
* aiEnhance: false
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example Task with AI enhancement
|
|
86
|
+
* ```typescript
|
|
87
|
+
* try {
|
|
88
|
+
* const enhancedTask = await taskService.createTask({
|
|
89
|
+
* title: "Design authentication system",
|
|
90
|
+
* content: "Implement OAuth2 + JWT authentication",
|
|
91
|
+
* aiEnhance: true,
|
|
92
|
+
* streamingOptions: {
|
|
93
|
+
* onChunk: (chunk) => console.log("AI:", chunk)
|
|
94
|
+
* }
|
|
95
|
+
* });
|
|
96
|
+
* console.log("Enhanced content:", enhancedTask.task.content);
|
|
97
|
+
* } catch (error) {
|
|
98
|
+
* if (error instanceof TaskOMaticError) {
|
|
99
|
+
* console.error("AI enhancement failed:", error.getDetails());
|
|
100
|
+
* }
|
|
101
|
+
* }
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @example Creating subtasks
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const subtask = await taskService.createTask({
|
|
107
|
+
* title: "Implement OAuth2 flow",
|
|
108
|
+
* parentId: "1",
|
|
109
|
+
* effort: "medium"
|
|
110
|
+
* });
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
9
113
|
createTask(input: {
|
|
10
114
|
title: string;
|
|
11
115
|
content?: string;
|
|
@@ -15,13 +119,34 @@ export declare class TaskService {
|
|
|
15
119
|
aiOptions?: AIOptions;
|
|
16
120
|
streamingOptions?: StreamingOptions;
|
|
17
121
|
}): Promise<CreateTaskResult>;
|
|
122
|
+
/**
|
|
123
|
+
* List tasks with optional filtering
|
|
124
|
+
*
|
|
125
|
+
* @param filters - Filter criteria
|
|
126
|
+
* @param filters.status - Filter by task status ("todo", "in-progress", "completed")
|
|
127
|
+
* @param filters.tag - Filter by task tag
|
|
128
|
+
*
|
|
129
|
+
* @returns Promise resolving to array of matching tasks
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* // List all tasks
|
|
134
|
+
* const allTasks = await taskService.listTasks({});
|
|
135
|
+
*
|
|
136
|
+
* // List only completed tasks
|
|
137
|
+
* const completedTasks = await taskService.listTasks({ status: "completed" });
|
|
138
|
+
*
|
|
139
|
+
* // List tasks with specific tag
|
|
140
|
+
* const frontendTasks = await taskService.listTasks({ tag: "frontend" });
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
18
143
|
listTasks(filters: {
|
|
19
144
|
status?: string;
|
|
20
145
|
tag?: string;
|
|
21
146
|
}): Promise<Task[]>;
|
|
22
147
|
getTask(id: string): Promise<Task | null>;
|
|
23
148
|
getTaskContent(id: string): Promise<string | null>;
|
|
24
|
-
getTaskAIMetadata(id: string): Promise<
|
|
149
|
+
getTaskAIMetadata(id: string): Promise<TaskAIMetadata | null>;
|
|
25
150
|
getSubtasks(id: string): Promise<Task[]>;
|
|
26
151
|
updateTask(id: string, updates: {
|
|
27
152
|
title?: string;
|
|
@@ -37,6 +162,35 @@ export declare class TaskService {
|
|
|
37
162
|
}): Promise<DeleteTaskResult>;
|
|
38
163
|
addTags(id: string, tags: string[]): Promise<Task>;
|
|
39
164
|
removeTags(id: string, tags: string[]): Promise<Task>;
|
|
165
|
+
/**
|
|
166
|
+
* Get the next task based on priority and filtering criteria
|
|
167
|
+
*
|
|
168
|
+
* @param filters - Filter and priority criteria
|
|
169
|
+
* @param filters.status - Filter by task status
|
|
170
|
+
* @param filters.tag - Filter by task tag
|
|
171
|
+
* @param filters.effort - Filter by estimated effort
|
|
172
|
+
* @param filters.priority - Priority strategy ("newest", "oldest", "effort", or default)
|
|
173
|
+
*
|
|
174
|
+
* @returns Promise resolving to the highest priority task or null if none found
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* // Get the next task by default priority (task ID order)
|
|
179
|
+
* const nextTask = await taskService.getNextTask({});
|
|
180
|
+
*
|
|
181
|
+
* // Get the newest task with "todo" status
|
|
182
|
+
* const newestTodo = await taskService.getNextTask({
|
|
183
|
+
* status: "todo",
|
|
184
|
+
* priority: "newest"
|
|
185
|
+
* });
|
|
186
|
+
*
|
|
187
|
+
* // Get the highest effort task with specific tag
|
|
188
|
+
* const highEffortTask = await taskService.getNextTask({
|
|
189
|
+
* tag: "backend",
|
|
190
|
+
* priority: "effort"
|
|
191
|
+
* });
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
40
194
|
getNextTask(filters: {
|
|
41
195
|
status?: string;
|
|
42
196
|
tag?: string;
|
|
@@ -44,9 +198,168 @@ export declare class TaskService {
|
|
|
44
198
|
priority?: string;
|
|
45
199
|
}): Promise<Task | null>;
|
|
46
200
|
getTaskTree(rootId?: string): Promise<Task[]>;
|
|
201
|
+
/**
|
|
202
|
+
* Enhance a task with AI-generated documentation using Context7
|
|
203
|
+
*
|
|
204
|
+
* Uses AI to enrich the task description with relevant documentation,
|
|
205
|
+
* code examples, and best practices from Context7 documentation sources.
|
|
206
|
+
*
|
|
207
|
+
* @param taskId - ID of the task to enhance
|
|
208
|
+
* @param aiOptions - Optional AI configuration overrides
|
|
209
|
+
* @param streamingOptions - Optional streaming callbacks for real-time feedback
|
|
210
|
+
* @returns Promise resolving to enhancement result with metrics
|
|
211
|
+
*
|
|
212
|
+
* @throws {Error} If task not found
|
|
213
|
+
* @throws {TaskOMaticError} If AI enhancement fails
|
|
214
|
+
*
|
|
215
|
+
* @example Basic enhancement
|
|
216
|
+
* ```typescript
|
|
217
|
+
* const result = await taskService.enhanceTask("1");
|
|
218
|
+
* console.log("Enhanced content:", result.enhancedContent);
|
|
219
|
+
* console.log("Took:", result.stats.duration, "ms");
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
222
|
+
* @example With streaming
|
|
223
|
+
* ```typescript
|
|
224
|
+
* try {
|
|
225
|
+
* const result = await taskService.enhanceTask("1", undefined, {
|
|
226
|
+
* onChunk: (chunk) => process.stdout.write(chunk)
|
|
227
|
+
* });
|
|
228
|
+
* console.log("\nEnhancement complete!");
|
|
229
|
+
* } catch (error) {
|
|
230
|
+
* if (error instanceof TaskOMaticError) {
|
|
231
|
+
* console.error("Enhancement failed:", error.getDetails());
|
|
232
|
+
* }
|
|
233
|
+
* }
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
47
236
|
enhanceTask(taskId: string, aiOptions?: AIOptions, streamingOptions?: StreamingOptions): Promise<EnhanceTaskResult>;
|
|
237
|
+
/**
|
|
238
|
+
* Split a task into subtasks using AI
|
|
239
|
+
*
|
|
240
|
+
* Analyzes the task and breaks it down into smaller, actionable subtasks
|
|
241
|
+
* with estimated effort. Can optionally use filesystem tools to understand
|
|
242
|
+
* project structure when creating subtasks.
|
|
243
|
+
*
|
|
244
|
+
* @param taskId - ID of the task to split
|
|
245
|
+
* @param aiOptions - Optional AI configuration overrides
|
|
246
|
+
* @param promptOverride - Optional custom prompt
|
|
247
|
+
* @param messageOverride - Optional custom message
|
|
248
|
+
* @param streamingOptions - Optional streaming callbacks
|
|
249
|
+
* @param enableFilesystemTools - Enable filesystem analysis for context
|
|
250
|
+
* @returns Promise resolving to split result with created subtasks
|
|
251
|
+
*
|
|
252
|
+
* @throws {Error} If task not found or already has subtasks
|
|
253
|
+
* @throws {TaskOMaticError} If AI operation fails
|
|
254
|
+
*
|
|
255
|
+
* @example Basic task splitting
|
|
256
|
+
* ```typescript
|
|
257
|
+
* const result = await taskService.splitTask("1");
|
|
258
|
+
* console.log(`Created ${result.subtasks.length} subtasks`);
|
|
259
|
+
* result.subtasks.forEach(subtask => {
|
|
260
|
+
* console.log(`- ${subtask.title} (${subtask.estimatedEffort})`);
|
|
261
|
+
* });
|
|
262
|
+
* ```
|
|
263
|
+
*
|
|
264
|
+
* @example With filesystem tools for code analysis
|
|
265
|
+
* ```typescript
|
|
266
|
+
* try {
|
|
267
|
+
* const result = await taskService.splitTask(
|
|
268
|
+
* "1",
|
|
269
|
+
* undefined,
|
|
270
|
+
* undefined,
|
|
271
|
+
* undefined,
|
|
272
|
+
* { onChunk: (chunk) => console.log(chunk) },
|
|
273
|
+
* true // Enable filesystem tools
|
|
274
|
+
* );
|
|
275
|
+
* console.log("AI analyzed codebase to create subtasks");
|
|
276
|
+
* } catch (error) {
|
|
277
|
+
* if (error instanceof TaskOMaticError) {
|
|
278
|
+
* console.error("Split failed:", error.suggestions);
|
|
279
|
+
* }
|
|
280
|
+
* }
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
48
283
|
splitTask(taskId: string, aiOptions?: AIOptions, promptOverride?: string, messageOverride?: string, streamingOptions?: StreamingOptions, enableFilesystemTools?: boolean): Promise<SplitTaskResult>;
|
|
284
|
+
/**
|
|
285
|
+
* Analyze and fetch documentation for a task using Context7
|
|
286
|
+
*
|
|
287
|
+
* Analyzes the task content to identify required libraries and documentation,
|
|
288
|
+
* then fetches relevant documentation from Context7. Caches documentation
|
|
289
|
+
* for future use.
|
|
290
|
+
*
|
|
291
|
+
* @param taskId - ID of the task to document
|
|
292
|
+
* @param force - Force re-fetch even if documentation exists
|
|
293
|
+
* @param aiOptions - Optional AI configuration overrides
|
|
294
|
+
* @param streamingOptions - Optional streaming callbacks
|
|
295
|
+
* @returns Promise resolving to documentation analysis result
|
|
296
|
+
*
|
|
297
|
+
* @throws {Error} If task not found or content is empty
|
|
298
|
+
* @throws {TaskOMaticError} If AI operation fails
|
|
299
|
+
*
|
|
300
|
+
* @example Analyze documentation needs
|
|
301
|
+
* ```typescript
|
|
302
|
+
* const result = await taskService.documentTask("1");
|
|
303
|
+
* if (result.documentation) {
|
|
304
|
+
* console.log("Documentation fetched:");
|
|
305
|
+
* console.log(result.documentation.recap);
|
|
306
|
+
* console.log("Libraries:", result.documentation.libraries);
|
|
307
|
+
* }
|
|
308
|
+
* ```
|
|
309
|
+
*
|
|
310
|
+
* @example Force refresh documentation
|
|
311
|
+
* ```typescript
|
|
312
|
+
* try {
|
|
313
|
+
* const result = await taskService.documentTask("1", true);
|
|
314
|
+
* console.log(`Analyzed ${result.analysis.libraries.length} libraries`);
|
|
315
|
+
* } catch (error) {
|
|
316
|
+
* if (error instanceof TaskOMaticError) {
|
|
317
|
+
* console.error("Documentation fetch failed:", error.getDetails());
|
|
318
|
+
* }
|
|
319
|
+
* }
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
49
322
|
documentTask(taskId: string, force?: boolean, aiOptions?: AIOptions, streamingOptions?: StreamingOptions): Promise<DocumentTaskResult>;
|
|
323
|
+
/**
|
|
324
|
+
* Generate an implementation plan for a task using AI
|
|
325
|
+
*
|
|
326
|
+
* Creates a detailed implementation plan with steps, considerations,
|
|
327
|
+
* and technical approach. Uses filesystem and Context7 tools to understand
|
|
328
|
+
* the project context and provide relevant suggestions.
|
|
329
|
+
*
|
|
330
|
+
* @param taskId - ID of the task to plan
|
|
331
|
+
* @param aiOptions - Optional AI configuration overrides
|
|
332
|
+
* @param streamingOptions - Optional streaming callbacks
|
|
333
|
+
* @returns Promise resolving to plan result with generated plan text
|
|
334
|
+
*
|
|
335
|
+
* @throws {Error} If task not found
|
|
336
|
+
* @throws {TaskOMaticError} If AI operation fails
|
|
337
|
+
*
|
|
338
|
+
* @example Basic implementation planning
|
|
339
|
+
* ```typescript
|
|
340
|
+
* const result = await taskService.planTask("1");
|
|
341
|
+
* console.log("Implementation Plan:");
|
|
342
|
+
* console.log(result.plan);
|
|
343
|
+
* console.log(`Generated in ${result.stats.duration}ms`);
|
|
344
|
+
* ```
|
|
345
|
+
*
|
|
346
|
+
* @example With streaming for real-time plan generation
|
|
347
|
+
* ```typescript
|
|
348
|
+
* try {
|
|
349
|
+
* const result = await taskService.planTask("1", undefined, {
|
|
350
|
+
* onChunk: (chunk) => {
|
|
351
|
+
* // Display plan as it's generated
|
|
352
|
+
* process.stdout.write(chunk);
|
|
353
|
+
* }
|
|
354
|
+
* });
|
|
355
|
+
* console.log("\n\nPlan saved to:", `plans/${result.task.id}.md`);
|
|
356
|
+
* } catch (error) {
|
|
357
|
+
* if (error instanceof TaskOMaticError) {
|
|
358
|
+
* console.error("Planning failed:", error.getDetails());
|
|
359
|
+
* }
|
|
360
|
+
* }
|
|
361
|
+
* ```
|
|
362
|
+
*/
|
|
50
363
|
planTask(taskId: string, aiOptions?: AIOptions, streamingOptions?: StreamingOptions): Promise<PlanTaskResult>;
|
|
51
364
|
getTaskDocumentation(taskId: string): Promise<string | null>;
|
|
52
365
|
addTaskDocumentationFromFile(taskId: string, filePath: string): Promise<{
|
|
@@ -70,5 +383,6 @@ export declare class TaskService {
|
|
|
70
383
|
}>>;
|
|
71
384
|
deleteTaskPlan(taskId: string): Promise<boolean>;
|
|
72
385
|
}
|
|
386
|
+
export declare function getTaskService(): TaskService;
|
|
73
387
|
export declare const taskService: TaskService;
|
|
74
388
|
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/services/tasks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/services/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAiB,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EACL,IAAI,EACJ,gBAAgB,EAChB,cAAc,EAGf,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAcrC;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;IACxC,YAAY,CAAC,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;IAClD,aAAa,CAAC,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;IACpD,cAAc,CAAC,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;IACtD,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,YAAY,CAAqC;IACzD,OAAO,CAAC,aAAa,CAAsC;IAC3D,OAAO,CAAC,cAAc,CAAuC;IAC7D,OAAO,CAAC,KAAK,CAAe;IAE5B;;;;OAIG;gBACS,YAAY,G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