Commit Graph

4347 Commits

Author SHA1 Message Date
Steve Yegge
f312101d5d bd sync: 2025-12-29 17:02:23 2025-12-29 17:02:23 -08:00
Steve Yegge
a4035b1422 bd sync: 2025-12-29 16:40:06 2025-12-29 16:40:20 -08:00
Steve Yegge
1b15ec2765 bd sync: 2025-12-29 15:27:19 2025-12-29 16:40:20 -08:00
Steve Yegge
f19e5c65ad chore: Bump version to 0.41.0
Update version across all components:
- cmd/bd/version.go
- .claude-plugin/plugin.json, marketplace.json
- npm-package/package.json
- integrations/beads-mcp/pyproject.toml
- Git hook templates

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 16:34:14 -08:00
Steve Yegge
ef7c2b3076 docs: Prepare v0.41.0 release notes
Update CHANGELOG.md and info.go versionChanges with comprehensive
changelog for v0.41.0 release including:
- bd swarm commands for multi-agent batch coordination
- bd repair for orphaned reference detection
- bd compact --purge-tombstones
- Multiple bug fixes (GH#785, #786, #787, #796, #798, #799)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 16:33:32 -08:00
Steve Yegge
0521910503 fix: --var flag now allows commas in values (#786)
Changed all --var flags from StringSlice to StringArray.
StringSlice splits on commas, breaking values like 'desc=A, B, C'.
StringArray only splits on separate --var flags.

Affected commands: pour, cook, wisp, mol distill, mol bond, template instantiate

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 16:17:51 -08:00
Steve Yegge
a08dd63079 test: fix config test environment pollution
Tests were failing when BD_ACTOR or other BD_/BEADS_ environment
variables were set. Added envSnapshot helper to save, clear, and
restore environment variables for proper test isolation.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 16:08:43 -08:00
Steve Yegge
f150590c27 Merge PR #802: test: expand routing and compact coverage 2025-12-29 16:01:19 -08:00
Jordan Hubbard
c9fa7af04c test: expand compact and ui coverage 2025-12-29 16:01:11 -08:00
Steve Yegge
d3b6855aa9 fix: resolve lint errors blocking CI
- Add explicit error checking for fmt.Fprintf/Fprintln in claude.go
- Add gosec nolint for safe exec.CommandContext calls in sync_git.go
- Remove unused error return from findTownRoutes in routes.go

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 15:58:24 -08:00
Steve Yegge
53a63f2779 fix: edge case in normalizeBeadsRelPath for similar prefixes
Code review caught that ".beads" would incorrectly match prefixes like
".beads-backup". Changed to match ".beads/" (with trailing slash) to
ensure we only match the actual .beads directory.

Added test cases for this edge case.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 15:51:17 -08:00
Steve Yegge
0fa97a4c30 fix: bd sync fails in bare repo worktrees (#785)
The bug: In a bare repo + worktrees setup, jsonlRelPath was calculated
relative to the project root (which contains all worktrees), resulting in
paths like "main/.beads/issues.jsonl". But the sync branch worktree uses
sparse checkout for .beads/*, so files are at ".beads/issues.jsonl".

This caused copyJSONLToMainRepo to look in the wrong location, silently
returning when the file was not found.

Fix: Add normalizeBeadsRelPath() to strip leading path components before
".beads", ensuring correct path resolution in both directions:
- copyJSONLToMainRepo (worktree -> local)
- SyncJSONLToWorktreeWithOptions (local -> worktree)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 15:39:23 -08:00
Steve Yegge
1256352d49 fix: bd delete --cascade now recursively deletes dependents (#787)
The --cascade flag was documented but not working for single-issue
deletes. The bug had two causes:

1. CLI direct mode: Single-issue deletes bypassed the batch path where
   cascade expansion actually happens. Fixed by routing cascade deletes
   through deleteBatch() regardless of issue count.

2. Daemon/RPC mode: handleDelete() iterated through IDs individually
   without expanding dependents. Fixed by using DeleteIssues() with
   cascade flag when SQLite storage is available.

Now `bd delete <id> --cascade --force` correctly deletes the target
issue plus all issues that depend on it (recursively).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 15:10:59 -08:00
Steve Yegge
05c8bbe4f9 fix: bd doctor falsely reports pre-push hook is not a bd hook (#799)
The CheckSyncBranchHookCompatibility was checking core.hooksPath first,
while CheckGitHooks always uses .git/hooks/. This caused inconsistent
results when core.hooksPath was set globally.

Fix: Remove core.hooksPath check from CheckSyncBranchHookCompatibility
to match CheckGitHooks behavior. Both now consistently use .git/hooks/.

Note: A future improvement could make both respect core.hooksPath.
2025-12-29 14:55:42 -08:00
Steve Yegge
c2c2ef5d07 feat: Update agent ID validation for canonical naming (gt-zvte2)
Updates ValidateAgentID to accept canonical format: prefix-rig-role-name
- Rig-level: gt-<rig>-witness (was gt-witness-<rig>)
- Named: gt-<rig>-crew-<name> (was gt-crew-<rig>-<name>)

Town-level agents unchanged: gt-mayor, gt-deacon

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 14:55:06 -08:00
Steve Yegge
e652449634 bd sync: 2025-12-29 14:04:26 2025-12-29 14:55:06 -08:00
Steve Yegge
59bc2cd059 fix: remove gitignore negations that override fork protection (#796)
The negation patterns (!issues.jsonl, !interactions.jsonl, etc.) in
.beads/.gitignore had higher precedence than the fork protection
exclusion in .git/info/exclude, effectively defeating fork protection.

Contributors could accidentally stage and commit upstream issue
databases because:
1. Fork protection added .beads/issues.jsonl to .git/info/exclude
2. .beads/.gitignore had !issues.jsonl which overrode the exclusion
3. .gitignore files have higher precedence than .git/info/exclude

The negation patterns were unnecessary anyway since no pattern in
.beads/.gitignore matches those files. Added a comment explaining
why negations should not be added.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 14:52:29 -08:00
Nahum Shalman
fd5bea7ff9 fix: add illumos/solaris support for disk space check (#798)
Solaris/illumos use Statvfs (POSIX standard) rather than Statfs.
Add daemon_health_solaris.go and exclude illumos/solaris from the
generic unix build constraint.

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

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 14:43:00 -08:00
Steve Yegge
71e2f22849 fix: Add nolint comments for gosec/errcheck/unparam warnings
Fixes CI lint failures by adding appropriate nolint directives for:
- G204 (subprocess with variable) - git commands with trusted inputs
- G304 (file inclusion via variable) - paths from internal helpers
- G302/G306 (file permissions) - .gitignore needs 0644
- errcheck (unchecked return values) - fmt.Fprint* to stdout/stderr
- unparam (unused parameters) - reserved for future use
2025-12-29 14:39:43 -08:00
kraitsura
e5d1e721ed Add bd human command for focused help menu
bd has 70+ commands, which can be overwhelming for human users who just
want to track issues. The new `bd human` command displays a curated list
of ~15 essential commands organized by workflow:

- Working With Issues: create, list, show, update, close, reopen, comment
- Finding Work: ready, search, status, stats
- Dependencies: dep add/remove/tree, graph, blocked
- Setup & Sync: init, sync, doctor
- Getting Help: quickstart, help, --help

Also includes quick examples showing common workflows.

Changes:
- Add cmd/bd/human.go with curated help output
- Add "human" to noDbCommands list in main.go (no database needed)
2025-12-29 14:33:19 -08:00
Jordan Hubbard
12b797781d test: expand routing and compact coverage 2025-12-29 14:18:33 -08:00
Jordan Hubbard
cb280b0fad test: improve nodb and orphans coverage 2025-12-29 14:17:44 -08:00
Jordan Hubbard
9cefa98528 test: refactor claude setup for coverage 2025-12-29 14:17:44 -08:00
Jordan Hubbard
283a275740 test: refactor claude setup for coverage 2025-12-29 14:16:44 -08:00
Jordan Hubbard
8f8a075943 test: refactor factory setup for coverage (#790)
* test: add git helper and guard annotations

* chore: align release metadata with 0.40.0

* test: refactor factory setup for coverage
2025-12-29 14:15:56 -08:00
Steve Yegge
96c7cceefc refactor: Extract IssueDetails to shared type (bd-6dnt)
Consolidated 5 duplicate IssueDetails struct definitions into a single
types.IssueDetails in internal/types/types.go:

- Removed 4 inline definitions from cmd/bd/show.go
- Removed 1 inline definition from internal/rpc/server_issues_epics.go

The shared type embeds types.Issue by value and includes:
Labels, Dependencies, Dependents, Comments, and Parent fields.

This improves maintainability and reduces risk of inconsistency.
2025-12-29 14:04:35 -08:00
Steve Yegge
2c57d41275 fix: Show warning when config.yaml overrides database config (bd-20j)
bd config list now shows a warning when config.yaml or environment
variables override database settings. This addresses the confusion when
sync.branch from config.yaml takes precedence over the database value.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 14:03:39 -08:00
Steve Yegge
9eb61f9dd0 bd sync: 2025-12-29 14:03:20 2025-12-29 14:03:20 -08:00
Steve Yegge
31bed17090 bd sync: 2025-12-29 13:46:54 2025-12-29 13:47:12 -08:00
Steve Yegge
64d5f20b90 fix: Add pre-migration orphan cleanup to avoid chicken-and-egg failure (bd-eko4)
When the database has orphaned foreign key references (dependencies or labels
pointing to non-existent issues), the migration invariant check would fail,
preventing the database from opening. This created a chicken-and-egg problem:

1. bd doctor --fix tries to open the database
2. Opening triggers migrations with invariant checks
3. Invariant check fails due to orphaned refs
4. Fix never runs because database won't open

The fix adds CleanOrphanedRefs() that runs BEFORE captureSnapshot() in
RunMigrations. This automatically cleans up orphaned dependencies and labels
(preserving external:* refs), allowing the database to open normally.

Added test coverage for the cleanup function.
2025-12-29 13:47:04 -08:00
Steve Yegge
819208b8c1 fix: hq- prefix routing by finding town root for routes.jsonl
The routing code now walks up from the current beads directory to find
the Gas Town root (identified by mayor/town.json), then loads routes
from <townRoot>/.beads/routes.jsonl. The '.' path is correctly resolved
to the town beads directory.

Previously, routes.jsonl was only searched in the current beads dir,
which failed when working from rig subdirectories like crew/emma.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 13:46:10 -08:00
Steve Yegge
04da559511 bd sync: 2025-12-29 13:45:51 2025-12-29 13:45:51 -08:00
Steve Yegge
6ee7be5fe9 bd sync: 2025-12-29 13:40:37 2025-12-29 13:40:37 -08:00
Steve Yegge
0183af11d5 bd sync: 2025-12-29 13:34:01 2025-12-29 13:34:14 -08:00
Steve Yegge
9e5a548339 bd sync: 2025-12-29 12:59:10 2025-12-29 13:34:14 -08:00
Steve Yegge
5560a4243e refactor: Export FollowRedirect and consolidate duplicate implementations
- Rename followRedirect to FollowRedirect in internal/beads (export it)
- Update doctor/maintenance.go to use beads.FollowRedirect
- Update doctor/fix/common.go to use beads.FollowRedirect
- Remove 66 lines of duplicated code across 3 implementations

This ensures consistent redirect handling with path canonicalization,
chain prevention, and proper error warnings.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 13:23:05 -08:00
Steve Yegge
ef40856f2f fix: bd repair - consistent JSON error handling for find operations
Add exitWithError helper to ensure JSON output is used when --json
flag is set during orphan detection errors.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 13:16:47 -08:00
Steve Yegge
24966bd1ce fix: Handle .beads/redirect files and limit verbose output in bd doctor --fix
- Add resolveBeadsDir helper to fix/common.go to follow redirect files
- Update OrphanedDependencies, ChildParentDependencies, and MergeArtifacts
  to use resolveBeadsDir instead of hardcoded .beads path
- Add --verbose/-v flag to bd doctor command
- Only print individual items if verbose or count < 20, always show summary

(bd-dq74, bd-v55y)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 12:59:19 -08:00
Steve Yegge
cd942f136d feat: bd repair - add comments/events orphan detection and --json flag
- Check comments table for orphaned issue_id references
- Check events table for orphaned issue_id references
- Delete orphaned comments/events in repair transaction
- Add --json flag for machine-readable output with:
  - orphan_counts by type (dependencies, labels, comments, events)
  - orphan_details with full reference info
  - status (success, no_orphans, dry_run, error)
  - backup_path when applicable

(bd-2wm2, bd-ie7j)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 12:58:22 -08:00
Steve Yegge
75e2afdae5 bd sync: 2025-12-29 12:58:08 2025-12-29 12:58:08 -08:00
Steve Yegge
bd750b10ea bd sync: 2025-12-29 12:48:20 2025-12-29 12:48:35 -08:00
Steve Yegge
a6bba83f09 fix: bd repair - add transaction, backup, dirty_issues marking
Code review fixes for critical issues:
- Wrap all DELETEs in a transaction with rollback on error
- Create .pre-repair backup before any destructive operations
- Mark parent issues as dirty when deleting orphaned depends_on refs
- Fix misleading PreRun comment

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 12:47:34 -08:00
Steve Yegge
1facf7fb83 feat: Add bd repair command for orphaned foreign key refs (hq-2cchm)
When the database has orphaned dependencies or labels, the migration
invariant check fails and prevents the database from opening. This
creates a chicken-and-egg problem where bd doctor --fix cannot run.

The new bd repair command:
- Opens SQLite directly, bypassing invariant checks
- Deletes orphaned dependencies (issue_id or depends_on_id not in issues)
- Deletes orphaned labels (issue_id not in issues)
- Runs WAL checkpoint to persist changes
- Supports --dry-run to preview what would be cleaned

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 12:43:22 -08:00
Steve Yegge
93cc9df9ad bd sync: 2025-12-29 12:43:14 2025-12-29 12:43:14 -08:00
Steve Yegge
c45242a8d3 feat: Add --reason flag to bd delete for audit trail 2025-12-29 12:40:03 -08:00
Steve Yegge
7b92b42d38 bd sync: 2025-12-29 12:35:12 2025-12-29 12:38:22 -08:00
Steve Yegge
934196e102 refactor: Extract shared importFromJSONLData function
Eliminate code duplication between importFromGit and importFromLocalJSONL
by extracting the common JSONL parsing and import logic.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 12:38:02 -08:00
Steve Yegge
bb5c27c81b feat: Add bd init --from-jsonl for preserving manual cleanups
Adds --from-jsonl flag that imports from the current working tree's
.beads/issues.jsonl file instead of scanning git history. This prevents
deleted issues from being resurrected during re-initialization.

Use case: After running bd compact --purge-tombstones and committing
the cleaned JSONL, a subsequent bd init would previously re-import
all historical issues from git, defeating the cleanup.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 12:34:57 -08:00
Steve Yegge
6c42b461a4 feat: Add bd compact --purge-tombstones for dependency-aware cleanup (hq-n19iv)
Unlike --prune which removes tombstones by age, --purge-tombstones removes
tombstones that have no open issues depending on them, regardless of age.
Also cleans stale deps from closed issues to tombstones.

Usage:
  bd compact --purge-tombstones --dry-run  # Preview what would be purged
  bd compact --purge-tombstones            # Actually purge

Note: Use --no-daemon to prevent daemon from re-exporting after cleanup.
2025-12-28 23:46:22 -08:00
Steve Yegge
7f1f906c28 bd sync: 2025-12-28 23:46:11 2025-12-28 23:46:11 -08:00