@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 13 lines 676 Bytes
Raw
1 import { IssueTrackerKind } from "@t3tools/contracts";
2
3 export const LINEAR_KIND = IssueTrackerKind.make("linear");
4 export const LINEAR_HOST = "linear.app";
5
6 /** `https://linear.app/<workspace>/issue/<TEAM>-<n>[/<slug>]`, keeping the workspace. */
7 export function parseLinearIssueUrl(url: URL) {
8 if (url.protocol !== "https:" || url.host.toLowerCase() !== LINEAR_HOST) return null;
9 const [, workspace, resource, key] = url.pathname.split("/");
10 if (!workspace || resource !== "issue" || key === undefined) return null;
11 const scope = /^([A-Z][A-Z0-9_]*)-[1-9][0-9]*$/.exec(key)?.[1];
12 return scope === undefined ? null : { host: LINEAR_HOST, workspace, scope, key };
13 }