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

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

fix(web): terminal links keep route and pnpm paths in one piece (#30603)

tiliakoos committed Nov 5, 2026 at 23:32 UTC 1b14cb3d8cbe077168ef70e7268b39b2df7a3554
2 files changed +8 -2
apps/web/src/terminal-links.test.ts
+5 -1
@@ -125,7 +125,11 @@ describe("extractTerminalLinks", () => {
125 String.raw`żółć\main.ts:12`,
126 "src/cafe\u0301.ts:12",
127 "src/𐐀.ts:12",
128 - ])("keeps the complete Unicode relative path %s", (text) => {
128 + "src/app/[id]/page.tsx:3:10",
129 + "src/routes/(app)/+page.svelte:12:4",
130 + "node_modules/.pnpm/react@18.3.1/node_modules/react/index.js:12:5",
131 + "app/routes/posts.$id.tsx:5",
132 + ])("keeps the complete relative path %s", (text) => {
133 expect(extractTerminalLinks(`see ${text} for details`)).toEqual([
134 { kind: "path", text, start: 4, end: 4 + text.length },
135 ]);
apps/web/src/terminal-links.ts
+3 -1
@@ -31,8 +31,10 @@ const URL_PATTERN = /https?:\/\/[^\s"'`<>]+/giu;
31 const POWERSHELL_PROMPT_PATH_PATTERN = /^PS ((?:[A-Za-z]:[\\/]|\\\\|\/)[^>\r\n]*)>/u;
32 // Bare paths start only at a segment boundary: hover detection runs this on
33 // every frame, so separator-free output must not be rescanned at every suffix.
34 +// For the same reason `]` needs its `[`: trimming a long run of `]` is quadratic.
35 +// Parentheses count only before a slash, so `src/foo.ts(3,10)` stays a compiler location.
36 const FILE_PATH_PATTERN =
35 - /(?:~[\\/]|\.{1,2}[\\/]|\/|[A-Za-z]:[\\/]|\\\\)[^\s"'`<>]+|(?<![\p{L}\p{M}\p{N}._-])[\p{L}\p{M}\p{N}._-]+(?:[\\/][\p{L}\p{M}\p{N}._-]+)+(?::\d+){0,2}/gu;
37 + /(?:~[\\/]|\.{1,2}[\\/]|\/|[A-Za-z]:[\\/]|\\\\)[^\s"'`<>]+|(?<![\p{L}\p{M}\p{N}._-])[\p{L}\p{M}\p{N}._-]+(?:[\\/](?:[\p{L}\p{M}\p{N}._$+@-]|\[{1,2}[\p{L}\p{M}\p{N}._-]+\]{1,2}|\([\p{L}\p{M}\p{N}._-]+\)(?=[\\/]))+)+(?::\d+){0,2}/gu;
38 const QUOTED_FILE_PATH_PATTERN =
39 /(["'`])(?<path>(?:~[\\/]|\.{1,2}[\\/]|\/|[A-Za-z]:[\\/]|\\\\|[\p{L}\p{M}\p{N}._ -]+[\\/])[^\r\n]*?|[\p{L}\p{M}\p{N}._ -]+\.[\p{L}\p{M}\p{N}_-]+(?::\d+){0,2})\1(?<position>(?::\d+){0,2})/gu;
40 const TRAILING_PUNCTUATION_PATTERN = /[.,;!?]+$/;