@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

main
ts 34 lines 1.36 KB
Raw
1 import * as HttpApiEndpoint from "effect/http-api/HttpApiEndpoint";
2 import * as HttpApiGroup from "effect/http-api/HttpApiGroup";
3 /**
4 * The `protocol` group: git smart HTTP v0 at the repository's root path.
5 * The routes are streaming binary (pkt-lines in, sideband packs out),
6 * decode repository path parameters and return the binary response they build.
7 * Use handleRaw to keep request bodies streaming through API middleware.
8 *
9 * `:repo` may carry a `.git` suffix; the handlers strip it.
10 */
11 import { RepoPath, RepoNotFound, PushDenied } from "./Schema.ts";
12
13 /** `GET /:owner/:repo/info/refs?service=…`: the ref advertisement. */
14 export const InfoRefs = HttpApiEndpoint.get("infoRefs", "/:owner/:repo/info/refs", {
15 params: RepoPath,
16 error: [RepoNotFound, PushDenied],
17 });
18
19 /** `POST /:owner/:repo/git-upload-pack`: clone and fetch. */
20 export const UploadPack = HttpApiEndpoint.post("uploadPack", "/:owner/:repo/git-upload-pack", {
21 params: RepoPath,
22 error: [RepoNotFound, PushDenied],
23 });
24
25 /** `POST /:owner/:repo/git-receive-pack`: push. */
26 export const ReceivePack = HttpApiEndpoint.post("receivePack", "/:owner/:repo/git-receive-pack", {
27 params: RepoPath,
28 error: [RepoNotFound, PushDenied],
29 });
30
31 /** The git wire protocol, mounted at the root. */
32 export class Protocol extends HttpApiGroup.make("protocol", {
33 topLevel: true,
34 }).add(InfoRefs, UploadPack, ReceivePack) {}