feat(cli): flag per e2e init wizard question
Merged
OK
12d ago+417+417+012345678901234567890123456789-97-97-01234567890123456789
Closes #1114.
e2e init takes a flag for every wizard question, so a host that sets up e2e for its users can pick each answer without a TTY.
npx e2e init --yes \
--engine web \
--gateway openrouter \
--skills .agents/skills \
--mcp .mcp.json \
--install
| Flag | Values | Prompt it answers |
|---|---|---|
--engine <id> | web, mobile, none | Which engine? |
--gateway <id> | vercel, openrouter, openai-compatible, chatgpt, copilot, opencode-console, grok, none | Which model gateway? |
--endpoint <url> | HTTPS, or HTTP on loopback | Base URL of the OpenAI-compatible API |
--skills <dirs> | .agents/skills, .claude/skills, comma-separated or repeated, or none | Install the e2e skill? |
--mcp <files> | .mcp.json, .cursor/mcp.json, comma-separated or repeated, or none | Register the MCP server? |
--install / --no-install | Install dependencies? |
- Values are the ids the wizard already uses (
GATEWAYS,getEnginePresets(),SKILL_LOCATIONS,MCP_LOCATIONS), so a new preset gets a flag value for free. - The flag is
--gateway, not the--providerthe issue proposed. The code, the prompt, and telemetry all say gateway, ande2e login [provider]already uses provider ids (openai,github-copilot) that differ from these. - A flag skips its prompt with or without
--yes. Without--yes, the prompts for omitted flags and the "Apply these changes?" confirmation still appear. An omitted flag under--yeskeeps today's default, soinit --yesoutput is byte-identical to main. - Bad values exit 2 through commander before
initruns, so nothing is written.--endpointwithout--gateway openai-compatibleis also rejected. --skills/--mcpoverride the locations found by an earlier run (chooseLocations,packages/e2e/src/cli/init.ts).--engine/--gateway/--endpointwith an existing config log a warning naming the flags that were ignored.- Telemetry:
usedFlagsstill sends flag names only, never values. It used to report both--installand--no-installwhen either was given, because the pair shares one attribute; it now reports only the one that was passed.--endpointnever leaves the machine. --yeshelp said "Playwright, AI on, no installation". It now lists the real defaults: web, vercel, every skill and MCP location, no installation.validateEndpointmoved toinit/gateways.tsso the CLI parser and the prompt share it.- Docs:
reference/cli.mdxflag table,skills/e2e/references/setup.md, andtelemetry.mdx(which was missingopencode-console). The Detox and Maestro migration prompts now useinit --yes --engine mobileinstead of swapping@e2e-dev/webby hand. Those prompts runnpx e2e init, so the new flag needs a release to work.
Verified
Ran it locally: yes
- Built
packages/e2eon main (/tmp/e2e-main) and on this branch, then raninit --yesfrom each in an empty/tmpdir. Stdout is identical. The only file that differs is the skill'sreferences/setup.md, which this PR edits.
$ node dist/cli/bin.js init --yes --engine web --gateway openrouter --skills .agents/skills --mcp .mcp.json --install
● Add dev dependencies: e2e@^0.20.0, @e2e-dev/web@^0.14.0, ai@^7.0.0, zod@^4.1.8, @openrouter/ai-sdk-provider@^3.0.0
● Add scripts: test:e2e (e2e run)
◆ Created package.json
◆ Created e2e.config.ts
◆ Created tests/example.e2e.ts
◆ Created .agents/skills/e2e/ (9 files)
◆ Created .mcp.json (e2e mcp server)
◆ Updated .gitignore (10 entries)
added 55 packages, and audited 56 packages in 4s
└ Next: APP_URL=http://localhost:3000 npm run test:e2e
$ ls -A
.agents .gitignore .mcp.json e2e.config.ts node_modules package-lock.json package.json tests
$ npx e2e list
tests/example.e2e.ts › app opens [web]
No .claude/ and no .cursor/. npm install ran, and the installed CLI lists the example test.
$ init --yes --engine none --gateway none --skills none --mcp none
● Skipped the agent skill; agents can still print it with npm exec -- e2e guide
● Skipped the MCP server; register it later with: claude mcp add e2e -- npx e2e mcp
$ ls -A
.gitignore e2e.config.ts package.json tests
$ init --yes --engine playwright
error: option '--engine <id>' argument 'playwright' is invalid. Allowed choices are web, mobile, none. (exit 2)
$ init --yes --mcp claude
error: option '--mcp <files>' argument 'claude' is invalid. unknown MCP config file "claude"; expected .mcp.json, .cursor/mcp.json, none (exit 2)
$ init --yes --endpoint https://llm.example/v1
error: --endpoint is the base URL for --gateway openai-compatible; pass that gateway with it (exit 2)
None of the rejected runs wrote anything (the directory stayed empty). I also ran init --engine web --gateway none --skills none --mcp .mcp.json --no-install interactively in a pty. The only prompt was "Apply these changes?", and it wrote .mcp.json with no skill directory.