()
| 27 | } |
| 28 | |
| 29 | function detectShell(): ShellInfo | null { |
| 30 | const shell = process.env.SHELL || '' |
| 31 | const home = homedir() |
| 32 | const claudeDir = getCompletionCacheDir() |
| 33 | |
| 34 | if (shell.endsWith('/zsh') || shell.endsWith('/zsh.exe')) { |
| 35 | const cacheFile = join(claudeDir, 'completion.zsh') |
| 36 | return { |
| 37 | name: 'zsh', |
| 38 | rcFile: join(home, '.zshrc'), |
| 39 | cacheFile, |
| 40 | completionLine: `[[ -f "${cacheFile}" ]] && source "${cacheFile}"`, |
| 41 | shellFlag: 'zsh', |
| 42 | } |
| 43 | } |
| 44 | if (shell.endsWith('/bash') || shell.endsWith('/bash.exe')) { |
| 45 | const cacheFile = join(claudeDir, 'completion.bash') |
| 46 | return { |
| 47 | name: 'bash', |
| 48 | rcFile: join(home, '.bashrc'), |
| 49 | cacheFile, |
| 50 | completionLine: `[ -f "${cacheFile}" ] && source "${cacheFile}"`, |
| 51 | shellFlag: 'bash', |
| 52 | } |
| 53 | } |
| 54 | if (shell.endsWith('/fish') || shell.endsWith('/fish.exe')) { |
| 55 | const xdg = process.env.XDG_CONFIG_HOME || join(home, '.config') |
| 56 | const cacheFile = join(claudeDir, 'completion.fish') |
| 57 | return { |
| 58 | name: 'fish', |
| 59 | rcFile: join(xdg, 'fish', 'config.fish'), |
| 60 | cacheFile, |
| 61 | completionLine: `[ -f "${cacheFile}" ] && source "${cacheFile}"`, |
| 62 | shellFlag: 'fish', |
| 63 | } |
| 64 | } |
| 65 | return null |
| 66 | } |
| 67 | |
| 68 | function formatPathLink(filePath: string): string { |
| 69 | if (!supportsHyperlinks()) { |
no test coverage detected