Forge 120
by Avapage
README.md
[](https://make.fun/bounty/github-core-clone-01?utm_source=github&utm_medium=readme&utm_campaign=github-core-clone-01)
[](https://make.fun/bounty/github-core-clone-01/leaderboard?utm_source=github&utm_medium=readme&utm_campaign=github-core-clone-01)
[](https://make.fun/bounty/github-core-clone-01?utm_source=github&utm_medium=readme&utm_campaign=github-core-clone-01)
# Forge 120
A small, self-contained GitHub-core forge in a single Node.js process. It speaks
the four surfaces agents already use — git smart HTTP (protocol v2 and v0), the
REST v3 API subset, GraphQL v4, and an MCP server — over one in-memory store,
with no dependencies, no database and no `git` binary at runtime: the object
model, packfiles, pkt-line framing and the three-way merge are all implemented
in the entry itself.
The whole server is one authored TypeScript source, `src/forge.ts`; `main.ts`
is a thin bootstrap that imports and starts it. Node 22's standard library is
the only runtime requirement.
## Status
Rebuilt from scratch for round 2 of github-core-clone-01. The design notes and
run instructions below were written alongside the implementation.
## Architecture
Everything lives in `src/forge.ts`, in layers:
- **Store** — repositories are in-memory maps of git objects (commits, trees,
blobs, annotated tags) addressed by their SHA-1, plus refs, labels, issues,
pull requests and comments. Ids and timestamps come from a logical clock, so
replaying the same operations reproduces byte-identical state.
- **Git object model** — objects are hashed, parsed and rebuilt in-process;
packfiles are written plain (version 2, SHA-1 trailer) and read back with
OFS/REF delta resolution, including thin packs whose bases the client holds.
- **Git smart HTTP** — protocol v2 (`ls-refs` with server-side ref-prefix
filtering, peeled tags and unborn HEAD; `fetch` with shallow/deepen,
including `deepen-relative` and the two-round `wait-for-done` negotiation)
and protocol v0 for fetch and receive-pack, with report-status inside
side-band-64k when negotiated. Push validation covers stale refs, missing
objects and non-fast-forward rejection with git's exact reason strings.
- **REST v3 subset** — repos (create/list with `Link` pagination/get/patch/
delete), branches, commits, contents (create/update/delete with stale-sha
409), git refs, labels, issues with comments, and pull requests with file
diffs and squash/merge merges (405 on conflict). Every reply is JSON with an
`X-GitHub-Request-Id` header; errors are JSON with a `message`.
- **GraphQL** — a hand-written lexer/parser and executor covering the viewer,
repository/issue/pull-request fields, cursor-paginated issue connections,
the create/close/merge mutations, `node(id:)` round-trips with opaque global
ids, batched documents, and introspection for the types the API exposes.
Unknown fields answer HTTP 200 with an error naming the field.
- **MCP** — a JSON-RPC streamable-HTTP endpoint at `/mcp` speaking both the
modern `server/discover` era and the legacy `initialize` handshake, with six
tools (create/get repo, create/list issues, create/merge pull request) that
share the same store and id space as REST.
Auth is a single bearer token (`MAKEFUN_SHOP_TOKEN`); the git endpoints are
open, `/healthz` is unauthenticated, and every other surface answers 401
without the token.
## How to run
With the make.fun env (the graded path), the entry binds an ephemeral port,
registers it with `$MAKEFUN_ENV_URL/register`, serves until the env reports
done, and exits 0:
```
node main.ts
```
Standalone, for local testing, it serves on `FORGE_PORT` (default 8080):
```
MAKEFUN_SHOP_TOKEN=any-token FORGE_PORT=8080 node main.ts
```
## Verification
- The kit's local conformance suite (120 checks across git, repos, issues,
pulls, protocol, GraphQL and MCP) passes 120/120 against this entry.
- Real-git interop is verified with the system git client: clone (full and
`--depth 1`), push of branches and annotated tags, `fetch`, and repeated
`fetch --deepen 1` until the clone is unshallowed.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues