()
| 138 | * Called after `claude update` so completions stay in sync with the new binary. |
| 139 | */ |
| 140 | export async function regenerateCompletionCache(): Promise<void> { |
| 141 | const shell = detectShell() |
| 142 | if (!shell) { |
| 143 | return |
| 144 | } |
| 145 | |
| 146 | logForDebugging(`update: Regenerating ${shell.name} completion cache`) |
| 147 | |
| 148 | const claudeBin = process.argv[1] || 'claude' |
| 149 | const result = await execFileNoThrow(claudeBin, [ |
| 150 | 'completion', |
| 151 | shell.shellFlag, |
| 152 | '--output', |
| 153 | shell.cacheFile, |
| 154 | ]) |
| 155 | |
| 156 | if (result.code !== 0) { |
| 157 | logForDebugging( |
| 158 | `update: Failed to regenerate ${shell.name} completion cache`, |
| 159 | ) |
| 160 | return |
| 161 | } |
| 162 | |
| 163 | logForDebugging( |
| 164 | `update: Regenerated ${shell.name} completion cache at ${shell.cacheFile}`, |
| 165 | ) |
| 166 | } |
| 167 |
no test coverage detected