Commit Graph

5307 Commits

Author SHA1 Message Date
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 6c739aead2 chore: close bd-2rfr (bd reset command implemented) 2025-12-14 17:40:33 -08:00
Steve Yegge 4b5ea05da2 feat: add bd reset command (GH#505)
Adds a new 'bd reset' command that completely removes beads from a repository:
- Stops running daemon
- Removes git hooks (pre-commit, post-merge, pre-push, post-checkout)
- Removes merge driver configuration
- Removes .gitattributes entry
- Removes sync branch worktrees
- Removes .beads directory

By default runs in dry-run mode showing what would be deleted.
Use --force to actually perform the reset.

Closes steveyegge/beads#505
2025-12-14 17:39:54 -08:00
Steve Yegge fc0e72d7fd refactor: extract common helpers for sync-branch hook checks (bd-e0o7)
Extract two helper functions from checkSyncBranchHookQuick and
checkSyncBranchHookCompatibility to reduce code duplication:

1. getPrePushHookPath(path) - resolves pre-push hook path handling
   both standard .git/hooks and shared hooks via core.hooksPath

2. extractBdHookVersion(content) - parses version from hook content
   looking for bd-hooks-version: marker

Also documented the intentional behavior difference:
- Quick check: returns OK for custom hooks (silent)
- Full check: returns Warning for custom hooks (user awareness)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 17:36:13 -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 dbbf338a12 feat: add bd daemon --stop-all to kill all daemon processes (bd-47tn)
Add --stop-all flag to bd daemon command that:
- Discovers all running bd daemon processes using the registry
- Gracefully stops them all (with force kill fallback)
- Reports how many were stopped

Useful for:
- Cleaning up multiple daemons causing race conditions
- Getting a clean slate before running bd sync
- Debugging daemon-related issues

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 17:32:54 -08:00
Steve Yegge deec7e4c7f chore: sync beads after GH#523 fix 2025-12-14 17:29:50 -08:00
Steve Yegge 7675c1dc31 chore: close bd-7r4l after implementing claude.local.md support 2025-12-14 17:29:50 -08:00
Steve Yegge a192b19602 chore: close bd-bscs (document bd setup) 2025-12-14 17:29:50 -08:00
Steve Yegge b7cbce4e21 chore: close bd-cyec (GH#510 docs complete) 2025-12-14 17:29:49 -08:00
Steve Yegge 8569259cf3 chore: close bd-er7r (GH#509 fix) 2025-12-14 17:29:47 -08:00
Steve Yegge 0dd8914619 chore: sync beads - close bd-0yzm 2025-12-14 17:24:14 -08:00
Steve Yegge fb20e43f5f fix(orphan): handle prefixes with dots in orphan detection (GH#508)
The orphan detection was incorrectly flagging issues with dots in their
prefix (e.g., "my.project-abc123") as orphans because it was looking for
any dot in the ID, treating everything before the first dot as the
parent ID.

The fix:
- Add IsHierarchicalID() helper that correctly detects hierarchical IDs
  by checking if the ID ends with .{digits} (e.g., "bd-abc.1")
- Update SQL query in orphan detection migration to use GLOB patterns
  that only match IDs ending with numeric suffixes
- Update all Go code that checks for hierarchical IDs to use the new
  helper function

Test cases added:
- Unit tests for IsHierarchicalID covering normal, dotted prefix, and
  edge cases
- Integration test verifying dotted prefixes do not trigger false
  positives

Fixes: #508
2025-12-14 17:23:46 -08:00
Steve Yegge 2db4808a19 chore: sync beads state 2025-12-14 17:23:26 -08:00
Steve Yegge 5da7172d43 chore: sync beads - close GH#522 2025-12-14 17:23:05 -08:00
Steve Yegge 82dc06eb84 feat(update): add --type flag to bd update command
Allows changing issue type (task/epic/bug/feature/chore) via bd update --type.
Storage layer already supported it, this adds CLI and RPC support.

Fixes GH#522.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 17:22:42 -08:00
Steve Yegge 6a8b278f16 chore: clean beads state 2025-12-14 17:22:31 -08:00
Steve Yegge c7e119a1cc fix(import): defensive handling for closed issues missing closed_at timestamp
Fixes GH#523: older versions of bd could close issues without setting
the closed_at timestamp. When importing such issues, validation would
fail with "closed issues must have closed_at timestamp".

This fix adds defensive handling in all issue creation/validation paths:
- If status is "closed" and closed_at is nil, set closed_at to
  max(created_at, updated_at) + 1 second
- Similarly for tombstones missing deleted_at

Applied to:
- batch_ops.go: validateBatchIssuesWithCustomStatuses (main import path)
- transaction.go: CreateIssue and CreateIssues
- queries.go: CreateIssue
- multirepo.go: upsertIssueInTx

Also adds comprehensive tests for the defensive fix.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 17:21:44 -08:00
Steve Yegge f2b7925dee chore: sync beads changes 2025-12-14 17:21:10 -08:00
Steve Yegge 03e7d7c650 feat: support claude.local.md for local-only documentation
Add support for claude.local.md and .claude/claude.local.md as local-only
alternatives to CLAUDE.md. These files are intended to be gitignored for
personal customizations that should not be committed to the repo.

Changes:
- Update CheckAgentDocumentation to detect claude.local.md files
- Update CheckLegacyBeadsSlashCommands to check claude.local.md files
- Update CheckDocumentationBdPrimeReference to check claude.local.md files
- Add fix message mentioning claude.local.md as an option
- Add test cases for claude.local.md support

Closes #488

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 17:20:59 -08:00
Steve Yegge 79aa949681 chore: sync beads 2025-12-14 17:20:49 -08:00
Steve Yegge 17389d0eb4 fix(sync): handle sync.branch == current branch (GH#519)
When sync.branch is configured to the same branch as the current branch,
git worktree creation fails because the same branch cannot be checked out
in multiple locations.

This fix detects when sync.branch equals the current branch and falls back
to direct commits on the current branch instead of using the worktree-based
approach.

Changes:
- Add IsSyncBranchSameAsCurrent() helper in syncbranch package
- Add GetCurrentBranch() helper function
- Update sync.go to detect this case and skip worktree operations
- Add unit tests for the new functionality

Closes #519

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 17:20:47 -08:00
Steve Yegge 69d14e21d8 fix(git): find .beads from nested worktrees (GH#509)
When worktrees are nested under the main repo (e.g.,
/project/.worktrees/feature/), bd now correctly finds .beads/ in the
parent repo.

The fix simplifies GetMainRepoRoot() to use `git rev-parse --git-common-dir`
which always returns the main repo's .git directory, regardless of whether
we're in a regular repo, a worktree, or a nested worktree.

- Simplified GetMainRepoRoot() implementation
- Added tests for nested worktree scenarios
- Updated CHANGELOG.md

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 17:20:46 -08:00
Steve Yegge 8e1a841daa feat(init): auto-add 'landing the plane' instructions to AGENTS.md
Closes GH#516: bd init now automatically:
- Creates AGENTS.md and @AGENTS.md with landing-the-plane instructions if they don't exist
- Appends the instructions to existing files if they don't have them
- Skips if the section already exists (idempotent)
- Skips in stealth mode (user wants invisible setup)

The landing-the-plane instructions ensure AI agents properly complete
their work sessions by pushing all changes to remote before ending.
2025-12-14 17:20:43 -08:00
Steve Yegge 214b5f9d07 fix(hooks): pre-commit hook warns instead of failing on flush error
Fixes GH#483 - The pre-commit hook was blocking commits when
`bd sync --flush-only` failed, even if the user had removed beads
from their branch. This made it impossible to commit on branches
that don't have beads configured.

Changes:
- Change "Error:" to "Warning:" in the message
- Remove `exit 1` so commits proceed even if flush fails
- Add comments explaining why we don't block commits

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 17:20:29 -08:00
Steve Yegge 424b0aa68a chore: sync beads changes 2025-12-14 17:20:24 -08:00
Steve Yegge 56fe3f78c2 chore: remove foreign prefix entries from deletions.jsonl (again) 2025-12-14 17:20:18 -08:00
Steve Yegge 344fc1b95d docs: explain sync-branch worktree behavior (GH#510)
Add comprehensive documentation about beads-created worktrees:
- New section in WORKTREES.md explaining why and where beads creates worktrees
- Common confusion: 'beads took over main!' with solution
- Troubleshooting entries for 'branch already checked out' errors
- FAQ entry: 'Why did beads create worktrees in my .git directory?'

This addresses user confusion when beads' sync-branch feature creates
internal worktrees that can lock branches users want to checkout.

Closes #510

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 17:20:12 -08:00
Steve Yegge 80e56d58f3 docs: document bd setup command
Add comprehensive documentation for the `bd setup` command:

- New docs/SETUP.md with full documentation for all three integrations:
  - Claude Code (hooks for SessionStart/PreCompact)
  - Cursor IDE (rules file in .cursor/rules/)
  - Aider (config file with human-in-the-loop workflow)

- Updated docs/CLI_REFERENCE.md:
  - Added Setup & Integration section
  - Added SETUP.md to See Also links
  - Added to Quick Navigation

Closes #518

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 17:20:10 -08:00
Steve Yegge c247d18115 chore: regenerate BD_GUIDE.md with v0.29.0
Update from v0.24.2 to v0.29.0 to get the generic template content
(removes beads-specific Go/SQLite/Cobra content).

Relates to: GH#497

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 17:20:05 -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 b98b25792e chore: remove foreign prefix entries from deletions manifest
These entries (beads-, test-, webui-, worker2-) were hydrated from git
history but don't belong in this repo's bd- namespace. They were causing
import failures during beads sync due to prefix mismatch validation.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 16:58:14 -08:00
Steve Yegge c21c8cb77b fix: resolve beads sync issues - remove foreign prefixes from deletions.jsonl 2025-12-14 16:56:12 -08:00
Steve Yegge 8d409fc719 chore: sync beads 2025-12-14 16:55:37 -08:00
Steve Yegge 1b5efd5d47 chore: sync beads state 2025-12-14 16:55:07 -08:00
Steve Yegge 0e70c813c7 chore: bd sync complete 2025-12-14 16:54:53 -08:00
Steve Yegge 59e9664284 chore: finalize beads sync state 2025-12-14 16:54:34 -08:00
Steve Yegge cfb9b3f6b1 chore: final beads sync 2025-12-14 16:54:32 -08:00
Steve Yegge b0b4e9fa44 bd sync: 2025-12-14 16:54:27 2025-12-14 16:54:27 -08:00
Steve Yegge 9d51f0579a bd sync: 2025-12-14 16:54:23 2025-12-14 16:54:23 -08:00
Steve Yegge fc99ca0ca3 bd sync: merge divergent histories (6 local + 4 remote commits) 2025-12-14 16:54:12 -08:00
Steve Yegge c678de0fea chore: clean beads state before sync 2025-12-14 16:54:05 -08:00
Steve Yegge fbcc00ebac chore: sync beads flush 2025-12-14 16:54:00 -08:00
Steve Yegge da753ea137 chore: final beads sync cleanup 2025-12-14 16:53:59 -08:00
Steve Yegge 659fbd0b59 chore: remove legacy deletions files and clean up beads 2025-12-14 16:53:51 -08:00
Steve Yegge 33627567f1 chore: force clean wrong-prefix entries 2025-12-14 16:53:32 -08:00