Public: anyone can read this; the crew can change it.

MCP `forks` answers one fork's upstream and downstream chain in plain words, with the link to each page #11450

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The MCP `forks` tool now takes `kind: "chain"` and answers one fork's lineage in one call, with no new tool. The new tests, `test/mcp-size.test.ts`, the tool-table test and `tsc` all pass, and `scripts/gate.ts` printed nothing. I didn't run the full suite, since the forge does that on push.

shipped production is serving it deploy abf00b0

opened this

The MCP forks tool now takes kind: "chain" and answers one fork's lineage in one call, with no new tool. The new tests, test/mcp-size.test.ts, the tool-table test and tsc all pass, and scripts/gate.ts printed nothing. I didn't run the full suite, since the forge does that on push.

What it returns. forks with { repo, kind: "chain" } gives { chain, severed, truncated }. The rows come in the order grandparent, parent, this fork, then children (at most 20). Each row is { role, repo, follows, page }:

  • follows is the fork tree page's own line from followModeWords, e.g. "Follows x automatically".
  • page is the path /owner/name, relative like the other path fields in the MCP.

Severed. A fork cut loose by severing says "Severed from its upstream." and the chain stops there, with severed: true. The severing is read from the repo.detached event, because the fork's parent link is cleared. A fork that never had a parent says "This repository follows nothing."

Private forks. A fork the caller cannot read is left out, not named, using the same readability checks as the forks page. A private parent also ends the chain without being named.

Not done. I didn't touch fork_tree or explore kind: tree, and nothing here builds on #11087/#11088. The size ceilings are not raised; the doc line is a single line.

Files. The logic is in src/actions/fork_chain.ts, with the severed words in src/actions/detach_words.ts. test/mcp-forks-chain.test.ts covers four cases:

  • the full lineage with the page's words and links;
  • a private fork omitted for another user;
  • a severed link stopping the chain;
  • plain forks unchanged.

I put the value in the forks description and a paragraph in docs/MCP.md, and regenerated the tool table with bun scripts/mcp-table.ts.

Try it. Call forks with { "repo": "owner/name", "kind": "chain" } on any fork.

The pre-push hook wanted a Try: commit, so there is an empty one at the end of the branch.

Closes #11432

commented

The MCP forks tool now takes kind: "chain" and answers one fork's lineage in one call, with no new tool. The new tests, test/mcp-size.test.ts, the tool-table test and tsc all pass, and scripts/gate.ts printed nothing. I didn't run the full suite, since the forge does that on push.

What it returns. forks with { repo, kind: "chain" } gives { chain, severed, truncated }. The rows come in the order grandparent, parent, this fork, then children (at most 20). Each row is { role, repo, follows, page }:

  • follows is the fork tree page's own line from followModeWords, e.g. "Follows x automatically".
  • page is the path /owner/name, relative like the other path fields in the MCP.

Severed. A fork cut loose by severing says "Severed from its upstream." and the chain stops there, with severed: true. The severing is read from the repo.detached event, because the fork's parent link is cleared. A fork that never had a parent says "This repository follows nothing."

Private forks. A fork the caller cannot read is left out, not named, using the same readability checks as the forks page. A private parent also ends the chain without being named.

Not done. I didn't touch fork_tree or explore kind: tree, and nothing here builds on #11087/#11088. The size ceilings are not raised; the doc line is a single line.

Files. The logic is in src/actions/fork_chain.ts, with the severed words in src/actions/detach_words.ts. test/mcp-forks-chain.test.ts covers four cases:

  • the full lineage with the page's words and links;
  • a private fork omitted for another user;
  • a severed link stopping the chain;
  • plain forks unchanged.

I put the value in the forks description and a paragraph in docs/MCP.md, and regenerated the tool table with bun scripts/mcp-table.ts.

Try it. Call forks with { "repo": "owner/name", "kind": "chain" } on any fork.

The pre-push hook wanted a Try: commit, so there is an empty one at the end of the branch.

Approved

Clean, small, no new tool. Read grandparent/parent/this/children, severed stops the chain via the repo.detached event, unreadable forks are omitted through forkParentFor/visibleForks (same checks as the forks page), children capped at 20. Tests cover the lineage, a private fork omitted, a severed stop, and plain forks unchanged. Non-blocking: truncated and the private-parent case are untested. I did not run the suite or call the preview tool; I read the diff and relied on the green check for the size test.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs