* Register the protocol handler on Windows via the registry.
(claudePath: string)
| 183 | * Register the protocol handler on Windows via the registry. |
| 184 | */ |
| 185 | async function registerWindows(claudePath: string): Promise<void> { |
| 186 | for (const args of [ |
| 187 | ['add', WINDOWS_REG_KEY, '/ve', '/d', `URL:${APP_NAME}`, '/f'], |
| 188 | ['add', WINDOWS_REG_KEY, '/v', 'URL Protocol', '/d', '', '/f'], |
| 189 | [ |
| 190 | 'add', |
| 191 | WINDOWS_COMMAND_KEY, |
| 192 | '/ve', |
| 193 | '/d', |
| 194 | windowsCommandValue(claudePath), |
| 195 | '/f', |
| 196 | ], |
| 197 | ]) { |
| 198 | const { code } = await execFileNoThrow('reg', args, { useCwd: false }) |
| 199 | if (code !== 0) { |
| 200 | throw Object.assign(new Error(`reg add exited with code ${code}`), { |
| 201 | code: 'REG_FAILED', |
| 202 | }) |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | logForDebugging( |
| 207 | `Registered ${DEEP_LINK_PROTOCOL}:// protocol handler in Windows registry`, |
| 208 | ) |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * Register the `claude-cli://` protocol handler with the operating system. |
no test coverage detected