Commit Graph

543 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
a1583a1b24 bd sync: 2025-11-05 18:43:51 2025-11-05 18:43:51 -08:00
Steve Yegge
fa38a69fcb bd sync: 2025-11-05 18:28:45 2025-11-05 18:28:45 -08:00
Steve Yegge
b6fad0e618 bd sync: 2025-11-05 18:09:54 2025-11-05 18:09:54 -08:00
Steve Yegge
5854bbfef7 Sync database state to JSONL 2025-11-05 17:51:46 -08:00
Steve Yegge
082f5ce6f9 Update issue timestamps 2025-11-05 17:50:36 -08:00
Steve Yegge
369a0fb7a9 bd sync: 2025-11-05 17:38:17 2025-11-05 17:38:18 -08:00
Steve Yegge
f7a45dd0ba bd sync: 2025-11-05 15:27:36 2025-11-05 15:27:36 -08:00
Steve Yegge
8e41df301f Update beads issue tracker (landing the plane) 2025-11-05 15:26:27 -08:00
Steve Yegge
279a1c48f6 Update beads issue tracker
Amp-Thread-ID: https://ampcode.com/threads/T-1844b7c3-fd46-49c0-95fe-86fe341485e9
Co-authored-by: Amp <amp@ampcode.com>
2025-11-05 15:26:19 -08:00
Steve Yegge
1814803b96 bd sync: 2025-11-05 14:36:44 2025-11-05 14:36:44 -08:00
Steve Yegge
0d07346a11 bd sync: 2025-11-05 14:31:39 2025-11-05 14:31:41 -08:00
Steve Yegge
9b92a1f769 bd sync: 2025-11-05 14:26:18 2025-11-05 14:26:20 -08:00
Steve Yegge
80617733a1 Add bd-zbq2: Export should verify JSONL line count
Filed feature request based on real-world silent export failure in VC
project where SQL DELETE + export appeared to succeed but JSONL was
never updated, causing 240 deleted issues to 'come back'.

Simple verification after export would catch this immediately:
- Count lines in written JSONL file
- Compare to number of exported issues
- Error if mismatch detected

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-05 14:25:05 -08:00
Steve Yegge
1c68ecf81a bd sync: 2025-11-05 14:19:57 2025-11-05 14:19:57 -08:00
Steve Yegge
ba2a8211b1 bd sync: 2025-11-05 14:18:58 2025-11-05 14:18:58 -08:00
Steve Yegge
3e93e18587 Merge JSONL conflicts
Amp-Thread-ID: https://ampcode.com/threads/T-d3bb1482-a852-4231-a481-c7e32dd13ff8
Co-authored-by: Amp <amp@ampcode.com>
2025-11-05 13:56:48 -08:00
Steve Yegge
4ccd8fe38e bd sync: 2025-11-05 13:56:09 2025-11-05 13:56:10 -08:00
Steve Yegge
dfca4926ce bd sync: 2025-11-05 12:56:00 2025-11-05 12:56:00 -08:00
Steve Yegge
cf2675027f bd sync: 2025-11-05 12:55:32 2025-11-05 12:55:48 -08:00
Steve Yegge
527e491216 docs: Enhance beads-merge documentation with setup instructions
- Add detailed installation steps for Git and Jujutsu users
- Explain 3-way merge algorithm and field-level merging
- Document configuration in .gitattributes and .jjconfig.toml
- Clarify how it prevents conflicts proactively vs resolving after
- Created bd-bzfy to track integration of beads-merge tool
2025-11-05 12:55:48 -08:00
Steve Yegge
187c395e3e bd sync: 2025-11-05 12:34:59 2025-11-05 12:34:59 -08:00
Steve Yegge
85ca8c3cbf bd sync: 2025-11-05 11:12:29 2025-11-05 11:12:29 -08:00
Steve Yegge
05d010e135 bd sync: 2025-11-05 11:09:34 2025-11-05 11:09:34 -08:00
Steve Yegge
32849c727a bd sync: 2025-11-05 01:41:58 2025-11-05 01:41:58 -08:00
Steve Yegge
97786e0bf9 bd sync: auto-export 2025-11-05 01:08:27 -08:00
Steve Yegge
f27d0ba5a8 bd sync: 2025-11-05 01:08:17 2025-11-05 01:08:17 -08:00
Steve Yegge
0f15bdf5d2 bd sync: Update JSONL 2025-11-05 01:08:06 -08:00
Steve Yegge
f354d6e905 bd sync: 2025-11-05 01:07:57 2025-11-05 01:07:57 -08:00
Steve Yegge
7eba7f6504 bd sync: 2025-11-05 01:05:18 2025-11-05 01:07:51 -08:00
Steve Yegge
183add96cc Resolve beads.jsonl merge conflict
Amp-Thread-ID: https://ampcode.com/threads/T-4b293f18-1d0a-41bf-932e-d65bc134fcfe
Co-authored-by: Amp <amp@ampcode.com>
2025-11-05 01:07:32 -08:00
Steve Yegge
ca14127698 bd sync: Update JSONL 2025-11-05 01:04:51 -08:00
Steve Yegge
147ae14c34 bd sync: auto-export 2025-11-05 01:04:36 -08:00
Steve Yegge
4892b8550f Export database to JSONL
Amp-Thread-ID: https://ampcode.com/threads/T-e58a11be-cbbb-4a75-86d5-fc51af8f51d2
Co-authored-by: Amp <amp@ampcode.com>
2025-11-05 01:01:06 -08:00
Steve Yegge
7c20f4bec1 Update issues (bd-gdzd closed, bd-gpe7 created) 2025-11-05 01:00:37 -08:00
Steve Yegge
a727cd0990 bd sync: 2025-11-05 01:00:07 2025-11-05 01:00:37 -08:00
Steve Yegge
c3ce00b257 bd sync: 2025-11-05 00:59:17 2025-11-05 00:59:17 -08:00
Steve Yegge
24126eaba5 bd sync: 2025-11-05 00:59:03
Amp-Thread-ID: https://ampcode.com/threads/T-9edaf5ed-11e2-49fe-93f2-2224ecd143f6
Co-authored-by: Amp <amp@ampcode.com>
2025-11-05 00:59:03 -08:00
Steve Yegge
d693a7d3a1 bd sync: 2025-11-05 00:58:28 2025-11-05 00:58:28 -08:00
Steve Yegge
c10a5bc839 bd sync: 2025-11-05 00:55:53 2025-11-05 00:55:53 -08:00
Steve Yegge
6c541edeed Database export: WASM issues now properly closed 2025-11-05 00:46:36 -08:00
Steve Yegge
e0c1872dd8 bd sync: 2025-11-05 00:44:55 2025-11-05 00:44:55 -08:00
Steve Yegge
fbe790aa40 feat: Add ancestor_id field and implement epic/child filtering
Amp-Thread-ID: https://ampcode.com/threads/T-22f7d7c5-6f7b-4783-beda-8494360d887a
Co-authored-by: Amp <amp@ampcode.com>
2025-11-05 00:44:41 -08:00
Steve Yegge
78fe709deb bd sync: 2025-11-05 00:41:02 2025-11-05 00:41:42 -08:00
Steve Yegge
8b9a486056 Fix critical import bug: preserve closed_at timestamps during sync
**Problem:**
Closed issues were silently reopening during git sync/import operations.
When importing an issue update, the importer built an updates map with
status='closed' but NO closed_at timestamp. The UpdateIssue() function's
manageClosedAt() would only set closed_at when status was CHANGING to
closed, not when it was already closed. Result: closed_at got cleared,
effectively reopening issues.

