Files
orca/src/cli/command-spec.ts
T
NeilandWilliam Poisel 9a62614615 fix(cli): help lists only the flags each command actually takes (#34598)
* fix(cli): hide unsupported profile-state flags

* fix(cli): derive --page and remote-selector help from what each command takes

--page is now a property the browser spec modules set for commands that act on
one page, rather than offered to every command group not on a deny-list, so
serve, environment, agent, connector, host, vm and profile commands stop
advertising and accepting it. Local-only commands offer only --help and --json
plus a selector they take as their own argument, and a test ties their help to
the same local-only list dispatch uses.

Co-authored-by: William Poisel <53629276+epoisel@users.noreply.github.com>

---------

Co-authored-by: William Poisel <53629276+epoisel@users.noreply.github.com>
2026-10-27 16:06:49 -07:00

28 lines
951 B
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[]
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]
}