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.

616 B
Raw Blame
type HostNameSource = {
  readonly name: string
}

// Treat matching legacy names as generated rather than phone overrides.
export const GENERATED_HOST_NAME_PATTERN = /^Host (\d+)$/

export function getNextHostNameFromHosts(hosts: readonly HostNameSource[]): string {
  let largestHostNumber = 0

  for (const host of hosts) {
    const match = GENERATED_HOST_NAME_PATTERN.exec(host.name)
    if (!match) {
      continue
    }

    const hostNumber = Number.parseInt(match[1]!, 10)
    if (hostNumber > largestHostNumber) {
      largestHostNumber = hostNumber
    }
  }

  return `Host ${largestHostNumber + 1}`
}