MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getInstallationPrefix

Function getInstallationPrefix

src/utils/autoUpdater.ts:270–290  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

268}
269
270async function getInstallationPrefix(): Promise<string | null> {
271 // Run from home directory to avoid reading project-level .npmrc/.bunfig.toml
272 const isBun = env.isRunningWithBun()
273 let prefixResult = null
274 if (isBun) {
275 prefixResult = await execFileNoThrowWithCwd('bun', ['pm', 'bin', '-g'], {
276 cwd: homedir(),
277 })
278 } else {
279 prefixResult = await execFileNoThrowWithCwd(
280 'npm',
281 ['-g', 'config', 'get', 'prefix'],
282 { cwd: homedir() },
283 )
284 }
285 if (prefixResult.code !== 0) {
286 logError(new Error(`Failed to check ${isBun ? 'bun' : 'npm'} permissions`))
287 return null
288 }
289 return prefixResult.stdout.trim()
290}
291
292export async function checkGlobalInstallPermissions(): Promise<{
293 hasPermissions: boolean

Callers 1

Calls 2

execFileNoThrowWithCwdFunction · 0.85
logErrorFunction · 0.70

Tested by

no test coverage detected