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

Function checkGlobalInstallPermissions

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

Source from the content-addressed store, hash-verified

290}
291
292export async function checkGlobalInstallPermissions(): Promise<{
293 hasPermissions: boolean
294 npmPrefix: string | null
295}> {
296 try {
297 const prefix = await getInstallationPrefix()
298 if (!prefix) {
299 return { hasPermissions: false, npmPrefix: null }
300 }
301
302 try {
303 await access(prefix, fsConstants.W_OK)
304 return { hasPermissions: true, npmPrefix: prefix }
305 } catch {
306 logError(
307 new AutoUpdaterError(
308 'Insufficient permissions for global npm install.',
309 ),
310 )
311 return { hasPermissions: false, npmPrefix: prefix }
312 }
313 } catch (error) {
314 logError(error as Error)
315 return { hasPermissions: false, npmPrefix: null }
316 }
317}
318
319export async function getLatestVersion(
320 channel: ReleaseChannel,

Callers 2

installGlobalPackageFunction · 0.85
getDoctorDiagnosticFunction · 0.85

Calls 2

getInstallationPrefixFunction · 0.85
logErrorFunction · 0.70

Tested by

no test coverage detected