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 { AuthOrchestrationReadScope, EnvironmentHttpApi } from "@t3tools/contracts"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as HttpApiBuilder from "effect/http-api/HttpApiBuilder"; |
| 4 | |
| 5 | import { annotateEnvironmentRequest, requireEnvironmentScope } from "../auth/http.ts"; |
| 6 | import { traceLocalHandlerWork } from "../cloud/traceRelayRequest.ts"; |
| 7 | import * as PullRequestService from "./PullRequestService.ts"; |
| 8 | |
| 9 | // Large patches benefit from HTTP compression and flow control. |
| 10 | export const layer = HttpApiBuilder.group( |
| 11 | EnvironmentHttpApi, |
| 12 | "pullRequests", |
| 13 | Effect.fnUntraced(function* (handlers) { |
| 14 | const pullRequests = yield* PullRequestService.PullRequestService; |
| 15 | return handlers.handle( |
| 16 | "diff", |
| 17 | Effect.fn("environment.pullRequests.diff")(function* (args) { |
| 18 | yield* annotateEnvironmentRequest(args.endpoint.name); |
| 19 | yield* requireEnvironmentScope(AuthOrchestrationReadScope); |
| 20 | return yield* pullRequests.diff(args.payload).pipe(traceLocalHandlerWork); |
| 21 | }), |
| 22 | ); |
| 23 | }), |
| 24 | ); |