Commit Graph

3133 Commits

Author SHA1 Message Date
Steve Yegge
0745bd69c8 fix(doctor): make --fix automatically migrate tombstones
When bd doctor detects legacy deletions.jsonl, --fix now runs the
tombstone migration automatically instead of requiring users to
manually run bd migrate-tombstones.

This makes the migration smoother for multi-clone scenarios where
only one clone needs to do the actual migration, but other clones
may still have local deletions.jsonl files that need cleanup.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 21:05:45 -08:00
Steve Yegge
c5c8318756 chore: remove legacy deletions.jsonl after tombstone migration
Tombstones are now stored inline in issues.jsonl.
Added deletions.jsonl to .gitignore to prevent re-tracking.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 17:15:40 -08:00
Steve Yegge
bc3e8f6359 chore: Bump version to 0.30.0
Updated all component versions:
- bd CLI: 0.29.0 → 0.30.0
- Plugin: 0.29.0 → 0.30.0
- MCP server: 0.29.0 → 0.30.0
- npm package: 0.29.0 → 0.30.0
- Documentation: 0.29.0 → 0.30.0

Generated by scripts/bump-version.sh
2025-12-15 00:10:54 -08:00
Steve Yegge
3a186a69d6 docs: prepare v0.30.0 changelog and whats-new entry
- Add comprehensive CHANGELOG entry for v0.30.0 (tombstone architecture)
- Add v0.30.0 to versionChanges in info.go for `bd info --whats-new`
- Acknowledge 13 community contributors

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 00:10:40 -08:00
Steve Yegge
936c446d3c chore: sync beads changes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
2025-12-14 23:08:29 -08:00
Steve Yegge
8e58c306a7 fix(sync,blocked): add safety guards for issue deletion and include status=blocked in bd blocked
GH#464: Add safety guards to prevent deletion of open/in_progress issues during sync:
- Safety guard in git-history-backfill (importer.go)
- Safety guard in deletions manifest processing
- Warning when uncommitted changes detected before pull (daemon_sync.go)
- Enhanced repo ID mismatch error message

