Skip to content

fix(init): ask every new-project question before writing the starter - #860

Merged
cpojer merged 1 commit into
voidzero-dev:mainfrom
morinokami:fix/init-questions-first
Nov 17, 2026
Merged

cpojer merged 1 commit into
voidzero-dev:mainfrom
morinokami:fix/init-questions-first

Conversation

@morinokami

Copy link
Copy Markdown
Collaborator

This PR changes the order of void init when it creates a new project: init now asks every question before it writes the starter, and says what it is going to do before the first question.

This follows #853. More PRs will follow to shorten the rest of the void init output in the style of vp create.

Changes

Ask where to deploy before writing the starter

Init asked "Where should this project deploy?" after it had written the starter. Cancelling at that question left a partial starter behind (package.json, pages/, void.config.ts and more), and the next void init treated the folder as an existing project instead of offering the starter again. Init now asks right after the starter question, so cancelling at any question leaves no starter files. The answer is still saved after the files are written, followed by the Cloudflare or Void platform setup as before. Existing projects keep their question order.

Say what init will do before the first question

"Empty project detected. Creating a Pages starter." and "Existing project detected. Configuring Void..." appeared after the Git question. They now come before it, so they introduce the questions that follow. The existing-project line also drops its trailing "...", like the empty-project line in #853. In a framework project, "Detected framework" now appears there alone; it used to be followed by the existing-project line.

Before / after

New project, answering every question. Blank lines are omitted, and the starter's file lines and the vp install output are shortened.

+● Empty project detected. Creating a Pages starter.
 ◇ Initialize a git repository?
   Yes
-● Empty project detected. Creating a Pages starter.
 ◇ Choose a Pages scaffold toolchain:
   Vite+
 ◇ Choose a Pages framework to scaffold:
   React
 ◇ Choose a Pages starter:
   D1 (SQLite)
+◇ Where should this project deploy?
+  Skip deployment setup
 ◇ Updated pnpm-workspace.yaml with approved builds
 ◇ Updated package.json with starter scripts and dependencies
 …
 ◇ Created AGENTS.md with Void instructions
 ● Bundled Void docs: node_modules/void/docs/
-◇ Where should this project deploy?
-  Skip deployment setup
 ◇ Installing dependencies with vp

void init --no-git, then Ctrl+C at the deployment question. Before, the folder kept 13 entries; now it stays empty.

 ● Empty project detected. Creating a Pages starter.
 ◇ Choose a Pages scaffold toolchain:
   Vite+
 ◇ Choose a Pages framework to scaffold:
   React
 ◇ Choose a Pages starter:
   D1 (SQLite)
-◇ Updated pnpm-workspace.yaml with approved builds
-◇ Updated package.json with starter scripts and dependencies
-…
-● Bundled Void docs: node_modules/void/docs/
 ■ Where should this project deploy?
   Cloudflare
 Setup cancelled.

An existing Vite app:

+● Existing project detected. Configuring Void.
 ◇ Initialize a git repository?
   Yes
-● Existing project detected. Configuring Void...
 ◇ Updated package.json with Void dependencies and Vite scripts

Design decisions

  • askDeploymentPlatform() only asks. runInitCommand() saves the answer at the point where promptDeploymentPlatform() used to.
  • The separate check that failed without a terminal when --deploy was missing is gone: the question itself now comes before any file is written and fails with the same message. Its existing test passes unchanged.
  • .git is allowed in an empty project, so detecting the project before git init gives the same result.
  • --tsconfig and --github runs print no new line. Detected <name> framework still appears there, as before.
  • The question wording is unchanged.

Checked

  • init.test.ts: four new tests check that the folder is still empty when the deployment question appears, that cancelling it leaves the folder empty, and that the line comes before the Git question for an empty folder and an existing app. They fail without the source changes. The existing tests pass unchanged.
  • vp run check, vp lint and vp fmt --check
  • Full suite (vp test run): 820 files passed, 1 skipped
  • Packed consumer with npm and pnpm (React). The Vite+ variant could not finish locally, as in fix(init): clarify starter messages and cd into a new subfolder #853.
  • The built CLI from main and from this branch, for the three flows above.

🤖 Generated with Claude Code

The deployment question came after init had written the starter, so
cancelling there left a partial starter that the next run treated as an
existing project. Init now asks it right after the starter question and
saves the answer where it did before.

The line that says what init will do (detected framework, empty project
or existing project) now comes before the first question instead of
after the Git prompt. Existing projects keep their question order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@cpojer cpojer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Makes sense, thank you!

@cpojer
cpojer merged commit 4815bdc into voidzero-dev:main Nov 17, 2026
18 checks passed
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