Skip to content

feat(init): accept scaffold choices as flags - #495

Merged
cpojer merged 1 commit into
voidzero-dev:mainfrom
ashunar0:feat/init-non-interactive
Oct 20, 2026
Merged

cpojer merged 1 commit into
voidzero-dev:mainfrom
ashunar0:feat/init-non-interactive

Conversation

@ashunar0

Copy link
Copy Markdown
Contributor

Fixes #491.

Adds --toolchain, --framework, --starter and --deploy to void init, with the same values as the prompts. Without an interactive terminal, a missing choice no longer prompts: init prints the flag it needs and its values, and exits with code 1. Unknown values fail the same way.

create-void forwards the arguments after the project name to void init:

npm create void@latest my-app -- --toolchain vite-plus --framework react --starter sqlite --deploy none

run() uses a shell on Windows, so only arguments made of letters, digits, - and = are forwarded. Without a terminal and a project name, it fails instead of asking for the name.

Out of scope: signing in after choosing cloudflare or void, and the prompts for existing projects (database, demo), stay interactive. The docs suggest --deploy none and void connect later for non-interactive runs.

Tests: init.test.ts mocks the prompts, so its beforeEach now gives init a terminal. It also sets CI=true, so Git and AGENTS.md setup keep skipping their prompts as they do in CI.

Checked:

  • init.test.ts (3 new tests), cli-help.test.ts, and the create-void tests
  • typecheck for void and create-void
  • the built CLI without a terminal: it stops when a flag is missing and runs to the end with all four

14 tests in init.test.ts fail locally on main too (vite-plus resolves, so the install command differs). This PR adds no new failures.

@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 4a7595d into voidzero-dev:main Oct 20, 2026
2 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.

Allow npm create void and void init to run without prompts

2 participants