π File detail
utils/embeddedTools.ts
π§© .tsπ 30 linesπΎ 1,043 bytesπ text
β Back to All Filesπ― Use case
This file lives under βutils/β, which covers cross-cutting helpers (shell, tempfiles, settings, messages, process input, β¦). On the API surface it exposes hasEmbeddedSearchTools and embeddedSearchToolsBinaryPath β mainly functions, hooks, or classes. It composes internal code from envUtils (relative imports).
Generated from folder role, exports, dependency roots, and inline comments β not hand-reviewed for every path.
π§ Inline summary
import { isEnvTruthy } from './envUtils.js' /** * Whether this build has bfs/ugrep embedded in the bun binary (ant-native only). *
π€ Exports (heuristic)
hasEmbeddedSearchToolsembeddedSearchToolsBinaryPath
π₯οΈ Source preview
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
}