- Move private package stubs to stubs/ (tracked), reference via file: in package.json
Stubs: color-diff-napi, modifiers-napi, @ant/claude-for-chrome-mcp,
@anthropic-ai/mcpb, @anthropic-ai/sandbox-runtime
- Add patches/commander@14.0.3.patch via pnpm patch:
Allow multi-char short flags (/^-[^-]+$/) so -d2e works with commander v14
- Pin all dependency versions to exact versions from original cli.js bundle
(extracted from node_modules package.json files in source map)
- Add @anthropic-ai/bedrock-sdk, foundry-sdk, vertex-sdk to dependencies
- Update .gitignore: node_modules/ fully ignored (regenerated by pnpm install)
- Update scripts to use plain `bun` instead of hardcoded path
- Verified: rm -rf node_modules && pnpm install && bun run build.ts succeeds
Output: dist/cli.js (22.1MB), `bun dist/cli.js --version` → 2.1.88 (Claude Code)
25 lines
820 B
JavaScript
25 lines
820 B
JavaScript
import { spawnSync } from 'node:child_process';
|
|
/**
|
|
* Find the path to an executable, similar to the `which` command.
|
|
* Uses Bun.which when running in Bun, falls back to spawnSync for Node.js.
|
|
*
|
|
* @param bin - The name of the executable to find
|
|
* @returns The full path to the executable, or null if not found
|
|
*/
|
|
export function whichSync(bin) {
|
|
// Check if we're running in Bun
|
|
if (typeof globalThis.Bun !== 'undefined') {
|
|
return globalThis.Bun.which(bin);
|
|
}
|
|
// Fallback to Node.js implementation
|
|
const result = spawnSync('which', [bin], {
|
|
encoding: 'utf8',
|
|
stdio: ['ignore', 'pipe', 'ignore'],
|
|
timeout: 1000,
|
|
});
|
|
if (result.status === 0 && result.stdout) {
|
|
return result.stdout.trim();
|
|
}
|
|
return null;
|
|
}
|
|
//# sourceMappingURL=which.js.map
|