create-better-t-stack 3.28.0 → 3.28.2

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 CHANGED
@@ -5,7 +5,7 @@ A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with
5
5
  ## Sponsors
6
6
 
7
7
  <p align="center">
8
- <img src="https://sponsors.amanv.dev/sponsors.png" alt="Sponsors">
8
+ <img src="https://sponsors.better-t-stack.dev/sponsors.png" alt="Sponsors">
9
9
  </p>
10
10
 
11
11
  ![demo](https://cdn.jsdelivr.net/gh/amanvarshney01/create-better-t-stack@master/demo.gif)
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { _ as types_exports, i as SchemaNameSchema, l as create, m as getSchemaResult, s as add, u as createBtsCli, v as getLatestCLIVersion } from "./src-CHenuE55.mjs";
2
+ import { _ as types_exports, i as SchemaNameSchema, l as create, m as getSchemaResult, s as add, u as createBtsCli, v as getLatestCLIVersion } from "./src-PtlLGeY1.mjs";
3
3
  import z from "zod";
4
4
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
5
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
@@ -9,6 +9,7 @@ const ToolResponseSchema = z.object({
9
9
  data: z.any().optional(),
10
10
  error: z.string().optional()
11
11
  });
12
+ const SchemaToolInputSchema = z.object({ name: SchemaNameSchema.optional().describe("Schema name to inspect. Defaults to all.") });
12
13
  const McpCreateProjectInputSchema = types_exports.CreateInputSchema.safeExtend({
13
14
  projectName: z.string().describe("Project name or relative path"),
14
15
  frontend: z.array(types_exports.FrontendSchema).describe("Explicit frontend app surfaces. Do not use native frontends as styling options."),
@@ -134,7 +135,6 @@ function createBtsMcpServer() {
134
135
  server.registerTool("bts_get_stack_guidance", {
135
136
  title: "Get Better T Stack MCP Guidance",
136
137
  description: "Read MCP-specific guidance for choosing valid Better T Stack configurations. Use this before planning when user intent is ambiguous. This explains the full explicit config required by MCP project creation, plus important field semantics and ambiguity rules.",
137
- inputSchema: z.object({}),
138
138
  outputSchema: ToolResponseSchema,
139
139
  annotations: {
140
140
  title: "Get Better T Stack MCP Guidance",
@@ -153,7 +153,7 @@ function createBtsMcpServer() {
153
153
  server.registerTool("bts_get_schema", {
154
154
  title: "Get Better T Stack Schemas",
155
155
  description: "Inspect Better T Stack CLI and input schemas so agents can plan valid create/add requests. Use this together with bts_get_stack_guidance before creating a project if any part of the request is ambiguous.",
156
- inputSchema: z.object({ name: SchemaNameSchema.optional().describe("Schema name to inspect. Defaults to all.") }),
156
+ inputSchema: SchemaToolInputSchema,
157
157
  outputSchema: ToolResponseSchema,
158
158
  annotations: {
159
159
  title: "Get Better T Stack Schemas",
package/dist/index.d.mts CHANGED
@@ -152,6 +152,7 @@ declare const SchemaNameSchema: z.ZodDefault<z.ZodEnum<{
152
152
  addInput: "addInput";
153
153
  projectConfig: "projectConfig";
154
154
  betterTStackConfig: "betterTStackConfig";
155
+ betterTStackConfigFile: "betterTStackConfigFile";
155
156
  initResult: "initResult";
156
157
  }>>;
157
158
  type SchemaName = z.infer<typeof SchemaNameSchema>;
@@ -294,7 +295,7 @@ declare const router: _$_trpc_server0.TRPCBuiltRouter<{
294
295
  }>;
295
296
  schema: _$_trpc_server0.TRPCQueryProcedure<{
296
297
  input: {
297
- name?: "all" | "cli" | "database" | "orm" | "backend" | "runtime" | "frontend" | "addons" | "examples" | "packageManager" | "databaseSetup" | "api" | "auth" | "payments" | "webDeploy" | "serverDeploy" | "directoryConflict" | "template" | "addonOptions" | "dbSetupOptions" | "createInput" | "addInput" | "projectConfig" | "betterTStackConfig" | "initResult" | undefined;
298
+ name?: "all" | "cli" | "database" | "orm" | "backend" | "runtime" | "frontend" | "addons" | "examples" | "packageManager" | "databaseSetup" | "api" | "auth" | "payments" | "webDeploy" | "serverDeploy" | "directoryConflict" | "template" | "addonOptions" | "dbSetupOptions" | "createInput" | "addInput" | "projectConfig" | "betterTStackConfig" | "betterTStackConfigFile" | "initResult" | undefined;
298
299
  };
299
300
  output: unknown;
300
301
  meta: TrpcCliMeta;
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import { C as ProjectCreationError, S as DirectoryConflictError, T as ValidationError, a as TEMPLATE_COUNT, b as CompatibilityError, c as builder, d as createVirtual, f as docs, g as sponsors, h as router, i as SchemaNameSchema, l as create, m as getSchemaResult, n as GeneratorError, o as VirtualFileSystem, p as generate, r as Result, s as add, t as EMBEDDED_TEMPLATES, u as createBtsCli, w as UserCancelledError, x as DatabaseSetupError, y as CLIError } from "./src-CHenuE55.mjs";
2
+ import { C as ProjectCreationError, S as DirectoryConflictError, T as ValidationError, a as TEMPLATE_COUNT, b as CompatibilityError, c as builder, d as createVirtual, f as docs, g as sponsors, h as router, i as SchemaNameSchema, l as create, m as getSchemaResult, n as GeneratorError, o as VirtualFileSystem, p as generate, r as Result, s as add, t as EMBEDDED_TEMPLATES, u as createBtsCli, w as UserCancelledError, x as DatabaseSetupError, y as CLIError } from "./src-PtlLGeY1.mjs";
3
3
  export { CLIError, CompatibilityError, DatabaseSetupError, DirectoryConflictError, EMBEDDED_TEMPLATES, GeneratorError, ProjectCreationError, Result, SchemaNameSchema, TEMPLATE_COUNT, UserCancelledError, ValidationError, VirtualFileSystem, add, builder, create, createBtsCli, createVirtual, docs, generate, getSchemaResult, router, sponsors };
@@ -338,7 +338,7 @@ async function readHistory() {
338
338
  cause: e
339
339
  })
340
340
  });
341
- if (existsResult.isErr()) return existsResult;
341
+ if (existsResult.isErr()) return Result.err(existsResult.error);
342
342
  if (!existsResult.value) return Result.ok(emptyHistory());
343
343
  const readResult = await Result.tryPromise({
344
344
  try: async () => await fs.readJson(historyPath),
@@ -352,7 +352,7 @@ async function readHistory() {
352
352
  }
353
353
  async function writeHistory(history) {
354
354
  const ensureDirResult = await ensureHistoryDir();
355
- if (ensureDirResult.isErr()) return ensureDirResult;
355
+ if (ensureDirResult.isErr()) return Result.err(ensureDirResult.error);
356
356
  return Result.tryPromise({
357
357
  try: async () => {
358
358
  await fs.writeJson(getHistoryPath(), history, { spaces: 2 });
@@ -365,7 +365,7 @@ async function writeHistory(history) {
365
365
  }
366
366
  async function addToHistory(config, reproducibleCommand) {
367
367
  const historyResult = await readHistory();
368
- if (historyResult.isErr()) return historyResult;
368
+ if (historyResult.isErr()) return Result.err(historyResult.error);
369
369
  const history = historyResult.value;
370
370
  const entry = {
371
371
  id: generateId(),
@@ -395,7 +395,7 @@ async function addToHistory(config, reproducibleCommand) {
395
395
  }
396
396
  async function getHistory(limit = 10) {
397
397
  const historyResult = await readHistory();
398
- if (historyResult.isErr()) return historyResult;
398
+ if (historyResult.isErr()) return Result.err(historyResult.error);
399
399
  return Result.ok(historyResult.value.entries.slice(0, limit));
400
400
  }
401
401
  async function clearHistory() {
@@ -5450,7 +5450,7 @@ async function initMongoDBAtlas(serverDir) {
5450
5450
  cause: e
5451
5451
  })
5452
5452
  });
5453
- if (deployResult.isErr()) return deployResult;
5453
+ if (deployResult.isErr()) return Result.err(deployResult.error);
5454
5454
  const connectionString = await text({
5455
5455
  message: "Enter your MongoDB connection string:",
5456
5456
  placeholder: "mongodb+srv://username:password@cluster.mongodb.net/database",
@@ -5561,7 +5561,7 @@ async function setupMongoDBAtlas(config, cliInput) {
5561
5561
  cliLog.success(pc.green("MongoDB Atlas setup complete! Connection saved to .env file."));
5562
5562
  return Result.ok(void 0);
5563
5563
  }
5564
- if (UserCancelledError.is(mongoConfigResult.error)) return mongoConfigResult;
5564
+ if (UserCancelledError.is(mongoConfigResult.error)) return Result.err(mongoConfigResult.error);
5565
5565
  cliLog.warn(pc.yellow("Falling back to local MongoDB configuration"));
5566
5566
  const envResult = await writeEnvFile$3(projectDir, backend);
5567
5567
  if (envResult.isErr()) return envResult;
@@ -5626,7 +5626,7 @@ async function executeNeonCommand(packageManager, commandArgsString, spinnerText
5626
5626
  }
5627
5627
  async function createNeonProject(projectName, regionId, packageManager) {
5628
5628
  const execResult = await executeNeonCommand(packageManager, `neonctl@latest projects create --name ${projectName} --region-id ${regionId} --output json`, `Creating Neon project "${projectName}"...`);
5629
- if (execResult.isErr()) return execResult;
5629
+ if (execResult.isErr()) return Result.err(execResult.error);
5630
5630
  const parseResult = Result.try({
5631
5631
  try: () => JSON.parse(execResult.value.stdout),
5632
5632
  catch: (e) => new DatabaseSetupError({
@@ -5635,7 +5635,7 @@ async function createNeonProject(projectName, regionId, packageManager) {
5635
5635
  cause: e
5636
5636
  })
5637
5637
  });
5638
- if (parseResult.isErr()) return parseResult;
5638
+ if (parseResult.isErr()) return Result.err(parseResult.error);
5639
5639
  const response = parseResult.value;
5640
5640
  if (response.project && response.connection_uris && response.connection_uris.length > 0) {
5641
5641
  const projectId = response.project.id;
@@ -5717,6 +5717,12 @@ async function setupNeonPostgres(config, cliInput) {
5717
5717
  dbSetupOptions: cliInput?.dbSetupOptions ?? config.dbSetupOptions
5718
5718
  });
5719
5719
  const target = backend === "self" ? "apps/web" : "apps/server";
5720
+ if (shouldSkipExternalCommands()) {
5721
+ const envResult = await writeEnvFile$2(projectDir, backend);
5722
+ if (envResult.isErr()) return envResult;
5723
+ displayManualSetupInstructions$2(target);
5724
+ return Result.ok(void 0);
5725
+ }
5720
5726
  if (setupMode === "manual") {
5721
5727
  const envResult = await writeEnvFile$2(projectDir, backend);
5722
5728
  if (envResult.isErr()) return envResult;
@@ -5960,7 +5966,7 @@ async function setupWithCreateDb(serverDir, packageManager, regionId) {
5960
5966
  });
5961
5967
  }
5962
5968
  });
5963
- if (execResult.isErr()) return execResult;
5969
+ if (execResult.isErr()) return Result.err(execResult.error);
5964
5970
  const parseResult = Result.try({
5965
5971
  try: () => JSON.parse(execResult.value),
5966
5972
  catch: (e) => new DatabaseSetupError({
@@ -5969,7 +5975,7 @@ async function setupWithCreateDb(serverDir, packageManager, regionId) {
5969
5975
  cause: e
5970
5976
  })
5971
5977
  });
5972
- if (parseResult.isErr()) return parseResult;
5978
+ if (parseResult.isErr()) return Result.err(parseResult.error);
5973
5979
  const createDbResponse = parseResult.value;
5974
5980
  return Result.ok({
5975
5981
  databaseUrl: createDbResponse.connectionString,
@@ -6060,7 +6066,7 @@ async function setupPrismaPostgres(config, cliInput) {
6060
6066
  }
6061
6067
  const prismaConfigResult = await setupWithCreateDb(dbDir, packageManager, cliInput?.dbSetupOptions?.prismaPostgres?.regionId ?? config.dbSetupOptions?.prismaPostgres?.regionId);
6062
6068
  if (prismaConfigResult.isErr()) {
6063
- if (UserCancelledError.is(prismaConfigResult.error)) return prismaConfigResult;
6069
+ if (UserCancelledError.is(prismaConfigResult.error)) return Result.err(prismaConfigResult.error);
6064
6070
  cliLog.error(pc.red(prismaConfigResult.error.message));
6065
6071
  const envResult = await writeEnvFile$1(projectDir, backend);
6066
6072
  if (envResult.isErr()) return envResult;
@@ -6360,7 +6366,7 @@ async function createTursoDatabase(dbName, groupName) {
6360
6366
  });
6361
6367
  }
6362
6368
  });
6363
- if (createResult.isErr()) return createResult;
6369
+ if (createResult.isErr()) return Result.err(createResult.error);
6364
6370
  s.start("Retrieving database connection details...");
6365
6371
  return Result.tryPromise({
6366
6372
  try: async () => {
@@ -6512,7 +6518,7 @@ async function setupTurso(config, cliInput) {
6512
6518
  if (!selectedGroup) if (isSilent()) selectedGroup = (await getTursoGroups())[0]?.name ?? null;
6513
6519
  else {
6514
6520
  const groupResult = await selectTursoGroup();
6515
- if (groupResult.isErr()) return groupResult;
6521
+ if (groupResult.isErr()) return Result.err(groupResult.error);
6516
6522
  selectedGroup = groupResult.value;
6517
6523
  }
6518
6524
  let suggestedName = cliInput?.dbSetupOptions?.turso?.databaseName ?? config.dbSetupOptions?.turso?.databaseName ?? path.basename(projectDir);
@@ -7364,6 +7370,7 @@ const SchemaNameSchema = z.enum([
7364
7370
  "addInput",
7365
7371
  "projectConfig",
7366
7372
  "betterTStackConfig",
7373
+ "betterTStackConfigFile",
7367
7374
  "initResult"
7368
7375
  ]).default("all");
7369
7376
  const t = initTRPC.meta().create();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-better-t-stack",
3
- "version": "3.28.0",
3
+ "version": "3.28.2",
4
4
  "description": "A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations",
5
5
  "keywords": [
6
6
  "better-auth",
@@ -70,13 +70,13 @@
70
70
  "prepublishOnly": "npm run build"
71
71
  },
72
72
  "dependencies": {
73
- "@better-t-stack/template-generator": "^3.28.0",
74
- "@better-t-stack/types": "^3.28.0",
75
- "@clack/core": "^1.2.0",
76
- "@clack/prompts": "^1.2.0",
73
+ "@better-t-stack/template-generator": "^3.28.2",
74
+ "@better-t-stack/types": "^3.28.2",
75
+ "@clack/core": "^1.3.0",
76
+ "@clack/prompts": "^1.3.0",
77
77
  "@modelcontextprotocol/sdk": "1.29.0",
78
- "@trpc/server": "^11.16.0",
79
- "better-result": "^2.8.2",
78
+ "@trpc/server": "^11.17.0",
79
+ "better-result": "^2.9.1",
80
80
  "consola": "^3.4.2",
81
81
  "env-paths": "^4.0.0",
82
82
  "execa": "^9.6.1",
@@ -84,20 +84,20 @@
84
84
  "gradient-string": "^3.0.0",
85
85
  "handlebars": "^4.7.9",
86
86
  "jsonc-parser": "^3.3.1",
87
- "oxfmt": "^0.46.0",
87
+ "oxfmt": "^0.47.0",
88
88
  "picocolors": "^1.1.1",
89
89
  "tinyglobby": "^0.2.15",
90
90
  "trpc-cli": "^0.14.0",
91
91
  "ts-morph": "^28.0.0",
92
- "yaml": "^2.8.3",
93
- "zod": "^4.3.6"
92
+ "yaml": "^2.8.4",
93
+ "zod": "^4.4.2"
94
94
  },
95
95
  "devDependencies": {
96
- "@types/bun": "^1.3.12",
96
+ "@types/bun": "^1.3.13",
97
97
  "@types/fs-extra": "^11.0.4",
98
98
  "@types/node": "^25.6.0",
99
99
  "publint": "^0.3.18",
100
- "tsdown": "^0.21.9",
100
+ "tsdown": "^0.21.10",
101
101
  "typescript": "^6.0.3"
102
102
  }
103
103
  }