mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
--wait is a global boolean flag, so '--wait 300' left 300 as a positional and the command failed with 'Unknown command: secret request NAME 300' (found in the W6 live e2e). A spec can now list optionalNumberFlags; secret request does for wait.
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
export type CommandSpec = {
|
|
path: string[]
|
|
aliases?: string[][]
|
|
argumentMode?: 'parsed' | 'passthrough'
|
|
// Prevent typo recovery from suggesting destructive actions for unrelated commands.
|
|
destructive?: boolean
|
|
hidden?: boolean
|
|
summary: string
|
|
usage: string
|
|
allowedFlags: string[]
|
|
// Flag repeatability varies by command, even for the same flag name.
|
|
repeatableFlags?: string[]
|
|
// Globally boolean flags that this command also accepts with a number (`--wait 300`).
|
|
optionalNumberFlags?: string[]
|
|
positionalArgs?: string[]
|
|
variadicPositional?: boolean
|
|
examples?: string[]
|
|
notes?: string[]
|
|
// Takes `--page <browserPageId>`; only the browser spec modules set it.
|
|
browserPageTarget?: boolean
|
|
// Caller flags must match the acting agent session; target flags may name another session.
|
|
identityFlagRoles?: Partial<Record<IdentityFlag, 'caller' | 'target'>>
|
|
}
|
|
|
|
export type IdentityFlag = 'from' | 'terminal'
|
|
|
|
export function specPaths(spec: CommandSpec): string[][] {
|
|
return spec.aliases ? [spec.path, ...spec.aliases] : [spec.path]
|
|
}
|