fix(cli): re-prompt when the project directory already exists - #976
Merged
Conversation
`openui create` aborted when the target directory was taken, so an interactive run had to be started over. It also only checked after the template prompt, so you answered everything before being rejected. - Check the name as soon as it is resolved, before any other prompt. - Interactive runs report the collision and ask again, defaulting to the next free `<name>-<n>`. After 5 attempts they abort as before. - Non-interactive runs still fail immediately with TARGET_EXISTS, since there is nobody to ask. - Move the logic to `lib/target-dir.ts` to keep `create-app.ts` readable. - Add `cli_target_exists`, fired on every collision in both modes. Interactive runs now recover instead of throwing, so the signal that used to reach analytics via `cli_create_failed` would otherwise be lost.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zahlekhan
approved these changes
Aug 13, 2026
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
openui createaborted outright when the target directory already existed, so you had to start the whole run again. Worse, it only checked after the template prompt — you answered everything, then got rejected.Changes
<name>-<n>. After 5 attempts they abort, as before.TARGET_EXISTS— there's nobody to ask.lib/target-dir.tssocreate-app.tsstays readable.cli_target_exists, fired on every collision in both modes. Interactive runs now recover instead of throwing, so the signal that used to reach analytics viacli_create_failedwould otherwise have been lost.Independent of the backend-framework stack (#964–#969); both touch
create-app.ts, so whichever lands second will need a trivial rebase.Test Plan
tsc,prettierandeslintclean. Built the CLI and ran:--template, non-interactive →Error: Directory "taken" already exists., exit 1 — proves the name is now checked before template resolution--template, non-interactive →Error: Missing required argument --template(control)Also diffed every
telemetry.capture/telemetry.registercall site againstmain: all 27 existing events are preserved, withcli_target_existsandcli_target_name_retriedadded.Checklist