Repository navigation
fix(lib): default to the bundled binary so createBeeClient() works on Windows - #30
Open
1aifanatic wants to merge 1 commit into
Open
1aifanatic wants to merge 1 commit into
1aifanatic wants to merge 1 commit into
Conversation
… Windows createBeeClient() defaulted to command "bee". On Windows that only resolves to npm's bee.cmd shim, which child_process.spawn cannot run without a shell, so createBeeClient() with no options fails with "spawn bee ENOENT" even though the package ships bee.exe. Without a global install it fails on every platform. When no command is given, the runner now uses the same lookup as bin/bee.js: BEE_CLI_BINARY, then the platform binary shipped next to the library (dist/lib -> dist/platforms/<os>-<arch>/bee[.exe]), and only then "bee" on PATH. An explicit command still wins. Claude-Session: https://claude.ai/code/session_01Lf8fMvJ11NuujSbk1HaBq5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
createBeeClient()(andcreateBeeCliRunner()) default tocommand: "bee". With the library installed from npm:beeonPATHis npm'sbee.cmdshim, andchild_process.spawncan't run.cmdfiles without a shell. SocreateBeeClient()with no options fails even though the package already shipsdist/platforms/windows-x64/bee.exe.beeisn't onPATHat all, so the README example (const bee = createBeeClient();) fails until the caller passescommandby hand.Reproduced on Windows 11 with
@beeai/cli0.9.0 and Node 25:Change
When no
commandis passed, the runner now resolves the binary the same waybin/bee.jsdoes:BEE_CLI_BINARY, if set;dist/lib→dist/platforms/<os>-<arch>/bee[.exe]);beeonPATH, as before.An explicit
commandstill wins, so existing callers and the integration tests (which passcommand) are unaffected. The README's library section describes the new default.Checks
bun install,bun run typecheckandbun run buildpass.bun run build:lib, then the snippet above against the builtdist/lib/index.js. With the binary in place: exit 0. Without it: falls back tospawn beeexactly as today.Found while building a Bee-powered app on Windows for the Amazon Developer Hackathon.