Skip to content

fix(build): externalize native clipboard modules#8

Merged
assagman merged 1 commit intomainfrom
fix/native-module-bundling
Jan 25, 2026
Merged

fix(build): externalize native clipboard modules#8
assagman merged 1 commit intomainfrom
fix/native-module-bundling

Conversation

@assagman
Copy link
Owner

Problem

When loading the pi extension, users get:

Failed to load extension: Cannot require module @mariozechner/clipboard-darwin-arm64

Root Cause

bun build cannot inline native .node binaries. Without --external flag, it replaces require() with throw Error(), causing immediate crash on extension load.

Fix

Add --external '@mariozechner/clipboard-*' to the build command to preserve native module requires at runtime.

Dependency Chain

agentsbox
  └── @mariozechner/pi-coding-agent
        └── @mariozechner/clipboard
              └── @mariozechner/clipboard-darwin-arm64 (native .node)

Native .node binaries from @mariozechner/clipboard-* cannot be bundled.
Without --external flag, bun replaces require() with throw Error(),
causing pi extension to crash on load.

Signed-off-by: assagman <ahmetsercansagman@gmail.com>
Copilot AI review requested due to automatic review settings January 25, 2026 17:20
@gemini-code-assist
Copy link

Summary of Changes

Hello @assagman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request implements a crucial fix for a build configuration problem that was preventing the pi extension from loading correctly. By adjusting the bun build command to properly externalize native clipboard modules, it ensures that the application can correctly resolve and utilize these dependencies at runtime, thereby restoring the functionality of the pi extension.

Highlights

  • Build Fix: Resolved a critical issue where the pi extension failed to load due to bun build incorrectly handling native .node binaries.
  • Module Externalization: Modified the bun build command to explicitly externalize @mariozechner/clipboard-* modules, ensuring their require() calls are preserved at runtime.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@assagman assagman merged commit 1fa8819 into main Jan 25, 2026
5 checks passed
@assagman assagman deleted the fix/native-module-bundling branch January 25, 2026 17:20
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly addresses a build failure caused by bun build attempting to inline native .node binaries from the @mariozechner/clipboard dependency. The fix, which adds the --external flag for these modules, is appropriate and resolves the issue. For future maintainability, a suggestion to refactor the build command into a separate script has been included, as it aligns with the repository's guidelines for complex build steps.

@codecov
Copy link

codecov bot commented Jan 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions github-actions bot mentioned this pull request Jan 25, 2026
3 tasks
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08ee9d2580

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a critical build issue where native clipboard modules from the @mariozechner/pi-coding-agent dependency were being incorrectly bundled by bun build, causing runtime failures when loading the pi extension.

Changes:

  • Added --external '@mariozechner/clipboard-*' flag to the build command to preserve native module requires at runtime

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

assagman added a commit that referenced this pull request Jan 25, 2026
- Move build logic to scripts/build.ts and externalize native modules.
- Improve release and quick-merge documentation with robust polling and security best practices.
- Add jq to prerequisites and fix cleanup steps.

Signed-off-by: assagman <ahmetsercansagman@gmail.com>
assagman added a commit that referenced this pull request Jan 25, 2026
- Move build logic to scripts/build.ts and externalize native modules.
- Improve release and quick-merge documentation with robust polling and security best practices.
- Add jq to prerequisites and fix cleanup steps.

Signed-off-by: assagman <ahmetsercansagman@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