Auto-import from git on empty DB (bd-189)
- Add checkAndAutoImport() that detects empty DB with issues in git - Automatically imports from git HEAD:.beads/issues.jsonl - Integrated into list, ready, and stats commands - Zero cognitive load for agents in fresh clones - Makes JSONL truly the source of truth - DB becomes ephemeral cache that auto-rebuilds Also: - Update AGENTS.md onboarding section with import instructions - Merge PR #98 (enhanced .gitignore) Amp-Thread-ID: https://ampcode.com/threads/T-ffcb5e95-e5a0-486b-a0ae-ce8bd861ab9d Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -137,10 +137,22 @@ var listCmd = &cobra.Command{
|
||||
ctx := context.Background()
|
||||
issues, err := store.SearchIssues(ctx, "", filter)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// If no issues found, check if git has issues and auto-import
|
||||
if len(issues) == 0 {
|
||||
if checkAndAutoImport(ctx, store) {
|
||||
// Re-run the query after import
|
||||
issues, err = store.SearchIssues(ctx, "", filter)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle format flag
|
||||
if formatStr != "" {
|
||||
if err := outputFormattedList(ctx, store, issues, formatStr); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user