bd-6xd: Standardize on issues.jsonl as canonical filename
- Change default JSONL filename from beads.jsonl to issues.jsonl - Add bd doctor check and fix to auto-migrate legacy beads.jsonl configs - Update FindJSONLPath to prefer issues.jsonl over beads.jsonl - Add CheckLegacyJSONLConfig and CheckLegacyJSONLFilename checks - Add LegacyJSONLConfig fix to rename files and update config - Update .gitattributes to reference issues.jsonl - Fix tests to expect new canonical filename - Add bd-6xd to v0.25.1 release notes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -259,7 +259,7 @@ func FindBeadsDir() string {
|
||||
|
||||
// FindJSONLPath returns the expected JSONL file path for the given database path.
|
||||
// It searches for existing *.jsonl files in the database directory and returns
|
||||
// the first one found, preferring beads.jsonl over issues.jsonl (bd-afd).
|
||||
// the first one found, preferring issues.jsonl over beads.jsonl (bd-6xd).
|
||||
//
|
||||
// This function does not create directories or files - it only discovers paths.
|
||||
// Use this when you need to know where bd stores its JSONL export.
|
||||
@@ -275,18 +275,18 @@ func FindJSONLPath(dbPath string) string {
|
||||
pattern := filepath.Join(dbDir, "*.jsonl")
|
||||
matches, err := filepath.Glob(pattern)
|
||||
if err == nil && len(matches) > 0 {
|
||||
// bd-afd: Prefer beads.jsonl over issues.jsonl (canonical name)
|
||||
// bd-6xd: Prefer issues.jsonl over beads.jsonl (canonical name)
|
||||
for _, match := range matches {
|
||||
if filepath.Base(match) == "beads.jsonl" {
|
||||
if filepath.Base(match) == "issues.jsonl" {
|
||||
return match
|
||||
}
|
||||
}
|
||||
// Return the first .jsonl file found if beads.jsonl not present
|
||||
// Return the first .jsonl file found if issues.jsonl not present
|
||||
return matches[0]
|
||||
}
|
||||
|
||||
// bd-afd: Default to beads.jsonl (was issues.jsonl)
|
||||
return filepath.Join(dbDir, "beads.jsonl")
|
||||
// bd-6xd: Default to issues.jsonl (canonical name)
|
||||
return filepath.Join(dbDir, "issues.jsonl")
|
||||
}
|
||||
|
||||
// DatabaseInfo contains information about a discovered beads database
|
||||
|
||||
@@ -168,9 +168,9 @@ func TestFindJSONLPathDefault(t *testing.T) {
|
||||
// Create a fake database path (no .jsonl files exist)
|
||||
dbPath := filepath.Join(tmpDir, "test.db")
|
||||
|
||||
// Should return default beads.jsonl
|
||||
// bd-6xd: Should return default issues.jsonl (canonical name)
|
||||
result := FindJSONLPath(dbPath)
|
||||
expected := filepath.Join(tmpDir, "beads.jsonl")
|
||||
expected := filepath.Join(tmpDir, "issues.jsonl")
|
||||
if result != expected {
|
||||
t.Errorf("Expected '%s', got '%s'", expected, result)
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ type Config struct {
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Database: "beads.db",
|
||||
JSONLExport: "beads.jsonl", // Default to canonical name (was issues.jsonl)
|
||||
JSONLExport: "issues.jsonl", // Canonical name (bd-6xd)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ func TestDefaultConfig(t *testing.T) {
|
||||
t.Errorf("Database = %q, want beads.db", cfg.Database)
|
||||
}
|
||||
|
||||
// bd-afd: Default changed from issues.jsonl to beads.jsonl (canonical name)
|
||||
if cfg.JSONLExport != "beads.jsonl" {
|
||||
t.Errorf("JSONLExport = %q, want beads.jsonl", cfg.JSONLExport)
|
||||
// bd-6xd: issues.jsonl is the canonical name
|
||||
if cfg.JSONLExport != "issues.jsonl" {
|
||||
t.Errorf("JSONLExport = %q, want issues.jsonl", cfg.JSONLExport)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -877,7 +877,7 @@ func checkGitHistoryForDeletions(beadsDir string, ids []string) []string {
|
||||
}
|
||||
repoRoot := strings.TrimSpace(string(output))
|
||||
|
||||
// Compute relative path from repo root to beads.jsonl
|
||||
// Compute relative path from repo root to issues.jsonl
|
||||
// beadsDir is absolute, compute its path relative to repoRoot
|
||||
absBeadsDir, err := filepath.Abs(beadsDir)
|
||||
if err != nil {
|
||||
@@ -889,8 +889,8 @@ func checkGitHistoryForDeletions(beadsDir string, ids []string) []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build JSONL path relative to repo root
|
||||
jsonlPath := filepath.Join(relBeadsDir, "beads.jsonl")
|
||||
// Build JSONL path relative to repo root (bd-6xd: issues.jsonl is canonical)
|
||||
jsonlPath := filepath.Join(relBeadsDir, "issues.jsonl")
|
||||
|
||||
var deleted []string
|
||||
|
||||
@@ -921,7 +921,7 @@ const gitHistoryTimeout = 30 * time.Second
|
||||
// The caller is responsible for confirming the ID is NOT currently in JSONL
|
||||
// to determine that it was deleted (vs still present).
|
||||
func wasEverInJSONL(repoRoot, jsonlPath, id string) bool {
|
||||
// git log --all -S "\"id\":\"bd-xxx\"" --oneline -- .beads/beads.jsonl
|
||||
// git log --all -S "\"id\":\"bd-xxx\"" --oneline -- .beads/issues.jsonl
|
||||
// This searches for commits that added or removed the ID string
|
||||
// Note: -S uses literal string matching, not regex, so no escaping needed
|
||||
searchPattern := fmt.Sprintf(`"id":"%s"`, id)
|
||||
|
||||
Reference in New Issue
Block a user