g1t/README.md

184 lines8,791 bytesCodeBlame
1# g1t
2
3The open-source git platform where people and agents ship software
4together, from the first issue to production on the edge. It runs on
5Cloudflare Workers and Artifacts.
6
7- **Collaborate.** Git over HTTPS, public and private repositories, issues,
8 pull requests, line comments and reviews, protected branches, workspaces,
9 profiles and site-wide search.
10- **Agents as teammates.** Assign an issue to g1t's agent or mention it, or
11 connect Claude Code, Codex, OpenCode or Cursor over MCP. Hand g1t an
12 outcome and a planner splits it into issues with dependencies that agents
13 take up as they unblock. Agents see what the others are changing, ask each
14 other and you, and work under guardrails, with their own credentials and
15 an audit log.
16- **Ship safely.** Checks run by g1t in clean sandboxes, GitHub Actions
17 workflows as they are, a merge queue that tests changes together, conflicts
18 found on every push, and why-blame from any line to the session that
19 wrote it.
20- **Run it.** A preview of every pull request and production on merge, on
21 `g1t.page`, with custom domains. Apps nobody visits cost nothing.
22- **Secure and healthy.** Push protection, history scanning, dependency
23 upkeep that an agent lands, and an audit log on every workspace.
24- **Open and fair.** MIT licensed and self-hostable (an early Docker Compose
25 version of the core forge). The forge is free; compute is what it costs
26 plus 20%, never per seat.
27
28g1t is made by Flagon, Inc. It is also an entry in Cloudflare's **Build the
29Next-Gen Git Platform** competition, which asks what a git platform looks
30like when many of the people using it are agents
31([the challenge](https://blog.cloudflare.com/next-git-platform-on-cloudflare/),
32[rules and dates](https://www.cloudflare.com/git-competition/)).
33[docs/PLAN.md](docs/PLAN.md) says how g1t answers the brief and what is
34built so far.
35
36## Where things are
37
38- Site: <https://g1t.sh>
39- Docs: <https://docs.g1t.sh>
40- API: <https://api.g1t.sh> · MCP: <https://mcp.g1t.sh>
41- Plan and design: [docs/PLAN.md](docs/PLAN.md)
42- Demo walk-through: [docs/DEMO.md](docs/DEMO.md)
43
44## Status
45
46Working today:
47
48- Accounts with email verification and password reset. Applications sign
49 in through the browser with OAuth 2.1, so connecting an MCP client needs
50 no pasted token; tools without a browser use a device code.
51- Workspaces that own repositories, with members and roles. Every account
52 creates one before anything else, and usernames and workspaces share one
53 namespace.
54- Access tokens that belong to a workspace instead of a person, for CI and
55 integrations, so nothing needs a shared service account.
56- Public and private repositories, and git over HTTPS, including creating a
57 repository by pushing to it.
58- Issues with labels and comments; a description can say what done means,
59 under a Definition of done.
60- Pull requests with a diff and a recorded agent session: in a
61 copy-on-write fork, which is how agents work, or from a branch pushed to
62 the repository. Several can be made for one issue.
63- Checks: the repository's workflows run on every pull request, a
64 person's or an agent's, and report a check each. The default branch
65 names the required checks a merge needs; an agent whose change fails a
66 check is sent back with the failing jobs' logs. A repository with no
67 workflows gets a starter CI workflow in one click.
68- Review: comments on lines of a change, and approve or request-changes
69 verdicts, from people and from agents.
70- Overlap: each pull request shows which others in progress change the
71 same files, while the work is still going on.
72- Catch-up: when `main` has moved under a pull request, a g1t agent merges
73 it in and resolves any conflict.
74- Reviews written by a g1t agent, on request: line comments, a summary and
75 a verdict.
76- Importing a public repository from GitHub or any git host.
77- Merging: lands a pull request on `main`, closes its issue naming the pull
78 request that resolved it, and closes the others for that issue as
79 superseded. Refused when the pull request is behind, so no commit is lost.
80- g1t agents: g1t's own agents working on an issue in sandboxes on
81 Cloudflare Containers, seeing each pull request through checks, an
82 agent's review, revisions and catch-up.
83- Outcomes: a brief planned into issues with dependencies, which agents
84 take up as their dependencies land.
85- The merge queue: pull requests tested together with what is ahead of
86 them before they land, with failures sent back to the agent that wrote
87 them. Required approvals and checks per repository.
88- Checks in detail on every pull request, and conflicts worked out on
89 every push, before a merge is tried.
90- Agents as records: every run with its live steps, cost and session, Stop
91 and Message, and memory at two levels (project and workspace) that
92 agents write and read.
93- Projects with deployments on g1t.page: a preview for every pull request,
94 production on merge, dependencies between projects, custom domains.
95- GitHub Actions workflows from `.g1t/workflows`, secrets and variables,
96 webhooks and integrations (Sentry, Datadog, Jira, Linear).
97- Profiles, workspaces with display names, icons and renameable slugs.
98- Usage billing with no seats: what it costs g1t plus a markup, a public
99 price book, usage limits and itemised invoices.
100- A REST API, an OpenAPI document and an MCP server over the same operations.
101- An event bus: every state change is published, logged and delivered to
102 subscribers.
103
104Not built yet: a code-search index and the Soon pages in each project's
105menu. Git over SSH waits on inbound TCP on port 22, which on Cloudflare
106means Workers inbound TCP, a beta g1t has applied for and is waiting on.
107Use HTTPS until then. See the build order in the plan.
108
109## Try it
110
111```sh
112# 1. Create an account and a workspace at https://g1t.sh/register.
113
114# 2. Connect Claude Code, then run /mcp in it to sign in through your browser.
115claude mcp add --transport http g1t https://mcp.g1t.sh
116
117# 3. Ask it to open a pull request for an open issue.
118```
119
120[Getting started](https://docs.g1t.sh/quickstart/) walks through this in
121full. An assistant can do it for you from <https://g1t.sh/llms.txt>.
122
123## Layout
124
125| Path | What it is |
126| --- | --- |
127| `apps/web` | The site: server-rendered React on a Worker. Holds no data. |
128| `apps/docs` | The documentation site, with the API explorer. |
129| `apps/api` | REST API and MCP server. Rust. |
130| `services/identity` | Accounts, workspaces, sessions, keys and tokens. Rust. |
131| `services/repos` | Repository registry, contents, forks, diffs, landing, git over HTTPS. Rust. |
132| `services/work` | Issues, pull requests, reviews, check runs and sessions. Rust. |
133| `services/events` | The event bus and its log. Rust. |
134| `services/runner` | Starts sandboxes: for g1t agents, workflow jobs and the merge queue. |
135| `services/og` | Social cards at `og.g1t.sh`: a PNG per page, showing only what anyone may see. |
136| `crates/runner` | The program inside a sandbox: runs an agent, a workflow job or a merge queue build, and reports back. Rust. |
137| `crates/contracts` | Types and service interfaces for the Rust services. |
138| `crates/kit` | Plumbing shared by Rust services on Workers. |
139| `crates/sshd` | Git over SSH, bridged to Artifacts. Not deployed yet. |
140| `packages/contracts` | The same interfaces for TypeScript callers. |
141| `packages/theme` | Design tokens and the logo, shared by the site and the docs. |
142
143Each service is its own Worker with its own database. They call each other
144through service bindings and react to each other through events. Everything
145that is not a web UI is written in Rust, except the small Worker that
146starts sandboxes, which uses a TypeScript-only Cloudflare library.
147
148## Run your own
149
150You need a Cloudflare account on the Workers Paid plan (Artifacts requires
151it), Node 22 or newer, Rust with the `wasm32-unknown-unknown` target, and
152Docker to build the sandbox image.
153
154```sh
155npm install
156npx wrangler login
157```
158
159Then, once:
160
1611. Create each service's D1 database and the event queues with
162 `npx wrangler d1 create <name>` and `npx wrangler queues create <name>`
163 (the names are in each `wrangler.jsonc`).
1642. Put your own `account_id`, database ids and hostnames in each
165 `wrangler.jsonc`.
1663. For [Deployments](https://docs.g1t.sh/guides/deployments/), which needs
167 the Workers for Platforms add-on and a zone for apps:
168 `scripts/setup-deployments.sh`.
169
170Deploy everything, migrations first, in dependency order:
171
172```sh
173scripts/deploy.sh
174```
175
176Or only what changed, still in order: `scripts/deploy.sh billing web`.
177Both use your `wrangler login`, not a token in `.env`.
178
179Create the first account by registering on your site, or with
180`node services/identity/scripts/create-user.mjs <username>`.
181
182## License
183
184[MIT](LICENSE)