Skip to content

fix(cli): make the CLI work on Windows - #295

Merged
thejackshelton merged 4 commits into
build/v2from
fix/windows-cli
Aug 25, 2026
Merged

fix(cli): make the CLI work on Windows#295
thejackshelton merged 4 commits into
build/v2from
fix/windows-cli

Conversation

@thejackshelton

Copy link
Copy Markdown
Member

Fixes #294.

The full-matrix run behind that issue showed all 9 windows-latest CLI cells failing. Diagnosis against the actual job logs found only two fatal bugs (the other documented symptoms — the pnpm .EXE bin warning, git init/add messages, and integration-install messages — all occur inside passing tests):

1. astro add dies under yarn on Windows (killed all 3 yarn cells)

The CLI ran astro add @qwik.dev/astro via panam's pm.x(), which maps to yarn exec astro … for yarn — and yarn v1's exec on Windows can't resolve locally installed bins (it only looks for the extension-less sh wrapper, never astro.cmd). The failure then escalated to a process.exit(1) panic that killed the in-process test runner mid-suite.

Fix: new execLocalBin() helper routes yarn through yarn run astro … (which resolves local .bin cross-platform); every other package manager keeps the exact pm.x(npmSpec(...)) path, deno npm: prefix included. Applied at all six call sites.

Hardening in the same path: the panic message now surfaces the subprocess stderr/stdout (CI logs used to read literally failed: .); the git commit call probes git var GIT_COMMITTER_IDENT and supplies a fallback -c identity only when git has none (bare CI runners), never overriding a configured user; and the git error branch no longer reports "failed to initialize" when it was adding changes.

2. Two Windows path bugs in the test suite (failed all 6 npm/pnpm cells: "141 passed, 2 failed")

  • tests/jsx-strategy.spec.ts asserted include(outPath, "src/components/qwik") against backslash paths — now separator-normalized.
  • tests/smoke-pack.spec.ts hardcoded /tmp/... (drive-relative on Windows) and await import(join(...)) (invalid ESM specifier for Windows absolute paths) — now join(tmpdir(), ...) and pathToFileURL(...).href, plus one startsWith("/")isAbsolute() sweep.

No test was skipped, gated, or weakened.

Proof

This branch restores windows-latest to the CLI matrix, so this PR's own CLI run executes all 27 cells. The combined local suite passes 143/143 on macOS under node, and the same suite already runs green on deno and bun cells on ubuntu/macos on build/v2.

🤖 Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 84a296c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 25, 2026

Copy link
Copy Markdown

Deploying astro with  Cloudflare Pages  Cloudflare Pages

Latest commit: 84a296c
Status: ✅  Deploy successful!
Preview URL: https://9f1e2a2c.astro-e3t.pages.dev
Branch Preview URL: https://fix-windows-cli.astro-e3t.pages.dev

View logs

@pkg-pr-new

pkg-pr-new Bot commented Aug 25, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@qwik.dev/create-astro@295
npm i https://pkg.pr.new/@qwik.dev/astro@295

commit: 84a296c

@thejackshelton
thejackshelton merged commit 04ce10a into build/v2 Aug 25, 2026
33 checks passed
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.

CLI is broken on Windows across all package managers

1 participant