Skip to content

fix(cli): gracefully handle prompt cancellation and validate template… - #373

Open
shobhitagnihotri69 wants to merge 1 commit into
bubblelabai:mainfrom
shobhitagnihotri69:fix/cli-prompt-cancellation
Open

fix(cli): gracefully handle prompt cancellation and validate template…#373
shobhitagnihotri69 wants to merge 1 commit into
bubblelabai:mainfrom
shobhitagnihotri69:fix/cli-prompt-cancellation

Conversation

@shobhitagnihotri69

@shobhitagnihotri69 shobhitagnihotri69 commented Sep 9, 2026

Copy link
Copy Markdown

Summary

When running create-bubblelab-app, pressing Ctrl+C or cancelling prompts midway left projectName populated while template was undefined. The CLI would create an empty target directory and crash with ENOENT while attempting to copy templates/undefined.

Changes

  • Added onCancel handler to prompts to cleanly exit with code 0 on user cancellation.
  • Validated that required fields (projectName, template, googleApiKey) are present before touching the filesystem.
  • Added fs.existsSync guard for templateDir.

Summary by CodeRabbit

  • Bug Fixes
    • Improved cancellation handling during project setup with a clear notification and successful exit.
    • Added validation to ensure all required project details are provided.
    • Added an error message when the selected template cannot be found.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: c945ea89-337c-4604-94d5-df33128cedad

📥 Commits

Reviewing files that changed from the base of the PR and between e64b246 and 5f0a248.

📒 Files selected for processing (1)
  • packages/create-bubblelab-app/bin/cli.js

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The CLI now handles prompt cancellation with a yellow message and exit code 0. It validates projectName, template, and googleApiKey, and reports missing template directories before copying.

Changes

CLI validation flow

Layer / File(s) Summary
Prompt cancellation and template checks
packages/create-bubblelab-app/bin/cli.js
The CLI handles cancelled or incomplete prompts with a yellow message and exit code 0. It computes templateDir before use and exits with a red error when the directory does not exist.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 5f0a2

The CLI now exits cleanly when setup is cancelled and reports missing required inputs or template directories before creating files. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: graceful prompt cancellation and template validation. It is concise and specific enough for the pull request history.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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.

2 participants