Commit Graph

379 Commits

Author SHA1 Message Date
Steve Yegge
445af4e3a5 bd sync: 2025-10-26 19:35:57 2025-10-26 19:35:57 -07:00
Steve Yegge
1c998917e5 bd sync: 2025-10-26 19:35:36 2025-10-26 19:35:36 -07:00
Steve Yegge
3d83a39362 bd sync: 2025-10-26 19:26:33 2025-10-26 19:26:33 -07:00
Steve Yegge
9e33784623 bd sync: 2025-10-26 19:23:21 2025-10-26 19:23:21 -07:00
Steve Yegge
5cede5e84d bd sync: 2025-10-26 19:04:08 2025-10-26 19:20:59 -07:00
Steve Yegge
2a274b7a10 bd sync: 2025-10-26 19:03:21 2025-10-26 19:03:21 -07:00
Steve Yegge
eb2563310b Update issue metadata
Amp-Thread-ID: https://ampcode.com/threads/T-f1cff202-188b-4850-a909-c2750d24ad22
Co-authored-by: Amp <amp@ampcode.com>
2025-10-26 19:03:07 -07:00
Steve Yegge
51abbb512e bd sync: 2025-10-26 18:44:19 2025-10-26 18:44:19 -07:00
Steve Yegge
50623f8be1 bd sync: 2025-10-26 18:35:28 2025-10-26 18:35:28 -07:00
Steve Yegge
93e170627d bd-154: Implement bd daemons stop and restart subcommands 2025-10-26 18:35:28 -07:00
Steve Yegge
cd86d7d2ba Implement bd-160: Add database schema versioning
- Added version validation on daemon startup
- Daemon checks bd_version metadata matches current version
- Clear error messages for version mismatches with 3 resolution options
- Auto-sets missing version metadata for old databases
- Added BEADS_IGNORE_VERSION_MISMATCH=1 override for emergencies
- Tested version mismatch detection, override flag, and missing metadata handling
2025-10-26 18:28:15 -07:00
Steve Yegge
b39420f748 bd sync: 2025-10-26 18:21:59 2025-10-26 18:21:59 -07:00
Steve Yegge
0a283d5148 bd-151: Implement bd daemons health subcommand 2025-10-26 18:21:55 -07:00
Steve Yegge
1c7de68bfc bd sync: 2025-10-26 18:17:38 2025-10-26 18:17:38 -07:00
Steve Yegge
991da5af0c bd sync: 2025-10-26 18:16:59 2025-10-26 18:16:59 -07:00
Steve Yegge
dd82840886 Close bd-165 as duplicate 2025-10-26 18:10:51 -07:00
Steve Yegge
95f50d7943 bd sync: 2025-10-26 18:10:45 2025-10-26 18:10:45 -07:00
Steve Yegge
764915f6a6 bd sync: 2025-10-26 18:10:25 2025-10-26 18:10:25 -07:00
Steve Yegge
c61ca494fe feat(daemons): implement discovery and list command (bd-146, bd-147)
- Add daemon discovery mechanism with socket scanning
- Implement depth-limited filesystem walk to avoid hangs
- Add DaemonInfo struct with metadata collection
- Create 'bd daemons list' command with table and JSON output
- Add FindDaemonByWorkspace and CleanupStaleSockets utilities
- Fix workspace path to be parent of .beads directory
- Add comprehensive tests for discovery functionality

Closes bd-146
Closes bd-147
2025-10-26 18:10:24 -07:00
Steve Yegge
6bf5c9d2b9 bd sync: 2025-10-26 17:55:32 2025-10-26 17:55:32 -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
9f9ea48ec1 Update beads.jsonl 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
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
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
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
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
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