GH#545: Fix bd blocked to show status=blocked issues (sqlite/ready.go):
- Changed from INNER JOIN to LEFT JOIN to include issues without dependencies
- Added WHERE clause to include both status=blocked AND dependency-blocked issues

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 23:07:54 -08:00
Steve Yegge
db3e22fef9 Merge pull request #561 from steveyegge/bd-6xfz-furiosa
fix(prime): document priority format to prevent Claude using 'medium'
2025-12-14 23:00:11 -08:00
Steve Yegge
7535dc88d2 fix(lint): resolve all golangci-lint errors
- Mark unused ctx parameter with underscore in getRepoRootForWorktree
- Replace exec.Command("test", "-d") with os.Stat for directory check
- Handle file.Close() errors properly in compact.go and migrate_tombstones.go
- Explicitly ignore cleanup errors with _ assignment

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 22:36:51 -08:00
Steve Yegge
f83a8f5a38 fix(ci): update nix vendorHash and fix integration test compilation
- Update default.nix vendorHash to match current go.mod dependencies
- Fix NewSQLiteStorage calls to include required context.Context parameter
- Rename duplicate runCmd to runGitCmd in routing_integration_test.go

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 22:18:10 -08:00
Steve Yegge
1e20d702f2 fix(doctor): include tombstones in getCurrentJSONLIDs to prevent corruption (#552)
The previous bd-in7q fix had backwards logic - by EXCLUDING tombstones
from currentIDs, they appeared missing when compared to historicalIDs,
causing HydrateDeletionsManifest to erroneously add them to deletions.jsonl.

This corruption manifested when:
1. Issues were migrated to tombstones via migrate-tombstones
2. Doctor hydration ran (directly or via sync)
3. Tombstones were seen as deleted and re-added to deletions.jsonl
4. Next import skipped thousands of issues with in deletions manifest

Fix: Include ALL issues (including tombstones) in currentIDs. Tombstones
represent migrated deletions that ARE accounted for - they should not
trigger new deletion records.

Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 17:33:07 -08:00
Steve Yegge
50608ce3a5 chore: close bd-6xfz (GH#517 fix) 2025-12-14 17:19:46 -08:00
Steve Yegge
76568e8802 fix(prime): document priority format to prevent Claude using 'medium'
GH#517: Claude uses 'medium' instead of P2/2 for priority, causing
infinite error loops. The bd prime output didn't show the --priority
flag or explain the valid format.

Fix: Add --priority=2 to the create example and add a clear note
explaining that priority must be 0-4 or P0-P4, NOT 'high/medium/low'.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 17:19:06 -08:00
Steve Yegge
509d96e58a chore: sync beads 2025-12-14 16:50:24 -08:00
Steve Yegge
48697663d8 chore: clean up beads sync state 2025-12-14 16:49:25 -08:00
Steve Yegge
58a5b4a54f chore: sync beads state after preflight fix 2025-12-14 16:42:15 -08:00
Steve Yegge
aa1e8db78f chore: sync beads 2025-12-14 16:41:06 -08:00
Steve Yegge
aa89c43573 chore: sync beads after preflight fix 2025-12-14 16:38:05 -08:00
Steve Yegge
e5f185875e chore: sanitize beads after sync 2025-12-14 15:24:08 -08:00
Steve Yegge
8a7b9afea3 chore: sync beads changes 2025-12-14 15:23:35 -08:00
Steve Yegge
43addba194 chore: sync issues after lockfile test coverage 2025-12-14 15:22:30 -08:00
Steve Yegge
6f3309b304 test(lockfile): improve coverage from 42% to 98%
- Add TestTryDaemonLock with 6 test cases for lock detection scenarios
- Add TestFlockFunctions for blocking/non-blocking lock operations
- Add TestIsProcessRunning for process detection edge cases
- Fix TestCheckPIDFile/current_process_is_running (was using invalid PID encoding)

Closes bd-9w3s
2025-12-14 15:21:29 -08:00
Steve Yegge
d7a813c045 chore: sync issues.jsonl after PR #555 merge 2025-12-14 15:13:34 -08:00
Steve Yegge
f1e5a6206f feat(mcp): Add compaction config and extended context engineering docs
- Extended CONTEXT_ENGINEERING.md with additional optimization strategies
- Added compaction configuration support to MCP server
- Added tests for compaction config and MCP compaction

Amp-Thread-ID: https://ampcode.com/threads/T-019b1f07-daa0-750c-878f-20bcc2d24f50
Co-authored-by: Amp <amp@ampcode.com>
2025-12-14 15:12:43 -08:00
Steve Yegge
a60972cd6a Merge remote-tracking branch 'origin/main' into performance-fix 2025-12-14 14:53:30 -08:00
mahawi1992
700dca22b0 feat(mcp): Add context engineering optimizations (#481)
Reduce context window usage by ~80-90% through:

1. Lazy Tool Schema Loading
   - discover_tools(): List tool names only (~500 bytes vs ~15KB)
   - get_tool_info(name): Get specific tool details on-demand

2. Minimal Issue Models
   - IssueMinimal: Lightweight model for list views (~80 bytes vs ~400 bytes)
   - Full Issue model preserved for show() command

3. Result Compaction
   - Auto-compact results with >20 issues
   - Returns preview (5 items) + total count + hint
   - Prevents unbounded context growth

4. Documentation
   - Updated CONTEXT_ENGINEERING.md with patterns and examples

Context savings:
- Tool schemas: 97% reduction (15KB → 500 bytes)
- List 50 issues: 80% reduction (20KB → 4KB)
- Ready work: 80% reduction (4KB → 800 bytes)

Inspired by MCP Bridge (github.com/mahawi1992/mwilliams_mcpbridge)
and Manus context engineering patterns.

Co-authored-by: Heal Smartly <marty@MacBook-Pro.local>
2025-12-14 14:21:22 -08:00
cbro
2651620a4c fix(storage): persist close_reason to issues table on close (#551)
CloseIssue was storing the reason only in the events table, not in the
issues.close_reason column. This caused `bd show --json` to return an
empty close_reason even when one was provided.

- Update CloseIssue in queries.go and transaction.go to set close_reason
- Clear close_reason when reopening issues (in manageClosedAt)
- Add tests for close_reason in storage and CLI JSON output
- Document the dual-storage of close_reason (issues + events tables)
2025-12-14 14:18:01 -08:00
Steve Yegge
3a4da4e08d fix(lint): address errcheck and De Morgan's law violations in doctor/fix
- Handle file.Close() errors in deletions.go and deletions_test.go
- Simplify boolean logic to apply De Morgan's law in common.go
- All golangci-lint checks now pass
2025-12-14 14:12:13 -08:00
matt wilkie
a22d949cbd Fix bd-in7q: prevent migrate-tombstones from corrupting deletions manifest (#554)
Root cause: bd doctor hydrate was re-adding migrated tombstones to the
deletions manifest because getCurrentJSONLIDs() included all issues,
including tombstones. When compared against git history, tombstones
appeared as 'deleted' and were incorrectly added to the manifest as new
deletions, corrupting the database on next sync.

Fix: Skip tombstone-status issues in getCurrentJSONLIDs() so they don't
participate in deletion detection. Tombstones represent already-recorded
deletions/migrations and shouldn't be treated as active issues.

Changes:
- cmd/bd/doctor/fix/deletions.go: Skip tombstones in getCurrentJSONLIDs()
- cmd/bd/doctor/fix/deletions_test.go: New tests for tombstone skipping
- cmd/bd/migrate_tombstones_test.go: Test that tombstones are valid

This fixes the bug where 'bd migrate-tombstones' followed by 'bd sync'
would add thousands of deletion records with author 'bd-doctor-hydrate'
2025-12-14 14:11:27 -08:00
Ryan Snodgrass
f88a0d015b feat(cli): add 'bd thanks' command to thank contributors
Adds a new command that displays a thank you page listing all human
contributors to the beads project. Features:

- Static list of contributors (compiled into binary)
- Top 20 featured contributors displayed in columns
- Additional contributors in wrapped list
- Styled output using lipgloss (colored box, sections)
- Dynamic width based on content
- JSON output support (--json flag)
- Excludes bots and AI agents by email pattern
2025-12-14 12:40:32 -08:00
Steve Yegge
3a9749279a fix(sync): protect locally exported issues from sanitization (bd-3ee1)
The sync sanitize process was incorrectly removing newly created issues
when they happened to have IDs matching entries in the deletions manifest.
This could occur with hash-based IDs when content is similar to previously
deleted issues.

The fix adds protection for issues that were in the left snapshot (local
export before pull). These represent local work and should not be removed
by sanitize, even if they match entries in the deletions manifest.

Changes:
- Load left snapshot in sanitizeJSONLWithDeletions() to build protection set
- Add protection check before removing issues from JSONL
- Add ProtectedCount/ProtectedIDs to SanitizeResult for tracking
- Log protected issues during sync for visibility
- Add comprehensive test coverage for the fix

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 00:55:55 -08:00
Steve Yegge
c125dc617d chore: bd-3ee1 is P0 (sanitize data loss bug) 2025-12-14 00:47:47 -08:00
Steve Yegge
70d09be1bc chore: upgrade bd-3ee1 to P0 2025-12-14 00:46:41 -08:00
Steve Yegge
a61ca252ae fix(cleanup): resolve CHECK constraint failure and add tombstone pruning
- Fix bd-tnsq: executeDelete now sets closed_at=NULL when creating
  tombstones, satisfying the CHECK constraint that requires
  closed_at IS NULL when status != 'closed'

- Fix bd-08ea: cleanup command now also prunes expired tombstones
  (older than 30 days) after converting closed issues to tombstones

- Add regression test for batch deletion of closed issues

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 00:37:54 -08:00
Steve Yegge
bb2e4f6fbf Merge pull request #549 from steveyegge/fix/nodb-mode-547
fix(memory): implement GetReadyWork/GetBlockedIssues + child counters
2025-12-14 00:28:37 -08:00
Steve Yegge
21e276dfad Merge remote-tracking branch 'origin/main' into fix/nodb-mode-547 2025-12-14 00:28:25 -08:00
Steve Yegge
9db756f8b6 fix(memory): implement GetReadyWork/GetBlockedIssues + child counters
Fixes #543, #544, #545, #546 (no-db mode regressions)

Memory backend fixes:
- GetReadyWork now properly excludes issues with open blocks dependencies
- GetBlockedIssues now includes issues with status=blocked (even with 0 blockers)
- LoadFromIssues initializes hierarchical child counters from existing IDs
  so repeated --parent creates bd-xxx.1, bd-xxx.2, etc.

JSONL path discovery:
- findJSONLPath works in no-db mode when dbPath is empty
- Honors BEADS_JSONL environment variable override
- Falls back to locating .beads directory

Based on PR #547 by @joelklabo - cherry-picked core fixes.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-13 23:22:10 -08:00
Steve Yegge
7f843a6105 chore: remove 12 orphaned child issues from JSONL
Orphaned issues (children of deleted epics):
- bd-cb64c226.1, .6, .8, .9, .10, .12, .13 (cache removal epic)
- bd-cbed9619.1, .2, .3, .4, .5 (N-way collision epic)

These were completed tasks from October 2025 that became orphans
when their parent epics were deleted.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 23:04:30 -08:00
Steve Yegge
dffb56299a chore: add 12 orphaned issues to deletions manifest
Added tombstones for orphaned child issues whose parent epics were deleted:
- bd-cb64c226.1, .6, .8, .9, .10, .12, .13 (cache removal epic)
- bd-cbed9619.1, .2, .3, .4, .5 (N-way collision epic)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 22:57:17 -08:00
Steve Yegge
4c985d7d3b chore: remove 12 orphaned issues (bd-cb64c226.* and bd-cbed9619.*) 2025-12-13 22:55:47 -08:00
Steve Yegge
89d97d4ccb chore: sync beads issues 2025-12-13 21:28:23 -08:00
Steve Yegge
ae7cd934a8 fix(ci): restore Windows smoke tests (reverted by #478)
PR #478 (worktree compatibility) accidentally reverted commit d1bd7ac
which changed Windows CI from full test suite to smoke tests only.

The full test suite times out on Windows due to slow filesystem I/O.
Linux runs comprehensive tests; Windows just verifies the binary works.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-13 21:28:23 -08:00
Steve Yegge
980c4aae8f Merge branch 'main' of github.com:steveyegge/beads 2025-12-13 21:06:54 -08:00
Steve Yegge
fdb722bf08 chore(beads): add preflight epic (bd-lfak) and namespace design (bd-umbf) 2025-12-13 21:06:52 -08:00
Steve Yegge
38ecec08f6 fix(nix): update vendorHash for Go dependencies
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 21:06:11 -08:00
Steve Yegge
e7991b9334 fix: add retry with rebase for concurrent push conflicts
When multiple polecats run bd sync simultaneously, they race to push to
the shared beads-sync branch. Previously this caused non-fast-forward
errors that blocked all polecats.

Now pushFromWorktree:
- Detects non-fast-forward errors from git push output
- On conflict: fetches remote, rebases local commits on top, retries
- Uses exponential backoff for transient failures (up to 5 retries)
- Aborts rebase cleanly if it fails to leave worktree in good state

Fixes gt-zqor.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 20:42:45 -08:00
Steve Yegge
6c84d36592 fix: bd onboard hangs on Windows (GH #531)
Added onboard and hooks commands to the noDbCommands list so they
skip database and daemon initialization. These commands don't need
database access - they just output documentation or manage git hooks.

On Windows, if no .beads directory exists, the PersistentPreRun
would attempt database discovery (including git worktree detection)
which could hang due to git command issues.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 18:09:34 -08:00
Steve Yegge
fc23dca7fb feat(cli): add --lock-timeout flag for SQLite busy_timeout control (#536)
Implements single-shot mode improvements for Windows and Docker scenarios:

- Add --lock-timeout global flag (default 30s, 0 = fail immediately)
- Add config file support: lock-timeout: 100ms
- Parameterize SQLite busy_timeout via NewWithTimeout() function
- In --sandbox mode: default lock-timeout to 100ms
- In --sandbox mode: skip FlushManager creation (no background goroutines)

This addresses bd.exe hanging on Windows and locking conflicts when
using beads across host + Docker containers.

Closes: bd-59er, bd-r4od, bd-dh8a

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 18:07:49 -08:00
Steve Yegge
45328d6bfe fix(doctor): detect sync-branch hook incompatibility (#532)
Add new bd doctor check that detects when sync-branch is configured
but the pre-push hook is too old (< 0.29.0) to support it. This causes
circular "bd sync" failures where the hook recommends running bd sync
but the user is already running bd sync.

The check:
- Returns error when hook version < 0.29.0 with sync-branch configured
- Returns warning for custom (non-bd) hooks that can't be verified
- Returns OK when hook is compatible or sync-branch not configured

Also adds checkSyncBranchHookQuick() for --check-health mode.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 18:05:49 -08:00
Steve Yegge
5587754616 chore: sync beads issues 2025-12-13 13:26:16 -08:00
Steve Yegge
5d71ca6356 fix: improve JSONL-only mode detection and error messages (GH #534)
- Add JSONL-only mode detection in ensureStoreActive() with context-aware
  error messages that suggest correct actions based on project state
- Improve error messages in main.go to detect JSONL presence and suggest
  appropriate solutions (bd init, --no-db flag, or config.yaml setting)
- Update documentation to use issues.jsonl as canonical filename:
  - AGENT_INSTRUCTIONS.md, README.md, resolve-beads-conflict.md
  - docs/GIT_INTEGRATION.md
- Update hook template comments to clarify issues.jsonl is canonical
  while maintaining backward compatibility for beads.jsonl

Fixes #534

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-13 12:50:33 -08:00