## Summary
Ripgrep is our preferred tool for file search. When users install via
`brew install codex`, it's automatically installed as a dependency. We
want to ensure that users running via an npm install also have this
tool! Microsoft has already solved this problem for VS Code - let's not
reinvent the wheel.
This approach of appending to the PATH directly might be a bit
heavy-handed, but feels reasonably robust to a variety of environment
concerns. Open to thoughts on better approaches here!
## Testing
- [x] confirmed this import approach works with `node -e "const { rgPath
} = require('@vscode/ripgrep'); require('child_process').spawn(rgPath,
['--version'], { stdio: 'inherit' })"`
- [x] Ran codex.js locally with `rg` uninstalled, asked it to run `which
rg`. Output below:
```
⚡ Ran command which rg; echo $?
⎿ /Users/dylan.hurd/code/dh--npm-rg/node_modules/@vscode/ripgrep/bin/rg
0
codex
Re-running to confirm the path and exit code.
- Path: `/Users/dylan.hurd/code/dh--npm-rg/node_modules/@vscode/ripgrep/bin/rg`
- Exit code: `0`
```
27 lines
433 B
JSON
27 lines
433 B
JSON
{
|
|
"name": "@openai/codex",
|
|
"version": "0.0.0-dev",
|
|
"license": "Apache-2.0",
|
|
"bin": {
|
|
"codex": "bin/codex.js"
|
|
},
|
|
"type": "module",
|
|
"engines": {
|
|
"node": ">=20"
|
|
},
|
|
"files": [
|
|
"bin",
|
|
"dist"
|
|
],
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/openai/codex.git"
|
|
},
|
|
"dependencies": {
|
|
"@vscode/ripgrep": "^1.15.14"
|
|
},
|
|
"devDependencies": {
|
|
"prettier": "^3.3.3"
|
|
}
|
|
}
|