Skip to content

fix(init): skip installed deps, isolate install failures, pre-select prompt defaults#14

Merged
robdmoore merged 1 commit into
mainfrom
fix/init-dep-install-and-prompt-defaults
Jul 11, 2026
Merged

fix(init): skip installed deps, isolate install failures, pre-select prompt defaults#14
robdmoore merged 1 commit into
mainfrom
fix/init-dep-install-and-prompt-defaults

Conversation

@robdmoore

Copy link
Copy Markdown
Member

What & why

verifyx init had three real-world failure modes reported in practice. This makes it robust to all three.

1. Dependency installs conflicted or bumped existing versions

The install was a single atomic npm install --save-dev <all deps>. One peer-dependency conflict (e.g. oxlint + oxlint-tsgolint) failed the whole batch so nothing installed, and re-running could bump an already-present typescript.

  • New src/scaffold/installDeps.ts skips any dep already declared in package.json (deps/dev/peer/optional) or present in node_modules — an existing typescript/oxlint is left untouched (no version bump), and known peer conflicts are sidestepped when the tool is already there.
  • Missing deps install in one fast batch; on failure it falls back to per-package installs to isolate the culprit(s), installs the rest, and reports exactly what to install manually at the end instead of aborting.

2. A failing install appeared to prevent the .claude files

Scaffolding was always written before the install, but its confirmation printed after, so a wall of npm errors (or a Ctrl-C on a hanging install) hid it. The scaffold report now prints before the install is attempted — the .claude/CLAUDE.md output can no longer be hidden or blocked by the install.

3. Interactive prompts silently dropped selections

enquirer's multiselect ignores each choice's enabled for the submitted result — it paints a but a plain Enter returns []. So selecting the pre-checked Claude target (and the recommended checks) and hitting Enter wrote nothing. Fixed by passing the enabled names as initial, which actually pre-selects them.

Testing

  • src/scaffold/installDeps.test.ts — happy-path batch, skip-declared, skip-node_modules, all-present no-op, and batch-fail isolation.
  • src/commands/registerInit.test.tspreSelected returns the enabled choice names.
  • Manually verified end-to-end in scratch projects (.claude/CLAUDE.md written up-front) and confirmed the enquirer initial behaviour against the exact enquirer.prompt({...}) call shape.
  • verifyx all (lint, format, types, complexity, tests) green.

Note: an enabled-alone-returns-[] integration test against live enquirer was intentionally dropped — it's flaky under vitest's headless (non-TTY) environment where initial is applied async during render. The interactive path only ever runs with a TTY (the non-TTY path skips enquirer entirely), so this is a harness artifact, not a coverage gap.

🤖 Generated with Claude Code

…prompt defaults

Make `verifyx init` robust to real-world install and prompt issues:

- Skip devDeps already declared in package.json (deps/dev/peer/optional) or
  present in node_modules, so an existing typescript/oxlint is never
  re-installed or version-bumped and known peer conflicts (e.g.
  oxlint/oxlint-tsgolint) are sidestepped when the tool is already present.
- Install missing deps in one batch; on failure fall back to per-package
  installs to isolate the culprit(s), install the rest, and report exactly
  what to install manually at the end instead of aborting init.
- Report the scaffold (scripts + agent files) before the install so a failing
  install can no longer hide or prevent the .claude/CLAUDE.md output.
- Fix the interactive prompts: enquirer multiselect ignores each choice's
  `enabled` for the submitted result (a plain enter returns []), so agent
  files and recommended checks were silently dropped. Pass the enabled names
  as `initial` to actually pre-select them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@robdmoore robdmoore marked this pull request as ready for review July 11, 2026 05:02
@robdmoore robdmoore merged commit 7c5f7da into main Jul 11, 2026
1 check passed
@robdmoore robdmoore deleted the fix/init-dep-install-and-prompt-defaults branch July 11, 2026 05:04
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.

1 participant