[Bug]: Non-Latin feature descriptions produce a nameless branch/directory (001-, 004-, ...)
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
调研方向
从 .specify/scripts/powershell/create-new-feature.ps1 中的 Get-BranchName 开始,然后比较对应的 Bash 和 Python 实现。使用仅包含 CJK 字符的描述重现空后缀,确定建议的行为中哪一种是可接受的,并添加回归测试以证明生成的分支和目录不再没有名称。
由索引模型根据 Issue 内容生成。
描述
What happened
A feature description written entirely in a non-Latin script produces a branch and directory with no name at all — just the number and a trailing dash. Every such feature looks identical apart from its number.
specify init demo --integration claude
./.specify/scripts/powershell/create-new-feature.ps1 -Json "给倒推引擎加正推能力"
# {"BRANCH_NAME":"001-", ... "specs\\001-\\spec.md"}
./.specify/scripts/powershell/create-new-feature.ps1 -Json "客户邮件审核队列"
# {"BRANCH_NAME":"004-", ... "specs\\004-\\spec.md"}
Resulting tree — two unrelated features, indistinguishable:
specs/
├── 001-/
├── 004-/
└── 005-mail-review-queue/ # same description, but with -ShortName
For comparison, on the same install:
| Description | BRANCH_NAME |
|---|---|
给倒推引擎加正推能力 |
001- |
add forward scheduling engine |
002-forward-scheduling-engine |
forward 正推 engine |
003-forward-engine (Latin words kept, rest dropped) |
Why this is not the already-known crash
Get-BranchName in create-new-feature.ps1 already carries a comment describing this path — a previous fix stopped it throwing ArgumentNullException and made it return an empty suffix instead, matching the bash and Python twins. That fix is correct as far as it goes: the script no longer dies.
But the outcome it settles on is a directory name that carries no information. The empty suffix is a reasonable internal result; it just isn't a usable name. For a team working in Chinese, Japanese, Korean, Arabic, Hebrew, Thai, Greek, or Cyrillic, this is the default path, not an edge case — every feature they create lands in NNN-.
The root cause is the character class, in two places:
# line 89
$Name.ToLower() -replace '[^a-z0-9]', '-' ...
# line 136
$Description.ToLower() -replace '[^a-z0-9\s]', ' '
Both drop every non-ASCII character, so a CJK description reduces to the empty string before stop-word filtering ever runs.
Suggested directions
Listed roughly by cost; any one of them removes the nameless directory.
- Warn and point at the escape hatch.
-ShortNamealready works (005-mail-review-queueabove). When the computed suffix is empty, print a line saying the description produced no usable branch name and that-ShortName <name>sets one. Cheapest fix, and it turns a silent surprise into a choice. - Fall back to something stable instead of nothing. A short hash or timestamp of the description —
001-f3a9c2,001-20260914— is still opaque, but at least distinct per feature. - Widen the character class. Keep Unicode letters and digits (
\p{L}\p{N}) and percent-encode or transliterate what git cannot take. Git branch names do accept UTF-8, so001-客户邮件审核队列is a legal ref; whether it is desirable is a separate call, and tooling downstream may not all agree.
(1) alone would have saved the confusion here. (3) is the real fix but needs a decision about non-ASCII refs that is yours to make, not mine.
Environment
- specify-cli
1.0.7.dev0(gitd848fb4), installed viauv tool install - Windows 11, PowerShell 5.1, Python 3.13.7, git 2.49.0.windows.1
--scriptauto-selectedpowershell
Not PowerShell-specific — reproduced on both script backends:
specify init demo-sh --integration claude --script sh
bash .specify/scripts/bash/create-new-feature.sh --json "给倒推引擎加正推能力"
# {"BRANCH_NAME":"001-", ... "specs/001-/spec.md"}
- 主要语言
- Python
- 星标
- 138k
- 派生
- 12.4k
- 平均合并
- 3 天 2 小时
- 30 天内合并 PR
- 169
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/spec-kit 的其他 Issue
-
enhancement needs-triage triage-can-wait
难度 2/5 1-3 小时 新手友好度 65/100
-
preset-submission triage-must-have validation-passed
难度 2/5 1-3 小时 新手友好度 75/100
-
extension-submission triage-must-have validation-passed
难度 2/5 1-3 小时 新手友好度 70/100
-
extension-submission triage-can-wait validation-passed
难度 2/5 1-3 小时 新手友好度 76/100
-
enhancement needs-triage triage-can-wait
难度 2/5 1-3 小时 新手友好度 65/100
相似的 Issue
-
area: harness bug status: needs-triage
难度 2/5 1-3 小时 新手友好度 75/100
Human-Agent-Society/reef#625 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 1/5 1 小时以内 新手友好度 80/100
learningequality/kolibri#15351 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
Name consistency 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
eellak/triplestore#65 · 1 条评论 ·