Support non-Latin (e.g. Japanese) task titles in branch/worktree names - #2974
Support non-Latin (e.g. Japanese) task titles in branch/worktree names#2974aburada-ai wants to merge 1 commit into
Conversation
nbranch transliterates input to ASCII and drops non-Latin scripts
entirely, so a Japanese task title collapsed to a generic
"feat-unknown" slug. Non-Latin titles now bypass nbranch and are
slugified directly with a Unicode-aware sanitizer (\p{L}\p{N}- instead
of a-z0-9-), preserving the original characters in the branch name and
worktree folder name. Same fix applied to the EMDASH_TASK_NAME env var
slugify helper.
Greptile SummaryThe PR adds Unicode-aware task and environment-name sanitization and bypasses nbranch for non-ASCII titles.
Confidence Score: 4/5The worktree-path collision and combining-mark corruption should be fixed before merging. Preserved Unicode branch names still collapse under the downstream ASCII-only worktree sanitizer, while the new allowlist corrupts scripts whose letters require combining marks. Files Needing Attention: apps/emdash-desktop/src/main/core/tasks/name-generation/generateTaskName.ts, apps/emdash-desktop/src/main/core/workspaces/workspace-env.ts
|
| Filename | Overview |
|---|---|
| apps/emdash-desktop/src/main/core/tasks/name-generation/generateTaskName.ts | Preserves Unicode titles, but exposes collisions in downstream worktree paths and strips combining marks from several scripts. |
| apps/emdash-desktop/src/main/core/tasks/name-generation/generateTaskName.test.ts | Covers Japanese characters and punctuation but does not exercise combining-mark scripts or downstream worktree naming. |
| apps/emdash-desktop/src/main/core/workspaces/workspace-env.ts | Makes EMDASH_TASK_NAME Unicode-aware but repeats the combining-mark omission. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Non-Latin task title] --> B[generateTaskName preserves Unicode]
B --> C[Git branch name]
C --> D[ASCII-only worktree path sanitizer]
D --> E[Unicode characters become hyphens]
B --> F[workspace-env slugify]
F --> G[EMDASH_TASK_NAME]
Prompt To Fix All With AI
### Issue 1
apps/emdash-desktop/src/main/core/tasks/name-generation/generateTaskName.ts:9
**Unicode worktree paths still collide**
When distinct non-Latin task titles reach worktree creation, this sanitizer preserves the Unicode branch names but the downstream ASCII-only worktree sanitizer replaces every non-ASCII character with hyphens, causing different branches to resolve to the same worktree directory.
### Issue 2
apps/emdash-desktop/src/main/core/tasks/name-generation/generateTaskName.ts:9
**Combining marks are stripped**
When a title uses combining marks, including common Devanagari vowel signs or Arabic diacritics, this allowlist replaces those marks with hyphens because it omits Unicode category `M`, corrupting the generated task name and allowing distinct words to collapse to the same slug.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "Support non-Latin task titles in generat..." | Re-trigger Greptile
| return raw | ||
| .toLowerCase() | ||
| .replace(/[^a-z0-9-]/g, '-') | ||
| .replace(/[^\p{L}\p{N}-]/gu, '-') |
There was a problem hiding this comment.
Unicode worktree paths still collide
When distinct non-Latin task titles reach worktree creation, this sanitizer preserves the Unicode branch names but the downstream ASCII-only worktree sanitizer replaces every non-ASCII character with hyphens, causing different branches to resolve to the same worktree directory.
Context Used: AGENTS.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/emdash-desktop/src/main/core/tasks/name-generation/generateTaskName.ts
Line: 9
Comment:
**Unicode worktree paths still collide**
When distinct non-Latin task titles reach worktree creation, this sanitizer preserves the Unicode branch names but the downstream ASCII-only worktree sanitizer replaces every non-ASCII character with hyphens, causing different branches to resolve to the same worktree directory.
**Context Used:** AGENTS.md ([source](https://github.com/generalaction/emdash/blob/main/AGENTS.md))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| return raw | ||
| .toLowerCase() | ||
| .replace(/[^a-z0-9-]/g, '-') | ||
| .replace(/[^\p{L}\p{N}-]/gu, '-') |
There was a problem hiding this comment.
When a title uses combining marks, including common Devanagari vowel signs or Arabic diacritics, this allowlist replaces those marks with hyphens because it omits Unicode category M, corrupting the generated task name and allowing distinct words to collapse to the same slug.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/emdash-desktop/src/main/core/tasks/name-generation/generateTaskName.ts
Line: 9
Comment:
**Combining marks are stripped**
When a title uses combining marks, including common Devanagari vowel signs or Arabic diacritics, this allowlist replaces those marks with hyphens because it omits Unicode category `M`, corrupting the generated task name and allowing distinct words to collapse to the same slug.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary
nbranch, which transliterates input to ASCII and drops non-Latin scripts entirely — a Japanese task title collapses to a genericfeat-unknownslug instead of preserving any of the original title.nbranchand are slugified directly with a Unicode-aware sanitizer (\p{L}\p{N}-instead ofa-z0-9-}), so the original characters (Japanese, etc.) are preserved in the generated branch name and worktree folder name.EMDASH_TASK_NAMEenv var slugify helper inworkspace-env.tsfor consistency.Test plan
generateTaskName.test.tscovering a Japanese title and a Japanese title containing unsafe characters (/, parentheses, spaces).