Files
orca/src/cli/handlers/worktree-link-flag-value.ts
T
c1d403a47b feat(cli): link GitHub and GitLab items on worktree create and set
Expose and validate the existing workspace link fields, preserving omitted values and provider identity checks.

Related: https://github.com/stablyai/orca/pull/22609

Co-authored-by: marco song <marco.song@mvlchain.io>
Co-authored-by: SongMarco <20613630+SongMarco@users.noreply.github.com>
Co-authored-by: Luca Critelli <lucacri@gmail.com>
Co-authored-by: Neil <neil@stably.ai>
2026-10-03 00:51:19 -07:00

26 lines
757 B
TypeScript

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
}