MCPcopy Index your code
hub / github.com/codeaashu/claude-code / registerWindows

Function registerWindows

src/utils/deepLink/registerProtocol.ts:185–209  ·  view source on GitHub ↗

* Register the protocol handler on Windows via the registry.

(claudePath: string)

Source from the content-addressed store, hash-verified

183 * Register the protocol handler on Windows via the registry.
184 */
185async 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.

Callers 1

registerProtocolHandlerFunction · 0.85

Calls 3

windowsCommandValueFunction · 0.85
execFileNoThrowFunction · 0.85
logForDebuggingFunction · 0.85

Tested by

no test coverage detected