Skip to content

armgit / orca

Public Imported from GitHub
0

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.

942 B
Raw Blame
import { isDefaultGitHubHost } from './repository-identity-key'

export type GitHubProjectIdentity = {
  owner: string
  ownerType: 'organization' | 'user'
  number: number
  host?: string
}

/** Stable settings/cache identity. Default-host keys intentionally retain the
 * legacy shape so existing github.com project preferences survive upgrades. */
export function githubProjectIdentityKey(project: GitHubProjectIdentity): string {
  const projectKey = `${project.ownerType}:${project.owner.toLowerCase()}:${project.number}`
  const host = project.host?.trim().toLowerCase()
  return host && !isDefaultGitHubHost(host) ? `${host}:${projectKey}` : projectKey
}

/** Project API calls must pin github.com too; otherwise process GH_HOST can
 * redirect a host-less persisted project to an Enterprise server. */
export function githubProjectHost(host?: string | null): string {
  const trimmed = host?.trim()
  return trimmed || 'github.com'
}