Add issue-prefix as a config.yaml option
Allow setting issue prefix via config.yaml that works independently of --no-db mode. This provides a consistent way to set the prefix across the entire repository. Precedence order: 1. --prefix flag (highest) 2. issue-prefix in config.yaml 3. .beads/nodb_prefix.txt (no-db mode only) 4. Auto-detect from directory name (lowest) Changes: - Add issue-prefix to config defaults in internal/config/config.go - Update cmd/bd/init.go to read from config before auto-detecting - Update cmd/bd/nodb.go detectPrefix to check config.yaml - Update .beads/config.yaml with documentation and example Usage: # .beads/config.yaml issue-prefix: "myproject" # Or via environment variable BD_ISSUE_PREFIX=myproject bd init This makes the prefix setting repository-scoped and automatically respected by bd init in both normal and no-db modes. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/steveyegge/beads/internal/config"
|
||||
"github.com/steveyegge/beads/internal/storage/memory"
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
)
|
||||
@@ -111,8 +112,9 @@ func loadIssuesFromJSONL(path string) ([]*types.Issue, error) {
|
||||
// detectPrefix detects the issue prefix to use in --no-db mode
|
||||
// Priority:
|
||||
// 1. .beads/nodb_prefix.txt file (if exists)
|
||||
// 2. Common prefix from existing issues (if all share same prefix)
|
||||
// 3. Current directory name (fallback)
|
||||
// 2. issue-prefix from config.yaml (if set)
|
||||
// 3. Common prefix from existing issues (if all share same prefix)
|
||||
// 4. Current directory name (fallback)
|
||||
func detectPrefix(beadsDir string, memStore *memory.MemoryStorage) (string, error) {
|
||||
// Check for nodb_prefix.txt
|
||||
prefixFile := filepath.Join(beadsDir, "nodb_prefix.txt")
|
||||
@@ -123,6 +125,12 @@ func detectPrefix(beadsDir string, memStore *memory.MemoryStorage) (string, erro
|
||||
}
|
||||
}
|
||||
|
||||
// Check config.yaml for issue-prefix
|
||||
configPrefix := config.GetString("issue-prefix")
|
||||
if configPrefix != "" {
|
||||
return configPrefix, nil
|
||||
}
|
||||
|
||||
// Check existing issues for common prefix
|
||||
issues := memStore.GetAllIssues()
|
||||
if len(issues) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user