**Root Cause:**
1. Importer built updates map without closed_at field (lines 443-451, 519-528)
2. closed_at was not in allowedUpdateFields whitelist
3. manageClosedAt() only managed closed_at for status TRANSITIONS
4. Import of already-closed issue → closed_at lost → issue reopens

**Impact:**
- WASM issues (bd-44d0, bd-8507, etc.) were closed on Nov 4 (commit 0df9144)
- They reopened as 'open' status during sync on Nov 5 (commit 8c9814a)
- Users had to repeatedly close the same issues
- Data integrity violation: status=closed with closed_at=NULL

**Fix:**
1. Add closed_at to allowedUpdateFields whitelist
2. Add closed_at to importer updates maps (both external_ref and ID paths)
3. Update manageClosedAt() to skip auto-management if closed_at explicitly provided
   - Preserves import timestamps while maintaining auto-management for CLI operations

**Testing:**
- All internal/importer tests pass
- All internal/storage/sqlite tests pass
- Explicitly tests timestamp preservation in TestImportWithExternalRef

**Files Changed:**
- internal/importer/importer.go: Add closed_at to updates maps
- internal/storage/sqlite/sqlite.go: Allow closed_at updates, respect explicit values

Amp-Thread-ID: https://ampcode.com/threads/T-53ed6e45-9d04-4a35-97e9-d1ec36321ab0
Co-authored-by: Amp <amp@ampcode.com>
2025-11-05 00:41:10 -08:00
Steve Yegge
6f5687f934 bd sync: 2025-11-05 00:32:20 2025-11-05 00:32:20 -08:00
Steve Yegge
8c9814a827 bd sync: 2025-11-05 00:27:51 2025-11-05 00:27:51 -08:00
Steve Yegge
e774d80939 bd sync: 2025-11-05 00:17:06 2025-11-05 00:17:06 -08:00
Steve Yegge
0bf5c91cb3 Wire OrphanHandling through import pipeline (bd-8072)
- Added OrphanHandling type to sqlite package with 4 modes: strict/resurrect/skip/allow
- Updated EnsureIDs() to accept orphanHandling parameter and implement mode logic
- Added CreateIssuesWithOptions() that passes orphan handling through batch creation
- Made importer.OrphanHandling an alias to sqlite.OrphanHandling
- Importer now respects opts.OrphanHandling during batch issue creation

Next: Add import.orphan_handling config and wire through CLI commands
Amp-Thread-ID: https://ampcode.com/threads/T-bb7ffdd9-f444-4975-b5f7-bfff97cb92ff
Co-authored-by: Amp <amp@ampcode.com>
2025-11-04 23:53:44 -08:00
Steve Yegge
ee01574e5c bd sync: 2025-11-04 23:31:46 2025-11-04 23:31:46 -08:00