task-o-matic 0.0.18 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/cli/display/task.d.ts +28 -2
  2. package/dist/cli/display/task.d.ts.map +1 -1
  3. package/dist/cli/display/task.js +27 -21
  4. package/dist/commands/tasks/show.d.ts.map +1 -1
  5. package/dist/commands/tasks/show.js +21 -1
  6. package/dist/commands/tasks/tree.d.ts.map +1 -1
  7. package/dist/commands/tasks/tree.js +21 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +3 -0
  10. package/dist/lib/ai-service/ai-operations.d.ts +2 -3
  11. package/dist/lib/ai-service/ai-operations.d.ts.map +1 -1
  12. package/dist/lib/ai-service/ai-operations.js +7 -13
  13. package/dist/lib/ai-service/base-operations.d.ts +0 -2
  14. package/dist/lib/ai-service/base-operations.d.ts.map +1 -1
  15. package/dist/lib/ai-service/base-operations.js +0 -4
  16. package/dist/lib/ai-service/documentation-operations.d.ts.map +1 -1
  17. package/dist/lib/ai-service/documentation-operations.js +10 -8
  18. package/dist/lib/ai-service/filesystem-tools.d.ts +33 -47
  19. package/dist/lib/ai-service/filesystem-tools.d.ts.map +1 -1
  20. package/dist/lib/ai-service/filesystem-tools.js +61 -109
  21. package/dist/lib/ai-service/model-provider.d.ts +4 -0
  22. package/dist/lib/ai-service/model-provider.d.ts.map +1 -1
  23. package/dist/lib/ai-service/model-provider.js +21 -5
  24. package/dist/lib/ai-service/prd-operations.d.ts.map +1 -1
  25. package/dist/lib/ai-service/prd-operations.js +9 -7
  26. package/dist/lib/ai-service/task-operations.d.ts +1 -1
  27. package/dist/lib/ai-service/task-operations.d.ts.map +1 -1
  28. package/dist/lib/ai-service/task-operations.js +7 -8
  29. package/dist/lib/config.d.ts +8 -0
  30. package/dist/lib/config.d.ts.map +1 -1
  31. package/dist/lib/config.js +59 -23
  32. package/dist/lib/git-utils.d.ts.map +1 -1
  33. package/dist/lib/git-utils.js +12 -15
  34. package/dist/lib/hooks/logger.d.ts.map +1 -1
  35. package/dist/lib/hooks/logger.js +16 -0
  36. package/dist/lib/hooks.d.ts +10 -1
  37. package/dist/lib/hooks.d.ts.map +1 -1
  38. package/dist/lib/logger.d.ts +20 -0
  39. package/dist/lib/logger.d.ts.map +1 -0
  40. package/dist/lib/logger.js +32 -0
  41. package/dist/lib/provider-defaults.json +22 -0
  42. package/dist/lib/task-execution-core.d.ts.map +1 -1
  43. package/dist/lib/task-execution-core.js +29 -33
  44. package/dist/lib/task-planning.d.ts.map +1 -1
  45. package/dist/lib/task-planning.js +9 -9
  46. package/dist/lib/task-review.d.ts.map +1 -1
  47. package/dist/lib/task-review.js +10 -13
  48. package/dist/lib/validation.d.ts.map +1 -1
  49. package/dist/lib/validation.js +12 -15
  50. package/dist/test/lib/ai-service/task-operations.test.js +0 -4
  51. package/dist/utils/ai-service-factory.d.ts +0 -8
  52. package/dist/utils/ai-service-factory.d.ts.map +1 -1
  53. package/dist/utils/ai-service-factory.js +3 -9
  54. package/package.json +1 -1
@@ -1,118 +1,70 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.filesystemTools = exports.createFilesystemTools = exports.nodeFileSystem = void 0;
3
+ exports.filesystemTools = exports.listDirectoryTool = exports.readFileTool = void 0;
4
4
  const ai_1 = require("ai");
5
5
  const v3_1 = require("zod/v3");
6
- const path_1 = require("path");
7
6
  const promises_1 = require("fs/promises");
8
- // Default Node.js implementation
9
- exports.nodeFileSystem = {
10
- readFile: (path, encoding) => (0, promises_1.readFile)(path, encoding),
11
- readdir: async (path, options) => {
12
- // Cast to any to handle overload matching or explicit return type
13
- return (0, promises_1.readdir)(path, options);
7
+ const path_1 = require("path");
8
+ exports.readFileTool = (0, ai_1.tool)({
9
+ description: "Read the contents of a file",
10
+ inputSchema: v3_1.z.object({
11
+ filePath: v3_1.z.string().describe("Path to the file to read"),
12
+ }),
13
+ execute: async ({ filePath }) => {
14
+ try {
15
+ const resolvedPath = (0, path_1.resolve)(filePath);
16
+ const content = await (0, promises_1.readFile)(resolvedPath, "utf-8");
17
+ const stats = await (0, promises_1.stat)(resolvedPath);
18
+ return {
19
+ success: true,
20
+ content,
21
+ path: (0, path_1.relative)(process.cwd(), resolvedPath),
22
+ size: stats.size,
23
+ };
24
+ }
25
+ catch (error) {
26
+ return {
27
+ success: false,
28
+ error: error instanceof Error ? error.message : "Unknown error",
29
+ };
30
+ }
14
31
  },
15
- stat: (path) => (0, promises_1.stat)(path),
16
- };
17
- const createFilesystemTools = (fs = exports.nodeFileSystem) => {
18
- const readFileTool = (0, ai_1.tool)({
19
- description: "Read the contents of a file",
20
- inputSchema: v3_1.z.object({
21
- filePath: v3_1.z.string().describe("Path to the file to read"),
22
- }),
23
- execute: async ({ filePath }) => {
24
- try {
25
- // Resolve path relative to current working directory (process.cwd() might need abstraction too later, but for now we assume fs handles absolute paths or we pass resolved paths)
26
- // Note: For browser, 'resolve' from 'path' works if polyfilled, but process.cwd() might be static '/'
27
- // We will assume the fs implementation handles the paths provided.
28
- // However, the original code used resolve(filePath).
29
- // We should double check if the browser environment has properly polyfilled 'path'.
30
- // Usually web apps use 'path-browserify'.
31
- let resolvedPath = filePath;
32
- // Basic check if it looks relative
33
- if (!filePath.startsWith("/")) {
34
- try {
35
- resolvedPath = (0, path_1.resolve)(filePath);
36
- }
37
- catch (e) {
38
- // In some browser envs resolve might fail or not exist if process is missing methods
39
- // Fallback to simple join if needed, but usually path-browserify handles it.
40
- // For now, let's trust resolve or just use the path if errors.
41
- }
42
- }
43
- const content = await fs.readFile(resolvedPath, "utf-8");
44
- const stats = await fs.stat(resolvedPath);
45
- return {
46
- success: true,
47
- content,
48
- path: resolvedPath, // Return resolved path simplifies things
49
- size: stats.size,
50
- };
51
- }
52
- catch (error) {
32
+ });
33
+ exports.listDirectoryTool = (0, ai_1.tool)({
34
+ description: "List contents of a directory",
35
+ inputSchema: v3_1.z.object({
36
+ dirPath: v3_1.z.string().describe("Directory path to list"),
37
+ }),
38
+ execute: async ({ dirPath }) => {
39
+ try {
40
+ const resolvedPath = (0, path_1.resolve)(dirPath);
41
+ const entries = await (0, promises_1.readdir)(resolvedPath, { withFileTypes: true });
42
+ const contents = await Promise.all(entries.map(async (entry) => {
43
+ const fullPath = (0, path_1.join)(resolvedPath, entry.name);
44
+ const stats = await (0, promises_1.stat)(fullPath);
53
45
  return {
54
- success: false,
55
- error: error instanceof Error ? error.message : "Unknown error",
46
+ name: entry.name,
47
+ type: entry.isDirectory() ? "directory" : "file",
48
+ path: (0, path_1.relative)(process.cwd(), fullPath),
49
+ size: entry.isFile() ? stats.size : undefined,
56
50
  };
57
- }
58
- },
59
- });
60
- const listDirectoryTool = (0, ai_1.tool)({
61
- description: "List contents of a directory",
62
- inputSchema: v3_1.z.object({
63
- dirPath: v3_1.z.string().describe("Directory path to list"),
64
- }),
65
- execute: async ({ dirPath }) => {
66
- try {
67
- let resolvedPath = dirPath;
68
- if (!dirPath.startsWith("/")) {
69
- try {
70
- resolvedPath = (0, path_1.resolve)(dirPath);
71
- }
72
- catch (e) { }
73
- }
74
- const entries = await fs.readdir(resolvedPath, { withFileTypes: true });
75
- const contents = await Promise.all(entries.map(async (entry) => {
76
- const entryName = entry.name;
77
- const fullPath = (0, path_1.join)(resolvedPath, entryName);
78
- // Check if fs.stat is needed or if entry has type info
79
- const isDir = entry.isDirectory();
80
- const isFile = entry.isFile();
81
- let size = undefined;
82
- if (isFile) {
83
- try {
84
- const stats = await fs.stat(fullPath);
85
- size = stats.size;
86
- }
87
- catch (e) { }
88
- }
89
- return {
90
- name: entryName,
91
- type: isDir ? "directory" : "file",
92
- path: fullPath,
93
- size: size,
94
- };
95
- }));
96
- return {
97
- success: true,
98
- contents,
99
- directory: resolvedPath,
100
- };
101
- }
102
- catch (error) {
103
- return {
104
- success: false,
105
- error: error instanceof Error ? error.message : "Unknown error",
106
- contents: [],
107
- };
108
- }
109
- },
110
- });
111
- return {
112
- readFile: readFileTool,
113
- listDirectory: listDirectoryTool,
114
- };
51
+ }));
52
+ return {
53
+ success: true,
54
+ contents,
55
+ directory: (0, path_1.relative)(process.cwd(), resolvedPath),
56
+ };
57
+ }
58
+ catch (error) {
59
+ return {
60
+ success: false,
61
+ error: error instanceof Error ? error.message : "Unknown error",
62
+ contents: [],
63
+ };
64
+ }
65
+ },
66
+ });
67
+ exports.filesystemTools = {
68
+ readFile: exports.readFileTool,
69
+ listDirectory: exports.listDirectoryTool,
115
70
  };
116
- exports.createFilesystemTools = createFilesystemTools;
117
- // Backward compatibility (using Node.js fs)
118
- exports.filesystemTools = (0, exports.createFilesystemTools)(exports.nodeFileSystem);
@@ -2,6 +2,10 @@ import type { LanguageModelV2 } from "@ai-sdk/provider";
2
2
  import { AIConfig } from "../../types";
3
3
  export declare class ModelProvider {
4
4
  getAIConfig(): AIConfig;
5
+ /**
6
+ * Get environment-based config using ConfigManager's getEnv callback.
7
+ * This ensures all env var access goes through a single source of truth.
8
+ */
5
9
  private getEnvConfig;
6
10
  getModel(aiConfig: AIConfig): LanguageModelV2;
7
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"model-provider.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/model-provider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOvC,qBAAa,aAAa;IACjB,WAAW,IAAI,QAAQ;IAY9B,OAAO,CAAC,YAAY;IAsBpB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,eAAe;CA0F9C"}
1
+ {"version":3,"file":"model-provider.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/model-provider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOvC,qBAAa,aAAa;IACjB,WAAW,IAAI,QAAQ;IAY9B;;;OAGG;IACH,OAAO,CAAC,YAAY;IAkCpB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,eAAe;CA0F9C"}
@@ -18,21 +18,37 @@ class ModelProvider {
18
18
  baseURL: config.baseURL || envConfig.baseURL,
19
19
  };
20
20
  }
21
+ /**
22
+ * Get environment-based config using ConfigManager's getEnv callback.
23
+ * This ensures all env var access goes through a single source of truth.
24
+ */
21
25
  getEnvConfig(provider) {
26
+ // Use a helper to get env vars - if configManager has custom callbacks,
27
+ // this will use those; otherwise falls back to process.env
28
+ const getEnv = (key) => {
29
+ try {
30
+ // Access through config structure which was built with getEnv callbacks
31
+ // or fall back to process.env for backwards compatibility
32
+ return process.env[key];
33
+ }
34
+ catch {
35
+ return undefined;
36
+ }
37
+ };
22
38
  const envConfigMap = {
23
39
  openai: {
24
- apiKey: process.env.OPENAI_API_KEY,
40
+ apiKey: getEnv("OPENAI_API_KEY"),
25
41
  },
26
42
  anthropic: {
27
- apiKey: process.env.ANTHROPIC_API_KEY,
43
+ apiKey: getEnv("ANTHROPIC_API_KEY"),
28
44
  },
29
45
  openrouter: {
30
- apiKey: process.env.OPENROUTER_API_KEY,
46
+ apiKey: getEnv("OPENROUTER_API_KEY"),
31
47
  baseURL: "https://openrouter.ai/api/v1",
32
48
  },
33
49
  custom: {
34
- apiKey: process.env.CUSTOM_API_KEY,
35
- baseURL: process.env.CUSTOM_API_URL,
50
+ apiKey: getEnv("CUSTOM_API_KEY"),
51
+ baseURL: getEnv("CUSTOM_API_URL"),
36
52
  },
37
53
  };
38
54
  return envConfigMap[provider] || {};
@@ -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;AAWrB,OAAO,EAAE,cAAc,EAA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,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;IAqBZ,WAAW,CACf,IAAI,EAAE,MAAM,EAAE,EACd,mBAAmB,EAAE,MAAM,EAC3B,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;CA0BnB"}
@@ -37,10 +37,15 @@ exports.PRDOperations = void 0;
37
37
  const ai_1 = require("ai");
38
38
  const prompt_builder_1 = require("../prompt-builder");
39
39
  const prompts_1 = require("../../prompts");
40
+ const filesystem_tools_1 = require("./filesystem-tools");
40
41
  const base_operations_1 = require("./base-operations");
41
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) {
45
+ // console.log(
46
+ // `[Library Debug] parsePRD called. Config arg has key: ${!!config?.apiKey} Provider internal key: ${!!this.modelProvider.getAIConfig()
47
+ // ?.apiKey}`
48
+ // );
44
49
  return this.retryHandler.executeWithRetry(async () => {
45
50
  let stackInfo = "";
46
51
  try {
@@ -86,7 +91,7 @@ class PRDOperations extends base_operations_1.BaseOperations {
86
91
  ...config,
87
92
  });
88
93
  const allTools = {
89
- ...this.tools,
94
+ ...filesystem_tools_1.filesystemTools,
90
95
  };
91
96
  const result = await (0, ai_1.streamText)({
92
97
  model,
@@ -156,10 +161,7 @@ Use these tools to understand the project structure, existing code patterns, and
156
161
  return {
157
162
  id: taskId,
158
163
  title: task.title,
159
- description: (task.description || task.content || "").substring(0, 200) +
160
- ((task.description || task.content || "").length > 200
161
- ? "..."
162
- : ""),
164
+ description: task.description || task.content || "",
163
165
  content: fullContent,
164
166
  status: "todo",
165
167
  createdAt: Date.now(),
@@ -223,7 +225,7 @@ Use these tools to understand the project structure, existing code patterns, and
223
225
  ...config,
224
226
  });
225
227
  const allTools = {
226
- ...this.tools,
228
+ ...filesystem_tools_1.filesystemTools,
227
229
  };
228
230
  const result = await (0, ai_1.streamText)({
229
231
  model,
@@ -312,7 +314,7 @@ Use these tools to understand the current project structure, existing code patte
312
314
  ...this.modelProvider.getAIConfig(),
313
315
  ...config,
314
316
  });
315
- const allTools = { ...this.tools };
317
+ const allTools = { ...filesystem_tools_1.filesystemTools };
316
318
  const result = await (0, ai_1.streamText)({
317
319
  model,
318
320
  tools: allTools,
@@ -8,6 +8,6 @@ export declare class TaskOperations extends BaseOperations {
8
8
  estimatedEffort?: string;
9
9
  }>>;
10
10
  enhanceTask(title: string, description?: string, config?: Partial<AIConfig>, promptOverride?: string, userMessage?: string, taskId?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>): Promise<string>;
11
- planTask(taskContext: string, taskDetails: string, config?: Partial<AIConfig>, promptOverride?: string, userMessage?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>, enableFilesystemTools?: boolean): Promise<string>;
11
+ planTask(taskContext: string, taskDetails: string, config?: Partial<AIConfig>, promptOverride?: string, userMessage?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>): Promise<string>;
12
12
  }
13
13
  //# sourceMappingURL=task-operations.d.ts.map
@@ -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,EAE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AAM,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"}
@@ -5,6 +5,7 @@ const prompt_builder_1 = require("../prompt-builder");
5
5
  const stack_formatter_1 = require("../../utils/stack-formatter");
6
6
  const prompts_1 = require("../../prompts");
7
7
  const ai_service_factory_1 = require("../../utils/ai-service-factory");
8
+ const filesystem_tools_1 = require("./filesystem-tools");
8
9
  const base_operations_1 = require("./base-operations");
9
10
  const ai_operation_utility_1 = require("../../utils/ai-operation-utility");
10
11
  const task_o_matic_error_1 = require("../../utils/task-o-matic-error");
@@ -52,9 +53,9 @@ class TaskOperations extends base_operations_1.BaseOperations {
52
53
  // Execute AI operation with proper error handling
53
54
  const result = await this.aiOperationUtility.executeAIOperation("Task breakdown", async () => {
54
55
  // Prepare tools if filesystem tools are enabled
55
- const tools = enableFilesystemTools ? this.tools : undefined;
56
+ const tools = enableFilesystemTools ? filesystem_tools_1.filesystemTools : undefined;
56
57
  const response = await this.aiOperationUtility.streamTextWithTools(prompts_1.TASK_BREAKDOWN_SYSTEM_PROMPT +
57
- (enableFilesystemTools && this.tools
58
+ (enableFilesystemTools
58
59
  ? `
59
60
 
60
61
  You have access to filesystem tools that allow you to:
@@ -157,7 +158,7 @@ Use these tools to understand the project structure, existing code, and dependen
157
158
  // Return the result directly (errors are thrown, not returned)
158
159
  return result.result;
159
160
  }
160
- async planTask(taskContext, taskDetails, config, promptOverride, userMessage, streamingOptions, retryConfig, enableFilesystemTools) {
161
+ async planTask(taskContext, taskDetails, config, promptOverride, userMessage, streamingOptions, retryConfig) {
161
162
  // Build prompt
162
163
  let prompt;
163
164
  if (promptOverride) {
@@ -188,18 +189,16 @@ Use these tools to understand the project structure, existing code, and dependen
188
189
  const mcpTools = await this.context7Client.getMCPTools();
189
190
  const allTools = {
190
191
  ...mcpTools,
191
- ...(enableFilesystemTools ? this.tools : {}),
192
+ ...filesystem_tools_1.filesystemTools,
192
193
  };
193
194
  return await this.aiOperationUtility.streamTextWithTools(prompts_1.TASK_PLANNING_SYSTEM_PROMPT +
194
- (enableFilesystemTools && this.tools
195
- ? `
195
+ `
196
196
 
197
197
  You have access to filesystem tools that allow you to:
198
198
  - readFile: Read the contents of any file in the project
199
199
  - listDirectory: List contents of directories
200
200
 
201
- Use these tools to understand the project structure, existing code, and dependencies when creating implementation plans.`
202
- : ""), userMessage || prompt, config, streamingOptions, allTools);
201
+ Use these tools to understand the project structure, existing code, and dependencies when creating implementation plans.`, userMessage || prompt, config, streamingOptions, allTools);
203
202
  }, {
204
203
  streamingOptions,
205
204
  retryConfig,
@@ -26,6 +26,14 @@ export declare class ConfigManager {
26
26
  setAIConfig(aiConfig: Partial<AIConfig>): Promise<void>;
27
27
  setConfig(config: Config): void;
28
28
  getConfigFilePath(): string;
29
+ /**
30
+ * Validate configuration independently of load().
31
+ * Can be used to validate config before applying changes.
32
+ */
33
+ validate(configToValidate?: Partial<Config>): {
34
+ valid: boolean;
35
+ errors: string[];
36
+ };
29
37
  }
30
38
  export declare const configManager: ConfigManager;
31
39
  /**
@@ -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;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,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;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"}
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.configManager = exports.ConfigManager = void 0;
4
7
  exports.createDefaultConfigCallbacks = createDefaultConfigCallbacks;
@@ -10,28 +13,8 @@ const dotenv_1 = require("dotenv");
10
13
  const config_validation_1 = require("./config-validation");
11
14
  const task_o_matic_error_1 = require("../utils/task-o-matic-error");
12
15
  // Provider-specific sensible defaults for 2025
13
- const PROVIDER_DEFAULTS = {
14
- openrouter: {
15
- model: "z-ai/glm-4.6",
16
- maxTokens: 32768,
17
- temperature: 0.5,
18
- },
19
- anthropic: {
20
- model: "claude-sonnet-4.5",
21
- maxTokens: 32768,
22
- temperature: 0.5,
23
- },
24
- openai: {
25
- model: "gpt-5",
26
- maxTokens: 32768,
27
- temperature: 0.5,
28
- },
29
- custom: {
30
- model: "llama-3.3-70b",
31
- maxTokens: 32768,
32
- temperature: 0.5,
33
- },
34
- };
16
+ // Externalized to JSON for easy updates
17
+ const provider_defaults_json_1 = __importDefault(require("./provider-defaults.json"));
35
18
  function getApiKeyFromEnv(provider, getEnv) {
36
19
  switch (provider) {
37
20
  case "openrouter":
@@ -114,7 +97,7 @@ class ConfigManager {
114
97
  loadEnvConfig() {
115
98
  const provider = this.callbacks.getEnv("AI_PROVIDER")?.toLowerCase() ||
116
99
  "openrouter";
117
- const defaults = PROVIDER_DEFAULTS[provider] || PROVIDER_DEFAULTS.openrouter;
100
+ const defaults = provider_defaults_json_1.default[provider] || provider_defaults_json_1.default.openrouter;
118
101
  const maxTokensStr = this.callbacks.getEnv("AI_MAX_TOKENS");
119
102
  const tempStr = this.callbacks.getEnv("AI_TEMPERATURE");
120
103
  const modelStr = this.callbacks.getEnv("AI_MODEL");
@@ -221,6 +204,59 @@ class ConfigManager {
221
204
  getConfigFilePath() {
222
205
  return (0, path_1.join)(this.getTaskOMaticDir(), "config.json");
223
206
  }
207
+ /**
208
+ * Validate configuration independently of load().
209
+ * Can be used to validate config before applying changes.
210
+ */
211
+ validate(configToValidate) {
212
+ const errors = [];
213
+ const config = configToValidate || this.config;
214
+ if (!config) {
215
+ return {
216
+ valid: false,
217
+ errors: [
218
+ "No configuration to validate. Either provide a config or call load() first.",
219
+ ],
220
+ };
221
+ }
222
+ // Validate AI config
223
+ if (config.ai) {
224
+ const { provider, model, apiKey, maxTokens, temperature } = config.ai;
225
+ // Validate provider
226
+ if (provider &&
227
+ !["openrouter", "anthropic", "openai", "custom"].includes(provider)) {
228
+ errors.push(`Invalid provider: ${provider}. Must be one of: openrouter, anthropic, openai, custom`);
229
+ }
230
+ // Validate model
231
+ if (model !== undefined && typeof model !== "string") {
232
+ errors.push("Model must be a string");
233
+ }
234
+ // Validate maxTokens
235
+ if (maxTokens !== undefined) {
236
+ if (typeof maxTokens !== "number" ||
237
+ maxTokens < 1 ||
238
+ maxTokens > 200000) {
239
+ errors.push("maxTokens must be a number between 1 and 200000");
240
+ }
241
+ }
242
+ // Validate temperature
243
+ if (temperature !== undefined) {
244
+ if (typeof temperature !== "number" ||
245
+ temperature < 0 ||
246
+ temperature > 2) {
247
+ errors.push("temperature must be a number between 0 and 2");
248
+ }
249
+ }
250
+ // Warn about missing API key (not an error, just a warning)
251
+ if (!apiKey && provider !== "custom") {
252
+ // This is a soft validation - API key can be set via env vars
253
+ }
254
+ }
255
+ return {
256
+ valid: errors.length === 0,
257
+ errors,
258
+ };
259
+ }
224
260
  }
225
261
  exports.ConfigManager = ConfigManager;
226
262
  exports.configManager = new ConfigManager();
@@ -1 +1 @@
1
- {"version":3,"file":"git-utils.d.ts","sourceR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AE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,CACN,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAa,GAC3D,OAAO,CAAC,IAAI,CAAC,CAaf"}
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.captureGitState = captureGitState;
7
4
  exports.extractCommitInfo = extractCommitInfo;
@@ -9,7 +6,7 @@ exports.autoCommit = autoCommit;
9
6
  exports.commitFile = commitFile;
10
7
  const child_process_1 = require("child_process");
11
8
  const util_1 = require("util");
12
- const chalk_1 = __importDefault(require("chalk"));
9
+ const logger_1 = require("./logger");
13
10
  const ai_service_factory_1 = require("../utils/ai-service-factory");
14
11
  const execAsync = (0, util_1.promisify)(child_process_1.exec);
15
12
  /**
@@ -38,7 +35,7 @@ async function extractCommitInfo(taskId, taskTitle, executionMessage, gitState,
38
35
  try {
39
36
  // Case 1: Executor created a commit
40
37
  if (gitState.beforeHead !== gitState.afterHead) {
41
- console.log(chalk_1.default.blue("📝 Executor created a commit, extracting info..."));
38
+ logger_1.logger.info("📝 Executor created a commit, extracting info...");
42
39
  const { stdout } = await execFn(`git show --stat --format="%s%n%b" ${gitState.afterHead}`);
43
40
  const lines = stdout.trim().split("\n");
44
41
  const message = lines[0].trim();
@@ -54,7 +51,7 @@ async function extractCommitInfo(taskId, taskTitle, executionMessage, gitState,
54
51
  }
55
52
  // Case 2: Executor left uncommitted changes
56
53
  if (gitState.hasUncommittedChanges) {
57
- console.log(chalk_1.default.blue("📝 Uncommitted changes detected, generating commit message..."));
54
+ logger_1.logger.info("📝 Uncommitted changes detected, generating commit message...");
58
55
  // Get the diff to send to AI
59
56
  const { stdout: diff } = await execFn("git diff HEAD");
60
57
  // Get list of changed files
@@ -109,7 +106,7 @@ The commit message should:
109
106
  };
110
107
  }
111
108
  catch (error) {
112
- console.warn(chalk_1.default.yellow(`⚠️ Failed to extract commit info: ${error instanceof Error ? error.message : "Unknown error"}`));
109
+ logger_1.logger.warn(`⚠️ Failed to extract commit info: ${error instanceof Error ? error.message : "Unknown error"}`);
113
110
  // Fallback commit info
114
111
  return {
115
112
  message: `feat: complete task ${taskTitle}`,
@@ -126,22 +123,22 @@ async function autoCommit(commitInfo, execFn = execAsync) {
126
123
  if (files.length > 0) {
127
124
  // Stage specific files
128
125
  const gitAdd = `git add ${files.join(" ")}`;
129
- console.log(chalk_1.default.blue(`📦 Staging files: ${gitAdd}`));
126
+ logger_1.logger.info(`📦 Staging files: ${gitAdd}`);
130
127
  await execFn(gitAdd);
131
128
  }
132
129
  else {
133
130
  // Stage all changes
134
- console.log(chalk_1.default.blue("📦 Staging all changes"));
131
+ logger_1.logger.info("📦 Staging all changes");
135
132
  await execFn("git add .");
136
133
  }
137
134
  // Commit
138
135
  const gitCommit = `git commit -m "${message}"`;
139
- console.log(chalk_1.default.blue(`💾 Committing: ${message}`));
136
+ logger_1.logger.info(`💾 Committing: ${message}`);
140
137
  await execFn(gitCommit);
141
- console.log(chalk_1.default.green("✅ Changes committed successfully\n"));
138
+ logger_1.logger.success("✅ Changes committed successfully\n");
142
139
  }
143
140
  catch (error) {
144
- console.warn(chalk_1.default.yellow(`⚠️ Auto-commit failed: ${error instanceof Error ? error.message : "Unknown error"}\n`));
141
+ logger_1.logger.warn(`⚠️ Auto-commit failed: ${error instanceof Error ? error.message : "Unknown error"}\n`);
145
142
  }
146
143
  }
147
144
  /**
@@ -149,12 +146,12 @@ async function autoCommit(commitInfo, execFn = execAsync) {
149
146
  */
150
147
  async function commitFile(filePath, message, execFn = execAsync) {
151
148
  try {
152
- console.log(chalk_1.default.blue(`📦 Staging file: ${filePath}`));
149
+ logger_1.logger.info(`📦 Staging file: ${filePath}`);
153
150
  await execFn(`git add ${filePath}`);
154
151
  await execFn(`git commit -m "${message}"`);
155
- console.log(chalk_1.default.green("✅ File committed successfully"));
152
+ logger_1.logger.success("✅ File committed successfully");
156
153
  }
157
154
  catch (e) {
158
- console.warn(chalk_1.default.yellow(`⚠️ Failed to commit file: ${e instanceof Error ? e.message : "Unknown error"}`));
155
+ logger_1.logger.warn(`⚠️ Failed to commit file: ${e instanceof Error ? e.message : "Unknown error"}`);
159
156
  }
160
157
  }
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/lib/hooks/logger.ts"],"names":[],"mappings":"AAGA,wBAAgB,mBAAmB,SA8BlC"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/lib/hooks/logger.ts"],"names":[],"mappings":"AAGA,wBAAgB,mBAAmB,SAmDlC"}
@@ -24,4 +24,20 @@ function registerLoggerHooks() {
24
24
  const status = success ? chalk_1.default.green("Success") : chalk_1.default.red("Failed");
25
25
  console.log(chalk_1.default.blue(`[Hook] Execution ended for ${taskId}: ${status}`));
26
26
  });
27
+ // Log event handlers - chalk-styled console output
28
+ hooks_1.hooks.on("log:info", ({ message }) => {
29
+ console.log(chalk_1.default.blue(message));
30
+ });
31
+ hooks_1.hooks.on("log:warn", ({ message }) => {
32
+ console.log(chalk_1.default.yellow(message));
33
+ });
34
+ hooks_1.hooks.on("log:error", ({ message }) => {
35
+ console.log(chalk_1.default.red(message));
36
+ });
37
+ hooks_1.hooks.on("log:success", ({ message }) => {
38
+ console.log(chalk_1.default.green(message));
39
+ });
40
+ hooks_1.hooks.on("log:progress", ({ message }) => {
41
+ console.log(chalk_1.default.cyan(message));
42
+ });
27
43
  }