Files
orca/src/main/runtime/runtime-linear-command-base.ts
T
Neil eedca5ee1c fix(persistence): worktree meta and lineage writes take the row's host, not the id (R4-2b) (#30811)
* fix(persistence): worktree meta and lineage writes take the row's host, not the id (R4-2b)

* fix(persistence): review fixes for host-targeted worktree writes

* test: SAFETY notes on partial runtime store mocks

* test: drop imports duplicated by the rebase onto #30797
2026-10-19 11:39:54 -07:00

57 lines
2.0 KiB
TypeScript

import type { RuntimeTerminalShow } from '../../shared/runtime-types'
import type { ResolvedWorktree } from './runtime-worktree-path-identity'
import type { LinearLinkedIssueUpdatedEvent } from './runtime-linear-command-dependencies'
import { RuntimeLinearBrowseCommands } from './runtime-linear-browse-commands'
export type RuntimeLinearCommandPorts = {
runtimeAvailable: () => boolean
showTerminal: (handle: string) => Promise<RuntimeTerminalShow>
resolveWorktreeSelector: (selector: string) => Promise<ResolvedWorktree>
listResolvedWorktrees: () => Promise<ResolvedWorktree[]>
setWorktreeMeta: (
worktree: Pick<ResolvedWorktree, 'id' | 'hostId'>,
meta: {
linkedLinearIssueWorkspaceId: string
linkedLinearIssueOrganizationUrlKey: string | null
}
) => void
emitClientEvent: (event: LinearLinkedIssueUpdatedEvent) => void
}
// Why: browse reads sit at the chain root so write commands can re-enter them through `this`, as they did on the facade.
export class RuntimeLinearCommandBase extends RuntimeLinearBrowseCommands {
constructor(private readonly ports: RuntimeLinearCommandPorts) {
super()
}
protected runtimeAvailable(): boolean {
return this.ports.runtimeAvailable()
}
protected showTerminal(handle: string): Promise<RuntimeTerminalShow> {
return this.ports.showTerminal(handle)
}
protected resolveWorktreeSelector(selector: string): Promise<ResolvedWorktree> {
return this.ports.resolveWorktreeSelector(selector)
}
protected listResolvedWorktrees(): Promise<ResolvedWorktree[]> {
return this.ports.listResolvedWorktrees()
}
protected setWorktreeMeta(
worktree: Pick<ResolvedWorktree, 'id' | 'hostId'>,
meta: {
linkedLinearIssueWorkspaceId: string
linkedLinearIssueOrganizationUrlKey: string | null
}
): void {
this.ports.setWorktreeMeta(worktree, meta)
}
protected emitClientEvent(event: LinearLinkedIssueUpdatedEvent): void {
this.ports.emitClientEvent(event)
}
}