Skip to content

feat(cli): add vibe rules addon - #481

Merged
AmanVarshney01 merged 6 commits into
mainfrom
vibe-rules
Aug 9, 2025
Merged

AmanVarshney01 merged 6 commits into
mainfrom
vibe-rules

Conversation

@AmanVarshney01

@AmanVarshney01 AmanVarshney01 commented Aug 9, 2025 •

Copy link
Copy Markdown
Owner

refactor error handling

Summary by CodeRabbit

  • New Features

    • Added support for a new "vibe-rules" addon, including an automated setup process and a customizable rules template for projects.
    • Introduced a new Handlebars helper for template customization.
  • Improvements

    • Centralized and streamlined error and cancellation handling throughout the CLI for a more consistent user experience.
    • Updated addon and frontend options display names for clarity.
    • Enhanced project template documentation with dynamic rules based on selected technologies.
  • Chores

    • Updated ignore patterns in configuration files to exclude additional directories.

@changeset-bot

changeset-bot Bot commented Aug 9, 2025 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e264d5d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-better-t-stack Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 9, 2025 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces the "vibe-rules" addon to the CLI, including its setup logic, compatibility rules, prompt options, and a Handlebars template for rule documentation. The PR centralizes error and cancellation handling across the CLI, replacing inline process exits and colored messages with reusable utility functions. Minor label adjustments and ignore rule updates are also included.

Changes

Cohort / File(s) Change Summary
Addon: Vibe Rules Integration
apps/cli/src/constants.ts, apps/cli/src/types.ts, apps/cli/src/helpers/setup/addons-setup.ts, apps/cli/src/helpers/setup/vibe-rules-setup.ts, apps/cli/src/helpers/project-generation/template-manager.ts, apps/cli/templates/addons/vibe-rules/.bts/rules.md.hbs, apps/cli/src/prompts/addons.ts
Adds "vibe-rules" addon: compatibility entry, schema update, setup function, prompt option, template for rules, and exclusion in template manager.
Centralized Error & Cancellation Handling
apps/cli/src/utils/errors.ts, apps/cli/src/utils/project-directory.ts, apps/cli/src/utils/compatibility-rules.ts, apps/cli/src/validation.ts, apps/cli/src/helpers/project-generation/add-addons.ts, apps/cli/src/helpers/project-generation/add-deployment.ts, apps/cli/src/helpers/project-generation/command-handlers.ts, apps/cli/src/helpers/project-generation/create-project.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/turso-setup.ts, apps/cli/src/helpers/setup/fumadocs-setup.ts, apps/cli/src/helpers/setup/ultracite-setup.ts, apps/cli/src/prompts/addons.ts, apps/cli/src/prompts/api.ts, apps/cli/src/prompts/auth.ts, apps/cli/src/prompts/backend.ts, apps/cli/src/prompts/config-prompts.ts, apps/cli/src/prompts/database-setup.ts, apps/cli/src/prompts/database.ts, apps/cli/src/prompts/examples.ts, apps/cli/src/prompts/frontend.ts, apps/cli/src/prompts/git.ts, apps/cli/src/prompts/install.ts, apps/cli/src/prompts/orm.ts, apps/cli/src/prompts/package-manager.ts, apps/cli/src/prompts/project-name.ts, apps/cli/src/prompts/runtime.ts, apps/cli/src/prompts/web-deploy.ts, apps/cli/src/index.ts
Replaces inline error/cancellation handling with exitWithError, exitCancelled, and handleError utilities; removes direct process exits and colored messages.
Template Helpers
apps/cli/src/utils/template-processor.ts
Adds a Handlebars "ne" (not equal) helper for template logic.
Label/Name Adjustments
apps/web/src/app/(home)/showcase/page.tsx, apps/web/src/lib/constant.ts, apps/cli/src/prompts/frontend.ts
Changes "TanStack Start (vite)" label to "TanStack Start" in relevant files.
Ignore Rule Updates
.gitignore, biome.json
Adds .smoke directory to ignore patterns in both files.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant ErrorUtils
    participant VibeRulesSetup

    User->>CLI: Run project setup
    CLI->>User: Prompt for addons
    User->>CLI: Selects "vibe-rules"
    CLI->>VibeRulesSetup: Calls setupVibeRules(config)
    VibeRulesSetup->>User: Prompts for editors
    User->>VibeRulesSetup: Selects editors or cancels
    alt User cancels
        VibeRulesSetup->>ErrorUtils: exitCancelled("Operation cancelled")
        ErrorUtils->>User: Show cancellation message and exit
    else User selects editors
        VibeRulesSetup->>CLI: Runs commands to apply rules
        VibeRulesSetup->>User: Shows progress and success/failure
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~35 minutes

Possibly related PRs

Poem

In the warren, code hops anew,
"Vibe-rules" joins the bunny crew!
Errors now all handled neat,
With exit helpers—what a treat!
Prompts and templates, clear and bright,
The stack grows strong, the rules take flight.
🐇✨

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b4ed3de and e264d5d.

📒 Files selected for processing (1)
  • .changeset/smooth-cows-enter.md (1 hunks)
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch vibe-rules

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@pkg-pr-new

pkg-pr-new Bot commented Aug 9, 2025 •

Copy link
Copy Markdown

Open in StackBlitz

npx https://pkg.pr.new/AmanVarshney01/create-better-t-stack@481

commit: e264d5d

@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: 12

🔭 Outside diff range comments (5)
apps/web/src/app/(home)/showcase/page.tsx (1)

46-46: Critical: Public API key exposed in client code

The image URL embeds a live API key. This leaks a secret to every visitor and any scraper.

Action:

  • Rotate/revoke the exposed key immediately.
  • Serve the image via a server-side proxy or pre-generate and host a static asset. Never embed secrets in client bundles.

If you need help implementing a minimal Next.js API proxy that fetches and caches the image safely, I can provide it.

apps/cli/src/utils/template-processor.ts (1)

18-28: Preserve original error as the cause when rethrowing

The current catch block logs the error but then throws a brand-new Error, losing the original stack and context. To aid debugging, include the original error as the cause:

• File: apps/cli/src/utils/template-processor.ts
• Lines: 18–28

   } catch (error: unknown) {
     consola.error(`Error processing template ${srcPath}:`, error);
-    throw new Error(`Failed to process template ${srcPath}`);
+    // Preserve original error details for better diagnostics
+    throw new Error(
+      `Failed to process template ${srcPath}`,
+      { cause: error as Error },
+    );
   }

This keeps your centralized CLI commands free to catch and handle the enriched error, without exiting the process prematurely.

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

