Skip to content

build(cli): port postbuild hook to TypeScript for Windows - #1433

Merged
Chase J (chajac) merged 2 commits into
mainfrom
chajac/windows-build-failure
Aug 3, 2026
Merged

build(cli): port postbuild hook to TypeScript for Windows#1433
Chase J (chajac) merged 2 commits into
mainfrom
chajac/windows-build-failure

Conversation

@chajac

Copy link
Copy Markdown
Contributor

Note

PR body AI drafted & edited as needed

Overview of Changes

The Windows release job fails at each release after v1.0.1. The log shows this error:

$ ./scripts/postbuild.sh
bun: command not found: ./scripts/postbuild.sh

On Linux and macOS, bun runs package scripts in a system shell. The system shell can start .sh files. On Windows, bun runs package scripts in Bun Shell. Bun Shell cannot start .sh files. The postbuild hook is a .sh file. The hook fails, and the build stops.

Changes:

  • scripts/postbuild.ts replaces scripts/postbuild.sh. The new script does the same two steps. It adds the shebang line to dist/cli.js. It sets the executable bit. It uses only node:fs, so it runs on all platforms.
  • ci.yml: the windows-smoke job now runs bun run build, not bun run build:bundle. The postbuild hook now runs on a Windows runner in CI. This prevents this failure in the future.

This PR has no changeset. The published package does not change. See the proof below.

Testing

bun run test        # 1277 pass
bun run typecheck
bun run lint
bun run format:check
bun run knip
  • Proof of equal output: we ran the old script and the new script on the same input file. The two outputs are the same (SHA-256 293e85aa…). The two file modes are the same (rwxr-xr-x). The Linux and macOS binaries do not change.

Checklist

  • Changes follow the code style of this project
  • Self-review completed
  • Tests added/updated (the windows-smoke CI job now covers the postbuild hook)
  • No breaking changes

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 220d145e-f50c-42a9-8f3a-c24512b0cc35

📥 Commits

Reviewing files that changed from the base of the PR and between b41d65c and 9406d20.

📒 Files selected for processing (1)
  • scripts/postbuild.ts

Walkthrough

The postbuild step now uses a Bun-executable TypeScript script instead of a shell script. The script prepends a Node.js shebang to dist/cli.js and enables executable permission bits while preserving existing mode bits. The Windows smoke job now runs the full build command, including the postbuild hook.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • qawolf/cli#1408: Both changes update the Windows CI smoke build command.
  • qawolf/cli#1412: Both changes modify Windows smoke behavior in the CI workflow.

Suggested reviewers: smonn

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commits, uses an allowed type and scope, stays under 72 characters, and clearly describes the TypeScript migration.
Description check ✅ Passed The description includes the required overview, testing details, and completed checklist, with clear rationale and verification evidence.
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 chajac/windows-build-failure

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/postbuild.ts`:
- Around line 11-15: Update the postbuild logic around the bundle read and write
operations to detect whether the existing bundle already begins with the Node
hashbang before prepending it. Only add the hashbang when absent, while
preserving the current output for bundles without one.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5472833c-8681-4c3f-8d1c-ec9bfa13f01a

📥 Commits

Reviewing files that changed from the base of the PR and between 54dab24 and b41d65c.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • package.json
  • scripts/postbuild.sh
  • scripts/postbuild.ts
💤 Files with no reviewable changes (1)
  • scripts/postbuild.sh

Comment thread scripts/postbuild.ts Outdated
@chajac
Chase J (chajac) merged commit a2068ca into main Aug 3, 2026
7 checks passed
@chajac
Chase J (chajac) deleted the chajac/windows-build-failure branch August 3, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants