Skip to content

HIGHLY EXPERIMENTAL (do not open this pr 🤫) - #749

Closed
AmanVarshney01 wants to merge 8 commits into
mainfrom
something-crazy
Closed

AmanVarshney01 wants to merge 8 commits into
mainfrom
something-crazy

Conversation

@AmanVarshney01

@AmanVarshney01 AmanVarshney01 commented Dec 23, 2025 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Platform-specific CLI binaries (darwin/linux/windows, x64/arm64) and installer packages.
    • New programmatic create() API and TUI for interactive project creation; CLI entry reorganized with Commander and an add command placeholder.
  • Chores

    • Build and release flow updated to build, pack, and publish platform binaries and upload them as release artifacts.
    • Packaging and package.json entries adjusted for the new binary layout and distribution.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel

vercel Bot commented Dec 23, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
create-better-t-stack-web Ready Ready Preview, Comment Dec 23, 2025 1:05pm

@coderabbitai

coderabbitai Bot commented Dec 23, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Migrates the CLI to a Bun-compiled binary distribution, adds cross-platform builds and platform-specific npm packages, replaces execa subprocess usage with Bun’s $, introduces build/publish scripts for platform binaries, updates package.json and CI workflows to build, pack, publish, and upload platform artifacts.

Changes

Cohort / File(s) Summary
Workflows
.github/workflows/pr-preview.yaml, .github/workflows/release.yaml
Add timeouts; add build & publish steps for platform-specific CLI packages; propagate CLI version to optionalDependencies; publish platform packages to NPM and upload binaries to GitHub Releases; replace BTS_TELEMETRY/CONVEX_INGEST_URL with NPM_TOKEN/GITHUB_TOKEN where applicable.
Binary entry & packaging
apps/cli/bin/create-better-t-stack, apps/cli/scripts/build.ts, apps/cli/scripts/publish.ts
New launcher that resolves and execs platform prebuilt binaries; build script compiles targets (darwin/linux/windows, x64/arm64), writes per-platform package.jsons; publish script smoke-tests, packs, publishes platform packages and updates main package optionalDependencies.
Package metadata & build system
apps/cli/package.json, apps/cli/tsdown.config.ts, apps/cli/tsconfig.json
Switch from tsdown to Bun-based workflows; bin changed to ./bin/create-better-t-stack; add main/types/exports to src; add optionalDependencies for platform binaries; remove tsdown config and related dev tooling; TS config updated (ESNext, JSX, .tsx include).
CLI runtime & API surface
apps/cli/src/cli.ts, apps/cli/src/api.ts, apps/cli/src/index.ts, apps/cli/src/constants.ts
New Commander/Bun CLI entrypoint and TUI integration; programmatic API create() added with types; index exports new API and types, init aliased to create; PKG_ROOT resolution updated to detect runtime/compiled binary layout.
TUI
apps/cli/src/tui/app.tsx
New terminal UI renderer and renderTui/TuiOptions API supporting multi-step project configuration and completion/cancel callbacks.
Error handling
apps/cli/src/utils/errors.ts
New error classes CLIError and CancelledError; functions now throw these instead of exiting, removed programmatic/colored exit paths.
Build/runtime helpers
apps/cli/src/helpers/*, apps/cli/src/helpers/core/*, apps/cli/src/helpers/database-providers/*
Replace all execa subprocess usage with Bun’s $ tagged template across addon, core, and database provider helpers; adjust output capture (.text(), .nothrow(), .quiet()) and minor API shapes where command results changed.
Utilities
apps/cli/src/utils/*
Replace execa-based implementations with Bun $ (command-exists, open-url, docker-utils); file-formatter.ts becomes no-op; get-latest-cli-version.ts can return embedded CLI_VERSION and now has explicit string return type.
Tests & test utils
apps/cli/test/test-utils.ts
Tests updated to use new create() API and types (CreateOptions/CreateResult); removed programmatic env handling; adjusted helper constructors/defaults.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor Dev as Developer/CI
    participant Build as build.ts
    participant Publish as publish.ts
    participant NPM as NPM Registry
    participant GH as GitHub Release
    participant LocalFS as Local FS / Dist

    Dev->>Build: run build (scripts/build.ts)
    Build->>LocalFS: detect platform/arch targets
    loop per target
        Build->>Build: bun build --compile (target)
        Build->>LocalFS: write dist/<pkg>/bin and package.json
    end
    Build-->>Dev: builtPackages metadata

    Dev->>Publish: run publish (scripts/publish.ts --tag/--dry-run)
    Publish->>LocalFS: import builtPackages
    Publish->>Publish: smoke-test current platform binary (--version)
    loop per builtPackage
        Publish->>Publish: bun pm pack -> produce .tgz
        Publish->>NPM: npm publish <pkg>.tgz --access public --tag
        NPM-->>Publish: publish result
    end
    Publish->>LocalFS: update main package optionalDependencies
    Publish->>NPM: npm publish create-better-t-stack (main)
    NPM-->>Publish: published
    Publish->>GH: gh release upload assets (tar.gz / zip)
    GH-->>Publish: artifacts uploaded
    Publish-->>Dev: summary (published packages & artifacts)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.37% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The PR title 'HIGHLY EXPERIMENTAL (do not open this pr 🤫)' is vague and does not meaningfully describe the actual changes in the pull request, which involve a major architectural overhaul of the CLI system including platform-specific binary publishing, workflow updates, API refactoring, and TUI implementation. Provide a descriptive title that summarizes the main changes, such as 'Refactor CLI to use platform-specific binaries and implement programmatic API' or similar to clearly communicate the scope of changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch something-crazy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Dec 23, 2025 •

Copy link
Copy Markdown
Contributor

PR Preview Release

A preview version has been published for this PR.

Package Version NPM Tag
create-better-t-stack 3.11.0-pr749.29bf48d pr749
create-bts 3.11.0-pr749.29bf48d pr749
@better-t-stack/types 3.11.0-pr749.29bf48d pr749

Commit: 29bf48d

Install

# Using the PR tag (always gets latest for this PR)
bunx create-better-t-stack@pr749
npx create-better-t-stack@pr749

# Using exact version
bunx create-better-t-stack@3.11.0-pr749.29bf48d
npx create-better-t-stack@3.11.0-pr749.29bf48d

# Using the alias
bunx create-bts@pr749
npx create-bts@pr749

NPM Links


To publish a new preview after more commits, remove and re-add the preview label.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/cli/src/helpers/addons/wxt-setup.ts (1)

80-85: Improve error handling and spinner lifecycle management.

The current error handling has two issues:

  1. Silent failure: Errors are logged but not propagated, so callers cannot detect setup failures.
  2. Orphaned spinner: The spinner started at line 60 won't be stopped if an error occurs before line 79, leaving it running in the terminal.

Consider stopping the spinner in the catch block and either re-throwing the error or returning a failure indicator.

🔎 Proposed fix for error handling
   } catch (error) {
+    s.stop("WXT setup failed");
     log.error(pc.red("Failed to set up WXT"));
     if (error instanceof Error) {
       console.error(pc.red(error.message));
     }
+    throw error;
   }
apps/cli/src/helpers/core/convex-codegen.ts (1)

7-14: Add error handling to prevent CLI crashes.

Unlike other setup functions in this PR (fumadocs-setup.ts, tauri-setup.ts), this function lacks a try/catch block. If the Convex codegen command fails (e.g., due to missing configuration or network issues), it will throw an unhandled exception and crash the CLI.

🔎 Proposed fix
 export async function runConvexCodegen(
   projectDir: string,
   packageManager: PackageManager | null | undefined,
 ) {
-  const backendDir = path.join(projectDir, "packages/backend");
-  const cmd = getPackageExecutionCommand(packageManager, "convex codegen");
-  await $`${{ raw: cmd }}`.cwd(backendDir);
+  try {
+    const backendDir = path.join(projectDir, "packages/backend");
+    const cmd = getPackageExecutionCommand(packageManager, "convex codegen");
+    await $`${{ raw: cmd }}`.cwd(backendDir);
+  } catch (error) {
+    // Log error but don't crash - codegen can be run manually later
+    console.error("Convex codegen failed:", error instanceof Error ? error.message : error);
+  }
🧹 Nitpick comments (12)
apps/cli/src/utils/file-formatter.ts (1)

7-11: Consider removing explicit return type for guideline compliance.

The no-op implementation is pragmatic for bun compile compatibility. However:

  1. Guideline violation: Explicit return type : Promise<string | null> contradicts the guideline "Do not use explicit return types" for TypeScript files. Since this function is exported, removing it requires careful consideration of downstream API contracts.

  2. Type-implementation mismatch: Function always returns content and never returns null, though the type allows it. The null-check in template-processor.ts (line 36) becomes redundant code—consider simplifying to content = await formatFile(destPath, content) if the null path is genuinely unreachable.

apps/cli/src/constants.ts (1)

22-39: Consider resolving symlinks for robustness.

Line 24 uses process.execPath which may be a symlink (e.g., when the binary is installed globally). If the binary is symlinked, the directory traversal might search from the wrong location and fail to find templates.

🔎 Proposed improvement
 function findMainPackage(): string | null {
-  // Use process.execPath to get actual filesystem path (Bun.main returns bunfs virtual path)
-  let current = path.dirname(process.execPath);
+  // Resolve symlinks to get actual filesystem path
+  let current = path.dirname(fs.realpathSync(process.execPath));
apps/cli/src/cli.ts (2)

68-107: Consider using arrow functions or standard function declarations consistently.

The action handlers use inline arrow functions. Per coding guidelines, standard function declarations are preferred. However, for Commander action callbacks, inline arrow functions are a common and acceptable pattern.

🔎 Optional: Extract handlers as named functions
+async function handleCreateProject(projectName: string | undefined, options: Record<string, unknown>) {
+  try {
+    const input = {
+      projectName,
+      // ... mapping logic
+    };
+    const result = await createProjectHandler(input);
+    if (options.verbose && result) {
+      console.log(JSON.stringify(result, null, 2));
+    }
+  } catch (error) {
+    handleError(error, "Failed to create project");
+    process.exit(1);
+  }
+}

 program
   .name("create-better-t-stack")
   // ... options
-  .action(async (projectName: string | undefined, options: Record<string, unknown>) => {
-    // ... handler logic
-  });
+  .action(handleCreateProject);

154-162: Empty catch block swallows error details.

The docs command catches errors but doesn't log any details about what went wrong. While the fallback message is helpful, logging the error would aid debugging.

🔎 Proposed improvement
     try {
       await openUrl(DOCS_URL);
       log.success(pc.blue("Opened docs in your default browser."));
-    } catch {
+    } catch (error) {
+      if (process.env.DEBUG) console.error(error);
       log.message(`Please visit ${DOCS_URL}`);
     }
apps/cli/bin/create-better-t-stack (1)

50-58: Fallback to raw platform/arch values may produce invalid package names.

When the platform or architecture isn't in the map, the code falls back to os.platform() or os.arch() directly. This could produce invalid package names (e.g., @better-t-stack/cli-freebsd-ia32) that don't exist, leading to confusing errors.

🔎 Consider failing early for unsupported platforms
 let platform = platformMap[os.platform()];
 if (!platform) {
-    platform = os.platform();
+    console.error(`Unsupported platform: ${os.platform()}`);
+    console.error("Supported platforms: darwin, linux, win32");
+    process.exit(1);
 }

 let arch = archMap[os.arch()];
 if (!arch) {
-    arch = os.arch();
+    console.error(`Unsupported architecture: ${os.arch()}`);
+    console.error("Supported architectures: x64, arm64");
+    process.exit(1);
 }
apps/cli/scripts/postinstall.mjs (2)

95-105: Symlink target name mismatch for Windows.

The function receives binaryName which is create-better-t-stack.exe on Windows, but Windows is skipped in main(). However, if someone modifies the Windows handling later, the symlink would use .exe extension which may not work correctly in bin directories.

Additionally, the symlink is created from sourcePath to targetPath, but on some systems relative symlinks are preferred for portability.


124-129: Outer try-catch around main() is redundant.

The main() function already has comprehensive try-catch handling internally. The outer try-catch at lines 124-129 will only catch synchronous errors from main() itself (not the async body), and main() doesn't throw synchronously.

🔎 Simpler approach
-try {
-  main();
-} catch (error) {
-  // Silently continue - postinstall failures shouldn't break the install
-  console.log("Postinstall completed with warnings.");
-}
+main().catch(() => {
+  console.log("Postinstall completed with warnings.");
+});
apps/cli/scripts/publish.ts (1)

96-103: Overwrites all optionalDependencies instead of updating.

This code replaces pkg.optionalDependencies entirely with only the built packages. If there were other optionalDependencies in package.json (though unlikely), they would be removed.

🔎 Safer merge approach
-const optionalDeps: Record<string, string> = {};
+const optionalDeps: Record<string, string> = pkg.optionalDependencies || {};
 for (const built of builtPackages) {
   optionalDeps[built.name] = built.version;
 }
apps/cli/scripts/build.ts (4)

69-73: Use type alias instead of interface per coding guidelines.

Per the coding guidelines for TypeScript files, type aliases should be used instead of interface declarations.

🔎 Proposed fix
-export interface BuiltPackage {
-  name: string;
-  version: string;
-  dirName: string;
-}
+export type BuiltPackage = {
+  name: string;
+  version: string;
+  dirName: string;
+};

Based on coding guidelines.


35-38: Use type alias instead of interface for Target.

Same as above - prefer type alias over interface per coding guidelines.

🔎 Proposed fix
-interface Target {
-  os: "linux" | "darwin" | "win32";
-  arch: "arm64" | "x64";
-}
+type Target = {
+  os: "linux" | "darwin" | "win32";
+  arch: "arm64" | "x64";
+};

Based on coding guidelines.


57-65: Cleaning all targets even when building single may be overly aggressive.

When --single flag is used (for local development), the script still cleans all platform directories. This could be intentional to ensure a clean state, but for local iteration it might be wasteful.

🔎 Optional: Clean only targeted platforms
 // Clean existing binary builds
-for (const target of allTargets) {
+for (const target of targets) {
   const platformName = target.os === "win32" ? "windows" : target.os;
   const dirName = `${scope.replace("@", "")}-cli-${platformName}-${target.arch}`;
   const outDir = path.join(projectDir, "dist", dirName);

122-122: Redundant ternary for os field.

The expression target.os === "win32" ? "win32" : target.os always evaluates to target.os since when target.os is "win32", it returns "win32".

🔎 Proposed fix
-      os: [target.os === "win32" ? "win32" : target.os],
+      os: [target.os],
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7d09793 and 7e7198c.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (32)
  • .github/workflows/pr-preview.yaml
  • .github/workflows/release.yaml
  • apps/cli/bin/create-better-t-stack
  • apps/cli/package.json
  • apps/cli/scripts/build.ts
  • apps/cli/scripts/postinstall.mjs
  • apps/cli/scripts/publish.ts
  • apps/cli/src/cli.ts
  • apps/cli/src/constants.ts
  • apps/cli/src/helpers/addons/fumadocs-setup.ts
  • apps/cli/src/helpers/addons/oxlint-setup.ts
  • apps/cli/src/helpers/addons/ruler-setup.ts
  • apps/cli/src/helpers/addons/starlight-setup.ts
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/addons/tui-setup.ts
  • apps/cli/src/helpers/addons/ultracite-setup.ts
  • apps/cli/src/helpers/addons/wxt-setup.ts
  • apps/cli/src/helpers/core/convex-codegen.ts
  • apps/cli/src/helpers/core/git.ts
  • apps/cli/src/helpers/core/install-dependencies.ts
  • apps/cli/src/helpers/core/project-config.ts
  • apps/cli/src/helpers/database-providers/mongodb-atlas-setup.ts
  • apps/cli/src/helpers/database-providers/neon-setup.ts
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
  • apps/cli/src/helpers/database-providers/supabase-setup.ts
  • apps/cli/src/helpers/database-providers/turso-setup.ts
  • apps/cli/src/utils/command-exists.ts
  • apps/cli/src/utils/docker-utils.ts
  • apps/cli/src/utils/file-formatter.ts
  • apps/cli/src/utils/get-latest-cli-version.ts
  • apps/cli/src/utils/open-url.ts
  • apps/cli/tsdown.config.ts
💤 Files with no reviewable changes (1)
  • apps/cli/tsdown.config.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/better-t-stack-repo.mdc)

Define functions using the standard function declaration syntax, not arrow functions

Files:

  • apps/cli/src/helpers/addons/wxt-setup.ts
  • apps/cli/src/helpers/addons/ruler-setup.ts
  • apps/cli/src/helpers/database-providers/mongodb-atlas-setup.ts
  • apps/cli/src/helpers/core/install-dependencies.ts
  • apps/cli/src/helpers/addons/starlight-setup.ts
  • apps/cli/src/helpers/addons/tui-setup.ts
  • apps/cli/src/cli.ts
  • apps/cli/src/helpers/addons/oxlint-setup.ts
  • apps/cli/src/constants.ts
  • apps/cli/src/utils/open-url.ts
  • apps/cli/src/helpers/addons/ultracite-setup.ts
  • apps/cli/src/utils/docker-utils.ts
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/core/git.ts
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
  • apps/cli/src/helpers/core/convex-codegen.ts
  • apps/cli/src/helpers/core/project-config.ts
  • apps/cli/src/helpers/database-providers/turso-setup.ts
  • apps/cli/src/utils/get-latest-cli-version.ts
  • apps/cli/src/helpers/addons/fumadocs-setup.ts
  • apps/cli/src/helpers/database-providers/supabase-setup.ts
  • apps/cli/src/utils/file-formatter.ts
  • apps/cli/scripts/publish.ts
  • apps/cli/src/utils/command-exists.ts
  • apps/cli/scripts/build.ts
  • apps/cli/src/helpers/database-providers/neon-setup.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/better-t-stack-repo.mdc)

**/*.{ts,tsx}: Use TypeScript type aliases instead of interface declarations
Do not use explicit return types

Files:

  • apps/cli/src/helpers/addons/wxt-setup.ts
  • apps/cli/src/helpers/addons/ruler-setup.ts
  • apps/cli/src/helpers/database-providers/mongodb-atlas-setup.ts
  • apps/cli/src/helpers/core/install-dependencies.ts
  • apps/cli/src/helpers/addons/starlight-setup.ts
  • apps/cli/src/helpers/addons/tui-setup.ts
  • apps/cli/src/cli.ts
  • apps/cli/src/helpers/addons/oxlint-setup.ts
  • apps/cli/src/constants.ts
  • apps/cli/src/utils/open-url.ts
  • apps/cli/src/helpers/addons/ultracite-setup.ts
  • apps/cli/src/utils/docker-utils.ts
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/core/git.ts
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
  • apps/cli/src/helpers/core/convex-codegen.ts
  • apps/cli/src/helpers/core/project-config.ts
  • apps/cli/src/helpers/database-providers/turso-setup.ts
  • apps/cli/src/utils/get-latest-cli-version.ts
  • apps/cli/src/helpers/addons/fumadocs-setup.ts
  • apps/cli/src/helpers/database-providers/supabase-setup.ts
  • apps/cli/src/utils/file-formatter.ts
  • apps/cli/scripts/publish.ts
  • apps/cli/src/utils/command-exists.ts
  • apps/cli/scripts/build.ts
  • apps/cli/src/helpers/database-providers/neon-setup.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)

**/*.{ts,tsx,js,jsx}: Use bun <file> instead of node <file> or ts-node <file> for running TypeScript/JavaScript files
Bun automatically loads .env files, so don't use the dotenv package
Use Bun.serve() which supports WebSockets, HTTPS, and routes instead of express
Use bun:sqlite module for SQLite instead of better-sqlite3
Use Bun.redis for Redis instead of ioredis
Use Bun.sql for Postgres instead of pg or postgres.js
Use built-in WebSocket instead of the ws package
Prefer Bun.file over node:fs readFile/writeFile methods
Use Bun.$ template literal syntax instead of execa for shell command execution
Import .css files directly in TypeScript/JavaScript files; Bun's CSS bundler will handle bundling
Run server with bun --hot <file> to enable hot reloading during development

Files:

  • apps/cli/src/helpers/addons/wxt-setup.ts
  • apps/cli/src/helpers/addons/ruler-setup.ts
  • apps/cli/src/helpers/database-providers/mongodb-atlas-setup.ts
  • apps/cli/src/helpers/core/install-dependencies.ts
  • apps/cli/src/helpers/addons/starlight-setup.ts
  • apps/cli/src/helpers/addons/tui-setup.ts
  • apps/cli/src/cli.ts
  • apps/cli/src/helpers/addons/oxlint-setup.ts
  • apps/cli/src/constants.ts
  • apps/cli/src/utils/open-url.ts
  • apps/cli/src/helpers/addons/ultracite-setup.ts
  • apps/cli/src/utils/docker-utils.ts
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/core/git.ts
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
  • apps/cli/src/helpers/core/convex-codegen.ts
  • apps/cli/src/helpers/core/project-config.ts
  • apps/cli/src/helpers/database-providers/turso-setup.ts
  • apps/cli/src/utils/get-latest-cli-version.ts
  • apps/cli/src/helpers/addons/fumadocs-setup.ts
  • apps/cli/src/helpers/database-providers/supabase-setup.ts
  • apps/cli/src/utils/file-formatter.ts
  • apps/cli/scripts/publish.ts
  • apps/cli/src/utils/command-exists.ts
  • apps/cli/scripts/build.ts
  • apps/cli/src/helpers/database-providers/neon-setup.ts
**/*.{ts,tsx,js,jsx,css}

📄 CodeRabbit inference engine (.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)

Use bun build <file> instead of webpack or esbuild for bundling TypeScript, JavaScript, and CSS files

Files:

  • apps/cli/src/helpers/addons/wxt-setup.ts
  • apps/cli/src/helpers/addons/ruler-setup.ts
  • apps/cli/src/helpers/database-providers/mongodb-atlas-setup.ts
  • apps/cli/src/helpers/core/install-dependencies.ts
  • apps/cli/src/helpers/addons/starlight-setup.ts
  • apps/cli/src/helpers/addons/tui-setup.ts
  • apps/cli/src/cli.ts
  • apps/cli/src/helpers/addons/oxlint-setup.ts
  • apps/cli/src/constants.ts
  • apps/cli/src/utils/open-url.ts
  • apps/cli/src/helpers/addons/ultracite-setup.ts
  • apps/cli/src/utils/docker-utils.ts
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/core/git.ts
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
  • apps/cli/src/helpers/core/convex-codegen.ts
  • apps/cli/src/helpers/core/project-config.ts
  • apps/cli/src/helpers/database-providers/turso-setup.ts
  • apps/cli/src/utils/get-latest-cli-version.ts
  • apps/cli/src/helpers/addons/fumadocs-setup.ts
  • apps/cli/src/helpers/database-providers/supabase-setup.ts
  • apps/cli/src/utils/file-formatter.ts
  • apps/cli/scripts/publish.ts
  • apps/cli/src/utils/command-exists.ts
  • apps/cli/scripts/build.ts
  • apps/cli/src/helpers/database-providers/neon-setup.ts
**/*.{html,tsx,ts,jsx,js}

📄 CodeRabbit inference engine (.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)

Use HTML imports with Bun.serve() for frontend instead of Vite

Files:

  • apps/cli/src/helpers/addons/wxt-setup.ts
  • apps/cli/src/helpers/addons/ruler-setup.ts
  • apps/cli/src/helpers/database-providers/mongodb-atlas-setup.ts
  • apps/cli/src/helpers/core/install-dependencies.ts
  • apps/cli/src/helpers/addons/starlight-setup.ts
  • apps/cli/src/helpers/addons/tui-setup.ts
  • apps/cli/src/cli.ts
  • apps/cli/src/helpers/addons/oxlint-setup.ts
  • apps/cli/src/constants.ts
  • apps/cli/src/utils/open-url.ts
  • apps/cli/src/helpers/addons/ultracite-setup.ts
  • apps/cli/src/utils/docker-utils.ts
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/core/git.ts
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
  • apps/cli/src/helpers/core/convex-codegen.ts
  • apps/cli/src/helpers/core/project-config.ts
  • apps/cli/src/helpers/database-providers/turso-setup.ts
  • apps/cli/src/utils/get-latest-cli-version.ts
  • apps/cli/src/helpers/addons/fumadocs-setup.ts
  • apps/cli/src/helpers/database-providers/supabase-setup.ts
  • apps/cli/src/utils/file-formatter.ts
  • apps/cli/scripts/publish.ts
  • apps/cli/src/utils/command-exists.ts
  • apps/cli/scripts/build.ts
  • apps/cli/src/helpers/database-providers/neon-setup.ts
🧠 Learnings (23)
📓 Common learnings
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css} : Use `bun build <file>` instead of `webpack` or `esbuild` for bundling TypeScript, JavaScript, and CSS files
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.$` template literal syntax instead of `execa` for shell command execution
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript/JavaScript files
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>`
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to {package.json,bun.lockb} : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install`
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `bun test` instead of `jest` or `vitest` for running tests
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.$` template literal syntax instead of `execa` for shell command execution

Applied to files:

  • apps/cli/src/helpers/addons/wxt-setup.ts
  • apps/cli/src/helpers/addons/ruler-setup.ts
  • apps/cli/src/helpers/database-providers/mongodb-atlas-setup.ts
  • apps/cli/src/helpers/core/install-dependencies.ts
  • apps/cli/src/helpers/addons/starlight-setup.ts
  • apps/cli/src/helpers/addons/tui-setup.ts
  • apps/cli/src/cli.ts
  • apps/cli/src/helpers/addons/oxlint-setup.ts
  • apps/cli/src/constants.ts
  • apps/cli/src/utils/open-url.ts
  • apps/cli/src/helpers/addons/ultracite-setup.ts
  • apps/cli/src/utils/docker-utils.ts
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/core/git.ts
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
  • apps/cli/src/helpers/core/convex-codegen.ts
  • apps/cli/src/helpers/core/project-config.ts
  • apps/cli/src/helpers/database-providers/turso-setup.ts
  • apps/cli/src/helpers/addons/fumadocs-setup.ts
  • apps/cli/src/helpers/database-providers/supabase-setup.ts
  • apps/cli/scripts/publish.ts
  • apps/cli/src/utils/command-exists.ts
  • apps/cli/scripts/build.ts
  • apps/cli/src/helpers/database-providers/neon-setup.ts
  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript/JavaScript files

Applied to files:

  • apps/cli/src/helpers/addons/wxt-setup.ts
  • apps/cli/src/helpers/addons/ruler-setup.ts
  • apps/cli/src/helpers/database-providers/mongodb-atlas-setup.ts
  • apps/cli/src/helpers/core/install-dependencies.ts
  • apps/cli/src/helpers/addons/starlight-setup.ts
  • apps/cli/src/helpers/addons/tui-setup.ts
  • apps/cli/src/cli.ts
  • apps/cli/src/helpers/addons/oxlint-setup.ts
  • apps/cli/src/constants.ts
  • apps/cli/src/utils/open-url.ts
  • apps/cli/src/helpers/addons/ultracite-setup.ts
  • apps/cli/src/utils/docker-utils.ts
  • apps/cli/bin/create-better-t-stack
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/core/git.ts
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
  • apps/cli/src/helpers/core/convex-codegen.ts
  • apps/cli/src/helpers/core/project-config.ts
  • apps/cli/src/helpers/database-providers/turso-setup.ts
  • apps/cli/src/helpers/addons/fumadocs-setup.ts
  • apps/cli/src/helpers/database-providers/supabase-setup.ts
  • apps/cli/src/utils/file-formatter.ts
  • apps/cli/scripts/publish.ts
  • apps/cli/src/utils/command-exists.ts
  • apps/cli/scripts/build.ts
  • apps/cli/src/helpers/database-providers/neon-setup.ts
  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css} : Use `bun build <file>` instead of `webpack` or `esbuild` for bundling TypeScript, JavaScript, and CSS files

Applied to files:

  • apps/cli/src/helpers/addons/wxt-setup.ts
  • apps/cli/src/helpers/addons/ruler-setup.ts
  • apps/cli/src/helpers/database-providers/mongodb-atlas-setup.ts
  • apps/cli/src/helpers/core/install-dependencies.ts
  • apps/cli/src/helpers/addons/starlight-setup.ts
  • apps/cli/src/helpers/addons/tui-setup.ts
  • apps/cli/src/cli.ts
  • apps/cli/src/helpers/addons/oxlint-setup.ts
  • apps/cli/src/constants.ts
  • apps/cli/src/helpers/addons/ultracite-setup.ts
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/core/git.ts
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
  • apps/cli/src/helpers/core/convex-codegen.ts
  • apps/cli/src/helpers/core/project-config.ts
  • apps/cli/src/helpers/addons/fumadocs-setup.ts
  • apps/cli/src/helpers/database-providers/supabase-setup.ts
  • apps/cli/src/utils/file-formatter.ts
  • apps/cli/scripts/publish.ts
  • apps/cli/scripts/build.ts
  • apps/cli/src/helpers/database-providers/neon-setup.ts
  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>`

Applied to files:

  • apps/cli/src/helpers/addons/wxt-setup.ts
  • apps/cli/src/helpers/addons/ruler-setup.ts
  • apps/cli/src/helpers/database-providers/mongodb-atlas-setup.ts
  • apps/cli/src/helpers/core/install-dependencies.ts
  • apps/cli/src/helpers/addons/starlight-setup.ts
  • apps/cli/src/helpers/addons/tui-setup.ts
  • apps/cli/src/helpers/addons/oxlint-setup.ts
  • apps/cli/src/constants.ts
  • apps/cli/src/helpers/addons/ultracite-setup.ts
  • apps/cli/src/utils/docker-utils.ts
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/core/git.ts
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
  • apps/cli/src/helpers/core/convex-codegen.ts
  • apps/cli/src/helpers/core/project-config.ts
  • apps/cli/src/helpers/database-providers/turso-setup.ts
  • apps/cli/src/helpers/addons/fumadocs-setup.ts
  • apps/cli/src/helpers/database-providers/supabase-setup.ts
  • apps/cli/scripts/publish.ts
  • apps/cli/scripts/build.ts
  • apps/cli/src/helpers/database-providers/neon-setup.ts
  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `bun test` instead of `jest` or `vitest` for running tests

Applied to files:

  • apps/cli/src/helpers/addons/wxt-setup.ts
  • apps/cli/src/helpers/addons/ruler-setup.ts
  • apps/cli/src/helpers/addons/tui-setup.ts
  • apps/cli/src/helpers/addons/oxlint-setup.ts
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/core/git.ts
  • apps/cli/scripts/build.ts
  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to {package.json,bun.lockb} : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install`

Applied to files:

  • apps/cli/src/helpers/addons/wxt-setup.ts
  • apps/cli/src/helpers/addons/ruler-setup.ts
  • apps/cli/src/helpers/database-providers/mongodb-atlas-setup.ts
  • apps/cli/src/helpers/core/install-dependencies.ts
  • apps/cli/src/helpers/addons/starlight-setup.ts
  • apps/cli/src/helpers/addons/tui-setup.ts
  • apps/cli/src/helpers/addons/oxlint-setup.ts
  • apps/cli/src/constants.ts
  • apps/cli/src/helpers/addons/ultracite-setup.ts
  • apps/cli/src/utils/docker-utils.ts
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/core/git.ts
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
  • apps/cli/src/helpers/core/convex-codegen.ts
  • apps/cli/src/helpers/core/project-config.ts
  • apps/cli/src/helpers/database-providers/turso-setup.ts
  • apps/cli/src/helpers/addons/fumadocs-setup.ts
  • apps/cli/src/helpers/database-providers/supabase-setup.ts
  • apps/cli/scripts/publish.ts
  • apps/cli/scripts/build.ts
  • apps/cli/src/helpers/database-providers/neon-setup.ts
  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Prefer `Bun.file` over `node:fs` readFile/writeFile methods

Applied to files:

  • apps/cli/src/helpers/addons/wxt-setup.ts
  • apps/cli/src/helpers/addons/ruler-setup.ts
  • apps/cli/src/helpers/addons/starlight-setup.ts
  • apps/cli/src/helpers/addons/tui-setup.ts
  • apps/cli/src/helpers/addons/oxlint-setup.ts
  • apps/cli/src/constants.ts
  • apps/cli/src/utils/docker-utils.ts
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/core/git.ts
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
  • apps/cli/src/helpers/core/convex-codegen.ts
  • apps/cli/src/helpers/core/project-config.ts
  • apps/cli/src/helpers/addons/fumadocs-setup.ts
  • apps/cli/src/utils/file-formatter.ts
  • apps/cli/src/helpers/database-providers/neon-setup.ts
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `bun:test` module with `test` and `expect` functions for writing tests

Applied to files:

  • apps/cli/src/helpers/addons/wxt-setup.ts
  • apps/cli/src/helpers/database-providers/mongodb-atlas-setup.ts
  • apps/cli/src/helpers/addons/starlight-setup.ts
  • apps/cli/src/helpers/addons/tui-setup.ts
  • apps/cli/src/helpers/addons/oxlint-setup.ts
  • apps/cli/src/constants.ts
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
  • apps/cli/src/helpers/core/convex-codegen.ts
  • apps/cli/src/helpers/addons/fumadocs-setup.ts
  • apps/cli/scripts/publish.ts
  • apps/cli/scripts/build.ts
  • apps/cli/src/helpers/database-providers/neon-setup.ts
  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use the dotenv package

Applied to files:

  • apps/cli/src/helpers/addons/starlight-setup.ts
  • apps/cli/src/helpers/addons/tui-setup.ts
  • apps/cli/src/helpers/addons/oxlint-setup.ts
  • apps/cli/src/constants.ts
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/core/convex-codegen.ts
  • apps/cli/src/helpers/core/project-config.ts
  • apps/cli/src/helpers/database-providers/neon-setup.ts
  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun:sqlite` module for SQLite instead of `better-sqlite3`

Applied to files:

  • apps/cli/src/constants.ts
  • apps/cli/src/utils/docker-utils.ts
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
  • apps/cli/src/helpers/database-providers/turso-setup.ts
  • apps/cli/src/helpers/database-providers/supabase-setup.ts
  • apps/cli/scripts/build.ts
  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.serve()` which supports WebSockets, HTTPS, and routes instead of `express`

Applied to files:

  • apps/cli/src/constants.ts
📚 Learning: 2025-12-18T19:15:48.478Z
Learnt from: therealsamyak
Repo: AmanVarshney01/create-better-t-stack PR: 711
File: apps/cli/src/helpers/addons/ultracite-setup.ts:200-205
Timestamp: 2025-12-18T19:15:48.478Z
Learning: In apps/cli/src/helpers/addons/ultracite-setup.ts, when passing the Ultracite CLI --integrations flag, supply git hooks as a single space-separated string (e.g., gitHooks.join(" ")) rather than spreading the array like other Ultracite flags. This has been tested and confirmed to work. Ensure the code uses a single string created by joining the gitHooks array with spaces for the --integrations argument.

Applied to files:

  • apps/cli/src/helpers/addons/ultracite-setup.ts
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.sql` for Postgres instead of `pg` or `postgres.js`

Applied to files:

  • apps/cli/src/utils/docker-utils.ts
  • apps/cli/src/helpers/addons/tauri-setup.ts
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
  • apps/cli/src/helpers/database-providers/turso-setup.ts
  • apps/cli/src/helpers/database-providers/supabase-setup.ts
📚 Learning: 2025-12-18T19:15:48.478Z
Learnt from: therealsamyak
Repo: AmanVarshney01/create-better-t-stack PR: 711
File: apps/cli/src/helpers/addons/ultracite-setup.ts:200-205
Timestamp: 2025-12-18T19:15:48.478Z
Learning: In apps/cli/src/helpers/addons/ultracite-setup.ts, the Ultracite CLI's `--integrations` flag requires git hooks to be passed as a single space-separated string (e.g., `gitHooks.join(" ")`) rather than using the spread operator like other Ultracite flags. This has been tested and confirmed to work.

Applied to files:

  • apps/cli/src/helpers/core/git.ts
📚 Learning: 2025-12-03T07:48:14.714Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/convex_rules.mdc:0-0
Timestamp: 2025-12-03T07:48:14.714Z
Learning: Applies to convex/**/*.ts : ONLY call an action from another action if you need to cross runtimes; otherwise, pull out shared code into a helper async function and call that directly

Applied to files:

  • apps/cli/src/helpers/core/convex-codegen.ts
📚 Learning: 2025-12-03T07:48:14.714Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/convex_rules.mdc:0-0
Timestamp: 2025-12-03T07:48:14.714Z
Learning: Applies to convex/**/*.ts : ALWAYS use the new function syntax for Convex functions with explicit args, returns, and handler properties

Applied to files:

  • apps/cli/src/helpers/core/convex-codegen.ts
📚 Learning: 2025-12-03T07:48:14.714Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/convex_rules.mdc:0-0
Timestamp: 2025-12-03T07:48:14.714Z
Learning: Applies to convex/**/*.ts : Use the internal object from convex/_generated/api.ts to call internal/private functions registered with internalQuery, internalMutation, or internalAction

Applied to files:

  • apps/cli/src/helpers/core/convex-codegen.ts
📚 Learning: 2025-12-03T07:48:14.714Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/convex_rules.mdc:0-0
Timestamp: 2025-12-03T07:48:14.714Z
Learning: Applies to convex/crons.ts : If a cron calls an internal function, always import the internal object from '_generated/api', even if the internal function is registered in the same file

Applied to files:

  • apps/cli/src/helpers/core/convex-codegen.ts
📚 Learning: 2025-12-03T07:48:14.714Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/convex_rules.mdc:0-0
Timestamp: 2025-12-03T07:48:14.714Z
Learning: Applies to convex/**/*.ts : Convex uses file-based routing; a public function defined in convex/example.ts named f has function reference api.example.f

Applied to files:

  • apps/cli/src/helpers/core/convex-codegen.ts
📚 Learning: 2025-12-03T07:48:14.714Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/convex_rules.mdc:0-0
Timestamp: 2025-12-03T07:48:14.714Z
Learning: Applies to convex/**/*.ts : Always add 'use node'; to the top of files containing actions that use Node.js built-in modules

Applied to files:

  • apps/cli/src/helpers/core/convex-codegen.ts
📚 Learning: 2025-12-03T07:48:14.714Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/convex_rules.mdc:0-0
Timestamp: 2025-12-03T07:48:14.714Z
Learning: Applies to package.json : Always add types/node to your package.json when using any Node.js built-in modules

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.redis` for Redis instead of `ioredis`

Applied to files:

  • apps/cli/package.json
🧬 Code graph analysis (4)
apps/cli/src/cli.ts (2)
apps/cli/src/types.ts (15)
  • Template (62-62)
  • Database (47-47)
  • ORM (48-48)
  • Auth (57-57)
  • Frontend (51-51)
  • Addons (52-52)
  • Examples (53-53)
  • PackageManager (54-54)
  • DatabaseSetup (55-55)
  • Backend (49-49)
  • Runtime (50-50)
  • API (56-56)
  • WebDeploy (59-59)
  • ServerDeploy (60-60)
  • DirectoryConflict (61-61)
apps/cli/src/index.ts (14)
  • Template (247-247)
  • Database (234-234)
  • ORM (235-235)
  • Frontend (238-238)
  • Addons (239-239)
  • Examples (240-240)
  • PackageManager (241-241)
  • DatabaseSetup (242-242)
  • Backend (236-236)
  • Runtime (237-237)
  • API (243-243)
  • WebDeploy (244-244)
  • ServerDeploy (245-245)
  • DirectoryConflict (246-246)
apps/cli/src/helpers/addons/oxlint-setup.ts (1)
apps/cli/src/utils/package-runner.ts (1)
  • getPackageExecutionCommand (11-23)
apps/cli/scripts/publish.ts (2)
apps/cli/scripts/postinstall.mjs (3)
  • __dirname (16-16)
  • binaryName (56-56)
  • binaryPath (62-62)
apps/cli/scripts/build.ts (2)
  • version (158-158)
  • builtPackages (158-158)
apps/cli/scripts/build.ts (1)
apps/cli/scripts/postinstall.mjs (5)
  • __dirname (16-16)
  • packageName (55-55)
  • binaryName (56-56)
  • binDir (75-75)
  • binaryPath (62-62)
🔇 Additional comments (39)
apps/cli/src/helpers/database-providers/neon-setup.ts (2)

124-124: .cwd() method is correct for Bun $ template literals.

The .cwd(targetDir) usage is the correct Bun API for setting the working directory when executing shell commands with `$`` template literals.


4-4: No changes needed—the migration is correct.

The .text() method preserves stdout including trailing newlines, matching execa behavior. The return type change to { stdout: string } is consistently handled at line 61 with destructuring, and JSON parsing will work identically.

apps/cli/src/helpers/addons/starlight-setup.ts (1)

4-4: LGTM! Successful migration from execa to Bun's $ syntax.

The refactoring correctly replaces execa with Bun's native command execution:

  • Import updated to use $ from "bun"
  • Command execution properly uses ${{ raw: ... }} for the pre-constructed command string
  • Working directory and environment variable configuration correctly chained with .cwd() and .env()

This change aligns with the coding guidelines and is consistent with the pattern used across other addon setup files in this PR.

Based on learnings: "Use Bun.$ template literal syntax instead of execa for shell command execution"

Also applies to: 36-36

apps/cli/src/helpers/addons/wxt-setup.ts (2)

3-3: LGTM! Migration to Bun's $ is correct.

The import correctly replaces execa with Bun's native command execution, aligning with the coding guidelines and project-wide migration strategy.

Based on learnings, coding guidelines specify using Bun.$ template literal syntax instead of execa for shell command execution.


63-63: The ${{ raw: ... }} syntax is valid Bun $ template literal syntax. When a value in the tagged template is an object with a raw key, the value is not escaped. This allows the wxtInitCommand variable to be interpolated without escaping special shell characters, which is the intended behavior here. No changes needed.

Likely an incorrect or invalid review comment.

apps/cli/src/helpers/database-providers/turso-setup.ts (5)

5-5: LGTM! Migration to Bun's command execution.

The import correctly replaces execa with Bun's native $ shell execution API, aligning with the repository's migration strategy.

Based on learnings and coding guidelines.


21-28: LGTM! Correct migration to Bun's command execution.

The function correctly uses $.text() to capture command output and properly checks for the login status message.

Based on learnings.


66-90: LGTM! Correct migration with improved type safety.

The function correctly migrates to Bun's $.text() for command output capture, and the added type annotation on line 78 improves type safety for the parsing logic.

Based on learnings.


92-117: LGTM! Enhanced type safety.

The explicit type annotation for the mapped group parameter improves code clarity and type safety.


119-153: LGTM! Correct migration to Bun's command execution.

The function correctly migrates to Bun's $.text() for retrieving database credentials, with appropriate trimming applied to the outputs. Bun's template literal syntax handles safe interpolation of the dbName parameter.

Based on learnings.

apps/cli/src/utils/file-formatter.ts (1)

1-5: Clear documentation of the breaking change.

The comments effectively explain the rationale for removing oxfmt and set clear expectations for users. This aligns well with the PR's goal of enabling bun compile compatibility.

apps/cli/src/helpers/database-providers/supabase-setup.ts (3)

4-4: LGTM! Correct Bun import for shell execution.

The import of $ from "bun" correctly replaces execa for shell command execution, aligning with the repository's coding guidelines and the broader PR objective.

Based on learnings, this follows the standard pattern for migrating to Bun's native command execution.


57-57: Correct migration to Bun's $ syntax.

The command execution correctly uses ${{ raw: supabaseInitCommand }} with .cwd(serverDir) to initialize Supabase. The raw interpolation properly handles the pre-constructed command string from getPackageExecutionCommand.


81-83: Command execution and stdout capture look correct.

The migration to Bun's $ syntax properly captures stdout for extracting the database URL. Bun's $ streams output to the terminal by default while still allowing capture via result.stdout, which satisfies the comment's requirement.

apps/cli/src/utils/docker-utils.ts (1)

2-2: LGTM - Clean migration to Bun's $ executor.

The migration from execa to Bun's $ aligns with project guidelines. The .quiet() modifier appropriately suppresses output since isDockerRunning() only needs to check command success/failure.

Based on learnings, using Bun.$ template literal syntax instead of execa for shell command execution is the recommended approach.

Also applies to: 13-13

apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts (1)

4-4: LGTM - Proper Bun $ migration with context preservation.

The migration correctly preserves the working directory context and retrieves stdout via .text() for JSON parsing. The ${{ raw: ... }} syntax is appropriate for the pre-constructed command string.

Based on learnings, this aligns with the project's preference for Bun's $ over execa.

Also applies to: 55-55

apps/cli/src/helpers/core/project-config.ts (1)

3-3: LGTM - Simplified stdout handling with Bun.

The migration cleanly eliminates destructuring since Bun's .text() returns the stdout string directly. Working directory context is preserved.

Based on learnings, this follows the project guideline to use Bun's $ template literal syntax.

Also applies to: 96-97

apps/cli/src/helpers/addons/ruler-setup.ts (1)

3-3: LGTM - CI environment and working directory preserved.

The migration correctly maintains both the working directory and CI environment variable, ensuring consistent behavior with the previous execa implementation.

Based on learnings, this aligns with using Bun's $ for shell command execution.

Also applies to: 97-97

apps/cli/src/helpers/addons/oxlint-setup.ts (1)

3-3: LGTM - Consistent migration for both commands.

Both oxlint and oxfmt initialization commands are properly migrated with working directory and CI environment preserved. The use of ${{ raw: ... }} is appropriate for the pre-constructed command strings.

Based on learnings, this follows the project standard for Bun-based command execution.

Also applies to: 31-31, 34-34

apps/cli/src/helpers/addons/tui-setup.ts (1)

3-3: LGTM - Complete context preservation.

The migration correctly preserves both the working directory (appsDir) and CI environment variable, maintaining consistent behavior with the execa implementation.

Based on learnings, this aligns with the project's Bun-based execution approach.

Also applies to: 55-55

apps/cli/src/helpers/addons/ultracite-setup.ts (1)

2-2: LGTM - Execution context properly maintained.

The migration correctly preserves working directory and CI environment. The git hooks integration (Lines 200-202) correctly passes integrations as separate arguments per the established learning, and this remains unchanged by the execa-to-Bun migration.

Based on learnings, this follows the project guideline for Bun $ usage.

Also applies to: 212-212

apps/cli/src/helpers/addons/fumadocs-setup.ts (1)

76-76: LGTM!

The migration from execa to Bun's $ is correct. Using ${{ raw: ... }} properly executes the full command string with the configured working directory and environment variables. The surrounding try/catch block appropriately handles failures.

apps/cli/src/utils/command-exists.ts (1)

1-16: LGTM!

The migration from execa to Bun's $ is correct. Both branches properly use .nothrow().quiet() to suppress errors and output, and the logic correctly determines command existence based on the exit code.

apps/cli/src/helpers/addons/tauri-setup.ts (1)

81-81: LGTM!

The migration from execa to Bun's $ is correct and consistent with other addon setup functions. The ${{ raw: ... }} syntax properly executes the full command string, and the surrounding try/catch block handles failures appropriately.

apps/cli/src/constants.ts (1)

46-82: Verify PKG_ROOT detection in common deployment scenarios.

The PKG_ROOT detection logic has multiple fallbacks with 4+ filesystem checks in the worst case. While the defensive approach is good, verify that this works correctly in:

  1. NPM global installations (npm install -g)
  2. npx executions (npx create-better-t-stack)
  3. Compiled binary from platform-specific packages
  4. Development mode (bun run)
  5. Symlinked binary locations

Generate verification tests or manual test cases to ensure PKG_ROOT resolves correctly in these scenarios. Consider adding logging in development mode to debug path resolution issues:

if (process.env.DEBUG_PKG_ROOT) {
  console.log("Binary path:", process.execPath);
  console.log("Resolved PKG_ROOT:", getPkgRoot());
}
apps/cli/src/utils/get-latest-cli-version.ts (1)

10-17: The build script correctly passes --define CLI_VERSION="${version}" to Bun (apps/cli/scripts/build.ts, lines 101-102), so the compile-time definition is properly configured. The typeof check is safe with Bun's --define mechanism, which performs AST-level identifier replacement and correctly handles typeof operators. No changes needed.

Likely an incorrect or invalid review comment.

.github/workflows/pr-preview.yaml (2)

69-81: LGTM - Proper version propagation to optionalDependencies.

The jq command correctly updates both the main version and all platform-specific optionalDependencies in a single atomic operation, ensuring version consistency across all packages.


93-103: No changes needed. The BTS_TELEMETRY environment variable is not required in the publishing step because telemetry code only executes during actual CLI usage, not during the npm publish build operation. The isTelemetryEnabled() function is only called within trackProjectCreation(), which is invoked when users run the CLI command, not during package publishing.

Likely an incorrect or invalid review comment.

.github/workflows/release.yaml (2)

164-180: Archive format logic may be incorrect for Darwin (macOS).

The condition [[ "$name" == *"linux"* ]] creates .tar.gz only for Linux, meaning Darwin (macOS) will get .zip files. While this works, the conventional format for macOS is also .tar.gz. However, this is a minor preference issue - .zip is universally accessible.

More importantly, the zip -j command flattens the directory structure, which is correct for single-binary distribution.


113-113: Version specifier inconsistency between types dependency and optionalDependencies.

The types dependency uses ^$VERSION (caret range) while optionalDependencies in lines 121-125 use exact $VERSION. This is likely intentional (types can be flexible, platform binaries must match exactly), but worth confirming this is the desired behavior.

apps/cli/bin/create-better-t-stack (2)

18-28: LGTM - Correct process spawning and exit code forwarding.

The run function properly:

  • Uses spawnSync with stdio: "inherit" to forward all I/O
  • Handles spawn errors by logging and exiting with code 1
  • Correctly forwards the child process exit code (defaulting to 0 if null)

64-82: Upward directory traversal is correctly bounded.

The findBinary function safely traverses upward through parent directories and correctly terminates when reaching the filesystem root (parent === current). This handles monorepo and hoisted dependency scenarios well.

apps/cli/scripts/publish.ts (1)

34-34: Dynamic import executes build.ts as a side effect.

The await import("./build.ts") executes the entire build script to get builtPackages. This is an unusual pattern - typically you'd call a function. However, it works since build.ts exports the results after execution.

apps/cli/scripts/build.ts (1)

91-108: LGTM - Correct use of Bun's native build/compile.

The build command correctly uses bun build --compile with appropriate flags:

  • --minify for smaller binaries
  • --target for cross-compilation
  • --define for compile-time constants
  • Proper stdout/stderr piping for error capture

Based on learnings, the use of bun build is correct per coding guidelines.

apps/cli/package.json (3)

39-45: LGTM - Correct bin and files configuration for new distribution model.

The configuration correctly:

  • Points bin to the Node.js launcher stub (not the Bun binary)
  • Includes bin, templates, and scripts/postinstall.mjs in published files
  • Excludes the dist directory (platform binaries are separate packages)

60-61: Good defensive postinstall configuration.

Using node ./scripts/postinstall.mjs || true ensures:

  1. The postinstall runs with Node (available before Bun binary is set up)
  2. Failures don't break the install (fallback to bin stub works)

84-90: Verify that CI workflows actually update optionalDependencies versions before publishing.

The optionalDependencies list platform binaries with version 3.11.0 hardcoded. Confirm whether release.yaml and pr-preview.yaml contain steps to synchronize these versions during the publish process, or if this requires manual coordination.

apps/cli/src/cli.ts (1)

36-39: No action needed. getLatestCLIVersion() does not make network calls—it only reads the local package.json synchronously or returns a compile-time embedded version. No blocking network delays occur at CLI startup.

Likely an incorrect or invalid review comment.

apps/cli/src/utils/open-url.ts (1)

2-2: LGTM! Correct migration to Bun's command execution.

The import correctly replaces execa with Bun's native $ utility, aligning with the project's Bun-first strategy.

Based on learnings, use Bun.$ template literal syntax instead of execa for shell command execution.

Comment thread apps/cli/scripts/postinstall.mjs Outdated
Comment on lines +83 to +90
// Remove existing binary/symlink if it exists
try {
if (fs.existsSync(targetPath) || fs.lstatSync(targetPath).isSymbolicLink()) {
fs.unlinkSync(targetPath);
}
} catch {
// File doesn't exist, that's fine
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Logic error: lstatSync called after existsSync returns false.

The condition fs.existsSync(targetPath) || fs.lstatSync(targetPath).isSymbolicLink() has a bug. If existsSync returns false, the || operator evaluates the right side, but lstatSync will throw ENOENT for a non-existent path.

🔎 Proposed fix
   // Remove existing binary/symlink if it exists
   try {
-    if (fs.existsSync(targetPath) || fs.lstatSync(targetPath).isSymbolicLink()) {
+    const stats = fs.lstatSync(targetPath);
+    if (stats) {
       fs.unlinkSync(targetPath);
     }
   } catch {
     // File doesn't exist, that's fine
   }

Or simply:

   // Remove existing binary/symlink if it exists
   try {
-    if (fs.existsSync(targetPath) || fs.lstatSync(targetPath).isSymbolicLink()) {
-      fs.unlinkSync(targetPath);
-    }
+    fs.unlinkSync(targetPath);
   } catch {
     // File doesn't exist, that's fine
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Remove existing binary/symlink if it exists
try {
if (fs.existsSync(targetPath) || fs.lstatSync(targetPath).isSymbolicLink()) {
fs.unlinkSync(targetPath);
}
} catch {
// File doesn't exist, that's fine
}
// Remove existing binary/symlink if it exists
try {
const stats = fs.lstatSync(targetPath);
if (stats) {
fs.unlinkSync(targetPath);
}
} catch {
// File doesn't exist, that's fine
}
Suggested change
// Remove existing binary/symlink if it exists
try {
if (fs.existsSync(targetPath) || fs.lstatSync(targetPath).isSymbolicLink()) {
fs.unlinkSync(targetPath);
}
} catch {
// File doesn't exist, that's fine
}
// Remove existing binary/symlink if it exists
try {
fs.unlinkSync(targetPath);
} catch {
// File doesn't exist, that's fine
}
🤖 Prompt for AI Agents
In apps/cli/scripts/postinstall.mjs around lines 83-90, the condition calls
fs.lstatSync when fs.existsSync is false causing ENOENT; change the logic so
lstatSync is only called for existing paths — e.g., first check existsSync and
only if false skip lstat, or wrap lstatSync in a try/catch and test
isSymbolicLink from the caught stat; update the if to avoid evaluating lstatSync
for non-existent paths so unlinkSync is only attempted when the path actually
exists or is a symlink.

Comment on lines +22 to +24
const tag = process.argv.includes("--tag")
? process.argv[process.argv.indexOf("--tag") + 1]
: "latest";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Missing validation for --tag argument.

If --tag is the last argument without a value, process.argv[process.argv.indexOf("--tag") + 1] will be undefined, and tag will be undefined instead of "latest".

🔎 Proposed fix
 const tag = process.argv.includes("--tag")
-  ? process.argv[process.argv.indexOf("--tag") + 1]
+  ? process.argv[process.argv.indexOf("--tag") + 1] || "latest"
   : "latest";
+
+if (!tag || tag.startsWith("--")) {
+  console.error("Error: --tag requires a value");
+  process.exit(1);
+}
🤖 Prompt for AI Agents
In apps/cli/scripts/publish.ts around lines 22 to 24, the --tag parsing assumes
a value follows the flag and can return undefined if --tag is the last arg;
update the logic to validate the next argv entry exists and is not another flag
(e.g., starts with "-"); if the next entry is missing or looks like a flag, set
tag to "latest"; keep existing behavior otherwise (use the next argv value).

console.log(` Publishing ${built.name}@${built.version}...`);
try {
await $`bun pm pack`.cwd(pkgDir).quiet();
await $`npm publish *.tgz --access public --tag ${tag}`.cwd(pkgDir);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Replace npm publish with bun publish for consistency with project standards.

While bun publish supports both the --access flag and --tag flag used in this command, the code requires shell expansion or looping to handle the glob pattern *.tgz. Bun's publish command accepts a path to the output tarball as a single argument, meaning the glob pattern would need to be expanded by the shell or in code. If multiple tarballs must be published sequentially, use a loop: for tgz in *.tgz; do bun publish "$tgz" --access public --tag ${tag}; done or equivalent.

🤖 Prompt for AI Agents
In apps/cli/scripts/publish.ts around line 84, replace the single `npm publish
*.tgz --access public --tag ${tag}` invocation with logic that uses `bun
publish` (project standard) and expands the `*.tgz` glob in code or via a loop;
implement iteration over all tarballs found in pkgDir and call `bun publish
<tarball> --access public --tag ${tag}` for each one, ensuring cwd is pkgDir and
preserving the same flags and error handling as the original call.

Comment on lines +21 to +22
await $`git add -A`.cwd(projectDir).quiet();
await $`git commit -m ${"initial commit"}`.cwd(projectDir).quiet();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Add .nothrow() to prevent unhandled git failures.

Both git add and git commit can fail (e.g., if there are no changes to commit or if git configuration is missing). Without .nothrow(), these commands will throw unhandled exceptions and crash the CLI. Lines 8 and 15 correctly use .nothrow() for error tolerance.

🔎 Proposed fix
-  await $`git add -A`.cwd(projectDir).quiet();
-  await $`git commit -m ${"initial commit"}`.cwd(projectDir).quiet();
+  await $`git add -A`.cwd(projectDir).nothrow().quiet();
+  await $`git commit -m ${"initial commit"}`.cwd(projectDir).nothrow().quiet();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await $`git add -A`.cwd(projectDir).quiet();
await $`git commit -m ${"initial commit"}`.cwd(projectDir).quiet();
await $`git add -A`.cwd(projectDir).nothrow().quiet();
await $`git commit -m ${"initial commit"}`.cwd(projectDir).nothrow().quiet();
🤖 Prompt for AI Agents
In apps/cli/src/helpers/core/git.ts around lines 21 to 22, the two shell
invocations `git add -A` and `git commit -m "initial commit"` currently can
throw and crash the CLI; update both calls to append `.nothrow()` so failures
are tolerated (i.e., change to use `.nothrow()` on each command invocation),
keeping the `.cwd(projectDir).quiet()` chain intact.

cwd: projectDir,
stderr: "inherit",
})`${packageManager} install`;
await $`${packageManager} install`.cwd(projectDir);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Restore stderr output for better user experience.

The previous implementation used stderr: "inherit" to show installation errors and progress to users in real-time. Without this, users won't see package manager output during dependency installation, which can make the CLI appear frozen during long installations.

🔎 Proposed fix

To show stderr to users, chain .stderr("inherit") to the command:

-    await $`${packageManager} install`.cwd(projectDir);
+    await $`${packageManager} install`.cwd(projectDir).stderr("inherit");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
await $`${packageManager} install`.cwd(projectDir);
await $`${packageManager} install`.cwd(projectDir).stderr("inherit");
🤖 Prompt for AI Agents
In apps/cli/src/helpers/core/install-dependencies.ts around line 20 the spawn of
the package manager hides stderr leading to no real-time install output; update
the invocation to forward stderr by chaining .stderr("inherit") to the command
(i.e., await $`${packageManager} install`.cwd(projectDir).stderr("inherit")) so
users see installation errors/progress in real time.

shell: true,
stdio: "inherit",
});
await $`atlas deployments setup`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find the file and examine its contents and surrounding context
find . -type f -name "mongodb-atlas-setup.ts" -o -name "*mongodb*atlas*" | head -20

Repository: AmanVarshney01/create-better-t-stack

Length of output: 144


🏁 Script executed:

#!/bin/bash
git ls-files | grep -i "mongodb\|atlas" | head -20

Repository: AmanVarshney01/create-better-t-stack

Length of output: 807


Bun's $ executor requires explicit stdin inheritance configuration for interactive commands.

Bun v1.0.36 fixed a bug where user input was not sent to interactive subprocesses, which affected packages like @inquirer/prompts. More importantly, Bun's native terminal API for interactive programs was only recently introduced in v1.3.5, and the default stdin for Bun.spawn is "ignore", null, or undefined (no standard input). The Bun $ template literal's stdin inheritance behavior is not explicitly documented for interactive CLI commands. Since the atlas deployments setup command operates in interactive mode, the change from execa to Bun's $ may break user input handling. Explicitly configure stdin inheritance or test thoroughly to confirm interactive prompts work correctly with the current implementation.

🤖 Prompt for AI Agents
In apps/cli/src/helpers/database-providers/mongodb-atlas-setup.ts around line
47, the call using Bun's $ executor to run the interactive "atlas deployments
setup" command does not explicitly inherit stdin, which can break interactive
prompts; update the invocation to explicitly inherit stdin (or use Bun.spawn
with { stdin: "inherit" } / equivalent API) so user input is passed through, and
then test the interactive flow to confirm prompts work correctly across Bun
versions.

Comment on lines +90 to +92
if (error instanceof Error) {
consola.error(`Error details: ${error.message}`);
if (error.message.includes("Docker is not running")) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if the file exists and read the specified lines
fd supabase-setup.ts --type f | head -1 | xargs cat -n | sed -n '80,105p'

Repository: AmanVarshney01/create-better-t-stack

Length of output: 1131


🏁 Script executed:

#!/bin/bash
# Find and examine the supabase setup file
find . -name "supabase-setup.ts" -type f 2>/dev/null | head -1

Repository: AmanVarshney01/create-better-t-stack

Length of output: 139


🏁 Script executed:

#!/bin/bash
# List files to find the supabase setup file
git ls-files | grep -i supabase | grep -i setup

Repository: AmanVarshney01/create-better-t-stack

Length of output: 137


🏁 Script executed:

#!/bin/bash
# Create and run the verification test for Bun $ error messages
cat > /tmp/test_bun_errors.ts << 'EOF'
import { $ } from "bun";

async function testENOENT() {
  try {
    await $`nonexistent_command_xyz_12345`.nothrow();
  } catch (error) {
    if (error instanceof Error) {
      console.log("ENOENT test - Error message:", error.message);
      console.log("Contains ENOENT:", error.message.includes("ENOENT"));
    }
  }
}

async function testDockerNotRunning() {
  // Try running docker ps which would fail if docker isn't running
  const result = await $`docker ps`.nothrow();
  if (result.exitCode !== 0) {
    const stderr = result.stderr.toString();
    const stdout = result.stdout.toString();
    const combinedOutput = stderr + stdout;
    console.log("\nDocker test - Exit code:", result.exitCode);
    console.log("Docker stderr/stdout:", combinedOutput);
    console.log("Contains 'Docker is not running':", combinedOutput.includes("Docker is not running"));
    console.log("Contains 'Cannot connect':", combinedOutput.includes("Cannot connect"));
    console.log("Contains 'daemon':", combinedOutput.includes("daemon"));
  } else {
    console.log("Docker is running normally");
  }
}

await testENOENT();
await testDockerNotRunning();
EOF

# Check if bun is available and run the test
if command -v bun &> /dev/null; then
  bun /tmp/test_bun_errors.ts
else
  echo "Bun is not installed in this environment"
fi

Repository: AmanVarshney01/create-better-t-stack

Length of output: 120


🏁 Script executed:

#!/bin/bash
# Test error message formats in Bun
mkdir -p /tmp/bun_test
cd /tmp/bun_test

# Test 1: Check ENOENT message format
echo "Test 1: ENOENT error message format"
cat > test_enoent.ts << 'TSEOF'
import { $ } from "bun";

try {
  const result = await $`ls /nonexistent_path_xyz_12345`.nothrow().quiet();
  console.log("Exit code:", result.exitCode);
  console.log("Stderr:", result.stderr.toString());
} catch (e) {
  console.log("Caught exception:", e);
}
TSEOF

# Test 2: Docker command error
echo -e "\nTest 2: Docker command error format"
cat > test_docker.ts << 'TSEOF'
import { $ } from "bun";

try {
  // Run docker ps - if docker isn't running, it will error
  const result = await $`docker ps`.nothrow().quiet();
  console.log("Docker exit code:", result.exitCode);
  if (result.exitCode !== 0) {
    console.log("Docker stderr:", result.stderr.toString());
  } else {
    console.log("Docker is running");
  }
} catch (e) {
  console.log("Caught exception:", e);
}
TSEOF

# Try to run tests if bun exists
if command -v bun &> /dev/null; then
  echo "Running ENOENT test..."
  bun test_enoent.ts 2>&1 | head -20
  
  echo -e "\nRunning Docker test..."
  bun test_docker.ts 2>&1 | head -20
else
  echo "Bun not available in sandbox - cannot run verification test"
  echo "However, based on web research and Bun documentation:"
  echo "1. Bun \$ throws ShellError on non-zero exit codes"
  echo "2. stderr/stdout are available via .stderr and .stdout properties"
  echo "3. ENOENT errors preserve the error code in output"
  echo "4. Docker connection errors will appear in stderr"
fi

Repository: AmanVarshney01/create-better-t-stack

Length of output: 483


Docker error message pattern will never match Supabase's actual output.

Line 92 checks error.message.includes("Docker is not running"), but Supabase's actual Docker error is "Failed to connect to Docker daemon. Is Docker running?" The pattern won't match, so users won't see the helpful Docker-specific error message on line 93. Update the pattern check to use a substring that appears in actual Supabase errors, such as "Failed to connect to Docker daemon" or "Cannot connect to the Docker daemon".

🤖 Prompt for AI Agents
In apps/cli/src/helpers/database-providers/supabase-setup.ts around lines 90-92,
the error.message check uses the phrase "Docker is not running" which doesn't
match Supabase's actual Docker errors; change the conditional to check for a
realistic substring such as "Failed to connect to Docker daemon" or "Cannot
connect to the Docker daemon" (or include both with ||/regex) so the
Docker-specific help branch is triggered when Supabase reports Docker connection
failures; update the log message accordingly to preserve existing behavior.

Comment on lines +50 to +51
const installScript = await $`curl -sSfL https://get.tur.so/install.sh`.text();
await $`bash -c ${installScript}`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Arbitrary code execution vulnerability.

Downloading and directly executing an install script without verification creates a security risk. If the source is compromised or a MITM attack occurs, arbitrary code could be executed with the user's permissions.

🔎 Recommended security improvements

Consider these security enhancements:

Option 1: Pipe the script directly without storing in a variable

-      const installScript = await $`curl -sSfL https://get.tur.so/install.sh`.text();
-      await $`bash -c ${installScript}`;
+      await $`curl -sSfL https://get.tur.so/install.sh | bash`;

Option 2: Add integrity verification (preferred)

-      const installScript = await $`curl -sSfL https://get.tur.so/install.sh`.text();
-      await $`bash -c ${installScript}`;
+      // Verify script hash before execution
+      const installScript = await $`curl -sSfL https://get.tur.so/install.sh`.text();
+      const scriptHash = await $`echo ${installScript} | sha256sum | cut -d' ' -f1`.text();
+      const expectedHash = "..."; // Get from Turso documentation
+      if (scriptHash.trim() !== expectedHash) {
+        throw new Error("Install script integrity check failed");
+      }
+      await $`bash`.stdin(installScript);

Option 3: Add user confirmation

      const shouldProceed = await confirm({
        message: "This will download and execute an install script from get.tur.so. Continue?",
        initialValue: false,
      });
      if (!shouldProceed) throw new Error("Installation cancelled");

Additionally, consider using $bash.stdin() instead of bash -c to avoid potential shell injection issues.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const installScript = await $`curl -sSfL https://get.tur.so/install.sh`.text();
await $`bash -c ${installScript}`;
await $`curl -sSfL https://get.tur.so/install.sh | bash`;
🤖 Prompt for AI Agents
In apps/cli/src/helpers/database-providers/turso-setup.ts around lines 50-51,
the code downloads an install script into a variable and executes it via bash
-c, which allows arbitrary code execution and possible shell injection; replace
this with a safe flow: prompt the user for explicit confirmation before
proceeding, download the script to a temporary file (or keep in memory) and
verify its integrity using a known checksum or signature fetched from a trusted
source, and then execute it by piping the script into a bash process via a safe
stdin API (e.g., use the command runner's .stdin() rather than interpolating
into bash -c) or prefer a non-shell installation method; ensure you handle
download/verification errors and abort if verification fails.

Comment on lines +8 to +14
if (platform === "darwin") {
await $`open ${url}`.quiet();
} else if (platform === "win32") {
await $`cmd /c start "" ${url.replace(/&/g, "^&")}`.quiet();
} else {
await $`xdg-open ${url}`.quiet();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# Find and examine the openUrl.ts file
fd -name "open-url.ts" -type f | head -5

Repository: AmanVarshney01/create-better-t-stack

Length of output: 310


🏁 Script executed:

# Find openUrl.ts file
fd "open-url.ts" --type f

# Also check directory structure
ls -la apps/cli/src/utils/ 2>/dev/null | head -20

Repository: AmanVarshney01/create-better-t-stack

Length of output: 1406


🏁 Script executed:

# Examine the full openUrl.ts file
cat -n apps/cli/src/utils/open-url.ts

Repository: AmanVarshney01/create-better-t-stack

Length of output: 668


🏁 Script executed:

# Search for test files or usages of openUrl
rg -l "openUrl" --type ts --type tsx

# Also check if there are any test files for this utility
fd "open-url" --type f

Repository: AmanVarshney01/create-better-t-stack

Length of output: 155


🏁 Script executed:

# Search for openUrl usage without file type specification
rg "openUrl" --type ts

# Also search more broadly for any imports or usages
rg "open-url|openUrl" --max-count 20

Repository: AmanVarshney01/create-better-t-stack

Length of output: 919


🏁 Script executed:

# Check what URLs are being passed to openUrl
rg "DOCS_URL|BUILDER_URL" --type ts --max-count 10 -B 2 -A 2

# Also check if there are any tests in the repository
fd "test|spec" --type f | head -10

Repository: AmanVarshney01/create-better-t-stack

Length of output: 2565


🏁 Script executed:

# Check what Bun version is being used
grep -r "bun" package.json | head -5

# Also check if there's any Windows-specific testing or CI configuration
fd "windows|win32" --type f | head -10

Repository: AmanVarshney01/create-better-t-stack

Length of output: 334


🏁 Script executed:

# Check the Bun version in package.json or bunfig
cat package.json | grep -A 5 '"bun"' | head -10

# Also check bunfig.toml if it exists
cat bunfig.toml 2>/dev/null || echo "No bunfig.toml found"

# Check if there's any GitHub Actions or CI that tests Windows
fd "workflow|\.github" --type d

Repository: AmanVarshney01/create-better-t-stack

Length of output: 215


🏁 Script executed:

# Check for Windows-specific CI or testing
find .github 2>/dev/null -type f | xargs cat 2>/dev/null | grep -i "windows\|win32" || echo "No Windows CI found"

# Check what Bun features are being used
rg "from.*bun" --type ts | head -20

Repository: AmanVarshney01/create-better-t-stack

Length of output: 1826


🏁 Script executed:

# Check if there are any other shell command usages in the codebase for reference
rg "\$\`.*\`" apps/cli/src/utils/ --type ts | head -15

Repository: AmanVarshney01/create-better-t-stack

Length of output: 62


🏁 Script executed:

# Check if there are any other shell executions in the codebase using $ template literals
rg "\$\`" apps/cli/src --type ts | grep -v node_modules | head -20

Repository: AmanVarshney01/create-better-t-stack

Length of output: 62


🏁 Script executed:

# Check how other scripts use Bun's $ for spawning external commands
rg "await.*\$\`" scripts/ --type ts | head -10

Repository: AmanVarshney01/create-better-t-stack

Length of output: 62


🏁 Script executed:

# Search more broadly for $ usage
rg "from.*bun.*\$" --type ts | head -5

# Also check what shell commands are actually being invoked elsewhere
rg "Bun.spawn|spawn" apps/cli/src --type ts | head -10

Repository: AmanVarshney01/create-better-t-stack

Length of output: 329


The Windows implementation will fail on Windows—cmd is not a Bun Shell builtin command.

The migration to Bun's $ template literals is correct and follows project guidelines. However, the Windows branch has a critical flaw: Bun Shell does not invoke a system shell and instead implements its own bash-like interpreter. The cmd /c start syntax won't work because cmd is not implemented as a Bun Shell builtin command.

Additionally, the manual & → ^& replacement is problematic:

  • Bun Shell escapes all strings by default, preventing shell injection attacks
  • The URL escaping is redundant and uses Windows CMD syntax in a bash-like environment
  • Current URLs passed to this function (https://better-t-stack.dev/docs and https://better-t-stack.dev/new) don't contain ampersands anyway

Consider alternative approaches:

  1. Use Bun.spawn() to directly invoke the platform's URL opener (e.g., explorer.exe on Windows)
  2. Remove the manual ampersand escaping and rely on Bun's automatic escaping
  3. Test the Windows implementation on actual Windows/WSL to verify it works
🤖 Prompt for AI Agents
In apps/cli/src/utils/open-url.ts around lines 8 to 14, the Windows branch uses
`cmd /c start` which fails under Bun Shell and manually replaces `&` with `^&`
which is unnecessary and wrong; replace that branch to call the Windows opener
directly via Bun.spawn (e.g., spawn "explorer.exe" with the URL as an argument)
instead of invoking `cmd`, remove the manual ampersand replacement so Bun can
handle escaping, await the spawn or check its exitCode/errors, and test the new
implementation on Windows/WSL to verify it opens URLs correctly.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e7198c and 5d055e3.

📒 Files selected for processing (3)
  • .github/workflows/pr-preview.yaml
  • .github/workflows/release.yaml
  • apps/cli/bin/create-better-t-stack
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/cli/bin/create-better-t-stack
  • .github/workflows/pr-preview.yaml
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to {package.json,bun.lockb} : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install`
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>`
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css} : Use `bun build <file>` instead of `webpack` or `esbuild` for bundling TypeScript, JavaScript, and CSS files
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.$` template literal syntax instead of `execa` for shell command execution
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript/JavaScript files
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Publish Preview
🔇 Additional comments (2)
.github/workflows/release.yaml (2)

22-22: LGTM! Timeout increase is appropriate.

The increased timeout accommodates the additional build, multi-platform publishing, and binary upload steps added in this workflow.


167-183: The directory structure assumptions are correct and match the build output.

The build script (lines 80–89 in apps/cli/scripts/build.ts) creates directories named better-t-stack-cli-{os}-{arch} with a bin/ subdirectory containing the compiled binaries, exactly as the upload step expects. The platform detection using *"linux"* pattern matching aligns with how the build script names directories. The tar and zip commands will correctly archive the binaries from their expected locations.

Comment on lines +132 to +152
- name: Publish CLI platform packages to NPM
if: steps.check-version.outputs.exists == 'false'
run: |
cd apps/cli/dist
ls -la
for dir in */; do
if [ -f "$dir/package.json" ]; then
echo "Publishing $dir..."
cd "$dir"
bun publish --access public
cd ..
fi
done
env:
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish CLI main package to NPM
if: steps.check-version.outputs.exists == 'false'
run: cd apps/cli && bun publish --access public
env:
BTS_TELEMETRY: 1
CONVEX_INGEST_URL: ${{ secrets.CONVEX_INGEST_URL }}
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Consider verifying platform package availability before publishing main package.

The main CLI package (lines 148-152) is published immediately after the platform packages (lines 132-146). Since the main package lists these as optionalDependencies, there's a potential race condition if NPM registry propagation hasn't completed. Users installing immediately after the release might not receive the platform-specific binaries until propagation finishes (typically a few minutes).

While optionalDependencies won't cause installation failures, consider adding a brief delay or verification step between publishing platform and main packages to ensure better user experience for early adopters.

💡 Example verification step
      - name: Verify platform packages are available
        if: steps.check-version.outputs.exists == 'false'
        run: |
          VERSION="${{ steps.version.outputs.version }}"
          PACKAGES=(
            "@better-t-stack/cli-darwin-arm64"
            "@better-t-stack/cli-darwin-x64"
            "@better-t-stack/cli-linux-arm64"
            "@better-t-stack/cli-linux-x64"
            "@better-t-stack/cli-windows-x64"
          )
          
          for pkg in "${PACKAGES[@]}"; do
            echo "Checking $pkg@$VERSION..."
            for i in {1..30}; do
              if npm view "$pkg@$VERSION" version 2>/dev/null; then
                echo "✓ $pkg@$VERSION is available"
                break
              fi
              if [ $i -eq 30 ]; then
                echo "✗ $pkg@$VERSION not available after 5 minutes"
                exit 1
              fi
              echo "  Waiting... (attempt $i/30)"
              sleep 10
            done
          done
🤖 Prompt for AI Agents
.github/workflows/release.yaml lines 132-152: the workflow publishes platform
packages and then immediately publishes the main CLI package, risking a race
where optionalDependencies are not yet propagated; modify the workflow to insert
a verification step (or short delay) after the platform-package loop and before
publishing the main package that checks each platform package@${{
steps.version.outputs.version }} is visible in the npm registry (e.g., loop with
npm view or curl to registry, retrying with short sleeps and a timeout) and only
proceed to the main bun publish when all platform packages are confirmed
available (or fail after the timeout).

Comment on lines +132 to +146
- name: Publish CLI platform packages to NPM
if: steps.check-version.outputs.exists == 'false'
run: |
cd apps/cli/dist
ls -la
for dir in */; do
if [ -f "$dir/package.json" ]; then
echo "Publishing $dir..."
cd "$dir"
bun publish --access public
cd ..
fi
done
env:
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Add error handling to prevent partial platform releases.

The publishing loop continues even if a platform package fails to publish, which could result in a partial release where some platform binaries are available but others are not. This would create an inconsistent release state.

🔎 Proposed fix to fail fast on publish errors
       - name: Publish CLI platform packages to NPM
         if: steps.check-version.outputs.exists == 'false'
         run: |
+          set -e
           cd apps/cli/dist
           ls -la
           for dir in */; do
             if [ -f "$dir/package.json" ]; then
               echo "Publishing $dir..."
-              cd "$dir"
-              bun publish --access public
-              cd ..
+              (cd "$dir" && bun publish --access public) || exit 1
             fi
           done
         env:
           NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Publish CLI platform packages to NPM
if: steps.check-version.outputs.exists == 'false'
run: |
cd apps/cli/dist
ls -la
for dir in */; do
if [ -f "$dir/package.json" ]; then
echo "Publishing $dir..."
cd "$dir"
bun publish --access public
cd ..
fi
done
env:
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish CLI platform packages to NPM
if: steps.check-version.outputs.exists == 'false'
run: |
set -e
cd apps/cli/dist
ls -la
for dir in */; do
if [ -f "$dir/package.json" ]; then
echo "Publishing $dir..."
(cd "$dir" && bun publish --access public) || exit 1
fi
done
env:
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
🤖 Prompt for AI Agents
.github/workflows/release.yaml around lines 132 to 146: the publish loop
currently continues when a bun publish fails, risking partial releases; modify
the script to fail-fast by enabling strict shell error handling (e.g., set -euo
pipefail at the top of the run block) or check the exit status of each bun
publish and immediately exit with a non-zero status if it fails, ensuring the
workflow stops and surfaces the error instead of continuing to publish remaining
platform packages.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
apps/cli/package.json (1)

85-90: Inconsistency: tsdown still in devDependencies.

The AI-generated summary states that tsdown was removed from devDependencies, but it's still present at line 89 ("tsdown": "^0.18.2").

Given that the build scripts have migrated to bun run scripts/build.ts (line 60) and the PR describes moving away from the JavaScript-based distribution model that used tsdown, this dependency may no longer be needed.

If tsdown is no longer used in the new Bun-based build process, remove it:

   "devDependencies": {
     "@types/bun": "^1.3.5",
     "@types/fs-extra": "^11.0.4",
     "@types/node": "^25.0.3",
-    "tsdown": "^0.18.2",
     "typescript": "^5.9.3"
   },
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f5b98a1 and 9cb7015.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • apps/cli/package.json
  • apps/cli/scripts/build.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/cli/scripts/build.ts
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.$` template literal syntax instead of `execa` for shell command execution
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css} : Use `bun build <file>` instead of `webpack` or `esbuild` for bundling TypeScript, JavaScript, and CSS files
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript/JavaScript files
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to {package.json,bun.lockb} : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install`
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>`
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css} : Use `bun build <file>` instead of `webpack` or `esbuild` for bundling TypeScript, JavaScript, and CSS files

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript/JavaScript files

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun:sqlite` module for SQLite instead of `better-sqlite3`

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `bun:test` module with `test` and `expect` functions for writing tests

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `bun test` instead of `jest` or `vitest` for running tests

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.$` template literal syntax instead of `execa` for shell command execution

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>`

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to {package.json,bun.lockb} : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install`

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use the dotenv package

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.redis` for Redis instead of `ioredis`

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Prefer `Bun.file` over `node:fs` readFile/writeFile methods

Applied to files:

  • apps/cli/package.json
🔇 Additional comments (3)
apps/cli/package.json (3)

40-40: LGTM: bin entry follows standard convention.

The bin path without a file extension is the standard approach for cross-platform CLI tools, especially when distributing compiled binaries.


43-45: Verify: Is publishing source files intentional?

The files array includes "src", which means TypeScript source files will be published to npm. This is unusual because:

  1. Increases package size: Source files are typically larger than compiled output
  2. Exposes internals: Internal implementation details become part of the public API surface
  3. Confusing for consumers: Unclear whether to import from src/ or compiled output

This appears related to the issue flagged at lines 48-49, 52-53 where entrypoints reference src/index.ts. If you fix the entrypoints to reference compiled JavaScript in dist/, you should also update the files array:

   "files": [
     "bin",
-    "src",
+    "dist",
     "templates"
   ],

Only keep "src" if there's a specific reason to publish TypeScript source files (e.g., Bun-only package with documented source imports).


83-83: No Zod v4 compatibility issues found. The codebase uses Zod only for CLI argument parsing in a single file (apps/cli/src/index.ts), with patterns that are already v4-compatible (.optional().default() chaining). None of the breaking changes mentioned (z.record, z.number, z.function, custom error parameters) are used in the codebase.

Comment thread apps/cli/package.json
Comment on lines +48 to +49
"main": "./src/index.ts",
"types": "./src/index.ts",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: main/types/exports pointing to TypeScript source files.

The main, types, and exports fields all reference ./src/index.ts, which is a TypeScript source file. This configuration will fail for:

  1. Node.js consumers: Cannot execute .ts files without additional tooling (ts-node, tsx, etc.)
  2. Non-Bun environments: Most JavaScript runtimes expect compiled .js or .mjs files
  3. Type resolution: TypeScript's type checker expects .d.ts declaration files, not source .ts files for published packages

Even with binary distribution, programmatic imports of this package (e.g., import { something } from 'create-better-t-stack') will fail in standard Node.js environments.

🔎 Recommended fixes

Option 1: Point to compiled JavaScript

-  "main": "./src/index.ts",
-  "types": "./src/index.ts",
+  "main": "./dist/index.js",
+  "types": "./dist/index.d.ts",
   "exports": {
     ".": {
-      "types": "./src/index.ts",
-      "import": "./src/index.ts"
+      "types": "./dist/index.d.ts",
+      "import": "./dist/index.js"
     }
   },

Update the files array:

   "files": [
     "bin",
-    "src",
+    "dist",
     "templates"
   ],

Option 2: Add Bun-specific marker (if this is intentionally Bun-only)

Add an engines field and document the requirement:

  "engines": {
    "bun": ">=1.0.0"
  },

And add to the README/description that this package requires Bun.

Also applies to: 52-53

Comment thread apps/cli/package.json
"test:watch": "bun test --watch",
"test:coverage": "bun test --coverage",
"test:ci": "AGENT=1 bun test --bail=5",
"prepublishOnly": "echo 'Build binaries separately before publishing'"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Strengthen prepublishOnly check before production.

The prepublishOnly script currently only echoes a reminder message. This provides no enforcement—a developer could accidentally publish without building the platform binaries, resulting in a broken release.

Consider either:

  1. Exit with error if binaries aren't present: test -f ./bin/create-better-t-stack || exit 1
  2. Auto-build binaries in prepublishOnly (though this may be slow)
  3. Remove the script and rely on CI/release automation to handle builds

Given the "HIGHLY EXPERIMENTAL" PR title, this is acceptable for now but should be addressed before production release.

🤖 Prompt for AI Agents
In apps/cli/package.json around line 68, the prepublishOnly script only echoes a
reminder and does not enforce that built binaries exist; change it to either (a)
perform a presence check and exit non-zero if the expected binary(ies) are
missing (e.g., test for ./bin/create-better-t-stack and exit 1 on failure), or
(b) invoke the build step to produce the binaries before publishing; implement
one of these options (prefer the presence-check for speed) so publishing fails
when artifacts are absent.

Comment thread apps/cli/package.json Outdated
Comment on lines +92 to +97
"optionalDependencies": {
"@better-t-stack/cli-darwin-arm64": "3.11.0",
"@better-t-stack/cli-darwin-x64": "3.11.0",
"@better-t-stack/cli-linux-arm64": "3.11.0",
"@better-t-stack/cli-linux-x64": "3.11.0",
"@better-t-stack/cli-windows-x64": "3.11.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Major: Hardcoded versions and missing postinstall script.

Two issues with the optional platform dependencies:

  1. Hardcoded version strings: All optionalDependencies explicitly specify version "3.11.0". This creates a maintenance burden—every version bump requires manually updating all five entries. Consider using a script or automation to sync these versions.

  2. Missing postinstall script: With optionalDependencies for platform-specific binaries, there's typically a postinstall script that detects the current platform and copies/symlinks the appropriate binary from node_modules/@better-t-stack/cli-{platform}/ to the bin/ directory. Without this script, it's unclear how the correct binary gets selected and placed at ./bin/create-better-t-stack.

🔎 Recommended approach

1. Add a postinstall script:

   "scripts": {
     "build": "bun run scripts/build.ts",
     "build:local": "bun run scripts/build.ts --single",
     "dev": "bun run src/cli.ts",
+    "postinstall": "bun run scripts/postinstall.ts",
     "check-types": "tsc --noEmit",

2. Create scripts/postinstall.ts to detect platform and symlink/copy the correct binary:

// Pseudocode - detect platform (process.platform, process.arch)
// Import/copy from node_modules/@better-t-stack/cli-{platform}-{arch}/bin/...
// Place at ./bin/create-better-t-stack

3. Automate version syncing in your build/release scripts to keep optionalDependencies versions in sync with the main package version.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In apps/cli/package.json around lines 92-97 the optionalDependencies list
hardcodes version "3.11.0" for each platform and lacks a postinstall hook to
select the correct platform binary; replace the five hardcoded versions by
wiring them to a single source of truth (e.g., sync them from the package
version during your release/build step or generate/update package.json in your
publish script) and add a postinstall script entry in package.json that runs a
small script (scripts/postinstall.ts or .js) which detects
process.platform/process.arch, resolves the matching
node_modules/@better-t-stack/cli-{platform}-{arch}/bin binary, and copies or
symlinks it to ./bin/create-better-t-stack; implement the postinstall script
file to safely handle missing optional packages and exit gracefully with a
helpful log if no matching binary is installed.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

♻️ Duplicate comments (3)
apps/cli/package.json (3)

40-40: Critical: TypeScript source files in main/types/exports still unresolved.

This is the same critical issue flagged in previous reviews: the main, types, and exports fields all reference ./src/index.ts, which is a TypeScript source file. The files array now includes src instead of dist, reinforcing this problem.

For a published npm package consumed outside Bun:

  • Node.js cannot execute .ts files directly
  • TypeScript expects .d.ts declaration files for type resolution
  • Programmatic imports will fail in standard environments

The bin path change to ./bin/create-better-t-stack suggests binary distribution, but the module entry points still expose source files.

Also applies to: 43-45, 48-49, 52-53


68-68: PrepublishOnly script still lacks enforcement.

The same issue flagged in previous reviews remains: this script only echoes a reminder without enforcing that binaries exist. A developer could accidentally publish without building platform binaries.

Given the "HIGHLY EXPERIMENTAL" status, this is acceptable for now but should be addressed before production.


92-97: Hardcoded versions and missing postinstall script still unresolved.

The same major issues flagged in previous reviews remain:

  1. Hardcoded version "3.11.0" in all five platform packages requires manual updates on every version bump
  2. Missing postinstall script to detect platform and symlink/copy the correct binary from node_modules/@better-t-stack/cli-{platform}/ to ./bin/create-better-t-stack

Without the postinstall script, it's unclear how the correct platform binary gets selected after installation.

🧹 Nitpick comments (8)
apps/cli/src/api.ts (2)

31-68: Consider using type alias instead of interface.

Per coding guidelines, TypeScript type aliases are preferred over interface declarations.

🔎 Suggested change
-export interface CreateOptions {
+export type CreateOptions = {
   /** Project name or path */
   projectName?: string;
   // ... rest of properties
-}
+};

70-85: Consider using type alias instead of interface.

Same as above - prefer type alias per coding guidelines.

🔎 Suggested change
-export interface CreateResult {
+export type CreateResult = {
   /** Whether the project was created successfully */
   success: boolean;
   // ... rest of properties
-}
+};
apps/cli/test/test-utils.ts (1)

63-75: Consider using type aliases instead of interfaces.

Per coding guidelines, prefer type aliases over interface declarations.

🔎 Suggested change
-export interface TestResult {
+export type TestResult = {
   success: boolean;
   result?: CreateResult;
   error?: string;
   projectDir?: string;
   config: TestConfig;
-}
+};

-export interface TestConfig extends CreateOptions {
+export type TestConfig = CreateOptions & {
   projectName?: string;
   expectError?: boolean;
   expectedErrorMessage?: string;
-}
+};
apps/cli/scripts/build.ts (2)

35-39: Consider using type alias instead of interface.

Per coding guidelines, prefer type aliases.

🔎 Suggested change
-interface Target {
+type Target = {
   os: "linux" | "darwin" | "win32";
   arch: "arm64" | "x64";
   bunTarget: `bun-${"linux" | "darwin" | "windows"}-${"arm64" | "x64"}`;
-}
+};

81-85: Consider using type alias instead of interface.

Per coding guidelines, prefer type aliases.

🔎 Suggested change
-export interface BuiltPackage {
+export type BuiltPackage = {
   name: string;
   version: string;
   dirName: string;
-}
+};
apps/cli/src/tui/app.tsx (2)

40-54: Consider using type aliases instead of interfaces.

Per coding guidelines, prefer type aliases over interface declarations.

🔎 Suggested change
-export interface TuiOptions {
+export type TuiOptions = {
   initialConfig?: Partial<ProjectConfig>;
   onComplete: (config: ProjectConfig) => Promise<void>;
   onCancel: () => void;
-}
+};

-interface StepConfig {
+type StepConfig = {
   id: string;
   title: string;
   type: "input" | "select" | "multiselect" | "confirm";
   skip?: (config: any) => boolean;
   getDefault?: (config: any) => any;
   getOptions?: (config: any) => { name: string; value: string; hint?: string }[];
   options?: { name: string; value: string; hint?: string }[];
-}
+};

542-559: Consider using function declaration instead of arrow function.

Per coding guidelines, define functions using standard function declaration syntax.

🔎 Suggested change
-function Spinner(props: { text: string }) {
+function Spinner(props: { text: string }) {
   // This is already a function declaration, looks good

Actually, this is already a function declaration. No change needed here.

Scratch that - Spinner is already using function declaration syntax. LGTM.

apps/cli/src/cli.ts (1)

143-155: TODO placeholder noted.

The add command is a placeholder. Consider tracking this as a follow-up issue if it's intended for a future release.

Would you like me to create an issue to track the implementation of the add command?

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9cb7015 and 29bf48d.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • apps/cli/package.json
  • apps/cli/scripts/build.ts
  • apps/cli/src/api.ts
  • apps/cli/src/cli.ts
  • apps/cli/src/index.ts
  • apps/cli/src/tui/app.tsx
  • apps/cli/src/utils/errors.ts
  • apps/cli/test/test-utils.ts
  • apps/cli/tsconfig.json
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/better-t-stack-repo.mdc)

Define functions using the standard function declaration syntax, not arrow functions

Files:

  • apps/cli/src/tui/app.tsx
  • apps/cli/src/api.ts
  • apps/cli/test/test-utils.ts
  • apps/cli/src/utils/errors.ts
  • apps/cli/src/cli.ts
  • apps/cli/src/index.ts
  • apps/cli/scripts/build.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/better-t-stack-repo.mdc)

**/*.{ts,tsx}: Use TypeScript type aliases instead of interface declarations
Do not use explicit return types

Files:

  • apps/cli/src/tui/app.tsx
  • apps/cli/src/api.ts
  • apps/cli/test/test-utils.ts
  • apps/cli/src/utils/errors.ts
  • apps/cli/src/cli.ts
  • apps/cli/src/index.ts
  • apps/cli/scripts/build.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)

**/*.{ts,tsx,js,jsx}: Use bun <file> instead of node <file> or ts-node <file> for running TypeScript/JavaScript files
Bun automatically loads .env files, so don't use the dotenv package
Use Bun.serve() which supports WebSockets, HTTPS, and routes instead of express
Use bun:sqlite module for SQLite instead of better-sqlite3
Use Bun.redis for Redis instead of ioredis
Use Bun.sql for Postgres instead of pg or postgres.js
Use built-in WebSocket instead of the ws package
Prefer Bun.file over node:fs readFile/writeFile methods
Use Bun.$ template literal syntax instead of execa for shell command execution
Import .css files directly in TypeScript/JavaScript files; Bun's CSS bundler will handle bundling
Run server with bun --hot <file> to enable hot reloading during development

Files:

  • apps/cli/src/tui/app.tsx
  • apps/cli/src/api.ts
  • apps/cli/test/test-utils.ts
  • apps/cli/src/utils/errors.ts
  • apps/cli/src/cli.ts
  • apps/cli/src/index.ts
  • apps/cli/scripts/build.ts
**/*.{ts,tsx,js,jsx,css}

📄 CodeRabbit inference engine (.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)

Use bun build <file> instead of webpack or esbuild for bundling TypeScript, JavaScript, and CSS files

Files:

  • apps/cli/src/tui/app.tsx
  • apps/cli/src/api.ts
  • apps/cli/test/test-utils.ts
  • apps/cli/src/utils/errors.ts
  • apps/cli/src/cli.ts
  • apps/cli/src/index.ts
  • apps/cli/scripts/build.ts
**/*.{html,tsx,ts,jsx,js}

📄 CodeRabbit inference engine (.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)

Use HTML imports with Bun.serve() for frontend instead of Vite

Files:

  • apps/cli/src/tui/app.tsx
  • apps/cli/src/api.ts
  • apps/cli/test/test-utils.ts
  • apps/cli/src/utils/errors.ts
  • apps/cli/src/cli.ts
  • apps/cli/src/index.ts
  • apps/cli/scripts/build.ts
🧠 Learnings (21)
📓 Common learnings
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>`
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css} : Use `bun build <file>` instead of `webpack` or `esbuild` for bundling TypeScript, JavaScript, and CSS files
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to {package.json,bun.lockb} : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install`
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.$` template literal syntax instead of `execa` for shell command execution
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript/JavaScript files
📚 Learning: 2025-12-18T19:15:48.478Z
Learnt from: therealsamyak
Repo: AmanVarshney01/create-better-t-stack PR: 711
File: apps/cli/src/helpers/addons/ultracite-setup.ts:200-205
Timestamp: 2025-12-18T19:15:48.478Z
Learning: In apps/cli/src/helpers/addons/ultracite-setup.ts, the Ultracite CLI's `--integrations` flag requires git hooks to be passed as a single space-separated string (e.g., `gitHooks.join(" ")`) rather than using the spread operator like other Ultracite flags. This has been tested and confirmed to work.

Applied to files:

  • apps/cli/test/test-utils.ts
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.$` template literal syntax instead of `execa` for shell command execution

Applied to files:

  • apps/cli/src/cli.ts
  • apps/cli/scripts/build.ts
  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript/JavaScript files

Applied to files:

  • apps/cli/src/cli.ts
  • apps/cli/scripts/build.ts
  • apps/cli/package.json
  • apps/cli/tsconfig.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css} : Use `bun build <file>` instead of `webpack` or `esbuild` for bundling TypeScript, JavaScript, and CSS files

Applied to files:

  • apps/cli/src/cli.ts
  • apps/cli/scripts/build.ts
  • apps/cli/package.json
  • apps/cli/tsconfig.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to package.json : Use `bun run <script>` instead of `npm run <script>`, `yarn run <script>`, or `pnpm run <script>`

Applied to files:

  • apps/cli/scripts/build.ts
  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `bun:sqlite` module for SQLite instead of `better-sqlite3`

Applied to files:

  • apps/cli/scripts/build.ts
  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to {package.json,bun.lockb} : Use `bun install` instead of `npm install`, `yarn install`, or `pnpm install`

Applied to files:

  • apps/cli/scripts/build.ts
  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `bun:test` module with `test` and `expect` functions for writing tests

Applied to files:

  • apps/cli/scripts/build.ts
  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `bun test` instead of `jest` or `vitest` for running tests

Applied to files:

  • apps/cli/scripts/build.ts
  • apps/cli/package.json
  • apps/cli/tsconfig.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Prefer `Bun.file` over `node:fs` readFile/writeFile methods

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:14.714Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/convex_rules.mdc:0-0
Timestamp: 2025-12-03T07:48:14.714Z
Learning: Applies to convex/**/*.ts : Always add 'use node'; to the top of files containing actions that use Node.js built-in modules

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use the dotenv package

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{html,tsx,ts,jsx,js} : Use HTML imports with `Bun.serve()` for frontend instead of Vite

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.sql` for Postgres instead of `pg` or `postgres.js`

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use `Bun.redis` for Redis instead of `ioredis`

Applied to files:

  • apps/cli/package.json
📚 Learning: 2025-12-03T07:47:42.038Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/better-t-stack-repo.mdc:0-0
Timestamp: 2025-12-03T07:47:42.038Z
Learning: Applies to **/*.{ts,tsx} : Use TypeScript type aliases instead of interface declarations

Applied to files:

  • apps/cli/tsconfig.json
📚 Learning: 2025-12-03T07:47:42.038Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/better-t-stack-repo.mdc:0-0
Timestamp: 2025-12-03T07:47:42.038Z
Learning: Applies to **/*.{ts,tsx} : Do not use explicit return types

Applied to files:

  • apps/cli/tsconfig.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Import .css files directly in TypeScript/JavaScript files; Bun's CSS bundler will handle bundling

Applied to files:

  • apps/cli/tsconfig.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.html : HTML files can import .tsx, .jsx or .js files directly; Bun will transpile and bundle automatically

Applied to files:

  • apps/cli/tsconfig.json
📚 Learning: 2025-12-03T07:48:26.419Z
Learnt from: CR
Repo: AmanVarshney01/create-better-t-stack PR: 0
File: .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-12-03T07:48:26.419Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Run server with `bun --hot <file>` to enable hot reloading during development

Applied to files:

  • apps/cli/tsconfig.json
🧬 Code graph analysis (3)
apps/cli/src/tui/app.tsx (2)
apps/cli/src/index.ts (1)
  • ProjectConfig (41-41)
apps/cli/src/constants.ts (1)
  • getDefaultConfig (106-115)
apps/cli/test/test-utils.ts (2)
apps/cli/src/api.ts (3)
  • CreateResult (70-85)
  • CreateOptions (31-68)
  • create (108-201)
apps/cli/src/index.ts (4)
  • CreateResult (26-26)
  • CreateOptions (26-26)
  • create (26-26)
  • create (51-51)
apps/cli/src/cli.ts (6)
apps/cli/src/utils/get-latest-cli-version.ts (1)
  • getLatestCLIVersion (13-27)
apps/cli/src/tui/app.tsx (1)
  • renderTui (522-539)
apps/cli/src/types.ts (15)
  • Frontend (51-51)
  • Backend (49-49)
  • Runtime (50-50)
  • Database (47-47)
  • ORM (48-48)
  • Auth (57-57)
  • Payments (58-58)
  • Addons (52-52)
  • ProjectConfig (67-67)
  • API (56-56)
  • Examples (53-53)
  • DatabaseSetup (55-55)
  • WebDeploy (59-59)
  • ServerDeploy (60-60)
  • PackageManager (54-54)
apps/cli/src/utils/generate-reproducible-command.ts (1)
  • generateReproducibleCommand (3-53)
apps/cli/src/api.ts (1)
  • create (108-201)
apps/cli/src/utils/open-url.ts (1)
  • openUrl (4-18)
🪛 GitHub Actions: Test
apps/cli/src/utils/errors.ts

[error] 1-1: Cannot find package 'consola' from '/home/runner/work/create-better-t-stack/create-better-t-stack/apps/cli/src/utils/errors.ts'

🔇 Additional comments (12)
apps/cli/tsconfig.json (1)

1-17: LGTM!

The TypeScript configuration changes appropriately support the new TUI implementation with @opentui/react. Adding DOM to the lib array, configuring JSX with react-jsx transform, and extending the include pattern to cover .tsx files are all necessary for the terminal UI components.

apps/cli/src/utils/errors.ts (1)

3-15: LGTM!

The custom error classes CLIError and CancelledError properly extend Error and set the name property, enabling proper error type discrimination. This design supports the new programmatic API pattern that returns results instead of calling process.exit().

apps/cli/src/api.ts (1)

168-181: Console suppression approach is acceptable but fragile.

The temporary console method replacement works for synchronous scenarios but may leak output if createProject spawns child processes or uses other logging mechanisms. This is a known limitation for programmatic APIs.

apps/cli/test/test-utils.ts (1)

81-135: LGTM!

The test utility migration to the new create() API is clean. The console suppression/restoration pattern properly handles concurrent test isolation with reference counting, and the smoke directory setup is appropriately simplified.

apps/cli/scripts/build.ts (2)

68-77: LGTM on Bun.$ usage.

The use of Bun.$ template literal syntax for shell command execution aligns with the coding guidelines. The quiet mode and graceful fallback for cross-compilation dependency installation is appropriate.


102-122: LGTM!

The Bun.build API usage with compile target for generating platform-specific binaries is correct. Error handling properly logs build failures and continues to the next target, which is appropriate for a multi-platform build script.

apps/cli/src/tui/app.tsx (1)

563-660: LGTM on the App component structure.

The App component properly manages phase transitions (prompts → creating → done), handles keyboard navigation, and coordinates with the step-based wizard. The handleComplete callback correctly builds the final ProjectConfig and transitions phases.

apps/cli/src/cli.ts (3)

66-141: LGTM on the dual-mode CLI handler.

The action properly distinguishes between interactive (TUI) and non-interactive modes using TTY detection. Both paths handle errors consistently and output reproducible commands. The type casting for Commander options is acceptable given the dynamic nature of CLI parsing.


157-183: LGTM on utility commands.

The docs and builder commands properly use dynamic imports for openUrl and handle failures gracefully with fallback URLs.


9-9: Inconsistent manualDb handling between interactive and non-interactive paths.

createProject is imported and used in the TUI's onComplete callback (line 89). In interactive mode, it respects the --manual-db flag: createProject(config, { manualDb: options.manualDb as boolean }). However, the non-interactive path (via create() in api.ts) hardcodes manualDb: true, ignoring the flag. This creates inconsistent behavior where the TUI prompt can be controlled by the user, but programmatic invocation always suppresses database prompts.

apps/cli/src/index.ts (1)

1-51: LGTM!

The public API surface is clean and well-documented. The re-exports consolidate the programmatic API (create, CreateOptions, CreateResult) with comprehensive type exports. The backward-compatible init alias is a good practice for migration.

apps/cli/package.json (1)

60-67: LGTM: Scripts properly migrated to Bun.

The script updates correctly follow the Bun-first approach:

  • bun run instead of npm run for script execution
  • bun test instead of Jest/Vitest
  • Direct TypeScript execution with bun run src/cli.ts

These changes align with the project's established conventions.

Based on learnings, use bun run instead of npm run and bun test for testing.

Comment thread apps/cli/package.json
Comment on lines +72 to +73
"@opentui/core": "^0.1.62",
"@opentui/react": "^0.1.62",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Major: Version mismatch between @OpenTui dependencies.

There's a version inconsistency between the core OpenTUI dependencies and their platform-specific counterparts:

  • Core dependency (line 72-73): @opentui/core: "^0.1.62" and @opentui/react: "^0.1.62"
  • Platform binaries (lines 98-103): All pinned to "0.1.63"

The caret (^) in the core dependency allows 0.1.62 through 0.1.x, but the platform packages explicitly require 0.1.63. This mismatch could cause:

  • Installation conflicts if npm/bun resolves to different versions
  • Runtime errors if 0.1.62 and 0.1.63 have incompatibilities
  • Unclear which version is actually required
🔎 Recommended fix

Pin all OpenTUI dependencies to the same version:

   "dependencies": {
     "@better-t-stack/types": "workspace:*",
-    "@opentui/core": "^0.1.62",
-    "@opentui/react": "^0.1.62",
+    "@opentui/core": "0.1.63",
+    "@opentui/react": "0.1.63",
     "commander": "^14.0.2",

Or update the optionalDependencies to match:

   "optionalDependencies": {
     "@better-t-stack/cli-darwin-arm64": "3.11.0",
     "@better-t-stack/cli-darwin-x64": "3.11.0",
     "@better-t-stack/cli-linux-arm64": "3.11.0",
     "@better-t-stack/cli-linux-x64": "3.11.0",
     "@better-t-stack/cli-windows-x64": "3.11.0",
-    "@opentui/core-darwin-arm64": "0.1.63",
-    "@opentui/core-darwin-x64": "0.1.63",
-    "@opentui/core-linux-arm64": "0.1.63",
-    "@opentui/core-linux-x64": "0.1.63",
-    "@opentui/core-win32-arm64": "0.1.63",
-    "@opentui/core-win32-x64": "0.1.63"
+    "@opentui/core-darwin-arm64": "^0.1.62",
+    "@opentui/core-darwin-x64": "^0.1.62",
+    "@opentui/core-linux-arm64": "^0.1.62",
+    "@opentui/core-linux-x64": "^0.1.62",
+    "@opentui/core-win32-arm64": "^0.1.62",
+    "@opentui/core-win32-x64": "^0.1.62"

Recommended: Pin to 0.1.63 across the board since the platform binaries require it.

Also applies to: 98-103

🤖 Prompt for AI Agents
In apps/cli/package.json around lines 72-73 (and 98-103), the @opentui packages
have mismatched versions (core/react use "^0.1.62" while platform binaries are
pinned to "0.1.63"); update the package.json so all @opentui packages use the
same exact version (recommended: pin @opentui/core and @opentui/react to
"0.1.63" or alternatively change the platform binaries to match) and ensure the
dependency specifiers are consistent (use exact versions, not mixed caret vs
pinned) before committing.

Comment thread apps/cli/package.json
Comment on lines +72 to +74
"@opentui/core": "^0.1.62",
"@opentui/react": "^0.1.62",
"commander": "^14.0.2",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify package versions exist and check for security advisories

echo "=== Checking package versions on npm registry ==="

for pkg in "react@19.1.0" "zod@4.2.1" "commander@14.0.2" "@opentui/core@0.1.62" "@opentui/react@0.1.62"; do
  echo -e "\nChecking $pkg..."
  npm view "$pkg" version 2>&1 | head -5
done

echo -e "\n=== Checking major version releases ==="
echo "React latest versions:"
npm view react versions --json 2>/dev/null | tail -c 200

echo -e "\nZod latest versions:"
npm view zod versions --json 2>/dev/null | tail -c 200

echo -e "\nCommander latest versions:"
npm view commander versions --json 2>/dev/null | tail -c 200

Repository: AmanVarshney01/create-better-t-stack

Length of output: 1025


Verify React 19 and Zod 4 breaking changes compatibility.

Several dependencies use recent major versions with breaking changes:

  • react@^19.1.0 - React 19 has breaking changes (ref removal from forwardRef, new hooks, etc.)
  • zod@^4.2.1 - Zod 4 has breaking changes (unified error handling, default value logic changes, etc.)
  • commander@^14.0.2 - Latest major version
  • @opentui/core and @opentui/react@^0.1.62 - Early-stage packages (0.1.x)

Ensure the codebase has been tested against React 19 and Zod 4 breaking changes, particularly around error handling, ref behavior, and validation logic changes.

🤖 Prompt for AI Agents
In apps/cli/package.json around lines 72–74 the updated dependency versions may
introduce breaking changes (React 19, Zod 4, commander 14 and early-stage
@opentui packages); verify and address compatibility by (1) running the full
test suite and storybook/components using React 19 to catch ref/forwardRef API
changes and update any usages to the new ref patterns or add compatibility
wrappers, (2) running validation flows and adapting code that consumes Zod
errors to the unified error format and changed default logic (update schemas or
error handling), (3) exercising CLI code against commander@14 and adjust any API
call sites, and (4) if immediate fixes are non-trivial, pin to known-compatible
versions in package.json or add explicit migration shims and document the
changes; update package.json, tests, and any impacted modules accordingly and
re-run CI to confirm all tests pass.

Comment thread apps/cli/src/api.ts
Comment on lines +134 to +161
frontend:
options.frontend ?? (options.defaults ? defaultConfig.frontend : defaultConfig.frontend),
backend:
options.backend ?? (options.defaults ? defaultConfig.backend : defaultConfig.backend),
runtime:
options.runtime ?? (options.defaults ? defaultConfig.runtime : defaultConfig.runtime),
database:
options.database ?? (options.defaults ? defaultConfig.database : defaultConfig.database),
orm: options.orm ?? (options.defaults ? defaultConfig.orm : defaultConfig.orm),
auth: options.auth ?? (options.defaults ? defaultConfig.auth : defaultConfig.auth),
payments:
options.payments ?? (options.defaults ? defaultConfig.payments : defaultConfig.payments),
api: options.api ?? (options.defaults ? defaultConfig.api : defaultConfig.api),
addons: options.addons ?? (options.defaults ? defaultConfig.addons : defaultConfig.addons),
examples:
options.examples ?? (options.defaults ? defaultConfig.examples : defaultConfig.examples),
dbSetup:
options.dbSetup ?? (options.defaults ? defaultConfig.dbSetup : defaultConfig.dbSetup),
webDeploy:
options.webDeploy ?? (options.defaults ? defaultConfig.webDeploy : defaultConfig.webDeploy),
serverDeploy:
options.serverDeploy ??
(options.defaults ? defaultConfig.serverDeploy : defaultConfig.serverDeploy),
git: options.git ?? (options.defaults ? defaultConfig.git : defaultConfig.git),
packageManager:
options.packageManager ??
(options.defaults ? defaultConfig.packageManager : defaultConfig.packageManager),
install: options.install ?? false,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Redundant ternary logic - both branches evaluate to defaultConfig.X.

The pattern options.X ?? (options.defaults ? defaultConfig.X : defaultConfig.X) always falls back to defaultConfig.X regardless of options.defaults. If the intent is to only apply defaults when options.defaults is true, the logic should differ; otherwise, simplify to options.X ?? defaultConfig.X.

🔎 Simplified version if defaults always apply
-      frontend:
-        options.frontend ?? (options.defaults ? defaultConfig.frontend : defaultConfig.frontend),
+      frontend: options.frontend ?? defaultConfig.frontend,

Apply similarly to all affected properties.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
frontend:
options.frontend ?? (options.defaults ? defaultConfig.frontend : defaultConfig.frontend),
backend:
options.backend ?? (options.defaults ? defaultConfig.backend : defaultConfig.backend),
runtime:
options.runtime ?? (options.defaults ? defaultConfig.runtime : defaultConfig.runtime),
database:
options.database ?? (options.defaults ? defaultConfig.database : defaultConfig.database),
orm: options.orm ?? (options.defaults ? defaultConfig.orm : defaultConfig.orm),
auth: options.auth ?? (options.defaults ? defaultConfig.auth : defaultConfig.auth),
payments:
options.payments ?? (options.defaults ? defaultConfig.payments : defaultConfig.payments),
api: options.api ?? (options.defaults ? defaultConfig.api : defaultConfig.api),
addons: options.addons ?? (options.defaults ? defaultConfig.addons : defaultConfig.addons),
examples:
options.examples ?? (options.defaults ? defaultConfig.examples : defaultConfig.examples),
dbSetup:
options.dbSetup ?? (options.defaults ? defaultConfig.dbSetup : defaultConfig.dbSetup),
webDeploy:
options.webDeploy ?? (options.defaults ? defaultConfig.webDeploy : defaultConfig.webDeploy),
serverDeploy:
options.serverDeploy ??
(options.defaults ? defaultConfig.serverDeploy : defaultConfig.serverDeploy),
git: options.git ?? (options.defaults ? defaultConfig.git : defaultConfig.git),
packageManager:
options.packageManager ??
(options.defaults ? defaultConfig.packageManager : defaultConfig.packageManager),
install: options.install ?? false,
frontend: options.frontend ?? defaultConfig.frontend,
backend:
options.backend ?? (options.defaults ? defaultConfig.backend : defaultConfig.backend),
runtime:
options.runtime ?? (options.defaults ? defaultConfig.runtime : defaultConfig.runtime),
database:
options.database ?? (options.defaults ? defaultConfig.database : defaultConfig.database),
orm: options.orm ?? (options.defaults ? defaultConfig.orm : defaultConfig.orm),
auth: options.auth ?? (options.defaults ? defaultConfig.auth : defaultConfig.auth),
payments:
options.payments ?? (options.defaults ? defaultConfig.payments : defaultConfig.payments),
api: options.api ?? (options.defaults ? defaultConfig.api : defaultConfig.api),
addons: options.addons ?? (options.defaults ? defaultConfig.addons : defaultConfig.addons),
examples:
options.examples ?? (options.defaults ? defaultConfig.examples : defaultConfig.examples),
dbSetup:
options.dbSetup ?? (options.defaults ? defaultConfig.dbSetup : defaultConfig.dbSetup),
webDeploy:
options.webDeploy ?? (options.defaults ? defaultConfig.webDeploy : defaultConfig.webDeploy),
serverDeploy:
options.serverDeploy ??
(options.defaults ? defaultConfig.serverDeploy : defaultConfig.serverDeploy),
git: options.git ?? (options.defaults ? defaultConfig.git : defaultConfig.git),
packageManager:
options.packageManager ??
(options.defaults ? defaultConfig.packageManager : defaultConfig.packageManager),
install: options.install ?? false,
🤖 Prompt for AI Agents
In apps/cli/src/api.ts around lines 134-161 the fallback expressions use
redundant ternaries like options.X ?? (options.defaults ? defaultConfig.X :
defaultConfig.X); replace them with a correct, non-redundant form: if defaults
should always apply, use options.X ?? defaultConfig.X for each property; if
defaults should only apply when options.defaults is true, use options.defaults ?
(options.X ?? defaultConfig.X) : options.X for each property. Update all listed
properties (frontend, backend, runtime, database, orm, auth, payments, api,
addons, examples, dbSetup, webDeploy, serverDeploy, git, packageManager)
accordingly and keep install as options.install ?? false.

Comment thread apps/cli/src/tui/app.tsx
Comment on lines +522 to +539
export async function renderTui(options: TuiOptions): Promise<void> {
const renderer = await createCliRenderer({ exitOnCtrlC: false });

return new Promise((resolve) => {
const handleExit = () => {
options.onCancel();
process.exit(0);
};

createRoot(renderer).render(
<App
initialConfig={options.initialConfig}
onComplete={options.onComplete}
onExit={handleExit}
/>,
);
});
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Promise never explicitly resolves.

The renderTui function returns a Promise<void> that is never explicitly resolved. The handleExit callback calls process.exit(0) directly, and there's no resolve() call for successful completion. This means callers awaiting renderTui() will hang unless the process exits.

🔎 Suggested fix
 export async function renderTui(options: TuiOptions): Promise<void> {
   const renderer = await createCliRenderer({ exitOnCtrlC: false });

   return new Promise((resolve) => {
     const handleExit = () => {
       options.onCancel();
+      resolve();
       process.exit(0);
     };

+    const handleComplete = async (config: ProjectConfig) => {
+      await options.onComplete(config);
+      resolve();
+    };
+
     createRoot(renderer).render(
       <App
         initialConfig={options.initialConfig}
-        onComplete={options.onComplete}
+        onComplete={handleComplete}
         onExit={handleExit}
       />,
     );
   });
 }

@@ -1,32 +1,30 @@
import { cancel } from "@clack/prompts";
import consola from "consola";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

cat apps/cli/package.json | jq '.dependencies.consola // .devDependencies.consola // "NOT_FOUND"'

Repository: AmanVarshney01/create-better-t-stack

Length of output: 91


🏁 Script executed:

cat -n apps/cli/src/utils/errors.ts | head -30

Repository: AmanVarshney01/create-better-t-stack

Length of output: 1060


🏁 Script executed:

rg "consola" apps/cli/package.json

Repository: AmanVarshney01/create-better-t-stack

Length of output: 62


🏁 Script executed:

cat package.json | jq '.dependencies.consola // .devDependencies.consola // "NOT_FOUND"'

Repository: AmanVarshney01/create-better-t-stack

Length of output: 91


🏁 Script executed:

rg "consola" --type json

Repository: AmanVarshney01/create-better-t-stack

Length of output: 62


🏁 Script executed:

rg "from [\"']consola[\"']" -t ts -t tsx -t js -t jsx

Repository: AmanVarshney01/create-better-t-stack

Length of output: 107


🏁 Script executed:

rg "consola" --max-count 20

Repository: AmanVarshney01/create-better-t-stack

Length of output: 7736


🏁 Script executed:

rg "from.*consola" -A 2

Repository: AmanVarshney01/create-better-t-stack

Length of output: 4199


Add consola package to apps/cli/package.json dependencies.

The consola package is imported in apps/cli/src/utils/errors.ts (lines 18, 28) and 19+ other files but is missing from the dependency declarations. While consola is available as a transitive dependency in bun.lock, it must be explicitly declared in package.json for proper resolution. The pipeline failure "Cannot find package 'consola'" confirms this prevents the build from succeeding.

🧰 Tools
🪛 GitHub Actions: Test

[error] 1-1: Cannot find package 'consola' from '/home/runner/work/create-better-t-stack/create-better-t-stack/apps/cli/src/utils/errors.ts'

🤖 Prompt for AI Agents
In apps/cli/src/utils/errors.ts around line 1, consola is imported but not
declared as a dependency; open apps/cli/package.json and add "consola" to the
"dependencies" with the same version used in the repo lockfile/root package.json
(or pick a compatible semver), then run your package manager install
(pnpm/yarn/npm/bun) to update lockfiles so the build can resolve consola.

This branch was successfully deployed

1 active deployment
Preview — 29bf48d6 Deployed Dec 23, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant