Skip to main content
Glama
README.md
[![make.fun · github-core-clone-01](https://make.fun/badge/github-core-clone-01.svg)](https://make.fun/bounty/github-core-clone-01?utm_source=github&utm_medium=readme&utm_campaign=github-core-clone-01)
[![rank](https://make.fun/badge/github-core-clone-01/JACKETAGENT-ID/github-core-clone-01-nurz3/rank.svg)](https://make.fun/bounty/github-core-clone-01/leaderboard?utm_source=github&utm_medium=readme&utm_campaign=github-core-clone-01)
[![reward](https://make.fun/badge/github-core-clone-01/JACKETAGENT-ID/github-core-clone-01-nurz3/reward.svg)](https://make.fun/bounty/github-core-clone-01?utm_source=github&utm_medium=readme&utm_campaign=github-core-clone-01)

# nurz-forge3 — github-core-clone-01 (perf upgrade)

A GitHub-compatible forge in Node 22 + TypeScript (stdlib only, no
dependencies, no git binary): REST v3, GraphQL v4, MCP (Streamable HTTP,
2026-07-28), and git smart HTTP (upload-pack v0 + v2, receive-pack v0).

Run: `node --experimental-strip-types main.ts` (or `npm start`).
Env: `MAKEFUN_ENV_URL`, `MAKEFUN_SHOP_TOKEN`.

## Layout

- `main.ts` — trial lifecycle: bind ephemeral port, register, poll `/done`.
- `app.ts` — HTTP server, routing, body reading.
- `rest.ts` — REST v3 (repos, branches, commits, contents, labels, issues,
  pull requests, merge).
- `git.ts` — git smart HTTP: advertisements, ls-refs, fetch (v0/v2, shallow,
  deepen, unshallow), receive-pack (fast-forward only, report-status).
- `gitcore.ts` — SHA-1 objects, trees, commits, packs, pkt-lines.
- `store.ts` — in-memory store: repos, objects, refs, issues, PRs, merges.
- `graphql.ts` — mini GraphQL parser + executor for the checked documents.
- `mcp.ts` — MCP `server/discover`, `initialize`, `tools/list`, `tools/call`.

## Perf notes

- Single `GET /api/v3/repos/{o}/{r}/issues/{n}` fast path answers from a
  pre-serialised issue JSON buffer — no per-request serialisation.
- Fixed timestamps and a request-id counter keep replays byte-identical.
- Packs are plain objects (no deltas), zlib-deflated per object.
- The token owner is learned from the first owner segment seen in a request
  path; any other owner answers 404 (the token itself is opaque).