Reduce remaining remote URL debug detail

This commit is contained in:
2026-04-04 10:48:40 +08:00
parent 4d506aabf7
commit 5149320afd
5 changed files with 49 additions and 15 deletions

View File

@@ -17,12 +17,19 @@ import {
filterExistingPaths,
getKnownPathsForRepo,
} from '../githubRepoPathMapping.js'
import { jsonStringify } from '../slowOperations.js'
import { readLastFetchTime } from './banner.js'
import { parseDeepLink } from './parseDeepLink.js'
import { MACOS_BUNDLE_ID } from './registerProtocol.js'
import { launchInTerminal } from './terminalLauncher.js'
function summarizeDeepLinkAction(action: {
query?: string
cwd?: string
repo?: string
}): string {
return `hasQuery=${Boolean(action.query)} hasCwd=${Boolean(action.cwd)} hasRepo=${Boolean(action.repo)}`
}
/**
* Handle an incoming deep link URI.
*
@@ -34,7 +41,7 @@ import { launchInTerminal } from './terminalLauncher.js'
* @returns exit code (0 = success)
*/
export async function handleDeepLinkUri(uri: string): Promise<number> {
logForDebugging(`Handling deep link URI: ${uri}`)
logForDebugging('Handling deep link URI')
let action
try {
@@ -46,7 +53,7 @@ export async function handleDeepLinkUri(uri: string): Promise<number> {
return 1
}
logForDebugging(`Parsed deep link action: ${jsonStringify(action)}`)
logForDebugging(`Parsed deep link action (${summarizeDeepLinkAction(action)})`)
// Always the running executable — no PATH lookup. The OS launched us via
// an absolute path (bundle symlink / .desktop Exec= / registry command)
@@ -125,11 +132,11 @@ async function resolveCwd(action: {
const known = getKnownPathsForRepo(action.repo)
const existing = await filterExistingPaths(known)
if (existing[0]) {
logForDebugging(`Resolved repo ${action.repo}${existing[0]}`)
logForDebugging('Resolved repo deep link to local clone')
return { cwd: existing[0], resolvedRepo: action.repo }
}
logForDebugging(
`No local clone found for repo ${action.repo}, falling back to home`,
'No local clone found for repo deep link, falling back to home',
)
}
return { cwd: homedir() }