task-o-matic 0.0.1

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 (159) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +552 -0
  3. package/dist/cli/bin.d.ts +3 -0
  4. package/dist/cli/bin.d.ts.map +1 -0
  5. package/dist/cli/bin.js +8 -0
  6. package/dist/cli/display/common.d.ts +5 -0
  7. package/dist/cli/display/common.d.ts.map +1 -0
  8. package/dist/cli/display/common.js +44 -0
  9. package/dist/cli/display/plan.d.ts +11 -0
  10. package/dist/cli/display/plan.d.ts.map +1 -0
  11. package/dist/cli/display/plan.js +42 -0
  12. package/dist/cli/display/progress.d.ts +11 -0
  13. package/dist/cli/display/progress.d.ts.map +1 -0
  14. package/dist/cli/display/progress.js +47 -0
  15. package/dist/cli/display/task.d.ts +18 -0
  16. package/dist/cli/display/task.d.ts.map +1 -0
  17. package/dist/cli/display/task.js +250 -0
  18. package/dist/commands/config.d.ts +3 -0
  19. package/dist/commands/config.d.ts.map +1 -0
  20. package/dist/commands/config.js +61 -0
  21. package/dist/commands/init.d.ts +4 -0
  22. package/dist/commands/init.d.ts.map +1 -0
  23. package/dist/commands/init.js +197 -0
  24. package/dist/commands/prd.d.ts +4 -0
  25. package/dist/commands/prd.d.ts.map +1 -0
  26. package/dist/commands/prd.js +131 -0
  27. package/dist/commands/prompt.d.ts +3 -0
  28. package/dist/commands/prompt.d.ts.map +1 -0
  29. package/dist/commands/prompt.js +192 -0
  30. package/dist/commands/tasks.d.ts +3 -0
  31. package/dist/commands/tasks.d.ts.map +1 -0
  32. package/dist/commands/tasks.js +599 -0
  33. package/dist/index.d.ts +18 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +67 -0
  36. package/dist/lib/ai-service/ai-operations.d.ts +31 -0
  37. package/dist/lib/ai-service/ai-operations.d.ts.map +1 -0
  38. package/dist/lib/ai-service/ai-operations.js +648 -0
  39. package/dist/lib/ai-service/json-parser.d.ts +9 -0
  40. package/dist/lib/ai-service/json-parser.d.ts.map +1 -0
  41. package/dist/lib/ai-service/json-parser.js +37 -0
  42. package/dist/lib/ai-service/mcp-client.d.ts +9 -0
  43. package/dist/lib/ai-service/mcp-client.d.ts.map +1 -0
  44. package/dist/lib/ai-service/mcp-client.js +48 -0
  45. package/dist/lib/ai-service/model-provider.d.ts +8 -0
  46. package/dist/lib/ai-service/model-provider.d.ts.map +1 -0
  47. package/dist/lib/ai-service/model-provider.js +71 -0
  48. package/dist/lib/ai-service/research-tools.d.ts +4 -0
  49. package/dist/lib/ai-service/research-tools.d.ts.map +1 -0
  50. package/dist/lib/ai-service/research-tools.js +8 -0
  51. package/dist/lib/ai-service/retry-handler.d.ts +8 -0
  52. package/dist/lib/ai-service/retry-handler.d.ts.map +1 -0
  53. package/dist/lib/ai-service/retry-handler.js +62 -0
  54. package/dist/lib/better-t-stack-cli.d.ts +35 -0
  55. package/dist/lib/better-t-stack-cli.d.ts.map +1 -0
  56. package/dist/lib/better-t-stack-cli.js +118 -0
  57. package/dist/lib/config.d.ts +24 -0
  58. package/dist/lib/config.d.ts.map +1 -0
  59. package/dist/lib/config.js +160 -0
  60. package/dist/lib/context-builder.d.ts +53 -0
  61. package/dist/lib/context-builder.d.ts.map +1 -0
  62. package/dist/lib/context-builder.js +294 -0
  63. package/dist/lib/executors/executor-factory.d.ts +5 -0
  64. package/dist/lib/executors/executor-factory.d.ts.map +1 -0
  65. package/dist/lib/executors/executor-factory.js +21 -0
  66. package/dist/lib/executors/opencode-executor.d.ts +6 -0
  67. package/dist/lib/executors/opencode-executor.d.ts.map +1 -0
  68. package/dist/lib/executors/opencode-executor.js +46 -0
  69. package/dist/lib/index.d.ts +89 -0
  70. package/dist/lib/index.d.ts.map +1 -0
  71. package/dist/lib/index.js +134 -0
  72. package/dist/lib/prompt-builder.d.ts +50 -0
  73. package/dist/lib/prompt-builder.d.ts.map +1 -0
  74. package/dist/lib/prompt-builder.js +171 -0
  75. package/dist/lib/prompt-registry.d.ts +22 -0
  76. package/dist/lib/prompt-registry.d.ts.map +1 -0
  77. package/dist/lib/prompt-registry.js +201 -0
  78. package/dist/lib/storage.d.ts +60 -0
  79. package/dist/lib/storage.d.ts.map +1 -0
  80. package/dist/lib/storage.js +768 -0
  81. package/dist/lib/task-execution.d.ts +3 -0
  82. package/dist/lib/task-execution.d.ts.map +1 -0
  83. package/dist/lib/task-execution.js +130 -0
  84. package/dist/lib/validation.d.ts +4 -0
  85. package/dist/lib/validation.d.ts.map +1 -0
  86. package/dist/lib/validation.js +52 -0
  87. package/dist/mcp/prompts.d.ts +3 -0
  88. package/dist/mcp/prompts.d.ts.map +1 -0
  89. package/dist/mcp/prompts.js +7 -0
  90. package/dist/mcp/resources.d.ts +3 -0
  91. package/dist/mcp/resources.d.ts.map +1 -0
  92. package/dist/mcp/resources.js +7 -0
  93. package/dist/mcp/server.d.ts +3 -0
  94. package/dist/mcp/server.d.ts.map +1 -0
  95. package/dist/mcp/server.js +25 -0
  96. package/dist/mcp/tools.d.ts +3 -0
  97. package/dist/mcp/tools.d.ts.map +1 -0
  98. package/dist/mcp/tools.js +99 -0
  99. package/dist/prompts/documentation-detection.d.ts +2 -0
  100. package/dist/prompts/documentation-detection.d.ts.map +1 -0
  101. package/dist/prompts/documentation-detection.js +24 -0
  102. package/dist/prompts/index.d.ts +7 -0
  103. package/dist/prompts/index.d.ts.map +1 -0
  104. package/dist/prompts/index.js +22 -0
  105. package/dist/prompts/prd-parsing.d.ts +3 -0
  106. package/dist/prompts/prd-parsing.d.ts.map +1 -0
  107. package/dist/prompts/prd-parsing.js +172 -0
  108. package/dist/prompts/prd-rework.d.ts +3 -0
  109. package/dist/prompts/prd-rework.d.ts.map +1 -0
  110. package/dist/prompts/prd-rework.js +81 -0
  111. package/dist/prompts/task-breakdown.d.ts +3 -0
  112. package/dist/prompts/task-breakdown.d.ts.map +1 -0
  113. package/dist/prompts/task-breakdown.js +151 -0
  114. package/dist/prompts/task-enhancement.d.ts +3 -0
  115. package/dist/prompts/task-enhancement.d.ts.map +1 -0
  116. package/dist/prompts/task-enhancement.js +140 -0
  117. package/dist/prompts/task-planning.d.ts +3 -0
  118. package/dist/prompts/task-planning.d.ts.map +1 -0
  119. package/dist/prompts/task-planning.js +66 -0
  120. package/dist/services/prd.d.ts +32 -0
  121. package/dist/services/prd.d.ts.map +1 -0
  122. package/dist/services/prd.js +191 -0
  123. package/dist/services/tasks.d.ts +67 -0
  124. package/dist/services/tasks.d.ts.map +1 -0
  125. package/dist/services/tasks.js +596 -0
  126. package/dist/test/commands.test.d.ts +2 -0
  127. package/dist/test/commands.test.d.ts.map +1 -0
  128. package/dist/test/commands.test.js +74 -0
  129. package/dist/test/storage.test.d.ts +2 -0
  130. package/dist/test/storage.test.d.ts.map +1 -0
  131. package/dist/test/storage.test.js +207 -0
  132. package/dist/types/callbacks.d.ts +27 -0
  133. package/dist/types/callbacks.d.ts.map +1 -0
  134. package/dist/types/callbacks.js +2 -0
  135. package/dist/types/index.d.ts +252 -0
  136. package/dist/types/index.d.ts.map +1 -0
  137. package/dist/types/index.js +2 -0
  138. package/dist/types/mcp.d.ts +3 -0
  139. package/dist/types/mcp.d.ts.map +1 -0
  140. package/dist/types/mcp.js +3 -0
  141. package/dist/types/options.d.ts +94 -0
  142. package/dist/types/options.d.ts.map +1 -0
  143. package/dist/types/options.js +2 -0
  144. package/dist/types/results.d.ts +90 -0
  145. package/dist/types/results.d.ts.map +1 -0
  146. package/dist/types/results.js +2 -0
  147. package/dist/utils/ai-config-builder.d.ts +14 -0
  148. package/dist/utils/ai-config-builder.d.ts.map +1 -0
  149. package/dist/utils/ai-config-builder.js +22 -0
  150. package/dist/utils/ai-service-factory.d.ts +10 -0
  151. package/dist/utils/ai-service-factory.d.ts.map +1 -0
  152. package/dist/utils/ai-service-factory.js +52 -0
  153. package/dist/utils/stack-formatter.d.ts +11 -0
  154. package/dist/utils/stack-formatter.d.ts.map +1 -0
  155. package/dist/utils/stack-formatter.js +30 -0
  156. package/dist/utils/streaming-options.d.ts +10 -0
  157. package/dist/utils/streaming-options.d.ts.map +1 -0
  158. package/dist/utils/streaming-options.js +53 -0
  159. package/package.json +82 -0
