Skip to content

fix(cli): install dependencies in the generated verification workflow - #297

Closed
FredApps wants to merge 1 commit into
DiffCI:mainfrom
FredApps:fix/cli-verification-workflow-install
Closed

FredApps wants to merge 1 commit into
DiffCI:mainfrom
FredApps:fix/cli-verification-workflow-install

Conversation

@FredApps

Copy link
Copy Markdown
Contributor

Fixes #296

init --verification-workflow now adds an "Install dependencies" step before "Verify changed code". The step uses the repository's package manager, from detectPackageManager in install.ts:

  • npm: npm ci, or npm install without a lockfile.
  • pnpm: corepack enable and pnpm install --frozen-lockfile.
  • yarn: corepack enable and yarn install --frozen-lockfile.

When there is no package.json, or the manager is Bun or cannot be detected (for example, conflicting lockfiles), the workflow gets a comment where the step goes: # Install the repository's dependencies here: verify runs its tests.. diffciVerificationWorkflow(version) without install commands produces that comment, so existing callers keep working.

Validation:

Unsupported: Bun (no install command emitted), Go/Python/Maven dependency setup, and workflows already written by an earlier init. They are not rewritten.

init --verification-workflow wrote a blocking workflow that checks out
the repository, sets up Node and runs diffci verify, which runs the
repository's tests. Nothing installed the dependencies first, so in a
fresh checkout every selected or full test command failed (for a
Vitest project: npx canceled due to missing packages) and the check
was red on every push and pull request.

The workflow now installs dependencies before verify, with the
repository's package manager: npm ci (npm install without a lockfile),
or corepack enable and pnpm/yarn install --frozen-lockfile. When the
manager is unknown, or is Bun, a comment marks where to add it.

Signed-off-by: FredApps <[email protected]>
@FredApps
FredApps marked this pull request as ready for review November 18, 2026 00:55
adityankale190895 pushed a commit that referenced this pull request Nov 18, 2026
…#297)

verify runs the repository's tests, which a fresh checkout cannot run
before its dependencies are installed. The generated workflow now
installs them with the detected package manager: a frozen install only
when the matching lockfile exists, and --immutable on Yarn 2+. Fixes #296.

Signed-off-by: FredApps <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@adityankale190895

Copy link
Copy Markdown
Member

Merged to main as 92f4dff (squashed, authorship kept). One change on top: a frozen install is used only when the matching lockfile exists. pnpm and Yarn 2+ install frozen by default in CI, so without a lockfile the workflow now uses pnpm install --no-frozen-lockfile / yarn install --no-immutable. Yarn 2+ (.yarnrc.yml or a non-1.x packageManager) uses --immutable, and Yarn 1 keeps --frozen-lockfile. The test cases cover each. Thanks!

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.

init --verification-workflow: the generated workflow never installs dependencies, so verify cannot run the tests

2 participants