Implement auto-import to complete automatic git sync workflow

Adds auto-import feature to complement bd-35's auto-export, completing
the automatic sync workflow for git collaboration.

**Implementation:**
- Auto-import checks if JSONL is newer than DB on command startup
- Silently imports JSONL when modification time is newer
- Skips import command itself to avoid recursion
- Can be disabled with --no-auto-import flag

**Documentation updates:**
- Updated README.md git workflow section
- Updated CLAUDE.md workflow and pro tips
- Updated bd quickstart with auto-sync section
- Updated git hooks README to clarify they're now optional

**Testing:**
- Tested auto-import by touching JSONL and running commands
- Tested auto-export with create/close operations
- Complete workflow verified working

Closes bd-33

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-10-13 22:48:30 -07:00
parent 026940c8ae
commit 584cd1ebfc
6 changed files with 255 additions and 77 deletions

View File

@@ -1,15 +1,32 @@
# Git Hooks for Beads
Automatic export/import of beads issues during git operations.
Optional git hooks for immediate export/import of beads issues.
**NOTE**: As of bd v0.9+, **auto-sync is enabled by default!** These hooks are optional and provide:
- **Immediate export** (no 5-second debounce wait)
- **Guaranteed import** after every git operation
- **Extra safety** for critical workflows
## What These Hooks Do
- **pre-commit**: Exports SQLite → JSONL before every commit
- **post-merge**: Imports JSONL → SQLite after git pull/merge
- **post-checkout**: Imports JSONL → SQLite after branch switching
- **pre-commit**: Exports SQLite → JSONL before every commit (immediate, no debounce)
- **post-merge**: Imports JSONL → SQLite after git pull/merge (guaranteed)
- **post-checkout**: Imports JSONL → SQLite after branch switching (guaranteed)
This keeps your `.beads/issues.jsonl` (committed to git) in sync with your local SQLite database (gitignored).
## Do You Need These Hooks?
**Most users don't need hooks anymore!** bd automatically:
- Exports after CRUD operations (5-second debounce)
- Imports when JSONL is newer than DB
**Install hooks if you:**
- Want immediate export (no waiting 5 seconds)
- Want guaranteed import after every git operation
- Need extra certainty for team workflows
- Prefer explicit automation over automatic behavior
## Installation
### Quick Install