Fix bd init to auto-import issues from git on fresh clone

Prevents agents from creating duplicate low-numbered issues when starting
with a fresh git clone that already has issues.jsonl in git history.

Changes:
- bd init now checks for existing issues in git after DB creation
- Auto-imports with collision resolution if found
- Updates AGENTS.md to simplify onboarding (just 'bd init')

Fixes the scenario where:
1. Fresh clone has .beads/issues.jsonl in git (212 issues)
2. Agent runs bd init (creates empty DB)
3. Agent starts creating bd-1, bd-2, etc (collisions with git)

Now bd init automatically imports all issues from git on first run.

Amp-Thread-ID: https://ampcode.com/threads/T-8a41f14d-d4c3-4c50-a18b-5f112110f138
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-21 20:38:35 -07:00
parent 36bd877e7c
commit 7f82708b90
4 changed files with 243 additions and 227 deletions
+2 -4
View File
@@ -456,11 +456,9 @@ Happy coding! 🔗
### Quick Start
**FIRST TIME?** Import existing issues from git:
**FIRST TIME?** Just run `bd init` - it auto-imports issues from git:
```bash
bd import -i .beads/issues.jsonl --json
# Or if issues.jsonl is empty in working tree but exists in git:
git show HEAD:.beads/issues.jsonl | bd import -i /dev/stdin --json
bd init --prefix bd
```
**Check for ready work:**