Files
orca/src/shared/runtime-reference-contracts.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

55 lines
1.3 KiB
TypeScript

import type { WorkspaceAttachment, Worktree } from './worktree/types'
import type { ExecutionHostId } from './execution-host'
import type { PtyLivenessVerdict } from './pty-liveness-verdict'
export type ReferenceWorkspace = Worktree & {
kind: 'worktree' | 'folder'
name: string
repo: string
}
export type RuntimeReferenceEntry = WorkspaceAttachment & { key: string; selected: boolean }
export type RuntimeReferenceAgent = {
linked: boolean
liveness: PtyLivenessVerdict['status']
terminal?: string
mailbox?: string
agent?: string
paneKey?: string
sessionId?: string
}
export type RuntimeReferenceFindParams = {
query: string
worktree?: string
cwd?: string
repo?: string
includeArchived?: boolean
limit?: number
}
export type RuntimeReferenceFindResult = {
kind: 'reference_matches'
query: string
scope: { source: 'stored-metadata'; worktree?: string; repo?: string; includeArchived: boolean }
truncated: boolean
matches: {
reference: WorkspaceAttachment & { key: string }
workspace: {
id: string
name: string
repo: string
kind: 'worktree' | 'folder'
archived: boolean
hostId?: ExecutionHostId
}
agents: RuntimeReferenceAgent[]
}[]
}
export type RuntimeReferenceListResult = {
worktree: ReferenceWorkspace
references: RuntimeReferenceEntry[]
}