Commit Graph

641 Commits

Author SHA1 Message Date
Steve Yegge
e910d96bc6 Adjust sync timings for better batching behavior
- Increase flush debounce from 1s to 30s (provides transaction window for batch operations)
- Increase daemon poll from 2s to 5s (reduces commit spam)
- Agents should run 'bd sync' at end of session to force immediate commit
- Prevents creating dozens of commits when making multiple issue changes
2025-10-26 17:15:39 -07:00
Steve Yegge
fcff20a735 Reduce auto-sync delays for better UX
- Reduce flush debounce from 5s to 1s (BEADS_FLUSH_DEBOUNCE)
- Reduce daemon poll interval from 10s to 2s
- Makes issue changes sync much faster to JSONL and git
2025-10-26 17:14:25 -07:00
Steve Yegge
0f27c5abf1 Add bd daemons list and health subcommand tasks (bd-158, bd-157) 2025-10-26 17:11:08 -07:00
Steve Yegge
e657931186 Fix two daemon bugs: race condition on deletion (bd-155) and wrong project context (bd-156)
- bd-155: Add pre-import flush in daemon sync cycle to prevent deleted issues from being re-imported
- bd-155: Reduce default daemon polling interval from 5 minutes to 10 seconds
- bd-156: Fix hardcoded 'vc.db' - now properly detects existing .db files in local .beads/ directory
2025-10-26 17:09:20 -07:00
Steve Yegge
b5a2734f78 feat: Add --all flag to bd list for CLI familiarity
Common CLI pattern (git branch -a, docker ps -a, ls -a).
No-op since bd list already shows all issues by default,
but prevents error/retry cycles when agents reflexively use it.
2025-10-26 14:45:09 -07:00
Steve Yegge
f34eca1e2e feat: Add --version/-v flag support
Agents often try 'bd --version' as a standard CLI pattern.
Now supports both:
- bd --version (or -v)
- bd version (existing subcommand)
2025-10-26 14:24:05 -07:00
Steve Yegge
80b0af9457 chore: Bump version to 0.17.4
Updated all component versions:
- bd CLI: 0.17.3 → 0.17.4
- Plugin: 0.17.3 → 0.17.4
- MCP server: 0.17.3 → 0.17.4
- Documentation: 0.17.3 → 0.17.4

Generated by scripts/bump-version.sh
2025-10-26 14:20:03 -07:00
Steve Yegge
0ee45bf7de fix: Auto-sync RPC client/server versions from CLI version
- Set rpc.ServerVersion from Version in daemon startup
- Set rpc.ClientVersion from Version in main.go startup
- Eliminates need to manually update RPC versions
- Both now use 0.0.0 placeholder, overridden at runtime

Amp-Thread-ID: https://ampcode.com/threads/T-03c37f7f-f41e-4b87-8700-d346c21bad30
Co-authored-by: Amp <amp@ampcode.com>
2025-10-26 14:18:35 -07:00
Steve Yegge
d297848f76 chore: Bump version to 0.17.3
Updated all component versions:
- bd CLI: 0.17.2 → 0.17.3
- Plugin: 0.17.2 → 0.17.3
- MCP server: 0.17.2 → 0.17.3
- Documentation: 0.17.2 → 0.17.3

Generated by scripts/bump-version.sh
2025-10-26 13:59:01 -07:00
Steve Yegge
9f9ea48ec1 Update beads.jsonl 2025-10-26 13:24:18 -07:00
Steve Yegge
4c71235377 Fix syntax error in onboard.go from PR #154
The backtick escaping was missing around .beads/issues.jsonl on line 69.
2025-10-26 13:24:18 -07:00
Steve Yegge
dde640a502 Add bd-144 for bd edit follow-ups 2025-10-26 13:24:18 -07:00
Ryan Newton
5727ec629d Add bd edit mode for human usage (#152)
Co-authored-by: Claude Code <claude@anthropic.com>
2025-10-26 13:23:49 -07:00
Steve Yegge
9cebb65410 Auto-update beads.jsonl 2025-10-26 13:21:49 -07:00
Steve Yegge
5228108d41 Update beads.jsonl: close bd-142, create bd-143 2025-10-26 13:21:49 -07:00
Steve Yegge
f01d81b468 Fix bd init --quiet to install git hooks inline
bd init --quiet was returning before git hooks installation code ran.
Also replaced external install.sh dependency with inline hook generation.

Changes:
- Move hooks installation before quiet mode return
- Embed hook scripts directly in installGitHooks()
- Remove dependency on examples/git-hooks/install.sh
- Remove unused os/exec import

Fixes bd-142 testing requirement.
2025-10-26 13:21:49 -07:00
Dennis Schön
4b150b0918 onboard: add step to commit JSONL with code changes (#154)
Add a new step to the onboarding workflow reminding AI agents to commit
the `.beads/issues.jsonl` file together with code changes. This ensures
issue state stays synchronized with code state, which is critical for
maintaining accurate project history and making issues meaningful when
reviewing past commits.
2025-10-26 13:21:34 -07:00
Dennis Schön
5f67dadec0 init: add daemon.lock to .gitignore (#156)
The daemon.lock file should be ignored in git since it's a runtime
file created by the daemon to manage exclusive database access.

Amp-Thread-ID: https://ampcode.com/threads/T-b77cef77-966d-4917-b605-4d2b2fb546e1

Co-authored-by: Amp <amp@ampcode.com>
2025-10-26 13:21:22 -07:00
Steve Yegge
ec7d824897 Fix bd init --quiet and clarify agent usage in docs
- Fix: bd init --quiet now skips interactive prompts and auto-installs hooks
- Docs: Add Git Workflow & Auto-Sync section to README
- Docs: Update AGENTS.md with --quiet flag guidance for agents
- Docs: Update WORKFLOW.md to explain auto-import after git pull
- Docs: Add FAQ entries about auto-sync behavior and who runs init
- Closes bd-127, bd-140, bd-141

Amp-Thread-ID: https://ampcode.com/threads/T-72f55d41-f16c-4541-b72a-8acc9013e87b
Co-authored-by: Amp <amp@ampcode.com>
2025-10-26 12:53:50 -07:00
Steve Yegge
c91e83e993 Add bd sync --import-only flag and git pull integration test (bd-124, bd-125)
- Add --import-only flag to bd sync command for manual JSONL import after git pull
- Show import summary output instead of suppressing it
- Add comprehensive integration test for git pull sync scenario
- Test covers non-daemon auto-import and bd sync command
- Verify performance of import operations

Closes bd-123, bd-114, bd-124, bd-125, bd-136, bd-137

Amp-Thread-ID: https://ampcode.com/threads/T-7d8dc20f-baf2-4d1d-add1-57fa67028c15
Co-authored-by: Amp <amp@ampcode.com>
2025-10-26 12:37:46 -07:00
Steve Yegge
8fe0586080 Update bd-132 with current status and next steps 2025-10-26 12:11:24 -07:00
Steve Yegge
897bc6ace8 Merge duplicate bd-135 into bd-132 2025-10-26 11:59:55 -07:00
Steve Yegge
ada7bd0b73 Refactor autoImportIfNewer to internal/autoimport package (bd-128)
- Extracted auto-import logic from cmd/bd/main.go to internal/autoimport
- Removed global dependencies (store, dbPath) by using parameters
- Uses callback pattern (ImportFunc) for flexible import implementation
- Both CLI and daemon can now call auto-import after detecting staleness
- Added detailed ID remapping output for collision resolution
- Improved error reporting for parse failures
- All tests passing

Amp-Thread-ID: https://ampcode.com/threads/T-b7faaa33-fc52-409f-82b3-28db143b335d
Co-authored-by: Amp <amp@ampcode.com>
2025-10-26 11:55:24 -07:00
Steve Yegge
744d7b67dc Merge duplicate issue bd-135 into bd-132 2025-10-26 11:49:55 -07:00
Steve Yegge
8eca47c4fb Fix database: restore clean 135 issues and add exclusive lock docs 2025-10-25 23:39:26 -07:00
Steve Yegge
3a42ca252d Implement exclusive lock protocol for daemon/external tool coexistence
- Add ExclusiveLock struct with JSON marshaling and validation
- Implement IsProcessAlive() with EPERM fail-safe behavior
- Add ShouldSkipDatabase() with stale lock cleanup
- Integrate lock checking into daemon sync cycle
- Return holder name on stale removal for better logging
- Case-insensitive hostname comparison
- Comprehensive unit tests (89.3% coverage)
- Documentation updates (ADVANCED.md, AGENTS.md)
- Add .beads/.exclusive-lock to .gitignore

Closes bd-115, bd-116, bd-117, bd-118, bd-119, bd-120, bd-121, bd-122

Amp-Thread-ID: https://ampcode.com/threads/T-0b835739-0d79-4ef9-aa62-8446a368c42d
Co-authored-by: Amp <amp@ampcode.com>
2025-10-25 23:32:47 -07:00
Steve Yegge
e42868c8e5 Update beads.jsonl after auto-import 2025-10-25 23:23:14 -07:00
Steve Yegge
ab69b6b744 Close bd-114: Add configurable SortPolicy to GetReadyWork
Amp-Thread-ID: https://ampcode.com/threads/T-da75f81b-41b9-4c99-b159-ffd67bfb670b
Co-authored-by: Amp <amp@ampcode.com>
2025-10-25 23:22:40 -07:00
Steve Yegge
8bd0ceb0d9 Clean up database: delete 41 duplicates/cruft and renumber to bd-1 through bd-135
Amp-Thread-ID: https://ampcode.com/threads/T-d238b838-793e-464b-a1b0-1d2efa0aeaf6
Co-authored-by: Amp <amp@ampcode.com>
2025-10-25 23:16:04 -07:00
Steve Yegge
fbaaedce53 Update beads database: close bd-159, bd-160, create bd-166
Amp-Thread-ID: https://ampcode.com/threads/T-b554e049-aff8-4a24-8bf3-3305483b7f5a
Co-authored-by: Amp <amp@ampcode.com>
2025-10-25 23:11:52 -07:00
Steve Yegge
daa25db720 Implement timestamp tracking and staleness detection (bd-159, bd-160)
- bd-159: Track last_import_time in metadata after auto-import
- bd-160: Add staleness check to daemon before serving requests
  - Detects when JSONL mtime > last import time
  - Currently logs warning (needs bd-166 for actual import trigger)
- Add lastImportTime field to RPC Server struct with getter/setter
- Add checkAndAutoImportIfStale() method to detect stale JSONL

This is part of bd-158 epic to fix daemon showing stale data after git pull.

Amp-Thread-ID: https://ampcode.com/threads/T-b554e049-aff8-4a24-8bf3-3305483b7f5a
Co-authored-by: Amp <amp@ampcode.com>
2025-10-25 23:07:30 -07:00
Steve Yegge
362d7172c0 Mark bd-149 as in_progress 2025-10-25 22:56:06 -07:00
Steve Yegge
91411d7c82 Update beads database with new epics and child issues 2025-10-25 22:50:42 -07:00
Steve Yegge
1e770a2f2e Add critical daemon and sync issues: singleton enforcement, exclusive locks, git pull auto-sync
Amp-Thread-ID: https://ampcode.com/threads/T-1d43dd4a-cee3-40c5-b6aa-c071c664d093
Co-authored-by: Amp <amp@ampcode.com>
2025-10-25 22:48:24 -07:00
Steve Yegge
ef5128fe24 Export SortPolicy type and constants
Export SortPolicy from beads package so external tools (like VC)
can use the sort policy constants without importing internal packages.

Added:
- SortPolicy type alias
- SortPolicyHybrid, SortPolicyPriority, SortPolicyOldest constants

This completes the sort policy feature for external consumers.
2025-10-25 20:20:12 -07:00
Steve Yegge
0709fd85dc Make Homebrew verification step mandatory and more prominent 2025-10-25 19:00:03 -07:00
Steve Yegge
5b963e3379 chore: Bump version to 0.17.2 2025-10-25 18:57:47 -07:00
Steve Yegge
fdf7188ba4 Add 0.17.2 release notes 2025-10-25 18:57:07 -07:00
Steve Yegge
8660cb631b Close bd-146 (duplicate) and bd-147 (sort policy implemented) 2025-10-25 18:54:24 -07:00
Steve Yegge
09c11a26e6 Add configurable sort policy for GetReadyWork (bd-147)
- Add SortPolicy type with hybrid, priority, oldest constants
- Add SortPolicy field to WorkFilter
- Implement buildOrderByClause() for SQL generation
- Add --sort flag to bd ready command
- Add comprehensive tests for all 3 sort policies
- Update RPC protocol to support sort policy
- Update documentation with sort policy examples

Enables autonomous systems like VC to use strict priority ordering
while preserving hybrid behavior for interactive use.

Amp-Thread-ID: https://ampcode.com/threads/T-9d7ea9db-8d6d-4498-9daa-48a7e104ce1f
Co-authored-by: Amp <amp@ampcode.com>
2025-10-25 18:54:00 -07:00
Steve Yegge
b855c444d4 Enable errcheck linter and fix all production code warnings
- Enabled errcheck linter (previously disabled)
- Set tests: false in .golangci.yml to focus on production code
- Fixed 27 errcheck warnings using Go best practices:
  * Database resources: defer func() { _ = rows.Close() }()
  * Transaction rollbacks: defer func() { _ = tx.Rollback() }()
  * Best-effort closers: _ = store.Close(), _ = client.Close()
  * File writes: proper error checking on Close()
  * Interactive input: handle EOF gracefully
  * File ops: ignore ENOENT on os.Remove()
- All tests pass
- Closes bd-58

Amp-Thread-ID: https://ampcode.com/threads/T-57c9afd3-9adf-40c2-8be7-3e493d200361
Co-authored-by: Amp <amp@ampcode.com>
2025-10-25 18:44:38 -07:00
Steve Yegge
bb33007036 Fix revive style issues (bd-56)
- Fix 14 unused-parameter warnings (rename to _)
- Fix 2 redefines-builtin-id (max→maxCount, min→minInt)
- Fix 3 indent-error-flow issues with gofmt
- Merged duplicate bd-126 into bd-116
2025-10-25 18:13:49 -07:00
Steve Yegge
14e14f647e Fix goconst linter issues (bd-116)
- Use windowsOS constant in reinit_test.go
- Use testIssueBD1 constant in compact_test.go and counter_sync_test.go
- Merged duplicate bd-126 into bd-116
2025-10-25 18:04:05 -07:00
Steve Yegge
37e5dcf4f8 Close bd-78: flaky test already fixed 2025-10-25 18:00:41 -07:00
Steve Yegge
0caf423021 Re-land TestDatabaseReinitialization with CI fixes
Fixes bd-130

Fixed all CI failures that caused the original revert:
- Windows: Use filepath.ToSlash() for git paths (git always uses forward slashes)
- Nix: Skip test when git not available (NIX_BUILD_TOP env check)
- JSON parsing: Increased scanner buffer to 64MB for large issue descriptions
- Cross-platform: Added normalizeGitPath() helper for path comparisons

Also restored beads.jsonl > issues.jsonl precedence in checkGitForIssues().

All tests pass locally.

Amp-Thread-ID: https://ampcode.com/threads/T-a560d9a0-29b9-4c46-aa90-813758d2553c
Co-authored-by: Amp <amp@ampcode.com>
2025-10-25 17:49:17 -07:00
Steve Yegge
ec43028dc9 Sync beads issues 2025-10-25 17:40:09 -07:00
Steve Yegge
744563e87f Add health checks and reconnection logic for stale daemon sockets (bd-137)
- Add ping() and health() methods to BdDaemonClient for connection verification
- Implement _health_check_client() to verify cached client connections
- Add _reconnect_client() with exponential backoff (0.1s, 0.2s, 0.4s, max 3 retries)
- Update _get_client() to health-check before returning cached clients
- Automatically detect and remove stale connections from pool
- Add comprehensive test suite with 14 tests covering all scenarios
- Handle daemon restarts, upgrades, and long-idle connections gracefully

Amp-Thread-ID: https://ampcode.com/threads/T-2366ef1b-389c-4293-8145-7613037c9dfa
Co-authored-by: Amp <amp@ampcode.com>
2025-10-25 17:39:21 -07:00
Steve Yegge
a91467d2fb Add full release automation script
Amp-Thread-ID: https://ampcode.com/threads/T-789d9ba6-2aea-4ee9-b4dc-ce73e8f496f4
Co-authored-by: Amp <amp@ampcode.com>
2025-10-25 16:57:15 -07:00
Steve Yegge
d31e9e7156 Add Homebrew formula update automation script
Amp-Thread-ID: https://ampcode.com/threads/T-789d9ba6-2aea-4ee9-b4dc-ce73e8f496f4
Co-authored-by: Amp <amp@ampcode.com>
2025-10-25 16:54:15 -07:00
Steve Yegge
36490a1648 Fix RELEASING.md: clarify rebuild requirement and Homebrew timing
Issues fixed:
- Added explicit rebuild step after version bump (source changes but binary doesn't)
- Clarified Homebrew formula update must happen AFTER tag push
- Added git pull step for /tmp/homebrew-beads to avoid stale repo
- Made it clear users won't get new version until Homebrew formula is updated
- Removed redundant git config steps (already configured in cloned repo)
2025-10-25 16:48:28 -07:00