@devries-cameron20 / t3code-1 / commits / 1c8e79ec18
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(mcp): accept GitCafe pull request URLs in link/unlink/watch tools (#23899)

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

Julius Marminge committed Oct 22, 2026 at 17:23 UTC 1c8e79ec18a77dd22cbd7f69e6ecc1d457c0e80d
4 files changed +38 -2
apps/server/src/mcp/toolkits/pullRequests/handlers.test.ts
+18
@@ -265,6 +265,24 @@ describe("pull request toolkit handlers", () => {
265 }),
266 );
267
268 + it.effect("links a GitCafe pull request by its canonical /pull/ URL", () =>
269 + Effect.gen(function* () {
270 + const harness = yield* makeHarness();
271 + const result = yield* harness.call("link_pull_request", {
272 + url: "https://git.cafe/pingdotgg/t3code/pull/23897",
273 + });
274 + expect(result).toMatchObject({
275 + host: "git.cafe",
276 + repository: "pingdotgg/t3code",
277 + number: 23897,
278 + alreadyLinked: false,
279 + });
280 + expect(yield* Ref.get(harness.commands)).toMatchObject([
281 + { type: "thread.pull-request.link", host: "git.cafe", number: 23897 },
282 + ]);
283 + }),
284 + );
285 +
286 it.effect("watching an unlinked pull request links it first", () =>
287 Effect.gen(function* () {
288 const harness = yield* makeHarness();
packages/shared/src/changeRequestUrl.test.ts
+17
@@ -19,6 +19,20 @@ describe("parseChangeRequestUrl", () => {
19 });
20 });
21
22 + it("reads a GitCafe pull request at its canonical /pull/ path and the older /pulls/ path", () => {
23 + for (const path of ["pull", "pulls"]) {
24 + expect(
25 + parseChangeRequestUrl(`https://git.cafe/PingDotGG/T3Code/${path}/23897`),
26 + path,
27 + ).toEqual({ host: "git.cafe", repository: "pingdotgg/t3code", number: 23897 });
28 + }
29 + expect(parseChangeRequestUrl("https://staging.git.cafe/team/repo/pull/7/files")).toEqual({
30 + host: "staging.git.cafe",
31 + repository: "team/repo",
32 + number: 7,
33 + });
34 + });
35 +
36 it("reads Forgejo URLs even when the hostname contains github", () => {
37 expect(parseChangeRequestUrl("https://github.internal/team/repo/pulls/7")).toEqual({
38 host: "github.internal",
@@ -106,6 +120,9 @@ describe("parseChangeRequestUrl", () => {
120 it("claims nothing it cannot be sure of", () => {
121 for (const link of [
122 "https://github.com/t3tools/t3code/issues/123",
123 + "https://git.cafe/pingdotgg/t3code/issues/23897",
124 + "https://git.cafe/pingdotgg/t3code/pull/abc",
125 + "https://git.cafe/pingdotgg/t3code",
126 "https://github.com/t3tools/t3code/commit/0a1b2c3",
127 "https://github.com/t3tools/t3code",
128 "https://github.com/t3tools/t3code/pull/abc",
packages/shared/src/changeRequestUrl.ts
+2 -1
@@ -29,7 +29,8 @@ export function parseChangeRequestUrl(targetUrl: string): ChangeRequestLink | nu
29 const host = url.hostname.toLowerCase();
30
31 if (host === "git.cafe" || host === "staging.git.cafe") {
32 - const match = /^\/([^/]+\/[^/]+)\/pulls\/(\d+)(?:\/|$)/u.exec(url.pathname);
32 + // GitCafe serves pull requests at `/pull/<n>` and redirects the older `/pulls/<n>` there.
33 + const match = /^\/([^/]+\/[^/]+)\/pulls?\/(\d+)(?:\/|$)/u.exec(url.pathname);
34 if (match) return claim(host, match);
35 } else {
36 if (isHostOf(host, "github.com", "github")) {
packages/source-control-gitcafe/src/client/definition.ts
+1 -1
@@ -71,7 +71,7 @@ export const definition = defineSourceControlClient({
71 try {
72 return (
73 GITCAFE_HOSTS.has(new URL(url).hostname.toLowerCase()) &&
74 - isChangeRequestPath(url, "/pulls/")
74 + (isChangeRequestPath(url, "/pull/") || isChangeRequestPath(url, "/pulls/"))
75 );
76 } catch {
77 return false;