69-74: Sanitize user input and eliminate shell: true in Neon commands

We’ve confirmed that executeNeonCommand in
apps/cli/src/helpers/database-providers/neon-setup.ts
uses

await execa(fullCommand, { shell: true })

and that projectName is interpolated directly into the shell string (lines 69–74). This same pattern appears across multiple setup scripts (prisma, supabase, tauri, etc.), creating a real command-injection risk.

Required fixes:

  • At the prompt, validate projectName against a strict allowlist (no spaces or shell metacharacters):
    diff -- apps/cli/src/commands/new.ts
    - const projectName = await text({
    -   message: "Enter a name for your Neon project:",
    -   defaultValue: suggestedProjectName,
    -   initialValue: suggestedProjectName,
    - });
    + const projectName = await text({
    +   message: "Enter a name for your Neon project:",
    +   initialValue: suggestedProjectName,
    +   validate: (val) => {
    +     if (typeof val !== "string" || !/^[A-Za-z0-9._-]+$/.test(val.trim())) {
    +       return "Project name may only include letters, numbers, dots (.), underscores (_), or hyphens (-).";
    +     }
    +   },
    + });
  • Long-term refactor executeNeonCommand to accept an array of args and invoke execa(cmd, args) (dropping shell: true):
    async function executeNeonCommand(
      pm: PackageManager,
      args: string[],
      spinnerText?: string
    ) {
      const [cmd, ...cmdArgs] = getPackageExecutionCommand(pm, args);
      const s = spinner();
      if (spinnerText) s.start(spinnerText);
      try {
        const { stdout } = await execa(cmd, cmdArgs);
        if (spinnerText) s.stop();
        return stdout;
      } catch (err) {
        s.stop("error");
        throw err;
      }
    }

This will fully eliminate interpolation-based injection vectors.

apps/cli/src/helpers/project-generation/command-handlers.ts (1)

62-66: Potential bug: projectDirectory uses projectName instead of finalResolvedPath

This can break downstream path-based logic. Use the resolved path from setupProjectDirectory.

-    const cliInput = {
-      ...input,
-      projectDirectory: input.projectName,
-    };
+    const cliInput = {
+      ...input,
+      projectDirectory: finalResolvedPath,
+    };
apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts (1)

197-201: String replace is brittle

Replacing the exact line export const db = new PrismaClient(); may miss common variants (no export, different spacing). Use a regex with broader match or an AST transform.

-        dbFileContent = dbFileContent.replace(
-          "export const db = new PrismaClient();",
-          "export const db = new PrismaClient().$extends(withAccelerate());",
-        );
+        // Replace any `new PrismaClient()` assignment for `db` (exported or not)
+        dbFileContent = dbFileContent.replace(
+          /(?:export\s+)?const\s+db\s*=\s*new\s+PrismaClient\(\)\s*;?/,
+          'export const db = new PrismaClient().$extends(withAccelerate());',
+        );
♻️ Duplicate comments (2)
apps/cli/src/prompts/addons.ts (1)

126-127: Same cancellation-helper type caveat applies.

As in other prompts, returning exitCancelled() assumes a never return type – verify once for the whole codebase.

Also applies to: 179-180

apps/cli/src/utils/project-directory.ts (1)

52-53: Cancellation path: confirm exitCancelled typing.

Both early-returns rely on exitCancelled being never; otherwise the enclosing while (true) loop becomes non-exhaustive.

Also applies to: 73-74

🧹 Nitpick comments (19)
biome.json (1)

22-23: Optional: keep ignore lists consistent across tools sections
You already exclude .smoke at files.includes. To avoid confusion, either:

  • also exclude it in formatter.includes and linter.includes, or
  • rely solely on files.includes and remove duplicate excludes in formatter/linter sections.

This reduces drift between sections.

apps/cli/src/prompts/project-name.ts (1)

80-80: Unify cancellation message punctuation

This file uses “Operation cancelled.” (with a period), while others omit it. Standardize for consistency.

Apply:

-    if (isCancel(response)) return exitCancelled("Operation cancelled.");
+    if (isCancel(response)) return exitCancelled("Operation cancelled");
apps/cli/src/prompts/backend.ts (1)

66-66: Standardize cancel copy across files

Some files include a trailing period, some don’t. Pick one.

-  if (isCancel(response)) return exitCancelled("Operation cancelled");
+  if (isCancel(response)) return exitCancelled("Operation cancelled.");

(Or vice versa—apply consistently across the codebase.)

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

75-75: Ensure exitCancelled fully handles termination; keep message consistent

Returning the helper is appropriate if typed as never and it exits. Also align punctuation of “Operation cancelled” across files.

To standardize punctuation here:

-    if (isCancel(editors)) return exitCancelled("Operation cancelled");
+    if (isCancel(editors)) return exitCancelled("Operation cancelled.");
-    if (isCancel(rules)) return exitCancelled("Operation cancelled");
+    if (isCancel(rules)) return exitCancelled("Operation cancelled.");

Optional: If you have an exitWithError utility, consider using it in this file’s catch block for parity with the new error model.

Also applies to: 87-87

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

54-54: Confirm exitCancelled typing and unify message

Should be typed never and reliably terminate. Also align punctuation with other files.

-  if (isCancel(response)) return exitCancelled("Operation cancelled");
+  if (isCancel(response)) return exitCancelled("Operation cancelled.");

Use the earlier verification script to confirm typing and check global message consistency.

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

56-56: Cancellation path: verify never type and standardize message

Ensure exitCancelled exits/throws (never) and align the message punctuation.

-    if (isCancel(template)) return exitCancelled("Operation cancelled");
+    if (isCancel(template)) return exitCancelled("Operation cancelled.");

Re-use the previously provided script to validate implementation and consistency.

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

166-174: Remove unreachable branch checking options.examples.includes("none")

Inside the else block (already guaranteeing "none" is not present), this condition can never be true, so it’s dead code.

       config.examples = options.examples.filter(
         (ex): ex is Examples => ex !== "none",
       );
-      if (options.examples.includes("none") && config.backend !== "convex") {
-        config.examples = [];
-      }
apps/cli/src/helpers/database-providers/turso-setup.ts (2)

125-126: Cancellation path consistency and clarity

  • Ensure exitCancelled returns never (same rationale as other modules).
  • Optional: make messages contextual (e.g., “Turso setup cancelled”) to aid telemetry/logs.
- if (isCancel(selectedGroup)) return exitCancelled("Operation cancelled");
+ if (isCancel(selectedGroup)) return exitCancelled("Turso setup cancelled");

- if (isCancel(shouldInstall)) return exitCancelled("Operation cancelled");
+ if (isCancel(shouldInstall)) return exitCancelled("Turso setup cancelled");

- if (isCancel(dbNameResponse)) return exitCancelled("Operation cancelled");
+ if (isCancel(dbNameResponse)) return exitCancelled("Turso setup cancelled");

Also applies to: 229-231, 259-260


9-9: Align error logging with centralized utilities

This file still uses consola.error and console.error. To keep the CLI consistent, consider using a centralized error helper (e.g., handleError) for the error message while preserving the fallback env/manual-setup flow.

Proposed diff:

-import { exitCancelled } from "../../utils/errors";
+import { exitCancelled, handleError } from "../../utils/errors";
@@
  } catch (error) {
-    setupSpinner.stop(pc.red("Turso CLI availability check failed"));
-    consola.error(
-      pc.red(
-        `Error during Turso setup: ${
-          error instanceof Error ? error.message : String(error)
-        }`,
-      ),
-    );
+    setupSpinner.stop(pc.red("Turso CLI availability check failed"));
+    handleError(
+      `Error during Turso setup: ${
+        error instanceof Error ? error.message : String(error)
+      }`,
+    );
     await writeEnvFile(projectDir);
     displayManualSetupInstructions();
     log.success("Setup completed with manual configuration required.");
   }

Also applies to: 279-290

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

58-58: Ensure exitCancelled is never and add explicit return type (optional)

Same as other prompts: returning exitCancelled is sound only if it’s never. Optionally annotate the function return type for clarity.

-export async function getDatabaseChoice(
+export async function getDatabaseChoice(
   database?: Database,
   backend?: Backend,
   runtime?: Runtime,
-): Promise<Database> {
+): Promise<Database> {
apps/cli/src/prompts/frontend.ts (1)

69-70: Minor UX: repeated literal message string.

The same "Operation cancelled" literal is repeated three times.
Consider a small helper const CANCEL_MSG = "Operation cancelled"; (or reuse a constant from the error utility) to avoid duplication and keep wording consistent project-wide.

Also applies to: 84-85, 107-108

apps/cli/src/helpers/setup/vibe-rules-setup.ts (3)

54-65: Guard against empty editor selection.

If the user hits without selecting an editor, selectedEditors is [].
You still start the “Applying rules” spinner and iterate, but nothing happens – confusing UX.

+if (selectedEditors.length === 0) {
+  log.warn("No editors selected – skipping rule application.");
+  return;
+}

66-77: run() re-implements exec with spinner; consider deduplication.

run() and exec() differ only by spinner handling. A single wrapper that optionally receives a spinner message would reduce duplication.


104-107: Silent catch masks clean-up failure.

Failing to remove .bts is ignored. At least log log.warn(...) so users know the temp folder remains.

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

45-48: Capitalisation / branding of addon label.

All other labels are Title-cased (“Turborepo”, “PWA”). For consistency consider "Vibe Rules" rather than "vibe-rules".

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

154-156: Idempotency: avoid duplicating dotenv import

Prepend only if not already present to keep the file clean.

-    let content = await fs.readFile(prismaConfigPath, "utf8");
-    content = `import "dotenv/config";\n${content}`;
-    await fs.writeFile(prismaConfigPath, content);
+    let content = await fs.readFile(prismaConfigPath, "utf8");
+    if (!content.includes('import "dotenv/config"')) {
+      content = `import "dotenv/config";\n${content}`;
+      await fs.writeFile(prismaConfigPath, content);
+    }
apps/cli/src/utils/errors.ts (2)

10-13: Nit: avoid red styling with cancel()

cancel already conveys cancellation; red can be perceived as an error. Optional.

-export function exitCancelled(message = "Operation cancelled"): never {
-  cancel(pc.red(message));
+export function exitCancelled(message = "Operation cancelled"): never {
+  cancel(message);
   process.exit(0);
 }

5-8: Optional: make exits test-friendly

Process exits complicate tests. Consider honoring an env flag to throw instead of exiting in test environments.

-export function exitWithError(message: string): never {
-  consola.error(pc.red(message));
-  process.exit(1);
-}
+export function exitWithError(message: string): never {
+  consola.error(pc.red(message));
+  if (process.env.BTS_TEST_MODE === "1") throw new Error(message);
+  process.exit(1);
+}
@@
-export function exitCancelled(message = "Operation cancelled"): never {
-  cancel(pc.red(message));
-  process.exit(0);
-}
+export function exitCancelled(message = "Operation cancelled"): never {
+  cancel(message);
+  if (process.env.BTS_TEST_MODE === "1") throw new Error(message);
+  process.exit(0);
+}
@@
-  consola.error(pc.red(message));
-  process.exit(1);
+  consola.error(pc.red(message));
+  if (process.env.BTS_TEST_MODE === "1") throw new Error(message);
+  process.exit(1);

Also applies to: 10-13, 15-20

apps/cli/templates/addons/vibe-rules/.bts/rules.md.hbs (1)

102-104: pnpm: prefer “pnpm dlx” over “pnpx”

Modern pnpm recommends dlx; pnpx is an alias but dlx is clearer.

-{{#if (eq packageManager "bun")}}bunx{{else if (eq packageManager "pnpm")}}pnpx{{else}}npx{{/if}} create-better-t-stack
+{{#if (eq packageManager "bun")}}bunx{{else if (eq packageManager "pnpm")}}pnpm dlx{{else}}npx{{/if}} create-better-t-stack
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9005a43 and 1b0f55a.

📒 Files selected for processing (41)
  • .gitignore (1 hunks)
  • apps/cli/src/constants.ts (1 hunks)
  • apps/cli/src/helpers/database-providers/neon-setup.ts (3 hunks)
  • apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts (4 hunks)
  • apps/cli/src/helpers/database-providers/turso-setup.ts (4 hunks)
  • apps/cli/src/helpers/project-generation/add-addons.ts (1 hunks)
  • apps/cli/src/helpers/project-generation/add-deployment.ts (1 hunks)
  • apps/cli/src/helpers/project-generation/command-handlers.ts (5 hunks)
  • apps/cli/src/helpers/project-generation/create-project.ts (2 hunks)
  • apps/cli/src/helpers/project-generation/template-manager.ts (1 hunks)
  • apps/cli/src/helpers/setup/addons-setup.ts (2 hunks)
  • apps/cli/src/helpers/setup/fumadocs-setup.ts (2 hunks)
  • apps/cli/src/helpers/setup/ultracite-setup.ts (3 hunks)
  • apps/cli/src/helpers/setup/vibe-rules-setup.ts (1 hunks)
  • apps/cli/src/index.ts (2 hunks)
  • apps/cli/src/prompts/addons.ts (5 hunks)
  • apps/cli/src/prompts/api.ts (2 hunks)
  • apps/cli/src/prompts/auth.ts (2 hunks)
  • apps/cli/src/prompts/backend.ts (2 hunks)
  • apps/cli/src/prompts/config-prompts.ts (3 hunks)
  • apps/cli/src/prompts/database-setup.ts (2 hunks)
  • apps/cli/src/prompts/database.ts (2 hunks)
  • apps/cli/src/prompts/examples.ts (2 hunks)
  • apps/cli/src/prompts/frontend.ts (5 hunks)
  • apps/cli/src/prompts/git.ts (2 hunks)
  • apps/cli/src/prompts/install.ts (2 hunks)
  • apps/cli/src/prompts/orm.ts (2 hunks)
  • apps/cli/src/prompts/package-manager.ts (2 hunks)
  • apps/cli/src/prompts/project-name.ts (2 hunks)
  • apps/cli/src/prompts/runtime.ts (2 hunks)
  • apps/cli/src/prompts/web-deploy.ts (3 hunks)
  • apps/cli/src/types.ts (1 hunks)
  • apps/cli/src/utils/compatibility-rules.ts (10 hunks)
  • apps/cli/src/utils/errors.ts (1 hunks)
  • apps/cli/src/utils/project-directory.ts (4 hunks)
  • apps/cli/src/utils/template-processor.ts (1 hunks)
  • apps/cli/src/validation.ts (25 hunks)
  • apps/cli/templates/addons/vibe-rules/.bts/rules.md.hbs (1 hunks)
  • apps/web/src/app/(home)/showcase/page.tsx (1 hunks)
  • apps/web/src/lib/constant.ts (1 hunks)
  • biome.json (1 hunks)
🔇 Additional comments (41)
.gitignore (1)

40-41: .smoke ignore added — LGTM

Matches the Biome config and keeps local smoke artifacts out of VCS.

biome.json (1)

22-23: Exclude _generated and .smoke from Biome workspace — LGTM

Given vcs.useIgnoreFile=false, placing these negated globs in files.includes is the correct way to keep them out of Biome’s formatter/linter scope.

apps/web/src/app/(home)/showcase/page.tsx (1)

51-51: Consistent label update — LGTM

Tag renamed to “TanStack Start” to match the new naming across the app.

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

138-139: Add “vibe-rules” to addon compatibility — LGTM

Using an empty array follows the existing convention for globally compatible addons (e.g., biome, husky).

apps/cli/src/utils/template-processor.ts (1)

32-32: New Handlebars helper ne — LGTM

Complements eq and keeps template conditions readable.

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

46-47: Addons enum extended with “vibe-rules” — LGTM

Type-safe plumbing for the new addon looks correct and consistent with constants and prompts.

apps/web/src/lib/constant.ts (1)

60-61: Rename to “TanStack Start” — LGTM

Matches the showcase tag and CLI prompt text for consistency.

apps/cli/src/helpers/project-generation/add-deployment.ts (1)

6-6: ExitWithError return type verified as never—no action required.

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

24-24: exitCancelled returns never as expected
Verified in apps/cli/src/utils/errors.ts that

export function exitCancelled(message = "Operation cancelled"): never { … }

so return exitCancelled("Operation cancelled") correctly never returns and poses no type or unreachable-code issues.

apps/cli/src/prompts/config-prompts.ts (1)

105-106: exitCancelled correctly returns never, no further action needed

The exitCancelled function in apps/cli/src/utils/errors.ts is declared with a return type of never, ensuring that onCancel: () => exitCancelled("…") aborts execution as intended.

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

51-51: exitCancelled has a never return type
The exitCancelled function in apps/cli/src/utils/errors.ts is declared as returning never, so using return exitCancelled("Operation cancelled") correctly signals non-returning control flow. No changes needed.

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

23-23: Good move to centralized error handling

Replacing local logging/exit with handleError improves consistency and maintainability. No further changes needed here.

Also applies to: 105-105

apps/cli/src/prompts/package-manager.ts (1)

31-31: exitCancelled is correctly typed as never

The exitCancelled function in apps/cli/src/utils/errors.ts is declared as:

export function exitCancelled(message = "Operation cancelled"): never {
  cancel(pc.red(message));
  process.exit(0);
}

This : never signature ensures that using return exitCancelled(...) in async functions (e.g. those returning Promise<PackageManager>) type-checks correctly and prevents any code fallthrough. No changes required.

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

13-13: Centralized cancellation looks good; verify exitCancelled typing

Refactor is consistent with the new error utilities. As above, ensure exitCancelled’s return type is never (or Promise<never>) so this return branch type-checks in all callers.

apps/cli/src/prompts/database-setup.ts (1)

104-104: Uniform cancel handling; verify exitCancelled signature

Pattern matches the new centralized approach. Please confirm exitCancelled is typed as never (or Promise<never>) to keep return types sound.

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

181-181: Good consolidation of cancel handling

Both cancel checks now use exitCancelled, improving consistency and avoiding inline exits. No further issues here.

Also applies to: 199-201

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

46-46: Consistent cancel handling; confirm never-typed exit path

Looks good. As with other modules, please verify exitCancelled returns never (or Promise<never>) to satisfy the function’s declared return type in all branches.

apps/cli/src/prompts/project-name.ts (2)

8-8: Centralized cancel handling import looks good

Switching to a single exit helper improves consistency and reduces duplication.


80-80: exitCancelled is correctly typed and terminates execution

Verified in apps/cli/src/utils/errors.ts that

  • export function exitCancelled(message = "Operation cancelled"): never { … process.exit(0); }
  • it logs the message and calls process.exit(0), so it never returns to the caller

Using return exitCancelled("Operation cancelled."); is safe—no fall-through or type mismatch will occur.

apps/cli/src/prompts/backend.ts (2)

4-4: Good move to shared cancel path

Importing and using exitCancelled keeps flow consistent across prompts.


66-66: Confirm exitCancelled terminates (typed never) to satisfy Backend return

If it doesn’t exit/throw, the function might continue unexpectedly.

Use the repo-wide script in the earlier comment to confirm typing and message consistency.

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

6-6: Importing exitCancelled aligns with the new error model

Refactor is on the right track.

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

4-4: Exit helper import: nice consistency improvement

Keeps cancellation flow uniform across prompts.

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

8-8: Consistent centralized cancellation

Importing exitCancelled here aligns this setup helper with the refactor.

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

1-1: Centralized cancellation import: LGTM

Moving to exitCancelled keeps prompt modules thin and consistent.

Also applies to: 3-3

apps/cli/src/validation.ts (2)

29-29: Centralized error handling import: LGTM

Good replacement for scattered consola.fatal + process.exit(1).


46-49: exitWithError correctly returns never
Confirmed that in apps/cli/src/utils/errors.ts (line 5)

export function exitWithError(message: string): never {

is typed to return never, so there’s no risk of fall-through. No changes required.

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

1-1: Centralized cancellation import: LGTM

Consistent with the new pattern across prompts.

Also applies to: 4-4

apps/cli/src/helpers/project-generation/add-addons.ts (1)

7-7: Centralized exitWithError: LGTM

Good move removing the local helper and reusing the shared one.

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

31-31: Return type relies on exitCancelled being never – double-check.

return exitCancelled("Operation cancelled") is only type-safe if exitCancelled is declared to return never.
If it instead returns void, the function’s Promise<Frontend[]> signature is violated and TypeScript will complain.

Confirm the signature in utils/errors.ts:

export function exitCancelled(msg: string): never { … }

If it isn’t never, update it accordingly.

apps/cli/src/utils/compatibility-rules.ts (1)

31-33: Early-exit helper must be never to avoid dead-code warnings.

exitWithError(...) replaces process.exit(1). Ensure it is typed/implemented as never; otherwise the compiler will flag subsequent code as unreachable yet still type-checked.
If it already is, great – just pointing out the importance here because this file relies on that behaviour dozens of times.

Also applies to: 36-38, 53-56

apps/cli/src/utils/project-directory.ts (1)

100-102: handleError must terminate or rethrow.

After catching a failure to empty the directory, handleError(error) is invoked.
If handleError only logs and returns void, the code continues into an inconsistent state.
Ensure handleError exits (never) or rethrows so the function doesn’t proceed with a half-cleared directory.

apps/cli/src/helpers/project-generation/command-handlers.ts (4)

2-2: LGTM: import cleanup is correct

Removed use of cancel; only intro/log/outro retained.


135-135: Centralized error handling call looks good

Once handleError uses the fallback (see errors.ts note), this will surface clearer context to users.


145-147: Good: fail-fast with a clear message

exitWithError here is appropriate; unreachable code after is fine due to return type never.


215-215: Consistent error handling

Consistent with the refactor; again, ensure handleError uses the fallback message.

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

2-2: LGTM: imports reflect centralized cancellation flow

Using isCancel/text/select/log and exitCancelled is correct.

Also applies to: 9-9


243-243: LGTM: cancel on setup method exits cleanly

exitCancelled here is appropriate.


179-188: Import path is correct
The Prisma schema templates specify output = "../generated", so the client is generated under prisma/generated/client. Using

import { PrismaClient } from "./generated/client";

in prisma/index.ts matches that configuration. No changes required.


116-116: Cancel behavior is already consistent

Both setupWithCreateDb (line 64) and the alternate setup path (line 116) use

if (isCancel(databaseUrl)) return null;

so the “skip on cancel” behavior is the same in both places. No changes are needed here.

apps/cli/templates/addons/vibe-rules/.bts/rules.md.hbs (1)

9-15: Custom Handlebars helpers are properly registered
Verified that eq, ne, and, or, and includes are registered in apps/cli/src/utils/template-processor.ts (lines 31–39). The conditional helpers used in apps/cli/templates/addons/vibe-rules/.bts/rules.md.hbs will resolve as expected.

Comment thread .gitignore
Comment on lines +40 to +41

.smoke No newline at end of file

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.

💡 Verification agent

🧩 Analysis chain

Ensure packaging/CI also excludes .smoke (and optionally _generated)
If you publish to npm or build containers, verify .smoke isn’t bundled. Consider aligning other ignore sources (.npmignore, package.json "files", .dockerignore).


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Checking for .smoke directories in repo (hidden included):"
fd -H -t d ".smoke" || true

echo -e "\n.package.json 'files' (if present):"
if [ -f package.json ]; then
  jq -r '.files // empty' package.json || true
else
  echo "package.json not found"
fi

echo -e "\n.npmignore entry for .smoke (if present):"
if [ -f .npmignore ]; then
  rg -n "^[.]?smoke/?$" .npmignore || echo "No explicit .smoke entry"
else
  echo ".npmignore not found (using package.json 'files' or defaults)"
fi

echo -e "\n.dockerignore entry for .smoke (if present):"
if [ -f .dockerignore ]; then
  rg -n "^[.]?smoke/?$" .dockerignore || echo "No explicit .smoke entry"
else
  echo ".dockerignore not found"
fi

Length of output: 775


Ensure .smoke Is Excluded from All Published Artifacts
Currently .smoke is only listed in .gitignore. Verify and update your packaging/CI configs so that no .smoke directories or files are ever bundled or published:

• There is no .npmignore, so npm will fall back to .gitignore defaults – consider adding a .npmignore entry for /.smoke
• No "files" field in package.json – you can explicitly omit smoke/ or only whitelist the directories you intend to publish
• No .dockerignore – add /.smoke (and optionally /_generated) to ensure Docker builds don’t include it

🤖 Prompt for AI Agents
In the .gitignore file around lines 40 to 41, the .smoke directory is ignored
for git but not explicitly excluded from npm packages, Docker builds, or other
published artifacts. To fix this, add an entry for /.smoke in a new or existing
.npmignore file to prevent it from being included in npm packages, add a "files"
field in package.json to whitelist only intended directories or explicitly
exclude smoke/, and create or update a .dockerignore file to include /.smoke and
optionally /_generated to exclude these from Docker builds.

cancel("Database setup cancelled");
return null;
}
if (isCancel(databaseUrl)) return null;

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.

💡 Verification agent

🧩 Analysis chain

Cancellation semantics: cancel currently “skips” instead of exiting

Returning null on isCancel(databaseUrl) treats a user cancel as “skip DB config” and proceeds to manual instructions. If that’s intentional, consider a confirm (“Skip DB configuration?”). If not, align with exitCancelled for consistency.

Option to align with exit:

-    if (isCancel(databaseUrl)) return null;
+    if (isCancel(databaseUrl)) return exitCancelled("Database setup cancelled");

🏁 Script executed:

#!/bin/bash
set -e

# Locate the Prisma Postgres setup helper
file=$(fd --hidden --glob 'prisma-postgres-setup.ts')
echo "Found file: $file"

# Show lines 1–100 to capture imports, helper definitions, and function context
echo "---- File head (1–100) ----"
sed -n '1,100p' "$file"
echo "----------------------------"

# Show lines 50–90 around the cancellation check
echo "---- Context around line 64 ----"
sed -n '50,90p' "$file"
echo "----------------------------"

# Find the isCancel helper definition and usages
echo "---- isCancel definition ----"
rg -n "function isCancel" -C3
echo "---- isCancel usages ----"
rg -n "isCancel" -C1

# Find the exitCancelled helper definition and usages
echo "---- exitCancelled definition ----"
rg -n "function exitCancelled" -C3
echo "---- exitCancelled usages ----"
rg -n "exitCancelled" -C1

Length of output: 4252


🏁 Script executed:

#!/bin/bash
set -e

# Locate the errors utility file
error_file=$(fd --hidden --glob 'errors.ts' | grep 'apps/cli/src/utils/errors.ts' || true)
echo "Found errors file: $error_file"

# Display the contents to see exitCancelled implementation
echo "---- errors.ts (1–200) ----"
sed -n '1,200p' "$error_file"
echo "---------------------------"

# Find all usages of exitCancelled in the codebase
echo "---- exitCancelled usages ----"
rg -n "exitCancelled" -C1

Length of output: 13626


Ensure consistent cancellation behavior in Prisma Postgres setup

The setupWithCreateDb helper in
apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts
currently does:

const databaseUrl = await text({ … });
if (isCancel(databaseUrl)) return null;

Returning null on cancel causes the CLI to “skip” DB configuration and fall back to manual instructions. All other prompts abort via exitCancelled. To keep UX consistent (and avoid surprising skips), replace the null return with an exitCancelled call:

-    if (isCancel(databaseUrl)) return null;
+    if (isCancel(databaseUrl)) return exitCancelled("Database setup cancelled");

If you intended to let users skip and continue, consider adding an explicit confirmation (e.g. confirm("Skip DB configuration?")) instead.

🤖 Prompt for AI Agents
In apps/cli/src/helpers/database-providers/prisma-postgres-setup.ts at line 64,
the code returns null when isCancel(databaseUrl) is true, causing inconsistent
cancellation behavior. Replace the return null statement with a call to
exitCancelled() to ensure the CLI aborts consistently on cancellation instead of
silently skipping DB configuration.

import type { AddInput, CreateInput, ProjectConfig } from "../../types";
import { trackProjectCreation } from "../../utils/analytics";
import { displayConfig } from "../../utils/display-config";
import { exitWithError, handleError } from "../../utils/errors";

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.

💡 Verification agent

🧩 Analysis chain

Double-check handleError fallback semantics

You’re passing a friendly fallback, but handleError currently ignores fallback when error is an Error. See proposed fix in errors.ts so the user-friendly context actually shows up.


🏁 Script executed:

#!/bin/bash
set -e

echo "=== Showing handleError implementation ==="
rg -n "handleError" -A20 apps/cli/src/utils/errors.ts

echo
echo "=== Showing usages of handleError in command-handlers.ts ==="
rg -n "handleError" -C3 apps/cli/src/helpers/project-generation/command-handlers.ts

Length of output: 1306


Double-check handleError fallback logic in utils/errors.ts

The current implementation in apps/cli/src/utils/errors.ts always selects error.message for any Error instance, so your provided fallback is never used when an actual Error is thrown:

export function handleError(error: unknown, fallbackMessage?: string): never {
  const message =
    error instanceof Error
      ? error.message               // ← fallbackMessage is ignored here
      : fallbackMessage || String(error);
  consola.error(pc.red(message));
  process.exit(1);
}

To ensure the friendly fallback is displayed when given, flip the logic to prefer fallbackMessage first:

-export function handleError(error: unknown, fallbackMessage?: string): never {
-  const message =
-    error instanceof Error ? error.message : fallbackMessage || String(error);
+export function handleError(error: unknown, fallbackMessage?: string): never {
+  const message =
+    fallbackMessage ??
+    (error instanceof Error ? error.message : String(error));
  consola.error(pc.red(message));
  process.exit(1);
}

• File: apps/cli/src/utils/errors.ts
• Adjust lines 15–18 as shown above.

🤖 Prompt for AI Agents
In apps/cli/src/utils/errors.ts around lines 15 to 18, the handleError function
always uses error.message when error is an instance of Error, ignoring the
fallbackMessage. To fix this, modify the logic to prioritize fallbackMessage if
provided, otherwise use error.message, and if neither is available, convert
error to string. This ensures the friendly fallback message is displayed when
given.

import pc from "picocolors";
import type { ProjectConfig } from "../../types";
import { writeBtsConfig } from "../../utils/bts-config";
import { exitWithError } from "../../utils/errors";

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.

🛠️ Refactor suggestion

Unify error handling via handleError; avoid double-logging and keep stack context

Use the centralized handler instead of mixing console.error + exitWithError. This keeps behavior consistent across the CLI and avoids duplicated output.

-import { exitWithError } from "../../utils/errors";
+import { handleError } from "../../utils/errors";
@@
   } catch (error) {
-    if (error instanceof Error) {
-      console.error(error.stack);
-      exitWithError(`Error during project creation: ${error.message}`);
-    } else {
-      console.error(error);
-      exitWithError(`An unexpected error occurred: ${String(error)}`);
-    }
+    handleError(error, "Error during project creation");
   }

Also applies to: 106-112

🤖 Prompt for AI Agents
In apps/cli/src/helpers/project-generation/create-project.ts at line 5 and also
lines 106 to 112, replace the current error handling that uses console.error
combined with exitWithError by using the centralized handleError function
instead. This will unify error handling, prevent double-logging, and preserve
the error stack context consistently across the CLI. Update the imports and
calls accordingly to use handleError for all error cases in these sections.

Comment on lines +538 to +539
if (addon === "vibe-rules") continue;

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.

💡 Verification agent

🧩 Analysis chain

Explicitly skipping 'vibe-rules' templates—add code comment and verify dedicated setup path handles it.

Good call if ‘vibe-rules’ is handled by a dedicated setup to avoid duplication. Add a brief comment to document the rationale and verify the setup path is indeed invoked.

Suggested inline comment:

-    if (addon === "vibe-rules") continue;
+    // 'vibe-rules' has a dedicated setup (see helpers/setup/vibe-rules-setup.ts).
+    // Skip template copy here to avoid duplication/conflicts.
+    if (addon === "vibe-rules") continue;

Verification script:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Searching for 'setupVibeRules' definition and invocations..."
rg -n 'setupVibeRules' -A 3 -B 3 || true

echo
echo "Checking addons setup wiring..."
rg -n 'setupAddons' -A 20 apps/cli/src/helpers/setup || true

Length of output: 3815


Add inline documentation for skipping ‘vibe-rules’ templates

To avoid confusion and clarify that ‘vibe-rules’ is processed via its own setup routine, please annotate the skip logic in apps/cli/src/helpers/project-generation/template-manager.ts.

• Location: around line 538 in apps/cli/src/helpers/project-generation/template-manager.ts
• Dedicated setup found in: apps/cli/src/helpers/setup/vibe-rules-setup.ts

Suggested diff:

     // 'vibe-rules' has its own setup handler
     // (apps/cli/src/helpers/setup/vibe-rules-setup.ts).
     // Skip copying templates here to prevent duplication/conflicts.
-    if (addon === "vibe-rules") continue;
+    if (addon === "vibe-rules") continue;

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

🤖 Prompt for AI Agents
In apps/cli/src/helpers/project-generation/template-manager.ts around lines 538
to 539, add an inline comment above the line that skips 'vibe-rules' templates
explaining that these templates are excluded here because they are handled
separately by their own setup routine located in
apps/cli/src/helpers/setup/vibe-rules-setup.ts. This will clarify the reason for
skipping and improve code readability.

cancel(pc.red("Operation cancelled"));
process.exit(0);
}
if (isCancel(response)) return exitCancelled("Operation cancelled");

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.

💡 Verification agent

🧩 Analysis chain

Ensure exitCancelled is typed to return never (and consider explicit return type here).

Returning exitCancelled(...) is correct only if it’s typed as never. Otherwise, this widens the function’s return type and may cause type leaks.

  • If exitCancelled is never, consider explicitly annotating the function return type for clarity.

Suggested tweak (optional):

-export async function getinstallChoice(install?: boolean) {
+export async function getinstallChoice(install?: boolean): Promise<boolean> {

Run to confirm never return type:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify exitCancelled signature and return type
rg -n $'export function exitCancelled\\s*\\(' apps/cli/src/utils/errors.ts -A 1 || true

# Verify exitWithError signature and return type
rg -n $'export function exitWithError\\s*\\(' apps/cli/src/utils/errors.ts -A 1 || true

Length of output: 374


exitCancelled correctly returns never—consider explicitly typing your function’s return type

  • In apps/cli/src/prompts/install.ts (around line 13), the call to exitCancelled(...) is safe because it’s declared as returning never in apps/cli/src/utils/errors.ts.
  • To make your API clearer and prevent unintentional return-type widening, you can explicitly annotate getInstallChoice:

Suggested diff:

-export async function getInstallChoice(install?: boolean) {
+export async function getInstallChoice(install?: boolean): Promise<boolean> {
📝 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
if (isCancel(response)) return exitCancelled("Operation cancelled");
-export async function getInstallChoice(install?: boolean) {
+export async function getInstallChoice(install?: boolean): Promise<boolean> {
🤖 Prompt for AI Agents
In apps/cli/src/prompts/install.ts at line 13, the call to exitCancelled is safe
because exitCancelled returns never, but the function getInstallChoice should be
explicitly typed with a return type that reflects this behavior. Add an explicit
return type annotation to getInstallChoice to clarify that it may not return
normally, preventing unintentional return-type widening and improving API
clarity.

import { DEFAULT_CONFIG } from "../constants";
import type { Backend, Frontend, Runtime, WebDeploy } from "../types";
import { WEB_FRAMEWORKS } from "../utils/compatibility";
import { exitCancelled } from "../utils/errors";

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.

💡 Verification agent

🧩 Analysis chain

Ensure exitCancelled is never-returning; avoid returning it

Same rationale as other prompts: returning exitCancelled is unnecessary if it returns never. If it doesn’t, it can violate the function’s return type.

Verification:

Refactor if needed:

- if (isCancel(response)) return exitCancelled("Operation cancelled");
+ if (isCancel(response)) {
+   exitCancelled("Operation cancelled");
+ }

Also applies to: 59-60, 105-106


🏁 Script executed:

#!/bin/bash
rg -n "export (const|function) exitCancelled" apps/cli/src/utils/errors.ts -A 3 -B 1

Length of output: 219


Avoid returning exitCancelled; invoke it directly

Since exitCancelled is declared to return never, using return exitCancelled(...) is unnecessary and may conflict with surrounding return types. Replace all instances of:

- if (isCancel(response)) return exitCancelled("Operation cancelled");
+ if (isCancel(response)) {
+   exitCancelled("Operation cancelled");
+ }

Locations to update:

  • apps/cli/src/prompts/web-deploy.ts, lines 59-60
  • apps/cli/src/prompts/web-deploy.ts, lines 105-106

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

🤖 Prompt for AI Agents
In apps/cli/src/prompts/web-deploy.ts at lines 59-60 and 105-106, the code uses
'return exitCancelled(...)' but since exitCancelled returns never, you should
remove the 'return' keyword and call exitCancelled directly to avoid type
conflicts and improve clarity.

Comment on lines +15 to +20
export function handleError(error: unknown, fallbackMessage?: string): never {
const message =
error instanceof Error ? error.message : fallbackMessage || String(error);
consola.error(pc.red(message));
process.exit(1);
}

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.

🛠️ Refactor suggestion

Use fallback message and include details; optionally log stack in debug

Current logic ignores fallback when error is an Error. Prefer a friendly base message plus details. Also log the stack at debug level when available.

-export function handleError(error: unknown, fallbackMessage?: string): never {
-  const message =
-    error instanceof Error ? error.message : fallbackMessage || String(error);
-  consola.error(pc.red(message));
-  process.exit(1);
-}
+export function handleError(error: unknown, fallbackMessage?: string): never {
+  const base = fallbackMessage ?? "An unexpected error occurred";
+  let detailed = "";
+  if (error instanceof Error) {
+    detailed = error.message || "";
+    if (error.stack) consola.debug(error.stack);
+  } else if (error != null) {
+    detailed = String(error);
+  }
+  const message = detailed ? `${base}: ${detailed}` : base;
+  consola.error(pc.red(message));
+  process.exit(1);
+}
🤖 Prompt for AI Agents
In apps/cli/src/utils/errors.ts around lines 15 to 20, the handleError function
currently uses the error message directly if error is an Error, ignoring the
fallbackMessage. Update the logic to always use the fallbackMessage as a base
friendly message and append error details if available. Additionally, if the
error has a stack trace, log it at the debug level using consola.debug. This
will provide a clearer user message and detailed debug info.

Comment on lines +11 to +15
- **`apps/web/`** - Frontend application{{#if (includes frontend "tanstack-router")}} (React with TanStack Router){{else
if (includes frontend "react-router")}} (React with React Router){{else if (includes frontend "next")}} (Next.js){{else
if (includes frontend "nuxt")}} (Nuxt.js){{else if (includes frontend "svelte")}} (SvelteKit){{else if (includes
frontend "solid")}} (SolidStart){{/if}}
{{/if}}

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.

💡 Verification agent

🧩 Analysis chain

Handlebars “else if” may not be supported; prefer nested ifs or a helper

If your renderer doesn’t support else if, this won’t compile. Either nest blocks or add a custom elseif helper. Example rewrite:

- - **`apps/web/`** - Frontend application{{#if (includes frontend "tanstack-router")}} (React with TanStack Router){{else
- if (includes frontend "react-router")}} (React with React Router){{else if (includes frontend "next")}} (Next.js){{else
- if (includes frontend "nuxt")}} (Nuxt.js){{else if (includes frontend "svelte")}} (SvelteKit){{else if (includes
- frontend "solid")}} (SolidStart){{/if}}
+ - **`apps/web/`** - Frontend application
+ {{#if (includes frontend "tanstack-router")}} (React with TanStack Router)
+ {{else}}
+   {{#if (includes frontend "react-router")}} (React with React Router)
+   {{else}}
+     {{#if (includes frontend "next")}} (Next.js)
+     {{else}}
+       {{#if (includes frontend "nuxt")}} (Nuxt.js)
+       {{else}}
+         {{#if (includes frontend "svelte")}} (SvelteKit)
+         {{else}}
+           {{#if (includes frontend "solid")}} (SolidStart){{/if}}
+         {{/if}}
+       {{/if}}
+     {{/if}}
+   {{/if}}
+ {{/if}}

To verify support, search for custom helpers and prior use of {{else if}}:


🏁 Script executed:

#!/bin/bash
rg -n --glob '!node_modules' 'registerHelper\\(|handlebars-helpers|{{else if' -A 3

Length of output: 243


🏁 Script executed:

#!/bin/bash
# Search for custom helper registrations
rg -n --glob '!node_modules' 'registerHelper\(' -A 3
# Search for inclusion of handlebars-helpers package
rg -n --glob '!node_modules' 'handlebars-helpers' -A 3
# Search for any use of '{{else if' in .hbs templates
rg -n --glob '!node_modules' --glob '*.hbs' '{{else if' -A 3

Length of output: 970


Refactor Handlebars conditionals to avoid unsupported else if

Handlebars only supports a single {{else}} block—not {{else if}}—and there’s no registered elseif helper. To ensure this template compiles across all environments, replace your chained else if with nested {{#if}}…{{else}} blocks.

File: apps/cli/templates/addons/vibe-rules/.bts/rules.md.hbs
Lines: 11–15

- - **`apps/web/`** - Frontend application{{#if (includes frontend "tanstack-router")}} (React with TanStack Router){{else if (includes frontend "react-router")}} (React with React Router){{else if (includes frontend "next")}} (Next.js){{else if (includes frontend "nuxt")}} (Nuxt.js){{else if (includes frontend "svelte")}} (SvelteKit){{else if (includes frontend "solid")}} (SolidStart){{/if}}
+ - **`apps/web/`** - Frontend application
+ {{#if (includes frontend "tanstack-router")}}
+   (React with TanStack Router)
+ {{else}}
+   {{#if (includes frontend "react-router")}}
+     (React with React Router)
+   {{else}}
+     {{#if (includes frontend "next")}}
+       (Next.js)
+     {{else}}
+       {{#if (includes frontend "nuxt")}}
+         (Nuxt.js)
+       {{else}}
+         {{#if (includes frontend "svelte")}}
+           (SvelteKit)
+         {{else}}
+           {{#if (includes frontend "solid")}}
+             (SolidStart)
+           {{/if}}
+         {{/if}}
+       {{/if}}
+     {{/if}}
+   {{/if}}
+ {{/if}}

– Replace every {{else if (…)}} with an {{else}} followed by a nested {{#if (…)}}…{{/if}}.
– No else if helper is registered in apps/cli/src/utils/template-processor.ts, so this change is required to avoid compilation errors.

📝 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
- **`apps/web/`** - Frontend application{{#if (includes frontend "tanstack-router")}} (React with TanStack Router){{else
if (includes frontend "react-router")}} (React with React Router){{else if (includes frontend "next")}} (Next.js){{else
if (includes frontend "nuxt")}} (Nuxt.js){{else if (includes frontend "svelte")}} (SvelteKit){{else if (includes
frontend "solid")}} (SolidStart){{/if}}
{{/if}}
- **`apps/web/`** - Frontend application
{{#if (includes frontend "tanstack-router")}}
(React with TanStack Router)
{{else}}
{{#if (includes frontend "react-router")}}
(React with React Router)
{{else}}
{{#if (includes frontend "next")}}
(Next.js)
{{else}}
{{#if (includes frontend "nuxt")}}
(Nuxt.js)
{{else}}
{{#if (includes frontend "svelte")}}
(SvelteKit)
{{else}}
{{#if (includes frontend "solid")}}
(SolidStart)
{{/if}}
{{/if}}
{{/if}}
{{/if}}
{{/if}}
{{/if}}
🤖 Prompt for AI Agents
In apps/cli/templates/addons/vibe-rules/.bts/rules.md.hbs around lines 11 to 15,
the Handlebars template uses unsupported `{{else if}}` conditionals which cause
compilation errors. Replace each `{{else if (...)}}` with an `{{else}}` block
containing a nested `{{#if (...)}}...{{/if}}` block to properly nest the
conditions without using `else if`. This ensures compatibility with Handlebars
which only supports a single `{{else}}` block.

Comment on lines +19 to +21
- **`apps/server/`** - Backend server{{#if (eq backend "hono")}} (Hono){{else if (eq backend "express")}}
(Express){{else if (eq backend "fastify")}} (Fastify){{else if (eq backend "elysia")}} (Elysia){{else if (eq backend
"next")}} (Next.js API){{/if}}

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.

🛠️ Refactor suggestion

Apply the same “else if” handling in other conditional blocks

Repeat the nested-if (or custom elseif helper) pattern for backend and ORM sections to prevent template parse errors.

Also applies to: 55-56, 86-89

🤖 Prompt for AI Agents
In apps/cli/templates/addons/vibe-rules/.bts/rules.md.hbs around lines 19 to 21,
the conditional block for backend uses multiple separate if statements instead
of a consistent "else if" pattern, which can cause template parse errors. Update
this block and similarly at lines 55-56 and 86-89 to use a nested "else if" or a
custom elseif helper for all conditional checks to ensure proper parsing and
consistent logic flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant