Fix bd import to auto-initialize database when missing

Agents were failing with 'bd import' after nuking the database.
Now bd import automatically:
- Creates .beads/ directory if missing
- Detects prefix from imported issues (analyzes JSONL)
- Falls back to directory name if no issues
- Initializes database before proceeding

This fixes the common agent workflow: rm .beads/beads.db && bd import

Amp-Thread-ID: https://ampcode.com/threads/T-3ace45ce-3cd6-46ae-a201-39c3d7f48f0b
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-11-08 01:51:34 -08:00
parent 068615f28a
commit ab4ec900f0
3 changed files with 170 additions and 96 deletions

File diff suppressed because one or more lines are too long