Commit Graph

1624 Commits

Author SHA1 Message Date
Steve Yegge
c9247312df Fix bd-6ku3: Update isHashID to recognize Base36 hash IDs
- Changed pattern from [a-f] (hex) to [a-z] (Base36)
- Added length check: 5+ chars = hash ID (sequential IDs rarely exceed 4 digits)
- Fixes test failure where all-digit Base36 IDs were incorrectly identified as sequential
2025-11-06 19:22:12 -08:00
Steve Yegge
41b1a21206 Fix bd-rb75: Ignore merge artifacts in .beads/.gitignore 2025-11-06 19:14:04 -08:00
Steve Yegge
a0d24f37af Fix bd-1ezg: Prevent import/export from hanging when daemon is running
Root cause: Import and export commands tried to open the database directly
while the daemon already held the lock, causing indefinite blocking.

Solution: Both commands now explicitly close the daemon connection before
opening direct database access, avoiding SQLite lock contention.

Changes:
- import.go: Close daemon connection and open direct SQLite connection
- export.go: Close daemon connection before direct access
- Added debug logging to help diagnose similar issues

Tests: Existing TestImport and TestExport tests pass
2025-11-06 19:07:46 -08:00
Steve Yegge
d2d31766e6 bd sync: 2025-11-06 19:07:35 2025-11-06 19:07:35 -08:00
Steve Yegge
746961efd2 Merge branch 'main' of github.com:steveyegge/beads
# Conflicts:
#	.beads/beads.jsonl
2025-11-06 19:07:31 -08:00
Steve Yegge
d6c2550579 bd sync: 2025-11-06 19:07:19 2025-11-06 19:07:19 -08:00
Steve Yegge
0b0d9a43d1 Improve bd-my64 fix based on oracle review
Oracle identified a critical race condition in the initial fix:
- Pre-push hook checked for changes but didn't flush first
- Pending 5s-debounced flushes could land after the check
- Result: stale JSONL could still be pushed

Improvements:
1. Pre-push now flushes pending changes FIRST (bd sync --flush-only)
2. Uses git status --porcelain to catch ALL change types:
   - Staged, unstaged, untracked, deleted, renamed, conflicts
3. Handles both beads.jsonl and issues.jsonl (backward compat)
4. Works even without bd installed (git-only check)
5. Pre-commit stages both JSONL files (simpler loop)

This completely eliminates the race condition.
2025-11-06 19:01:28 -08:00
Steve Yegge
4460ede3a7 Remove dead issues.jsonl and add bd-1ezg sync investigation issue 2025-11-06 19:01:03 -08:00
Steve Yegge
ff1f25ea63 Update beads JSONL 2025-11-06 18:57:52 -08:00
Steve Yegge
3ba245e6c0 Fix bd-my64: Pre-push hook blocks instead of exports
The original pre-push hook tried to export DB → JSONL during the push,
then run 'git add', but this doesn't work because:

1. The commit is already created when pre-push runs
2. git add in pre-push stages files for a FUTURE commit
3. The current push sends the old commit with stale JSONL
4. Result: dirty git status after push

Fix:
- Pre-push now CHECKS for uncommitted JSONL changes
- If found, it FAILS the push with clear instructions
- User must commit JSONL before pushing
- This prevents stale JSONL from reaching remote

The pre-commit hook already properly flushes changes, so this
catch-all prevents changes made BETWEEN commit and push.

Amp-Thread-ID: https://ampcode.com/threads/T-39a89553-c301-4d4f-b39f-6df9c403d22b
Co-authored-by: Amp <amp@ampcode.com>
2025-11-06 18:57:34 -08:00
Steve Yegge
2cb97e4d22 Update beads JSONL 2025-11-06 18:53:07 -08:00
Steve Yegge
bae701af13 Add bd-6ku3: Fix TestMigrateHashIDs test failure 2025-11-06 18:53:02 -08:00
Steve Yegge
7eea30acde Update beads JSONL
Amp-Thread-ID: https://ampcode.com/threads/T-65a9b3f9-0552-4587-bb8f-34c2b98781b1
Co-authored-by: Amp <amp@ampcode.com>
2025-11-06 18:52:37 -08:00
Steve Yegge
96269763c0 Update beads database with comments 2025-11-06 18:49:46 -08:00
Steve Yegge
e85740167b Sync beads database
Amp-Thread-ID: https://ampcode.com/threads/T-dc29c5ad-ff33-401a-9546-4d5ca1d8421b
Co-authored-by: Amp <amp@ampcode.com>
2025-11-06 18:49:31 -08:00
Steve Yegge
510934ff19 bd sync: 2025-11-06 18:49:09 2025-11-06 18:49:09 -08:00
Steve Yegge
1edf3c6c88 Fix bd-9v7l: bd status now uses git history for recent activity
- Changed from database timestamps (7 days) to git log analysis (24 hours)
- Git log is fast (~24ms) and reflects actual JSONL changes
- Shows commits, total changes, created/closed/reopened/updated counts
- Updated tests to verify git-based activity tracking
- Removed misleading database-based getRecentActivity function

Amp-Thread-ID: https://ampcode.com/threads/T-dc29c5ad-ff33-401a-9546-4d5ca1d8421b
Co-authored-by: Amp <amp@ampcode.com>
2025-11-06 18:49:07 -08:00
Steve Yegge
c731c45f0c Update beads JSONL
Amp-Thread-ID: https://ampcode.com/threads/T-5e744954-8a08-4697-960e-5f2a88d50c54
Co-authored-by: Amp <amp@ampcode.com>
2025-11-06 18:48:53 -08:00
Steve Yegge
b23c472f55 Update AGENTS.md: use -short flag for all local tests
- Changed all test commands to 'go test -short ./...'
- Clarified that full tests run in CI
- Updated: Code Standards, Before Committing, Landing the Plane, Building and Testing, Release Process
- Agents should only run short tests; CI runs full suite
2025-11-06 18:48:23 -08:00
Steve Yegge
ed6be66343 Merge branch 'main' of github.com:steveyegge/beads 2025-11-06 18:47:44 -08:00
Steve Yegge
b7395128a9 bd sync: 2025-11-06 18:47:43 2025-11-06 18:47:43 -08:00
Steve Yegge
e5a6c05e38 Fix P1 deletion tracking bugs (bd-rbxi)
- bd-nqes: Made snapshot capture mandatory with fail-fast
- bd-mn9p: Added semantic JSON comparison (jsonEquals)
- bd-2ifg: Collect deletion errors and fail operation
- bd-8ayj: Atomic file ops with PID-specific temp files
- bd-aewm: Added defer cleanup for .merged temp file

All tests pass.

Amp-Thread-ID: https://ampcode.com/threads/T-5e744954-8a08-4697-960e-5f2a88d50c54
Co-authored-by: Amp <amp@ampcode.com>
2025-11-06 18:47:06 -08:00
Steve Yegge
fa811300bd Sync beads issues
Amp-Thread-ID: https://ampcode.com/threads/T-932dcf45-76f2-4994-9b5c-a6eb20a86036
Co-authored-by: Amp <amp@ampcode.com>
2025-11-06 18:19:31 -08:00
Steve Yegge
70a3361d77 bd sync: 2025-11-06 18:19:21 2025-11-06 18:19:21 -08:00
Steve Yegge
708a81c491 Fix bd-hv01: Implement deletion tracking for multi-workspace sync
- Add 3-way merge deletion tracking using snapshot files
- Create .beads/beads.base.jsonl and .beads/beads.left.jsonl snapshots
- Integrate into both sync.go and daemon_sync.go
- Add comprehensive test suite in deletion_tracking_test.go
- Update .gitignore to exclude snapshot files

This fixes the resurrection bug where deleted issues come back after
multi-workspace git sync. Uses the beads-merge 3-way merge logic to
detect and apply deletions correctly.
2025-11-06 17:52:37 -08:00
Steve Yegge
b201eecd55 bd sync: 2025-11-06 17:52:29 2025-11-06 17:52:30 -08:00
Steve Yegge
f9108ff498 bd sync: 2025-11-06 17:31:18 2025-11-06 17:31:18 -08:00
Steve Yegge
11fa142539 Optimize test suite with testing.Short() guards
- Add Short() guards to slow CLI tests (2-4s each)
- Add Short() guards to slow API/integration tests (3-11s)
- Add Short() guard to hanging daemon discovery test (29s timeout)
- Short test suite now runs in ~6s (down from 5+ minutes)

Run 'go test -short ./...' for fast iteration
Run 'go test ./...' for full coverage

Closes: bd-iov0
2025-11-06 17:31:15 -08:00
Steve Yegge
5fff4edcb6 bd sync: 2025-11-06 16:14:27 2025-11-06 16:14:27 -08:00
Steve Yegge
6424ebdada Add comprehensive tests for merge driver auto-config in bd init
- Test auto-install in quiet mode (bd init --quiet)
- Test --skip-merge-driver flag
- Test detection of already-installed merge driver (no duplication)
- Test append to existing .gitattributes (preserve content)
- Test non-git repo gracefully skips merge driver
- Test git config has correct merge.beads.driver settings

Fixes: bd-csvy
Amp-Thread-ID: https://ampcode.com/threads/T-b237be26-6dd8-4d4e-9b9d-b460ace8ce72
Co-authored-by: Amp <amp@ampcode.com>
2025-11-06 15:57:51 -08:00
Steve Yegge
725e43d49c Sync beads database 2025-11-06 15:52:11 -08:00
Steve Yegge
5f95d05a39 Update beads database: closed bd-kazt 2025-11-06 15:52:01 -08:00
Steve Yegge
14b2d3431f Add comprehensive tests for 3-way merge functionality
- Added merge_test.go with 797 lines of test coverage
- Tests for field merging, dependency merging, timestamp handling
- Tests for deletion detection and conflict generation
- Integration tests for merge driver auto-config in bd init
- Test helpers for git repository setup

Closes bd-kazt

All tests pass: go test ./internal/merge/... -v

Amp-Thread-ID: https://ampcode.com/threads/T-f0fe7c4c-13e7-486b-b073-fc64b81eeb4b
Co-authored-by: Amp <amp@ampcode.com>
2025-11-06 15:51:40 -08:00
Steve Yegge
f475c13064 bd sync: 2025-11-06 15:41:51 2025-11-06 15:41:51 -08:00
Steve Yegge
4b1e96bd3f Fix linting errors in vendored merge code
- Check error returns from Fprintln and Sync
- Remove unused 'merged' parameter from hasConflict
- Remaining gosec G304 warnings are baseline (file paths from git, not user input)
2025-11-06 15:41:36 -08:00
Steve Yegge
dcb6eb27a8 Vendor beads-merge by @neongreen for native bd merge command
- Vendored beads-merge algorithm into internal/merge/ with full MIT license attribution
- Created bd merge command as native wrapper (no external binary needed)
- Updated bd init to auto-configure git merge driver (both interactive and --quiet)
- Removed obsolete test files that were incompatible with vendored version
- Added merge to noDbCommands list so it can run standalone
- Tested: successful merge and conflict detection work correctly

Closes bd-bzfy

Thanks to @neongreen for permission to vendor!
See: https://github.com/neongreen/mono/issues/240
Original: https://github.com/neongreen/mono/tree/main/beads-merge

Amp-Thread-ID: https://ampcode.com/threads/T-f0fe7c4c-13e7-486b-b073-fc64b81eeb4b
Co-authored-by: Amp <amp@ampcode.com>
2025-11-06 15:38:48 -08:00
Steve Yegge
d4c97d9f70 bd sync: 2025-11-06 15:30:20 2025-11-06 15:30:20 -08:00
Steve Yegge
aca631a1c4 Update CHANGELOG for git hook version detection 2025-11-06 15:02:38 -08:00
Steve Yegge
991c6248ca Add git hooks support and refactor info command 2025-11-06 15:00:15 -08:00
Steve Yegge
c4eddf0de4 bd sync: 2025-11-06 15:00:10 2025-11-06 15:00:10 -08:00
Steve Yegge
8f676a4850 Add public API for external extensions
Created root-level beads.go that re-exports types and functions from
internal packages. This allows external projects (like VC) to import
from github.com/steveyegge/beads without violating Go's internal
package restrictions.

Exports:
- Storage interface and NewSQLiteStorage()
- Core types (Issue, Dependency, Label, etc.)
- Filter types (IssueFilter, WorkFilter)
- All relevant constants (Status, IssueType, DependencyType, etc.)

This matches the usage shown in docs/EXTENDING.md.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 13:30:04 -08:00
Steve Yegge
5c59a3dfec bd sync: 2025-11-06 13:02:45 2025-11-06 13:02:45 -08:00
Steve Yegge
cee9cbaba7 Clean up test binary 2025-11-06 13:02:35 -08:00
Steve Yegge
4f0da2cd9d bd sync: 2025-11-06 13:02:14 2025-11-06 13:02:14 -08:00
Steve Yegge
9d45cb47f0 Merge remote beads issues 2025-11-06 13:02:10 -08:00
Steve Yegge
e6de031627 bd sync: 2025-11-06 13:01:54 2025-11-06 13:01:54 -08:00
Steve Yegge
9de98cf1cb Add --clear-duplicate-external-refs flag to bd import
Fixes GH-234 by providing automatic resolution for duplicate external_ref
values instead of forcing manual JSONL editing.

Changes:
- Add ClearDuplicateExternalRefs option to importer.Options
- Modify validateNoDuplicateExternalRefs to clear duplicates when enabled
- Keep first occurrence, clear rest when flag is set
- Enhanced error message to suggest the flag
- Add comprehensive tests for the new behavior

Usage: bd import -i issues.jsonl --clear-duplicate-external-refs
Amp-Thread-ID: https://ampcode.com/threads/T-932dcf45-76f2-4994-9b5c-a6eb20a86036
Co-authored-by: Amp <amp@ampcode.com>
2025-11-06 13:01:44 -08:00
Steve Yegge
2ea2a0f010 Update beads issues 2025-11-06 10:53:55 -08:00
Ben Lovell
b5e2ef4a59 Add script to automate Nix vendorHash updates (#235)
* Add script to automate Nix vendorHash updates

- Create update-nix-hash.sh to automate vendorHash calculation
- Update vendorHash (to be usedafter recent Go dependency changes)
- Script uses ed for OS agnostic in-place editing and extracts hash from nix output

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix Test Nix Flake CI job

* Revert CI change - bd outputs help by default without 'help' arg

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Steve Yegge <stevey@sourcegraph.com>
2025-11-06 10:30:19 -08:00
Steve Yegge
c47f40b03e fix: Extract linux checksums properly in Homebrew workflow
Fixes #238 - The workflow was using a shell command
instead of extracting the linux checksums like it does for macOS.
Now extracts all platform hashes and uses them in the formula.
2025-11-06 10:20:12 -08:00