source dump of claude code
at main 29 lines 1.0 kB view raw
1import { isEnvTruthy } from './envUtils.js' 2 3/** 4 * Whether this build has bfs/ugrep embedded in the bun binary (ant-native only). 5 * 6 * When true: 7 * - `find` and `grep` in Claude's Bash shell are shadowed by shell functions 8 * that invoke the bun binary with argv0='bfs' / argv0='ugrep' (same trick 9 * as embedded ripgrep) 10 * - The dedicated Glob/Grep tools are removed from the tool registry 11 * - Prompt guidance steering Claude away from find/grep is omitted 12 * 13 * Set as a build-time define in scripts/build-with-plugins.ts for ant-native builds. 14 */ 15export function hasEmbeddedSearchTools(): boolean { 16 if (!isEnvTruthy(process.env.EMBEDDED_SEARCH_TOOLS)) return false 17 const e = process.env.CLAUDE_CODE_ENTRYPOINT 18 return ( 19 e !== 'sdk-ts' && e !== 'sdk-py' && e !== 'sdk-cli' && e !== 'local-agent' 20 ) 21} 22 23/** 24 * Path to the bun binary that contains the embedded search tools. 25 * Only meaningful when hasEmbeddedSearchTools() is true. 26 */ 27export function embeddedSearchToolsBinaryPath(): string { 28 return process.execPath 29}