Fix hyphenated issue prefix detection (#199)

- update prefix/number parsing to use the last hyphen across utils and nodb paths
- add regression tests covering multi-hyphen prefixes in both packages
This commit is contained in:
Midworld Kim
2025-11-02 11:57:37 +09:00
committed by GitHub
parent b5db80c412
commit 21ab565819
4 changed files with 20 additions and 9 deletions

View File

@@ -173,11 +173,11 @@ func detectPrefix(beadsDir string, memStore *memory.MemoryStorage) (string, erro
// extractIssuePrefix extracts the prefix from an issue ID like "bd-123" -> "bd"
func extractIssuePrefix(issueID string) string {
parts := strings.SplitN(issueID, "-", 2)
if len(parts) < 2 {
idx := strings.LastIndex(issueID, "-")
if idx <= 0 {
return ""
}
return parts[0]
return issueID[:idx]
}
// writeIssuesToJSONL writes all issues from memory storage to JSONL file atomically