MCPcopy Create free account
hub / github.com/cursor/plugins / prNumberFromUrl

Function prNumberFromUrl

orchestrate/skills/orchestrate/scripts/core/handoff.ts:97–116  ·  view source on GitHub ↗
(rawUrl: string)

Source from the content-addressed store, hash-verified

95}
96
97function prNumberFromUrl(rawUrl: string): number | null {
98 let url: URL;
99 try {
100 url = new URL(rawUrl);
101 } catch {
102 return null;
103 }
104 const parts = url.pathname.split("/").filter(Boolean);
105 const pullIndex = parts.indexOf("pull");
106 if (pullIndex < 0 || pullIndex + 1 >= parts.length) return null;
107 if (url.hostname === "review.cursor.com") {
108 if (parts[0] !== "github" || pullIndex !== 3) return null;
109 } else if (url.hostname === "github.com") {
110 if (pullIndex !== 2) return null;
111 } else {
112 return null;
113 }
114 const number = Number.parseInt(parts[pullIndex + 1], 10);
115 return Number.isInteger(number) && number > 0 ? number : null;
116}
117
118function readSectionValue(args: {
119 handoff: string;

Callers 1

parseHandoffPrNumberFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected