1import { WS_METHODS } from "@t3tools/contracts";
2import { Atom } from "effect/reactivity";
3
4import { createEnvironmentRpcCommand, createEnvironmentRpcQueryAtomFamily } from "./runtime.ts";
5import type { EnvironmentRegistry } from "../connection/registry.ts";
6import { vcsCommandConcurrency, vcsCommandScheduler } from "./vcsCommandScheduler.ts";
7
8export function createGitEnvironmentAtoms<R, E>(
9 runtime: Atom.AtomRuntime<EnvironmentRegistry | R, E>,
10) {
11 return {
12 pullRequestResolution: createEnvironmentRpcQueryAtomFamily(runtime, {
13 label: "environment-data:git:resolve-pull-request",
14 tag: WS_METHODS.gitResolvePullRequest,
15 }),
16 preparePullRequestThread: createEnvironmentRpcCommand(runtime, {
17 label: "environment-data:git:prepare-pull-request-thread",
18 tag: WS_METHODS.gitPreparePullRequestThread,
19 scheduler: vcsCommandScheduler,
20 concurrency: vcsCommandConcurrency,
21 }),
22 };
23}