Skip to content

feat(install): stage ripgrep into CoDev Code's cache during setup - #230

Merged
quickbeard merged 1 commit into
mainfrom
rg-cache-install
Jul 31, 2026
Merged

feat(install): stage ripgrep into CoDev Code's cache during setup#230
quickbeard merged 1 commit into
mainfrom
rg-cache-install

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

Summary

CoDev Code needs a ripgrep binary for file search: the @ mention index on Windows (where its bundled fff indexer is disabled by default), plus the Grep/Glob tools on every platform. When rg is neither on PATH nor in its cache dir, the agent downloads one from github.com/BurntSushi/ripgrep on first use — which fails on corporate networks that block GitHub, leaving file search silently empty (see codev-code PR #146 for the full failure-mode analysis).

Both codevhub install and codevhub config now stage the binary proactively, from our own domain, so the agent never needs to reach GitHub.

Changes

  • src/lib/ripgrep.ts (new) — detects process.platform/process.arch, downloads the matching official ripgrep 15.1.0 executable from the landing page's downloads dir, and installs it at <xdg cache>/codev/bin/rg[.exe] — the exact location CoDev Code checks before attempting its own GitHub download. Details that matter:
    • An existing cached rg is never overwritten (status: "present").
    • Write-then-rename staging: CoDev Code's cache check is bare file existence, so a partial file left by a crash would permanently satisfy it and brick the agent's search instead of helping it.
    • Download bounded by a 30s abort signal so a blackholing proxy can't hang the finalize step.
    • Unsupported platform/arch pairs are a clean no-op.
  • src/lib/const.ts — new CODE_DOWNLOADS_URL (landing page's /codev/docs/code/downloads).
  • src/SetupApp.tsx — the finalize phase (shared by install and config modes, runs only after the user has clicked through every choice) stages ripgrep in parallel with CodeGraph setup when CoDev Code is among the selected tools. Best-effort: failure logs, surfaces a yellow ▲ row with the manual remedy, and never blocks completion — the agent still tries PATH and its own download at runtime.
  • Tests — new tests/lib/ripgrep.test.ts (cache path resolution, URL shape, happy path incl. exec bit and no leftover .partial, skip-when-present, HTTP-error and empty-body rejection). InstallApp/ConfigApp suites mock installRipgrep in beforeEach alongside the existing setupCodegraph mock so full-flow tests stay hermetic.

Dependencies

Requires quickbeard/codev-landing-page#64 (hosts the binaries) to be merged and deployed first — until then the staging fails soft with the warning row.

Test plan

  • pnpm exec tsc --noEmit clean
  • pnpm test: 73 files, 1299 pass / 2 skipped
  • pnpm exec biome check src tests clean
  • Manual: codevhub install on a machine without ~/.cache/codev/bin/rg, verify the file appears with the exec bit and @ search works in CoDev Code without touching GitHub

🤖 Generated with Claude Code

CoDev Code needs a ripgrep binary for file search (the @ mention index on
Windows, where its bundled fff indexer is disabled, plus the Grep/Glob
tools everywhere). When rg is neither on PATH nor cached it downloads one
from GitHub on first use — which fails on corporate networks that block
GitHub, leaving file search silently empty.

Both `codevhub install` and `codevhub config` now stage the official
ripgrep 15.1.0 binary for the current platform/arch from the landing
page's downloads dir into <xdg cache>/codev/bin/rg[.exe] — the location
CoDev Code checks before attempting its own download. Runs during the
finalize phase, best-effort: an existing cached rg is never overwritten,
failure logs and surfaces a yellow warning row with the manual fix, and
the write is staged-then-renamed so a crash can't leave a partial file
that CoDev Code's bare existence check would trust forever.

Companion PR: codev-landing-page#64 hosts the binaries.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@quickbeard
quickbeard merged commit 2e73603 into main Jul 31, 2026
4 checks passed
@quickbeard
quickbeard deleted the rg-cache-install branch July 31, 2026 15:31
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