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

Function removeClaudeAliasesFromShellConfigs

src/utils/autoUpdater.ts:539–561  ·  view source on GitHub ↗

* Remove claude aliases from shell configuration files * This helps clean up old installation methods when switching to native or npm global

()

Source from the content-addressed store, hash-verified

537 * This helps clean up old installation methods when switching to native or npm global
538 */
539async function removeClaudeAliasesFromShellConfigs(): Promise<void> {
540 const configMap = getShellConfigPaths()
541
542 // Process each shell config file
543 for (const [, configFile] of Object.entries(configMap)) {
544 try {
545 const lines = await readFileLines(configFile)
546 if (!lines) continue
547
548 const { filtered, hadAlias } = filterClaudeAliases(lines)
549
550 if (hadAlias) {
551 await writeFileLines(configFile, filtered)
552 logForDebugging(`Removed claude alias from ${configFile}`)
553 }
554 } catch (error) {
555 // Don't fail the whole operation if one file can't be processed
556 logForDebugging(`Failed to remove alias from ${configFile}: ${error}`, {
557 level: 'error',
558 })
559 }
560 }
561}
562

Callers 1

installGlobalPackageFunction · 0.85

Calls 6

getShellConfigPathsFunction · 0.85
readFileLinesFunction · 0.85
filterClaudeAliasesFunction · 0.85
writeFileLinesFunction · 0.85
logForDebuggingFunction · 0.85
entriesMethod · 0.80

Tested by

no test coverage detected