fix(utils): parse multi-hyphen prefixes correctly (GH#405)

The ExtractIssuePrefix function was falling back to first-hyphen
extraction when the suffix didn't look like a hash (e.g., 4+ char
words without digits). This broke prefixes like 'hacker-news' where
an issue ID 'hacker-news-test' would incorrectly extract 'hacker'.

Fix: Always use last-hyphen extraction for alphanumeric suffixes.
Only fall back to first-hyphen for non-alphanumeric suffixes.

Examples:
- 'hacker-news-test' -> 'hacker-news' (was: 'hacker')
- 'me-py-toolkit-abc' -> 'me-py-toolkit' (was: 'me')
- 'vc-baseline-hello' -> 'vc-baseline' (was: 'vc')

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-16 01:13:15 -08:00
parent 50608ce3a5
commit 77aeb50d27
5 changed files with 252 additions and 235 deletions

View File

@@ -360,7 +360,7 @@ func TestExtractIssuePrefix(t *testing.T) {
{
name: "multi-part non-numeric suffix",
issueID: "vc-baseline-test",
expected: "vc", // Falls back to first hyphen for non-numeric suffix
expected: "vc-baseline", // Alphanumeric suffix uses last hyphen (GH#405 fix)
},
{
name: "beads-vscode style prefix",