MCPcopy
hub / github.com/codeaashu/claude-code / removeInstalledSymlink

Function removeInstalledSymlink

src/utils/nativeInstaller/installer.ts:1465–1486  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1463 * Will only remove if it's a native binary symlink, not npm-managed JS files
1464 */
1465export async function removeInstalledSymlink(): Promise<void> {
1466 const dirs = getBaseDirectories()
1467
1468 try {
1469 // Check if this is an npm-managed installation
1470 if (await isNpmSymlink(dirs.executable)) {
1471 logForDebugging(
1472 `Skipping removal of ${dirs.executable} - appears to be npm-managed`,
1473 )
1474 return
1475 }
1476
1477 // It's a native binary symlink, safe to remove
1478 await unlink(dirs.executable)
1479 logForDebugging(`Removed claude symlink at ${dirs.executable}`)
1480 } catch (error) {
1481 if (isENOENT(error)) {
1482 return
1483 }
1484 logError(new Error(`Failed to remove claude symlink: ${error}`))
1485 }
1486}
1487
1488/**
1489 * Clean up old claude aliases from shell configuration files

Callers 2

AutoUpdaterFunction · 0.85
updateFunction · 0.85

Calls 6

getBaseDirectoriesFunction · 0.85
isNpmSymlinkFunction · 0.85
logForDebuggingFunction · 0.85
unlinkFunction · 0.85
isENOENTFunction · 0.85
logErrorFunction · 0.50

Tested by

no test coverage detected