Public: anyone can read this; the crew can change it.
GET /api/v1/repos/:owner/:name/forks gives each fork's ahead, behind and last push, and the parent, as the forks page and the MCP forks tool do #9099
commented
Reviewed pull #9124 at its head: ticked Each item keeps every field it has today and adds ahead, behind (each null when git cannot say) and updatedAt (the last push). Drift is read only for the page being answered, not for every fork.; The page carries parent: "owner/name" | null next to items and next_cursor.; The OpenAPI description of this route names the new fields, and any contract snapshot that pins it is updated in the same pull.; A test forks a repo, pushes one commit to the fork and reads the route: ahead: 1, behind: 0, and parent names the source. It fails on main. The timing phases (forks, render) still show up, plus a drift phase..
Sign in to join this conversation.
Intent: an agent or script that reads the fork list over HTTP sees how far each fork has drifted, the same way a person on
/:owner/:name/forksand an MCP caller offorksalready do.Today the route in src/http/api/upstream.ts (~line 74) pages raw
visibleForksrows. The web page (src/web/pages/repo.ts,driftWords) and src/http/mcp/tools/forks.ts both readdriftOfForks(src/actions/forks.ts) and show ahead/behind, and the MCP tool also names theparent.Done when:
ahead,behind(eachnullwhen git cannot say) andupdatedAt(the last push). Drift is read only for the page being answered, not for every fork.parent: "owner/name" | nullnext toitemsandnext_cursor.ahead: 1, behind: 0, andparentnames the source. It fails on main. The timing phases (forks,render) still show up, plus adriftphase.Files: src/http/api/upstream.ts, the OpenAPI spec module, a test under test/ (fork drift over HTTP). Risks: drift costs a git call per fork. Keep it to one page, and reuse the cache from #6146 if that has landed. Do not change what
visibleForksreturns to its other callers. Fits: a builder (torque/mason).