Files
beads/cmd/bd
Steve Yegge ea5157e204 fix: Replace mtime-based auto-import with hash-based comparison (bd-84)
The auto-import mechanism previously relied on file modification time
comparison between JSONL and DB. This broke in git workflows because
git doesn't preserve original mtimes - pulled files get fresh timestamps.

Changes:
- Added metadata table for internal state storage (separate from config)
- Replaced mtime comparison with SHA256 hash comparison in autoImportIfNewer()
- Store JSONL hash in metadata after both import and export operations
- Added crypto/sha256 and encoding/hex imports

Benefits:
- Git-proof: Works regardless of file timestamps after git pull
- Universal: Works with git, Dropbox, rsync, manual edits
- Efficient: SHA256 is fast (~20ms for 1MB files)
- Accurate: Only imports when content actually changed
- No user action required: Fully automatic and invisible

Testing:
- All existing tests pass
- Manual testing confirms hash-based import triggers on content changes
- Linter warnings are baseline only (documented in LINTING.md)

This fixes issues where parallel agents in git workflows couldn't
find their assigned issues after git pull because auto-import
silently failed due to stale mtimes.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-14 02:54:57 -07:00
..