@devries-cameron20 / t3code Mirror · read-only / commits / 03822a8312
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, 07:15 UTC

fix(shared): Latin letters such as ł, ø, þ and ı no longer split words in generated folder and branch names (#38540)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Fuksss committed Nov 18, 2026 at 11:47 UTC 03822a83126be699c806e5e90f54c6e93cbbbabf
3 files changed +39 -5
packages/shared/src/git.test.ts
+3
@@ -369,6 +369,9 @@ describe("sanitizeFeatureBranchName", () => {
369 "feature/grosse-der-strasse-korrigieren",
370 );
371 expect(sanitizeFeatureBranchName("fix/Đặt tên")).toBe("fix/dat-ten");
372 + expect(sanitizeFeatureBranchName("Napraw błąd w żółtym przycisku")).toBe(
373 + "feature/napraw-blad-w-zoltym-przycisku",
374 + );
375 });
376 });
377
packages/shared/src/path.test.ts
+2
@@ -31,6 +31,8 @@ describe("path helpers", () => {
31 expect(newProjectFolderName(" Café & Crème! ")).toBe("cafe-creme");
32 expect(newProjectFolderName("Đặt tên dự án")).toBe("dat-ten-du-an");
33 expect(newProjectFolderName("Straßenbahn GROẞ")).toBe("strassenbahn-gross");
34 + expect(newProjectFolderName("Łódź sklep")).toBe("lodz-sklep");
35 + expect(newProjectFolderName("Øl på Þingvellir ı")).toBe("ol-pa-thingvellir-i");
36 expect(newProjectFolderName("../../etc")).toBe("etc");
37 expect(newProjectFolderName("🎱🎱")).toBe("project");
38 expect(newProjectFolderName(`${"a".repeat(63)} b`)).toBe("a".repeat(63));
packages/shared/src/path.ts
+34 -5
@@ -63,15 +63,44 @@ export function normalizeProjectPathForComparison(value: string): string {
63 // Windows refuses these as file names, with or without an extension.
64 const WINDOWS_RESERVED_NAME = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/;
65
66 +// Latin letters NFKD leaves whole (ł, ø, ß) or splits with a spacing mark (Ŀ, ʼn).
67 +const LATIN_FOLDS: Record<string, string> = {
68 + Ŀ: "L",
69 + ŀ: "l",
70 + ʼn: "'n",
71 + Đ: "D",
72 + đ: "d",
73 + Ð: "D",
74 + ð: "d",
75 + ß: "ss",
76 + ẞ: "SS",
77 + Ł: "L",
78 + ł: "l",
79 + Ø: "O",
80 + ø: "o",
81 + Æ: "AE",
82 + æ: "ae",
83 + Œ: "OE",
84 + œ: "oe",
85 + Þ: "TH",
86 + þ: "th",
87 + Ħ: "H",
88 + ħ: "h",
89 + ı: "i",
90 + ĸ: "q",
91 + Ŋ: "N",
92 + ŋ: "n",
93 + Ŧ: "T",
94 + ŧ: "t",
95 +};
96 +const LATIN_FOLD_PATTERN = new RegExp(`[${Object.keys(LATIN_FOLDS).join("")}]`, "g");
97 +
98 /** Folds accented Latin letters to ASCII ("tìm" -> "tim"); other scripts pass through. */
99 export function foldLatinDiacritics(text: string): string {
100 return text
101 + .replace(LATIN_FOLD_PATTERN, (letter) => LATIN_FOLDS[letter] ?? letter)
102 .normalize("NFKD")
70 - .replace(/[\u0300-\u036f]/g, "")
71 - .replace(/đ/g, "d") // d-with-stroke and sharp s have no Unicode decomposition
72 - .replace(/Đ/g, "D")
73 - .replace(/ß/g, "ss")
74 - .replace(/ẞ/g, "SS");
103 + .replace(/[\u0300-\u036f]/g, "");
104 }
105
106 export function newProjectFolderName(name: string): string {