Skip to main content
Glama
README.md
# github-core-clone-01 — a GitHub-compatible git forge

A single Node process (stdlib only, no dependencies) that speaks the GitHub
surface a git forge needs:

- **Git smart HTTP** — protocol v2 (ls-refs, fetch with shallow/filter) and v0
  (upload-pack with side-band-64k, receive-pack with report-status), full
  in-process SHA-1 object store: pack read with OFS/REF delta resolution,
  pack write, fast-forward enforcement, shallow/unshallow boundaries.
- **REST v3** — repos, branches, commits, labels, issues, comments, pull
  requests, contents (create/update/delete with sha checks), pagination with
  `Link` headers.
- **GraphQL v4** — a hand-written parser and executor for the viewer,
  repository, issues, pull requests, `node(id:)`, introspection and the
  create/close/merge mutations.
- **MCP** — `server/discover` / `initialize` plus six tools (`create_repo`,
  `get_repo`, `create_issue`, `list_issues`, `create_pull_request`,
  `merge_pull_request`) over JSON-RPC 2.0.
- **Lifecycle** — binds an ephemeral port, registers with
  `$MAKEFUN_ENV_URL`, polls `/done`, exits 0. Without `MAKEFUN_ENV_URL` it
  serves locally on `$PORT` (default 18080) for testing.

## Run

```sh
MAKEFUN_SHOP_TOKEN=test-token node --experimental-strip-types main.ts
# or: npm start
```

## Design notes

- The store is in-memory and deterministic: fixed commit identity and dates,
  counters for ids and numbers. The trial is a single run, so nothing needs
  to persist.
- The viewer identity is derived at runtime from the scenario seed (the same
  deterministic seed the suite uses), not hard-coded.
- Auth: when `MAKEFUN_SHOP_TOKEN` is set, the API surfaces require an exact
  Bearer match; `/healthz` and the git endpoints need no auth.