fix(cli): describe what e2e init changes in existing files

Merged
SA
18d ago
+26-2

What and why

  • e2e init --help said it scaffolds "without touching existing files", but a rerun adds a missing e2e dev dependency and test:e2e script to package.json, appends missing .gitignore entries, and creates a missing example test. The help now says the config and test files stay as they are, and package.json and .gitignore get only what they lack (packages/e2e/src/cli/index.ts:465).
  • The "Re-running init" reference said "no packages are added" for an existing config, which read as covering e2e itself. It now separates the engine and gateway packages a kept config skips from the dependency, script, and ignore entries init still adds (docs/reference/cli.mdx).
  • Text only, plus a test for the re-run behavior the text now describes. init behaves the same.

Issue

Fixes #1368

Verified

Ran it locally: yes

  • Built CLI (packages/e2e/dist/cli/bin.js) on the issue's fixture, a directory with {"name":"example-project","private":true,"type":"module"} as package.json and export default { targets: [] }; as e2e.config.js. Ran e2e init --help, then E2E_TELEMETRY_DISABLED=1 e2e init --yes --gateway none --skills none --mcp none. Main is the same build with index.ts from 0d3e403c, the only code file this PR changes.
mainthis branch
Scaffold a project without touching existing files: an ESM package.json, ...Scaffold a project: an ESM package.json, ... An existing config and test files stay as they are; an existing package.json gets only the missing dependencies and scripts, and .gitignore only the missing entries.

Both builds print the same run, which is what the new text describes:

▲  Exists, not touching: e2e.config.js
●  Add dev dependencies: e2e@^0.21.3
●  Add scripts: test:e2e (e2e run)
◆  Updated package.json
◆  Created tests/example.e2e.js
◆  Updated .gitignore (10 entries)

e2e.config.js hashes the same before and after on both.

  • Rerun with an existing tests/example.e2e.js and "e2e": "1.2.3" in devDependencies: prints Exists, not touching: tests/example.e2e.js, keeps the file and the 1.2.3 pin, and adds only the script.
  • New unit test in tests/unit/cli-init.test.ts pins that re-run: an existing config plus "e2e": "1.2.3" in package.json gets only the test:e2e script, no engine or gateway packages, and the pin stays. It fails if addDependencies overwrites existing entries or an existing config picks engine packages.

Checklist

  • Changeset added (pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.
  • Breaking change: title carries !, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).
  • Docs updated in the same PR: the docs/**/*.mdx page for the behavior, and skills/e2e/ if the skill describes it.
  • Contract change: emitted .d.ts reviewed, tests/types/sdk-types.ts updated; wire change edits the schema and both fixtures.
  • Engine contract change (e2e/engine): changesets for e2e, @e2e-dev/web, and @e2e-dev/mobile.

🤖 Generated with Claude Code