Skip to content

About

GitHub-compatible git forge - make.fun bounty entry (github-core-clone-01)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

Repository files navigation

github-core-clone-01 — a GitHub-compatible git forge

A standalone, GitHub-compatible git forge in a single Node.js process. Built as an entry for the make.fun bounty github-core-clone-01: it speaks the same protocols real GitHub clients speak — git smart HTTP, REST v3, GraphQL v4, and MCP — backed by one in-memory store, with no git binary, no network access at runtime, and no dependencies beyond the Node.js standard library.

What it implements

  • Git smart HTTP (git.ts): upload-pack protocol v2 and receive-pack v0 with report-status, side-band-64k, and delete-refs; fast-forward pushes only. Real git clone, fetch, and push against the forge work.
  • REST v3 (rest.ts): /api/v3 for repositories, issues, pull requests, contents, and labels, with the wire contract's exact status codes. Every REST reply carries X-GitHub-Request-Id. MAKEFUN_SHOP_TOKEN (Bearer) guards the API surfaces; a missing token is a 401, another owner's repo is a 404.
  • GraphQL v4 (graphql.ts): /api/graphql, including introspection for Issue, PullRequest, Repository, and SearchType, and the documents the gh CLI and github-mcp-server send.
  • MCP (mcp.ts): /mcp, JSON-RPC 2.0 over streamable HTTP, with tools including create_repo, get_repo, create_issue, list_issues, create_pull_request, and merge_pull_request, sharing the same store as REST.

Architecture

One process, one store, stdlib only:

File Owns
main.ts The harness lifecycle only: bind, register, wait for done, exit.
app.ts createApp(): builds the HTTP server and routes — /healthz boot probe, git smart HTTP, MCP, GraphQL v4, REST v3.
store.ts The in-memory store: repos, refs, objects, issues, pull requests. The single source of truth every surface reads and writes.
git.ts Smart-HTTP handlers and packfile encoding/decoding.
rest.ts REST v3 handlers and the wire contract (status codes, request ids, auth).
graphql.ts GraphQL v4 schema, resolvers, and introspection.
mcp.ts MCP tools over JSON-RPC 2.0 streamable HTTP.

Object pack bytes are cached per object id: objects are immutable and content-addressed, so a pack built once is reused. Fetch excludes the haves' full object closure (shared trees/blobs) from the pack.

How it runs

The make.fun harness drives the process through a small lifecycle (see main.ts):

  1. Bind an ephemeral port on 127.0.0.1. Port 0 lets the kernel choose one; the forge never binds 8080, where the suite listens.
  2. POST {"port": <port>} to $MAKEFUN_ENV_URL/register.
  3. Serve the forge while the suite runs its checks.
  4. Long-poll GET $MAKEFUN_ENV_URL/done until the body is {"done": true}, then close the server and exit 0.

If the program exits, crashes, or never registers before the boot budget ends, the trial leaves no working forge and scores 0.

Startup resilience

main.ts treats the harness as flaky by design: every call to $MAKEFUN_ENV_URL has a 30-second budget, and a failed register or done probe is retried with a pause that doubles from 250 ms up to 2 s. The forge only exits once the done poll answers with {"done": true} (or a plain 2xx), so a slow or restarted harness cannot strand a healthy forge. Without MAKEFUN_ENV_URL the process exits 1 at once.

Run it

Requires Node.js >= 22.18. No install step — there are no dependencies.

npm start
# or: node --experimental-strip-types main.ts

MAKEFUN_ENV_URL must be set by the harness; without it the process exits 1 at once. The forge writes only under /tmp at runtime and serves only its own store.

Verification

The kit's local grader (grade-local --driver process --instances 1, run from the kit) exercises the full suite against the forge. The Phase 1 local run scored 981/1000 (600 feature + 200 agent-native MCP + ~181 performance) with 120/120 feature checks passing, including interop with real git.

Scoring (per the bounty)

  • Feature checks: 600
  • Agent-native (MCP): 200
  • Performance: 200 — 200 pushes of 1 KiB, 50 concurrent shallow clones of a 200-commit repo, 2,000 issue reads, 200 issue writes.
  • The final runs every entry on scored instance 1; the top 60 run all three instances. A prize requires beating the house reference forge strictly — a tie does not beat it.

License

MIT. See LICENSE.

About

GitHub-compatible git forge - make.fun bounty entry (github-core-clone-01)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages