The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { WS_METHODS } from "@t3tools/contracts"; |
| 2 | import { Atom } from "effect/reactivity"; |
| 3 | |
| 4 | import { createEnvironmentRpcCommand, createEnvironmentRpcQueryAtomFamily } from "./runtime.ts"; |
| 5 | import type { EnvironmentRegistry } from "../connection/registry.ts"; |
| 6 | import * as Persistence from "../platform/persistence.ts"; |
| 7 | import { vcsCommandConcurrency, vcsCommandScheduler } from "./vcsCommandScheduler.ts"; |
| 8 | import { invalidateCachedVcsRefs } from "./vcsRefInvalidation.ts"; |
| 9 | |
| 10 | export function createGitEnvironmentAtoms<R, E>( |
| 11 | runtime: Atom.AtomRuntime<EnvironmentRegistry | Persistence.EnvironmentCacheStore | R, E>, |
| 12 | ) { |
| 13 | return { |
| 14 | pullRequestResolution: createEnvironmentRpcQueryAtomFamily(runtime, { |
| 15 | label: "environment-data:git:resolve-pull-request", |
| 16 | tag: WS_METHODS.gitResolvePullRequest, |
| 17 | }), |
| 18 | preparePullRequestThread: createEnvironmentRpcCommand(runtime, { |
| 19 | label: "environment-data:git:prepare-pull-request-thread", |
| 20 | tag: WS_METHODS.gitPreparePullRequestThread, |
| 21 | scheduler: vcsCommandScheduler, |
| 22 | concurrency: vcsCommandConcurrency, |
| 23 | onSettled: ({ environmentId, input }, registry) => |
| 24 | invalidateCachedVcsRefs(registry, { environmentId, cwd: input.cwd }), |
| 25 | }), |
| 26 | }; |
| 27 | } |