Strip bridge metadata and trusted-device egress
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { feature } from 'bun:bundle'
|
||||
import { randomUUID } from 'crypto'
|
||||
import { hostname, tmpdir } from 'os'
|
||||
import { tmpdir } from 'os'
|
||||
import { basename, join, resolve } from 'path'
|
||||
import { getRemoteSessionUrl } from '../constants/product.js'
|
||||
import { shutdownDatadog } from '../services/analytics/datadog.js'
|
||||
@@ -2203,9 +2203,7 @@ export async function bridgeMain(args: string[]): Promise<void> {
|
||||
? process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL
|
||||
: baseUrl
|
||||
|
||||
const { getBranch, getRemoteUrl, findGitRoot } = await import(
|
||||
'../utils/git.js'
|
||||
)
|
||||
const { findGitRoot } = await import('../utils/git.js')
|
||||
|
||||
// Precheck worktree availability for the first-run dialog and the `w`
|
||||
// toggle. Unconditional so we know upfront whether worktree is an option.
|
||||
@@ -2337,9 +2335,6 @@ export async function bridgeMain(args: string[]): Promise<void> {
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const branch = await getBranch()
|
||||
const gitRepoUrl = await getRemoteUrl()
|
||||
const machineName = hostname()
|
||||
const bridgeId = randomUUID()
|
||||
|
||||
const { handleOAuth401Error } = await import('../utils/auth.js')
|
||||
@@ -2417,9 +2412,6 @@ export async function bridgeMain(args: string[]): Promise<void> {
|
||||
|
||||
const config: BridgeConfig = {
|
||||
dir,
|
||||
machineName,
|
||||
branch,
|
||||
gitRepoUrl,
|
||||
maxSessions,
|
||||
spawnMode,
|
||||
verbose,
|
||||
@@ -2435,7 +2427,7 @@ export async function bridgeMain(args: string[]): Promise<void> {
|
||||
}
|
||||
|
||||
logForDebugging(
|
||||
`[bridge:init] bridgeId=${bridgeId}${reuseEnvironmentId ? ` reuseEnvironmentId=${reuseEnvironmentId}` : ''} dir=${dir} branch=${branch} gitRepoUrl=${gitRepoUrl} machine=${machineName}`,
|
||||
`[bridge:init] bridgeId=${bridgeId}${reuseEnvironmentId ? ` reuseEnvironmentId=${reuseEnvironmentId}` : ''} dir=${dir}`,
|
||||
)
|
||||
logForDebugging(
|
||||
`[bridge:init] apiBaseUrl=${baseUrl} sessionIngressUrl=${sessionIngressUrl}`,
|
||||
@@ -2591,11 +2583,7 @@ export async function bridgeMain(args: string[]): Promise<void> {
|
||||
})
|
||||
|
||||
const logger = createBridgeLogger({ verbose })
|
||||
const { parseGitHubRepository } = await import('../utils/detectRepository.js')
|
||||
const ownerRepo = gitRepoUrl ? parseGitHubRepository(gitRepoUrl) : null
|
||||
// Use the repo name from the parsed owner/repo, or fall back to the dir basename
|
||||
const repoName = ownerRepo ? ownerRepo.split('/').pop()! : basename(dir)
|
||||
logger.setRepoInfo(repoName, branch)
|
||||
logger.setRepoInfo(basename(dir), '')
|
||||
|
||||
// `w` toggle is available iff we're in a multi-session mode AND worktree
|
||||
// is a valid option. When unavailable, the mode suffix and hint are hidden.
|
||||
@@ -2678,8 +2666,6 @@ export async function bridgeMain(args: string[]): Promise<void> {
|
||||
environmentId,
|
||||
title: name,
|
||||
events: [],
|
||||
gitRepoUrl,
|
||||
branch,
|
||||
signal: controller.signal,
|
||||
baseUrl,
|
||||
getAccessToken: getBridgeAccessToken,
|
||||
@@ -2856,9 +2842,7 @@ export async function runBridgeHeadless(
|
||||
? process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL
|
||||
: baseUrl
|
||||
|
||||
const { getBranch, getRemoteUrl, findGitRoot } = await import(
|
||||
'../utils/git.js'
|
||||
)
|
||||
const { findGitRoot } = await import('../utils/git.js')
|
||||
const { hasWorktreeCreateHook } = await import('../utils/hooks.js')
|
||||
|
||||
if (opts.spawnMode === 'worktree') {
|
||||
@@ -2871,16 +2855,10 @@ export async function runBridgeHeadless(
|
||||
}
|
||||
}
|
||||
|
||||
const branch = await getBranch()
|
||||
const gitRepoUrl = await getRemoteUrl()
|
||||
const machineName = hostname()
|
||||
const bridgeId = randomUUID()
|
||||
|
||||
const config: BridgeConfig = {
|
||||
dir,
|
||||
machineName,
|
||||
branch,
|
||||
gitRepoUrl,
|
||||
maxSessions: opts.capacity,
|
||||
spawnMode: opts.spawnMode,
|
||||
verbose: false,
|
||||
@@ -2934,8 +2912,6 @@ export async function runBridgeHeadless(
|
||||
environmentId,
|
||||
title: opts.name,
|
||||
events: [],
|
||||
gitRepoUrl,
|
||||
branch,
|
||||
signal,
|
||||
baseUrl,
|
||||
getAccessToken: opts.getAccessToken,
|
||||
|
||||
Reference in New Issue
Block a user