()
| 148 | } |
| 149 | |
| 150 | async function getInstallationPath(): Promise<string> { |
| 151 | if (process.env.NODE_ENV === 'development') { |
| 152 | return getCwd() |
| 153 | } |
| 154 | |
| 155 | // For bundled/native builds, show the binary location |
| 156 | if (isInBundledMode()) { |
| 157 | // Try to find the actual binary that was invoked |
| 158 | try { |
| 159 | return await realpath(process.execPath) |
| 160 | } catch { |
| 161 | // This function doesn't expect errors |
| 162 | } |
| 163 | |
| 164 | try { |
| 165 | const path = await which('claude') |
| 166 | if (path) { |
| 167 | return path |
| 168 | } |
| 169 | } catch { |
| 170 | // This function doesn't expect errors |
| 171 | } |
| 172 | |
| 173 | // If we can't find it, check common locations |
| 174 | try { |
| 175 | await getFsImplementation().stat(join(homedir(), '.local/bin/claude')) |
| 176 | return join(homedir(), '.local/bin/claude') |
| 177 | } catch { |
| 178 | // Not found |
| 179 | } |
| 180 | return 'native' |
| 181 | } |
| 182 | |
| 183 | // For npm installations, use the path of the executable |
| 184 | try { |
| 185 | return process.argv[0] || 'unknown' |
| 186 | } catch { |
| 187 | return 'unknown' |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | export function getInvokedBinary(): string { |
| 192 | try { |
no test coverage detected