task-o-matic 0.0.13 → 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.
Files changed (59) hide show
  1. package/dist/commands/init.js +41 -8
  2. package/dist/commands/tasks/document/add.js +3 -3
  3. package/dist/commands/tasks/list.js +2 -2
  4. package/dist/commands/tasks/next.js +4 -4
  5. package/dist/commands/tasks/status.js +2 -2
  6. package/dist/lib/ai-service/ai-operations.d.ts +1 -1
  7. package/dist/lib/ai-service/ai-operations.d.ts.map +1 -1
  8. package/dist/lib/ai-service/base-operations.d.ts +22 -0
  9. package/dist/lib/ai-service/base-operations.d.ts.map +1 -1
  10. package/dist/lib/ai-service/base-operations.js +29 -1
  11. package/dist/lib/ai-service/task-operations.d.ts +1 -1
  12. package/dist/lib/ai-service/task-operations.d.ts.map +1 -1
  13. package/dist/lib/better-t-stack-cli.d.ts +36 -21
  14. package/dist/lib/better-t-stack-cli.d.ts.map +1 -1
  15. package/dist/lib/better-t-stack-cli.js +212 -33
  16. package/dist/lib/bootstrap/cli-bootstrap.d.ts +14 -0
  17. package/dist/lib/bootstrap/cli-bootstrap.d.ts.map +1 -0
  18. package/dist/lib/bootstrap/cli-bootstrap.js +325 -0
  19. package/dist/lib/bootstrap/index.d.ts +4 -0
  20. package/dist/lib/bootstrap/index.d.ts.map +1 -0
  21. package/dist/lib/bootstrap/index.js +19 -0
  22. package/dist/lib/bootstrap/medusa-bootstrap.d.ts +14 -0
  23. package/dist/lib/bootstrap/medusa-bootstrap.d.ts.map +1 -0
  24. package/dist/lib/bootstrap/medusa-bootstrap.js +218 -0
  25. package/dist/lib/bootstrap/opentui-bootstrap.d.ts +11 -0
  26. package/dist/lib/bootstrap/opentui-bootstrap.d.ts.map +1 -0
  27. package/dist/lib/bootstrap/opentui-bootstrap.js +342 -0
  28. package/dist/lib/config.d.ts +14 -0
  29. package/dist/lib/config.d.ts.map +1 -1
  30. package/dist/lib/config.js +18 -0
  31. package/dist/services/prd.d.ts.map +1 -1
  32. package/dist/services/prd.js +18 -45
  33. package/dist/services/tasks.d.ts +2 -2
  34. package/dist/services/tasks.d.ts.map +1 -1
  35. package/dist/services/tasks.js +55 -85
  36. package/dist/types/index.d.ts +36 -1
  37. package/dist/types/index.d.ts.map +1 -1
  38. package/dist/types/results.d.ts +60 -6
  39. package/dist/types/results.d.ts.map +1 -1
  40. package/dist/utils/error-utils.d.ts +70 -0
  41. package/dist/utils/error-utils.d.ts.map +1 -0
  42. package/dist/utils/error-utils.js +103 -0
  43. package/dist/utils/file-utils.d.ts +49 -0
  44. package/dist/utils/file-utils.d.ts.map +1 -0
  45. package/dist/utils/file-utils.js +77 -0
  46. package/dist/utils/id-generator.d.ts +92 -0
  47. package/dist/utils/id-generator.d.ts.map +1 -0
  48. package/dist/utils/id-generator.js +140 -0
  49. package/dist/utils/stack-formatter.d.ts +2 -1
  50. package/dist/utils/stack-formatter.d.ts.map +1 -1
  51. package/dist/utils/stack-formatter.js +8 -2
  52. package/dist/utils/storage-utils.d.ts +49 -0
  53. package/dist/utils/storage-utils.d.ts.map +1 -0
  54. package/dist/utils/storage-utils.js +79 -0
  55. package/dist/utils/streaming-utils.d.ts +38 -0
  56. package/dist/utils/streaming-utils.d.ts.map +1 -0
  57. package/dist/utils/streaming-utils.js +56 -0
  58. package/docs/agents/cli.md +58 -149
  59. package/package.json +1 -1
