mirror of
https://github.com/stablyai/orca.git
synced 2026-11-03 10:37:35 +00:00
* feat(wsl-mover): refuse edits to a project a WSL move is taking, and drop its background bookkeeping quietly (D1b-5c-2) * fix(wsl-mover): hide only local rows of a moved project; the host's own row keeps its id (D1b-5c-2) * fix(wsl-mover): refuse a user's unread toggle, fence branch deletes, host setups and issue commands; settings unfreeze once the host owns a repo (D1b-5c-2) * test(wsl-mover): the fence e2e refuses edits to moving projects and drops their bookkeeping quietly (D1b-5c-2) * refactor(wsl-mover): name the update type the fence inspects (D1b-5c-2) * test(wsl-mover): run the fence tests that open a real store in the Node runtime (D1b-5c-2) * fix(wsl-mover): a host setup's own repo stays frozen once the host owns it; e2e pins the quiet drop (D1b-5c-2)
58 lines
2.2 KiB
TypeScript
58 lines
2.2 KiB
TypeScript
import { getStoredRepoSshConnectionId } from '../repo-execution-host'
|
|
import type { GitRuntimeOptions } from '../git/git-runtime-options'
|
|
import type { Repo } from '../../shared/repo-types'
|
|
import { readIssueCommand, writeIssueCommand } from '../issue-command-file'
|
|
import { isFolderRepo } from '../../shared/repo-kind'
|
|
import { joinWorktreeRelativePath } from './runtime-relative-paths'
|
|
import type { RuntimeStore } from './runtime-store-contract'
|
|
import { assertWslMoveRepoWritable } from '../persistence/moving-wsl-projects/wsl-move-scope-guard'
|
|
|
|
type RuntimeRepositoryIssueCommandDeps = {
|
|
resolveRepo: (selector: string) => Promise<Repo>
|
|
getLocalGitArgs: (repo: Repo) => [] | [GitRuntimeOptions]
|
|
getStore?: () => RuntimeStore | null
|
|
}
|
|
|
|
export class RuntimeRepositoryIssueCommand {
|
|
constructor(private readonly deps: RuntimeRepositoryIssueCommandDeps) {}
|
|
|
|
async read(repoSelector: string) {
|
|
const repo = await this.deps.resolveRepo(repoSelector)
|
|
if (isFolderRepo(repo)) {
|
|
return {
|
|
localContent: null,
|
|
sharedContent: null,
|
|
effectiveContent: null,
|
|
localFilePath: '',
|
|
source: 'none' as const
|
|
}
|
|
}
|
|
const connectionId = getStoredRepoSshConnectionId(repo)
|
|
if (!connectionId) {
|
|
return readIssueCommand(repo.path)
|
|
}
|
|
// Why: an `ssh:` repo is not served here; it reads as having no command.
|
|
return {
|
|
localContent: null,
|
|
sharedContent: null,
|
|
effectiveContent: null,
|
|
localFilePath: joinWorktreeRelativePath(repo.path, '.orca/issue-command'),
|
|
source: 'none' as const
|
|
}
|
|
}
|
|
|
|
/** Save a private override on its execution host; blank content restores the shared command. */
|
|
async write(repoSelector: string, content: string): Promise<{ ok: true }> {
|
|
const repo = await this.deps.resolveRepo(repoSelector)
|
|
assertWslMoveRepoWritable(this.deps.getStore?.() ?? undefined, repo)
|
|
if (isFolderRepo(repo)) {
|
|
return { ok: true }
|
|
}
|
|
// Why: an `ssh:` repo is not served here; the write is dropped, as when it was unreachable.
|
|
if (!getStoredRepoSshConnectionId(repo)) {
|
|
await writeIssueCommand(repo.path, content, () => this.deps.getLocalGitArgs(repo)[0] ?? {})
|
|
}
|
|
return { ok: true }
|
|
}
|
|
}
|