( options?: ShellConfigOptions, )
| 114 | * @param options Optional overrides for testing (env, homedir) |
| 115 | */ |
| 116 | export async function findClaudeAlias( |
| 117 | options?: ShellConfigOptions, |
| 118 | ): Promise<string | null> { |
| 119 | const configs = getShellConfigPaths(options) |
| 120 | |
| 121 | for (const configPath of Object.values(configs)) { |
| 122 | const lines = await readFileLines(configPath) |
| 123 | if (!lines) continue |
| 124 | |
| 125 | for (const line of lines) { |
| 126 | if (CLAUDE_ALIAS_REGEX.test(line)) { |
| 127 | // Extract the alias target |
| 128 | const match = line.match(/alias\s+claude=["']?([^"'\s]+)/) |
| 129 | if (match && match[1]) { |
| 130 | return match[1] |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | return null |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * Check if a claude alias exists and points to a valid executable |
no test coverage detected