embeddedTools.ts
utils/embeddedTools.ts
30
Lines
1043
Bytes
2
Exports
1
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with tool-system. It contains 30 lines, 1 detected imports, and 2 detected exports.
Important relationships
Detected exports
hasEmbeddedSearchToolsembeddedSearchToolsBinaryPath
Keywords
embeddedbinarygrepprocessisenvtruthyugrepant-nativeonlywhenfind
Detected imports
./envUtils.js
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
import { isEnvTruthy } from './envUtils.js'
/**
* Whether this build has bfs/ugrep embedded in the bun binary (ant-native only).
*
* When true:
* - `find` and `grep` in Claude's Bash shell are shadowed by shell functions
* that invoke the bun binary with argv0='bfs' / argv0='ugrep' (same trick
* as embedded ripgrep)
* - The dedicated Glob/Grep tools are removed from the tool registry
* - Prompt guidance steering Claude away from find/grep is omitted
*
* Set as a build-time define in scripts/build-with-plugins.ts for ant-native builds.
*/
export function hasEmbeddedSearchTools(): boolean {
if (!isEnvTruthy(process.env.EMBEDDED_SEARCH_TOOLS)) return false
const e = process.env.CLAUDE_CODE_ENTRYPOINT
return (
e !== 'sdk-ts' && e !== 'sdk-py' && e !== 'sdk-cli' && e !== 'local-agent'
)
}
/**
* Path to the bun binary that contains the embedded search tools.
* Only meaningful when hasEmbeddedSearchTools() is true.
*/
export function embeddedSearchToolsBinaryPath(): string {
return process.execPath
}