task-o-matic 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/init.js +41 -8
- package/dist/commands/tasks/create.d.ts.map +1 -1
- package/dist/commands/tasks/create.js +6 -13
- package/dist/commands/tasks/document/add.d.ts +3 -0
- package/dist/commands/tasks/document/add.d.ts.map +1 -0
- package/dist/commands/tasks/document/add.js +35 -0
- package/dist/commands/tasks/document/analyze.d.ts +3 -0
- package/dist/commands/tasks/document/analyze.d.ts.map +1 -0
- package/dist/commands/tasks/document/analyze.js +49 -0
- package/dist/commands/tasks/document/get.d.ts +3 -0
- package/dist/commands/tasks/document/get.d.ts.map +1 -0
- package/dist/commands/tasks/document/get.js +29 -0
- package/dist/commands/tasks/document/index.d.ts +8 -0
- package/dist/commands/tasks/document/index.d.ts.map +1 -0
- package/dist/commands/tasks/document/index.js +13 -0
- package/dist/commands/tasks/enhance.d.ts.map +1 -1
- package/dist/commands/tasks/enhance.js +64 -61
- package/dist/commands/tasks/execute-loop.d.ts.map +1 -1
- package/dist/commands/tasks/execute-loop.js +64 -90
- package/dist/commands/tasks/execute.d.ts.map +1 -1
- package/dist/commands/tasks/execute.js +52 -16
- package/dist/commands/tasks/list.js +2 -2
- package/dist/commands/tasks/next.js +4 -4
- package/dist/commands/tasks/plan/create.d.ts +3 -0
- package/dist/commands/tasks/plan/create.d.ts.map +1 -0
- package/dist/commands/tasks/plan/create.js +37 -0
- package/dist/commands/tasks/plan/delete.d.ts +3 -0
- package/dist/commands/tasks/plan/delete.d.ts.map +1 -0
- package/dist/commands/tasks/plan/delete.js +14 -0
- package/dist/commands/tasks/plan/get.d.ts +3 -0
- package/dist/commands/tasks/plan/get.d.ts.map +1 -0
- package/dist/commands/tasks/plan/get.js +24 -0
- package/dist/commands/tasks/plan/index.d.ts +10 -0
- package/dist/commands/tasks/plan/index.d.ts.map +1 -0
- package/dist/commands/tasks/plan/index.js +17 -0
- package/dist/commands/tasks/plan/list.d.ts +3 -0
- package/dist/commands/tasks/plan/list.d.ts.map +1 -0
- package/dist/commands/tasks/plan/list.js +21 -0
- package/dist/commands/tasks/plan/set.d.ts +3 -0
- package/dist/commands/tasks/plan/set.d.ts.map +1 -0
- package/dist/commands/tasks/plan/set.js +33 -0
- package/dist/commands/tasks/split.d.ts.map +1 -1
- package/dist/commands/tasks/split.js +65 -60
- package/dist/commands/tasks/status.js +2 -2
- package/dist/lib/ai-service/ai-operations.d.ts +1 -1
- package/dist/lib/ai-service/ai-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/base-operations.d.ts +22 -0
- package/dist/lib/ai-service/base-operations.d.ts.map +1 -1
- package/dist/lib/ai-service/base-operations.js +29 -1
- package/dist/lib/ai-service/task-operations.d.ts +1 -1
- package/dist/lib/ai-service/task-operations.d.ts.map +1 -1
- package/dist/lib/better-t-stack-cli.d.ts +36 -21
- package/dist/lib/better-t-stack-cli.d.ts.map +1 -1
- package/dist/lib/better-t-stack-cli.js +212 -33
- 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 +325 -0
- package/dist/lib/bootstrap/index.d.ts +4 -0
- package/dist/lib/bootstrap/index.d.ts.map +1 -0
- package/dist/lib/bootstrap/index.js +19 -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 +218 -0
- package/dist/lib/bootstrap/opentui-bootstrap.d.ts +11 -0
- package/dist/lib/bootstrap/opentui-bootstrap.d.ts.map +1 -0
- package/dist/lib/bootstrap/opentui-bootstrap.js +342 -0
- package/dist/lib/config.d.ts +14 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +18 -0
- package/dist/lib/git-utils.d.ts +45 -0
- package/dist/lib/git-utils.d.ts.map +1 -0
- package/dist/lib/git-utils.js +160 -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 +360 -0
- package/dist/lib/task-execution.d.ts +4 -0
- package/dist/lib/task-execution.d.ts.map +1 -1
- package/dist/lib/task-execution.js +31 -149
- package/dist/lib/task-loop-execution.d.ts +1 -19
- package/dist/lib/task-loop-execution.d.ts.map +1 -1
- package/dist/lib/task-loop-execution.js +50 -585
- package/dist/lib/task-planning.d.ts +28 -0
- package/dist/lib/task-planning.d.ts.map +1 -0
- package/dist/lib/task-planning.js +109 -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 +106 -0
- package/dist/lib/validation.d.ts +20 -3
- package/dist/lib/validation.d.ts.map +1 -1
- package/dist/lib/validation.js +39 -10
- package/dist/services/prd.d.ts.map +1 -1
- package/dist/services/prd.js +18 -45
- package/dist/services/tasks.d.ts +2 -2
- package/dist/services/tasks.d.ts.map +1 -1
- package/dist/services/tasks.js +55 -85
- package/dist/test/task-loop-git.test.js +6 -6
- package/dist/types/cli-options.d.ts +138 -0
- package/dist/types/cli-options.d.ts.map +1 -0
- package/dist/types/cli-options.js +6 -0
- package/dist/types/index.d.ts +74 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/results.d.ts +60 -6
- package/dist/types/results.d.ts.map +1 -1
- package/dist/utils/bulk-operations.d.ts +51 -0
- package/dist/utils/bulk-operations.d.ts.map +1 -0
- package/dist/utils/bulk-operations.js +68 -0
- package/dist/utils/cli-validators.d.ts +54 -0
- package/dist/utils/cli-validators.d.ts.map +1 -0
- package/dist/utils/cli-validators.js +75 -0
- package/dist/utils/command-error-handler.d.ts +32 -0
- package/dist/utils/command-error-handler.d.ts.map +1 -0
- package/dist/utils/command-error-handler.js +52 -0
- package/dist/utils/confirmation.d.ts +19 -0
- package/dist/utils/confirmation.d.ts.map +1 -0
- package/dist/utils/confirmation.js +39 -0
- package/dist/utils/display-helpers.d.ts +81 -0
- package/dist/utils/display-helpers.d.ts.map +1 -0
- package/dist/utils/display-helpers.js +109 -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 +103 -0
- package/dist/utils/file-utils.d.ts +49 -0
- package/dist/utils/file-utils.d.ts.map +1 -0
- package/dist/utils/file-utils.js +77 -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 +140 -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 +67 -0
- package/dist/utils/progress-tracking.d.ts +28 -0
- package/dist/utils/progress-tracking.d.ts.map +1 -0
- package/dist/utils/progress-tracking.js +43 -0
- package/dist/utils/stack-formatter.d.ts +2 -1
- package/dist/utils/stack-formatter.d.ts.map +1 -1
- package/dist/utils/stack-formatter.js +8 -2
- 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 +79 -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 +56 -0
- package/docs/agents/cli.md +58 -149
- package/package.json +1 -1
- package/dist/commands/tasks/document.d.ts +0 -5
- package/dist/commands/tasks/document.d.ts.map +0 -1
- package/dist/commands/tasks/document.js +0 -118
- package/dist/commands/tasks/plan.d.ts +0 -7
- package/dist/commands/tasks/plan.d.ts.map +0 -1
- package/dist/commands/tasks/plan.js +0 -131
|
@@ -7,14 +7,21 @@ exports.splitCommand = void 0;
|
|
|
7
7
|
const commander_1 = require("commander");
|
|
8
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
9
|
const tasks_1 = require("../../services/tasks");
|
|
10
|
-
const hooks_1 = require("../../lib/hooks");
|
|
11
10
|
const streaming_options_1 = require("../../utils/streaming-options");
|
|
12
|
-
const progress_1 = require("../../cli/display/progress");
|
|
13
11
|
const task_1 = require("../../cli/display/task");
|
|
12
|
+
const progress_tracking_1 = require("../../utils/progress-tracking");
|
|
13
|
+
const cli_validators_1 = require("../../utils/cli-validators");
|
|
14
|
+
const bulk_operations_1 = require("../../utils/bulk-operations");
|
|
15
|
+
const confirmation_1 = require("../../utils/confirmation");
|
|
16
|
+
const command_error_handler_1 = require("../../utils/command-error-handler");
|
|
14
17
|
exports.splitCommand = new commander_1.Command("split")
|
|
15
18
|
.description("Split a task into smaller subtasks using AI")
|
|
16
19
|
.option("--task-id <id>", "Task ID to split")
|
|
17
20
|
.option("--all", "Split all existing tasks that don't have subtasks")
|
|
21
|
+
.option("--status <status>", "Filter tasks by status (todo/in-progress/completed)")
|
|
22
|
+
.option("--tag <tag>", "Filter tasks by tag")
|
|
23
|
+
.option("--dry", "Preview what would be split without making changes")
|
|
24
|
+
.option("--force", "Skip confirmation prompt for bulk operations")
|
|
18
25
|
.option("--stream", "Show streaming AI output during breakdown")
|
|
19
26
|
.option("--ai-provider <provider>", "AI provider override")
|
|
20
27
|
.option("--ai-model <model>", "AI model override")
|
|
@@ -22,74 +29,72 @@ exports.splitCommand = new commander_1.Command("split")
|
|
|
22
29
|
.option("--ai-provider-url <url>", "AI provider URL override")
|
|
23
30
|
.option("--reasoning <tokens>", "Enable reasoning for OpenRouter models (max reasoning tokens)")
|
|
24
31
|
.option("--tools", "Enable filesystem tools for project analysis")
|
|
25
|
-
.action(async (options) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
.action((0, command_error_handler_1.wrapCommandHandler)("Task splitting", async (options) => {
|
|
33
|
+
// Validate mutual exclusivity (only if no filters provided)
|
|
34
|
+
if (!options.status && !options.tag) {
|
|
35
|
+
(0, cli_validators_1.validateMutuallyExclusive)(options, "taskId", "all", "task-id", "all");
|
|
36
|
+
}
|
|
37
|
+
const splitSingleTask = async (taskId) => {
|
|
38
|
+
if (options.dry) {
|
|
39
|
+
const task = await tasks_1.taskService.getTask(taskId);
|
|
40
|
+
console.log(chalk_1.default.blue(`[DRY RUN] Would split: ${task?.title || taskId}`));
|
|
41
|
+
return;
|
|
32
42
|
}
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
(
|
|
37
|
-
};
|
|
38
|
-
hooks_1.hooks.on("task:progress", progressHandler);
|
|
39
|
-
try {
|
|
40
|
-
const result = await tasks_1.taskService.splitTask(taskId, {
|
|
43
|
+
const streamingOptions = (0, streaming_options_1.createStreamingOptions)(options.stream, "Task breakdown");
|
|
44
|
+
try {
|
|
45
|
+
const result = await (0, progress_tracking_1.withProgressTracking)(async () => {
|
|
46
|
+
return await tasks_1.taskService.splitTask(taskId, {
|
|
41
47
|
aiProvider: options.aiProvider,
|
|
42
48
|
aiModel: options.aiModel,
|
|
43
49
|
aiKey: options.aiKey,
|
|
44
50
|
aiProviderUrl: options.aiProviderUrl,
|
|
45
51
|
aiReasoning: options.reasoning,
|
|
46
52
|
}, undefined, undefined, streamingOptions, options.tools);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
catch (error) {
|
|
58
|
-
if (error instanceof Error && error.message.includes("already has")) {
|
|
59
|
-
console.log(chalk_1.default.yellow(`⚠️ ${error.message}`));
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
64
|
-
finally {
|
|
65
|
-
hooks_1.hooks.off("task:progress", progressHandler);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
if (options.taskId) {
|
|
69
|
-
await splitSingleTask(options.taskId);
|
|
53
|
+
});
|
|
54
|
+
(0, task_1.displaySubtaskCreation)(result.subtasks);
|
|
55
|
+
// Display AI metadata
|
|
56
|
+
console.log(chalk_1.default.gray(`\n📊 AI Splitting Details:`));
|
|
57
|
+
console.log(chalk_1.default.gray(` Provider: ${result.metadata.aiProvider}`));
|
|
58
|
+
console.log(chalk_1.default.gray(` Model: ${result.metadata.aiModel}`));
|
|
59
|
+
console.log(chalk_1.default.gray(` Subtasks created: ${result.subtasks.length}`));
|
|
60
|
+
console.log(chalk_1.default.gray(` Confidence: ${result.metadata.confidence
|
|
61
|
+
? (result.metadata.confidence * 100).toFixed(1)
|
|
62
|
+
: "N/A"}%`));
|
|
70
63
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
console.log(chalk_1.default.yellow("No tasks found to split."));
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (error instanceof Error && error.message.includes("already has")) {
|
|
66
|
+
console.log(chalk_1.default.yellow(`⚠️ ${error.message}`));
|
|
75
67
|
return;
|
|
76
68
|
}
|
|
77
|
-
|
|
78
|
-
for (let i = 0; i < allTasks.length; i++) {
|
|
79
|
-
const task = allTasks[i];
|
|
80
|
-
console.log(chalk_1.default.cyan(`\n[${i + 1}/${allTasks.length}] Splitting: ${task.title}`));
|
|
81
|
-
try {
|
|
82
|
-
await splitSingleTask(task.id);
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
console.log(chalk_1.default.red(`❌ Failed to split task ${task.id}: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
console.log(chalk_1.default.green(`\n✓ Bulk splitting complete! Processed ${allTasks.length} tasks.`));
|
|
69
|
+
throw error;
|
|
89
70
|
}
|
|
71
|
+
};
|
|
72
|
+
if (options.taskId) {
|
|
73
|
+
await splitSingleTask(options.taskId);
|
|
90
74
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
75
|
+
else {
|
|
76
|
+
// Build filters for bulk operation
|
|
77
|
+
const filters = {};
|
|
78
|
+
if (options.status)
|
|
79
|
+
filters.status = options.status;
|
|
80
|
+
if (options.tag)
|
|
81
|
+
filters.tag = options.tag;
|
|
82
|
+
// Get task count for confirmation
|
|
83
|
+
const tasks = await tasks_1.taskService.listTasks(filters);
|
|
84
|
+
if (tasks.length === 0) {
|
|
85
|
+
console.log(chalk_1.default.yellow("No tasks found matching the filters"));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
// Confirm bulk operation
|
|
89
|
+
const confirmed = await (0, confirmation_1.confirmBulkOperation)("split", tasks.length, options.force);
|
|
90
|
+
if (!confirmed) {
|
|
91
|
+
console.log(chalk_1.default.yellow("Operation cancelled"));
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
await (0, bulk_operations_1.executeBulkOperation)((taskId) => splitSingleTask(taskId), {
|
|
95
|
+
operationName: "Splitting",
|
|
96
|
+
operationEmoji: "🔧",
|
|
97
|
+
filters,
|
|
98
|
+
});
|
|
94
99
|
}
|
|
95
|
-
});
|
|
100
|
+
}));
|
|
@@ -7,8 +7,8 @@ const task_1 = require("../../cli/display/task");
|
|
|
7
7
|
const progress_1 = require("../../cli/display/progress");
|
|
8
8
|
exports.statusCommand = new commander_1.Command("status")
|
|
9
9
|
.description("Set task status")
|
|
10
|
-
.requiredOption("--id <id>", "Task ID")
|
|
11
|
-
.requiredOption("--status <status>", "New status (todo/in-progress/completed)")
|
|
10
|
+
.requiredOption("-i, --id <id>", "Task ID")
|
|
11
|
+
.requiredOption("-s, --status <status>", "New status (todo/in-progress/completed)")
|
|
12
12
|
.action(async (options) => {
|
|
13
13
|
try {
|
|
14
14
|
const task = await tasks_1.taskService.getTask(options.id);
|
|
@@ -36,6 +36,6 @@ export declare class AIOperations extends BaseOperations {
|
|
|
36
36
|
library: string;
|
|
37
37
|
content: string;
|
|
38
38
|
}>, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>): Promise<string>;
|
|
39
|
-
planTask(taskContext: string, taskDetails: string, config?: Partial<AIConfig>, promptOverride?: string, userMessage?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>): Promise<
|
|
39
|
+
planTask(taskContext: string, taskDetails: string, config?: Partial<AIConfig>, promptOverride?: string, userMessage?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>): Promise<string>;
|
|
40
40
|
}
|
|
41
41
|
//# sourceMappingURL=ai-operations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/ai-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKnD;;;GAGG;AACH,qBAAa,YAAa,SAAQ,cAAc;IAC9C,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,MAAM,CAAiC;IAIzC,QAAQ,CACZ,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAClC,gBAAgB,CAAC,EAAE,MAAM,EACzB,qBAAqB,CAAC,EAAE,OAAO,GAC9B,OAAO,CAAC,gBAAgB,CAAC;IAetB,aAAa,CACjB,IAAI,EAAE,IAAI,EACV,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,E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W,CAAC,EAClC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,gBAAgB,CAAC,EAAE,CAAC,iBAAiB,GAAG,SAAS,CAAC,EAAE,GACnD,OAAO,CAAC,sBAAsB,CAAC;IAa5B,0BAA0B,CAC9B,SAAS,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,EACtE,gBAAgB,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,EAC7D,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;IASZ,QAAQ,CACZ,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;CAWnB"}
|
|
@@ -8,6 +8,28 @@ export declare class BaseOperations {
|
|
|
8
8
|
protected context7Client: Context7Client;
|
|
9
9
|
protected retryHandler: RetryHandler;
|
|
10
10
|
protected modelProvider: ModelProvider;
|
|
11
|
+
/**
|
|
12
|
+
* Merges AI configuration with proper precedence.
|
|
13
|
+
*
|
|
14
|
+
* Configuration precedence (highest to lowest):
|
|
15
|
+
* 1. Method parameter `config` (operation-specific overrides)
|
|
16
|
+
* 2. ConfigManager global config (project-level settings)
|
|
17
|
+
* 3. Environment variables (OPENAI_API_KEY, etc.)
|
|
18
|
+
* 4. Provider defaults (defined in config.ts)
|
|
19
|
+
*
|
|
20
|
+
* @param config - Optional operation-specific config overrides
|
|
21
|
+
* @returns Merged AIConfig with all precedence levels applied
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // Override just the model for this operation
|
|
26
|
+
* const finalConfig = this.mergeAIConfig({ model: "gpt-4o" });
|
|
27
|
+
*
|
|
28
|
+
* // Use default config (from ConfigManager + env vars)
|
|
29
|
+
* const finalConfig = this.mergeAIConfig();
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
protected mergeAIConfig(config?: Partial<AIConfig>): AIConfig;
|
|
11
33
|
streamText(prompt: string, config?: Partial<AIConfig>, systemPrompt?: string, userMessage?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>): Promise<string>;
|
|
12
34
|
}
|
|
13
35
|
//# sourceMappingURL=base-operations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/base-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,qBAAa,cAAc;IACzB,SAAS,CAAC,UAAU,aAAoB;IACxC,SAAS,CAAC,cAAc,iBAAwB;IAChD,SAAS,CAAC,YAAY,eAAsB;IAC5C,SAAS,CAAC,aAAa,gBAAuB;
|
|
1
|
+
{"version":3,"file":"base-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/base-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,qBAAa,cAAc;IACzB,SAAS,CAAC,UAAU,aAAoB;IACxC,SAAS,CAAC,cAAc,iBAAwB;IAChD,SAAS,CAAC,YAAY,eAAsB;IAC5C,SAAS,CAAC,aAAa,gBAAuB;IAE9C;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ;IAQvD,UAAU,CACd,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;CAgFnB"}
|
|
@@ -11,8 +11,36 @@ class BaseOperations {
|
|
|
11
11
|
context7Client = new mcp_client_1.Context7Client();
|
|
12
12
|
retryHandler = new retry_handler_1.RetryHandler();
|
|
13
13
|
modelProvider = new model_provider_1.ModelProvider();
|
|
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
|
+
mergeAIConfig(config) {
|
|
36
|
+
// Get base config (includes ConfigManager + env vars + defaults)
|
|
37
|
+
const baseConfig = this.modelProvider.getAIConfig();
|
|
38
|
+
// Apply operation-specific overrides (highest priority)
|
|
39
|
+
return { ...baseConfig, ...config };
|
|
40
|
+
}
|
|
14
41
|
async streamText(prompt, config, systemPrompt, userMessage, streamingOptions, retryConfig) {
|
|
15
|
-
|
|
42
|
+
// Merge config with proper precedence (Bug fix 2.9)
|
|
43
|
+
const aiConfig = this.mergeAIConfig(config);
|
|
16
44
|
return this.retryHandler.executeWithRetry(async () => {
|
|
17
45
|
const model = this.modelProvider.getModel(aiConfig);
|
|
18
46
|
const result = (0, ai_1.streamText)({
|
|
@@ -7,6 +7,6 @@ export declare class TaskOperations extends BaseOperations {
|
|
|
7
7
|
estimatedEffort?: string;
|
|
8
8
|
}>>;
|
|
9
9
|
enhanceTask(title: string, description?: string, config?: Partial<AIConfig>, promptOverride?: string, userMessage?: string, taskId?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>): Promise<string>;
|
|
10
|
-
planTask(taskContext: string, taskDetails: string, config?: Partial<AIConfig>, promptOverride?: string, userMessage?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>): Promise<
|
|
10
|
+
planTask(taskContext: string, taskDetails: string, config?: Partial<AIConfig>, promptOverride?: string, userMessage?: string, streamingOptions?: StreamingOptions, retryConfig?: Partial<RetryConfig>): Promise<string>;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=task-operations.d.ts.map
|
|
@@ -1 +1 @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AAQ,CACZ,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC1B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACjC,OAAO,CAAC,MAAM,CAAC;CA6EnB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BTSConfig } from "../types";
|
|
1
|
+
import { BTSConfig, InitOptions } from "../types";
|
|
2
2
|
export declare class BetterTStackService {
|
|
3
3
|
createProject(name: string, config: BTSConfig, workingDirectory?: string): Promise<{
|
|
4
4
|
success: boolean;
|
|
@@ -10,26 +10,41 @@ export declare class BetterTStackService {
|
|
|
10
10
|
private addCheckTypesScript;
|
|
11
11
|
private copyDocumentation;
|
|
12
12
|
}
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
13
|
+
export declare class BetterTStackIntegration {
|
|
14
|
+
private btsService;
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Parse frontend option into array of frontends
|
|
18
|
+
*/
|
|
19
|
+
private parseFrontends;
|
|
20
|
+
/**
|
|
21
|
+
* Split frontends into Better-T-Stack frontends vs custom frontends
|
|
22
|
+
*/
|
|
23
|
+
private splitFrontends;
|
|
24
|
+
/**
|
|
25
|
+
* Create project with support for multiple frontends
|
|
26
|
+
*/
|
|
27
|
+
createProject(name: string, options: InitOptions, workingDirectory?: string): Promise<{
|
|
28
|
+
success: boolean;
|
|
29
|
+
message: string;
|
|
30
|
+
projectPath?: string;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Bootstrap Better-T-Stack project with one or more frontends
|
|
34
|
+
*/
|
|
35
|
+
private bootstrapBetterTStackProject;
|
|
36
|
+
/**
|
|
37
|
+
* Add CLI app to project (standalone or monorepo)
|
|
38
|
+
*/
|
|
39
|
+
private addCliToProject;
|
|
40
|
+
/**
|
|
41
|
+
* Add TUI app to project (standalone or monorepo)
|
|
42
|
+
*/
|
|
43
|
+
private addTuiToProject;
|
|
44
|
+
/**
|
|
45
|
+
* Add MedusaJS app to project (standalone or monorepo)
|
|
46
|
+
*/
|
|
47
|
+
private addMedusaToProject;
|
|
33
48
|
}
|
|
34
49
|
export declare function runBetterTStackCLI(options: InitOptions, workingDirectory?: string): Promise<{
|
|
35
50
|
success: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"better-t-stack-cli.d.ts","sourceRoot":"","sources":["../../src/lib/better-t-stack-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"better-t-stack-cli.d.ts","sourceRoot":"","sources":["../../src/lib/better-t-stack-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,WAAW,EAAE,MAAM,UAAU,CAAC;AAK/D,qBAAa,mBAAmB;IACxB,aAAa,CACjB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,SAAS,EACjB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC;QACT,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAqEF,OAAO,CAAC,kBAAkB;YA+BZ,aAAa;YAiCb,mBAAmB;YAiCnB,iBAAiB;CA+ChC;AAGD,qBAAa,uBAAuB;IAClC,OAAO,CAAC,UAAU,CAAsB;;IAMxC;;OAEG;IACH,OAAO,CAAC,cAAc;IAoBtB;;OAEG;IACH,OAAO,CAAC,cAAc;IAYtB;;OAEG;IACG,aAAa,CACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,WAAW,EACpB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAiFvE;;OAEG;YACW,4BAA4B;IA6C1C;;OAEG;YACW,eAAe;IAiC7B;;OAEG;YACW,eAAe;IA+B7B;;OAEG;YACW,kBAAkB;CAkCjC;AAGD,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,WAAW,EACpB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAOtE"}
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.BetterTStackService = void 0;
|
|
36
|
+
exports.BetterTStackIntegration = exports.BetterTStackService = void 0;
|
|
37
37
|
exports.runBetterTStackCLI = runBetterTStackCLI;
|
|
38
38
|
const config_1 = require("./config");
|
|
39
39
|
const fs_1 = require("fs");
|
|
@@ -99,9 +99,13 @@ class BetterTStackService {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
convertToAPIConfig(config) {
|
|
102
|
+
// Ensure frontend is always an array for Better-T-Stack API
|
|
103
|
+
const frontend = Array.isArray(config.frontend)
|
|
104
|
+
? config.frontend
|
|
105
|
+
: [config.frontend];
|
|
102
106
|
return {
|
|
103
107
|
// Don't use 'yes' flag when providing explicit configuration
|
|
104
|
-
frontend
|
|
108
|
+
frontend,
|
|
105
109
|
backend: config.backend,
|
|
106
110
|
runtime: config.runtime,
|
|
107
111
|
api: config.api,
|
|
@@ -210,36 +214,211 @@ class BetterTStackService {
|
|
|
210
214
|
}
|
|
211
215
|
}
|
|
212
216
|
exports.BetterTStackService = BetterTStackService;
|
|
217
|
+
// Helper methods for multi-frontend support
|
|
218
|
+
class BetterTStackIntegration {
|
|
219
|
+
btsService;
|
|
220
|
+
constructor() {
|
|
221
|
+
this.btsService = new BetterTStackService();
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Parse frontend option into array of frontends
|
|
225
|
+
*/
|
|
226
|
+
parseFrontends(frontendOption) {
|
|
227
|
+
if (!frontendOption)
|
|
228
|
+
return [];
|
|
229
|
+
// If already array, return it
|
|
230
|
+
if (Array.isArray(frontendOption))
|
|
231
|
+
return frontendOption;
|
|
232
|
+
// If string, split by comma or space
|
|
233
|
+
if (typeof frontendOption === "string") {
|
|
234
|
+
return frontendOption
|
|
235
|
+
.split(/[\s,]+/)
|
|
236
|
+
.map((f) => f.trim())
|
|
237
|
+
.filter(Boolean);
|
|
238
|
+
}
|
|
239
|
+
// Single value
|
|
240
|
+
return [frontendOption];
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Split frontends into Better-T-Stack frontends vs custom frontends
|
|
244
|
+
*/
|
|
245
|
+
splitFrontends(frontends) {
|
|
246
|
+
const customTypes = new Set(["cli", "tui", "opentui", "medusa"]);
|
|
247
|
+
return {
|
|
248
|
+
btsFrontends: frontends.filter((f) => !customTypes.has(f)),
|
|
249
|
+
customFrontends: frontends.filter((f) => customTypes.has(f)),
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Create project with support for multiple frontends
|
|
254
|
+
*/
|
|
255
|
+
async createProject(name, options, workingDirectory) {
|
|
256
|
+
const workingDir = workingDirectory || config_1.configManager.getWorkingDirectory();
|
|
257
|
+
const frontends = this.parseFrontends(options.frontend);
|
|
258
|
+
const { btsFrontends, customFrontends } = this.splitFrontends(frontends);
|
|
259
|
+
const isMonorepo = frontends.length > 1;
|
|
260
|
+
let projectPath = (0, path_1.join)(workingDir, name);
|
|
261
|
+
const results = [];
|
|
262
|
+
try {
|
|
263
|
+
// Step 1: Bootstrap Better-T-Stack project FIRST (if any BTS frontends)
|
|
264
|
+
// This creates the monorepo structure that CLI/TUI will be added to
|
|
265
|
+
if (btsFrontends.length > 0) {
|
|
266
|
+
const result = await this.bootstrapBetterTStackProject(name, btsFrontends, options, workingDir);
|
|
267
|
+
if (!result.success)
|
|
268
|
+
throw new Error(result.message);
|
|
269
|
+
// Get the actual project path from Better-T-Stack result
|
|
270
|
+
// This is the full path where the project was created
|
|
271
|
+
projectPath = (0, path_1.join)(workingDir, name);
|
|
272
|
+
results.push(result.message);
|
|
273
|
+
}
|
|
274
|
+
else if (isMonorepo) {
|
|
275
|
+
// Create monorepo structure manually if no BTS frontends
|
|
276
|
+
// (e.g., just cli + tui with no web/native)
|
|
277
|
+
(0, fs_1.mkdirSync)(projectPath, { recursive: true });
|
|
278
|
+
(0, fs_1.mkdirSync)((0, path_1.join)(projectPath, "apps"), { recursive: true });
|
|
279
|
+
console.log(`📁 Created monorepo structure at ${projectPath}`);
|
|
280
|
+
}
|
|
281
|
+
// Step 2: AFTER Better-T-Stack creates the structure, add custom frontends
|
|
282
|
+
// These get added into the apps/ directory that Better-T-Stack created
|
|
283
|
+
for (const frontend of customFrontends) {
|
|
284
|
+
if (frontend === "cli") {
|
|
285
|
+
const result = await this.addCliToProject(name, projectPath, isMonorepo, options);
|
|
286
|
+
results.push(result.message);
|
|
287
|
+
}
|
|
288
|
+
if (frontend === "tui" || frontend === "opentui") {
|
|
289
|
+
const result = await this.addTuiToProject(name, projectPath, isMonorepo, options);
|
|
290
|
+
results.push(result.message);
|
|
291
|
+
}
|
|
292
|
+
if (frontend === "medusa") {
|
|
293
|
+
const result = await this.addMedusaToProject(name, projectPath, isMonorepo, options);
|
|
294
|
+
results.push(result.message);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
success: true,
|
|
299
|
+
message: results.join("\n"),
|
|
300
|
+
projectPath,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
catch (error) {
|
|
304
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
305
|
+
return {
|
|
306
|
+
success: false,
|
|
307
|
+
message: `Project creation failed: ${message}`,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Bootstrap Better-T-Stack project with one or more frontends
|
|
313
|
+
*/
|
|
314
|
+
async bootstrapBetterTStackProject(name, frontends, options, workingDir) {
|
|
315
|
+
const backend = options.backend || "hono";
|
|
316
|
+
const isConvex = backend === "convex";
|
|
317
|
+
const btsConfig = {
|
|
318
|
+
projectName: options.name || options.projectName || name,
|
|
319
|
+
frontend: frontends.length === 1 ? frontends[0] : frontends, // Pass array if multiple
|
|
320
|
+
backend: backend || "hono",
|
|
321
|
+
database: isConvex
|
|
322
|
+
? "none"
|
|
323
|
+
: options.database || "sqlite",
|
|
324
|
+
auth: options.noAuth ? "none" : "better-auth",
|
|
325
|
+
addons: options.addons || ["turborepo"],
|
|
326
|
+
runtime: isConvex || backend === "self" ? "none" : options.runtime || "node",
|
|
327
|
+
api: options.api || "none",
|
|
328
|
+
payments: options.payment || "none",
|
|
329
|
+
orm: isConvex ? "none" : options.orm || "drizzle",
|
|
330
|
+
dbSetup: isConvex ? "none" : options.dbSetup || "none",
|
|
331
|
+
packageManager: options.packageManager || "npm",
|
|
332
|
+
git: !options.noGit,
|
|
333
|
+
webDeploy: options.webDeploy || "none",
|
|
334
|
+
serverDeploy: options.serverDeploy || "none",
|
|
335
|
+
install: !options.noInstall,
|
|
336
|
+
examples: options.examples || [],
|
|
337
|
+
includeDocs: options.includeDocs,
|
|
338
|
+
};
|
|
339
|
+
const result = await this.btsService.createProject(name, btsConfig, workingDir);
|
|
340
|
+
return {
|
|
341
|
+
success: result.success,
|
|
342
|
+
message: result.message,
|
|
343
|
+
projectPath: result.projectPath,
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Add CLI app to project (standalone or monorepo)
|
|
348
|
+
*/
|
|
349
|
+
async addCliToProject(projectName, projectPath, isMonorepo, options) {
|
|
350
|
+
const { bootstrapCliProject } = await Promise.resolve().then(() => __importStar(require("./bootstrap/cli-bootstrap.js")));
|
|
351
|
+
const cliPath = isMonorepo ? (0, path_1.join)(projectPath, "apps", "cli") : projectPath;
|
|
352
|
+
const cliName = isMonorepo ? `${projectName}-cli` : projectName;
|
|
353
|
+
const result = await bootstrapCliProject({
|
|
354
|
+
projectName: cliName,
|
|
355
|
+
projectPath: cliPath,
|
|
356
|
+
dependencyLevel: options.cliDeps || "standard",
|
|
357
|
+
packageManager: options.packageManager || "npm",
|
|
358
|
+
runtime: options.runtime || "node",
|
|
359
|
+
typescript: true,
|
|
360
|
+
});
|
|
361
|
+
if (!result.success)
|
|
362
|
+
throw new Error(result.message);
|
|
363
|
+
return {
|
|
364
|
+
success: true,
|
|
365
|
+
message: isMonorepo
|
|
366
|
+
? `✅ CLI app added to apps/cli/`
|
|
367
|
+
: `✅ CLI project "${projectName}" created successfully!`,
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Add TUI app to project (standalone or monorepo)
|
|
372
|
+
*/
|
|
373
|
+
async addTuiToProject(projectName, projectPath, isMonorepo, options) {
|
|
374
|
+
const { bootstrapOpenTuiProject } = await Promise.resolve().then(() => __importStar(require("./bootstrap/opentui-bootstrap.js")));
|
|
375
|
+
const tuiPath = isMonorepo ? (0, path_1.join)(projectPath, "apps", "tui") : projectPath;
|
|
376
|
+
const tuiName = isMonorepo ? `${projectName}-tui` : projectName;
|
|
377
|
+
const result = await bootstrapOpenTuiProject({
|
|
378
|
+
projectName: tuiName,
|
|
379
|
+
projectPath: tuiPath,
|
|
380
|
+
framework: options.tuiFramework || "solid",
|
|
381
|
+
packageManager: options.packageManager || "bun",
|
|
382
|
+
});
|
|
383
|
+
if (!result.success)
|
|
384
|
+
throw new Error(result.message);
|
|
385
|
+
return {
|
|
386
|
+
success: true,
|
|
387
|
+
message: isMonorepo
|
|
388
|
+
? `✅ TUI app added to apps/tui/`
|
|
389
|
+
: `✅ TUI project "${projectName}" created successfully!`,
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Add MedusaJS app to project (standalone or monorepo)
|
|
394
|
+
*/
|
|
395
|
+
async addMedusaToProject(projectName, projectPath, isMonorepo, options) {
|
|
396
|
+
const { bootstrapMedusaProject } = await Promise.resolve().then(() => __importStar(require("./bootstrap/medusa-bootstrap.js")));
|
|
397
|
+
const medusaPath = isMonorepo
|
|
398
|
+
? (0, path_1.join)(projectPath, "apps", "medusa")
|
|
399
|
+
: projectPath;
|
|
400
|
+
const medusaName = isMonorepo ? `${projectName}-medusa` : projectName;
|
|
401
|
+
const result = await bootstrapMedusaProject({
|
|
402
|
+
projectName: medusaName,
|
|
403
|
+
projectPath: medusaPath,
|
|
404
|
+
packageManager: options.packageManager || "npm",
|
|
405
|
+
database: options.database || "sqlite",
|
|
406
|
+
skipDb: options.noInstall, // Skip DB setup if not installing deps
|
|
407
|
+
skipInstall: options.noInstall,
|
|
408
|
+
});
|
|
409
|
+
if (!result.success)
|
|
410
|
+
throw new Error(result.message);
|
|
411
|
+
return {
|
|
412
|
+
success: true,
|
|
413
|
+
message: isMonorepo
|
|
414
|
+
? `✅ MedusaJS app added to apps/medusa/`
|
|
415
|
+
: `✅ MedusaJS project "${projectName}" created successfully!`,
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
exports.BetterTStackIntegration = BetterTStackIntegration;
|
|
420
|
+
// Export backward-compatible function
|
|
213
421
|
async function runBetterTStackCLI(options, workingDirectory) {
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
const isConvex = backend === "convex";
|
|
217
|
-
const btsConfig = {
|
|
218
|
-
projectName: options.name || options.projectName || "default-project",
|
|
219
|
-
frontend: options.frontend || "next",
|
|
220
|
-
backend: backend || "convex",
|
|
221
|
-
database: isConvex
|
|
222
|
-
? "none"
|
|
223
|
-
: options.database || "sqlite",
|
|
224
|
-
auth: options.noAuth ? "none" : "better-auth",
|
|
225
|
-
addons: options.addons || ["turborepo"],
|
|
226
|
-
runtime: isConvex || backend === "self" ? "none" : options.runtime || "node",
|
|
227
|
-
api: options.api || "none",
|
|
228
|
-
payments: options.payment || "none",
|
|
229
|
-
orm: isConvex ? "none" : options.orm || "drizzle",
|
|
230
|
-
dbSetup: isConvex ? "none" : options.dbSetup || "none",
|
|
231
|
-
packageManager: options.packageManager || "npm",
|
|
232
|
-
git: !options.noGit,
|
|
233
|
-
webDeploy: options.webDeploy || "none",
|
|
234
|
-
serverDeploy: options.serverDeploy || "none",
|
|
235
|
-
install: !options.noInstall,
|
|
236
|
-
examples: options.examples || [],
|
|
237
|
-
includeDocs: options.includeDocs,
|
|
238
|
-
};
|
|
239
|
-
const result = await btsService.createProject(options.projectName || options.name || "", btsConfig, workingDirectory);
|
|
240
|
-
return {
|
|
241
|
-
success: result.success,
|
|
242
|
-
message: result.message,
|
|
243
|
-
projectPath: result.projectPath,
|
|
244
|
-
};
|
|
422
|
+
const integration = new BetterTStackIntegration();
|
|
423
|
+
return integration.createProject(options.projectName || options.name || "default-project", options, workingDirectory);
|
|
245
424
|
}
|