Skip to content

feat(release): publish Windows prebuilt artifacts#282

Merged
benvinegar merged 1 commit into
mainfrom
feat/windows-prebuilt-release
May 11, 2026
Merged

feat(release): publish Windows prebuilt artifacts#282
benvinegar merged 1 commit into
mainfrom
feat/windows-prebuilt-release

Conversation

@benvinegar
Copy link
Copy Markdown
Member

Summary

  • Add hunkdiff-windows-x64 to the prebuilt npm release build matrix.
  • Teach the npm launcher to resolve the Windows prebuilt package.
  • Make prebuilt artifact and install smoke scripts handle Windows paths, .exe outputs, and global npm prefix layout.
  • Add Windows coverage to the prebuilt npm CI matrix.

Testing

  • bun run format:check
  • bun run typecheck
  • bun test scripts/prebuilt-package-helpers.test.ts
  • bun run build:prebuilt:npm
  • bun run check:prebuilt-pack
  • bun run smoke:prebuilt-install
  • bun run lint

This PR description was generated by Pi using GPT-5

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 10, 2026

Greptile Summary

This PR adds Windows x64 to the prebuilt binary release pipeline: a new hunkdiff-windows-x64 matrix entry in the release workflow, the npm launcher updated to resolve the Windows package, and the smoke/build scripts extended to handle .exe suffixes, Windows PATH layout, and hunk.cmd wrappers.

  • prebuilt-package-helpers.ts correctly maps the internal "windows" OS to npm's "win32" and uses bin/hunk.exe in the published manifest; tests cover the new manifest shape and updated stable-sort order.
  • bin/hunk.cjs adds the Windows branch to hostCandidates() with hunk.exe as the binary name, matching the package spec.
  • smoke-prebuilt-install.ts replaces the old bash-based node path resolution with process.execPath, which resolves to the Bun binary — not Node.js — causing the sanitized PATH to miss node and include bun, breaking both the installed wrapper invocation and the bun-availability assertion on the smoke test.

Confidence Score: 3/5

The release workflow and launcher changes are correct, but the smoke test will fail on Windows CI and on any machine where Bun and Node.js are installed in different directories.

The launcher, package helpers, and release matrix changes are all correct and well-tested. The smoke test rewrite uses process.execPath (Bun) to derive what should be Node.js's directory, causing node to be absent from the sanitized PATH and bun to be unexpectedly present on it — two simultaneous failures that will surface on the new Windows CI job added in this same PR.

scripts/smoke-prebuilt-install.ts — the nodeDir derivation and its downstream effects on sanitizedPath and bunCheck.

Important Files Changed

Filename Overview
scripts/smoke-prebuilt-install.ts Replaces explicit node binary resolution with process.execPath (the Bun binary); this puts Bun's directory — not Node.js's — on the sanitized PATH, which can cause the npm-installed wrapper to fail to find node and break the smoke test on Windows CI.
bin/hunk.cjs Adds hunkdiff-windows-x64 package resolution and correctly sets the binary name to hunk.exe for the Windows platform branch.
scripts/prebuilt-package-helpers.ts Adds hunkdiff-windows-x64 to the platform matrix with correct binaryRelativePath (bin/hunk.exe) and maps the internal "windows" OS to npm's "win32" in the published manifest.
scripts/build-prebuilt-artifact.ts Switches to a two-candidate binary lookup (dist/hunk.exe then dist/hunk) with a clearer error message when neither is found; logic is correct.
scripts/prebuilt-package-helpers.test.ts Adds Windows-specific test cases for getPlatformPackageSpecForHost and buildPlatformPackageManifest; the stable-sort test is updated to include hunkdiff-windows-x64 in the expected output.
.github/workflows/release-prebuilt-npm.yml Adds hunkdiff-windows-x64 / windows-latest to the release build matrix; straightforward matrix addition.
.github/workflows/ci.yml Adds windows-latest to the prebuilt-install smoke-test CI matrix job.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["npm install -g hunkdiff"] --> B["hunk / hunk.cmd wrapper created"]
    B --> C["bin/hunk.cjs executed"]
    C --> D{"hostCandidates()"}
    D -->|darwin arm64| E["hunkdiff-darwin-arm64"]
    D -->|darwin x64| F["hunkdiff-darwin-x64"]
    D -->|linux arm64| G["hunkdiff-linux-arm64"]
    D -->|linux x64| H["hunkdiff-linux-x64"]
    D -->|windows x64 NEW| I["hunkdiff-windows-x64"]
    E & F & G & H --> J["bin/hunk"]
    I --> K["bin/hunk.exe"]
    J & K --> L["findInstalledBinary()"]
    L -->|found| M["spawnSync prebuilt binary"]
    L -->|not found| N["fallback: bun runtime or error"]
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
scripts/smoke-prebuilt-install.ts:76-77
**`nodeDir` points to Bun, not Node.js — two distinct failures on the smoke test**

