Commit Graph

9 Commits

Author SHA1 Message Date
Steve Yegge
52c505956f feat: Add bd merge command for git 3-way JSONL merging (bd-omx1)
- Implemented bd merge command with dual-mode operation:
  1. Git 3-way merge: bd merge <output> <base> <left> <right>
  2. Duplicate issue merge: bd merge <sources...> --into <target> (placeholder)
- Added MergeFiles wrapper to internal/merge package
- Command works without database when used as git merge driver
- Supports --debug flag for verbose output
- Exit code 0 for clean merge, 1 for conflicts
- Handles deletions intelligently (delete-modify conflicts)
- Added proper MIT license attribution for @neongreen's beads-merge code
- Tests pass for git merge functionality

This enables git merge driver setup for .beads/beads.jsonl files.
2025-11-05 19:16:50 -08:00
Steve Yegge
e5f1e4b971 Fix --json flag shadowing issue causing test failures
Fixed TestHashIDs_IdenticalContentDedup test failure by removing duplicate
--json flag definitions that were shadowing the global persistent flag.

Root cause: Commands had both a persistent --json flag (main.go) and local
--json flags (in individual command files). The local flags shadowed the
persistent flag, preventing jsonOutput variable from being set correctly.

Changes:
- Removed 31 duplicate --json flag definitions from 15 command files
- All commands now use the single persistent --json flag from main.go
- Commands now correctly output JSON when --json flag is specified

Test results:
- TestHashIDs_IdenticalContentDedup: Now passes (was failing)
- TestHashIDs_MultiCloneConverge: Passes without JSON parsing warnings
- All other tests: Pass with no regressions

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 18:52:44 -08:00
Steve Yegge
0215e73780 Fix config system: rename config.json → metadata.json, fix config.yaml loading
- Renamed config.json to metadata.json to clarify purpose (database metadata)
- Fixed config.yaml/config.json conflict by making Viper explicitly load only config.yaml
- Added automatic migration from config.json to metadata.json on first read
- Fixed jsonOutput variable shadowing across 22 command files
- Updated bd init to create both metadata.json and config.yaml template
- Fixed 5 failing JSON output tests
- All tests passing

Resolves config file confusion and makes config.yaml work correctly.
Closes #178 (global flags), addresses config issues from #193

Amp-Thread-ID: https://ampcode.com/threads/T-e6ac8192-e18f-4ed7-83bc-4a5986718bb7
Co-authored-by: Amp <amp@ampcode.com>
2025-11-02 14:31:22 -08:00
Steve Yegge
118d7541dd Add --json flag support to more bd commands
- stats: Added --json flag for programmatic output
- show, update: Added --json flag for issue details
- close, reopen: Added --json flag for bulk operations
- dep (add, remove, tree, cycles): Added --json flags
- label (add, remove, list, list-all): Added --json flags
- duplicates, merge: Added --json flags

Closes bd-4dcd2d09
2025-10-31 14:36:20 -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
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
d9e1ee9dd6 Make merge command idempotent for safe retry after partial failures (bd-26)
- Added mergeResult struct to track operations (added vs skipped)
- Check if source issues already closed before attempting to close
- Track dependencies migrated vs already existed
- Count text references updated
- Display detailed breakdown of operations in output
- Updated help text to clarify idempotent behavior
- Added comprehensive tests for idempotent retry scenarios
2025-10-22 12:24:08 -07:00
Steve Yegge
edd4ec95c5 Implement bd merge command with dependency migration and text references
- Add performMerge() with dependency migration in both directions
- Implement updateMergeTextReferences() for text reference updates
- Close source issues with 'Merged into bd-X' reason
- Fix store initialization panic by checking daemon mode earlier
- Add TODO for transaction support (deferred, see bd-215 for idempotency approach)

Closes bd-202, bd-193, bd-194, bd-195, bd-196
Related: bd-190 (merge epic), bd-215 (idempotency enhancement)

Amp-Thread-ID: https://ampcode.com/threads/T-30fe297d-4713-4f84-abc9-3bd264caa4c6
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 19:39:22 -07:00
Steve Yegge
c0807e50e3 Implement merge validation logic (bd-192)
- Add merge command with --into and --dry-run flags
- Validate target and source issues exist
- Validate no self-merge attempts
- Add comprehensive test coverage
- Capture --id flag feature request as bd-9369

Amp-Thread-ID: https://ampcode.com/threads/T-22945597-9f4f-413b-afde-dcf3099eb2f0
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 18:23:17 -07:00