task-o-matic 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/display/progress.d.ts +15 -2
- package/dist/cli/display/progress.d.ts.map +1 -1
- package/dist/cli/display/progress.js +72 -4
- package/dist/commands/benchmark.d.ts.map +1 -1
- package/dist/commands/benchmark.js +11 -3
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +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/lib/ai-service/model-provider.d.ts.map +1 -1
- package/dist/lib/ai-service/model-provider.js +37 -6
- package/dist/lib/ai-service/task-operations.d.ts +1 -0
- package/dist/lib/ai-service/task-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/task-operations.js +135 -173
- package/dist/lib/benchmark/registry.d.ts.map +1 -1
- package/dist/lib/benchmark/registry.js +6 -10
- package/dist/lib/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 +19 -5
- package/dist/lib/storage/file-system.d.ts.map +1 -1
- package/dist/lib/storage/file-system.js +81 -21
- package/dist/lib/task-execution-core.d.ts.map +1 -1
- package/dist/lib/task-execution-core.js +3 -2
- package/dist/services/prd.d.ts +17 -0
- package/dist/services/prd.d.ts.map +1 -1
- package/dist/services/prd.js +49 -15
- package/dist/services/tasks.d.ts +315 -1
- package/dist/services/tasks.d.ts.map +1 -1
- package/dist/services/tasks.js +483 -107
- package/dist/services/workflow-ai-assistant.d.ts.map +1 -1
- package/dist/services/workflow-ai-assistant.js +19 -6
- package/dist/test/lib/ai-service/task-operations.test.d.ts +2 -0
- package/dist/test/lib/ai-service/task-operations.test.d.ts.map +1 -0
- package/dist/test/lib/ai-service/task-operations.test.js +362 -0
- package/dist/test/mocks/mock-ai-operations.d.ts +15 -0
- package/dist/test/mocks/mock-ai-operations.d.ts.map +1 -0
- package/dist/test/mocks/mock-ai-operations.js +107 -0
- package/dist/test/mocks/mock-context-builder.d.ts +10 -0
- package/dist/test/mocks/mock-context-builder.d.ts.map +1 -0
- package/dist/test/mocks/mock-context-builder.js +81 -0
- package/dist/test/mocks/mock-model-provider.d.ts +7 -0
- package/dist/test/mocks/mock-model-provider.d.ts.map +1 -0
- package/dist/test/mocks/mock-model-provider.js +21 -0
- package/dist/test/mocks/mock-service-factory.d.ts +11 -0
- package/dist/test/mocks/mock-service-factory.d.ts.map +1 -0
- package/dist/test/mocks/mock-service-factory.js +61 -0
- package/dist/test/mocks/mock-storage.d.ts +50 -0
- package/dist/test/mocks/mock-storage.d.ts.map +1 -0
- package/dist/test/mocks/mock-storage.js +145 -0
- package/dist/test/services/task-service.test.d.ts +2 -0
- package/dist/test/services/task-service.test.d.ts.map +1 -0
- package/dist/test/services/task-service.test.js +352 -0
- package/dist/test/test-mock-setup.d.ts +26 -0
- package/dist/test/test-mock-setup.d.ts.map +1 -0
- package/dist/test/test-mock-setup.js +41 -0
- package/dist/test/test-setup.d.ts +9 -0
- package/dist/test/test-setup.d.ts.map +1 -0
- package/dist/test/test-setup.js +44 -0
- package/dist/test/test-utils.d.ts +22 -0
- package/dist/test/test-utils.d.ts.map +1 -0
- package/dist/test/test-utils.js +37 -0
- package/dist/test/utils/ai-operation-utility.test.d.ts +2 -0
- package/dist/test/utils/ai-operation-utility.test.d.ts.map +1 -0
- package/dist/test/utils/ai-operation-utility.test.js +290 -0
- package/dist/test/utils/error-handling.test.d.ts +2 -0
- package/dist/test/utils/error-handling.test.d.ts.map +1 -0
- package/dist/test/utils/error-handling.test.js +231 -0
- package/dist/utils/ai-operation-utility.d.ts +142 -0
- package/dist/utils/ai-operation-utility.d.ts.map +1 -0
- package/dist/utils/ai-operation-utility.js +288 -0
- package/dist/utils/ai-service-factory.d.ts +10 -0
- package/dist/utils/ai-service-factory.d.ts.map +1 -1
- package/dist/utils/ai-service-factory.js +19 -1
- package/dist/utils/cli-validators.d.ts +2 -2
- package/dist/utils/cli-validators.d.ts.map +1 -1
- package/dist/utils/cli-validators.js +7 -6
- package/dist/utils/error-utils.d.ts +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 +4 -4
- package/dist/utils/file-utils.d.ts.map +1 -1
- package/dist/utils/file-utils.js +11 -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/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 +2 -2
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigSchema = exports.AIConfigSchema = exports.AIProviderSchema = void 0;
|
|
4
|
+
exports.validateAIConfig = validateAIConfig;
|
|
5
|
+
exports.validateConfig = validateConfig;
|
|
6
|
+
exports.safeValidateConfig = safeValidateConfig;
|
|
7
|
+
exports.safeValidateAIConfig = safeValidateAIConfig;
|
|
8
|
+
exports.validatePartialAIConfig = validatePartialAIConfig;
|
|
9
|
+
const zod_1 = require("zod");
|
|
10
|
+
const task_o_matic_error_1 = require("../utils/task-o-matic-error");
|
|
11
|
+
/**
|
|
12
|
+
* Zod schema for AI Provider
|
|
13
|
+
*/
|
|
14
|
+
exports.AIProviderSchema = zod_1.z.enum(["openai", "anthropic", "openrouter", "custom"], {
|
|
15
|
+
errorMap: () => ({
|
|
16
|
+
message: "Provider must be one of: openai, anthropic, openrouter, custom",
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Zod schema for AI Configuration
|
|
21
|
+
*/
|
|
22
|
+
exports.AIConfigSchema = zod_1.z.object({
|
|
23
|
+
provider: exports.AIProviderSchema,
|
|
24
|
+
model: zod_1.z.string().min(1, "Model name cannot be empty"),
|
|
25
|
+
apiKey: zod_1.z.string().optional(),
|
|
26
|
+
baseURL: zod_1.z.string().url("Base URL must be a valid URL").optional().or(zod_1.z.literal("")),
|
|
27
|
+
maxTokens: zod_1.z
|
|
28
|
+
.number()
|
|
29
|
+
.int("Max tokens must be an integer")
|
|
30
|
+
.positive("Max tokens must be positive")
|
|
31
|
+
.max(1000000, "Max tokens cannot exceed 1,000,000")
|
|
32
|
+
.optional(),
|
|
33
|
+
temperature: zod_1.z
|
|
34
|
+
.number()
|
|
35
|
+
.min(0, "Temperature must be between 0 and 2")
|
|
36
|
+
.max(2, "Temperature must be between 0 and 2")
|
|
37
|
+
.optional(),
|
|
38
|
+
context7Enabled: zod_1.z.boolean().optional(),
|
|
39
|
+
reasoning: zod_1.z
|
|
40
|
+
.object({
|
|
41
|
+
maxTokens: zod_1.z
|
|
42
|
+
.number()
|
|
43
|
+
.int("Reasoning max tokens must be an integer")
|
|
44
|
+
.positive("Reasoning max tokens must be positive")
|
|
45
|
+
.max(100000, "Reasoning max tokens cannot exceed 100,000")
|
|
46
|
+
.optional(),
|
|
47
|
+
})
|
|
48
|
+
.optional(),
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Zod schema for full Config object
|
|
52
|
+
*/
|
|
53
|
+
exports.ConfigSchema = zod_1.z.object({
|
|
54
|
+
ai: exports.AIConfigSchema,
|
|
55
|
+
workingDirectory: zod_1.z.string().optional(),
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Validate AI configuration
|
|
59
|
+
*
|
|
60
|
+
* @param config - AI configuration to validate
|
|
61
|
+
* @returns Validated and typed configuration
|
|
62
|
+
* @throws {TaskOMaticError} If validation fails
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```typescript
|
|
66
|
+
* const aiConfig = {
|
|
67
|
+
* provider: "openai",
|
|
68
|
+
* model: "gpt-4",
|
|
69
|
+
* temperature: 0.7,
|
|
70
|
+
* maxTokens: 4000
|
|
71
|
+
* };
|
|
72
|
+
*
|
|
73
|
+
* const validated = validateAIConfig(aiConfig);
|
|
74
|
+
* // validated is now type-safe and guaranteed valid
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
function validateAIConfig(config) {
|
|
78
|
+
try {
|
|
79
|
+
return exports.AIConfigSchema.parse(config);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
if (error instanceof zod_1.z.ZodError) {
|
|
83
|
+
const errors = error.errors.map((err) => ({
|
|
84
|
+
path: err.path.join("."),
|
|
85
|
+
message: err.message,
|
|
86
|
+
}));
|
|
87
|
+
throw new task_o_matic_error_1.TaskOMaticError("AI configuration validation failed", {
|
|
88
|
+
code: task_o_matic_error_1.TaskOMaticErrorCodes.CONFIGURATION_ERROR,
|
|
89
|
+
context: JSON.stringify(config, null, 2),
|
|
90
|
+
suggestions: [
|
|
91
|
+
"Check that all required fields are present",
|
|
92
|
+
"Verify provider is one of: openai, anthropic, openrouter, custom",
|
|
93
|
+
"Ensure model name is not empty",
|
|
94
|
+
"Check temperature is between 0 and 2",
|
|
95
|
+
"Verify maxTokens is a positive integer",
|
|
96
|
+
...errors.map((e) => `Fix ${e.path}: ${e.message}`),
|
|
97
|
+
],
|
|
98
|
+
metadata: { errors },
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Validate full configuration object
|
|
106
|
+
*
|
|
107
|
+
* @param config - Configuration object to validate
|
|
108
|
+
* @returns Validated and typed configuration
|
|
109
|
+
* @throws {TaskOMaticError} If validation fails
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* const config = {
|
|
114
|
+
* ai: {
|
|
115
|
+
* provider: "anthropic",
|
|
116
|
+
* model: "claude-sonnet-4.5",
|
|
117
|
+
* temperature: 0.5
|
|
118
|
+
* },
|
|
119
|
+
* workingDirectory: "/path/to/project"
|
|
120
|
+
* };
|
|
121
|
+
*
|
|
122
|
+
* const validated = validateConfig(config);
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
function validateConfig(config) {
|
|
126
|
+
try {
|
|
127
|
+
return exports.ConfigSchema.parse(config);
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
if (error instanceof zod_1.z.ZodError) {
|
|
131
|
+
const errors = error.errors.map((err) => ({
|
|
132
|
+
path: err.path.join("."),
|
|
133
|
+
message: err.message,
|
|
134
|
+
}));
|
|
135
|
+
throw new task_o_matic_error_1.TaskOMaticError("Configuration validation failed", {
|
|
136
|
+
code: task_o_matic_error_1.TaskOMaticErrorCodes.CONFIGURATION_ERROR,
|
|
137
|
+
context: JSON.stringify(config, null, 2),
|
|
138
|
+
suggestions: [
|
|
139
|
+
"Check that all required fields are present",
|
|
140
|
+
"Verify the configuration structure is correct",
|
|
141
|
+
...errors.map((e) => `Fix ${e.path}: ${e.message}`),
|
|
142
|
+
],
|
|
143
|
+
metadata: { errors },
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
throw error;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Safe validation that returns a result object instead of throwing
|
|
151
|
+
*
|
|
152
|
+
* @param config - Configuration to validate
|
|
153
|
+
* @returns Validation result with success flag and data or errors
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* const result = safeValidateConfig(userInput);
|
|
158
|
+
* if (result.success) {
|
|
159
|
+
* console.log("Valid config:", result.data);
|
|
160
|
+
* } else {
|
|
161
|
+
* console.error("Validation errors:", result.errors);
|
|
162
|
+
* }
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
function safeValidateConfig(config) {
|
|
166
|
+
const result = exports.ConfigSchema.safeParse(config);
|
|
167
|
+
if (result.success) {
|
|
168
|
+
return {
|
|
169
|
+
success: true,
|
|
170
|
+
data: result.data,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
return {
|
|
175
|
+
success: false,
|
|
176
|
+
errors: result.error.errors.map((err) => ({
|
|
177
|
+
path: err.path.join("."),
|
|
178
|
+
message: err.message,
|
|
179
|
+
})),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Safe AI config validation
|
|
185
|
+
*
|
|
186
|
+
* @param config - AI configuration to validate
|
|
187
|
+
* @returns Validation result with success flag and data or errors
|
|
188
|
+
*/
|
|
189
|
+
function safeValidateAIConfig(config) {
|
|
190
|
+
const result = exports.AIConfigSchema.safeParse(config);
|
|
191
|
+
if (result.success) {
|
|
192
|
+
return {
|
|
193
|
+
success: true,
|
|
194
|
+
data: result.data,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
return {
|
|
199
|
+
success: false,
|
|
200
|
+
errors: result.error.errors.map((err) => ({
|
|
201
|
+
path: err.path.join("."),
|
|
202
|
+
message: err.message,
|
|
203
|
+
})),
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Validate partial AI config (for updates)
|
|
209
|
+
*
|
|
210
|
+
* @param config - Partial AI configuration to validate
|
|
211
|
+
* @returns Validated partial configuration
|
|
212
|
+
* @throws {TaskOMaticError} If validation fails
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```typescript
|
|
216
|
+
* // Only validating fields that are present
|
|
217
|
+
* const updates = {
|
|
218
|
+
* temperature: 0.8
|
|
219
|
+
* };
|
|
220
|
+
*
|
|
221
|
+
* const validated = validatePartialAIConfig(updates);
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
function validatePartialAIConfig(config) {
|
|
225
|
+
try {
|
|
226
|
+
return exports.AIConfigSchema.partial().parse(config);
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
if (error instanceof zod_1.z.ZodError) {
|
|
230
|
+
const errors = error.errors.map((err) => ({
|
|
231
|
+
path: err.path.join("."),
|
|
232
|
+
message: err.message,
|
|
233
|
+
}));
|
|
234
|
+
throw new task_o_matic_error_1.TaskOMaticError("AI configuration update validation failed", {
|
|
235
|
+
code: task_o_matic_error_1.TaskOMaticErrorCodes.CONFIGURATION_ERROR,
|
|
236
|
+
context: JSON.stringify(config, null, 2),
|
|
237
|
+
suggestions: [
|
|
238
|
+
"Check that field values are valid",
|
|
239
|
+
...errors.map((e) => `Fix ${e.path}: ${e.message}`),
|
|
240
|
+
],
|
|
241
|
+
metadata: { errors },
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
throw error;
|
|
245
|
+
}
|
|
246
|
+
}
|
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,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,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
|
@@ -7,6 +7,7 @@ const path_1 = require("path");
|
|
|
7
7
|
const process_1 = require("process");
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
9
|
const dotenv_1 = require("dotenv");
|
|
10
|
+
const config_validation_1 = require("./config-validation");
|
|
10
11
|
// Provider-specific sensible defaults for 2025
|
|
11
12
|
const PROVIDER_DEFAULTS = {
|
|
12
13
|
openrouter: {
|
|
@@ -140,22 +141,27 @@ class ConfigManager {
|
|
|
140
141
|
const configData = await this.callbacks.read("config.json");
|
|
141
142
|
if (configData) {
|
|
142
143
|
const fileConfig = JSON.parse(configData);
|
|
143
|
-
|
|
144
|
+
const mergedConfig = {
|
|
144
145
|
...defaultConfig,
|
|
145
146
|
...fileConfig,
|
|
146
147
|
ai: { ...defaultConfig.ai, ...fileConfig.ai, ...envConfig },
|
|
147
148
|
};
|
|
149
|
+
// Validate the merged configuration
|
|
150
|
+
const validatedConfig = (0, config_validation_1.validateConfig)(mergedConfig);
|
|
151
|
+
this.config = validatedConfig;
|
|
148
152
|
if (this.config && this.config.workingDirectory) {
|
|
149
153
|
this.customWorkingDir = this.config.workingDirectory;
|
|
150
154
|
}
|
|
151
155
|
}
|
|
152
156
|
else {
|
|
153
|
-
|
|
157
|
+
// Validate default config too
|
|
158
|
+
this.config = (0, config_validation_1.validateConfig)(defaultConfig);
|
|
154
159
|
}
|
|
155
160
|
}
|
|
156
161
|
catch (error) {
|
|
157
|
-
console.warn("Failed to read config, using defaults:", error);
|
|
158
|
-
|
|
162
|
+
console.warn("Failed to read or validate config, using defaults:", error);
|
|
163
|
+
// Even defaults should be validated
|
|
164
|
+
this.config = (0, config_validation_1.validateConfig)(defaultConfig);
|
|
159
165
|
}
|
|
160
166
|
return this.config;
|
|
161
167
|
}
|
|
@@ -188,7 +194,15 @@ class ConfigManager {
|
|
|
188
194
|
if (!this.config) {
|
|
189
195
|
await this.load();
|
|
190
196
|
}
|
|
191
|
-
|
|
197
|
+
// Validate the partial config before merging
|
|
198
|
+
const validatedPartial = (0, config_validation_1.validatePartialAIConfig)(aiConfig);
|
|
199
|
+
// Merge and validate the full config
|
|
200
|
+
const mergedAIConfig = { ...this.config.ai, ...validatedPartial };
|
|
201
|
+
const validatedConfig = (0, config_validation_1.validateConfig)({
|
|
202
|
+
...this.config,
|
|
203
|
+
ai: mergedAIConfig,
|
|
204
|
+
});
|
|
205
|
+
this.config = validatedConfig;
|
|
192
206
|
await this.save();
|
|
193
207
|
}
|
|
194
208
|
setConfig(config) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-system.d.ts","sourceRoot":"","sources":["../../../src/lib/storage/file-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EACL,gBAAgB,EAEjB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"file-system.d.ts","sourceRoot":"","sources":["../../../src/lib/storage/file-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EACL,gBAAgB,EAEjB,MAAM,qBAAqB,CAAC;AAa7B,qBAAa,iBAAkB,YAAW,cAAc;IACtD,OAAO,CAAC,SAAS,CAAmB;gBAExB,SAAS,CAAC,EAAE,gBAAgB;IAOjC,m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CAAC,MAAM,GAAG,IAAI,CAAC;CAYnE"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FileSystemStorage = void 0;
|
|
4
4
|
const config_1 = require("../config");
|
|
5
5
|
const storage_callbacks_1 = require("./storage-callbacks");
|
|
6
|
+
const task_o_matic_error_1 = require("../../utils/task-o-matic-error");
|
|
6
7
|
class FileSystemStorage {
|
|
7
8
|
callbacks;
|
|
8
9
|
constructor(callbacks) {
|
|
@@ -16,30 +17,54 @@ class FileSystemStorage {
|
|
|
16
17
|
}
|
|
17
18
|
validateTaskId(taskId) {
|
|
18
19
|
if (!taskId || typeof taskId !== "string" || taskId.trim() === "") {
|
|
19
|
-
throw
|
|
20
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.INVALID_INPUT, "Task ID must be a non-empty string", {
|
|
21
|
+
context: "validateTaskId",
|
|
22
|
+
suggestions: ["Provide a valid task ID string"],
|
|
23
|
+
metadata: { taskId },
|
|
24
|
+
});
|
|
20
25
|
}
|
|
21
26
|
}
|
|
22
27
|
validateTaskRequest(task) {
|
|
23
28
|
if (!task || typeof task !== "object") {
|
|
24
|
-
throw
|
|
29
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.INVALID_INPUT, "Task request must be a valid object", {
|
|
30
|
+
context: "validateTaskRequest",
|
|
31
|
+
suggestions: ["Provide a valid task request object"],
|
|
32
|
+
});
|
|
25
33
|
}
|
|
26
34
|
if (!task.title ||
|
|
27
35
|
typeof task.title !== "string" ||
|
|
28
36
|
task.title.trim() === "") {
|
|
29
|
-
throw
|
|
37
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.INVALID_INPUT, "Task title is required and must be a non-empty string", {
|
|
38
|
+
context: "validateTaskRequest - title validation",
|
|
39
|
+
suggestions: ["Provide a non-empty title for the task"],
|
|
40
|
+
});
|
|
30
41
|
}
|
|
31
42
|
if (task.parentId && typeof task.parentId !== "string") {
|
|
32
|
-
throw
|
|
43
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.INVALID_INPUT, "Parent ID must be a string if provided", {
|
|
44
|
+
context: "validateTaskRequest - parentId validation",
|
|
45
|
+
suggestions: ["Provide a valid parent ID string or omit the field"],
|
|
46
|
+
metadata: { parentId: task.parentId },
|
|
47
|
+
});
|
|
33
48
|
}
|
|
34
49
|
if (task.estimatedEffort &&
|
|
35
50
|
!["small", "medium", "large"].includes(task.estimatedEffort)) {
|
|
36
|
-
throw
|
|
51
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.INVALID_INPUT, "Estimated effort must be 'small', 'medium', or 'large'", {
|
|
52
|
+
context: "validateTaskRequest - estimatedEffort validation",
|
|
53
|
+
suggestions: ["Use 'small', 'medium', or 'large' for estimatedEffort"],
|
|
54
|
+
metadata: { estimatedEffort: task.estimatedEffort },
|
|
55
|
+
});
|
|
37
56
|
}
|
|
38
57
|
if (task.dependencies && !Array.isArray(task.dependencies)) {
|
|
39
|
-
throw
|
|
58
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.INVALID_INPUT, "Dependencies must be an array if provided", {
|
|
59
|
+
context: "validateTaskRequest - dependencies validation",
|
|
60
|
+
suggestions: ["Provide dependencies as an array of task IDs"],
|
|
61
|
+
});
|
|
40
62
|
}
|
|
41
63
|
if (task.tags && !Array.isArray(task.tags)) {
|
|
42
|
-
throw
|
|
64
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.INVALID_INPUT, "Tags must be an array if provided", {
|
|
65
|
+
context: "validateTaskRequest - tags validation",
|
|
66
|
+
suggestions: ["Provide tags as an array of strings"],
|
|
67
|
+
});
|
|
43
68
|
}
|
|
44
69
|
}
|
|
45
70
|
async loadTasksData() {
|
|
@@ -60,7 +85,7 @@ class FileSystemStorage {
|
|
|
60
85
|
await this.callbacks.write("tasks.json", JSON.stringify(data, null, 2));
|
|
61
86
|
}
|
|
62
87
|
catch (error) {
|
|
63
|
-
throw
|
|
88
|
+
throw (0, task_o_matic_error_1.formatStorageError)("write tasks.json", error instanceof Error ? error : undefined);
|
|
64
89
|
}
|
|
65
90
|
}
|
|
66
91
|
findTaskInHierarchy(tasks, id) {
|
|
@@ -111,7 +136,15 @@ class FileSystemStorage {
|
|
|
111
136
|
if (task.parentId) {
|
|
112
137
|
const parentResult = this.findTaskInHierarchy(data.tasks, task.parentId);
|
|
113
138
|
if (!parentResult.task) {
|
|
114
|
-
throw
|
|
139
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.TASK_NOT_FOUND, `Parent task with ID ${task.parentId} not found`, {
|
|
140
|
+
context: "createTask - parent validation",
|
|
141
|
+
suggestions: [
|
|
142
|
+
"Create the parent task first",
|
|
143
|
+
"Check that the parent ID is correct",
|
|
144
|
+
"List all tasks to see available parent IDs",
|
|
145
|
+
],
|
|
146
|
+
metadata: { parentId: task.parentId },
|
|
147
|
+
});
|
|
115
148
|
}
|
|
116
149
|
const siblingCount = (parentResult.task.subtasks?.length || 0) + 1;
|
|
117
150
|
id = `${task.parentId}.${siblingCount}`;
|
|
@@ -129,11 +162,26 @@ class FileSystemStorage {
|
|
|
129
162
|
for (const depId of task.dependencies) {
|
|
130
163
|
const depExists = this.taskExists(data.tasks, depId);
|
|
131
164
|
if (!depExists) {
|
|
132
|
-
throw
|
|
165
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.TASK_NOT_FOUND, `Dependency task not found: ${depId}`, {
|
|
166
|
+
context: "createTask - dependency validation",
|
|
167
|
+
suggestions: [
|
|
168
|
+
"Create the dependency task first",
|
|
169
|
+
"Check that the dependency ID is correct",
|
|
170
|
+
"Remove the dependency from the task",
|
|
171
|
+
],
|
|
172
|
+
metadata: { dependencyId: depId, taskDependencies: task.dependencies },
|
|
173
|
+
});
|
|
133
174
|
}
|
|
134
175
|
}
|
|
135
176
|
if (this.wouldCreateCircularDependency(data.tasks, id, task.dependencies)) {
|
|
136
|
-
throw
|
|
177
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.STORAGE_INTEGRITY_ERROR, `Circular dependency detected for task ${id}`, {
|
|
178
|
+
context: "createTask - circular dependency check",
|
|
179
|
+
suggestions: [
|
|
180
|
+
"Remove circular dependencies from the task",
|
|
181
|
+
"Review the dependency chain",
|
|
182
|
+
],
|
|
183
|
+
metadata: { taskId: id, dependencies: task.dependencies },
|
|
184
|
+
});
|
|
137
185
|
}
|
|
138
186
|
}
|
|
139
187
|
let contentFile;
|
|
@@ -184,7 +232,10 @@ class FileSystemStorage {
|
|
|
184
232
|
async updateTask(id, updates) {
|
|
185
233
|
this.validateTaskId(id);
|
|
186
234
|
if (!updates || typeof updates !== "object") {
|
|
187
|
-
throw
|
|
235
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.INVALID_INPUT, "Updates must be a valid object", {
|
|
236
|
+
context: "updateTask - updates validation",
|
|
237
|
+
suggestions: ["Provide a valid updates object with task properties"],
|
|
238
|
+
});
|
|
188
239
|
}
|
|
189
240
|
const data = await this.loadTasksData();
|
|
190
241
|
const result = this.findTaskInHierarchy(data.tasks, id);
|
|
@@ -314,28 +365,34 @@ class FileSystemStorage {
|
|
|
314
365
|
async saveTaskContent(taskId, content) {
|
|
315
366
|
this.validateTaskId(taskId);
|
|
316
367
|
if (typeof content !== "string") {
|
|
317
|
-
throw
|
|
368
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.INVALID_INPUT, "Content must be a string", {
|
|
369
|
+
context: "Content validation",
|
|
370
|
+
suggestions: ["Provide content as a string"],
|
|
371
|
+
});
|
|
318
372
|
}
|
|
319
373
|
const contentFileName = `tasks/${taskId}.md`;
|
|
320
374
|
try {
|
|
321
375
|
await this.callbacks.write(contentFileName, content);
|
|
322
376
|
}
|
|
323
377
|
catch (error) {
|
|
324
|
-
throw
|
|
378
|
+
throw (0, task_o_matic_error_1.formatStorageError)("write task content", error instanceof Error ? error : undefined);
|
|
325
379
|
}
|
|
326
380
|
return contentFileName;
|
|
327
381
|
}
|
|
328
382
|
async saveEnhancedTaskContent(taskId, content) {
|
|
329
383
|
this.validateTaskId(taskId);
|
|
330
384
|
if (typeof content !== "string") {
|
|
331
|
-
throw
|
|
385
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.INVALID_INPUT, "Content must be a string", {
|
|
386
|
+
context: "Content validation",
|
|
387
|
+
suggestions: ["Provide content as a string"],
|
|
388
|
+
});
|
|
332
389
|
}
|
|
333
390
|
const contentFileName = `tasks/enhanced/${taskId}.md`;
|
|
334
391
|
try {
|
|
335
392
|
await this.callbacks.write(contentFileName, content);
|
|
336
393
|
}
|
|
337
394
|
catch (error) {
|
|
338
|
-
throw
|
|
395
|
+
throw (0, task_o_matic_error_1.formatStorageError)("write enhanced task content", error instanceof Error ? error : undefined);
|
|
339
396
|
}
|
|
340
397
|
return contentFileName;
|
|
341
398
|
}
|
|
@@ -496,7 +553,7 @@ class FileSystemStorage {
|
|
|
496
553
|
await this.callbacks.write(planFile, JSON.stringify(planData, null, 2));
|
|
497
554
|
}
|
|
498
555
|
catch (error) {
|
|
499
|
-
throw
|
|
556
|
+
throw (0, task_o_matic_error_1.formatStorageError)(`write plan for task ${taskId}`, error instanceof Error ? error : undefined);
|
|
500
557
|
}
|
|
501
558
|
}
|
|
502
559
|
async getPlan(taskId) {
|
|
@@ -509,7 +566,7 @@ class FileSystemStorage {
|
|
|
509
566
|
return JSON.parse(content);
|
|
510
567
|
}
|
|
511
568
|
catch (error) {
|
|
512
|
-
throw
|
|
569
|
+
throw (0, task_o_matic_error_1.formatStorageError)(`read plan for task ${taskId}`, error instanceof Error ? error : undefined);
|
|
513
570
|
}
|
|
514
571
|
}
|
|
515
572
|
async listPlans() {
|
|
@@ -534,7 +591,7 @@ class FileSystemStorage {
|
|
|
534
591
|
return plans.sort((a, b) => b.updatedAt - a.updatedAt);
|
|
535
592
|
}
|
|
536
593
|
catch (error) {
|
|
537
|
-
throw
|
|
594
|
+
throw (0, task_o_matic_error_1.formatStorageError)("list plans", error instanceof Error ? error : undefined);
|
|
538
595
|
}
|
|
539
596
|
}
|
|
540
597
|
async deletePlan(taskId) {
|
|
@@ -551,14 +608,17 @@ class FileSystemStorage {
|
|
|
551
608
|
async saveTaskDocumentation(taskId, documentation) {
|
|
552
609
|
this.validateTaskId(taskId);
|
|
553
610
|
if (typeof documentation !== "string") {
|
|
554
|
-
throw
|
|
611
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.INVALID_INPUT, "Documentation must be a string", {
|
|
612
|
+
context: "Documentation validation",
|
|
613
|
+
suggestions: ["Provide documentation as a string"],
|
|
614
|
+
});
|
|
555
615
|
}
|
|
556
616
|
const documentationFileName = `docs/tasks/${taskId}.md`;
|
|
557
617
|
try {
|
|
558
618
|
await this.callbacks.write(documentationFileName, documentation);
|
|
559
619
|
}
|
|
560
620
|
catch (error) {
|
|
561
|
-
throw
|
|
621
|
+
throw (0, task_o_matic_error_1.formatStorageError)("write task documentation", error instanceof Error ? error : undefined);
|
|
562
622
|
}
|
|
563
623
|
return documentationFileName;
|
|
564
624
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-execution-core.d.ts","sourceRoot":"","sources":["../../src/lib/task-execution-core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"task-execution-core.d.ts","sourceRoot":"","sources":["../../src/lib/task-execution-core.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EAKpB,MAAM,UAAU,CAAC;AAWlB;;;GAGG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CA+D9B"}
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.executeTaskCore = executeTaskCore;
|
|
7
|
+
const task_o_matic_error_1 = require("../utils/task-o-matic-error");
|
|
7
8
|
const tasks_1 = require("../services/tasks");
|
|
8
9
|
const executor_factory_1 = require("./executors/executor-factory");
|
|
9
10
|
const validation_1 = require("./validation");
|
|
@@ -23,7 +24,7 @@ async function executeTaskCore(taskId, config) {
|
|
|
23
24
|
// Load task
|
|
24
25
|
const task = await tasks_1.taskService.getTask(taskId);
|
|
25
26
|
if (!task) {
|
|
26
|
-
throw
|
|
27
|
+
throw (0, task_o_matic_error_1.formatTaskNotFoundError)(taskId);
|
|
27
28
|
}
|
|
28
29
|
// Check if task has subtasks and should execute them recursively
|
|
29
30
|
if (executeSubtasks && !customMessage) {
|
|
@@ -254,7 +255,7 @@ async function executeSingleAttempt(task, config, attempts, planContent, attempt
|
|
|
254
255
|
retryContext,
|
|
255
256
|
});
|
|
256
257
|
if (!promptResult.success) {
|
|
257
|
-
throw
|
|
258
|
+
throw (0, task_o_matic_error_1.createStandardError)(task_o_matic_error_1.TaskOMaticErrorCodes.CONFIGURATION_ERROR, `Failed to build execution prompt: ${promptResult.error}`);
|
|
258
259
|
}
|
|
259
260
|
executionMessage = promptResult.prompt;
|
|
260
261
|
}
|
package/dist/services/prd.d.ts
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
|
+
import { getAIOperations, getStorage } from "../utils/ai-service-factory";
|
|
1
2
|
import { AIOptions } from "../utils/ai-config-builder";
|
|
2
3
|
import { StreamingOptions } from "../types";
|
|
3
4
|
import { PRDParseResult } from "../types/results";
|
|
4
5
|
import { ProgressCallback } from "../types/callbacks";
|
|
6
|
+
/**
|
|
7
|
+
* Dependencies for PRDService
|
|
8
|
+
*/
|
|
9
|
+
export interface PRDServiceDependencies {
|
|
10
|
+
storage?: ReturnType<typeof getStorage>;
|
|
11
|
+
aiOperations?: ReturnType<typeof getAIOperations>;
|
|
12
|
+
}
|
|
5
13
|
/**
|
|
6
14
|
* PRDService - Business logic for PRD operations
|
|
7
15
|
* Handles PRD parsing, task extraction, and PRD improvement
|
|
8
16
|
*/
|
|
9
17
|
export declare class PRDService {
|
|
18
|
+
private storage;
|
|
19
|
+
private aiOperations;
|
|
20
|
+
/**
|
|
21
|
+
* Create a new PRDService
|
|
22
|
+
*
|
|
23
|
+
* @param dependencies - Optional dependencies to inject (for testing)
|
|
24
|
+
*/
|
|
25
|
+
constructor(dependencies?: PRDServiceDependencies);
|
|
10
26
|
parsePRD(input: {
|
|
11
27
|
file: string;
|
|
12
28
|
workingDirectory?: string;
|
|
@@ -98,5 +114,6 @@ export declare class PRDService {
|
|
|
98
114
|
};
|
|
99
115
|
}>;
|
|
100
116
|
}
|
|
117
|
+
export declare function getPRDService(): PRDService;
|
|
101
118
|
export declare const prdService: PRDService;
|
|
102
119
|
//# sourceMappingURL=prd.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prd.d.ts","sourceRoot":"","sources":["../../src/services/prd.ts"],"names":[],"mappings":"
|
|
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,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAY,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD;;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