Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.
TypeScript adeagent-ideai-agentsautomationbotclaude-codecodexghosttygrok-bothermes-agentmobile-appmuseopenclawopencodeorchestrationpiruntimeterminalworktreesyc-backed
export function normalizeHostedReviewHeadRef(ref: string): string {
return ref
.trim()
.replace(/^refs\/heads\//, '')
.replace(/^refs\/remotes\/[^/]+\//, '')
}
export function normalizeHostedReviewBaseRef(ref: string): string {
const normalized = normalizeHostedReviewHeadRef(ref)
return normalized.replace(/^(origin|upstream)\//, '')
}
/** Exclude only a remote's direct symbolic HEAD, preserving branches like feature/HEAD. */
export function isRemoteHeadRef(ref: string, remotes: readonly string[] = []): boolean {
// Every true result ends in `/HEAD`, so ordinary refs can skip the remote copy+sort.
if (!ref.endsWith('/HEAD')) {
return false
}
const shortRef = ref.startsWith('refs/remotes/') ? ref.slice('refs/remotes/'.length) : ref
const remote = [...remotes]
.sort((left, right) => right.length - left.length)
.find((candidate) => shortRef.startsWith(`${candidate}/`))
if (remote) {
return shortRef.slice(remote.length + 1) === 'HEAD'
}
// Unconfigured stale remotes are unambiguous only as <remote>/HEAD.
return shortRef.split('/').length === 2 && shortRef.endsWith('/HEAD')
}