@@ -11,7 +11,7 @@ const fs_1 = require("fs");
11
11
  const path_1 = require("path");
12
12
  const config_1 = require("../lib/config");
13
13
  const better_t_stack_cli_1 = require("../lib/better-t-stack-cli");
14
- exports.initCommand = new commander_1.Command("init").description("Initialize task-o-matic project and bootstrap Better-T-Stack");
14
+ exports.initCommand = new commander_1.Command("init").description("Initialize task-o-matic project and bootstrap projects (web/native/cli/tui)");
15
15
  // Initialize task-o-matic project
16
16
  exports.initCommand
17
17
  .command("init")
@@ -24,7 +24,7 @@ exports.initCommand
24
24
  .option("--temperature <temp>", "AI temperature", "0.5")
25
25
  .option("--no-bootstrap", "Skip bootstrap after initialization")
26
26
  .option("--project-name <name>", "Project name for bootstrap")
27
- .option("--frontend <frontend>", "Frontend framework for bootstrap", "next")
27
+ .option("--frontend <frontends...>", "Frontend framework(s) - space/comma-separated (next, native-bare, cli, tui, etc.)", "next")
28
28
  .option("--backend <backend>", "Backend framework for bootstrap", "convex")
29
29
  .option("--database <database>", "Database for bootstrap")
30
30
  .option("--auth <auth>", "Authentication for bootstrap", "better-auth")
@@ -33,6 +33,8 @@ exports.initCommand
33
33
  .option("--package-manager <pm>", "Package manager (npm/pnpm/bun)", "npm")
34
34
  .option("--runtime <runtime>", "Runtime (bun/node)", "node")
35
35
  .option("--payment <payment>", "Payment provider (none/polar)", "none")
36
+ .option("--cli-deps <level>", "CLI dependency level (minimal/standard/full/task-o-matic)", "standard")
37
+ .option("--tui-framework <framework>", "TUI framework (solid/vue/react)", "solid")
36
38
  .action(async (options) => {
37
39
  // Handle directory creation/setup first
38
40
  if (options.directory) {
@@ -136,9 +138,9 @@ async function initializeProjectStructure(options) {
136
138
  // Bootstrap project with Better-T-Stack
137
139
  exports.initCommand
138
140
  .command("bootstrap")
139
- .description("Bootstrap a new project using Better-T-Stack")
141
+ .description("Bootstrap a new project (web/native/cli/tui)")
140
142
  .argument("<name>", "Project name")
141
- .option("--frontend <frontend>", "Frontend framework (next/tanstack-router/react-router/etc)", "next")
143
+ .option("--frontend <frontends...>", "Frontend framework(s) - space/comma-separated (next, native-bare, cli, tui, etc.)", "next")
142
144
  .option("--backend <backend>", "Backend framework (hono/express/elysia)", "hono")
143
145
  .option("--database <database>", "Database (sqlite/postgres/mysql/mongodb)", "sqlite")
144
146
  .option("--orm <orm>", "ORM (drizzle/prisma/none)", "drizzle")
@@ -152,6 +154,8 @@ exports.initCommand
152
154
  .option("--runtime <runtime>", "Runtime (bun/node)", "node")
153
155
  .option("--api <type>", "API type (trpc/orpc)")
154
156
  .option("--payment <payment>", "Payment provider (none/polar)", "none")
157
+ .option("--cli-deps <level>", "CLI dependency level (minimal/standard/full/task-o-matic)", "standard")
158
+ .option("--tui-framework <framework>", "TUI framework (solid/vue/react)", "solid")
155
159
  .action(async (name, options) => {
156
160
  const taskOMaticDir = config_1.configManager.getTaskOMaticDir();
157
161
  if (!(0, fs_1.existsSync)(taskOMaticDir)) {
@@ -192,11 +196,32 @@ exports.initCommand.action(() => {
192
196
  console.log(" task-o-matic init bootstrap <name> Bootstrap Better-T-Stack project");
193
197
  console.log("");
194
198
  console.log(chalk_1.default.cyan("Examples:"));
199
+ console.log(" # Basic initialization:");
195
200
  console.log(" task-o-matic init init");
196
201
  console.log(" task-o-matic init init --project-name my-app");
197
- console.log(" task-o-matic init init --project-name my-app --ai-provider openrouter --ai-key your-key --frontend next --backend hono");
202
+ console.log("");
203
+ console.log(" # Web + Native + CLI + TUI (monorepo):");
204
+ console.log(" task-o-matic init init --project-name my-app --frontend \"next native-uniwind cli tui\" --backend hono");
205
+ console.log("");
206
+ console.log(" # CLI only:");
207
+ console.log(" task-o-matic init init --project-name my-cli --frontend cli --cli-deps full");
208
+ console.log("");
209
+ console.log(" # TUI only:");
210
+ console.log(" task-o-matic init init --project-name my-tui --frontend tui --tui-framework solid");
211
+ console.log("");
212
+ console.log(" # Web + Native (monorepo):");
213
+ console.log(" task-o-matic init init --project-name my-app --frontend \"next native-bare\" --backend hono");
214
+ console.log("");
215
+ console.log(" # Multiple web frontends:");
216
+ console.log(" task-o-matic init init --project-name my-app --frontend \"next tanstack-router\" --backend hono");
217
+ console.log("");
218
+ console.log(" # No bootstrap:");
198
219
  console.log(" task-o-matic init init --project-name my-app --no-bootstrap");
220
+ console.log("");
221
+ console.log(" # Custom directory:");
199
222
  console.log(" task-o-matic init init --directory my-workspace --project-name my-app");
223
+ console.log("");
224
+ console.log(" # Bootstrap command:");
200
225
  console.log(" task-o-matic init bootstrap my-app --frontend next --backend hono --database postgres");
201
226
  console.log("");
202
227
  console.log(chalk_1.default.cyan("Init Options:"));
@@ -211,8 +236,16 @@ exports.initCommand.action(() => {
211
236
  console.log(" --directory <dir> Working directory for the project");
212
237
  console.log("");
213
238
  console.log(chalk_1.default.cyan("Bootstrap Options:"));
214
- console.log(" --frontend <frontend> Frontend framework (next/tanstack-router/react-router/etc)");
215
- console.log(" --backend <backend> Backend framework (hono/express/elysia)");
239
+ console.log(" --frontend <frontends...> Frontend framework(s) - multiple values supported");
240
+ console.log(" Web: next, tanstack-router, react-router, nuxt, svelte, solid");
241
+ console.log(" Native: native-bare, native-uniwind, native-unistyles");
242
+ console.log(" Custom: cli, tui");
243
+ console.log(" --backend <backend> Backend framework (hono/express/elysia/convex)");
216
244
  console.log(" --database <database> Database (sqlite/postgres/mysql/mongodb)");
217
- console.log(" --auth Include authentication");
245
+ console.log(" --auth <auth> Authentication (better-auth/none)");
246
+ console.log(" --cli-deps <level> CLI dependency level (minimal/standard/full/task-o-matic)");
247
+ console.log(" --tui-framework <framework> TUI framework (solid/vue/react)");
248
+ console.log(" --package-manager <pm> Package manager (npm/pnpm/bun)");
249
+ console.log(" --runtime <runtime> Runtime (node/bun)");
250
+ console.log(" --payment <payment> Payment provider (none/polar)");
218
251
  });
@@ -10,9 +10,9 @@ const tasks_1 = require("../../../services/tasks");
10
10
  const command_error_handler_1 = require("../../../utils/command-error-handler");
11
11
  exports.addDocumentationCommand = new commander_1.Command("add-documentation")
12
12
  .description("Add documentation to a task from a file")
13
- .requiredOption("--id <id>", "Task ID")
14
- .requiredOption("--doc-file <path>", "Path to documentation file")
15
- .option("--overwrite", "Overwrite existing documentation")
13
+ .requiredOption("-i, --id <id>", "Task ID")
14
+ .requiredOption("-f, --doc-file <path>", "Path to documentation file")
15
+ .option("-o, --overwrite", "Overwrite existing documentation")
16
16
  .action((0, command_error_handler_1.wrapCommandHandler)("Add documentation", async (options) => {
17
17
  const task = await tasks_1.taskService.getTask(options.id);
18
18
  if (!task) {
@@ -7,8 +7,8 @@ const task_1 = require("../../cli/display/task");
7
7
  const progress_1 = require("../../cli/display/progress");
8
8
  exports.listCommand = new commander_1.Command("list")
9
9
  .description("List all tasks")
10
- .option("--status <status>", "Filter by status (todo/in-progress/completed)")
11
- .option("--tag <tag>", "Filter by tag")
10
+ .option("-s, --status <status>", "Filter by status (todo/in-progress/completed)")
11
+ .option("-t, --tag <tag>", "Filter by tag")
12
12
  .action(async (options) => {
13
13
  try {
14
14
  const tasks = await tasks_1.taskService.listTasks({
@@ -11,10 +11,10 @@ const task_1 = require("../../cli/display/task");
11
11
  const progress_1 = require("../../cli/display/progress");
12
12
  exports.nextCommand = new commander_1.Command("get-next")
13
13
  .description("Get the next task to work on (defaults to hierarchical order)")
14
- .option("--status <status>", "Filter by status (todo/in-progress)")
15
- .option("--tag <tag>", "Filter by tag")
16
- .option("--effort <effort>", "Filter by effort (small/medium/large)")
17
- .option("--priority <priority>", "Sort priority (newest/oldest/effort)", "hierarchical")
14
+ .option("-s, --status <status>", "Filter by status (todo/in-progress)")
15
+ .option("-t, --tag <tag>", "Filter by tag")
16
+ .option("-e, --effort <effort>", "Filter by effort (small/medium/large)")
17
+ .option("-p, --priority <priority>", "Sort priority (newest/oldest/effort)", "hierarchical")
18
18
  .action(async (options) => {
19
19
  try {
20
20
  // Default to todo status if not specified
@@ -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<any>;
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,EAClC,WAAW,C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AW,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;IAExC,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;CA+EnB"}
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
- const aiConfig = { ...this.modelProvider.getAIConfig(), ...config };
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<any>;
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 @@
1
- {"version":3,"file":"task-operations.d.ts","sourceRoot":"","sources":["../../../src/lib/ai-service/task-operations.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,WAAW,EAEZ,MAAM,aAAa,CAAC;AAUrB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,qBAAa,cAAe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W,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 interface InitOptions {
14
- projectName?: string;
15
- name?: string;
16
- frontend: string;
17
- backend: string;
18
- database: string;
19
- noAuth?: boolean;
20
- addons?: string[];
21
- runtime?: string;
22
- api?: string;
23
- payment?: string;
24
- orm?: string;
25
- dbSetup?: string;
26
- packageManager?: string;
27
- noGit?: boolean;
28
- webDeploy?: string;
29
- serverDeploy?: string;
30
- noInstall?: boolean;
31
- examples?: string[];
32
- includeDocs?: boolean;
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-st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AAC,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: [config.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 btsService = new BetterTStackService();
215
- const backend = options.backend;
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
  }
@@ -0,0 +1,14 @@
1
+ import type { CliDependencyLevel } from "../../types";
2
+ export interface CliBootstrapOptions {
3
+ projectName: string;
4
+ projectPath: string;
5
+ dependencyLevel: CliDependencyLevel;
6
+ packageManager: "npm" | "pnpm" | "bun";
7
+ runtime: "node" | "bun";
8
+ typescript: boolean;
9
+ }
10
+ export declare function bootstrapCliProject(options: CliBootstrapOptions): Promise<{
11
+ success: boolean;
12
+ message: string;
13
+ }>;
14
+ //# sourceMappingURL=cli-bootstrap.d.ts.map