MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / openDeepLink

Function openDeepLink

source code/utils/desktopDeepLink.ts:170–202  ·  view source on GitHub ↗

* Opens a deep link URL using the platform-specific mechanism. * Returns true if the command succeeded, false otherwise.

(deepLinkUrl: string)

Source from the content-addressed store, hash-verified

168 * Returns true if the command succeeded, false otherwise.
169 */
170async function openDeepLink(deepLinkUrl: string): Promise<boolean> {
171 const platform = process.platform
172 logForDebugging(`Opening deep link: ${deepLinkUrl}`)
173
174 if (platform === 'darwin') {
175 if (isDevMode()) {
176 // In dev mode, `open` launches a bare Electron binary (without app code)
177 // because setAsDefaultProtocolClient registers just the Electron executable.
178 // Use AppleScript to route the URL to the already-running Electron app.
179 const { code } = await execFileNoThrow('osascript', [
180 '-e',
181 `tell application "Electron" to open location "${deepLinkUrl}"`,
182 ])
183 return code === 0
184 }
185 const { code } = await execFileNoThrow('open', [deepLinkUrl])
186 return code === 0
187 } else if (platform === 'linux') {
188 const { code } = await execFileNoThrow('xdg-open', [deepLinkUrl])
189 return code === 0
190 } else if (platform === 'win32') {
191 // On Windows, use cmd /c start to open URLs
192 const { code } = await execFileNoThrow('cmd', [
193 '/c',
194 'start',
195 '',
196 deepLinkUrl,
197 ])
198 return code === 0
199 }
200
201 return false
202}
203
204/**
205 * Build and open a deep link to resume the current session in Claude Desktop.

Callers 1

Calls 3

logForDebuggingFunction · 0.85
isDevModeFunction · 0.85
execFileNoThrowFunction · 0.85

Tested by

no test coverage detected