MCPcopy
hub / github.com/claude-code-best/claude-code / openDeepLink

Function openDeepLink

src/utils/desktopDeepLink.ts:168–200  ·  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

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

Callers 1

Calls 3

isDevModeFunction · 0.85
logForDebuggingFunction · 0.70
execFileNoThrowFunction · 0.70

Tested by

no test coverage detected