Files
orca/src/cli/command-spec.ts
T
Neil 15717a4e53 Add CLI commands to manage and find workspace references (#26807)
* Add CLI commands to manage and find workspace references

* Fix reference review findings: source-context twins, legacy link collapse, closed chats, old-host errors

- Keep same-URL links with different source contexts separate; CLI add/remove no longer drops a twin
- Restore merging a bare legacy link into its single matching URL link (no duplicate PR rows, no resurrection on older-client removal)
- Carry absorbed data through collapse chains; resolve repoId conflicts deterministically
- Identity: ignore www., case-insensitive GitHub/GitLab/Gitea paths (stored URL keeps case), no Jira match on git hosts; find accepts self-hosted issue URLs
- reference find: skip closed native chats, require a session id for linked, include an explicitly named archived workspace, warm-cache fallback for --worktree
- Selector parity: collapse same-host duplicate paths, issue: ignores unlinked rows
- CLI: clear update-host error for hosts without reference.*, local flag checks before host probe, help text fixes

* Fix CI: add reference rm alias for verb policy; expect linkedItems in worktree ps summary

* Simplify reference CLI: share identifier/legacy-match helpers, drop redundant dedupe
2026-10-09 22:22:01 -07:00

29 lines
1.1 KiB
TypeScript

export type CommandSpec = {
path: string[]
// Why: conventional alternate verbs should resolve without duplicating specs or handlers.
aliases?: string[][]
argumentMode?: 'parsed' | 'passthrough'
// Why: typo recovery must never steer a benign mistake into destructive state changes.
destructive?: boolean
hidden?: boolean
summary: string
usage: string
allowedFlags: string[]
// Why: repeatability is per-command vocabulary. `--agent` repeats for `search`
// and is single-valued for `worktree create`, which one global set cannot say.
repeatableFlags?: string[]
positionalArgs?: string[]
variadicPositional?: boolean
examples?: string[]
notes?: string[]
// Why: `--from`/`--terminal` names either the acting caller or a target, and only the spec can
// say which. An agent session refuses a caller flag naming anyone else before dispatch.
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]
}