`process.execPath` is the Bun binary (this is a `#!/usr/bin/env bun` script), so `nodeDir` becomes Bun's installation directory rather than Node.js's. On GitHub Actions (and most developer machines) Bun and Node.js live in different directories, so this has two consequences:

1. The npm-created `hunk.cmd` wrapper calls `node` relative to `PATH`. With node's directory absent from `sanitizedPath`, running `installedHunk` fails immediately because `node` cannot be found.
2. Bun's directory is now in `sanitizedPath`. The `bunCheck` below spawns `bun` under `commandEnv` — it will find Bun and exit 1, triggering `"bun unexpectedly available on the prebuilt install smoke-test PATH"`.

The cross-platform `commandDirectory` helper introduced in this same PR already handles Windows (`where node`) and Unix (`bash -lc "command -v node"`), so the fix is to use it here: `const nodeDir = commandDirectory("node");`.

Reviews (1): Last reviewed commit: "feat(release): publish Windows prebuilt ..." | Re-trigger Greptile

Comment thread scripts/smoke-prebuilt-install.ts Outdated
Comment on lines +76 to +77
const nodeDir = path.dirname(process.execPath);
const bashDir = commandDirectory("bash");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 nodeDir points to Bun, not Node.js — two distinct failures on the smoke test

process.execPath is the Bun binary (this is a #!/usr/bin/env bun script), so nodeDir becomes Bun's installation directory rather than Node.js's. On GitHub Actions (and most developer machines) Bun and Node.js live in different directories, so this has two consequences:

  1. The npm-created hunk.cmd wrapper calls node relative to PATH. With node's directory absent from sanitizedPath, running installedHunk fails immediately because node cannot be found.
  2. Bun's directory is now in sanitizedPath. The bunCheck below spawns bun under commandEnv — it will find Bun and exit 1, triggering "bun unexpectedly available on the prebuilt install smoke-test PATH".

The cross-platform commandDirectory helper introduced in this same PR already handles Windows (where node) and Unix (bash -lc "command -v node"), so the fix is to use it here: const nodeDir = commandDirectory("node");.

Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/smoke-prebuilt-install.ts
Line: 76-77

Comment:
**`nodeDir` points to Bun, not Node.js — two distinct failures on the smoke test**

`process.execPath` is the Bun binary (this is a `#!/usr/bin/env bun` script), so `nodeDir` becomes Bun's installation directory rather than Node.js's. On GitHub Actions (and most developer machines) Bun and Node.js live in different directories, so this has two consequences:

1. The npm-created `hunk.cmd` wrapper calls `node` relative to `PATH`. With node's directory absent from `sanitizedPath`, running `installedHunk` fails immediately because `node` cannot be found.
2. Bun's directory is now in `sanitizedPath`. The `bunCheck` below spawns `bun` under `commandEnv` — it will find Bun and exit 1, triggering `"bun unexpectedly available on the prebuilt install smoke-test PATH"`.

The cross-platform `commandDirectory` helper introduced in this same PR already handles Windows (`where node`) and Unix (`bash -lc "command -v node"`), so the fix is to use it here: `const nodeDir = commandDirectory("node");`.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in the latest push: the smoke test now resolves the real node path with the cross-platform command lookup and derives nodeDir from that path, so the sanitized PATH includes Node without accidentally including Bun. The release workflow dry-run passed afterward.

This comment was generated by Pi using GPT-5

@benvinegar benvinegar force-pushed the feat/windows-prebuilt-release branch from c3b5f4d to 18ad36a Compare May 10, 2026 23:54
@benvinegar benvinegar merged commit 0ba3108 into main May 11, 2026
13 checks passed
@benvinegar benvinegar deleted the feat/windows-prebuilt-release branch May 11, 2026 01:08
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