[Bug]: Non-Latin feature descriptions produce a nameless branch/directory (001-, 004-, ...)

Đang mở
#4,574 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
bash, git, powershell, python
Lĩnh vực
cli, tooling

Hướng nghiên cứu

Bắt đầu với Get-BranchName trong .specify/scripts/powershell/create-new-feature.ps1, sau đó so sánh các triển khai tương ứng bằng Bash và Python. Tái hiện hậu tố rỗng với một mô tả chỉ gồm các ký tự CJK, quyết định hành vi được đề xuất nào là chấp nhận được, và bổ sung kiểm thử hồi quy cho thấy branch và thư mục được tạo không còn không có tên.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug-assess bug-fix severity-low triage-nice-to-have
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.

  1. Warn and point at the escape hatch. -ShortName already works (005-mail-review-queue above). 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.
  2. 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.
  3. 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, so 001-客户邮件审核队列 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 (git d848fb4), installed via uv tool install
  • Windows 11, PowerShell 5.1, Python 3.13.7, git 2.49.0.windows.1
  • --script auto-selected powershell

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"}
Ngôn ngữ chính
Python
Star
138k
Fork
12.4k
Merge trung bình
3 ngày 6 giờ
Pull request đã merge (30 ngày)
136

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của github/spec-kit

Tất cả issue của github/spec-kit

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.