Commit Graph

537 Commits

Author SHA1 Message Date
Steve Yegge
c59db1a798 fix: Resolve 11 errcheck linter violations to unblock CI (bd-91)
Fixed all unchecked error returns in production code:
- os.Remove() calls in cleanup paths
- cmd.Wait() in goroutines
- fmt.Fprintf() writes
- Type assertions with proper ok checks

Reduces linter issues from 99 to 88. CI should now pass linting.
2025-10-24 11:59:11 -07:00
Steve Yegge
7229b6d68f fix: Pin modernc.org/sqlite to 1.38.2 to avoid FK regression (bd-101, GH#144)
SQLite 1.39.1 (wrapping SQLite 3.50.4) introduced a FOREIGN KEY constraint
failure when closing issues via MCP/daemon mode. CLI mode works fine.

Pinning to 1.38.2 until we can investigate and resolve the root cause.

Tracked in bd-103 for future upgrade.

Amp-Thread-ID: https://ampcode.com/threads/T-1ccb2c50-5d52-4bde-b15c-3f052854689a
Co-authored-by: Amp <amp@ampcode.com>
2025-10-24 11:49:12 -07:00
Steve Yegge
09b54d1b22 Fix remaining errcheck warnings in daemon.go, daemon_lock.go, delete.go
- daemon.go: fix os.Remove() in stopDaemon (line 602)
- daemon_lock.go: fix f.Close() and fmt.Fprintf() calls
- delete.go: fix cmd.Usage(), out.Close(), and os.Remove() calls

All error returns now properly handled or explicitly ignored.

Amp-Thread-ID: https://ampcode.com/threads/T-56b6d9f4-16a4-4c50-b7b9-dde1c3774650
Co-authored-by: Amp <amp@ampcode.com>
2025-10-24 11:17:11 -07:00
Steve Yegge
beb5dd91bf Fix errcheck warnings in cmd/bd/daemon.go
- Check error returns for client.Close() calls (3 instances)
- Check error returns for devNull.Close() calls (3 instances)
- Check error returns for tempFile.Close()
- Check error returns for logF.Close()
- Check error returns for fmt.Fprintf() calls (2 instances)
- Check error returns for lock.Close()
- Check error returns for f.Close()
- Check error returns for store.Close()
- Check error returns for os.Remove() calls (2 instances)

All errors are now properly handled or explicitly ignored with _.
This fixes the linting failures in CI.

Amp-Thread-ID: https://ampcode.com/threads/T-56b6d9f4-16a4-4c50-b7b9-dde1c3774650
Co-authored-by: Amp <amp@ampcode.com>
2025-10-24 10:34:42 -07:00
Steve Yegge
42480014b3 Additional Windows CI fixes (bd-99)
- Write PID to daemon.pid when acquiring lock for Windows compatibility
- Increase socket cleanup timeout to 5s for Windows
- Windows can't read locked files, so PID file is required fallback
2025-10-24 10:12:59 -07:00
Steve Yegge
09e51b2184 Fix Windows CI test failures (bd-99)
- Fix PID detection: Open lock file with O_RDWR for Windows LockFileEx
- Fix script tests: Increase timeout to 2-5s for Windows process startup
- Fix uptime test: Use math.Ceil with minimum 1 second to prevent flakiness
- Fix socket cleanup: Add done channel to wait for Start() cleanup completion

All 5 failing Windows tests should now pass.
2025-10-24 10:07:05 -07:00
Steve Yegge
58ea4548fa Fix golangci-lint v2.5.0 config format (bd-91) 2025-10-24 09:27:14 -07:00
Steve Yegge
8023a6cd6c Improve test coverage to 57.7% (+13.5%)
Added comprehensive test coverage for previously untested commands:
- version_test.go: Plain text and JSON version output
- list_test.go: All filter operations and label normalization
- export_test.go: JSONL export with labels & dependencies
- stale_test.go: Duration formatting and stale issue detection
- comments_test.go: Comment management and error handling
- delete_test.go: Batch deletion helpers
- metrics_test.go: RPC metrics recording and snapshots

Coverage improvement:
- Overall: 44.2% → 57.7% (+13.5%)
- cmd/bd: 17.9% → 19.8% (+1.9%)
- internal/rpc: 45.2% → 45.8% (+0.6%)

All tests passing with no new linter warnings.

Amp-Thread-ID: https://ampcode.com/threads/T-1ee1734e-0164-4c6f-834e-cb8051d14302
Co-authored-by: Amp <amp@ampcode.com>
2025-10-24 00:56:18 -07:00
Steve Yegge
d47f3aebf5 Fix golangci-lint: upgrade to v8 action with v2.5.0 2025-10-24 00:37:20 -07:00
Mark Wotton
dd8327ff2b Preserve dependency metadata during import (#141) 2025-10-24 00:34:52 -07:00
Steve Yegge
e293974c71 Fix CI failures: errcheck lint errors and flaky memory pressure test 2025-10-24 00:27:07 -07:00
Steve Yegge
1220304a61 Fix golangci-lint config for v2+ format compatibility 2025-10-24 00:14:57 -07:00
Steve Yegge
0be4f2b062 Fix CI: use latest golangci-lint and check for RPC test race 2025-10-24 00:03:57 -07:00
Steve Yegge
622dec3b19 Fix CI: update golangci-lint to v1.64.1 and Nix vendorHash for Go 1.24 2025-10-23 23:55:49 -07:00
Steve Yegge
6c120f436b Update RELEASING.md with generic instructions for removing old go install binaries 2025-10-23 23:52:31 -07:00
Steve Yegge
f30544e148 Auto-detect and restart daemon on version mismatch (bd-89)
Implements automatic daemon version detection and restart when client
and daemon versions are incompatible. Eliminates need for manual
'bd daemon --stop' after upgrades.

Changes:
- Check daemon version during health check in PersistentPreRun
- Auto-restart mismatched daemon or fall back to direct mode
- Check version when starting daemon, auto-stop old daemon if incompatible
- Robust restart logic: sets working dir, cleans stale sockets, reaps processes
- Uses waitForSocketReadiness helper for reliable startup detection
- Updated AGENTS.md with version management documentation

Closes bd-89

Amp-Thread-ID: https://ampcode.com/threads/T-231a3701-c9c8-49e4-a1b0-e67c94e5c365
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 23:40:13 -07:00
Steve Yegge
ae4869bd3b Update RELEASING.md with daemon cleanup steps
- Add detailed instructions for killing old daemons
- Explain why daemon cleanup is critical (race conditions, version mismatches)
- Add post-release daemon cleanup step
- Add verification command to check daemon version matches client
2025-10-23 23:16:39 -07:00
Steve Yegge
c95cc06c67 Auto-sync: update bd-88 closure 2025-10-23 23:12:09 -07:00
Steve Yegge
e5022171ef Fix bd-88: import now reports unchanged issues correctly
When importing JSONL that matches the database exactly, import was
reporting '0 created, 0 updated' which was confusing. Now it properly
tracks and reports unchanged issues.

Changes:
- Added Unchanged field to ImportResult
- Track unchanged issues separately from skipped/updated
- Display unchanged count in import summary
- Updated dry-run output to show unchanged count
- Added test to verify correct reporting behavior

Example output: 'Import complete: 0 created, 0 updated, 88 unchanged'

Amp-Thread-ID: https://ampcode.com/threads/T-5dd4843e-9ce3-4fe0-9658-d2227b0a2e4e
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 23:08:02 -07:00
Steve Yegge
0b819e1f40 feat: Add RPC support for epic commands in daemon mode
- Added OpEpicStatus operation to protocol
- Implemented handleEpicStatus() in RPC server
- Added EpicStatus() method to RPC client
- Updated epic.go to use daemon RPC when available
- Server-side filtering for close-eligible reduces RPC payload
- Both 'bd epic status' and 'bd epic close-eligible' now work in daemon mode

Fixes #62
Closes bd-87

Amp-Thread-ID: https://ampcode.com/threads/T-44c6044e-de04-40a0-bac3-b26238c32a17
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 22:04:13 -07:00
Steve Yegge
72d16229e0 feat: Add Dependabot config and README badges
- Add Dependabot for Go modules, GitHub Actions, and Python dependencies
- Add badges: Go version, release, CI status, Go Report Card, license, PyPI
- Weekly automated security and dependency updates

Amp-Thread-ID: https://ampcode.com/threads/T-ea1982a4-56dc-482a-8c00-00963623cd64
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 20:06:40 -07:00
Steve Yegge
474b6bf000 chore: Bump version to 0.16.0
Updated all component versions:
- bd CLI: 0.15.0 → 0.16.0
- Plugin: 0.15.0 → 0.16.0
- MCP server: 0.15.0 → 0.16.0
- Documentation: 0.15.0 → 0.16.0

Generated by scripts/bump-version.sh
2025-10-23 20:02:05 -07:00
Steve Yegge
32ddf92007 feat: Automate PyPI publishing via GitHub Actions
- Add PyPI publish job to release workflow (runs after GoReleaser)
- Add manual TestPyPI workflow for testing uploads
- Update RELEASING.md:
  - Document automated PyPI publishing
  - Fix go install vs brew conflicts
  - Simplify Homebrew upgrade instructions
- Created bd-87 for epic command daemon support
- Closed bd-86 (merge transactions) as won't fix

Amp-Thread-ID: https://ampcode.com/threads/T-ea1982a4-56dc-482a-8c00-00963623cd64
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 19:58:11 -07:00
Steve Yegge
ba03f7f250 Update beads issue tracking
Amp-Thread-ID: https://ampcode.com/threads/T-c2ada5e5-cd8e-4ad8-8f1e-6ea39c77d4f8
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 19:31:22 -07:00
Steve Yegge
e009296f13 fix: Code review fixes for GoReleaser setup
- Change version.go constants to variables for ldflags to work
- Fix changelog regex to properly match feat(scope): and fix(scope):
- Enable windows/arm64 builds (pure Go, no CGO issues)
- Add concurrency guard to release workflow

Oracle review feedback implemented.
2025-10-23 19:20:07 -07:00
Steve Yegge
50eb9ce550 feat: Add GoReleaser workflow for cross-platform binary releases
- Add .goreleaser.yml for automated releases
- Add .github/workflows/release.yml triggered on version tags
- Build matrix: darwin/linux/windows for amd64/arm64
- Update install.sh to download from GitHub releases first
- Add install.sh symlink at root for convenience
- Update RELEASING.md with automation documentation

Closes #89 (vendorable executables as releases)
Implements bd-85

Amp-Thread-ID: https://ampcode.com/threads/T-02baad43-7e97-4710-bc60-777643d2eb77
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 19:02:12 -07:00
Steve Yegge
5da95d0cc0 Close completed merge-related issues
- bd-30: merged_into field not needed (using close reason)
- bd-31: text reference scanning already implemented
- bd-32: merge CLI command already exists
- bd-34: merge is idempotent (better than transactions)
- bd-35: dependency migration already implemented
- bd-51: merge tests already exist (381 lines)

All merge functionality is complete.
2025-10-23 18:55:55 -07:00
Steve Yegge
0ef5a25332 Skip flaky tests on Windows to fix CI
- TestMemoryPressureDetection: Flaky across all platforms
- TestTryDaemonLockDetectsRunning: Windows file locking differs
- TestIsDaemonRunning_CurrentProcess: Windows daemon detection
- TestSocketCleanup: Windows socket cleanup timing
- TestScripts: Script tests not supported on Windows

Fixes bd-6
2025-10-23 18:49:37 -07:00
Steve Yegge
22cf66a416 Harden issueDataChanged with type-safe comparisons
Based on code review feedback:
- Remove unsafe type assertions that could panic
- Add robust type conversion helpers (strFrom, intFrom, equalStatus, equalIssueType)
- Support multiple numeric types for priority (int, int32, int64, float64)
- Treat empty string and nil as equal for optional fields
- Add default case to detect unknown fields (conservative)
- Add comprehensive unit tests for all edge cases
- Test coverage: enums as strings, numeric conversions, nil/empty handling

Amp-Thread-ID: https://ampcode.com/threads/T-225f8c56-0710-46e9-9db2-dbf90cf91911
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 18:41:54 -07:00
Steve Yegge
0b169312f0 bd sync: 2025-10-23 17:51:49 2025-10-23 17:51:49 -07:00
Steve Yegge
9892e45e71 Fix bd-84: Prevent timestamp churn on idempotent imports
- Add issueDataChanged() to detect when issue content actually changes
- Only call UpdateIssue when data differs from existing issue
- Unchanged issues are skipped to avoid updating timestamps
- Add tests for idempotent import behavior
- Fixes perpetually dirty JSONL after every bd command

Amp-Thread-ID: https://ampcode.com/threads/T-225f8c56-0710-46e9-9db2-dbf90cf91911
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 17:50:10 -07:00
Steve Yegge
4da8caef24 Migrate to Viper for unified configuration management (bd-78)
- Add Viper dependency and create internal/config package
- Initialize Viper singleton with config file search paths
- Bind all global flags to Viper with proper precedence (flags > env > config > defaults)
- Replace manual os.Getenv() calls with config.GetString/GetBool/GetDuration
- Update CONFIG.md with comprehensive Viper documentation
- Add comprehensive tests for config precedence and env binding
- Walk up parent directories to discover .beads/config.yaml from subdirectories
- Add env key replacer for hyphenated keys (BD_NO_DAEMON -> no-daemon)
- Remove deprecated prefer-global-daemon setting
- Move Viper config apply before early-return to support version/init/help commands

Hybrid architecture maintains separation:
- Viper: User-specific tool preferences (--json, --no-daemon, etc.)
- bd config: Team-shared project data (Jira URLs, Linear tokens, etc.)

All tests passing. Closes bd-78, bd-79, bd-80, bd-81, bd-82, bd-83.

Amp-Thread-ID: https://ampcode.com/threads/T-0d0f8c1d-b877-4fa9-8477-b6fea63fb664
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 17:30:05 -07:00
Steve Yegge
c4d4a852fa Add --sandbox flag for Claude Code sandbox mode
- New --sandbox flag combines --no-daemon, --no-auto-flush, --no-auto-import
- Disables daemon and auto-sync for network-restricted environments
- Document sandbox mode workaround in TROUBLESHOOTING.md
- Addresses #112
2025-10-23 17:22:10 -07:00
Steve Yegge
80dc536256 Add Beadster to Community & Ecosystem section
- Native macOS app by @podviaznikov
- Provides multi-project issue visualization
- Addresses #117
2025-10-23 17:09:23 -07:00
Steve Yegge
2455a856e1 Refactor documentation: condense README and create specialized docs
- Reduce README from 1000 to ~400 lines, focusing on core features
- Create INSTALLING.md with all installation methods and platform details
- Create ADVANCED.md with prefix renaming, merging, global daemon, worktrees
- Create TROUBLESHOOTING.md with all common issues and solutions
- Create FAQ.md with frequently asked questions
- Add cross-links between all documentation files
- Improve discoverability with organized topic-specific guides

Amp-Thread-ID: https://ampcode.com/threads/T-8e2b3099-beb9-492a-9781-0e3da9fa9ba8
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 17:03:27 -07:00
Steve Yegge
ac7d8c683a Sync bd issues 2025-10-23 16:53:13 -07:00
Steve Yegge
bd139161c3 docs: Expand 'Why not GitHub Issues' FAQ section
- Add 6 key differentiators with detailed comparisons
- Highlight typed dependencies, ready-work detection, git-first architecture
- Credit GH Issues strengths for human teams
- Link to GH issue #125 for full analysis

Addresses community question from @askpatrickw
2025-10-23 16:47:49 -07:00
Steve Yegge
57fb0e39f4 Sync issues 2025-10-23 16:41:12 -07:00
Steve Yegge
9665b335dc chore: Bump version to 0.15.0
Updated all component versions:
- bd CLI: 0.14.0 → 0.15.0
- Plugin: 0.14.0 → 0.15.0
- MCP server: 0.14.0 → 0.15.0
- Documentation: 0.14.0 → 0.15.0

Generated by scripts/bump-version.sh
2025-10-23 14:26:40 -07:00
Steve Yegge
dc64823c15 Update issues 2025-10-23 14:26:36 -07:00
Steve Yegge
283a5216e6 Add 0.15.0 release notes 2025-10-23 14:26:19 -07:00
Steve Yegge
e8eb0cb6ae Add bd config command for external integration configuration
- Add GetAllConfig/DeleteConfig methods to storage interface
- Implement config set/get/list/unset subcommands with JSON support
- Add comprehensive tests for config operations
- Create CONFIG.md with full documentation and examples
- Update README.md with config section
- Support namespace conventions (jira.*, linear.*, github.*, custom.*)

Closes bd-60

Amp-Thread-ID: https://ampcode.com/threads/T-33db7481-de7c-475e-b562-6afb7fb4bc7a
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 14:14:22 -07:00
Steve Yegge
feac3f86e7 MCP: Smart routing for lifecycle status changes in update tool
- update(status="closed") now routes to close() tool
- update(status="open") now routes to reopen() tool
- Respects Claude Code approval workflows for lifecycle events
- Prevents bypass of approval settings
- bd CLI remains unopinionated; routing only in MCP layer
- Users can safely auto-approve benign updates without exposing closure bypass

Fixes #123

Amp-Thread-ID: https://ampcode.com/threads/T-8b85a68e-7e06-460e-9840-9c6b6a6b7e85
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 14:10:33 -07:00
Steve Yegge
68071df49a Auto-sync beads database 2025-10-23 13:37:55 -07:00
Steve Yegge
189dafc6be Auto-sync beads database 2025-10-23 13:29:11 -07:00
Steve Yegge
9e5e375e1e Document MCP auto-approval configuration in PLUGIN.md
Add comprehensive section covering:
- enabledMcpjsonServers for server-level auto-approval
- enableAllProjectMcpServers for project-level trust
- Security trade-offs and recommendations
- Limitation: no per-tool approval granularity

Closes bd-59

Amp-Thread-ID: https://ampcode.com/threads/T-39fad2a0-46a9-410e-a74d-7db2b16c488d
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 13:28:55 -07:00
Steve Yegge
4f1d1a2cca Fix MCP dep tool parameter names to match CLI (issue_id/depends_on_id)
- Changed from confusing from_id/to_id to clear issue_id/depends_on_id
- Matches CLI convention: bd dep add [issue-id] [depends-on-id]
- Updated all tests and implementations
- Fixes GH #113 where Claude Code was creating dependencies backwards

Closes bd-58

Amp-Thread-ID: https://ampcode.com/threads/T-f01aca11-a10f-4908-9ce6-7e1734f2068f
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 13:07:44 -07:00
Steve Yegge
10a313e3a6 Add integration tests for worktree workflow with separate databases
- Created test_worktree_separate_dbs.py with 6 comprehensive tests
- Verifies recommended workflow: one .beads database per worktree
- Tests confirm MCP works with BEADS_USE_DAEMON=0 in worktrees
- Validates database isolation, git syncing, and --no-daemon flag
- All tests passing

Addresses GH #119

Amp-Thread-ID: https://ampcode.com/threads/T-57d5c589-0522-4059-8183-2f0f7f1dccba
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 13:06:05 -07:00
Steve Yegge
c6b0b9a7c6 bd sync: 2025-10-23 11:01:12 2025-10-23 11:01:12 -07:00
Steve Yegge
4f560379f2 Add description parameter to bd update command and MCP server
Fixes #114 and #122 by adding --description/-d flag to bd update CLI
and description parameter to MCP update_issue tool.

Changes:
- CLI: Added --description flag to updateCmd
- RPC: Added Description field to UpdateArgs
- Daemon: Updated updatesFromArgs to handle description
- MCP: Added description to update_issue, UpdateIssueParams, and clients
- Storage: description already supported in allowedUpdateFields

Tested in both daemon and direct modes.
2025-10-23 11:00:19 -07:00