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

Function launchInTerminal

src/utils/deepLink/terminalLauncher.ts:214–253  ·  view source on GitHub ↗
(
  claudePath: string,
  action: {
    query?: string
    cwd?: string
    repo?: string
    lastFetchMs?: number
  },
)

Source from the content-addressed store, hash-verified

212 * query or cwd are preserved by argv boundaries with zero interpretation.
213 */
214export async function launchInTerminal(
215 claudePath: string,
216 action: {
217 query?: string
218 cwd?: string
219 repo?: string
220 lastFetchMs?: number
221 },
222): Promise<boolean> {
223 const terminal = await detectTerminal()
224 if (!terminal) {
225 logForDebugging('No terminal emulator detected', { level: 'error' })
226 return false
227 }
228
229 logForDebugging(
230 `Launching in terminal: ${terminal.name} (${terminal.command})`,
231 )
232 const claudeArgs = ['--deep-link-origin']
233 if (action.repo) {
234 claudeArgs.push('--deep-link-repo', action.repo)
235 if (action.lastFetchMs !== undefined) {
236 claudeArgs.push('--deep-link-last-fetch', String(action.lastFetchMs))
237 }
238 }
239 if (action.query) {
240 claudeArgs.push('--prefill', action.query)
241 }
242
243 switch (process.platform) {
244 case 'darwin':
245 return launchMacosTerminal(terminal, claudePath, claudeArgs, action.cwd)
246 case 'linux':
247 return launchLinuxTerminal(terminal, claudePath, claudeArgs, action.cwd)
248 case 'win32':
249 return launchWindowsTerminal(terminal, claudePath, claudeArgs, action.cwd)
250 default:
251 return false
252 }
253}
254
255async function launchMacosTerminal(
256 terminal: TerminalInfo,

Callers 1

handleDeepLinkUriFunction · 0.85

Calls 6

logForDebuggingFunction · 0.85
launchMacosTerminalFunction · 0.85
launchLinuxTerminalFunction · 0.85
launchWindowsTerminalFunction · 0.85
detectTerminalFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected