feat: Normalize prefix by stripping trailing hyphens in bd init
Ensures exactly one hyphen between prefix and issue number regardless of whether user provides trailing hyphen. Before: bd init --prefix wy- → Issues: wy--1, wy--2 (double hyphen) bd init --prefix wy → Issues: wy-1, wy-2 (single hyphen) After: bd init --prefix wy- → Issues: wy-1, wy-2 (single hyphen) bd init --prefix wy → Issues: wy-1, wy-2 (single hyphen) The hyphen is added automatically during ID generation in CreateIssue(), so the stored prefix should never include trailing hyphens. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@@ -28,6 +29,10 @@ and database file. Optionally specify a custom issue prefix.`,
|
|||||||
prefix = filepath.Base(cwd)
|
prefix = filepath.Base(cwd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Normalize prefix: strip trailing hyphens
|
||||||
|
// The hyphen is added automatically during ID generation
|
||||||
|
prefix = strings.TrimRight(prefix, "-")
|
||||||
|
|
||||||
// Create .beads directory
|
// Create .beads directory
|
||||||
beadsDir := ".beads"
|
beadsDir := ".beads"
|
||||||
if err := os.MkdirAll(beadsDir, 0750); err != nil {
|
if err := os.MkdirAll(beadsDir, 0750); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user