@@ -0,0 +1,53 @@
1
+ import { TaskContext, TaskDocumentation } from "../types";
2
+ export declare class ContextBuilder {
3
+ private storage;
4
+ private taskOMatic;
5
+ private initialized;
6
+ constructor();
7
+ private ensureInitialized;
8
+ /**
9
+ * Build comprehensive context for AI operations
10
+ */
11
+ buildContext(taskId: string): Promise<TaskContext>;
12
+ /**
13
+ * Build context for new tasks (without requiring existing task)
14
+ */
15
+ buildContextForNewTask(title: string, description?: string, prdFile?: string): Promise<TaskContext>;
16
+ /**
17
+ * Get stack configuration from project (set by bootstrap)
18
+ */
19
+ private getStackConfig;
20
+ /**
21
+ * Get task documentation references
22
+ */
23
+ private getTaskDocumentation;
24
+ /**
25
+ * Get full task content from MD file
26
+ */
27
+ private getTaskFullContent;
28
+ /**
29
+ * Read documentation file content
30
+ */
31
+ private readDocumentationFile;
32
+ /**
33
+ * Check if documentation is fresh (less than 7 days old)
34
+ */
35
+ isDocumentationFresh(documentation: TaskDocumentation): boolean;
36
+ /**
37
+ * Check if documentation is stale (more than 30 days old)
38
+ */
39
+ isDocumentationStale(documentation: TaskDocumentation): boolean;
40
+ /**
41
+ * Get PRD content from file path
42
+ */
43
+ private getPRDContent;
44
+ /**
45
+ * Get relevant PRD content based on task title/description
46
+ */
47
+ private getRelevantPRDContent;
48
+ /**
49
+ * Format context for AI prompts
50
+ */
51
+ formatContextForAI(context: TaskContext): string;
52
+ }
53
+ //# sourceMappingURL=context-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-builder.d.ts","sourceRoot":"","sources":["../../src/lib/context-builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,WAAW,EAAa,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAI3E,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,WAAW,CAAS;;IAM5B,OAAO,CAAC,iBAAiB;IAUzB;;OAEG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IA0CxD;;OAEG;IACG,sBAAsB,CAC1B,KAAK,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,WAAW,CAAC;IAsBvB;;OAEG;IACH,OAAO,CAAC,cAAc;IA6CtB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAI5B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAmB1B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAgB7B;;OAEG;IACH,oBAAoB,CAAC,aAAa,EAAE,iBAAiB,GAAG,OAAO;IAK/D;;OAEG;IACH,oBAAoB,CAAC,aAAa,EAAE,iBAAiB,GAAG,OAAO;IAK/D;;OAEG;IACH,OAAO,CAAC,aAAa;IAqBrB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA0C7B;;OAEG;IACH,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM;CAmDjD"}
@@ -0,0 +1,294 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContextBuilder = void 0;
4
+ const fs_1 = require("fs");
5
+ const path_1 = require("path");
6
+ const storage_1 = require("./storage");
7
+ const config_1 = require("./config");
8
+ class ContextBuilder {
9
+ storage = null;
10
+ taskOMatic = null;
11
+ initialized = false;
12
+ constructor() {
13
+ // Pure constructor - NO side effects
14
+ }
15
+ ensureInitialized() {
16
+ if (this.initialized) {
17
+ return;
18
+ }
19
+ this.storage = new storage_1.LocalStorage();
20
+ this.taskOMatic = config_1.configManager.getTaskOMaticDir();
21
+ this.initialized = true;
22
+ }
23
+ /**
24
+ * Build comprehensive context for AI operations
25
+ */
26
+ async buildContext(taskId) {
27
+ this.ensureInitialized();
28
+ if (!this.storage) {
29
+ throw new Error("ContextBuilder not initialized");
30
+ }
31
+ const task = await this.storage.getTask(taskId);
32
+ if (!task) {
33
+ throw new Error(`Task with ID ${taskId} not found`);
34
+ }
35
+ const stack = this.getStackConfig();
36
+ const documentation = this.getTaskDocumentation(task);
37
+ const fullContent = this.getTaskFullContent(task);
38
+ const prdContent = task.prdFile
39
+ ? this.getPRDContent(task.prdFile)
40
+ : undefined;
41
+ return {
42
+ task: {
43
+ id: task.id,
44
+ title: task.title,
45
+ description: task.description ?? "",
46
+ fullContent,
47
+ },
48
+ stack,
49
+ documentation: documentation
50
+ ? {
51
+ recap: documentation.recap,
52
+ files: documentation.files.map((file) => ({
53
+ path: file,
54
+ // WOW, this is MORONIC ! you do not give 1K lines doc like that you MORON !
55
+ // content: this.readDocumentationFile(file),
56
+ })),
57
+ }
58
+ : undefined,
59
+ existingContent: documentation?.recap,
60
+ prdContent,
61
+ existingResearch: documentation?.research || {},
62
+ };
63
+ }
64
+ /**
65
+ * Build context for new tasks (without requiring existing task)
66
+ */
67
+ async buildContextForNewTask(title, description, prdFile) {
68
+ this.ensureInitialized();
69
+ const stack = this.getStackConfig();
70
+ const prdContent = prdFile
71
+ ? this.getPRDContent(prdFile)
72
+ : this.getRelevantPRDContent(title, description);
73
+ return {
74
+ task: {
75
+ id: "new-task",
76
+ title,
77
+ description: description ?? "",
78
+ fullContent: undefined,
79
+ },
80
+ stack,
81
+ documentation: undefined, // New tasks don't have documentation yet
82
+ existingContent: undefined,
83
+ prdContent,
84
+ };
85
+ }
86
+ /**
87
+ * Get stack configuration from project (set by bootstrap)
88
+ */
89
+ getStackConfig() {
90
+ if (!this.taskOMatic) {
91
+ return undefined;
92
+ }
93
+ // Return sensible defaults for Better-T-Stack
94
+ const fallbackConfig = {
95
+ projectName: "default",
96
+ frontend: "next",
97
+ backend: "convex",
98
+ database: "none", // Convex has its own database
99
+ auth: "better-auth",
100
+ runtime: "none",
101
+ api: "none",
102
+ payments: "none",
103
+ orm: "none", // Convex doesn't use ORM
104
+ dbSetup: "none",
105
+ packageManager: "npm",
106
+ git: true,
107
+ webDeploy: "none",
108
+ serverDeploy: "none",
109
+ install: true,
110
+ addons: ["turborepo"],
111
+ examples: [],
112
+ };
113
+ try {
114
+ const stackFile = (0, path_1.join)(this.taskOMatic, "stack.json");
115
+ if ((0, fs_1.existsSync)(stackFile)) {
116
+ const content = (0, fs_1.readFileSync)(stackFile, "utf-8");
117
+ const config = JSON.parse(content);
118
+ config._source = "file"; // Track source
119
+ return config;
120
+ }
121
+ fallbackConfig._source = "fallback"; // Track source
122
+ return fallbackConfig;
123
+ }
124
+ catch (error) {
125
+ console.warn("Failed to load stack configuration, using defaults:", error);
126
+ fallbackConfig._source = "fallback"; // Track source
127
+ return fallbackConfig;
128
+ }
129
+ }
130
+ /**
131
+ * Get task documentation references
132
+ */
133
+ getTaskDocumentation(task) {
134
+ return task.documentation;
135
+ }
136
+ /**
137
+ * Get full task content from MD file
138
+ */
139
+ getTaskFullContent(task) {
140
+ if (!task.contentFile || !this.taskOMatic) {
141
+ return undefined;
142
+ }
143
+ try {
144
+ const contentPath = (0, path_1.join)(this.taskOMatic, task.contentFile);
145
+ if ((0, fs_1.existsSync)(contentPath)) {
146
+ return (0, fs_1.readFileSync)(contentPath, "utf-8");
147
+ }
148
+ }
149
+ catch (error) {
150
+ console.warn(`Failed to read task content file ${task.contentFile}:`, error);
151
+ }
152
+ return undefined;
153
+ }
154
+ /**
155
+ * Read documentation file content
156
+ */
157
+ readDocumentationFile(filePath) {
158
+ if (!this.taskOMatic) {
159
+ return `# ContextBuilder Not Initialized\n\nFile: ${filePath}\n\nContextBuilder has not been properly initialized.`;
160
+ }
161
+ try {
162
+ const fullPath = (0, path_1.join)(this.taskOMatic, filePath);
163
+ if ((0, fs_1.existsSync)(fullPath)) {
164
+ return (0, fs_1.readFileSync)(fullPath, "utf-8");
165
+ }
166
+ return `# Documentation File Not Found\n\nFile: ${filePath}\n\nThis documentation file could not be found on disk.`;
167
+ }
168
+ catch (error) {
169
+ return `# Error Reading Documentation\n\nFile: ${filePath}\n\nError: ${error instanceof Error ? error.message : "Unknown error"}`;
170
+ }
171
+ }
172
+ /**
173
+ * Check if documentation is fresh (less than 7 days old)
174
+ */
175
+ isDocumentationFresh(documentation) {
176
+ const sevenDaysAgo = Date.now() - 7 * 24 * 60 * 60 * 1000;
177
+ return documentation.lastFetched > sevenDaysAgo;
178
+ }
179
+ /**
180
+ * Check if documentation is stale (more than 30 days old)
181
+ */
182
+ isDocumentationStale(documentation) {
183
+ const thirtyDaysAgo = Date.now() - 30 * 24 * 60 * 60 * 1000;
184
+ return documentation.lastFetched < thirtyDaysAgo;
185
+ }
186
+ /**
187
+ * Get PRD content from file path
188
+ */
189
+ getPRDContent(prdFile) {
190
+ if (!this.taskOMatic) {
191
+ return undefined;
192
+ }
193
+ try {
194
+ // Handle relative paths from .task-o-matic directory
195
+ const fullPath = prdFile.startsWith("/")
196
+ ? prdFile
197
+ : (0, path_1.join)(this.taskOMatic, prdFile);
198
+ if ((0, fs_1.existsSync)(fullPath)) {
199
+ return (0, fs_1.readFileSync)(fullPath, "utf-8");
200
+ }
201
+ return undefined;
202
+ }
203
+ catch (error) {
204
+ console.warn(`Failed to read PRD file ${prdFile}:`, error);
205
+ return undefined;
206
+ }
207
+ }
208
+ /**
209
+ * Get relevant PRD content based on task title/description
210
+ */
211
+ getRelevantPRDContent(taskTitle, taskDescription) {
212
+ if (!this.taskOMatic)
213
+ return undefined;
214
+ // Look for PRD files in known locations
215
+ const prdPaths = [
216
+ (0, path_1.join)(this.taskOMatic, "prd"),
217
+ (0, path_1.join)(this.taskOMatic, "..", "docs"),
218
+ (0, path_1.join)(process.cwd(), ".task-o-matic", "prd"),
219
+ (0, path_1.join)(process.cwd(), "prd"),
220
+ (0, path_1.join)(process.cwd(), "docs"),
221
+ ];
222
+ for (const prdPath of prdPaths) {
223
+ if ((0, fs_1.existsSync)(prdPath)) {
224
+ try {
225
+ // Look for ANY text files in PRD directory
226
+ const prdFiles = (0, fs_1.readdirSync)(prdPath).filter((f) => f.endsWith(".md") || f.endsWith(".txt"));
227
+ if (prdFiles.length > 0) {
228
+ // Get the MOST RECENT PRD file by modification time
229
+ const prdFilesWithStats = prdFiles.map((file) => ({
230
+ file,
231
+ path: (0, path_1.join)(prdPath, file),
232
+ mtime: (0, fs_1.statSync)((0, path_1.join)(prdPath, file)).mtime.getTime(),
233
+ }));
234
+ prdFilesWithStats.sort((a, b) => b.mtime - a.mtime); // Sort by newest first
235
+ const mostRecentPrd = prdFilesWithStats[0];
236
+ return (0, fs_1.readFileSync)(mostRecentPrd.path, "utf-8");
237
+ }
238
+ }
239
+ catch (error) {
240
+ console.warn(`Failed to read PRD directory ${prdPath}:`, error);
241
+ }
242
+ }
243
+ }
244
+ return undefined;
245
+ }
246
+ /**
247
+ * Format context for AI prompts
248
+ */
249
+ formatContextForAI(context) {
250
+ let formatted = `# Task Context\n\n`;
251
+ formatted += `## Task Information\n`;
252
+ formatted += `- **ID**: ${context.task.id}\n`;
253
+ formatted += `- **Title**: ${context.task.title}\n`;
254
+ formatted += `- **Description**: ${context.task.description}\n`;
255
+ if (context.task.fullContent) {
256
+ formatted += `- **Full Content**:\n${context.task.fullContent}\n\n`;
257
+ }
258
+ if (context.prdContent) {
259
+ formatted += `## Product Requirements Document\n`;
260
+ formatted += `${context.prdContent}\n\n`;
261
+ }
262
+ if (context.stack) {
263
+ formatted += `## Technology Stack\n`;
264
+ formatted += `- **Project**: ${context.stack.projectName}\n`;
265
+ formatted += `- **Frontend**: ${context.stack.frontend}\n`;
266
+ formatted += `- **Backend**: ${context.stack.backend}\n`;
267
+ if (context.stack.database !== "none") {
268
+ formatted += `- **Database**: ${context.stack.database}\n`;
269
+ }
270
+ if (context.stack.orm !== "none") {
271
+ formatted += `- **ORM**: ${context.stack.orm}\n`;
272
+ }
273
+ formatted += `- **Auth**: ${context.stack.auth}\n`;
274
+ if (context.stack.addons.length > 0) {
275
+ formatted += `- **Addons**: ${context.stack.addons.join(", ")}\n`;
276
+ }
277
+ formatted += `- **Package Manager**: ${context.stack.packageManager}\n`;
278
+ formatted += `\n`;
279
+ }
280
+ if (context.documentation) {
281
+ formatted += `## Available Documentation\n`;
282
+ formatted += `**Recap**: ${context.documentation.recap}\n\n`;
283
+ if (context.documentation.files.length > 0) {
284
+ formatted += `### Documentation Files\n\n`;
285
+ context.documentation.files.forEach((file, index) => {
286
+ formatted += `#### ${index + 1}. ${file.path}\n`;
287
+ // formatted += `${file.content}\n\n`;
288
+ });
289
+ }
290
+ }
291
+ return formatted;
292
+ }
293
+ }
294
+ exports.ContextBuilder = ContextBuilder;
@@ -0,0 +1,5 @@
1
+ import { ExternalExecutor, ExecutorTool } from "../../types";
2
+ export declare class ExecutorFactory {
3
+ static create(tool?: ExecutorTool): ExternalExecutor;
4
+ }
5
+ //# sourceMappingURL=executor-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor-factory.d.ts","sourceRoot":"","sources":["../../../src/lib/executors/executor-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG7D,qBAAa,eAAe;IAC1B,MAAM,CAAC,MAAM,CAAC,IAAI,GAAE,YAAyB,GAAG,gBAAgB;CAcjE"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExecutorFactory = void 0;
4
+ const opencode_executor_1 = require("./opencode-executor");
5
+ class ExecutorFactory {
6
+ static create(tool = "opencode") {
7
+ switch (tool) {
8
+ case "opencode":
9
+ return new opencode_executor_1.OpencodeExecutor();
10
+ case "claude":
11
+ throw new Error("Claude executor not implemented yet");
12
+ case "gemini":
13
+ throw new Error("Gemini executor not implemented yet");
14
+ case "codex":
15
+ throw new Error("Codex executor not implemented yet");
16
+ default:
17
+ throw new Error(`Unknown executor tool: ${tool}`);
18
+ }
19
+ }
20
+ }
21
+ exports.ExecutorFactory = ExecutorFactory;
@@ -0,0 +1,6 @@
1
+ import { ExternalExecutor } from "../../types";
2
+ export declare class OpencodeExecutor implements ExternalExecutor {
3
+ name: string;
4
+ execute(message: string, dry?: boolean): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=opencode-executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencode-executor.d.ts","sourceRoot":"","sources":["../../../src/lib/executors/opencode-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAmB,MAAM,aAAa,CAAC;AAIhE,qBAAa,gBAAiB,YAAW,gBAAgB;IACvD,IAAI,SAAc;IAEZ,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAsCpE"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.OpencodeExecutor = void 0;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const child_process_1 = require("child_process");
9
+ class OpencodeExecutor {
10
+ name = "opencode";
11
+ async execute(message, dry = false) {
12
+ const command = `opencode run "${message}"`;
13
+ if (dry) {
14
+ console.log(chalk_1.default.cyan(command));
15
+ return;
16
+ }
17
+ console.log(`🚀 Launching opencode with message: ${message}`);
18
+ // Launch opencode and wait for it to complete
19
+ const child = (0, child_process_1.spawn)("opencode", ["-p", message], {
20
+ stdio: "inherit", // Give tool full terminal control
21
+ });
22
+ // run opencode and wait for it to complete
23
+ // const child = spawn("opencode", ["run", message], {
24
+ // stdio: "inherit", // Give tool full terminal control
25
+ // });
26
+ // Wait for completion (blocking)
27
+ await new Promise((resolve, reject) => {
28
+ child.on("close", (code) => {
29
+ if (code === 0) {
30
+ console.log("✅ Opencode execution completed successfully");
31
+ resolve();
32
+ }
33
+ else {
34
+ const error = new Error(`Opencode exited with code ${code}`);
35
+ console.error(`❌ ${error.message}`);
36
+ reject(error);
37
+ }
38
+ });
39
+ child.on("error", (error) => {
40
+ console.error(`❌ Failed to launch opencode: ${error.message}`);
41
+ reject(error);
42
+ });
43
+ });
44
+ }
45
+ }
46
+ exports.OpencodeExecutor = OpencodeExecutor;
@@ -0,0 +1,89 @@
1
+ /**
2
+ * task-o-matic Library Entry Point
3
+ *
4
+ * This module exports the core services, types, and utilities for using
5
+ * task-o-matic as a library in TUI, web applications, or other Node.js projects.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { TaskService, Task, AIConfig } from 'task-o-matic';
10
+ *
11
+ * const taskService = new TaskService();
12
+ * const result = await taskService.createTask({
13
+ * title: 'My Task',
14
+ * content: 'Task description',
15
+ * aiEnhance: true
16
+ * });
17
+ * ```
18
+ */
19
+ /**
20
+ * TaskService - Core task management operations
21
+ * Handles creating, updating, listing, enhancing, splitting, and planning tasks
22
+ */
23
+ export { TaskService } from '../services/tasks';
24
+ /**
25
+ * PRDService - Product Requirements Document parsing and processing
26
+ * Handles PRD parsing, task extraction, and PRD improvement
27
+ */
28
+ export { PRDService } from '../services/prd';
29
+ /**
30
+ * Re-export all types from the types module
31
+ * Includes Task, AIConfig, StreamingOptions, and all related interfaces
32
+ */
33
+ export * from '../types';
34
+ /**
35
+ * Re-export callback types
36
+ */
37
+ export type { ProgressCallback } from '../types/callbacks';
38
+ /**
39
+ * Re-export option types
40
+ */
41
+ export type { CreateTaskOptions, SplitTaskOptions, PlanTaskOptions, EnhanceTaskOptions } from '../types/options';
42
+ /**
43
+ * Factory functions for getting singleton instances of core services
44
+ * These ensure only one instance exists throughout the application
45
+ */
46
+ export { getAIOperations, getModelProvider, getStorage, getContextBuilder, resetServiceInstances } from '../utils/ai-service-factory';
47
+ /**
48
+ * AI configuration builder utility
49
+ */
50
+ export { buildAIConfig } from '../utils/ai-config-builder';
51
+ export type { AIOptions } from '../utils/ai-config-builder';
52
+ /**
53
+ * LocalStorage - File-based storage abstraction for tasks and metadata
54
+ * Note: This is Node.js file-system based and not compatible with browser environments
55
+ */
56
+ export { LocalStorage } from './storage';
57
+ /**
58
+ * ConfigManager - Configuration management for task-o-matic projects
59
+ */
60
+ export { ConfigManager, configManager } from './config';
61
+ /**
62
+ * AIOperations - AI service operations wrapper
63
+ */
64
+ export { AIOperations } from './ai-service/ai-operations';
65
+ /**
66
+ * ModelProvider - AI model provider abstraction
67
+ */
68
+ export { ModelProvider } from './ai-service/model-provider';
69
+ /**
70
+ * ContextBuilder - Task context assembly for AI operations
71
+ */
72
+ export { ContextBuilder } from './context-builder';
73
+ /**
74
+ * PromptBuilder - Prompt template management
75
+ */
76
+ export { PromptBuilder } from './prompt-builder';
77
+ /**
78
+ * Stack formatter utility
79
+ */
80
+ export { formatStackInfo } from '../utils/stack-formatter';
81
+ /**
82
+ * Streaming options builders
83
+ */
84
+ export { createStreamingOptions, createStreamingOptionsWithCustomHandlers } from '../utils/streaming-options';
85
+ /**
86
+ * Validation utilities
87
+ */
88
+ export { isValidAIProvider, runValidations } from './validation';
89
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAM7C;;;GAGG;AACH,cAAc,UAAU,CAAC;AAEzB;;GAEG;AACH,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;GAEG;AACH,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAMjH;;;GAGG;AACH,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,6BAA6B,CAAC;AAErC;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,YAAY,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAM5D;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAExD;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D;;GAEG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAMjD;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D;;GAEG;AACH,OAAO,EAAE,sBAAsB,EAAE,wCAAwC,EAAE,MAAM,4BAA4B,CAAC;AAM9G;;GAEG;AACH,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ /**
3
+ * task-o-matic Library Entry Point
4
+ *
5
+ * This module exports the core services, types, and utilities for using
6
+ * task-o-matic as a library in TUI, web applications, or other Node.js projects.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { TaskService, Task, AIConfig } from 'task-o-matic';
11
+ *
12
+ * const taskService = new TaskService();
13
+ * const result = await taskService.createTask({
14
+ * title: 'My Task',
15
+ * content: 'Task description',
16
+ * aiEnhance: true
17
+ * });
18
+ * ```
19
+ */
20
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ var desc = Object.getOwnPropertyDescriptor(m, k);
23
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24
+ desc = { enumerable: true, get: function() { return m[k]; } };
25
+ }
26
+ Object.defineProperty(o, k2, desc);
27
+ }) : (function(o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ }));
31
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
32
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.runValidations = exports.isValidAIProvider = exports.createStreamingOptionsWithCustomHandlers = exports.createStreamingOptions = exports.formatStackInfo = exports.PromptBuilder = exports.ContextBuilder = exports.ModelProvider = exports.AIOperations = exports.configManager = exports.ConfigManager = exports.LocalStorage = exports.buildAIConfig = exports.resetServiceInstances = exports.getContextBuilder = exports.getStorage = exports.getModelProvider = exports.getAIOperations = exports.PRDService = exports.TaskService = void 0;
36
+ // ============================================================================
37
+ // Main Services - Business Logic Layer
38
+ // ============================================================================
39
+ /**
40
+ * TaskService - Core task management operations
41
+ * Handles creating, updating, listing, enhancing, splitting, and planning tasks
42
+ */
43
+ var tasks_1 = require("../services/tasks");
44
+ Object.defineProperty(exports, "TaskService", { enumerable: true, get: function () { return tasks_1.TaskService; } });
45
+ /**
46
+ * PRDService - Product Requirements Document parsing and processing
47
+ * Handles PRD parsing, task extraction, and PRD improvement
48
+ */
49
+ var prd_1 = require("../services/prd");
50
+ Object.defineProperty(exports, "PRDService", { enumerable: true, get: function () { return prd_1.PRDService; } });
51
+ // ============================================================================
52
+ // Core Types - Type Definitions
53
+ // ============================================================================
54
+ /**
55
+ * Re-export all types from the types module
56
+ * Includes Task, AIConfig, StreamingOptions, and all related interfaces
57
+ */
58
+ __exportStar(require("../types"), exports);
59
+ // ============================================================================
60
+ // Utility Factories - Singleton Service Instances
61
+ // ============================================================================
62
+ /**
63
+ * Factory functions for getting singleton instances of core services
64
+ * These ensure only one instance exists throughout the application
65
+ */
66
+ var ai_service_factory_1 = require("../utils/ai-service-factory");
67
+ Object.defineProperty(exports, "getAIOperations", { enumerable: true, get: function () { return ai_service_factory_1.getAIOperations; } });
68
+ Object.defineProperty(exports, "getModelProvider", { enumerable: true, get: function () { return ai_service_factory_1.getModelProvider; } });
69
+ Object.defineProperty(exports, "getStorage", { enumerable: true, get: function () { return ai_service_factory_1.getStorage; } });
70
+ Object.defineProperty(exports, "getContextBuilder", { enumerable: true, get: function () { return ai_service_factory_1.getContextBuilder; } });
71
+ Object.defineProperty(exports, "resetServiceInstances", { enumerable: true, get: function () { return ai_service_factory_1.resetServiceInstances; } });
72
+ /**
73
+ * AI configuration builder utility
74
+ */
75
+ var ai_config_builder_1 = require("../utils/ai-config-builder");
76
+ Object.defineProperty(exports, "buildAIConfig", { enumerable: true, get: function () { return ai_config_builder_1.buildAIConfig; } });
77
+ // ============================================================================
78
+ // Core Classes - Direct Class Exports
79
+ // ============================================================================
80
+ /**
81
+ * LocalStorage - File-based storage abstraction for tasks and metadata
82
+ * Note: This is Node.js file-system based and not compatible with browser environments
83
+ */
84
+ var storage_1 = require("./storage");
85
+ Object.defineProperty(exports, "LocalStorage", { enumerable: true, get: function () { return storage_1.LocalStorage; } });
86
+ /**
87
+ * ConfigManager - Configuration management for task-o-matic projects
88
+ */
89
+ var config_1 = require("./config");
90
+ Object.defineProperty(exports, "ConfigManager", { enumerable: true, get: function () { return config_1.ConfigManager; } });
91
+ Object.defineProperty(exports, "configManager", { enumerable: true, get: function () { return config_1.configManager; } });
92
+ /**
93
+ * AIOperations - AI service operations wrapper
94
+ */
95
+ var ai_operations_1 = require("./ai-service/ai-operations");
96
+ Object.defineProperty(exports, "AIOperations", { enumerable: true, get: function () { return ai_operations_1.AIOperations; } });
97
+ /**
98
+ * ModelProvider - AI model provider abstraction
99
+ */
100
+ var model_provider_1 = require("./ai-service/model-provider");
101
+ Object.defineProperty(exports, "ModelProvider", { enumerable: true, get: function () { return model_provider_1.ModelProvider; } });
102
+ /**
103
+ * ContextBuilder - Task context assembly for AI operations
104
+ */
105
+ var context_builder_1 = require("./context-builder");
106
+ Object.defineProperty(exports, "ContextBuilder", { enumerable: true, get: function () { return context_builder_1.ContextBuilder; } });
107
+ /**
108
+ * PromptBuilder - Prompt template management
109
+ */
110
+ var prompt_builder_1 = require("./prompt-builder");
111
+ Object.defineProperty(exports, "PromptBuilder", { enumerable: true, get: function () { return prompt_builder_1.PromptBuilder; } });
112
+ // ============================================================================
113
+ // Utilities
114
+ // ============================================================================
115
+ /**
116
+ * Stack formatter utility
117
+ */
118
+ var stack_formatter_1 = require("../utils/stack-formatter");
119
+ Object.defineProperty(exports, "formatStackInfo", { enumerable: true, get: function () { return stack_formatter_1.formatStackInfo; } });
120
+ /**
121
+ * Streaming options builders
122
+ */
123
+ var streaming_options_1 = require("../utils/streaming-options");
124
+ Object.defineProperty(exports, "createStreamingOptions", { enumerable: true, get: function () { return streaming_options_1.createStreamingOptions; } });
125
+ Object.defineProperty(exports, "createStreamingOptionsWithCustomHandlers", { enumerable: true, get: function () { return streaming_options_1.createStreamingOptionsWithCustomHandlers; } });
126
+ // ============================================================================
127
+ // Validation
128
+ // ============================================================================
129
+ /**
130
+ * Validation utilities
131
+ */
132
+ var validation_1 = require("./validation");
133
+ Object.defineProperty(exports, "isValidAIProvider", { enumerable: true, get: function () { return validation_1.isValidAIProvider; } });
134
+ Object.defineProperty(exports, "runValidations", { enumerable: true, get: function () { return validation_1.runValidations; } });