task-o-matic-core 0.1.1-beta.7 → 0.1.1-beta.9

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 (115) hide show
  1. package/package.json +6 -1
  2. package/src/index.ts +0 -36
  3. package/src/lib/ai-service/ai-operations.ts +0 -310
  4. package/src/lib/ai-service/base-operations.ts +0 -139
  5. package/src/lib/ai-service/documentation-operations.ts +0 -438
  6. package/src/lib/ai-service/filesystem-tools.ts +0 -73
  7. package/src/lib/ai-service/gemini-proxy.ts.bak +0 -52
  8. package/src/lib/ai-service/json-parser.ts +0 -203
  9. package/src/lib/ai-service/mcp-client.ts +0 -54
  10. package/src/lib/ai-service/model-provider.ts +0 -192
  11. package/src/lib/ai-service/prd-operations.ts +0 -854
  12. package/src/lib/ai-service/research-tools.ts +0 -207
  13. package/src/lib/ai-service/retry-handler.ts +0 -89
  14. package/src/lib/ai-service/task-operations.ts +0 -342
  15. package/src/lib/benchmark/registry.ts +0 -307
  16. package/src/lib/benchmark/runner.ts +0 -190
  17. package/src/lib/benchmark/storage.ts +0 -140
  18. package/src/lib/benchmark/types.ts +0 -121
  19. package/src/lib/better-t-stack-cli.ts +0 -526
  20. package/src/lib/bootstrap/cli-bootstrap.ts +0 -397
  21. package/src/lib/bootstrap/index.ts +0 -2
  22. package/src/lib/bootstrap/medusa-bootstrap.ts +0 -261
  23. package/src/lib/config-validation.ts +0 -278
  24. package/src/lib/config.ts +0 -435
  25. package/src/lib/context-builder.ts +0 -383
  26. package/src/lib/executors/claude-code-executor.ts +0 -83
  27. package/src/lib/executors/codex-executor.ts +0 -85
  28. package/src/lib/executors/executor-factory.ts +0 -28
  29. package/src/lib/executors/gemini-executor.ts +0 -80
  30. package/src/lib/executors/kilo-executor.ts +0 -83
  31. package/src/lib/executors/opencode-executor.ts +0 -81
  32. package/src/lib/git-utils.ts +0 -334
  33. package/src/lib/hooks.ts +0 -121
  34. package/src/lib/index.ts +0 -166
  35. package/src/lib/logger.ts +0 -43
  36. package/src/lib/notifications.ts +0 -103
  37. package/src/lib/prompt-builder.ts +0 -471
  38. package/src/lib/prompt-registry.ts +0 -491
  39. package/src/lib/provider-defaults.json +0 -32
  40. package/src/lib/storage/file-system.ts +0 -864
  41. package/src/lib/storage/storage-callbacks.ts +0 -120
  42. package/src/lib/storage/types.ts +0 -58
  43. package/src/lib/task-execution-core.ts +0 -591
  44. package/src/lib/task-execution.ts +0 -59
  45. package/src/lib/task-loop-execution.ts +0 -214
  46. package/src/lib/task-planning.ts +0 -157
  47. package/src/lib/task-review.ts +0 -138
  48. package/src/lib/validation.ts +0 -140
  49. package/src/prompts/documentation-detection.ts +0 -21
  50. package/src/prompts/documentation-recap.ts +0 -11
  51. package/src/prompts/index.ts +0 -14
  52. package/src/prompts/prd-combination.ts +0 -32
  53. package/src/prompts/prd-generation.ts +0 -46
  54. package/src/prompts/prd-parsing.ts +0 -170
  55. package/src/prompts/prd-question-answer.ts +0 -25
  56. package/src/prompts/prd-question.ts +0 -38
  57. package/src/prompts/prd-rework.ts +0 -79
  58. package/src/prompts/prd-suggest-stack.ts +0 -97
  59. package/src/prompts/task-breakdown.ts +0 -149
  60. package/src/prompts/task-enhancement.ts +0 -138
  61. package/src/prompts/task-execution.ts +0 -22
  62. package/src/prompts/task-planning.ts +0 -64
  63. package/src/prompts/workflow-assistance.ts +0 -151
  64. package/src/prompts/workflow-prompts.ts +0 -97
  65. package/src/services/benchmark.ts +0 -433
  66. package/src/services/prd.ts +0 -845
  67. package/src/services/tasks.ts +0 -1515
  68. package/src/services/workflow-ai-assistant.ts +0 -298
  69. package/src/services/workflow-benchmark.ts +0 -339
  70. package/src/services/workflow.ts +0 -779
  71. package/src/test/hooks.test.ts +0 -77
  72. package/src/test/integration/callbacks.test.ts +0 -39
  73. package/src/test/lib/ai-service/task-operations.test.ts +0 -430
  74. package/src/test/lib/config.test.ts +0 -150
  75. package/src/test/lib/git-utils.test.ts +0 -198
  76. package/src/test/mocks/mock-ai-operations.ts +0 -205
  77. package/src/test/mocks/mock-context-builder.ts +0 -84
  78. package/src/test/mocks/mock-model-provider.ts +0 -21
  79. package/src/test/mocks/mock-service-factory.ts +0 -64
  80. package/src/test/mocks/mock-storage.ts +0 -204
  81. package/src/test/model-parsing.test.ts +0 -78
  82. package/src/test/services/task-service.test.ts +0 -551
  83. package/src/test/storage.test.ts +0 -206
  84. package/src/test/task-loop-git.test.ts +0 -142
  85. package/src/test/test-mock-setup.ts +0 -46
  86. package/src/test/test-setup.ts +0 -48
  87. package/src/test/test-utils.ts +0 -45
  88. package/src/test/utils/ai-operation-utility.test.ts +0 -306
  89. package/src/test/utils/error-handling.test.ts +0 -241
  90. package/src/test/utils/file-utils.test.ts +0 -80
  91. package/src/test/utils/id-generator.test.ts +0 -44
  92. package/src/test/utils/model-parser.test.ts +0 -67
  93. package/src/test/validation.test.ts +0 -19
  94. package/src/types/callbacks.ts +0 -14
  95. package/src/types/index.ts +0 -628
  96. package/src/types/mcp.ts +0 -5
  97. package/src/types/options.ts +0 -165
  98. package/src/types/results.ts +0 -216
  99. package/src/types/workflow-options.ts +0 -118
  100. package/src/types/workflow-results.ts +0 -87
  101. package/src/utils/ai-config-builder.ts +0 -33
  102. package/src/utils/ai-operation-utility.ts +0 -380
  103. package/src/utils/ai-service-factory.ts +0 -125
  104. package/src/utils/error-utils.ts +0 -124
  105. package/src/utils/file-utils.ts +0 -197
  106. package/src/utils/id-generator.ts +0 -168
  107. package/src/utils/metadata-utils.ts +0 -48
  108. package/src/utils/model-executor-parser.ts +0 -80
  109. package/src/utils/model-parser.ts +0 -58
  110. package/src/utils/stack-formatter.ts +0 -53
  111. package/src/utils/storage-utils.ts +0 -94
  112. package/src/utils/streaming-utils.ts +0 -91
  113. package/src/utils/task-o-matic-error.ts +0 -393
  114. package/tsconfig.json +0 -20
  115. package/tsconfig.tsbuildinfo +0 -1
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "task-o-matic-core",
3
- "version": "0.1.1-beta.7",
3
+ "version": "0.1.1-beta.9",
4
4
  "description": "Core logic for Task-O-Matic",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "README.md",
10
+ "LICENSE"
11
+ ],
7
12
  "exports": {
8
13
  ".": {
9
14
  "types": "./dist/index.d.ts",
package/src/index.ts DELETED
@@ -1,36 +0,0 @@
1
- export * from "./types";
2
- export * from "./lib/config";
3
- export * from "./lib/logger";
4
- export * from "./lib/better-t-stack-cli";
5
- export * from "./lib/validation";
6
- export * from "./lib/context-builder";
7
- export * from "./lib/ai-service/ai-operations";
8
- export * from "./lib/ai-service/task-operations";
9
- export * from "./lib/ai-service/prd-operations";
10
- export * from "./lib/ai-service/documentation-operations";
11
- export * from "./lib/executors/executor-factory";
12
- export * from "./lib/prompt-builder";
13
- export * from "./lib/task-execution";
14
- export * from "./lib/task-loop-execution";
15
-
16
- export * from "./services/tasks";
17
- export * from "./services/workflow";
18
- export * from "./services/prd";
19
- export * from "./services/benchmark";
20
- export * from "./lib/benchmark/registry";
21
- export * from "./lib/benchmark/types";
22
-
23
- export * from "./utils/ai-service-factory";
24
- export * from "./utils/task-o-matic-error";
25
-
26
- export * from "./lib/hooks";
27
-
28
- // Moved to CLI:
29
- // - ./utils/streaming-options
30
- // - ./utils/display-helpers
31
- // - ./lib/hooks/logger
32
-
33
- export * from "./utils/model-executor-parser";
34
- export * from "./utils/model-parser";
35
-
36
- export * from "./prompts";
@@ -1,310 +0,0 @@
1
- import {
2
- AIConfig,
3
- Task,
4
- AIPRDParseResult,
5
- DocumentationDetection,
6
- StreamingOptions,
7
- RetryConfig,
8
- TaskDocumentation,
9
- } from "../../types";
10
- import { BaseOperations } from "./base-operations";
11
- import { PRDOperations } from "./prd-operations";
12
- import { TaskOperations } from "./task-operations";
13
- import { DocumentationOperations } from "./documentation-operations";
14
-
15
- /**
16
- * Main AIOperations class that delegates to specialized operation classes.
17
- * This provides a unified API for all AI operations while keeping the implementation modular.
18
- */
19
- export class AIOperations extends BaseOperations {
20
- private prdOps = new PRDOperations();
21
- private taskOps = new TaskOperations();
22
- private docOps = new DocumentationOperations();
23
-
24
- // PRD Operations - Delegated to PRDOperations
25
-
26
- async parsePRD(
27
- prdContent: string,
28
- config?: Partial<AIConfig>,
29
- promptOverride?: string,
30
- userMessage?: string,
31
- streamingOptions?: StreamingOptions,
32
- retryConfig?: Partial<RetryConfig>,
33
- workingDirectory?: string,
34
- enableFilesystemTools?: boolean
35
- ): Promise<AIPRDParseResult> {
36
- return this.prdOps.parsePRD(
37
- prdContent,
38
- config,
39
- promptOverride,
40
- userMessage,
41
- streamingOptions,
42
- retryConfig,
43
- workingDirectory,
44
- enableFilesystemTools
45
- );
46
- }
47
-
48
- // Task Operations - Delegated to TaskOperations
49
-
50
- async breakdownTask(
51
- task: Task,
52
- config?: Partial<AIConfig>,
53
- promptOverride?: string,
54
- userMessage?: string,
55
- streamingOptions?: StreamingOptions,
56
- retryConfig?: Partial<RetryConfig>,
57
- fullContent?: string,
58
- stackInfo?: string,
59
- existingSubtasks?: Task[],
60
- enableFilesystemTools?: boolean
61
- ): Promise<
62
- Array<{ title: string; content: string; estimatedEffort?: string }>
63
- > {
64
- return this.taskOps.breakdownTask(
65
- task,
66
- config,
67
- promptOverride,
68
- userMessage,
69
- streamingOptions,
70
- retryConfig,
71
- fullContent,
72
- stackInfo,
73
- existingSubtasks,
74
- enableFilesystemTools
75
- );
76
- }
77
-
78
- async enhanceTask(
79
- title: string,
80
- description?: string,
81
- config?: Partial<AIConfig>,
82
- promptOverride?: string,
83
- userMessage?: string,
84
- taskId?: string,
85
- streamingOptions?: StreamingOptions,
86
- retryConfig?: Partial<RetryConfig>
87
- ): Promise<string> {
88
- return this.taskOps.enhanceTask(
89
- title,
90
- description,
91
- config,
92
- promptOverride,
93
- userMessage,
94
- taskId,
95
- streamingOptions,
96
- retryConfig
97
- );
98
- }
99
-
100
- async reworkPRD(
101
- prdContent: string,
102
- feedback: string,
103
- config?: Partial<AIConfig>,
104
- promptOverride?: string,
105
- userMessage?: string,
106
- streamingOptions?: StreamingOptions,
107
- retryConfig?: Partial<RetryConfig>,
108
- workingDirectory?: string,
109
- enableFilesystemTools?: boolean
110
- ): Promise<string> {
111
- return this.prdOps.reworkPRD(
112
- prdContent,
113
- feedback,
114
- config,
115
- promptOverride,
116
- userMessage,
117
- streamingOptions,
118
- retryConfig,
119
- workingDirectory,
120
- enableFilesystemTools
121
- );
122
- }
123
-
124
- async generatePRDQuestions(
125
- prdContent: string,
126
- config?: Partial<AIConfig>,
127
- promptOverride?: string,
128
- userMessage?: string,
129
- streamingOptions?: StreamingOptions,
130
- retryConfig?: Partial<RetryConfig>,
131
- workingDirectory?: string,
132
- enableFilesystemTools?: boolean
133
- ): Promise<string[]> {
134
- return this.prdOps.generatePRDQuestions(
135
- prdContent,
136
- config,
137
- promptOverride,
138
- userMessage,
139
- streamingOptions,
140
- retryConfig,
141
- workingDirectory,
142
- enableFilesystemTools
143
- );
144
- }
145
-
146
- async answerPRDQuestions(
147
- prdContent: string,
148
- questions: string[],
149
- config?: Partial<AIConfig>,
150
- contextInfo?: {
151
- stackInfo?: string;
152
- projectDescription?: string;
153
- },
154
- streamingOptions?: StreamingOptions,
155
- retryConfig?: Partial<RetryConfig>
156
- ): Promise<Record<string, string>> {
157
- return this.prdOps.answerPRDQuestions(
158
- prdContent,
159
- questions,
160
- config,
161
- contextInfo,
162
- streamingOptions,
163
- retryConfig
164
- );
165
- }
166
-
167
- async generatePRD(
168
- description: string,
169
- config?: Partial<AIConfig>,
170
- promptOverride?: string,
171
- userMessage?: string,
172
- streamingOptions?: StreamingOptions,
173
- retryConfig?: Partial<RetryConfig>
174
- ): Promise<string> {
175
- return this.prdOps.generatePRD(
176
- description,
177
- config,
178
- promptOverride,
179
- userMessage,
180
- streamingOptions,
181
- retryConfig
182
- );
183
- }
184
-
185
- async combinePRDs(
186
- prds: string[],
187
- originalDescription: string,
188
- config?: Partial<AIConfig>,
189
- promptOverride?: string,
190
- userMessage?: string,
191
- streamingOptions?: StreamingOptions,
192
- retryConfig?: Partial<RetryConfig>
193
- ): Promise<string> {
194
- return this.prdOps.combinePRDs(
195
- prds,
196
- originalDescription,
197
- config,
198
- promptOverride,
199
- userMessage,
200
- streamingOptions,
201
- retryConfig
202
- );
203
- }
204
-
205
- // Documentation Operations - Delegated to DocumentationOperations
206
-
207
- async enhanceTaskWithDocumentation(
208
- taskId: string,
209
- taskTitle: string,
210
- taskDescription: string,
211
- stackInfo?: string,
212
- streamingOptions?: StreamingOptions,
213
- retryConfig?: Partial<RetryConfig>,
214
- config?: Partial<AIConfig>,
215
- existingResearch?: Record<string, Array<{ query: string; doc: string }>>
216
- ): Promise<string> {
217
- return this.docOps.enhanceTaskWithDocumentation(
218
- taskId,
219
- taskTitle,
220
- taskDescription,
221
- stackInfo,
222
- streamingOptions,
223
- retryConfig,
224
- config,
225
- existingResearch
226
- );
227
- }
228
-
229
- async analyzeDocumentationNeeds(
230
- taskId: string,
231
- taskTitle: string,
232
- taskDescription: string,
233
- stackInfo?: string,
234
- streamingOptions?: StreamingOptions,
235
- retryConfig?: Partial<RetryConfig>,
236
- config?: Partial<AIConfig>,
237
- existingResearch?: (TaskDocumentation | undefined)[]
238
- ): Promise<DocumentationDetection> {
239
- return this.docOps.analyzeDocumentationNeeds(
240
- taskId,
241
- taskTitle,
242
- taskDescription,
243
- stackInfo,
244
- streamingOptions,
245
- retryConfig,
246
- config,
247
- existingResearch
248
- );
249
- }
250
-
251
- async generateDocumentationRecap(
252
- libraries: Array<{ name: string; context7Id: string; reason: string }>,
253
- documentContents: Array<{ library: string; content: string }>,
254
- streamingOptions?: StreamingOptions,
255
- retryConfig?: Partial<RetryConfig>
256
- ): Promise<string> {
257
- return this.docOps.generateDocumentationRecap(
258
- libraries,
259
- documentContents,
260
- streamingOptions,
261
- retryConfig
262
- );
263
- }
264
-
265
- async planTask(
266
- taskContext: string,
267
- taskDetails: string,
268
- config?: Partial<AIConfig>,
269
- promptOverride?: string,
270
- userMessage?: string,
271
- streamingOptions?: StreamingOptions,
272
- retryConfig?: Partial<RetryConfig>
273
- ): Promise<string> {
274
- return this.taskOps.planTask(
275
- taskContext,
276
- taskDetails,
277
- config,
278
- promptOverride,
279
- userMessage,
280
- streamingOptions,
281
- retryConfig
282
- );
283
- }
284
-
285
- // Stack suggestion - Delegated to PRDOperations
286
-
287
- async suggestStack(
288
- prdContent: string,
289
- projectName?: string,
290
- config?: Partial<AIConfig>,
291
- promptOverride?: string,
292
- userMessage?: string,
293
- streamingOptions?: StreamingOptions,
294
- retryConfig?: Partial<RetryConfig>,
295
- workingDirectory?: string,
296
- enableFilesystemTools?: boolean
297
- ): Promise<{ config: import("../../types").BTSConfig; reasoning: string }> {
298
- return this.prdOps.suggestStack(
299
- prdContent,
300
- projectName,
301
- config,
302
- promptOverride,
303
- userMessage,
304
- streamingOptions,
305
- retryConfig,
306
- workingDirectory,
307
- enableFilesystemTools
308
- );
309
- }
310
- }
@@ -1,139 +0,0 @@
1
- import { streamText, type LanguageModel } from "ai";
2
- import { AIConfig, StreamingOptions, RetryConfig } from "../../types";
3
- import { JSONParser } from "./json-parser";
4
- import { Context7Client } from "./mcp-client";
5
- import { RetryHandler } from "./retry-handler";
6
- import { ModelProvider } from "./model-provider";
7
-
8
- export class BaseOperations {
9
- protected jsonParser = new JSONParser();
10
- protected context7Client = new Context7Client();
11
- protected retryHandler = new RetryHandler();
12
- protected modelProvider = new ModelProvider();
13
-
14
- /**
15
- * Merges AI configuration with proper precedence.
16
- *
17
- * Configuration precedence (highest to lowest):
18
- * 1. Method parameter `config` (operation-specific overrides)
19
- * 2. ConfigManager global config (project-level settings)
20
- * 3. Environment variables (OPENAI_API_KEY, etc.)
21
- * 4. Provider defaults (defined in config.ts)
22
- *
23
- * @param config - Optional operation-specific config overrides
24
- * @returns Merged AIConfig with all precedence levels applied
25
- *
26
- * @example
27
- * ```typescript
28
- * // Override just the model for this operation
29
- * const finalConfig = this.mergeAIConfig({ model: "gpt-4o" });
30
- *
31
- * // Use default config (from ConfigManager + env vars)
32
- * const finalConfig = this.mergeAIConfig();
33
- * ```
34
- */
35
- protected mergeAIConfig(config?: Partial<AIConfig>): AIConfig {
36
- // Get base config (includes ConfigManager + env vars + defaults)
37
- const baseConfig = this.modelProvider.getAIConfig();
38
-
39
- // Apply operation-specific overrides (highest priority)
40
- return { ...baseConfig, ...config };
41
- }
42
-
43
- /**
44
- * Handles Context7 tool results by caching documentation.
45
- * Extracts and saves documentation from get-library-docs tool results.
46
- *
47
- * @param chunk - The chunk to check for Context7 tool results
48
- * @protected
49
- */
50
- protected handleContext7ToolResult(chunk: any): void {
51
- if (chunk.type === "tool-result" && chunk.toolName === "get-library-docs") {
52
- const docs = chunk.output;
53
- const libraryID = chunk.input?.context7CompatibleLibraryID || "unknown";
54
- const topic = chunk.input?.topic || "general";
55
-
56
- if (docs && typeof docs === "object" && "content" in docs) {
57
- this.context7Client.saveContext7Documentation(
58
- libraryID,
59
- docs.content,
60
- topic
61
- );
62
- } else if (docs && typeof docs === "string") {
63
- this.context7Client.saveContext7Documentation(libraryID, docs, topic);
64
- }
65
- }
66
- }
67
-
68
- async streamText(
69
- prompt: string,
70
- config?: Partial<AIConfig>,
71
- systemPrompt?: string,
72
- userMessage?: string,
73
- streamingOptions?: StreamingOptions,
74
- retryConfig?: Partial<RetryConfig>
75
- ): Promise<string> {
76
- // Merge config with proper precedence (Bug fix 2.9)
77
- const aiConfig = this.mergeAIConfig(config);
78
-
79
- return this.retryHandler.executeWithRetry(
80
- async () => {
81
- const model = this.modelProvider.getModel(aiConfig);
82
-
83
- const result = streamText({
84
- model,
85
- system: systemPrompt,
86
- messages: [{ role: "user", content: userMessage || prompt }],
87
- maxRetries: 0,
88
- onError: ({ error }) => {
89
- streamingOptions?.onError?.(error);
90
- throw error;
91
- },
92
- onChunk: streamingOptions?.onChunk
93
- ? ({ chunk }) => {
94
- if (chunk.type === "text-delta") {
95
- streamingOptions.onChunk!(chunk.text);
96
- } else if (chunk.type === "reasoning-delta") {
97
- streamingOptions.onReasoning?.(chunk.text);
98
- }
99
- // Handle Context7 tool result caching
100
- this.handleContext7ToolResult(chunk);
101
- }
102
- : undefined,
103
- onFinish: streamingOptions?.onFinish
104
- ? ({ text, finishReason, usage }) => {
105
- streamingOptions.onFinish!({
106
- text,
107
- finishReason,
108
- usage,
109
- isAborted: false,
110
- });
111
- }
112
- : undefined,
113
- ...(aiConfig.provider === "openrouter" &&
114
- aiConfig.reasoning &&
115
- aiConfig.reasoning.maxTokens
116
- ? {
117
- providerOptions: {
118
- openrouter: {
119
- reasoning: {
120
- max_tokens: aiConfig.reasoning.maxTokens,
121
- },
122
- },
123
- },
124
- }
125
- : {}),
126
- });
127
-
128
- let fullText = "";
129
- for await (const textPart of result.textStream) {
130
- fullText += textPart;
131
- }
132
-
133
- return fullText;
134
- },
135
- retryConfig,
136
- "AI streaming"
137
- );
138
- }
139
- }