* Remove claude aliases from shell configuration files * This helps clean up old installation methods when switching to native or npm global
()
| 575 | * This helps clean up old installation methods when switching to native or npm global |
| 576 | */ |
| 577 | async function removeClaudeAliasesFromShellConfigs(): Promise<void> { |
| 578 | const configMap = getShellConfigPaths() |
| 579 | |
| 580 | // Process each shell config file |
| 581 | for (const [, configFile] of Object.entries(configMap)) { |
| 582 | try { |
| 583 | const lines = await readFileLines(configFile) |
| 584 | if (!lines) continue |
| 585 | |
| 586 | const { filtered, hadAlias } = filterNcodeAliases(lines) |
| 587 | |
| 588 | if (hadAlias) { |
| 589 | await writeFileLines(configFile, filtered) |
| 590 | logForDebugging(`Removed claude alias from ${configFile}`) |
| 591 | } |
| 592 | } catch (error) { |
| 593 | // Don't fail the whole operation if one file can't be processed |
| 594 | logForDebugging(`Failed to remove alias from ${configFile}: ${error}`, { |
| 595 | level: 'error', |
| 596 | }) |
| 597 | } |
| 598 | } |
| 599 | } |
no test coverage detected