task-o-matic 0.0.14 ā 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/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 +19 -4
- 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 +2 -1
- package/dist/commands/tasks/document/get.d.ts.map +1 -1
- package/dist/commands/tasks/document/get.js +2 -1
- 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 +2 -1
- package/dist/commands/tasks/update.d.ts.map +1 -1
- package/dist/commands/tasks/update.js +7 -1
- 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/model-provider.d.ts.map +1 -1
- package/dist/lib/ai-service/model-provider.js +37 -6
- 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 +1 -0
- package/dist/lib/ai-service/task-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/task-operations.js +158 -171
- package/dist/lib/benchmark/registry.d.ts.map +1 -1
- package/dist/lib/benchmark/registry.js +6 -10
- 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.map +1 -1
- package/dist/lib/config.js +30 -7
- 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/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 +69 -84
- package/dist/services/tasks.d.ts +315 -1
- package/dist/services/tasks.d.ts.map +1 -1
- package/dist/services/tasks.js +486 -121
- package/dist/services/workflow-ai-assistant.d.ts.map +1 -1
- package/dist/services/workflow-ai-assistant.js +19 -6
- package/dist/services/workflow.d.ts.map +1 -1
- package/dist/services/workflow.js +7 -1
- 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 +459 -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/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 +279 -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 +3 -3
- package/dist/utils/error-utils.d.ts.map +1 -1
- package/dist/utils/error-utils.js +5 -4
- package/dist/utils/file-utils.d.ts +27 -4
- package/dist/utils/file-utils.d.ts.map +1 -1
- package/dist/utils/file-utils.js +46 -6
- package/dist/utils/id-generator.d.ts +1 -1
- package/dist/utils/id-generator.d.ts.map +1 -1
- package/dist/utils/id-generator.js +8 -2
- 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/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/storage-utils.d.ts +3 -3
- package/dist/utils/storage-utils.d.ts.map +1 -1
- package/dist/utils/storage-utils.js +7 -6
- 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/package.json +7 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-ai-assistant.d.ts","sourceRoot":"","sources":["../../src/services/workflow-ai-assistant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEtD,OAAO,EAAiB,SAAS,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow-ai-assistant.d.ts","sourceRoot":"","sources":["../../src/services/workflow-ai-assistant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEtD,OAAO,EAAiB,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAQtE;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B;;OAEG;IACG,gBAAgB,CAAC,KAAK,EAAE;QAC5B,eAAe,EAAE,MAAM,CAAC;QACxB,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;KACrC,GAAG,OAAO,CAAC;QACV,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IAgEF;;OAEG;IACG,iBAAiB,CAAC,KAAK,EAA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istant = void 0;
|
|
|
4
4
|
const ai_service_factory_1 = require("../utils/ai-service-factory");
|
|
5
5
|
const ai_config_builder_1 = require("../utils/ai-config-builder");
|
|
6
6
|
const prompt_builder_1 = require("../lib/prompt-builder");
|
|
7
|
+
const task_o_matic_error_1 = require("../utils/task-o-matic-error");
|
|
7
8
|
/**
|
|
8
9
|
* WorkflowAIAssistant - AI-powered decision making for workflow steps
|
|
9
10
|
* Helps users make configuration choices using natural language
|
|
@@ -22,7 +23,7 @@ class WorkflowAIAssistant {
|
|
|
22
23
|
},
|
|
23
24
|
});
|
|
24
25
|
if (!promptResult.success) {
|
|
25
|
-
throw
|
|
26
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.CONFIGURATION_ERROR, `Failed to build project init prompt: ${promptResult.error}`);
|
|
26
27
|
}
|
|
27
28
|
const systemPromptResult = prompt_builder_1.PromptBuilder.buildPrompt({
|
|
28
29
|
name: "project-init-suggestion",
|
|
@@ -34,7 +35,13 @@ class WorkflowAIAssistant {
|
|
|
34
35
|
try {
|
|
35
36
|
const jsonMatch = result.match(/\{[\s\S]*\}/);
|
|
36
37
|
if (!jsonMatch) {
|
|
37
|
-
throw
|
|
38
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.AI_OPERATION_FAILED, "No JSON found in AI response for init config", {
|
|
39
|
+
context: "The AI did not return a valid JSON object.",
|
|
40
|
+
suggestions: [
|
|
41
|
+
"Try a different model or provider.",
|
|
42
|
+
"Check the prompt for clarity.",
|
|
43
|
+
],
|
|
44
|
+
});
|
|
38
45
|
}
|
|
39
46
|
return JSON.parse(jsonMatch[0]);
|
|
40
47
|
}
|
|
@@ -73,7 +80,7 @@ class WorkflowAIAssistant {
|
|
|
73
80
|
},
|
|
74
81
|
});
|
|
75
82
|
if (!promptResult.success) {
|
|
76
|
-
throw
|
|
83
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.CONFIGURATION_ERROR, `Failed to build PRD improvement prompt: ${promptResult.error}`);
|
|
77
84
|
}
|
|
78
85
|
const systemPromptResult = prompt_builder_1.PromptBuilder.buildPrompt({
|
|
79
86
|
name: "prd-improvement",
|
|
@@ -100,7 +107,7 @@ class WorkflowAIAssistant {
|
|
|
100
107
|
},
|
|
101
108
|
});
|
|
102
109
|
if (!promptResult.success) {
|
|
103
|
-
throw
|
|
110
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.CONFIGURATION_ERROR, `Failed to build task prioritization prompt: ${promptResult.error}`);
|
|
104
111
|
}
|
|
105
112
|
const systemPromptResult = prompt_builder_1.PromptBuilder.buildPrompt({
|
|
106
113
|
name: "task-prioritization",
|
|
@@ -112,7 +119,13 @@ class WorkflowAIAssistant {
|
|
|
112
119
|
try {
|
|
113
120
|
const jsonMatch = result.match(/\{[\s\S]*\}/);
|
|
114
121
|
if (!jsonMatch) {
|
|
115
|
-
throw
|
|
122
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.AI_OPERATION_FAILED, "No JSON found in AI response for task prioritization", {
|
|
123
|
+
context: "The AI did not return a valid JSON object.",
|
|
124
|
+
suggestions: [
|
|
125
|
+
"Try a different model or provider.",
|
|
126
|
+
"Check the prompt for clarity.",
|
|
127
|
+
],
|
|
128
|
+
});
|
|
116
129
|
}
|
|
117
130
|
return JSON.parse(jsonMatch[0]);
|
|
118
131
|
}
|
|
@@ -146,7 +159,7 @@ class WorkflowAIAssistant {
|
|
|
146
159
|
},
|
|
147
160
|
});
|
|
148
161
|
if (!promptResult.success) {
|
|
149
|
-
throw
|
|
162
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.CONFIGURATION_ERROR, `Failed to build task splitting prompt: ${promptResult.error}`);
|
|
150
163
|
}
|
|
151
164
|
const systemPromptResult = prompt_builder_1.PromptBuilder.buildPrompt({
|
|
152
165
|
name: "task-splitting-assistance",
|
|
@@ -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;AAMnC;;;GAGG;AACH,qBAAa,eAAe;IAC1B;;;OAGG;IACG,iBAAiB,CAAC,KAAK,EAAE;QAC7B,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,IAAI,CAAC;QACvC,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,WAAW,CAAC,EAAE;YACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,IAAI,CAAC,EAAE,OAAO,CAAC;SAChB,CAAC;QACF,SAAS,CAAC,EAAE,OAA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aAAa,CAAC,KAAK,EAAE;QACzB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;QAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;QACpC,SAAS,CAAC,EAAE,gBAAgB,CAAC;KAC9B,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAkEhC;;;OAGG;IACG,UAAU,CAAC,KAAK,EAAE;QACtB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,WAAW,EAAE,aAAa,GAAG,UAAU,GAAG,QAAQ,CAAC;QACnD,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;QACpC,SAAS,CAAC,EAAE,gBAAgB,CAAC;KAC9B,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAkD9B;AAGD,eAAO,MAAM,eAAe,iBAAwB,CAAC"}
|
|
@@ -8,6 +8,7 @@ const better_t_stack_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";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-operations.test.d.ts","sourceRoot":"","sources":["../../../../src/test/lib/ai-service/task-operations.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const assert = __importStar(require("assert"));
|
|
37
|
+
const task_operations_1 = require("../../../lib/ai-service/task-operations");
|
|
38
|
+
const task_o_matic_error_1 = require("../../../utils/task-o-matic-error");
|
|
39
|
+
/**
|
|
40
|
+
* ā ļø CRITICAL: These integration tests use 100% MOCKS - ZERO real AI calls
|
|
41
|
+
* No API calls are made, no costs incurred, tests run fast
|
|
42
|
+
*
|
|
43
|
+
* These tests verify that TaskOperations properly integrates with AIOperationUtility
|
|
44
|
+
* and that errors propagate correctly through the stack.
|
|
45
|
+
*/
|
|
46
|
+
describe("TaskOperations Integration Tests", () => {
|
|
47
|
+
let taskOps;
|
|
48
|
+
let mockAIOperationUtility;
|
|
49
|
+
beforeEach(() => {
|
|
50
|
+
taskOps = new task_operations_1.TaskOperations();
|
|
51
|
+
// Create mock AIOperationUtility - NO REAL AI CALLS
|
|
52
|
+
mockAIOperationUtility = {
|
|
53
|
+
executeAIOperation: async (operationName, operation, options) => {
|
|
54
|
+
// Execute the operation and return mock metrics
|
|
55
|
+
const result = await operation();
|
|
56
|
+
return {
|
|
57
|
+
result,
|
|
58
|
+
metrics: {
|
|
59
|
+
duration: 100,
|
|
60
|
+
tokenUsage: {
|
|
61
|
+
prompt: 50,
|
|
62
|
+
completion: 25,
|
|
63
|
+
total: 75,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
streamTextWithTools: async (systemPrompt, userMessage, config, streamingOptions, tools) => {
|
|
69
|
+
// Return mock JSON response
|
|
70
|
+
return JSON.stringify({
|
|
71
|
+
subtasks: [
|
|
72
|
+
{
|
|
73
|
+
title: "Mock subtask 1",
|
|
74
|
+
description: "Mock description 1",
|
|
75
|
+
effort: "small",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
title: "Mock subtask 2",
|
|
79
|
+
description: "Mock description 2",
|
|
80
|
+
effort: "medium",
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
streamText: async (_prompt, _config, _systemPrompt, _userMessage, _streamingOptions) => {
|
|
86
|
+
return "Mock enhanced content";
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
// Inject mock into TaskOperations
|
|
90
|
+
taskOps.aiOperationUtility = mockAIOperationUtility;
|
|
91
|
+
});
|
|
92
|
+
describe("breakdownTask Integration", () => {
|
|
93
|
+
it("should successfully break down a task using AIOperationUtility", async () => {
|
|
94
|
+
const mockTask = {
|
|
95
|
+
id: "test-task-1",
|
|
96
|
+
title: "Test Task",
|
|
97
|
+
description: "A task to break down",
|
|
98
|
+
status: "todo",
|
|
99
|
+
createdAt: Date.now(),
|
|
100
|
+
updatedAt: Date.now(),
|
|
101
|
+
};
|
|
102
|
+
const result = await taskOps.breakdownTask(mockTask);
|
|
103
|
+
// Verify result structure
|
|
104
|
+
assert.ok(Array.isArray(result));
|
|
105
|
+
assert.strictEqual(result.length, 2);
|
|
106
|
+
assert.strictEqual(result[0].title, "Mock subtask 1");
|
|
107
|
+
assert.strictEqual(result[0].content, "Mock description 1");
|
|
108
|
+
assert.strictEqual(result[0].estimatedEffort, "small");
|
|
109
|
+
});
|
|
110
|
+
it("should handle filesystem tools when enabled", async () => {
|
|
111
|
+
let toolsPassed = false;
|
|
112
|
+
// Override streamTextWithTools to capture tools parameter
|
|
113
|
+
mockAIOperationUtility.streamTextWithTools = async (_systemPrompt, _userMessage, _config, _streamingOptions, tools) => {
|
|
114
|
+
if (tools && Object.keys(tools).length > 0) {
|
|
115
|
+
toolsPassed = true;
|
|
116
|
+
}
|
|
117
|
+
return JSON.stringify({
|
|
118
|
+
subtasks: [
|
|
119
|
+
{
|
|
120
|
+
title: "Subtask with tools",
|
|
121
|
+
description: "Used filesystem tools",
|
|
122
|
+
effort: "small",
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
const mockTask = {
|
|
128
|
+
id: "test-task-2",
|
|
129
|
+
title: "Task with tools",
|
|
130
|
+
status: "todo",
|
|
131
|
+
createdAt: Date.now(),
|
|
132
|
+
updatedAt: Date.now(),
|
|
133
|
+
};
|
|
134
|
+
const result = await taskOps.breakdownTask(mockTask, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true // enableFilesystemTools
|
|
135
|
+
);
|
|
136
|
+
assert.ok(toolsPassed, "Filesystem tools should be passed when enabled");
|
|
137
|
+
assert.strictEqual(result.length, 1);
|
|
138
|
+
});
|
|
139
|
+
it("should propagate TaskOMaticError from AIOperationUtility", async () => {
|
|
140
|
+
// Mock AIOperationUtility to throw error
|
|
141
|
+
taskOps.aiOperationUtility.executeAIOperation = async () => {
|
|
142
|
+
throw new task_o_matic_error_1.TaskOMaticError("AI operation failed: Task breakdown", {
|
|
143
|
+
code: "AI_OPERATION_FAILED",
|
|
144
|
+
context: "Mock error context",
|
|
145
|
+
suggestions: ["Check AI configuration"],
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
const mockTask = {
|
|
149
|
+
id: "test-task-error",
|
|
150
|
+
title: "Task that will fail",
|
|
151
|
+
status: "todo",
|
|
152
|
+
createdAt: Date.now(),
|
|
153
|
+
updatedAt: Date.now(),
|
|
154
|
+
};
|
|
155
|
+
try {
|
|
156
|
+
await taskOps.breakdownTask(mockTask);
|
|
157
|
+
assert.fail("Should have thrown TaskOMaticError");
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
assert.ok(error instanceof task_o_matic_error_1.TaskOMaticError);
|
|
161
|
+
assert.strictEqual(error.code, "AI_OPERATION_FAILED");
|
|
162
|
+
assert.ok(error.message.includes("Task breakdown"));
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
describe("enhanceTask Integration", () => {
|
|
167
|
+
it("should successfully enhance a task using AIOperationUtility", async () => {
|
|
168
|
+
const result = await taskOps.enhanceTask("Test Task", "Basic description");
|
|
169
|
+
// Verify result
|
|
170
|
+
assert.strictEqual(typeof result, "string");
|
|
171
|
+
assert.strictEqual(result, "Mock enhanced content");
|
|
172
|
+
});
|
|
173
|
+
it("should propagate errors from AIOperationUtility", async () => {
|
|
174
|
+
// Mock AIOperationUtility to throw error
|
|
175
|
+
taskOps.aiOperationUtility.executeAIOperation = async () => {
|
|
176
|
+
throw new task_o_matic_error_1.TaskOMaticError("AI operation failed: Task enhancement", {
|
|
177
|
+
code: "AI_OPERATION_FAILED",
|
|
178
|
+
context: "Enhancement failed",
|
|
179
|
+
suggestions: ["Retry with different parameters"],
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
try {
|
|
183
|
+
await taskOps.enhanceTask("Test", "Description");
|
|
184
|
+
assert.fail("Should have thrown TaskOMaticError");
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
assert.ok(error instanceof task_o_matic_error_1.TaskOMaticError);
|
|
188
|
+
assert.ok(error.message.includes("Task enhancement"));
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
describe("planTask Integration", () => {
|
|
193
|
+
it("should successfully plan a task using AIOperationUtility", async () => {
|
|
194
|
+
// Mock streamTextWithTools to return plan
|
|
195
|
+
mockAIOperationUtility.streamTextWithTools = async () => {
|
|
196
|
+
return "Mock implementation plan:\n1. Step 1\n2. Step 2\n3. Step 3";
|
|
197
|
+
};
|
|
198
|
+
const result = await taskOps.planTask("Project context", "Task details");
|
|
199
|
+
// Verify result
|
|
200
|
+
assert.strictEqual(typeof result, "string");
|
|
201
|
+
assert.ok(result.includes("Mock implementation plan"));
|
|
202
|
+
assert.ok(result.includes("Step 1"));
|
|
203
|
+
});
|
|
204
|
+
it("should handle MCP tools and filesystem tools", async () => {
|
|
205
|
+
let toolsReceived = false;
|
|
206
|
+
mockAIOperationUtility.streamTextWithTools = async (_systemPrompt, _userMessage, _config, _streamingOptions, tools) => {
|
|
207
|
+
if (tools && Object.keys(tools).length > 0) {
|
|
208
|
+
toolsReceived = true;
|
|
209
|
+
}
|
|
210
|
+
return "Plan with tools";
|
|
211
|
+
};
|
|
212
|
+
// Mock Context7Client to return MCP tools
|
|
213
|
+
const mockContext7Client = {
|
|
214
|
+
getMCPTools: async () => ({
|
|
215
|
+
mockTool: {
|
|
216
|
+
description: "Mock MCP tool",
|
|
217
|
+
parameters: {},
|
|
218
|
+
execute: async () => ({}),
|
|
219
|
+
},
|
|
220
|
+
}),
|
|
221
|
+
saveContext7Documentation: () => { },
|
|
222
|
+
};
|
|
223
|
+
taskOps.context7Client = mockContext7Client;
|
|
224
|
+
const result = await taskOps.planTask("Context", "Details");
|
|
225
|
+
assert.ok(toolsReceived, "Tools should be passed to streamTextWithTools");
|
|
226
|
+
assert.strictEqual(result, "Plan with tools");
|
|
227
|
+
});
|
|
228
|
+
it("should propagate errors from AIOperationUtility", async () => {
|
|
229
|
+
// Mock AIOperationUtility to throw error
|
|
230
|
+
taskOps.aiOperationUtility.executeAIOperation = async () => {
|
|
231
|
+
throw new task_o_matic_error_1.TaskOMaticError("AI operation failed: Task planning", {
|
|
232
|
+
code: "AI_OPERATION_FAILED",
|
|
233
|
+
context: "Planning failed",
|
|
234
|
+
suggestions: ["Check task context"],
|
|
235
|
+
});
|
|
236
|
+
};
|
|
237
|
+
try {
|
|
238
|
+
await taskOps.planTask("Context", "Details");
|
|
239
|
+
assert.fail("Should have thrown TaskOMaticError");
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
assert.ok(error instanceof task_o_matic_error_1.TaskOMaticError);
|
|
243
|
+
assert.ok(error.message.includes("Task planning"));
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
describe("Metrics Flow", () => {
|
|
248
|
+
it("should return results from AIOperationUtility without exposing metrics", async () => {
|
|
249
|
+
// breakdownTask returns result.result directly, not the full AIOperationResult
|
|
250
|
+
const mockTask = {
|
|
251
|
+
id: "metrics-test",
|
|
252
|
+
title: "Metrics test task",
|
|
253
|
+
status: "todo",
|
|
254
|
+
createdAt: Date.now(),
|
|
255
|
+
updatedAt: Date.now(),
|
|
256
|
+
};
|
|
257
|
+
const result = await taskOps.breakdownTask(mockTask);
|
|
258
|
+
// Verify we got the result, not the AIOperationResult wrapper
|
|
259
|
+
assert.ok(Array.isArray(result));
|
|
260
|
+
assert.ok(!("metrics" in result), "Should not expose metrics in result");
|
|
261
|
+
assert.ok(!("result" in result), "Should not expose AIOperationResult structure");
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
describe("Error Handling Integration", () => {
|
|
265
|
+
it("should wrap string errors in TaskOMaticError", async () => {
|
|
266
|
+
// Mock operation that throws string error
|
|
267
|
+
taskOps.aiOperationUtility.executeAIOperation = async () => {
|
|
268
|
+
const error = new Error("String error was converted");
|
|
269
|
+
throw new task_o_matic_error_1.TaskOMaticError("AI operation failed: Task breakdown", {
|
|
270
|
+
code: "AI_OPERATION_FAILED",
|
|
271
|
+
cause: error,
|
|
272
|
+
context: JSON.stringify({
|
|
273
|
+
operation: "Task breakdown",
|
|
274
|
+
error: "String error was converted",
|
|
275
|
+
}),
|
|
276
|
+
suggestions: ["Check AI configuration"],
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
const mockTask = {
|
|
280
|
+
id: "string-error-test",
|
|
281
|
+
title: "Test",
|
|
282
|
+
status: "todo",
|
|
283
|
+
createdAt: Date.now(),
|
|
284
|
+
updatedAt: Date.now(),
|
|
285
|
+
};
|
|
286
|
+
try {
|
|
287
|
+
await taskOps.breakdownTask(mockTask);
|
|
288
|
+
assert.fail("Should have thrown");
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
assert.ok(error instanceof task_o_matic_error_1.TaskOMaticError);
|
|
292
|
+
const taskError = error;
|
|
293
|
+
assert.ok(taskError.cause instanceof Error);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
it("should preserve error context and suggestions", async () => {
|
|
297
|
+
const mockError = new task_o_matic_error_1.TaskOMaticError("Original error", {
|
|
298
|
+
code: "TEST_ERROR",
|
|
299
|
+
context: "Original context",
|
|
300
|
+
suggestions: ["Original suggestion 1", "Original suggestion 2"],
|
|
301
|
+
metadata: { testData: "test value" },
|
|
302
|
+
});
|
|
303
|
+
taskOps.aiOperationUtility.executeAIOperation = async () => {
|
|
304
|
+
throw mockError;
|
|
305
|
+
};
|
|
306
|
+
const mockTask = {
|
|
307
|
+
id: "context-test",
|
|
308
|
+
title: "Test",
|
|
309
|
+
status: "todo",
|
|
310
|
+
createdAt: Date.now(),
|
|
311
|
+
updatedAt: Date.now(),
|
|
312
|
+
};
|
|
313
|
+
try {
|
|
314
|
+
await taskOps.breakdownTask(mockTask);
|
|
315
|
+
assert.fail("Should have thrown");
|
|
316
|
+
}
|
|
317
|
+
catch (error) {
|
|
318
|
+
assert.ok(error instanceof task_o_matic_error_1.TaskOMaticError);
|
|
319
|
+
const taskError = error;
|
|
320
|
+
assert.strictEqual(taskError.code, "TEST_ERROR");
|
|
321
|
+
assert.ok(taskError.context?.includes("Original context"));
|
|
322
|
+
assert.ok(Array.isArray(taskError.suggestions));
|
|
323
|
+
assert.ok(taskError.metadata?.testData === "test value");
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
describe("Streaming Options Integration", () => {
|
|
328
|
+
it("should pass streaming options through to AIOperationUtility", async () => {
|
|
329
|
+
let onChunkCalled = false;
|
|
330
|
+
let onFinishCalled = false;
|
|
331
|
+
const streamingOptions = {
|
|
332
|
+
onChunk: (chunk) => {
|
|
333
|
+
onChunkCalled = true;
|
|
334
|
+
},
|
|
335
|
+
onFinish: (result) => {
|
|
336
|
+
onFinishCalled = true;
|
|
337
|
+
},
|
|
338
|
+
};
|
|
339
|
+
// Mock to verify streaming options are passed
|
|
340
|
+
let receivedOptions;
|
|
341
|
+
taskOps.aiOperationUtility.executeAIOperation = async (_operationName, operation, options) => {
|
|
342
|
+
receivedOptions = options;
|
|
343
|
+
const result = await operation();
|
|
344
|
+
return {
|
|
345
|
+
result,
|
|
346
|
+
metrics: { duration: 100 },
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
const mockTask = {
|
|
350
|
+
id: "streaming-test",
|
|
351
|
+
title: "Test",
|
|
352
|
+
status: "todo",
|
|
353
|
+
createdAt: Date.now(),
|
|
354
|
+
updatedAt: Date.now(),
|
|
355
|
+
};
|
|
356
|
+
await taskOps.breakdownTask(mockTask, undefined, undefined, undefined, streamingOptions);
|
|
357
|
+
// Verify streaming options were passed
|
|
358
|
+
assert.ok(receivedOptions);
|
|
359
|
+
assert.ok(receivedOptions.streamingOptions);
|
|
360
|
+
});
|
|
361
|
+
});
|
|
362
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Task, StreamingOptions, AIConfig } from "../../types";
|
|
2
|
+
export declare class MockAIOperations {
|
|
3
|
+
enhanceTaskWithDocumentation(taskId: string, title: string, description: string, stackInfo: string, streamingOptions?: StreamingOptions, retryConfig?: any, aiConfig?: AIConfig, existingResearch?: any): Promise<string>;
|
|
4
|
+
breakdownTask(task: Task, aiConfig: AIConfig, promptOverride?: string, messageOverride?: string, streamingOptions?: StreamingOptions, retryConfig?: any, fullContent?: string, stackInfo?: string, existingSubtasks?: Task[], enableFilesystemTools?: boolean): Promise<Task[]>;
|
|
5
|
+
planTask(taskContext: string, taskDetails: string, aiConfig: AIConfig, promptOverride?: string, messageOverride?: string, streamingOptions?: StreamingOptions): Promise<string>;
|
|
6
|
+
analyzeDocumentationNeeds(taskId: string, title: string, content: string, stackInfo: string, streamingOptions?: StreamingOptions, retryConfig?: any, aiConfig?: AIConfig, existingDocumentations?: string[]): Promise<any>;
|
|
7
|
+
generateDocumentationRecap(libraries: any[], toolResults: any[], streamingOptions?: StreamingOptions): Promise<string>;
|
|
8
|
+
parsePRD(prdContent: string, aiConfig: AIConfig, promptOverride?: string, messageOverride?: string, streamingOptions?: StreamingOptions, retryConfig?: any, workingDirectory?: string, enableFilesystemTools?: boolean): Promise<any>;
|
|
9
|
+
generatePRDQuestions(prdContent: string, aiConfig: AIConfig, promptOverride?: string, messageOverride?: string, streamingOptions?: StreamingOptions, retryConfig?: any, workingDirectory?: string, enableFilesystemTools?: boolean): Promise<string[]>;
|
|
10
|
+
reworkPRD(prdContent: string, feedback: string, aiConfig: AIConfig, promptOverride?: string, messageOverride?: string, streamingOptions?: StreamingOptions, retryConfig?: any, workingDirectory?: string, enableFilesystemTools?: boolean): Promise<string>;
|
|
11
|
+
answerPRDQuestions(prdContent: string, questions: string[], aiConfig: AIConfig, context: any, streamingOptions?: StreamingOptions): Promise<Record<string, string>>;
|
|
12
|
+
generatePRD(description: string, aiConfig: AIConfig, promptOverride?: string, messageOverride?: string, streamingOptions?: StreamingOptions): Promise<string>;
|
|
13
|
+
combinePRDs(prds: string[], originalDescription: string, aiConfig: AIConfig, promptOverride?: string, messageOverride?: string, streamingOptions?: StreamingOptions): Promise<string>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=mock-ai-operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-ai-operations.d.ts","sourceRoot":"","sources":["../../../src/test/mocks/mock-ai-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAkB,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG/E,qBAAa,gBAAgB;IACrB,4BAA4B,CAChC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,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,WAAW,CACf,IAAI,EAAE,MAAM,EAAE,EACd,mBAAmB,EAAE,MAAM,EAC3B,QAAQ,EAAE,QAAQ,EAClB,cAAc,CAAC,EAAE,MAAM,EACvB,eAAe,CAAC,EAAE,MAAM,EACxB,gBAAgB,CAAC,EAAE,gBAAgB,GAClC,OAAO,CAAC,MAAM,CAAC;CAKnB"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MockAIOperations = void 0;
|
|
4
|
+
class MockAIOperations {
|
|
5
|
+
async enhanceTaskWithDocumentation(taskId, title, description, stackInfo, streamingOptions, retryConfig, aiConfig, existingResearch) {
|
|
6
|
+
return `${description}\n\nš¤ Enhanced with AI documentation for ${title}`;
|
|
7
|
+
}
|
|
8
|
+
async breakdownTask(task, aiConfig, promptOverride, messageOverride, streamingOptions, retryConfig, fullContent, stackInfo, existingSubtasks, enableFilesystemTools) {
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
id: `${task.id}.1`,
|
|
12
|
+
title: `Subtask 1: ${task.title}`,
|
|
13
|
+
description: `First subtask for ${task.title}`,
|
|
14
|
+
content: `Content for subtask 1`,
|
|
15
|
+
status: "todo",
|
|
16
|
+
estimatedEffort: "small",
|
|
17
|
+
createdAt: Date.now(),
|
|
18
|
+
updatedAt: Date.now(),
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: `${task.id}.2`,
|
|
22
|
+
title: `Subtask 2: ${task.title}`,
|
|
23
|
+
description: `Second subtask for ${task.title}`,
|
|
24
|
+
content: `Content for subtask 2`,
|
|
25
|
+
status: "todo",
|
|
26
|
+
estimatedEffort: "medium",
|
|
27
|
+
createdAt: Date.now(),
|
|
28
|
+
updatedAt: Date.now(),
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
async planTask(taskContext, taskDetails, aiConfig, promptOverride, messageOverride, streamingOptions) {
|
|
33
|
+
return `# Implementation Plan for ${taskContext.split("\n")[0]}\n\n1. Analyze requirements\n2. Implement core functionality\n3. Write tests\n4. Review and refactor`;
|
|
34
|
+
}
|
|
35
|
+
async analyzeDocumentationNeeds(taskId, title, content, stackInfo, streamingOptions, retryConfig, aiConfig, existingDocumentations) {
|
|
36
|
+
return {
|
|
37
|
+
libraries: [
|
|
38
|
+
{
|
|
39
|
+
name: "react",
|
|
40
|
+
context7Id: "/facebook/react",
|
|
41
|
+
reason: "Task involves React development",
|
|
42
|
+
searchQuery: "React hooks best practices",
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
confidence: 0.9,
|
|
46
|
+
files: ["src/components/TaskComponent.tsx"],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
async generateDocumentationRecap(libraries, toolResults, streamingOptions) {
|
|
50
|
+
return `## Documentation Recap\n\n${libraries
|
|
51
|
+
.map((lib) => `- ${lib.name}: ${lib.reason}`)
|
|
52
|
+
.join("\n")}`;
|
|
53
|
+
}
|
|
54
|
+
async parsePRD(prdContent, aiConfig, promptOverride, messageOverride, streamingOptions, retryConfig, workingDirectory, enableFilesystemTools) {
|
|
55
|
+
return {
|
|
56
|
+
tasks: [
|
|
57
|
+
{
|
|
58
|
+
id: "1",
|
|
59
|
+
title: "Implement user authentication",
|
|
60
|
+
description: "Add login/logout functionality",
|
|
61
|
+
content: "Full authentication implementation",
|
|
62
|
+
estimatedEffort: "medium",
|
|
63
|
+
dependencies: [],
|
|
64
|
+
tags: ["auth", "backend"],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: "2",
|
|
68
|
+
title: "Create task management UI",
|
|
69
|
+
description: "Build React components for task management",
|
|
70
|
+
content: "Task list, create, edit, delete components",
|
|
71
|
+
estimatedEffort: "large",
|
|
72
|
+
dependencies: ["1"],
|
|
73
|
+
tags: ["ui", "frontend"],
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
summary: "PRD for task management application",
|
|
77
|
+
estimatedDuration: "2 weeks",
|
|
78
|
+
confidence: 0.95,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
async generatePRDQuestions(prdContent, aiConfig, promptOverride, messageOverride, streamingOptions, retryConfig, workingDirectory, enableFilesystemTools) {
|
|
82
|
+
return [
|
|
83
|
+
"What authentication providers should be supported?",
|
|
84
|
+
"Should the task management support real-time collaboration?",
|
|
85
|
+
"What are the expected performance requirements?",
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
async reworkPRD(prdContent, feedback, aiConfig, promptOverride, messageOverride, streamingOptions, retryConfig, workingDirectory, enableFilesystemTools) {
|
|
89
|
+
return `${prdContent}\n\n## Improvements Based on Feedback\n\n${feedback}`;
|
|
90
|
+
}
|
|
91
|
+
async answerPRDQuestions(prdContent, questions, aiConfig, context, streamingOptions) {
|
|
92
|
+
const answers = {};
|
|
93
|
+
questions.forEach((question) => {
|
|
94
|
+
answers[question] = `AI-generated answer for: ${question}`;
|
|
95
|
+
});
|
|
96
|
+
return answers;
|
|
97
|
+
}
|
|
98
|
+
async generatePRD(description, aiConfig, promptOverride, messageOverride, streamingOptions) {
|
|
99
|
+
return `# Product Requirements Document\n\n## Overview\n${description}\n\n## Features\n- User authentication\n- Task management\n- Real-time collaboration\n\n## Technical Requirements\n- React frontend\n- Node.js backend\n- PostgreSQL database`;
|
|
100
|
+
}
|
|
101
|
+
async combinePRDs(prds, originalDescription, aiConfig, promptOverride, messageOverride, streamingOptions) {
|
|
102
|
+
return `# Master PRD\n\n${prds
|
|
103
|
+
.map((prd, index) => `## PRD ${index + 1}\n\n${prd}`)
|
|
104
|
+
.join("\n\n")}`;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.MockAIOperations = MockAIOperations;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TaskRepository } from "../../lib/storage/types";
|
|
2
|
+
import { TaskContext } from "../../types";
|
|
3
|
+
export declare class MockContextBuilder {
|
|
4
|
+
private storage;
|
|
5
|
+
constructor(storage: TaskRepository);
|
|
6
|
+
buildContextForNewTask(title: string, content?: string): Promise<TaskContext>;
|
|
7
|
+
buildContext(taskId: string): Promise<TaskContext>;
|
|
8
|
+
isDocumentationFresh(documentation: any): boolean;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=mock-context-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-context-builder.d.ts","sourceRoot":"","sources":["../../../src/test/mocks/mock-context-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,qBAAa,kBAAkB;IACjB,OAAO,CAAC,OAAO;gBAAP,OAAO,EAAE,cAAc;IAErC,sBAAsB,CAC1B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,WAAW,CAAC;IAiCjB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAsCxD,oBAAoB,CAAC,aAAa,EAAE,GAAG,GAAG,OAAO;CAGlD"}
|