task-o-matic 0.0.15 → 0.0.16
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/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +15 -2
- package/dist/lib/ai-service/base-operations.d.ts +8 -0
- package/dist/lib/ai-service/base-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/base-operations.js +23 -10
- package/dist/lib/ai-service/prd-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/prd-operations.js +50 -7
- package/dist/lib/ai-service/task-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/task-operations.js +29 -4
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +11 -2
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +2 -1
- package/dist/services/prd.d.ts.map +1 -1
- package/dist/services/prd.js +20 -69
- package/dist/services/tasks.d.ts.map +1 -1
- package/dist/services/tasks.js +3 -14
- package/dist/services/workflow.d.ts.map +1 -1
- package/dist/services/workflow.js +7 -1
- package/dist/test/services/task-service.test.js +107 -0
- package/dist/utils/ai-operation-utility.d.ts.map +1 -1
- package/dist/utils/ai-operation-utility.js +1 -10
- package/dist/utils/file-utils.d.ts +23 -0
- package/dist/utils/file-utils.d.ts.map +1 -1
- package/dist/utils/file-utils.js +35 -0
- package/dist/utils/metadata-utils.d.ts +40 -0
- package/dist/utils/metadata-utils.d.ts.map +1 -0
- package/dist/utils/metadata-utils.js +43 -0
- package/package.json +6 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/commands/workflow.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/commands/workflow.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0BpC,eAAO,MAAM,eAAe,SAsKxB,CAAC"}
|
|
@@ -48,6 +48,7 @@ const inquirer_1 = __importDefault(require("inquirer"));
|
|
|
48
48
|
const workflow_prompts_1 = require("../utils/workflow-prompts");
|
|
49
49
|
const streaming_options_1 = require("../utils/streaming-options");
|
|
50
50
|
const progress_1 = require("../cli/display/progress");
|
|
51
|
+
const task_o_matic_error_1 = require("../utils/task-o-matic-error");
|
|
51
52
|
exports.workflowCommand = new commander_1.Command("workflow")
|
|
52
53
|
.description("Interactive workflow for complete project setup and task management")
|
|
53
54
|
// Existing AI options
|
|
@@ -336,7 +337,13 @@ async function stepDefinePRD(state, options, streamingOptions) {
|
|
|
336
337
|
multiGenerationModels = modelsInput.split(",").map((m) => {
|
|
337
338
|
const parts = m.trim().split(":");
|
|
338
339
|
if (parts.length < 2) {
|
|
339
|
-
throw
|
|
340
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.WORKFLOW_EXECUTION_ERROR, `Invalid model format: ${m}. Expected provider:model`, {
|
|
341
|
+
context: "Model format validation failed during multi-generation setup",
|
|
342
|
+
suggestions: [
|
|
343
|
+
"Use format: provider:model (e.g., anthropic:claude-sonnet-4.5)",
|
|
344
|
+
"Check for typos in provider or model name",
|
|
345
|
+
],
|
|
346
|
+
});
|
|
340
347
|
}
|
|
341
348
|
return { provider: parts[0], model: parts[1] };
|
|
342
349
|
});
|
|
@@ -347,7 +354,13 @@ async function stepDefinePRD(state, options, streamingOptions) {
|
|
|
347
354
|
if (combineModelInput && combineModelInput.trim()) {
|
|
348
355
|
const parts = combineModelInput.trim().split(":");
|
|
349
356
|
if (parts.length < 2) {
|
|
350
|
-
throw
|
|
357
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.WORKFLOW_EXECUTION_ERROR, `Invalid model format: ${combineModelInput}. Expected provider:model`, {
|
|
358
|
+
context: "Model format validation failed during PRD combine setup",
|
|
359
|
+
suggestions: [
|
|
360
|
+
"Use format: provider:model (e.g., anthropic:claude-sonnet-4.5)",
|
|
361
|
+
"Check for typos in provider or model name",
|
|
362
|
+
],
|
|
363
|
+
});
|
|
351
364
|
}
|
|
352
365
|
combineAI = { provider: parts[0], model: parts[1] };
|
|
353
366
|
}
|
|
@@ -30,6 +30,14 @@ export declare class BaseOperations {
|
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
protected mergeAIConfig(config?: Partial<AIConfig>): AIConfig;
|
|
33
|
+
/**
|
|
34
|
+
* Handles Context7 tool results by caching documentation.
|
|
35
|
+
* Extracts and saves documentation from get-library-docs tool results.
|
|
36
|
+
*
|
|
37
|
+
* @param chunk - The chunk to check for Context7 tool results
|
|
38
|
+
* @protected
|
|
39
|
+
*/
|
|
40
|
+
protected handleContext7ToolResult(chunk: any): void;
|
|
33
41
|
streamText(prompt: string, config?: Partial<AIConfig>, systemPrompt?: string, userMessage?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>): Promise<string>;
|
|
34
42
|
}
|
|
35
43
|
//# sourceMappingURL=base-operations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/base-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,qBAAa,cAAc;IACzB,SAAS,CAAC,UAAU,aAAoB;IACxC,SAAS,CAAC,cAAc,iBAAwB;IAChD,SAAS,CAAC,YAAY,eAAsB;IAC5C,SAAS,CAAC,aAAa,gBAAuB;IAE9C;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ;
|
|
1
|
+
{"version":3,"file":"base-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/base-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,qBAAa,cAAc;IACzB,SAAS,CAAC,UAAU,aAAoB;IACxC,SAAS,CAAC,cAAc,iBAAwB;IAChD,SAAS,CAAC,YAAY,eAAsB;IAC5C,SAAS,CAAC,aAAa,gBAAuB;IAE9C;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ;IAQ7D;;;;;;OAMG;IACH,SAAS,CAAC,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAqB9C,UAAU,CACd,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;CAgEnB"}
|
|
@@ -38,6 +38,27 @@ class BaseOperations {
|
|
|
38
38
|
// Apply operation-specific overrides (highest priority)
|
|
39
39
|
return { ...baseConfig, ...config };
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Handles Context7 tool results by caching documentation.
|
|
43
|
+
* Extracts and saves documentation from get-library-docs tool results.
|
|
44
|
+
*
|
|
45
|
+
* @param chunk - The chunk to check for Context7 tool results
|
|
46
|
+
* @protected
|
|
47
|
+
*/
|
|
48
|
+
handleContext7ToolResult(chunk) {
|
|
49
|
+
if (chunk.type === "tool-result" &&
|
|
50
|
+
chunk.toolName === "get-library-docs") {
|
|
51
|
+
const docs = chunk.output;
|
|
52
|
+
const libraryID = chunk.input?.context7CompatibleLibraryID || "unknown";
|
|
53
|
+
const topic = chunk.input?.topic || "general";
|
|
54
|
+
if (docs && typeof docs === "object" && "content" in docs) {
|
|
55
|
+
this.context7Client.saveContext7Documentation(libraryID, docs.content, topic);
|
|
56
|
+
}
|
|
57
|
+
else if (docs && typeof docs === "string") {
|
|
58
|
+
this.context7Client.saveContext7Documentation(libraryID, docs, topic);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
41
62
|
async streamText(prompt, config, systemPrompt, userMessage, streamingOptions, retryConfig) {
|
|
42
63
|
// Merge config with proper precedence (Bug fix 2.9)
|
|
43
64
|
const aiConfig = this.mergeAIConfig(config);
|
|
@@ -60,16 +81,8 @@ class BaseOperations {
|
|
|
60
81
|
else if (chunk.type === "reasoning-delta") {
|
|
61
82
|
streamingOptions.onReasoning?.(chunk.text);
|
|
62
83
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const docs = chunk.output;
|
|
66
|
-
if (docs && typeof docs === "object" && "content" in docs) {
|
|
67
|
-
this.context7Client.saveContext7Documentation(chunk.input?.context7CompatibleLibraryID || "unknown", docs.content, chunk.input?.topic || "general");
|
|
68
|
-
}
|
|
69
|
-
else if (docs && typeof docs === "string") {
|
|
70
|
-
this.context7Client.saveContext7Documentation(chunk.input?.context7CompatibleLibraryID || "unknown", docs, chunk.input?.topic || "general");
|
|
71
|
-
}
|
|
72
|
-
}
|
|
84
|
+
// Handle Context7 tool result caching
|
|
85
|
+
this.handleContext7ToolResult(chunk);
|
|
73
86
|
}
|
|
74
87
|
: undefined,
|
|
75
88
|
onFinish: streamingOptions?.onFinish
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prd-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/prd-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EAER,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EAIZ,MAAM,aAAa,CAAC;AAYrB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"prd-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/prd-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EAER,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EAIZ,MAAM,aAAa,CAAC;AAYrB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMnD,qBAAa,aAAc,SAAQ,cAAc;IACzC,QAAQ,CACZ,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAClC,gBAAgB,CAAC,EAAE,MAAM,EACzB,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,CAAC,gBAAgB,CAAC;IA2LtB,SAAS,CACb,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW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,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;CA0BnB"}
|
|
@@ -39,6 +39,7 @@ const prompt_builder_1 = require("../prompt-builder");
|
|
|
39
39
|
const prompts_1 = require("../../prompts");
|
|
40
40
|
const filesystem_tools_1 = require("./filesystem-tools");
|
|
41
41
|
const base_operations_1 = require("./base-operations");
|
|
42
|
+
const task_o_matic_error_1 = require("../../utils/task-o-matic-error");
|
|
42
43
|
class PRDOperations extends base_operations_1.BaseOperations {
|
|
43
44
|
async parsePRD(prdContent, config, promptOverride, userMessage, streamingOptions, retryConfig, workingDirectory, enableFilesystemTools) {
|
|
44
45
|
return this.retryHandler.executeWithRetry(async () => {
|
|
@@ -69,7 +70,13 @@ class PRDOperations extends base_operations_1.BaseOperations {
|
|
|
69
70
|
variables,
|
|
70
71
|
});
|
|
71
72
|
if (!promptResult.success) {
|
|
72
|
-
throw
|
|
73
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.PRD_PARSING_ERROR, `Failed to build PRD parsing prompt: ${promptResult.error}`, {
|
|
74
|
+
context: "Prompt building failed during PRD parsing",
|
|
75
|
+
suggestions: [
|
|
76
|
+
"Verify prompt template exists",
|
|
77
|
+
"Check variable substitution",
|
|
78
|
+
],
|
|
79
|
+
});
|
|
73
80
|
}
|
|
74
81
|
enhancedPrompt = promptResult.prompt;
|
|
75
82
|
}
|
|
@@ -125,7 +132,13 @@ Use these tools to understand the project structure, existing code patterns, and
|
|
|
125
132
|
}
|
|
126
133
|
const parseResult = this.jsonParser.parseJSONFromResponse(response);
|
|
127
134
|
if (!parseResult.success) {
|
|
128
|
-
throw
|
|
135
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.PRD_PARSING_ERROR, parseResult.error || "Failed to parse PRD response", {
|
|
136
|
+
context: "AI response parsing failed during PRD parsing",
|
|
137
|
+
suggestions: [
|
|
138
|
+
"Check AI response format",
|
|
139
|
+
"Verify JSON structure",
|
|
140
|
+
],
|
|
141
|
+
});
|
|
129
142
|
}
|
|
130
143
|
const parsed = parseResult.data;
|
|
131
144
|
const tasks = (parsed?.tasks || []).map((task, index) => {
|
|
@@ -195,7 +208,13 @@ Use these tools to understand the project structure, existing code patterns, and
|
|
|
195
208
|
variables,
|
|
196
209
|
});
|
|
197
210
|
if (!promptResult.success) {
|
|
198
|
-
throw
|
|
211
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.PRD_GENERATION_ERROR, `Failed to build PRD rework prompt: ${promptResult.error}`, {
|
|
212
|
+
context: "Prompt building failed during PRD rework",
|
|
213
|
+
suggestions: [
|
|
214
|
+
"Verify prompt template exists",
|
|
215
|
+
"Check variable substitution",
|
|
216
|
+
],
|
|
217
|
+
});
|
|
199
218
|
}
|
|
200
219
|
prompt = promptResult.prompt;
|
|
201
220
|
}
|
|
@@ -277,7 +296,13 @@ Use these tools to understand the current project structure, existing code patte
|
|
|
277
296
|
variables,
|
|
278
297
|
});
|
|
279
298
|
if (!promptResult.success) {
|
|
280
|
-
throw
|
|
299
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.PRD_GENERATION_ERROR, `Failed to build PRD question prompt: ${promptResult.error}`, {
|
|
300
|
+
context: "Prompt building failed during PRD question generation",
|
|
301
|
+
suggestions: [
|
|
302
|
+
"Verify prompt template exists",
|
|
303
|
+
"Check variable substitution",
|
|
304
|
+
],
|
|
305
|
+
});
|
|
281
306
|
}
|
|
282
307
|
prompt = promptResult.prompt;
|
|
283
308
|
}
|
|
@@ -324,7 +349,13 @@ Use these tools to understand the current project structure, existing code patte
|
|
|
324
349
|
}
|
|
325
350
|
const parseResult = this.jsonParser.parseJSONFromResponse(response);
|
|
326
351
|
if (!parseResult.success) {
|
|
327
|
-
throw
|
|
352
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.PRD_GENERATION_ERROR, parseResult.error || "Failed to parse PRD questions", {
|
|
353
|
+
context: "AI response parsing failed during PRD question generation",
|
|
354
|
+
suggestions: [
|
|
355
|
+
"Check AI response format",
|
|
356
|
+
"Verify JSON structure",
|
|
357
|
+
],
|
|
358
|
+
});
|
|
328
359
|
}
|
|
329
360
|
return parseResult.data?.questions || [];
|
|
330
361
|
}, retryConfig, "PRD questioning");
|
|
@@ -351,7 +382,13 @@ Use these tools to understand the current project structure, existing code patte
|
|
|
351
382
|
},
|
|
352
383
|
});
|
|
353
384
|
if (!promptResult.success) {
|
|
354
|
-
throw
|
|
385
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.PRD_GENERATION_ERROR, `Failed to build PRD question answer prompt: ${promptResult.error}`, {
|
|
386
|
+
context: "Prompt building failed during PRD answer generation",
|
|
387
|
+
suggestions: [
|
|
388
|
+
"Verify prompt template exists",
|
|
389
|
+
"Check variable substitution",
|
|
390
|
+
],
|
|
391
|
+
});
|
|
355
392
|
}
|
|
356
393
|
const systemPromptResult = prompt_builder_1.PromptBuilder.buildPrompt({
|
|
357
394
|
name: "prd-question-answer",
|
|
@@ -361,7 +398,13 @@ Use these tools to understand the current project structure, existing code patte
|
|
|
361
398
|
const response = await this.streamText("", config, systemPromptResult.prompt, promptResult.prompt, streamingOptions, { maxAttempts: 1 });
|
|
362
399
|
const parseResult = this.jsonParser.parseJSONFromResponse(response);
|
|
363
400
|
if (!parseResult.success) {
|
|
364
|
-
throw
|
|
401
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.PRD_GENERATION_ERROR, parseResult.error || "Failed to parse PRD answers response", {
|
|
402
|
+
context: "AI response parsing failed during PRD answer generation",
|
|
403
|
+
suggestions: [
|
|
404
|
+
"Check AI response format",
|
|
405
|
+
"Verify JSON structure",
|
|
406
|
+
],
|
|
407
|
+
});
|
|
365
408
|
}
|
|
366
409
|
const answers = {};
|
|
367
410
|
const numberedAnswers = parseResult.data?.answers || {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/task-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,WAAW,EAEZ,MAAM,aAAa,CAAC;AAUrB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"task-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/task-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,WAAW,EAEZ,MAAM,aAAa,CAAC;AAUrB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOnD,qBAAa,cAAe,SAAQ,cAAc;IAChD,OAAO,CAAC,kBAAkB,CAA4B;IAChD,aAAa,CACjB,IAAI,EAAE,IAAI,EACV,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAClC,WAAW,CAAC,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,MAAM,EAClB,gBAAgB,CAAC,EAAE,IAAI,EAAE,EACzB,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,CACR,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CACpE;IAmHK,WAAW,CACf,KAAK,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,MAAM,EACf,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;IA4FZ,QAAQ,CACZ,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;CAoEnB"}
|
|
@@ -8,6 +8,7 @@ const ai_service_factory_1 = require("../../utils/ai-service-factory");
|
|
|
8
8
|
const filesystem_tools_1 = require("./filesystem-tools");
|
|
9
9
|
const base_operations_1 = require("./base-operations");
|
|
10
10
|
const ai_operation_utility_1 = require("../../utils/ai-operation-utility");
|
|
11
|
+
const task_o_matic_error_1 = require("../../utils/task-o-matic-error");
|
|
11
12
|
class TaskOperations extends base_operations_1.BaseOperations {
|
|
12
13
|
aiOperationUtility = new ai_operation_utility_1.AIOperationUtility();
|
|
13
14
|
async breakdownTask(task, config, promptOverride, userMessage, streamingOptions, retryConfig, fullContent, stackInfo, existingSubtasks, enableFilesystemTools) {
|
|
@@ -39,7 +40,13 @@ class TaskOperations extends base_operations_1.BaseOperations {
|
|
|
39
40
|
variables,
|
|
40
41
|
});
|
|
41
42
|
if (!promptResult.success) {
|
|
42
|
-
throw
|
|
43
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.AI_OPERATION_FAILED, `Failed to build task breakdown prompt: ${promptResult.error}`, {
|
|
44
|
+
context: "Prompt building failed during task breakdown operation",
|
|
45
|
+
suggestions: [
|
|
46
|
+
"Verify prompt template exists",
|
|
47
|
+
"Check variable substitution",
|
|
48
|
+
],
|
|
49
|
+
});
|
|
43
50
|
}
|
|
44
51
|
prompt = promptResult.prompt;
|
|
45
52
|
}
|
|
@@ -59,7 +66,13 @@ Use these tools to understand the project structure, existing code, and dependen
|
|
|
59
66
|
: ""), userMessage || prompt, config, streamingOptions, tools);
|
|
60
67
|
const parseResult = this.jsonParser.parseJSONFromResponse(response);
|
|
61
68
|
if (!parseResult.success) {
|
|
62
|
-
throw
|
|
69
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.AI_OPERATION_FAILED, parseResult.error || "Failed to parse task breakdown response", {
|
|
70
|
+
context: "AI response parsing failed during task breakdown",
|
|
71
|
+
suggestions: [
|
|
72
|
+
"Check AI response format",
|
|
73
|
+
"Verify JSON structure",
|
|
74
|
+
],
|
|
75
|
+
});
|
|
63
76
|
}
|
|
64
77
|
const parsed = parseResult.data;
|
|
65
78
|
return (parsed?.subtasks || []).map((subtask) => ({
|
|
@@ -123,7 +136,13 @@ Use these tools to understand the project structure, existing code, and dependen
|
|
|
123
136
|
},
|
|
124
137
|
});
|
|
125
138
|
if (!promptResult.success) {
|
|
126
|
-
throw
|
|
139
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.AI_OPERATION_FAILED, `Failed to build task enhancement prompt: ${promptResult.error}`, {
|
|
140
|
+
context: "Prompt building failed during task enhancement operation",
|
|
141
|
+
suggestions: [
|
|
142
|
+
"Verify prompt template exists",
|
|
143
|
+
"Check variable substitution",
|
|
144
|
+
],
|
|
145
|
+
});
|
|
127
146
|
}
|
|
128
147
|
prompt = promptResult.prompt;
|
|
129
148
|
}
|
|
@@ -155,7 +174,13 @@ Use these tools to understand the project structure, existing code, and dependen
|
|
|
155
174
|
},
|
|
156
175
|
});
|
|
157
176
|
if (!promptResult.success) {
|
|
158
|
-
throw
|
|
177
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.AI_OPERATION_FAILED, `Failed to build task planning prompt: ${promptResult.error}`, {
|
|
178
|
+
context: "Prompt building failed during task planning operation",
|
|
179
|
+
suggestions: [
|
|
180
|
+
"Verify prompt template exists",
|
|
181
|
+
"Check variable substitution",
|
|
182
|
+
],
|
|
183
|
+
});
|
|
159
184
|
}
|
|
160
185
|
prompt = promptResult.prompt;
|
|
161
186
|
}
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAA6C,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAA6C,MAAM,UAAU,CAAC;AAS/E,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,QAAQ,CAAC;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9C,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC7C;AA4CD,wBAAgB,4BAA4B,CAC1C,UAAU,GAAE,MAAc,GACzB,eAAe,CA+BjB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,SAAS,CAAkB;gBAEvB,SAAS,CAAC,EAAE,eAAe,EAAE,gBAAgB,CAAC,EAAE,MAAM;IAiBlE,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQtC,YAAY,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI;IAK9C,mBAAmB,IAAI,MAAM;IAI7B,gBAAgB,IAAI,MAAM;IAI1B,OAAO,CAAC,aAAa;IAoBf,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IA6CvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAqB3B,SAAS,IAAI,MAAM;IAqBnB,WAAW,IAAI,QAAQ;IAIjB,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB7D,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAK/B,iBAAiB,IAAI,MAAM;CAG5B;AAED,eAAO,MAAM,aAAa,eAAsB,CAAC;AAEjD;;;;;;;;;;;;GAYG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,aAA6B,GACrC,OAAO,CAAC,MAAM,CAAC,CAGjB"}
|
package/dist/lib/config.js
CHANGED
|
@@ -8,6 +8,7 @@ const process_1 = require("process");
|
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const dotenv_1 = require("dotenv");
|
|
10
10
|
const config_validation_1 = require("./config-validation");
|
|
11
|
+
const task_o_matic_error_1 = require("../utils/task-o-matic-error");
|
|
11
12
|
// Provider-specific sensible defaults for 2025
|
|
12
13
|
const PROVIDER_DEFAULTS = {
|
|
13
14
|
openrouter: {
|
|
@@ -167,7 +168,9 @@ class ConfigManager {
|
|
|
167
168
|
}
|
|
168
169
|
async save() {
|
|
169
170
|
if (!this.config) {
|
|
170
|
-
throw
|
|
171
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.CONFIGURATION_ERROR, "Config not loaded, cannot save.", {
|
|
172
|
+
suggestions: ["Call await configManager.load() before saving"],
|
|
173
|
+
});
|
|
171
174
|
}
|
|
172
175
|
try {
|
|
173
176
|
await this.callbacks.write("config.json", JSON.stringify(this.config, null, 2));
|
|
@@ -183,7 +186,13 @@ class ConfigManager {
|
|
|
183
186
|
// Since we can't be async here, we must throw or return defaults.
|
|
184
187
|
// Returning defaults might hide issues.
|
|
185
188
|
// Throwing forces users to await load().
|
|
186
|
-
throw
|
|
189
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.CONFIGURATION_ERROR, "Config not loaded. Call await configManager.load() first.", {
|
|
190
|
+
context: "Configuration must be loaded before access",
|
|
191
|
+
suggestions: [
|
|
192
|
+
"Call await configManager.load() first",
|
|
193
|
+
"Check initialization order",
|
|
194
|
+
],
|
|
195
|
+
});
|
|
187
196
|
}
|
|
188
197
|
return this.config;
|
|
189
198
|
}
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export type { CreateTaskOptions, SplitTaskOptions, PlanTaskOptions, EnhanceTaskO
|
|
|
57
57
|
* Factory functions for getting singleton instances of core services
|
|
58
58
|
* These ensure only one instance exists throughout the application
|
|
59
59
|
*/
|
|
60
|
-
export { getAIOperations, getModelProvider, getStorage, getContextBuilder, resetServiceInstances, } from "../utils/ai-service-factory";
|
|
60
|
+
export { getAIOperations, getModelProvider, getStorage, getContextBuilder, resetServiceInstances, initializeServices, } from "../utils/ai-service-factory";
|
|
61
61
|
/**
|
|
62
62
|
* AI configuration builder utility
|
|
63
63
|
*/
|
package/dist/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;GAGG;AACH,OAAO,EAAE,UAA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,EACf,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAM1B;;;GAGG;AACH,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AAErC;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,YAAY,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAM5D;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAExD;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAMjD;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D;;GAEG;AACH,OAAO,EACL,sBAAsB,EACtB,wCAAwC,GACzC,MAAM,4BAA4B,CAAC;AAMpC;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/lib/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
32
32
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.runValidations = exports.isValidAIProvider = exports.createStreamingOptionsWithCustomHandlers = exports.createStreamingOptions = exports.formatStackInfo = exports.PromptBuilder = exports.ContextBuilder = exports.ModelProvider = exports.AIOperations = exports.configManager = exports.ConfigManager = exports.FileSystemStorage = exports.buildAIConfig = exports.resetServiceInstances = exports.getContextBuilder = exports.getStorage = exports.getModelProvider = exports.getAIOperations = exports.BenchmarkService = exports.WorkflowService = exports.PRDService = exports.TaskService = void 0;
|
|
35
|
+
exports.runValidations = exports.isValidAIProvider = exports.createStreamingOptionsWithCustomHandlers = exports.createStreamingOptions = exports.formatStackInfo = exports.PromptBuilder = exports.ContextBuilder = exports.ModelProvider = exports.AIOperations = exports.configManager = exports.ConfigManager = exports.FileSystemStorage = exports.buildAIConfig = exports.initializeServices = exports.resetServiceInstances = exports.getContextBuilder = exports.getStorage = exports.getModelProvider = exports.getAIOperations = exports.BenchmarkService = exports.WorkflowService = exports.PRDService = exports.TaskService = void 0;
|
|
36
36
|
// ============================================================================
|
|
37
37
|
// Main Services - Business Logic Layer
|
|
38
38
|
// ============================================================================
|
|
@@ -81,6 +81,7 @@ Object.defineProperty(exports, "getModelProvider", { enumerable: true, get: func
|
|
|
81
81
|
Object.defineProperty(exports, "getStorage", { enumerable: true, get: function () { return ai_service_factory_1.getStorage; } });
|
|
82
82
|
Object.defineProperty(exports, "getContextBuilder", { enumerable: true, get: function () { return ai_service_factory_1.getContextBuilder; } });
|
|
83
83
|
Object.defineProperty(exports, "resetServiceInstances", { enumerable: true, get: function () { return ai_service_factory_1.resetServiceInstances; } });
|
|
84
|
+
Object.defineProperty(exports, "initializeServices", { enumerable: true, get: function () { return ai_service_factory_1.initializeServices; } });
|
|
84
85
|
/**
|
|
85
86
|
* AI configuration builder utility
|
|
86
87
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prd.d.ts","sourceRoot":"","sources":["../../src/services/prd.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAiB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I,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE;YACL,QAAQ,EAAE,MAAM,CAAC;YACjB,UAAU,CAAC,EAAE;gBAAE,MAAM,EAAE,MAAM,CAAC;gBAAC,UAAU,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE,CAAC;YACnE,gBAAgB,CAAC,EAAE,MAAM,CAAC;YAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;SACf,CAAC;KACH,CAAC;CAuDH;AAKD,wBAAgB,aAAa,IAAI,UAAU,CAK1C;AAGD,eAAO,MAAM,UAAU,YAIrB,CAAC"}
|
package/dist/services/prd.js
CHANGED
|
@@ -381,48 +381,23 @@ class PRDService {
|
|
|
381
381
|
}
|
|
382
382
|
async generatePRD(input) {
|
|
383
383
|
const startTime = Date.now();
|
|
384
|
-
let tokenUsage;
|
|
385
|
-
let timeToFirstToken;
|
|
386
|
-
let cost;
|
|
387
384
|
input.callbacks?.onProgress?.({
|
|
388
385
|
type: "started",
|
|
389
386
|
message: "Generating PRD...",
|
|
390
387
|
});
|
|
391
|
-
//
|
|
392
|
-
const metricsStreamingOptions =
|
|
393
|
-
...input.streamingOptions,
|
|
394
|
-
onFinish: async (result) => {
|
|
395
|
-
if (result.usage) {
|
|
396
|
-
tokenUsage = {
|
|
397
|
-
prompt: result.usage.inputTokens || result.usage.promptTokens || 0,
|
|
398
|
-
completion: result.usage.outputTokens || result.usage.completionTokens || 0,
|
|
399
|
-
total: result.usage.totalTokens || 0,
|
|
400
|
-
};
|
|
401
|
-
// Simple cost estimation placeholder
|
|
402
|
-
if (tokenUsage.total > 0) {
|
|
403
|
-
cost = tokenUsage.total * 0.000001;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
await input.streamingOptions?.onFinish?.(result);
|
|
407
|
-
},
|
|
408
|
-
onChunk: (chunk) => {
|
|
409
|
-
if (chunk && !timeToFirstToken) {
|
|
410
|
-
timeToFirstToken = Date.now() - startTime;
|
|
411
|
-
}
|
|
412
|
-
input.streamingOptions?.onChunk?.(chunk);
|
|
413
|
-
},
|
|
414
|
-
};
|
|
388
|
+
// Use utility to wrap streaming options and capture metrics
|
|
389
|
+
const { options: metricsStreamingOptions, getMetrics } = (0, streaming_utils_1.createMetricsStreamingOptions)(input.streamingOptions, startTime);
|
|
415
390
|
const aiConfig = (0, ai_config_builder_1.buildAIConfig)(input.aiOptions);
|
|
416
391
|
const content = await this.aiOperations.generatePRD(input.description, aiConfig, undefined, undefined, metricsStreamingOptions);
|
|
417
|
-
//
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
392
|
+
// Get metrics after AI operation
|
|
393
|
+
const { tokenUsage, timeToFirstToken } = getMetrics();
|
|
394
|
+
// Calculate cost if needed
|
|
395
|
+
let cost;
|
|
396
|
+
if (tokenUsage && tokenUsage.total > 0) {
|
|
397
|
+
cost = tokenUsage.total * 0.000001; // Placeholder cost calculation
|
|
422
398
|
}
|
|
423
|
-
|
|
424
|
-
const path = (0,
|
|
425
|
-
(0, fs_1.writeFileSync)(path, content);
|
|
399
|
+
// Save file using utility
|
|
400
|
+
const path = (0, file_utils_1.savePRDFile)(content, input.filename, input.outputDir);
|
|
426
401
|
input.callbacks?.onProgress?.({
|
|
427
402
|
type: "completed",
|
|
428
403
|
message: `PRD generated and saved to ${path}`,
|
|
@@ -440,47 +415,23 @@ class PRDService {
|
|
|
440
415
|
}
|
|
441
416
|
async combinePRDs(input) {
|
|
442
417
|
const startTime = Date.now();
|
|
443
|
-
let tokenUsage;
|
|
444
|
-
let timeToFirstToken;
|
|
445
|
-
let cost;
|
|
446
418
|
input.callbacks?.onProgress?.({
|
|
447
419
|
type: "started",
|
|
448
420
|
message: "Combining PRDs...",
|
|
449
421
|
});
|
|
450
|
-
//
|
|
451
|
-
const metricsStreamingOptions =
|
|
452
|
-
...input.streamingOptions,
|
|
453
|
-
onFinish: async (result) => {
|
|
454
|
-
if (result.usage) {
|
|
455
|
-
tokenUsage = {
|
|
456
|
-
prompt: result.usage.inputTokens || result.usage.promptTokens || 0,
|
|
457
|
-
completion: result.usage.outputTokens || result.usage.completionTokens || 0,
|
|
458
|
-
total: result.usage.totalTokens || 0,
|
|
459
|
-
};
|
|
460
|
-
if (tokenUsage.total > 0) {
|
|
461
|
-
cost = tokenUsage.total * 0.000001;
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
await input.streamingOptions?.onFinish?.(result);
|
|
465
|
-
},
|
|
466
|
-
onChunk: (chunk) => {
|
|
467
|
-
if (chunk && !timeToFirstToken) {
|
|
468
|
-
timeToFirstToken = Date.now() - startTime;
|
|
469
|
-
}
|
|
470
|
-
input.streamingOptions?.onChunk?.(chunk);
|
|
471
|
-
},
|
|
472
|
-
};
|
|
422
|
+
// Use utility to wrap streaming options and capture metrics
|
|
423
|
+
const { options: metricsStreamingOptions, getMetrics } = (0, streaming_utils_1.createMetricsStreamingOptions)(input.streamingOptions, startTime);
|
|
473
424
|
const aiConfig = (0, ai_config_builder_1.buildAIConfig)(input.aiOptions);
|
|
474
425
|
const content = await this.aiOperations.combinePRDs(input.prds, input.originalDescription, aiConfig, undefined, undefined, metricsStreamingOptions);
|
|
475
|
-
//
|
|
476
|
-
const
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
426
|
+
// Get metrics after AI operation
|
|
427
|
+
const { tokenUsage, timeToFirstToken } = getMetrics();
|
|
428
|
+
// Calculate cost if needed
|
|
429
|
+
let cost;
|
|
430
|
+
if (tokenUsage && tokenUsage.total > 0) {
|
|
431
|
+
cost = tokenUsage.total * 0.000001;
|
|
480
432
|
}
|
|
481
|
-
|
|
482
|
-
const path = (0,
|
|
483
|
-
(0, fs_1.writeFileSync)(path, content);
|
|
433
|
+
// Save file using utility (defaults to "prd.md" if no filename, so we provide the default for combinePRDs)
|
|
434
|
+
const path = (0, file_utils_1.savePRDFile)(content, input.filename || "prd-master.md", input.outputDir);
|
|
484
435
|
input.callbacks?.onProgress?.({
|
|
485
436
|
type: "completed",
|
|
486
437
|
message: `Master PRD saved to ${path}`,
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAerC;;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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MAAM,GACb,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAInE,aAAa,IAAI,OAAO,CAC5B,KAAK,CAAC;QACJ,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CACH;IAIK,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGvD;AAKD,wBAAgB,cAAc,IAAI,WAAW,CAK5C;AAGD,eAAO,MAAM,WAAW,aAItB,CAAC"}
|
package/dist/services/tasks.js
CHANGED
|
@@ -43,6 +43,7 @@ const streaming_utils_1 = require("../utils/streaming-utils");
|
|
|
43
43
|
const error_utils_1 = require("../utils/error-utils");
|
|
44
44
|
const id_generator_1 = require("../utils/id-generator");
|
|
45
45
|
const task_o_matic_error_1 = require("../utils/task-o-matic-error");
|
|
46
|
+
const metadata_utils_1 = require("../utils/metadata-utils");
|
|
46
47
|
/**
|
|
47
48
|
* TaskService - Centralized business logic for all task operations
|
|
48
49
|
*
|
|
@@ -707,13 +708,7 @@ class TaskService {
|
|
|
707
708
|
createdSubtasks.push(result.task);
|
|
708
709
|
// Save AI metadata for each subtask (Bug fix 2.3)
|
|
709
710
|
const subtaskMetadata = {
|
|
710
|
-
|
|
711
|
-
aiGenerated: true,
|
|
712
|
-
aiPrompt: promptOverride ||
|
|
713
|
-
"Split task into meaningful subtasks with full context and existing subtask awareness",
|
|
714
|
-
confidence: 0.9,
|
|
715
|
-
aiProvider: aiConfig.provider,
|
|
716
|
-
aiModel: aiConfig.model,
|
|
711
|
+
...(0, metadata_utils_1.createBaseAIMetadata)(result.task.id, aiConfig, promptOverride, "Split task into meaningful subtasks with full context and existing subtask awareness", 0.9),
|
|
717
712
|
splitAt: splitTimestamp,
|
|
718
713
|
parentTaskId: taskId,
|
|
719
714
|
subtaskIndex: i + 1,
|
|
@@ -722,13 +717,7 @@ class TaskService {
|
|
|
722
717
|
}
|
|
723
718
|
// Save AI metadata for parent task as well
|
|
724
719
|
const parentMetadata = {
|
|
725
|
-
|
|
726
|
-
aiGenerated: true,
|
|
727
|
-
aiPrompt: promptOverride ||
|
|
728
|
-
"Split task into meaningful subtasks with full context and existing subtask awareness",
|
|
729
|
-
confidence: 0.9,
|
|
730
|
-
aiProvider: aiConfig.provider,
|
|
731
|
-
aiModel: aiConfig.model,
|
|
720
|
+
...(0, metadata_utils_1.createBaseAIMetadata)(task.id, aiConfig, promptOverride, "Split task into meaningful subtasks with full context and existing subtask awareness", 0.9),
|
|
732
721
|
splitAt: splitTimestamp,
|
|
733
722
|
subtasksCreated: createdSubtasks.length,
|
|
734
723
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/services/workflow.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAQ,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/services/workflow.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAQ,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,2BAA2B,CAAC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_cli_1 = require("../lib/better-t-stack-cli");
|
|
|
8
8
|
const prd_1 = require("./prd");
|
|
9
9
|
const tasks_1 = require("./tasks");
|
|
10
10
|
const workflow_ai_assistant_1 = require("./workflow-ai-assistant");
|
|
11
|
+
const task_o_matic_error_1 = require("../utils/task-o-matic-error");
|
|
11
12
|
/**
|
|
12
13
|
* WorkflowService - Business logic for workflow operations
|
|
13
14
|
* Extracts all workflow logic from the command layer for reusability
|
|
@@ -222,7 +223,12 @@ class WorkflowService {
|
|
|
222
223
|
let prdFilename = "prd.md";
|
|
223
224
|
if (input.method === "upload" && input.prdFile) {
|
|
224
225
|
if (!(0, fs_1.existsSync)(input.prdFile)) {
|
|
225
|
-
throw
|
|
226
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.INVALID_INPUT, `PRD file not found: ${input.prdFile}`, {
|
|
227
|
+
suggestions: [
|
|
228
|
+
"Verify the file path is correct",
|
|
229
|
+
"Check if file was moved or deleted",
|
|
230
|
+
],
|
|
231
|
+
});
|
|
226
232
|
}
|
|
227
233
|
prdContent = (0, fs_1.readFileSync)(input.prdFile, "utf-8");
|
|
228
234
|
prdFilename = input.prdFile.split("/").pop() || "prd.md";
|
|
@@ -349,4 +349,111 @@ describe("TaskService", () => {
|
|
|
349
349
|
});
|
|
350
350
|
});
|
|
351
351
|
});
|
|
352
|
+
describe("getTask", () => {
|
|
353
|
+
it("should retrieve a task by ID", async () => {
|
|
354
|
+
const taskData = (0, test_utils_1.createTestTaskData)();
|
|
355
|
+
const createResult = await taskService.createTask({ title: taskData.title });
|
|
356
|
+
const task = await taskService.getTask(createResult.task.id);
|
|
357
|
+
assert.ok(task !== null);
|
|
358
|
+
if (task) {
|
|
359
|
+
assert.strictEqual(task.id, createResult.task.id);
|
|
360
|
+
assert.strictEqual(task.title, taskData.title);
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
it("should return null for non-existent task", async () => {
|
|
364
|
+
const task = await taskService.getTask("non-existent-id");
|
|
365
|
+
assert.strictEqual(task, null);
|
|
366
|
+
});
|
|
367
|
+
});
|
|
368
|
+
describe("getSubtasks", () => {
|
|
369
|
+
it("should return empty array for task without subtasks", async () => {
|
|
370
|
+
const createResult = await taskService.createTask({ title: "Parent Task" });
|
|
371
|
+
const subtasks = await taskService.getSubtasks(createResult.task.id);
|
|
372
|
+
assert.strictEqual(subtasks.length, 0);
|
|
373
|
+
});
|
|
374
|
+
it("should return all subtasks for a parent task", async () => {
|
|
375
|
+
const parentResult = await taskService.createTask({ title: "Parent" });
|
|
376
|
+
await taskService.createTask({ title: "Subtask 1", parentId: parentResult.task.id });
|
|
377
|
+
await taskService.createTask({ title: "Subtask 2", parentId: parentResult.task.id });
|
|
378
|
+
const subtasks = await taskService.getSubtasks(parentResult.task.id);
|
|
379
|
+
assert.strictEqual(subtasks.length, 2);
|
|
380
|
+
assert.ok(subtasks.every(t => t.parentId === parentResult.task.id));
|
|
381
|
+
});
|
|
382
|
+
});
|
|
383
|
+
describe("Tag Management", () => {
|
|
384
|
+
it("should add tags to a task", async () => {
|
|
385
|
+
const createResult = await taskService.createTask({ title: "Test Task" });
|
|
386
|
+
await taskService.addTags(createResult.task.id, ["urgent", "bug"]);
|
|
387
|
+
const task = await taskService.getTask(createResult.task.id);
|
|
388
|
+
assert.ok(task !== null);
|
|
389
|
+
if (task && task.tags) {
|
|
390
|
+
assert.ok(task.tags.includes("urgent"));
|
|
391
|
+
assert.ok(task.tags.includes("bug"));
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
it("should remove tags from a task", async () => {
|
|
395
|
+
const createResult = await taskService.createTask({
|
|
396
|
+
title: "Test Task"
|
|
397
|
+
});
|
|
398
|
+
// Add tags first
|
|
399
|
+
await taskService.addTags(createResult.task.id, ["urgent", "bug"]);
|
|
400
|
+
// Then remove one
|
|
401
|
+
const updatedTask = await taskService.removeTags(createResult.task.id, ["bug"]);
|
|
402
|
+
if (updatedTask.tags) {
|
|
403
|
+
assert.strictEqual(updatedTask.tags.includes("bug"), false);
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
it("should not duplicate tags when adding existing tags", async () => {
|
|
407
|
+
const createResult = await taskService.createTask({
|
|
408
|
+
title: "Test Task"
|
|
409
|
+
});
|
|
410
|
+
await taskService.addTags(createResult.task.id, ["urgent"]);
|
|
411
|
+
await taskService.addTags(createResult.task.id, ["urgent", "bug"]);
|
|
412
|
+
const task = await taskService.getTask(createResult.task.id);
|
|
413
|
+
if (task && task.tags) {
|
|
414
|
+
const urgentCount = task.tags.filter(t => t === "urgent").length;
|
|
415
|
+
assert.strictEqual(urgentCount, 1);
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
describe("setTaskStatus", () => {
|
|
420
|
+
it("should update task status", async () => {
|
|
421
|
+
const createResult = await taskService.createTask({ title: "Test Task" });
|
|
422
|
+
await taskService.setTaskStatus(createResult.task.id, "in-progress");
|
|
423
|
+
const task = await taskService.getTask(createResult.task.id);
|
|
424
|
+
assert.ok(task !== null);
|
|
425
|
+
if (task) {
|
|
426
|
+
assert.strictEqual(task.status, "in-progress");
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
it("should allow valid status transitions", async () => {
|
|
430
|
+
const createResult = await taskService.createTask({ title: "Test Task" });
|
|
431
|
+
await taskService.setTaskStatus(createResult.task.id, "in-progress");
|
|
432
|
+
await taskService.setTaskStatus(createResult.task.id, "completed");
|
|
433
|
+
const task = await taskService.getTask(createResult.task.id);
|
|
434
|
+
assert.ok(task !== null);
|
|
435
|
+
if (task) {
|
|
436
|
+
assert.strictEqual(task.status, "completed");
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
describe("getNextTask", () => {
|
|
441
|
+
it("should return next pending task", async () => {
|
|
442
|
+
await taskService.createTask({ title: "Task 1" });
|
|
443
|
+
const nextTask = await taskService.getNextTask({});
|
|
444
|
+
assert.ok(nextTask !== null);
|
|
445
|
+
});
|
|
446
|
+
it("should filter by tag", async () => {
|
|
447
|
+
const task1 = await taskService.createTask({ title: "Task 1" });
|
|
448
|
+
const task2 = await taskService.createTask({ title: "Task 2" });
|
|
449
|
+
// Add tags after creation
|
|
450
|
+
await taskService.addTags(task1.task.id, ["backend"]);
|
|
451
|
+
await taskService.addTags(task2.task.id, ["frontend"]);
|
|
452
|
+
const nextTask = await taskService.getNextTask({ tag: "frontend" });
|
|
453
|
+
// Either returns frontend task or null if implementation differs
|
|
454
|
+
if (nextTask && nextTask.tags) {
|
|
455
|
+
assert.ok(nextTask.tags.includes("frontend"));
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
});
|
|
352
459
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-operation-utility.d.ts","sourceRoot":"","sources":["../../src/utils/ai-operation-utility.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGnE,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,MAAM,EAAE,CAAC,CAAC;IACV,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE;YACX,MAAM,EAAE,MAAM,CAAC;YACf,UAAU,EAAE,MAAM,CAAC;YACnB,KAAK,EAAE,MAAM,CAAC;SACf,CAAC;QACF,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH;AAED,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7B,qBAAqB,CAAC,EAAE,OAAO,C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amingOptions?.onChunk || streamingOptions?.onReasoning
|
|
217
217
|
? (event) => {
|
|
218
218
|
// Handle Context7 tool results ALWAYS (critical for caching)
|
|
219
|
-
|
|
220
|
-
event.chunk?.toolName === "get-library-docs") {
|
|
221
|
-
const docs = event.chunk.output;
|
|
222
|
-
if (docs && typeof docs === "object" && "content" in docs) {
|
|
223
|
-
this.context7Client.saveContext7Documentation(event.chunk.input?.context7CompatibleLibraryID || "unknown", docs.content, event.chunk.input?.topic || "general");
|
|
224
|
-
}
|
|
225
|
-
else if (docs && typeof docs === "string") {
|
|
226
|
-
this.context7Client.saveContext7Documentation(event.chunk.input?.context7CompatibleLibraryID || "unknown", docs, event.chunk.input?.topic || "general");
|
|
227
|
-
}
|
|
228
|
-
}
|
|
219
|
+
this.handleContext7ToolResult(event.chunk);
|
|
229
220
|
// Forward text deltas to user callback
|
|
230
221
|
if (event.chunk?.type === "text-delta") {
|
|
231
222
|
streamingOptions?.onChunk?.(event.chunk.text);
|
|
@@ -46,4 +46,27 @@ export declare function fileExists(filePath: string): boolean;
|
|
|
46
46
|
* @returns Promise resolving to true if file exists, false otherwise
|
|
47
47
|
*/
|
|
48
48
|
export declare function fileExistsAsync(filePath: string): Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* Saves a file to the PRD directory, ensuring the directory exists.
|
|
51
|
+
* If no output directory is specified, uses `.task-o-matic/prd/` by default.
|
|
52
|
+
*
|
|
53
|
+
* @param content - Content to write to the file
|
|
54
|
+
* @param filename - Filename (defaults to "prd.md")
|
|
55
|
+
* @param outputDir - Optional output directory override
|
|
56
|
+
* @returns Full path to the saved file
|
|
57
|
+
* @throws TaskOMaticError if file saving fails
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* // Save to default location (.task-o-matic/prd/prd.md)
|
|
62
|
+
* const path = savePRDFile("# My PRD\n...");
|
|
63
|
+
*
|
|
64
|
+
* // Save with custom filename
|
|
65
|
+
* const path = savePRDFile("# My PRD\n...", "custom-prd.md");
|
|
66
|
+
*
|
|
67
|
+
* // Save to custom directory
|
|
68
|
+
* const path = savePRDFile("# My PRD\n...", "prd.md", "./docs");
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export declare function savePRDFile(content: string, filename?: string, outputDir?: string): string;
|
|
49
72
|
//# sourceMappingURL=file-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-utils.d.ts","sourceRoot":"","sources":["../../src/utils/file-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-utils.d.ts","sourceRoot":"","sources":["../../src/utils/file-utils.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,MAAM,GACrB,IAAI,CAUN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,CAYf;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOxE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE,MAAiB,EAC3B,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAYR"}
|
package/dist/utils/file-utils.js
CHANGED
|
@@ -4,9 +4,12 @@ exports.validateFileExists = validateFileExists;
|
|
|
4
4
|
exports.validateFileExistsAsync = validateFileExistsAsync;
|
|
5
5
|
exports.fileExists = fileExists;
|
|
6
6
|
exports.fileExistsAsync = fileExistsAsync;
|
|
7
|
+
exports.savePRDFile = savePRDFile;
|
|
7
8
|
const fs_1 = require("fs");
|
|
8
9
|
const promises_1 = require("fs/promises");
|
|
10
|
+
const path_1 = require("path");
|
|
9
11
|
const task_o_matic_error_1 = require("./task-o-matic-error");
|
|
12
|
+
const config_1 = require("../lib/config");
|
|
10
13
|
/**
|
|
11
14
|
* Validates that a file exists at the given path (synchronous).
|
|
12
15
|
* Throws an error with a custom message if the file doesn't exist.
|
|
@@ -80,3 +83,35 @@ async function fileExistsAsync(filePath) {
|
|
|
80
83
|
return false;
|
|
81
84
|
}
|
|
82
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Saves a file to the PRD directory, ensuring the directory exists.
|
|
88
|
+
* If no output directory is specified, uses `.task-o-matic/prd/` by default.
|
|
89
|
+
*
|
|
90
|
+
* @param content - Content to write to the file
|
|
91
|
+
* @param filename - Filename (defaults to "prd.md")
|
|
92
|
+
* @param outputDir - Optional output directory override
|
|
93
|
+
* @returns Full path to the saved file
|
|
94
|
+
* @throws TaskOMaticError if file saving fails
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* // Save to default location (.task-o-matic/prd/prd.md)
|
|
99
|
+
* const path = savePRDFile("# My PRD\n...");
|
|
100
|
+
*
|
|
101
|
+
* // Save with custom filename
|
|
102
|
+
* const path = savePRDFile("# My PRD\n...", "custom-prd.md");
|
|
103
|
+
*
|
|
104
|
+
* // Save to custom directory
|
|
105
|
+
* const path = savePRDFile("# My PRD\n...", "prd.md", "./docs");
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
function savePRDFile(content, filename = "prd.md", outputDir) {
|
|
109
|
+
const taskOMaticDir = config_1.configManager.getTaskOMaticDir();
|
|
110
|
+
const prdDir = outputDir || (0, path_1.join)(taskOMaticDir, "prd");
|
|
111
|
+
if (!(0, fs_1.existsSync)(prdDir)) {
|
|
112
|
+
(0, fs_1.mkdirSync)(prdDir, { recursive: true });
|
|
113
|
+
}
|
|
114
|
+
const path = (0, path_1.join)(prdDir, filename);
|
|
115
|
+
(0, fs_1.writeFileSync)(path, content);
|
|
116
|
+
return path;
|
|
117
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AIConfig } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Creates base AI metadata object with common fields.
|
|
4
|
+
* Caller can extend with operation-specific fields.
|
|
5
|
+
*
|
|
6
|
+
* @param taskId - The ID of the task
|
|
7
|
+
* @param aiConfig - AI configuration used for the operation
|
|
8
|
+
* @param promptOverride - Optional custom prompt override
|
|
9
|
+
* @param defaultPrompt - Default prompt if no override provided
|
|
10
|
+
* @param confidence - Confidence score (0-1) for the AI operation
|
|
11
|
+
* @returns Base metadata object
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const baseMetadata = createBaseAIMetadata(
|
|
16
|
+
* "task-123",
|
|
17
|
+
* { provider: "anthropic", model: "claude-sonnet-4.5" },
|
|
18
|
+
* undefined,
|
|
19
|
+
* "Split task into subtasks",
|
|
20
|
+
* 0.9
|
|
21
|
+
* );
|
|
22
|
+
*
|
|
23
|
+
* // Extend with operation-specific fields
|
|
24
|
+
* const subtaskMetadata = {
|
|
25
|
+
* ...baseMetadata,
|
|
26
|
+
* parentTaskId: "parent-123",
|
|
27
|
+
* subtaskIndex: 1
|
|
28
|
+
* };
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function createBaseAIMetadata(taskId: string, aiConfig: Partial<AIConfig>, promptOverride?: string, defaultPrompt?: string, confidence?: number): {
|
|
32
|
+
taskId: string;
|
|
33
|
+
aiGenerated: boolean;
|
|
34
|
+
aiPrompt: string;
|
|
35
|
+
confidence: number;
|
|
36
|
+
aiProvider: import("../types").AIProvider | undefined;
|
|
37
|
+
aiModel: string | undefined;
|
|
38
|
+
generatedAt: number;
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=metadata-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata-utils.d.ts","sourceRoot":"","sources":["../../src/utils/metadata-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC3B,cAAc,CAAC,EAAE,MAAM,EACvB,aAAa,GAAE,MAA4B,EAC3C,UAAU,GAAE,MAAY;;;;;;;;EAWzB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBaseAIMetadata = createBaseAIMetadata;
|
|
4
|
+
/**
|
|
5
|
+
* Creates base AI metadata object with common fields.
|
|
6
|
+
* Caller can extend with operation-specific fields.
|
|
7
|
+
*
|
|
8
|
+
* @param taskId - The ID of the task
|
|
9
|
+
* @param aiConfig - AI configuration used for the operation
|
|
10
|
+
* @param promptOverride - Optional custom prompt override
|
|
11
|
+
* @param defaultPrompt - Default prompt if no override provided
|
|
12
|
+
* @param confidence - Confidence score (0-1) for the AI operation
|
|
13
|
+
* @returns Base metadata object
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const baseMetadata = createBaseAIMetadata(
|
|
18
|
+
* "task-123",
|
|
19
|
+
* { provider: "anthropic", model: "claude-sonnet-4.5" },
|
|
20
|
+
* undefined,
|
|
21
|
+
* "Split task into subtasks",
|
|
22
|
+
* 0.9
|
|
23
|
+
* );
|
|
24
|
+
*
|
|
25
|
+
* // Extend with operation-specific fields
|
|
26
|
+
* const subtaskMetadata = {
|
|
27
|
+
* ...baseMetadata,
|
|
28
|
+
* parentTaskId: "parent-123",
|
|
29
|
+
* subtaskIndex: 1
|
|
30
|
+
* };
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
function createBaseAIMetadata(taskId, aiConfig, promptOverride, defaultPrompt = "AI-generated task", confidence = 0.9) {
|
|
34
|
+
return {
|
|
35
|
+
taskId,
|
|
36
|
+
aiGenerated: true,
|
|
37
|
+
aiPrompt: promptOverride || defaultPrompt,
|
|
38
|
+
confidence,
|
|
39
|
+
aiProvider: aiConfig.provider,
|
|
40
|
+
aiModel: aiConfig.model,
|
|
41
|
+
generatedAt: Date.now(),
|
|
42
|
+
};
|
|
43
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "task-o-matic",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "AI-powered task management CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"task-management",
|
|
@@ -34,6 +34,11 @@
|
|
|
34
34
|
"types": "./dist/types/index.d.ts",
|
|
35
35
|
"require": "./dist/types/index.js",
|
|
36
36
|
"default": "./dist/types/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./cli": {
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"require": "./dist/index.js",
|
|
41
|
+
"default": "./dist/index.js"
|
|
37
42
|
}
|
|
38
43
|
},
|
|
39
44
|
"files": [
|