fix(init): skip installed deps, isolate install failures, pre-select prompt defaults#14
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
verifyx inithad 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-presenttypescript.src/scaffold/installDeps.tsskips any dep already declared inpackage.json(deps/dev/peer/optional) or present innode_modules— an existingtypescript/oxlintis left untouched (no version bump), and known peer conflicts are sidestepped when the tool is already there.2. A failing install appeared to prevent the
.claudefilesScaffolding 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.mdoutput can no longer be hidden or blocked by the install.3. Interactive prompts silently dropped selections
enquirer's
multiselectignores each choice'senabledfor 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 asinitial, 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.ts—preSelectedreturns the enabled choice names..claude/CLAUDE.mdwritten up-front) and confirmed the enquirerinitialbehaviour against the exactenquirer.prompt({...})call shape.verifyx all(lint, format, types, complexity, tests) green.🤖 Generated with Claude Code