Repository navigation
feat: bundle ripgrep into the Windows platform packages - #309
Merged
Merged
Conversation
quickbeard
force-pushed
the
bundle-ripgrep-windows
branch
2 times, most recently
from
August 24, 2026 02:39
86ab1a8 to
07d61b0
Compare
On Windows fff is disabled, so file search and the @ mention popup depend entirely on ripgrep — and when rg isn't already on the machine, the agent's runtime fallback downloads it from GitHub, exactly the host corporate networks block. A bare `npm i -g codev-code` therefore landed with silently empty file search. (codevhub install already papers over this by staging rg into the agent's cache; direct npm installs had nothing.) - build.ts stages ripgrep into each win32 platform package's bin/rg.exe under its own RG_VERSION pin: "latest" (the default) resolves the newest GitHub release per build via the releases API, an exact version pins its release tag. Asset zips are extracted in-memory with @zip.js/zip.js so builds work on any host platform, and magic-byte-checked against proxy block pages; x64/baseline share one download. Independent of binary.ts's pinned VERSION, which governs only the runtime download fallback. - postinstall.mjs best-effort copies the bundled bin/rg.exe next to the codev binary on both resolution paths; it can never fail the install. - RipgrepBinary.resolve (win32 only) checks for rg.exe beside process.execPath after PATH and before the cache and the network. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
quickbeard
force-pushed
the
bundle-ripgrep-windows
branch
from
August 24, 2026 02:43
07d61b0 to
6c8ddbb
Compare
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.
Why
On Windows fff is disabled, so file search and the
@mention popup depend entirely on ripgrep. Whenrgisn't already on the machine, the agent's runtime fallback downloads it from GitHub — exactly the host corporate networks block — so a barenpm i -g codev-codelanded with silently empty file search.codevhub installalready stages rg into the agent's cache, but direct npm installs had nothing.What
script/build.ts— each win32 target now stages ripgrep atbin/rg.exein its platform package, under a build-sideRG_VERSIONpin:"latest"(the default) resolves the newest GitHub release per build via the releases API; an exact version (e.g."15.1.0") pins its release tag. The asset zip is extracted in-memory with@zip.js/zip.js(nounzip/powershell host dependency, so local builds work from macOS or Windows) and magic-byte-checked so a proxy block page (200 + HTML) can't be packed as a binary. One release lookup per build; x64 and x64-baseline share one download per arch. This pin is independent ofbinary.ts'sVERSION, which governs only the runtime download fallback (the CoDev mirror hosts just that version and is not used at build time).script/postinstall.mjs— best-effortcopyRipgrepputs the bundledrg.exenext to the codev binary on both resolution paths (in the temp npm-install path before its cleanup deletes the package). It can never fail the install.packages/core/src/ripgrep/binary.ts— on win32, resolution checks forrg.exebesideprocess.execPath(bun standalone executables report their own location) after PATH and before the cache and the network, so no download is needed at all.Non-Windows platforms are unchanged: nothing is bundled there and resolution is untouched (
rgon PATH still wins everywhere). Package cost: ~2 MB gzipped on ~55 MB tarballs, win32 only. The GitHub-release win32 zips (built from the samebin/dirs) gainrg.exetoo.Testing
bun typecheckclean inpackages/coreandpackages/opencode;node --checkon postinstall.mjs.bun test test/ripgrep-binary.test.ts test/ripgrep.test.tsinpackages/core: 5 pass.latest→ 15.2.0,15.1.0→ 15.1.0, each resolving both win32 arch assets; the download+zip.js extraction path verified end-to-end (arm64 → 3,859,456 bytes, x64 → 4,218,880 bytes, valid MZ executables).item.os === "win32"); checkdist/opencode-windows-*/bin/rg.exeexists before publishing.🤖 Generated with Claude Code