Skip to content

Commit f3c07e6

Browse files
committed
sdk: Bundle ripgrep binaries instead of importing from vscode
1 parent 9880f69 commit f3c07e6

File tree

18 files changed

+1023
-16
lines changed

18 files changed

+1023
-16
lines changed

β€Žbun.lockβ€Ž

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@
238238
"name": "@codebuff/sdk",
239239
"version": "0.2.3",
240240
"dependencies": {
241-
"@vscode/ripgrep": "1.15.14",
242241
"@vscode/tree-sitter-wasm": "0.1.4",
243242
"ai": "^5.0.0",
244243
"diff": "8.0.2",
@@ -250,6 +249,8 @@
250249
"@types/bun": "^1.2.11",
251250
"@types/diff": "8.0.0",
252251
"@types/node": "22",
252+
"adm-zip": "^0.5.12",
253+
"node-fetch": "^3.3.2",
253254
},
254255
},
255256
"web": {
@@ -1497,6 +1498,8 @@
14971498

14981499
"acorn-walk": ["[email protected]", "", { "dependencies": { "acorn": "^8.11.0" } }, "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g=="],
14991500

1501+
"adm-zip": ["[email protected]", "", {}, "sha512-TGw5yVi4saajsSEgz25grObGHEUaDrniwvA2qwSC060KfqGPdglhvPMA2lPIoxs3PQIItj2iag35fONcQqgUaQ=="],
1502+
15001503
"agent-base": ["[email protected]", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="],
15011504

15021505
"agentkeepalive": ["[email protected]", "", { "dependencies": { "humanize-ms": "^1.2.1" } }, "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ=="],
@@ -3005,7 +3008,7 @@
30053008

30063009
"node-domexception": ["[email protected]", "", {}, "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ=="],
30073010

3008-
"node-fetch": ["node-fetch@2.7.0", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="],
3011+
"node-fetch": ["node-fetch@3.3.2", "", { "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", "formdata-polyfill": "^4.0.10" } }, "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA=="],
30093012

30103013
"node-int64": ["[email protected]", "", {}, "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw=="],
30113014

@@ -3979,8 +3982,6 @@
39793982

39803983
"@codebuff/sdk/@types/diff": ["@types/[email protected]", "", { "dependencies": { "diff": "*" } }, "sha512-o7jqJM04gfaYrdCecCVMbZhNdG6T1MHg/oQoRFdERLV+4d+V7FijhiEAbFu0Usww84Yijk9yH58U4Jk4HbtzZw=="],
39813984

3982-
"@codebuff/sdk/@vscode/ripgrep": ["@vscode/[email protected]", "", { "dependencies": { "https-proxy-agent": "^7.0.2", "proxy-from-env": "^1.1.0", "yauzl": "^2.9.2" } }, "sha512-/G1UJPYlm+trBWQ6cMO3sv6b8D1+G16WaJH1/DSqw32JOVlzgZbLkDxRyzIpTpv30AcYGMkCf5tUqGlW6HbDWw=="],
3983-
39843985
"@codebuff/sdk/diff": ["[email protected]", "", {}, "sha512-sSuxWU5j5SR9QQji/o2qMvqRNYRDOcBTgsJ/DeCf4iSN4gW+gNMXM7wFIP+fdXZxoNiAnHUTGjCr+TSWXdRDKg=="],
39853986

39863987
"@codebuff/sdk/ws": ["[email protected]", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg=="],
@@ -4071,8 +4072,6 @@
40714072

40724073
"@mdx-js/esbuild/@mdx-js/mdx": ["@mdx-js/[email protected]", "", { "dependencies": { "@types/estree-jsx": "^1.0.0", "@types/mdx": "^2.0.0", "estree-util-build-jsx": "^2.0.0", "estree-util-is-identifier-name": "^2.0.0", "estree-util-to-js": "^1.1.0", "estree-walker": "^3.0.0", "hast-util-to-estree": "^2.0.0", "markdown-extensions": "^1.0.0", "periscopic": "^3.0.0", "remark-mdx": "^2.0.0", "remark-parse": "^10.0.0", "remark-rehype": "^10.0.0", "unified": "^10.0.0", "unist-util-position-from-estree": "^1.0.0", "unist-util-stringify-position": "^3.0.0", "unist-util-visit": "^4.0.0", "vfile": "^5.0.0" } }, "sha512-jLuwRlz8DQfQNiUCJR50Y09CGPq3fLtmtUQfVrj79E0JWu3dvsVcxVIcfhR5h0iXu+/z++zDrYeiJqifRynJkA=="],
40734074

4074-
"@mdx-js/esbuild/node-fetch": ["[email protected]", "", { "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", "formdata-polyfill": "^4.0.10" } }, "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA=="],
4075-
40764075
"@mdx-js/esbuild/vfile": ["[email protected]", "", { "dependencies": { "@types/unist": "^2.0.0", "is-buffer": "^2.0.0", "unist-util-stringify-position": "^3.0.0", "vfile-message": "^3.0.0" } }, "sha512-r7qlzkgErKjobAmyNIkkSpizsFPYiUPuJb5pNW1RB4JcYVZhs4lIbVqk8XPk033CV/1z8ss5pkax8SuhGpcG8g=="],
40774076

40784077
"@nx/devkit/ignore": ["[email protected]", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="],
@@ -4139,8 +4138,6 @@
41394138

41404139
"@shadcn/ui/commander": ["[email protected]", "", {}, "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug=="],
41414140

4142-
"@shadcn/ui/node-fetch": ["[email protected]", "", { "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", "formdata-polyfill": "^4.0.10" } }, "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA=="],
4143-
41444141
"@testing-library/dom/aria-query": ["[email protected]", "", { "dependencies": { "dequal": "^2.0.3" } }, "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A=="],
41454142

41464143
"@testing-library/dom/dom-accessibility-api": ["[email protected]", "", {}, "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg=="],
@@ -4195,8 +4192,6 @@
41954192

41964193
"aceternity-ui/https-proxy-agent": ["[email protected]", "", { "dependencies": { "agent-base": "^7.0.2", "debug": "4" } }, "sha512-ONsE3+yfZF2caH5+bJlcddtWqNI3Gvs5A38+ngvljxaBiRXRswym2c7yf8UAeFpRFKjFNHIFEHqR/OLAWJzyiA=="],
41974194

4198-
"aceternity-ui/node-fetch": ["[email protected]", "", { "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", "formdata-polyfill": "^4.0.10" } }, "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA=="],
4199-
42004195
"ai/@ai-sdk/provider-utils": ["@ai-sdk/[email protected]", "", { "dependencies": { "@ai-sdk/provider": "2.0.0", "@standard-schema/spec": "^1.0.0", "eventsource-parser": "^3.0.3", "zod-to-json-schema": "^3.24.1" }, "peerDependencies": { "zod": "^3.25.76 || ^4" } }, "sha512-BoQZtGcBxkeSH1zK+SRYNDtJPIPpacTeiMZqnG4Rv6xXjEwM0FH4MGs9c+PlhyEWmQCzjRM2HAotEydFhD4dYw=="],
42014196

42024197
"autoprefixer/picocolors": ["[email protected]", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
@@ -4309,6 +4304,8 @@
43094304

43104305
"gaxios/is-stream": ["[email protected]", "", {}, "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg=="],
43114306

4307+
"gaxios/node-fetch": ["[email protected]", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="],
4308+
43124309
"get-uri/data-uri-to-buffer": ["[email protected]", "", {}, "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw=="],
43134310

43144311
"glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="],
@@ -4483,6 +4480,8 @@
44834480

44844481
"openai/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-hY4YWZFLs3ku6D2Gqo3RchTd9VRCcrjqp/I0mmohYeUVA5Y8eCXKJEasHxLAJVZRJuQogfd1GiJ9lgogBgKeuQ=="],
44854482

4483+
"openai/node-fetch": ["[email protected]", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="],
4484+
44864485
"openid-client/object-hash": ["[email protected]", "", {}, "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw=="],
44874486

44884487
"ora/chalk": ["[email protected]", "", {}, "sha512-46QrSQFyVSEyYAgQ22hQ+zDa60YHA4fBstHmtSApj1Y5vKtG27fWowW03jCk5KcbXEWPZUIR894aARCA/G1kfQ=="],
@@ -4617,6 +4616,8 @@
46174616

46184617
"teeny-request/https-proxy-agent": ["[email protected]", "", { "dependencies": { "agent-base": "6", "debug": "4" } }, "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA=="],
46194618

4619+
"teeny-request/node-fetch": ["[email protected]", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="],
4620+
46204621
"terser/commander": ["[email protected]", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="],
46214622

46224623
"test-exclude/glob": ["[email protected]", "", { "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q=="],

β€Žsdk/package.jsonβ€Ž

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"license": "Apache-2.0",
77
"type": "module",
88
"main": "./dist/index.cjs",
9-
"module": "./dist/index.mjs",
109
"types": "./dist/index.d.ts",
1110
"exports": {
1211
".": {
@@ -25,14 +24,16 @@
2524
"scripts": {
2625
"build": "bun run scripts/build.ts",
2726
"build:types": "tsc -p tsconfig.build.json",
28-
"build:verify": "bun run build && bun run smoke-test:dist && bun run test:cjs && bun run test:esm",
27+
"build:verify": "bun run build && bun run smoke-test:dist && bun run test:cjs && bun run test:esm && bun run test:ripgrep",
2928
"smoke-test:dist": "bun run smoke-test-dist.ts",
3029
"test:cjs": "cd test/cjs-compatibility && npm install --silent && npm run test:all",
3130
"test:esm": "cd test/esm-compatibility && npm install --silent && npm run test:all",
31+
"test:ripgrep": "cd test/ripgrep-bundling && npm install --silent && npm run test:all",
3232
"clean": "rm -rf dist",
3333
"prepare-dist": "bun run scripts/publish.ts --dry-run",
3434
"publish-sdk": "bun run scripts/publish.ts --public",
3535
"publish-dry-run": "bun run build:verify && bun run scripts/publish.ts --dry-run",
36+
"fetch-ripgrep": "bun scripts/fetch-ripgrep.ts",
3637
"prepack": "bun run build",
3738
"typecheck": "tsc --noEmit -p .",
3839
"test": "bun test"
@@ -58,7 +59,6 @@
5859
"url": "https://github.com/CodebuffAI/codebuff/issues"
5960
},
6061
"dependencies": {
61-
"@vscode/ripgrep": "1.15.14",
6262
"@vscode/tree-sitter-wasm": "0.1.4",
6363
"ai": "^5.0.0",
6464
"diff": "8.0.2",
@@ -69,7 +69,9 @@
6969
"devDependencies": {
7070
"@types/bun": "^1.2.11",
7171
"@types/diff": "8.0.0",
72-
"@types/node": "22"
72+
"@types/node": "22",
73+
"adm-zip": "^0.5.12",
74+
"node-fetch": "^3.3.2"
7375
},
7476
"author": ""
7577
}

β€Žsdk/scripts/build.tsβ€Ž

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ async function build() {
8181
console.log('πŸ“‚ Copying WASM files for tree-sitter...')
8282
await copyWasmFiles()
8383

84+
console.log('πŸ“‚ Copying vendored ripgrep binaries...')
85+
await copyRipgrepVendor()
86+
8487
console.log('βœ… Build complete!')
8588
console.log(' πŸ“„ dist/index.mjs (ESM)')
8689
console.log(' πŸ“„ dist/index.cjs (CJS)')
@@ -133,6 +136,20 @@ async function copyWasmFiles() {
133136
}
134137
}
135138

139+
async function copyRipgrepVendor() {
140+
const vendorSrc = 'vendor/ripgrep'
141+
const vendorDest = 'dist/vendor/ripgrep'
142+
try {
143+
await mkdir(vendorDest, { recursive: true })
144+
await cp(vendorSrc, vendorDest, { recursive: true })
145+
console.log(' βœ“ Copied vendored ripgrep binaries')
146+
} catch (e) {
147+
console.warn(
148+
' ⚠ No vendored ripgrep found; skipping (use fetch-ripgrep.ts first)',
149+
)
150+
}
151+
}
152+
136153
if (import.meta.main) {
137154
build().catch(console.error)
138155
}

β€Žsdk/scripts/fetch-ripgrep.tsβ€Ž

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
#!/usr/bin/env bun
2+
3+
import { mkdir, writeFile } from 'fs/promises'
4+
import { existsSync } from 'fs'
5+
import { join } from 'path'
6+
import AdmZip from 'adm-zip'
7+
import fetch from 'node-fetch'
8+
9+
// Ripgrep version to download
10+
const RIPGREP_VERSION = '14.1.1'
11+
12+
// Platform configurations
13+
const PLATFORMS = [
14+
{
15+
name: 'x64-win32',
16+
url: `https://github.com/BurntSushi/ripgrep/releases/download/${RIPGREP_VERSION}/ripgrep-${RIPGREP_VERSION}-x86_64-pc-windows-msvc.zip`,
17+
executable: 'rg.exe',
18+
archivePath: `ripgrep-${RIPGREP_VERSION}-x86_64-pc-windows-msvc/rg.exe`
19+
},
20+
{
21+
name: 'x64-darwin',
22+
url: `https://github.com/BurntSushi/ripgrep/releases/download/${RIPGREP_VERSION}/ripgrep-${RIPGREP_VERSION}-x86_64-apple-darwin.tar.gz`,
23+
executable: 'rg',
24+
archivePath: `ripgrep-${RIPGREP_VERSION}-x86_64-apple-darwin/rg`
25+
},
26+
{
27+
name: 'arm64-darwin',
28+
url: `https://github.com/BurntSushi/ripgrep/releases/download/${RIPGREP_VERSION}/ripgrep-${RIPGREP_VERSION}-aarch64-apple-darwin.tar.gz`,
29+
executable: 'rg',
30+
archivePath: `ripgrep-${RIPGREP_VERSION}-aarch64-apple-darwin/rg`
31+
},
32+
{
33+
name: 'x64-linux',
34+
url: `https://github.com/BurntSushi/ripgrep/releases/download/${RIPGREP_VERSION}/ripgrep-${RIPGREP_VERSION}-x86_64-unknown-linux-musl.tar.gz`,
35+
executable: 'rg',
36+
archivePath: `ripgrep-${RIPGREP_VERSION}-x86_64-unknown-linux-musl/rg`
37+
},
38+
{
39+
name: 'arm64-linux',
40+
url: `https://github.com/BurntSushi/ripgrep/releases/download/${RIPGREP_VERSION}/ripgrep-${RIPGREP_VERSION}-aarch64-unknown-linux-gnu.tar.gz`,
41+
executable: 'rg',
42+
archivePath: `ripgrep-${RIPGREP_VERSION}-aarch64-unknown-linux-gnu/rg`
43+
}
44+
]
45+
46+
async function downloadAndExtract(platform: typeof PLATFORMS[0]): Promise<void> {
47+
const vendorDir = join('vendor', 'ripgrep', platform.name)
48+
const outputPath = join(vendorDir, platform.executable)
49+
50+
// Skip if already exists
51+
if (existsSync(outputPath)) {
52+
console.log(`βœ“ ${platform.name} already exists, skipping`)
53+
return
54+
}
55+
56+
console.log(`πŸ“₯ Downloading ${platform.name}...`)
57+
58+
const response = await fetch(platform.url)
59+
if (!response.ok) {
60+
throw new Error(`Failed to download ${platform.url}: ${response.statusText}`)
61+
}
62+
63+
const arrayBuffer = await response.arrayBuffer()
64+
const buffer = Buffer.from(arrayBuffer)
65+
66+
// Create vendor directory
67+
await mkdir(vendorDir, { recursive: true })
68+
69+
if (platform.url.endsWith('.zip')) {
70+
// Handle ZIP files
71+
const zip = AdmZip(buffer)
72+
const entry = zip.getEntry(platform.archivePath)
73+
if (!entry) {
74+
throw new Error(`Could not find ${platform.archivePath} in archive`)
75+
}
76+
await writeFile(outputPath, entry.getData())
77+
} else {
78+
// Handle tar.gz files
79+
const { spawn } = require('child_process')
80+
const tempFile = join(vendorDir, 'temp.tar.gz')
81+
82+
// Write temp file
83+
await writeFile(tempFile, buffer)
84+
85+
// Extract using tar
86+
await new Promise<void>((resolve, reject) => {
87+
const tar = spawn('tar', ['-xzf', tempFile, '-C', vendorDir, '--strip-components=1', platform.archivePath], {
88+
stdio: 'inherit'
89+
})
90+
91+
tar.on('close', (code) => {
92+
if (code === 0) {
93+
resolve()
94+
} else {
95+
reject(new Error(`tar extraction failed with code ${code}`))
96+
}
97+
})
98+
99+
tar.on('error', reject)
100+
})
101+
102+
// Clean up temp file
103+
try {
104+
await Bun.file(tempFile).delete()
105+
} catch {}
106+
}
107+
108+
// Make executable on Unix systems
109+
if (platform.executable === 'rg') {
110+
const { spawn } = require('child_process')
111+
await new Promise<void>((resolve, reject) => {
112+
const chmod = spawn('chmod', ['+x', outputPath])
113+
chmod.on('close', (code) => {
114+
if (code === 0) {
115+
resolve()
116+
} else {
117+
reject(new Error(`chmod failed with code ${code}`))
118+
}
119+
})
120+
chmod.on('error', reject)
121+
})
122+
}
123+
124+
console.log(`βœ“ ${platform.name} downloaded and extracted`)
125+
}
126+
127+
async function main() {
128+
console.log(`πŸ”§ Fetching ripgrep v${RIPGREP_VERSION} binaries...`)
129+
130+
// Create base vendor directory
131+
await mkdir(join('vendor', 'ripgrep'), { recursive: true })
132+
133+
// Download all platforms in parallel
134+
await Promise.all(PLATFORMS.map(downloadAndExtract))
135+
136+
// Copy COPYING file
137+
console.log('πŸ“„ Downloading COPYING file...')
138+
const copyingResponse = await fetch(`https://raw.githubusercontent.com/BurntSushi/ripgrep/main/COPYING`)
139+
if (copyingResponse.ok) {
140+
const copyingText = await copyingResponse.text()
141+
await writeFile(join('vendor', 'ripgrep', 'COPYING'), copyingText)
142+
console.log('βœ“ COPYING file downloaded')
143+
}
144+
145+
console.log('πŸŽ‰ All ripgrep binaries downloaded successfully!')
146+
console.log('πŸ“ Files are located in vendor/ripgrep/')
147+
}
148+
149+
if (import.meta.main) {
150+
main().catch((error) => {
151+
console.error('❌ Error:', error.message)
152+
process.exit(1)
153+
})
154+
}

β€Žsdk/src/index.tsβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ export * from './client'
1010
export * from './custom-tool'
1111
export * from './run-state'
1212
export * from './websocket-client'
13+
export * from './native/ripgrep'
14+
export { ToolHelpers } from './tools'

0 commit comments

Comments
Β (0)