refactor: deduplicate FindJSONLInDir function (bd-8a5)
Extract shared JSONL file discovery logic to internal/utils/path.go. Both autoimport and beads packages now use this shared implementation. Changes: - Add utils.FindJSONLInDir with common logic - Update autoimport.go to use utils.FindJSONLInDir - Update beads.go to delegate to utils.FindJSONLInDir - Update server_export_import_auto.go to use utils.FindJSONLInDir - Move FindJSONLInDir test to utils/path_test.go - Fix pre-existing duplicate countIssuesInJSONLFile in init.go 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/steveyegge/beads/internal/storage"
|
||||
"github.com/steveyegge/beads/internal/storage/sqlite"
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
"github.com/steveyegge/beads/internal/utils"
|
||||
)
|
||||
|
||||
// handleExport handles the export operation
|
||||
@@ -443,7 +444,7 @@ func (s *Server) triggerExport(ctx context.Context, store storage.Storage, dbPat
|
||||
// Find JSONL path using database directory
|
||||
// Use FindJSONLInDir to prefer issues.jsonl over other .jsonl files (bd-tqo fix)
|
||||
dbDir := filepath.Dir(dbPath)
|
||||
jsonlPath := autoimport.FindJSONLInDir(dbDir)
|
||||
jsonlPath := utils.FindJSONLInDir(dbDir)
|
||||
|
||||
// Get all issues from storage
|
||||
sqliteStore, ok := store.(*sqlite.SQLiteStorage)
|
||||
|
||||
Reference in New Issue
Block a user