Skip to content

fix(cli): resolve Windows Alchemy executable shims - #280

Merged
AmanVarshney01 merged 2 commits into
mainfrom
codex/verify-windows-alchemy
Sep 10, 2026
Merged

fix(cli): resolve Windows Alchemy executable shims#280
AmanVarshney01 merged 2 commits into
mainfrom
codex/verify-windows-alchemy

Conversation

@AmanVarshney01

@AmanVarshney01 AmanVarshney01 commented Sep 8, 2026

Copy link
Copy Markdown
Member

Problem

Composer only looked for node_modules/.bin/alchemy. Windows package managers can install alchemy.exe or alchemy.cmd without that extensionless file, so Composer incorrectly reports DEPLOY.ALCHEMY_BIN_MISSING before launching anything.

Fix

Resolve the nearest installed Windows executable in order: alchemy.exe, alchemy.cmd, then the extensionless shim. Continue searching ancestors for hoisted installations; POSIX behavior is unchanged. No PATH/global fallback, application workaround, or dependency change. Update the deployment guide and core-concepts skill with the resolution contract.

Verification

  • Local CLI typecheck passed.
  • Local resolver/runner tests: 12 passed; 2 Windows-only regressions skipped on macOS.
  • Windows regressions cover cmd/exe-only installations and execution of a cmd shim with spaces and a literal ampersand in argv through the existing cross-spawn runner.
  • Native Windows CI passed, including both new regressions. All checks are green, including macOS, Linux, and deployment E2E jobs. No new workflow.

Related owning-repo fix

prisma/prisma-cli#250 fixes the consolidated CLI adapter that launches the resolved command. Its native Windows regression reproduced spawn EINVAL on npm.cmd before the fix.

Limits

This does not claim all Windows assembly or deployment failures share this cause, or enable local Windows dev support. Deployment verification ran through the existing CI E2E jobs; no manual production deployment was performed.

Regression intentionally fails on Windows until resolver supports installed cmd/exe shims. Existing POSIX resolver tests pass.

Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Essentials

Run ID: fd7737f0-9079-45c7-8eb6-cca48afa8903

📥 Commits

Reviewing files that changed from the base of the PR and between aa48cfb and 9f85af1.

📒 Files selected for processing (4)
  • docs/guides/deploying.md
  • packages/0-framework/3-tooling/cli/src/__tests__/run-alchemy.test.ts
  • packages/0-framework/3-tooling/cli/src/run-alchemy.ts
  • skills/prisma-composer-core-concepts/SKILL.md

Included review availability: 1 review is currently available. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.


Summary by CodeRabbit

  • New Features

    • Improved Alchemy executable discovery across local and hoisted dependency directories.
    • Added Windows support for resolving and running .cmd and .exe launchers, including arguments containing spaces and symbols.
    • Windows resolution now checks supported launcher types in a defined order.
  • Documentation

    • Updated build and core-concepts guides with executable resolution details for Windows and POSIX environments.
    • Clarified that local dependency installations can be used without a global Alchemy installation.

Walkthrough

The CLI now resolves alchemy.exe, alchemy.cmd, and alchemy on Windows while searching ancestor node_modules/.bin directories. Windows tests cover shim discovery and execution with arguments that contain spaces and symbols. Deployment documentation describes the lookup order and installation requirements.

Merge Risk: ⚪ Minimal · up to 9f85a

Composer now resolves local and hoisted Windows Alchemy executable shims in a documented order while retaining POSIX behavior. The supplied coverage indicates the intended Windows resolution and argument handling are ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: resolving Windows Alchemy executable shims in the CLI.
Description check ✅ Passed The description directly explains the Windows resolution problem, the implemented fix, documentation updates, verification, and scope limits.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (2 skipped: 2 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/verify-windows-alchemy
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch codex/verify-windows-alchemy

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Sep 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@prisma/composer@280
npm i https://pkg.pr.new/@prisma/composer-cli@280
npm i https://pkg.pr.new/@prisma/composer-prisma-cloud@280

commit: 9f85af1

Local resolver/runner tests and CLI typecheck pass. Windows execution is verified by the existing CI matrix, pending at commit time.

Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
@AmanVarshney01
AmanVarshney01 marked this pull request as ready for review September 10, 2026 07:48

@wmadden wmadden left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work 👍🏻

@AmanVarshney01
AmanVarshney01 merged commit eb42714 into main Sep 10, 2026
24 checks passed
@AmanVarshney01
AmanVarshney01 deleted the codex/verify-windows-alchemy branch September 10, 2026 09:48
AmanVarshney01 added a commit to prisma/prisma-cli that referenced this pull request Sep 10, 2026
…ter (#250)

## Problem
The consolidated CLI delegates Composer and other commands through its
own spawn adapter. That adapter used native node:child_process.spawn,
which cannot execute Windows .cmd shims directly.

## Reproduced
The first commit runs the real installed npm.cmd through the shipped
adapter. Existing Windows CI failed with spawn EINVAL (-4071), while 951
other tests passed:
https://github.com/prisma/prisma-cli/actions/runs/34236425789/job/102095202659.

## Fix
Use cross-spawn at the owning adapter. Preserve argv arrays, inherited
human stdio, structured diagnostic forwarding/backpressure, bounded
drain, exit status, and signal forwarding. No blanket shell:true and no
create-prisma workaround. Declare the runtime dependency in both
published package manifests. Document the execution contract.

## Verification
- Windows after fix: the same npm.cmd regression passes; all 61 CLI test
files pass, 952 tests passed and 10 platform skips:
https://github.com/prisma/prisma-cli/actions/runs/34237016724/job/102097241940.
- Linux CI passed:
https://github.com/prisma/prisma-cli/actions/runs/34237016724/job/102097242011.
- macOS locally: all 61 CLI test files passed (960 tests, 2 platform
skips).
- Repository typecheck and lint passed.
- No workflows added and no production deployment needed for the
command-launch reproduction.

## Scope
Fixes Windows delegated shim launch failures, not every
CLI.SPAWN_FAILED, auth error, build failure, or install failure.
Composer executable discovery is separate:
prisma/composer#280.

Ready for review. All CI checks passed, including the native Windows
regression.

---------

Signed-off-by: Aman Varshney <amanvarshney.work@gmail.com>
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.

2 participants