task-o-matic-core 0.1.0
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/README.md +646 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/lib/ai-service/ai-operations.d.ts +45 -0
- package/dist/lib/ai-service/ai-operations.d.ts.map +1 -0
- package/dist/lib/ai-service/ai-operations.js +60 -0
- package/dist/lib/ai-service/base-operations.d.ts +43 -0
- package/dist/lib/ai-service/base-operations.d.ts.map +1 -0
- package/dist/lib/ai-service/base-operations.js +119 -0
- package/dist/lib/ai-service/documentation-operations.d.ts +18 -0
- package/dist/lib/ai-service/documentation-operations.d.ts.map +1 -0
- package/dist/lib/ai-service/documentation-operations.js +308 -0
- package/dist/lib/ai-service/filesystem-tools.d.ts +69 -0
- package/dist/lib/ai-service/filesystem-tools.d.ts.map +1 -0
- package/dist/lib/ai-service/filesystem-tools.js +70 -0
- package/dist/lib/ai-service/json-parser.d.ts +34 -0
- package/dist/lib/ai-service/json-parser.d.ts.map +1 -0
- package/dist/lib/ai-service/json-parser.js +177 -0
- package/dist/lib/ai-service/mcp-client.d.ts +9 -0
- package/dist/lib/ai-service/mcp-client.d.ts.map +1 -0
- package/dist/lib/ai-service/mcp-client.js +48 -0
- package/dist/lib/ai-service/model-provider.d.ts +12 -0
- package/dist/lib/ai-service/model-provider.d.ts.map +1 -0
- package/dist/lib/ai-service/model-provider.js +146 -0
- package/dist/lib/ai-service/prd-operations.d.ts +25 -0
- package/dist/lib/ai-service/prd-operations.d.ts.map +1 -0
- package/dist/lib/ai-service/prd-operations.js +592 -0
- package/dist/lib/ai-service/research-tools.d.ts +4 -0
- package/dist/lib/ai-service/research-tools.d.ts.map +1 -0
- package/dist/lib/ai-service/research-tools.js +8 -0
- package/dist/lib/ai-service/retry-handler.d.ts +8 -0
- package/dist/lib/ai-service/retry-handler.d.ts.map +1 -0
- package/dist/lib/ai-service/retry-handler.js +63 -0
- package/dist/lib/ai-service/task-operations.d.ts +13 -0
- package/dist/lib/ai-service/task-operations.d.ts.map +1 -0
- package/dist/lib/ai-service/task-operations.js +220 -0
- package/dist/lib/benchmark/registry.d.ts +11 -0
- package/dist/lib/benchmark/registry.d.ts.map +1 -0
- package/dist/lib/benchmark/registry.js +212 -0
- package/dist/lib/benchmark/runner.d.ts +6 -0
- package/dist/lib/benchmark/runner.d.ts.map +1 -0
- package/dist/lib/benchmark/runner.js +150 -0
- package/dist/lib/benchmark/storage.d.ts +13 -0
- package/dist/lib/benchmark/storage.d.ts.map +1 -0
- package/dist/lib/benchmark/storage.js +100 -0
- package/dist/lib/benchmark/types.d.ts +104 -0
- package/dist/lib/benchmark/types.d.ts.map +1 -0
- package/dist/lib/benchmark/types.js +2 -0
- package/dist/lib/better-t-stack-cli.d.ts +50 -0
- package/dist/lib/better-t-stack-cli.d.ts.map +1 -0
- package/dist/lib/better-t-stack-cli.js +428 -0
- package/dist/lib/bootstrap/cli-bootstrap.d.ts +14 -0
- package/dist/lib/bootstrap/cli-bootstrap.d.ts.map +1 -0
- package/dist/lib/bootstrap/cli-bootstrap.js +322 -0
- package/dist/lib/bootstrap/index.d.ts +3 -0
- package/dist/lib/bootstrap/index.d.ts.map +1 -0
- package/dist/lib/bootstrap/index.js +18 -0
- package/dist/lib/bootstrap/medusa-bootstrap.d.ts +14 -0
- package/dist/lib/bootstrap/medusa-bootstrap.d.ts.map +1 -0
- package/dist/lib/bootstrap/medusa-bootstrap.js +215 -0
- 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 +254 -0
- package/dist/lib/config.d.ts +55 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +351 -0
- package/dist/lib/context-builder.d.ts +66 -0
- package/dist/lib/context-builder.d.ts.map +1 -0
- package/dist/lib/context-builder.js +322 -0
- package/dist/lib/executors/claude-code-executor.d.ts +9 -0
- package/dist/lib/executors/claude-code-executor.d.ts.map +1 -0
- package/dist/lib/executors/claude-code-executor.js +69 -0
- package/dist/lib/executors/codex-executor.d.ts +9 -0
- package/dist/lib/executors/codex-executor.d.ts.map +1 -0
- package/dist/lib/executors/codex-executor.js +73 -0
- package/dist/lib/executors/executor-factory.d.ts +5 -0
- package/dist/lib/executors/executor-factory.d.ts.map +1 -0
- package/dist/lib/executors/executor-factory.js +27 -0
- package/dist/lib/executors/gemini-executor.d.ts +9 -0
- package/dist/lib/executors/gemini-executor.d.ts.map +1 -0
- package/dist/lib/executors/gemini-executor.js +67 -0
- package/dist/lib/executors/kilo-executor.d.ts +9 -0
- package/dist/lib/executors/kilo-executor.d.ts.map +1 -0
- package/dist/lib/executors/kilo-executor.js +69 -0
- package/dist/lib/executors/opencode-executor.d.ts +9 -0
- package/dist/lib/executors/opencode-executor.d.ts.map +1 -0
- package/dist/lib/executors/opencode-executor.js +67 -0
- package/dist/lib/git-utils.d.ts +88 -0
- package/dist/lib/git-utils.d.ts.map +1 -0
- package/dist/lib/git-utils.js +242 -0
- package/dist/lib/hooks.d.ts +73 -0
- package/dist/lib/hooks.d.ts.map +1 -0
- package/dist/lib/hooks.js +62 -0
- package/dist/lib/index.d.ts +100 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +143 -0
- package/dist/lib/logger.d.ts +20 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +32 -0
- package/dist/lib/notifications.d.ts +7 -0
- package/dist/lib/notifications.d.ts.map +1 -0
- package/dist/lib/notifications.js +81 -0
- package/dist/lib/prompt-builder.d.ts +70 -0
- package/dist/lib/prompt-builder.d.ts.map +1 -0
- package/dist/lib/prompt-builder.js +344 -0
- package/dist/lib/prompt-registry.d.ts +22 -0
- package/dist/lib/prompt-registry.d.ts.map +1 -0
- package/dist/lib/prompt-registry.js +409 -0
- package/dist/lib/provider-defaults.json +32 -0
- package/dist/lib/storage/file-system.d.ts +57 -0
- package/dist/lib/storage/file-system.d.ts.map +1 -0
- package/dist/lib/storage/file-system.js +638 -0
- package/dist/lib/storage/storage-callbacks.d.ts +17 -0
- package/dist/lib/storage/storage-callbacks.d.ts.map +1 -0
- package/dist/lib/storage/storage-callbacks.js +94 -0
- package/dist/lib/storage/types.d.ts +43 -0
- package/dist/lib/storage/types.d.ts.map +1 -0
- package/dist/lib/storage/types.js +2 -0
- package/dist/lib/task-execution-core.d.ts +7 -0
- package/dist/lib/task-execution-core.d.ts.map +1 -0
- package/dist/lib/task-execution-core.js +381 -0
- package/dist/lib/task-execution.d.ts +7 -0
- package/dist/lib/task-execution.d.ts.map +1 -0
- package/dist/lib/task-execution.js +40 -0
- package/dist/lib/task-loop-execution.d.ts +7 -0
- package/dist/lib/task-loop-execution.d.ts.map +1 -0
- package/dist/lib/task-loop-execution.js +156 -0
- package/dist/lib/task-planning.d.ts +29 -0
- package/dist/lib/task-planning.d.ts.map +1 -0
- package/dist/lib/task-planning.js +103 -0
- package/dist/lib/task-review.d.ts +27 -0
- package/dist/lib/task-review.d.ts.map +1 -0
- package/dist/lib/task-review.js +103 -0
- package/dist/lib/validation.d.ts +26 -0
- package/dist/lib/validation.d.ts.map +1 -0
- package/dist/lib/validation.js +98 -0
- package/dist/prompts/documentation-detection.d.ts +2 -0
- package/dist/prompts/documentation-detection.d.ts.map +1 -0
- package/dist/prompts/documentation-detection.js +24 -0
- package/dist/prompts/documentation-recap.d.ts +3 -0
- package/dist/prompts/documentation-recap.d.ts.map +1 -0
- package/dist/prompts/documentation-recap.js +13 -0
- package/dist/prompts/index.d.ts +15 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +30 -0
- package/dist/prompts/prd-combination.d.ts +2 -0
- package/dist/prompts/prd-combination.d.ts.map +1 -0
- package/dist/prompts/prd-combination.js +35 -0
- package/dist/prompts/prd-generation.d.ts +2 -0
- package/dist/prompts/prd-generation.d.ts.map +1 -0
- package/dist/prompts/prd-generation.js +49 -0
- package/dist/prompts/prd-parsing.d.ts +3 -0
- package/dist/prompts/prd-parsing.d.ts.map +1 -0
- package/dist/prompts/prd-parsing.js +172 -0
- package/dist/prompts/prd-question-answer.d.ts +3 -0
- package/dist/prompts/prd-question-answer.d.ts.map +1 -0
- package/dist/prompts/prd-question-answer.js +27 -0
- package/dist/prompts/prd-question.d.ts +3 -0
- package/dist/prompts/prd-question.d.ts.map +1 -0
- package/dist/prompts/prd-question.js +40 -0
- package/dist/prompts/prd-rework.d.ts +3 -0
- package/dist/prompts/prd-rework.d.ts.map +1 -0
- package/dist/prompts/prd-rework.js +81 -0
- package/dist/prompts/prd-suggest-stack.d.ts +3 -0
- package/dist/prompts/prd-suggest-stack.d.ts.map +1 -0
- package/dist/prompts/prd-suggest-stack.js +99 -0
- package/dist/prompts/task-breakdown.d.ts +3 -0
- package/dist/prompts/task-breakdown.d.ts.map +1 -0
- package/dist/prompts/task-breakdown.js +151 -0
- package/dist/prompts/task-enhancement.d.ts +3 -0
- package/dist/prompts/task-enhancement.d.ts.map +1 -0
- package/dist/prompts/task-enhancement.js +140 -0
- package/dist/prompts/task-execution.d.ts +3 -0
- package/dist/prompts/task-execution.d.ts.map +1 -0
- package/dist/prompts/task-execution.js +24 -0
- package/dist/prompts/task-planning.d.ts +3 -0
- package/dist/prompts/task-planning.d.ts.map +1 -0
- package/dist/prompts/task-planning.js +66 -0
- package/dist/prompts/workflow-assistance.d.ts +32 -0
- package/dist/prompts/workflow-assistance.d.ts.map +1 -0
- package/dist/prompts/workflow-assistance.js +130 -0
- package/dist/prompts/workflow-prompts.d.ts +9 -0
- package/dist/prompts/workflow-prompts.d.ts.map +1 -0
- package/dist/prompts/workflow-prompts.js +93 -0
- package/dist/services/benchmark.d.ts +26 -0
- package/dist/services/benchmark.d.ts.map +1 -0
- package/dist/services/benchmark.js +343 -0
- package/dist/services/prd.d.ts +136 -0
- package/dist/services/prd.d.ts.map +1 -0
- package/dist/services/prd.js +550 -0
- package/dist/services/tasks.d.ts +388 -0
- package/dist/services/tasks.d.ts.map +1 -0
- package/dist/services/tasks.js +1150 -0
- package/dist/services/workflow-ai-assistant.d.ts +74 -0
- package/dist/services/workflow-ai-assistant.d.ts.map +1 -0
- package/dist/services/workflow-ai-assistant.js +175 -0
- package/dist/services/workflow-benchmark.d.ts +34 -0
- package/dist/services/workflow-benchmark.d.ts.map +1 -0
- package/dist/services/workflow-benchmark.js +318 -0
- package/dist/services/workflow.d.ts +107 -0
- package/dist/services/workflow.d.ts.map +1 -0
- package/dist/services/workflow.js +580 -0
- package/dist/test/hooks.test.d.ts +2 -0
- package/dist/test/hooks.test.d.ts.map +1 -0
- package/dist/test/hooks.test.js +67 -0
- package/dist/test/integration/callbacks.test.d.ts +2 -0
- package/dist/test/integration/callbacks.test.d.ts.map +1 -0
- package/dist/test/integration/callbacks.test.js +64 -0
- 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/lib/config.test.d.ts +2 -0
- package/dist/test/lib/config.test.d.ts.map +1 -0
- package/dist/test/lib/config.test.js +128 -0
- package/dist/test/lib/git-utils.test.d.ts +2 -0
- package/dist/test/lib/git-utils.test.d.ts.map +1 -0
- package/dist/test/lib/git-utils.test.js +168 -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/model-parsing.test.d.ts +2 -0
- package/dist/test/model-parsing.test.d.ts.map +1 -0
- package/dist/test/model-parsing.test.js +73 -0
- package/dist/test/services/task-service.test.d.ts +2 -0
- package/dist/test/services/task-service.test.d.ts.map +1 -0
- package/dist/test/services/task-service.test.js +459 -0
- package/dist/test/storage.test.d.ts +2 -0
- package/dist/test/storage.test.d.ts.map +1 -0
- package/dist/test/storage.test.js +207 -0
- package/dist/test/task-loop-git.test.d.ts +2 -0
- package/dist/test/task-loop-git.test.d.ts.map +1 -0
- package/dist/test/task-loop-git.test.js +95 -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/test/utils/file-utils.test.d.ts +2 -0
- package/dist/test/utils/file-utils.test.d.ts.map +1 -0
- package/dist/test/utils/file-utils.test.js +76 -0
- package/dist/test/utils/id-generator.test.d.ts +2 -0
- package/dist/test/utils/id-generator.test.d.ts.map +1 -0
- package/dist/test/utils/id-generator.test.js +41 -0
- package/dist/test/utils/model-parser.test.d.ts +2 -0
- package/dist/test/utils/model-parser.test.d.ts.map +1 -0
- package/dist/test/utils/model-parser.test.js +65 -0
- package/dist/test/validation.test.d.ts +2 -0
- package/dist/test/validation.test.d.ts.map +1 -0
- package/dist/test/validation.test.js +22 -0
- package/dist/types/callbacks.d.ts +30 -0
- package/dist/types/callbacks.d.ts.map +1 -0
- package/dist/types/callbacks.js +2 -0
- package/dist/types/index.d.ts +435 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +30 -0
- package/dist/types/mcp.d.ts +3 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +3 -0
- package/dist/types/options.d.ts +112 -0
- package/dist/types/options.d.ts.map +1 -0
- package/dist/types/options.js +2 -0
- package/dist/types/results.d.ts +200 -0
- package/dist/types/results.d.ts.map +1 -0
- package/dist/types/results.js +2 -0
- package/dist/types/workflow-options.d.ts +82 -0
- package/dist/types/workflow-options.d.ts.map +1 -0
- package/dist/types/workflow-options.js +2 -0
- package/dist/types/workflow-results.d.ts +82 -0
- package/dist/types/workflow-results.d.ts.map +1 -0
- package/dist/types/workflow-results.js +2 -0
- package/dist/utils/ai-config-builder.d.ts +14 -0
- package/dist/utils/ai-config-builder.d.ts.map +1 -0
- package/dist/utils/ai-config-builder.js +22 -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 +303 -0
- package/dist/utils/ai-service-factory.d.ts +34 -0
- package/dist/utils/ai-service-factory.d.ts.map +1 -0
- package/dist/utils/ai-service-factory.js +99 -0
- package/dist/utils/error-utils.d.ts +70 -0
- package/dist/utils/error-utils.d.ts.map +1 -0
- package/dist/utils/error-utils.js +104 -0
- package/dist/utils/file-utils.d.ts +107 -0
- package/dist/utils/file-utils.d.ts.map +1 -0
- package/dist/utils/file-utils.js +171 -0
- package/dist/utils/id-generator.d.ts +92 -0
- package/dist/utils/id-generator.d.ts.map +1 -0
- package/dist/utils/id-generator.js +146 -0
- package/dist/utils/metadata-utils.d.ts +40 -0
- package/dist/utils/metadata-utils.d.ts.map +1 -0
- package/dist/utils/metadata-utils.js +43 -0
- package/dist/utils/model-executor-parser.d.ts +38 -0
- package/dist/utils/model-executor-parser.d.ts.map +1 -0
- package/dist/utils/model-executor-parser.js +69 -0
- package/dist/utils/model-parser.d.ts +6 -0
- package/dist/utils/model-parser.d.ts.map +1 -0
- package/dist/utils/model-parser.js +49 -0
- package/dist/utils/stack-formatter.d.ts +12 -0
- package/dist/utils/stack-formatter.d.ts.map +1 -0
- package/dist/utils/stack-formatter.js +36 -0
- package/dist/utils/storage-utils.d.ts +49 -0
- package/dist/utils/storage-utils.d.ts.map +1 -0
- package/dist/utils/storage-utils.js +80 -0
- package/dist/utils/streaming-utils.d.ts +38 -0
- package/dist/utils/streaming-utils.d.ts.map +1 -0
- package/dist/utils/streaming-utils.js +64 -0
- 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 +40 -0
- package/src/index.ts +36 -0
- package/src/lib/ai-service/ai-operations.ts +310 -0
- package/src/lib/ai-service/base-operations.ts +139 -0
- package/src/lib/ai-service/documentation-operations.ts +438 -0
- package/src/lib/ai-service/filesystem-tools.ts +73 -0
- package/src/lib/ai-service/gemini-proxy.ts.bak +52 -0
- package/src/lib/ai-service/json-parser.ts +203 -0
- package/src/lib/ai-service/mcp-client.ts +54 -0
- package/src/lib/ai-service/model-provider.ts +192 -0
- package/src/lib/ai-service/prd-operations.ts +854 -0
- package/src/lib/ai-service/research-tools.ts +207 -0
- package/src/lib/ai-service/retry-handler.ts +89 -0
- package/src/lib/ai-service/task-operations.ts +342 -0
- package/src/lib/benchmark/registry.ts +307 -0
- package/src/lib/benchmark/runner.ts +190 -0
- package/src/lib/benchmark/storage.ts +140 -0
- package/src/lib/benchmark/types.ts +121 -0
- package/src/lib/better-t-stack-cli.ts +524 -0
- package/src/lib/bootstrap/cli-bootstrap.ts +397 -0
- package/src/lib/bootstrap/index.ts +2 -0
- package/src/lib/bootstrap/medusa-bootstrap.ts +261 -0
- package/src/lib/config-validation.ts +278 -0
- package/src/lib/config.ts +435 -0
- package/src/lib/context-builder.ts +383 -0
- package/src/lib/executors/claude-code-executor.ts +83 -0
- package/src/lib/executors/codex-executor.ts +85 -0
- package/src/lib/executors/executor-factory.ts +28 -0
- package/src/lib/executors/gemini-executor.ts +80 -0
- package/src/lib/executors/kilo-executor.ts +83 -0
- package/src/lib/executors/opencode-executor.ts +81 -0
- package/src/lib/git-utils.ts +334 -0
- package/src/lib/hooks.ts +121 -0
- package/src/lib/index.ts +166 -0
- package/src/lib/logger.ts +43 -0
- package/src/lib/notifications.ts +103 -0
- package/src/lib/prompt-builder.ts +471 -0
- package/src/lib/prompt-registry.ts +491 -0
- package/src/lib/provider-defaults.json +32 -0
- package/src/lib/storage/file-system.ts +864 -0
- package/src/lib/storage/storage-callbacks.ts +120 -0
- package/src/lib/storage/types.ts +58 -0
- package/src/lib/task-execution-core.ts +591 -0
- package/src/lib/task-execution.ts +59 -0
- package/src/lib/task-loop-execution.ts +214 -0
- package/src/lib/task-planning.ts +157 -0
- package/src/lib/task-review.ts +138 -0
- package/src/lib/validation.ts +140 -0
- package/src/prompts/documentation-detection.ts +21 -0
- package/src/prompts/documentation-recap.ts +11 -0
- package/src/prompts/index.ts +14 -0
- package/src/prompts/prd-combination.ts +32 -0
- package/src/prompts/prd-generation.ts +46 -0
- package/src/prompts/prd-parsing.ts +170 -0
- package/src/prompts/prd-question-answer.ts +25 -0
- package/src/prompts/prd-question.ts +38 -0
- package/src/prompts/prd-rework.ts +79 -0
- package/src/prompts/prd-suggest-stack.ts +97 -0
- package/src/prompts/task-breakdown.ts +149 -0
- package/src/prompts/task-enhancement.ts +138 -0
- package/src/prompts/task-execution.ts +22 -0
- package/src/prompts/task-planning.ts +64 -0
- package/src/prompts/workflow-assistance.ts +151 -0
- package/src/prompts/workflow-prompts.ts +97 -0
- package/src/services/benchmark.ts +433 -0
- package/src/services/prd.ts +845 -0
- package/src/services/tasks.ts +1515 -0
- package/src/services/workflow-ai-assistant.ts +298 -0
- package/src/services/workflow-benchmark.ts +339 -0
- package/src/services/workflow.ts +779 -0
- package/src/test/hooks.test.ts +77 -0
- package/src/test/integration/callbacks.test.ts +39 -0
- package/src/test/lib/ai-service/task-operations.test.ts +430 -0
- package/src/test/lib/config.test.ts +150 -0
- package/src/test/lib/git-utils.test.ts +198 -0
- package/src/test/mocks/mock-ai-operations.ts +205 -0
- package/src/test/mocks/mock-context-builder.ts +84 -0
- package/src/test/mocks/mock-model-provider.ts +21 -0
- package/src/test/mocks/mock-service-factory.ts +64 -0
- package/src/test/mocks/mock-storage.ts +204 -0
- package/src/test/model-parsing.test.ts +78 -0
- package/src/test/services/task-service.test.ts +551 -0
- package/src/test/storage.test.ts +206 -0
- package/src/test/task-loop-git.test.ts +142 -0
- package/src/test/test-mock-setup.ts +46 -0
- package/src/test/test-setup.ts +48 -0
- package/src/test/test-utils.ts +45 -0
- package/src/test/utils/ai-operation-utility.test.ts +306 -0
- package/src/test/utils/error-handling.test.ts +241 -0
- package/src/test/utils/file-utils.test.ts +80 -0
- package/src/test/utils/id-generator.test.ts +44 -0
- package/src/test/utils/model-parser.test.ts +67 -0
- package/src/test/validation.test.ts +19 -0
- package/src/types/callbacks.ts +14 -0
- package/src/types/index.ts +628 -0
- package/src/types/mcp.ts +5 -0
- package/src/types/options.ts +165 -0
- package/src/types/results.ts +216 -0
- package/src/types/workflow-options.ts +113 -0
- package/src/types/workflow-results.ts +87 -0
- package/src/utils/ai-config-builder.ts +33 -0
- package/src/utils/ai-operation-utility.ts +380 -0
- package/src/utils/ai-service-factory.ts +125 -0
- package/src/utils/error-utils.ts +124 -0
- package/src/utils/file-utils.ts +197 -0
- package/src/utils/id-generator.ts +168 -0
- package/src/utils/metadata-utils.ts +48 -0
- package/src/utils/model-executor-parser.ts +80 -0
- package/src/utils/model-parser.ts +58 -0
- package/src/utils/stack-formatter.ts +53 -0
- package/src/utils/storage-utils.ts +94 -0
- package/src/utils/streaming-utils.ts +91 -0
- package/src/utils/task-o-matic-error.ts +393 -0
- package/tsconfig.json +20 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContextBuilder = void 0;
|
|
4
|
+
exports.createDefaultContextCallbacks = createDefaultContextCallbacks;
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const config_1 = require("./config");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const logger_1 = require("./logger");
|
|
9
|
+
function createDefaultContextCallbacks() {
|
|
10
|
+
return {
|
|
11
|
+
readFile: async (path) => {
|
|
12
|
+
if ((0, fs_1.existsSync)(path)) {
|
|
13
|
+
return (0, fs_1.readFileSync)(path, "utf-8");
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
},
|
|
17
|
+
fileExists: async (path) => {
|
|
18
|
+
return (0, fs_1.existsSync)(path);
|
|
19
|
+
},
|
|
20
|
+
listFiles: async (dir) => {
|
|
21
|
+
if ((0, fs_1.existsSync)(dir) && (0, fs_1.statSync)(dir).isDirectory()) {
|
|
22
|
+
return (0, fs_1.readdirSync)(dir);
|
|
23
|
+
}
|
|
24
|
+
return [];
|
|
25
|
+
},
|
|
26
|
+
stat: async (path) => {
|
|
27
|
+
if ((0, fs_1.existsSync)(path)) {
|
|
28
|
+
const stats = (0, fs_1.statSync)(path);
|
|
29
|
+
return {
|
|
30
|
+
mtime: stats.mtime.getTime(),
|
|
31
|
+
isDirectory: stats.isDirectory(),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
class ContextBuilder {
|
|
39
|
+
storage;
|
|
40
|
+
callbacks;
|
|
41
|
+
taskOMatic = null;
|
|
42
|
+
initialized = false;
|
|
43
|
+
constructor(storage, callbacks) {
|
|
44
|
+
this.storage = storage;
|
|
45
|
+
this.callbacks = callbacks || createDefaultContextCallbacks();
|
|
46
|
+
}
|
|
47
|
+
ensureInitialized() {
|
|
48
|
+
if (this.initialized) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.taskOMatic = config_1.configManager.getTaskOMaticDir();
|
|
52
|
+
this.initialized = true;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Build comprehensive context for AI operations
|
|
56
|
+
*/
|
|
57
|
+
async buildContext(taskId) {
|
|
58
|
+
this.ensureInitialized();
|
|
59
|
+
const task = await this.storage.getTask(taskId);
|
|
60
|
+
if (!task) {
|
|
61
|
+
throw new Error(`Task with ID ${taskId} not found`);
|
|
62
|
+
}
|
|
63
|
+
const stack = await this.getStackConfig();
|
|
64
|
+
const documentation = this.getTaskDocumentation(task);
|
|
65
|
+
const fullContent = await this.getTaskFullContent(task);
|
|
66
|
+
const prdContent = task.prdFile
|
|
67
|
+
? await this.getPRDContent(task.prdFile)
|
|
68
|
+
: await this.getRelevantPRDContent(task.title, task.description);
|
|
69
|
+
return {
|
|
70
|
+
task: {
|
|
71
|
+
id: task.id,
|
|
72
|
+
title: task.title,
|
|
73
|
+
description: task.description ?? "",
|
|
74
|
+
fullContent,
|
|
75
|
+
},
|
|
76
|
+
stack,
|
|
77
|
+
documentation: documentation
|
|
78
|
+
? {
|
|
79
|
+
recap: documentation.recap,
|
|
80
|
+
files: documentation.files.map((file) => ({
|
|
81
|
+
path: file,
|
|
82
|
+
// Content loading is skipped as per original code comment
|
|
83
|
+
})),
|
|
84
|
+
}
|
|
85
|
+
: undefined,
|
|
86
|
+
existingContent: documentation?.recap,
|
|
87
|
+
prdContent,
|
|
88
|
+
existingResearch: documentation?.research || {},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Build context for new tasks (without requiring existing task)
|
|
93
|
+
*/
|
|
94
|
+
async buildContextForNewTask(title, description, prdFile) {
|
|
95
|
+
this.ensureInitialized();
|
|
96
|
+
const stack = await this.getStackConfig();
|
|
97
|
+
const prdContent = prdFile
|
|
98
|
+
? await this.getPRDContent(prdFile)
|
|
99
|
+
: await this.getRelevantPRDContent(title, description);
|
|
100
|
+
return {
|
|
101
|
+
task: {
|
|
102
|
+
id: "new-task",
|
|
103
|
+
title,
|
|
104
|
+
description: description ?? "",
|
|
105
|
+
fullContent: undefined,
|
|
106
|
+
},
|
|
107
|
+
stack,
|
|
108
|
+
documentation: undefined, // New tasks don't have documentation yet
|
|
109
|
+
existingContent: undefined,
|
|
110
|
+
prdContent,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Get stack configuration from project (set by bootstrap)
|
|
115
|
+
*/
|
|
116
|
+
async getStackConfig() {
|
|
117
|
+
if (!this.taskOMatic) {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
// Return sensible defaults for Better-T-Stack
|
|
121
|
+
const fallbackConfig = {
|
|
122
|
+
projectName: "default",
|
|
123
|
+
frontend: "next",
|
|
124
|
+
backend: "convex",
|
|
125
|
+
database: "none", // Convex has its own database
|
|
126
|
+
auth: "better-auth",
|
|
127
|
+
runtime: "none",
|
|
128
|
+
api: "none",
|
|
129
|
+
payments: "none",
|
|
130
|
+
orm: "none", // Convex doesn't use ORM
|
|
131
|
+
dbSetup: "none",
|
|
132
|
+
packageManager: "npm",
|
|
133
|
+
git: true,
|
|
134
|
+
webDeploy: "none",
|
|
135
|
+
serverDeploy: "none",
|
|
136
|
+
install: true,
|
|
137
|
+
addons: ["turborepo"],
|
|
138
|
+
examples: [],
|
|
139
|
+
};
|
|
140
|
+
try {
|
|
141
|
+
const stackFile = (0, path_1.join)(this.taskOMatic, "stack.json");
|
|
142
|
+
const content = await this.callbacks.readFile(stackFile);
|
|
143
|
+
if (content) {
|
|
144
|
+
const config = JSON.parse(content);
|
|
145
|
+
config._source = "file"; // Track source
|
|
146
|
+
return config;
|
|
147
|
+
}
|
|
148
|
+
fallbackConfig._source = "fallback"; // Track source
|
|
149
|
+
return fallbackConfig;
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
logger_1.logger.warn(`Failed to load stack configuration, using defaults: ${error}`);
|
|
153
|
+
fallbackConfig._source = "fallback"; // Track source
|
|
154
|
+
return fallbackConfig;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Get task documentation references
|
|
159
|
+
*/
|
|
160
|
+
getTaskDocumentation(task) {
|
|
161
|
+
return task.documentation;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Get full task content from MD file
|
|
165
|
+
*/
|
|
166
|
+
async getTaskFullContent(task) {
|
|
167
|
+
if (!task.contentFile || !this.taskOMatic) {
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
const contentPath = (0, path_1.join)(this.taskOMatic, task.contentFile);
|
|
172
|
+
return (await this.callbacks.readFile(contentPath)) || undefined;
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
logger_1.logger.warn(`Failed to read task content file ${task.contentFile}: ${error}`);
|
|
176
|
+
}
|
|
177
|
+
return undefined;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Read documentation file content
|
|
181
|
+
*/
|
|
182
|
+
async readDocumentationFile(filePath) {
|
|
183
|
+
if (!this.taskOMatic) {
|
|
184
|
+
return `# ContextBuilder Not Initialized\n\nFile: ${filePath}\n\nContextBuilder has not been properly initialized.`;
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
const fullPath = (0, path_1.join)(this.taskOMatic, filePath);
|
|
188
|
+
const content = await this.callbacks.readFile(fullPath);
|
|
189
|
+
if (content) {
|
|
190
|
+
return content;
|
|
191
|
+
}
|
|
192
|
+
return `# Documentation File Not Found\n\nFile: ${filePath}\n\nThis documentation file could not be found on disk.`;
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
return `# Error Reading Documentation\n\nFile: ${filePath}\n\nError: ${error instanceof Error ? error.message : "Unknown error"}`;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Check if documentation is fresh (less than 7 days old)
|
|
200
|
+
*/
|
|
201
|
+
isDocumentationFresh(documentation) {
|
|
202
|
+
const sevenDaysAgo = Date.now() - 7 * 24 * 60 * 60 * 1000;
|
|
203
|
+
return documentation.lastFetched > sevenDaysAgo;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Check if documentation is stale (more than 30 days old)
|
|
207
|
+
*/
|
|
208
|
+
isDocumentationStale(documentation) {
|
|
209
|
+
const thirtyDaysAgo = Date.now() - 30 * 24 * 60 * 60 * 1000;
|
|
210
|
+
return documentation.lastFetched < thirtyDaysAgo;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Get PRD content from file path
|
|
214
|
+
*/
|
|
215
|
+
async getPRDContent(prdFile) {
|
|
216
|
+
if (!this.taskOMatic) {
|
|
217
|
+
return undefined;
|
|
218
|
+
}
|
|
219
|
+
try {
|
|
220
|
+
// Handle relative paths from .task-o-matic directory
|
|
221
|
+
const fullPath = prdFile.startsWith("/")
|
|
222
|
+
? prdFile
|
|
223
|
+
: (0, path_1.join)(this.taskOMatic, prdFile);
|
|
224
|
+
return (await this.callbacks.readFile(fullPath)) || undefined;
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
logger_1.logger.warn(`Failed to read PRD file ${prdFile}: ${error}`);
|
|
228
|
+
return undefined;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Get relevant PRD content based on task title/description
|
|
233
|
+
*/
|
|
234
|
+
async getRelevantPRDContent(taskTitle, taskDescription) {
|
|
235
|
+
if (!this.taskOMatic)
|
|
236
|
+
return undefined;
|
|
237
|
+
// Look for PRD files in known locations
|
|
238
|
+
const prdPaths = [
|
|
239
|
+
(0, path_1.join)(this.taskOMatic, "prd"),
|
|
240
|
+
(0, path_1.join)(this.taskOMatic, "..", "docs"),
|
|
241
|
+
(0, path_1.join)(config_1.configManager.getWorkingDirectory(), ".task-o-matic", "prd"),
|
|
242
|
+
(0, path_1.join)(config_1.configManager.getWorkingDirectory(), "prd"),
|
|
243
|
+
(0, path_1.join)(config_1.configManager.getWorkingDirectory(), "docs"),
|
|
244
|
+
];
|
|
245
|
+
for (const prdPath of prdPaths) {
|
|
246
|
+
if (await this.callbacks.fileExists(prdPath)) {
|
|
247
|
+
try {
|
|
248
|
+
// Look for ANY text files in PRD directory
|
|
249
|
+
const files = await this.callbacks.listFiles(prdPath);
|
|
250
|
+
const prdFiles = files.filter((f) => f.endsWith(".md") || f.endsWith(".txt"));
|
|
251
|
+
if (prdFiles.length > 0) {
|
|
252
|
+
// Get the MOST RECENT PRD file by modification time
|
|
253
|
+
const prdFilesWithStats = await Promise.all(prdFiles.map(async (file) => {
|
|
254
|
+
const path = (0, path_1.join)(prdPath, file);
|
|
255
|
+
const stats = await this.callbacks.stat(path);
|
|
256
|
+
return {
|
|
257
|
+
file,
|
|
258
|
+
path,
|
|
259
|
+
mtime: stats ? stats.mtime : 0,
|
|
260
|
+
};
|
|
261
|
+
}));
|
|
262
|
+
prdFilesWithStats.sort((a, b) => b.mtime - a.mtime); // Sort by newest first
|
|
263
|
+
const mostRecentPrd = prdFilesWithStats[0];
|
|
264
|
+
return ((await this.callbacks.readFile(mostRecentPrd.path)) || undefined);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
logger_1.logger.warn(`Failed to read PRD directory ${prdPath}: ${error}`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return undefined;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Format context for AI prompts
|
|
276
|
+
*/
|
|
277
|
+
formatContextForAI(context) {
|
|
278
|
+
let formatted = `# Task Context\n\n`;
|
|
279
|
+
formatted += `## Task Information\n`;
|
|
280
|
+
formatted += `- **ID**: ${context.task.id}\n`;
|
|
281
|
+
formatted += `- **Title**: ${context.task.title}\n`;
|
|
282
|
+
formatted += `- **Description**: ${context.task.description}\n`;
|
|
283
|
+
if (context.task.fullContent) {
|
|
284
|
+
formatted += `- **Full Content**:\n${context.task.fullContent}\n\n`;
|
|
285
|
+
}
|
|
286
|
+
if (context.prdContent) {
|
|
287
|
+
formatted += `## Product Requirements Document\n`;
|
|
288
|
+
formatted += `${context.prdContent}\n\n`;
|
|
289
|
+
}
|
|
290
|
+
if (context.stack) {
|
|
291
|
+
formatted += `## Technology Stack\n`;
|
|
292
|
+
formatted += `- **Project**: ${context.stack.projectName}\n`;
|
|
293
|
+
formatted += `- **Frontend**: ${context.stack.frontend}\n`;
|
|
294
|
+
formatted += `- **Backend**: ${context.stack.backend}\n`;
|
|
295
|
+
if (context.stack.database !== "none") {
|
|
296
|
+
formatted += `- **Database**: ${context.stack.database}\n`;
|
|
297
|
+
}
|
|
298
|
+
if (context.stack.orm !== "none") {
|
|
299
|
+
formatted += `- **ORM**: ${context.stack.orm}\n`;
|
|
300
|
+
}
|
|
301
|
+
formatted += `- **Auth**: ${context.stack.auth}\n`;
|
|
302
|
+
if (context.stack.addons.length > 0) {
|
|
303
|
+
formatted += `- **Addons**: ${context.stack.addons.join(", ")}\n`;
|
|
304
|
+
}
|
|
305
|
+
formatted += `- **Package Manager**: ${context.stack.packageManager}\n`;
|
|
306
|
+
formatted += `\n`;
|
|
307
|
+
}
|
|
308
|
+
if (context.documentation) {
|
|
309
|
+
formatted += `## Available Documentation\n`;
|
|
310
|
+
formatted += `**Recap**: ${context.documentation.recap}\n\n`;
|
|
311
|
+
if (context.documentation.files.length > 0) {
|
|
312
|
+
formatted += `### Documentation Files\n\n`;
|
|
313
|
+
context.documentation.files.forEach((file, index) => {
|
|
314
|
+
formatted += `#### ${index + 1}. ${file.path}\n`;
|
|
315
|
+
// formatted += `${file.content}\n\n`;
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return formatted;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
exports.ContextBuilder = ContextBuilder;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ExecutorConfig, ExternalExecutor } from "../../types";
|
|
2
|
+
export declare class ClaudeCodeExecutor implements ExternalExecutor {
|
|
3
|
+
name: string;
|
|
4
|
+
private config?;
|
|
5
|
+
constructor(config?: ExecutorConfig);
|
|
6
|
+
supportsSessionResumption(): boolean;
|
|
7
|
+
execute(message: string, dry?: boolean, config?: ExecutorConfig): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=claude-code-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code-executor.d.ts","sourceRoot":"","sources":["../../../src/lib/executors/claude-code-executor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpE,qBAAa,kBAAmB,YAAW,gBAAgB;IACzD,IAAI,SAAY;IAChB,OAAO,CAAC,MAAM,CAAC,CAAiB;gBAEpB,MAAM,CAAC,EAAE,cAAc;IAInC,yBAAyB,IAAI,OAAO;IAI9B,OAAO,CACX,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,OAAe,EACpB,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC;CA6DjB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClaudeCodeExecutor = void 0;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const logger_1 = require("../logger");
|
|
6
|
+
class ClaudeCodeExecutor {
|
|
7
|
+
name = "claude";
|
|
8
|
+
config;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.config = config;
|
|
11
|
+
}
|
|
12
|
+
supportsSessionResumption() {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
async execute(message, dry = false, config) {
|
|
16
|
+
// Merge constructor config with execution config (execution takes precedence)
|
|
17
|
+
const finalConfig = { ...this.config, ...config };
|
|
18
|
+
// Build arguments array
|
|
19
|
+
const args = [];
|
|
20
|
+
// Add model if specified
|
|
21
|
+
if (finalConfig.model) {
|
|
22
|
+
args.push("--model", finalConfig.model);
|
|
23
|
+
logger_1.logger.progress(`🤖 Using model: ${finalConfig.model}`);
|
|
24
|
+
}
|
|
25
|
+
// Add session resumption if specified
|
|
26
|
+
if (finalConfig.continueLastSession) {
|
|
27
|
+
args.push("-c");
|
|
28
|
+
logger_1.logger.progress("🔄 Continuing last session");
|
|
29
|
+
}
|
|
30
|
+
else if (finalConfig.sessionId) {
|
|
31
|
+
args.push("-r", finalConfig.sessionId);
|
|
32
|
+
logger_1.logger.progress(`🔄 Resuming session: ${finalConfig.sessionId}`);
|
|
33
|
+
}
|
|
34
|
+
// Add --print for non-interactive mode (required for automation)
|
|
35
|
+
// args.push("-p");
|
|
36
|
+
// Auto-approve file edits for automation
|
|
37
|
+
args.push("--permission-mode", "acceptEdits");
|
|
38
|
+
// Add prompt as positional argument
|
|
39
|
+
args.push(message);
|
|
40
|
+
if (dry) {
|
|
41
|
+
logger_1.logger.progress(`🔧 Using executor: ${this.name}`);
|
|
42
|
+
logger_1.logger.progress(`claude ${args.join(" ")}`);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
// Launch claude and wait for it to complete
|
|
46
|
+
const child = (0, node_child_process_1.spawn)("claude", args, {
|
|
47
|
+
stdio: "inherit", // Give tool full terminal control
|
|
48
|
+
});
|
|
49
|
+
// Wait for completion (blocking)
|
|
50
|
+
await new Promise((resolve, reject) => {
|
|
51
|
+
child.on("close", (code) => {
|
|
52
|
+
if (code === 0) {
|
|
53
|
+
logger_1.logger.success("✅ Claude Code execution completed successfully");
|
|
54
|
+
resolve();
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
const error = new Error(`Claude Code exited with code ${code}`);
|
|
58
|
+
logger_1.logger.error(`❌ ${error.message}`);
|
|
59
|
+
reject(error);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
child.on("error", (error) => {
|
|
63
|
+
logger_1.logger.error(`❌ Failed to launch Claude Code: ${error.message}`);
|
|
64
|
+
reject(error);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.ClaudeCodeExecutor = ClaudeCodeExecutor;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ExecutorConfig, ExternalExecutor } from "../../types";
|
|
2
|
+
export declare class CodexExecutor implements ExternalExecutor {
|
|
3
|
+
name: string;
|
|
4
|
+
private config?;
|
|
5
|
+
constructor(config?: ExecutorConfig);
|
|
6
|
+
supportsSessionResumption(): boolean;
|
|
7
|
+
execute(message: string, dry?: boolean, config?: ExecutorConfig): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=codex-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-executor.d.ts","sourceRoot":"","sources":["../../../src/lib/executors/codex-executor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpE,qBAAa,aAAc,YAAW,gBAAgB;IACpD,IAAI,SAAW;IACf,OAAO,CAAC,MAAM,CAAC,CAAiB;gBAEpB,MAAM,CAAC,EAAE,cAAc;IAInC,yBAAyB,IAAI,OAAO;IAI9B,OAAO,CACX,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,OAAe,EACpB,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC;CA+DjB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodexExecutor = void 0;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const logger_1 = require("../logger");
|
|
6
|
+
class CodexExecutor {
|
|
7
|
+
name = "codex";
|
|
8
|
+
config;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.config = config;
|
|
11
|
+
}
|
|
12
|
+
supportsSessionResumption() {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
async execute(message, dry = false, config) {
|
|
16
|
+
// Merge constructor config with execution config (execution takes precedence)
|
|
17
|
+
const finalConfig = { ...this.config, ...config };
|
|
18
|
+
// Build arguments array - structure depends on session resumption
|
|
19
|
+
const args = [];
|
|
20
|
+
// Add model via config if specified (codex uses -c for config overrides)
|
|
21
|
+
if (finalConfig.model) {
|
|
22
|
+
args.push("-c", `model="${finalConfig.model}"`);
|
|
23
|
+
logger_1.logger.progress(`🤖 Using model: ${finalConfig.model}`);
|
|
24
|
+
}
|
|
25
|
+
// Session resumption uses different subcommand
|
|
26
|
+
if (finalConfig.continueLastSession) {
|
|
27
|
+
// Use 'exec resume --last' subcommand
|
|
28
|
+
args.push("exec", "resume", "--last");
|
|
29
|
+
logger_1.logger.progress("🔄 Continuing last session");
|
|
30
|
+
}
|
|
31
|
+
else if (finalConfig.sessionId) {
|
|
32
|
+
// Use 'exec resume <session-id>' subcommand
|
|
33
|
+
args.push("exec", "resume", finalConfig.sessionId);
|
|
34
|
+
logger_1.logger.progress(`🔄 Resuming session: ${finalConfig.sessionId}`);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
// Normal execution
|
|
38
|
+
args.push("exec");
|
|
39
|
+
}
|
|
40
|
+
// Add full write access for automation
|
|
41
|
+
args.push("--sandbox", "workspace-write");
|
|
42
|
+
// Add prompt as positional argument
|
|
43
|
+
args.push(message);
|
|
44
|
+
if (dry) {
|
|
45
|
+
logger_1.logger.progress(`🔧 Using executor: ${this.name}`);
|
|
46
|
+
logger_1.logger.progress(`codex ${args.join(" ")}`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// Launch codex and wait for it to complete
|
|
50
|
+
const child = (0, node_child_process_1.spawn)("codex", args, {
|
|
51
|
+
stdio: "inherit", // Give tool full terminal control
|
|
52
|
+
});
|
|
53
|
+
// Wait for completion (blocking)
|
|
54
|
+
await new Promise((resolve, reject) => {
|
|
55
|
+
child.on("close", (code) => {
|
|
56
|
+
if (code === 0) {
|
|
57
|
+
logger_1.logger.success("✅ Codex CLI execution completed successfully");
|
|
58
|
+
resolve();
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const error = new Error(`Codex CLI exited with code ${code}`);
|
|
62
|
+
logger_1.logger.error(`❌ ${error.message}`);
|
|
63
|
+
reject(error);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
child.on("error", (error) => {
|
|
67
|
+
logger_1.logger.error(`❌ Failed to launch Codex CLI: ${error.message}`);
|
|
68
|
+
reject(error);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.CodexExecutor = CodexExecutor;
|
|
@@ -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,cAAc,EAAE,MAAM,aAAa,CAAC;AAO7E,qBAAa,eAAe;IAC1B,MAAM,CAAC,MAAM,CACX,IAAI,GAAE,YAAyB,EAC/B,MAAM,CAAC,EAAE,cAAc,GACtB,gBAAgB;CAgBpB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExecutorFactory = void 0;
|
|
4
|
+
const opencode_executor_1 = require("./opencode-executor");
|
|
5
|
+
const claude_code_executor_1 = require("./claude-code-executor");
|
|
6
|
+
const gemini_executor_1 = require("./gemini-executor");
|
|
7
|
+
const codex_executor_1 = require("./codex-executor");
|
|
8
|
+
const kilo_executor_1 = require("./kilo-executor");
|
|
9
|
+
class ExecutorFactory {
|
|
10
|
+
static create(tool = "opencode", config) {
|
|
11
|
+
switch (tool) {
|
|
12
|
+
case "opencode":
|
|
13
|
+
return new opencode_executor_1.OpencodeExecutor(config);
|
|
14
|
+
case "claude":
|
|
15
|
+
return new claude_code_executor_1.ClaudeCodeExecutor(config);
|
|
16
|
+
case "gemini":
|
|
17
|
+
return new gemini_executor_1.GeminiExecutor(config);
|
|
18
|
+
case "codex":
|
|
19
|
+
return new codex_executor_1.CodexExecutor(config);
|
|
20
|
+
case "kilo":
|
|
21
|
+
return new kilo_executor_1.KiloExecutor(config);
|
|
22
|
+
default:
|
|
23
|
+
throw new Error(`Unknown executor tool: ${tool}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.ExecutorFactory = ExecutorFactory;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ExecutorConfig, ExternalExecutor } from "../../types";
|
|
2
|
+
export declare class GeminiExecutor implements ExternalExecutor {
|
|
3
|
+
name: string;
|
|
4
|
+
private config?;
|
|
5
|
+
constructor(config?: ExecutorConfig);
|
|
6
|
+
supportsSessionResumption(): boolean;
|
|
7
|
+
execute(message: string, dry?: boolean, config?: ExecutorConfig): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=gemini-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini-executor.d.ts","sourceRoot":"","sources":["../../../src/lib/executors/gemini-executor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpE,qBAAa,cAAe,YAAW,gBAAgB;IACrD,IAAI,SAAY;IAChB,OAAO,CAAC,MAAM,CAAC,CAAiB;gBAEpB,MAAM,CAAC,EAAE,cAAc;IAInC,yBAAyB,IAAI,OAAO;IAI9B,OAAO,CACX,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,OAAe,EACpB,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC;CA0DjB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GeminiExecutor = void 0;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
const logger_1 = require("../logger");
|
|
6
|
+
class GeminiExecutor {
|
|
7
|
+
name = "gemini";
|
|
8
|
+
config;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.config = config;
|
|
11
|
+
}
|
|
12
|
+
supportsSessionResumption() {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
async execute(message, dry = false, config) {
|
|
16
|
+
// Merge constructor config with execution config (execution takes precedence)
|
|
17
|
+
const finalConfig = { ...this.config, ...config };
|
|
18
|
+
// Build arguments array
|
|
19
|
+
const args = [];
|
|
20
|
+
// Add model if specified
|
|
21
|
+
if (finalConfig.model) {
|
|
22
|
+
args.push("-m", finalConfig.model);
|
|
23
|
+
logger_1.logger.progress(`🤖 Using model: ${finalConfig.model}`);
|
|
24
|
+
}
|
|
25
|
+
// Add session resumption if specified
|
|
26
|
+
if (finalConfig.continueLastSession) {
|
|
27
|
+
args.push("-r", "latest");
|
|
28
|
+
logger_1.logger.progress("🔄 Continuing last session");
|
|
29
|
+
}
|
|
30
|
+
else if (finalConfig.sessionId) {
|
|
31
|
+
args.push("-r", finalConfig.sessionId);
|
|
32
|
+
logger_1.logger.progress(`🔄 Resuming session: ${finalConfig.sessionId}`);
|
|
33
|
+
}
|
|
34
|
+
// Enable auto-approval of all tools (yolo mode) - required for file writes
|
|
35
|
+
args.push("--yolo");
|
|
36
|
+
// Add prompt as positional argument (the -p flag is deprecated)
|
|
37
|
+
args.push(message);
|
|
38
|
+
if (dry) {
|
|
39
|
+
logger_1.logger.progress(`🔧 Using executor: ${this.name}`);
|
|
40
|
+
logger_1.logger.progress(`gemini ${args.join(" ")}`);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
// Launch gemini and wait for it to complete
|
|
44
|
+
const child = (0, node_child_process_1.spawn)("gemini", args, {
|
|
45
|
+
stdio: "inherit", // Give tool full terminal control
|
|
46
|
+
});
|
|
47
|
+
// Wait for completion (blocking)
|
|
48
|
+
await new Promise((resolve, reject) => {
|
|
49
|
+
child.on("close", (code) => {
|
|
50
|
+
if (code === 0) {
|
|
51
|
+
logger_1.logger.success("✅ Gemini CLI execution completed successfully");
|
|
52
|
+
resolve();
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const error = new Error(`Gemini CLI exited with code ${code}`);
|
|
56
|
+
logger_1.logger.error(`❌ ${error.message}`);
|
|
57
|
+
reject(error);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
child.on("error", (error) => {
|
|
61
|
+
logger_1.logger.error(`❌ Failed to launch Gemini CLI: ${error.message}`);
|
|
62
|
+
reject(error);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.GeminiExecutor = GeminiExecutor;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ExecutorConfig, ExternalExecutor } from "../../types";
|
|
2
|
+
export declare class KiloExecutor implements ExternalExecutor {
|
|
3
|
+
name: string;
|
|
4
|
+
private config?;
|
|
5
|
+
constructor(config?: ExecutorConfig);
|
|
6
|
+
supportsSessionResumption(): boolean;
|
|
7
|
+
execute(message: string, dry?: boolean, config?: ExecutorConfig): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=kilo-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kilo-executor.d.ts","sourceRoot":"","sources":["../../../src/lib/executors/kilo-executor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpE,qBAAa,YAAa,YAAW,gBAAgB;IACnD,IAAI,SAAU;IACd,OAAO,CAAC,MAAM,CAAC,CAAiB;gBAEpB,MAAM,CAAC,EAAE,cAAc;IAInC,yBAAyB,IAAI,OAAO;IAI9B,OAAO,CACX,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,OAAe,EACpB,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,IAAI,CAAC;CA6DjB"}
|