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.

757 B
Raw Blame
import { RuntimeClientError } from '../runtime-client'

export function getOptionalWorktreeLinkFlagValue(
  flags: Map<string, string | boolean>,
  name: string,
  options: { allowNull?: boolean; createHint?: string } = {}
): string | null | undefined {
  if (!flags.has(name)) {
    return undefined
  }
  const value = flags.get(name)
  if (typeof value !== 'string' || value.length === 0) {
    throw new RuntimeClientError('invalid_argument', `Missing value for --${name}`)
  }
  if (value.trim().toLowerCase() !== 'null') {
    return value
  }
  if (!options.allowNull) {
    throw new RuntimeClientError(
      'invalid_argument',
      `Omit --${name} on create, or pass ${options.createHint ?? 'a valid link reference'}.`
    )
  }
  return null
}