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

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

fix(server): keep Vietnamese words readable in scratch folder names (#30311)

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

Epistex committed Nov 15, 2026 at 06:29 UTC c62c7649f74a96d3a8d856a014c39d9f708cae29
4 files changed +22 -5
apps/server/src/project/ManagedProjectFolders.test.ts
+9
@@ -318,6 +318,15 @@ it.effect("gives each Scratch thread its own folder, named from its message", ()
318 );
319 assert.equal(path.dirname(pasted), root);
320 assert.isAtMost(path.basename(pasted).length, 80);
321 +
322 + const accented = Option.getOrThrow(
323 + yield* scratch.folderForThread({
324 + projectId,
325 + threadId: ThreadId.make("thread-diacritics"),
326 + text: "tìm kiếm skill",
327 + }),
328 + );
329 + assert.match(path.basename(accented), /^\d{4}-\d{2}-\d{2}-tim-kiem-skill-/);
330 }),
331 ),
332 );
apps/server/src/project/ManagedProjectFolders.ts
+2 -2
@@ -6,7 +6,7 @@ import {
6 type ThreadId,
7 VcsProcessSpawnError,
8 } from "@t3tools/contracts";
9 -import { newProjectFolderName } from "@t3tools/shared/path";
9 +import { foldLatinDiacritics, newProjectFolderName } from "@t3tools/shared/path";
10 import * as Cause from "effect/Cause";
11 import * as Context from "effect/Context";
12 import * as SecureRandom from "effect/crypto/SecureRandom";
@@ -133,7 +133,7 @@ export class ManagedProjectFolders extends Context.Service<
133 >()("t3/project/ManagedProjectFolders") {}
134
135 const folderWords = (text: string) =>
136 - text
136 + foldLatinDiacritics(text)
137 .toLowerCase()
138 .split(/[^a-z0-9]+/)
139 .filter(Boolean)
packages/shared/src/path.test.ts
+1
@@ -29,6 +29,7 @@ describe("path helpers", () => {
29 it("names a new project's folder from any typed name", () => {
30 expect(newProjectFolderName("Pinball Stats")).toBe("pinball-stats");
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("../../etc")).toBe("etc");
34 expect(newProjectFolderName("🎱🎱")).toBe("project");
35 expect(newProjectFolderName(`${"a".repeat(63)} b`)).toBe("a".repeat(63));
packages/shared/src/path.ts
+10 -3
@@ -63,10 +63,17 @@ 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 -export function newProjectFolderName(name: string): string {
67 - const slug = name
66 +/** Folds accented Latin letters to ASCII ("tìm" -> "tim"); other scripts pass through. */
67 +export function foldLatinDiacritics(text: string): string {
68 + return text
69 .normalize("NFKD")
69 - .replace(/[̀-ͯ]/g, "")
70 + .replace(/[\u0300-\u036f]/g, "")
71 + .replace(/đ/g, "d") // d-with-stroke has no Unicode decomposition
72 + .replace(/Đ/g, "D");
73 +}
74 +
75 +export function newProjectFolderName(name: string): string {
76 + const slug = foldLatinDiacritics(name)
77 .toLowerCase()
78 .replace(/[^a-z0-9]+/g, "-")
79 .replace(/^-+/, "")