Commit Graph

3255 Commits

Author SHA1 Message Date
Steve Yegge
5bceda10a4 chore: sync beads 2025-12-16 01:18:33 -08:00
Steve Yegge
8306b2b8f3 Merge bd-2k5f-pumpjack: GH#483 2025-12-16 01:18:02 -08:00
Steve Yegge
3be20d64da chore: sync beads 2025-12-16 01:17:54 -08:00
Steve Yegge
3baf4ae50a Merge bd-7r4l-prospector: GH#540 2025-12-16 01:17:25 -08:00
Steve Yegge
72441eea49 Merge bd-cddj-nux: GH#519 2025-12-16 01:17:25 -08:00
Steve Yegge
2e9b5a5870 Merge bd-xoyh-morsov: GH#517 2025-12-16 01:17:18 -08:00
Steve Yegge
60ae6586e7 Merge bd-zbyb-gusher: GH#509 worktrees 2025-12-16 01:16:46 -08:00
Steve Yegge
2d1c8900cb chore: sync beads 2025-12-16 01:16:40 -08:00
Steve Yegge
a518581a86 Merge bd-6xfz-furiosa: GH#405 prefix parsing 2025-12-16 01:16:26 -08:00
Steve Yegge
b3fef08fd4 Merge bd-bscs-driller: GH#403 doctor --fix 2025-12-16 01:15:51 -08:00
Steve Yegge
40c6893f33 Merge bd-er7r-derrick: GH#444 status naming 2025-12-16 01:15:36 -08:00
Steve Yegge
11c3bb4fdb Merge bd-0yzm-ace: GH#522 --type flag for bd update 2025-12-16 01:15:11 -08:00
Steve Yegge
3d8750883c chore: track and close GH#405 fix 2025-12-16 01:14:03 -08:00
Steve Yegge
e3b6091931 feat(sync): add --check flag for pre-sync integrity checks (bd-hlsw.1)
Add bd sync --check command that performs pre-sync integrity checks
without modifying state:

1. Force push detection: Detects when sync branch has diverged from
   remote, indicating a potential force push

2. Prefix mismatch detection: Scans JSONL for issues that don't match
   the configured prefix

3. Orphaned children detection: Finds issues with parent references
   to non-existent issues

Outputs diagnostic with actionable suggestions for each problem found.
Exits with code 1 if any problems are detected.

Implements bd-hlsw.1: Pre-sync integrity check
2025-12-16 01:13:23 -08:00
Steve Yegge
77aeb50d27 fix(utils): parse multi-hyphen prefixes correctly (GH#405)
The ExtractIssuePrefix function was falling back to first-hyphen
extraction when the suffix didn't look like a hash (e.g., 4+ char
words without digits). This broke prefixes like 'hacker-news' where
an issue ID 'hacker-news-test' would incorrectly extract 'hacker'.

Fix: Always use last-hyphen extraction for alphanumeric suffixes.
Only fall back to first-hyphen for non-alphanumeric suffixes.

Examples:
- 'hacker-news-test' -> 'hacker-news' (was: 'hacker')
- 'me-py-toolkit-abc' -> 'me-py-toolkit' (was: 'me')
- 'vc-baseline-hello' -> 'vc-baseline' (was: 'vc')

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 01:13:15 -08:00
Steve Yegge
9458922f26 chore: close GH#509 - already fixed by PR #478 2025-12-16 01:10:10 -08:00
Steve Yegge
69ac8fdbc2 chore: close bd-l0pg (duplicate GH#483) 2025-12-16 01:10:02 -08:00
Steve Yegge
25b3876113 chore: sync beads - close GH#522 2025-12-16 01:09:28 -08:00
Steve Yegge
53ccbfa217 fix: bd sync works when on sync branch (GH#519)
When sync.branch is set to the current branch (e.g., main), bd sync
now commits directly instead of failing with a worktree error.

Changes:
- sync.go: Detect when current branch == sync branch and skip worktree
- sync.go: Show appropriate messages for direct-mode commits/pulls
- doctor.go: Change from Error to OK status when on sync branch

The fix allows users to work directly on the sync branch without
having to switch to a different branch for bd sync to work.

Closes: GH#519

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 01:09:22 -08:00
Steve Yegge
57cb73dc89 chore: close bd-zci3 (GH#540 silent quick-capture) 2025-12-16 01:09:19 -08:00
Steve Yegge
1016559ad7 chore: close bd-boh7 (GH#403 fix) 2025-12-16 01:09:08 -08:00
Steve Yegge
cd8320fe3e feat: add silent quick-capture mode (bd q)
Add a truly silent quick-capture command that outputs only the issue ID,
enabling seamless script integration and reducing noise in AI conversations.

Changes:
- Add --silent flag to 'bd create' command
- Create new 'bd q' alias for quick capture
- Suppress warnings in silent/quiet mode

Usage:
  bd q "Fix login bug"           # Outputs only: bd-a1b2
  ISSUE=$(bd q "New feature")    # Capture ID in variable
  bd create "Task" --silent       # Same as bd q

Closes #540

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 01:08:40 -08:00
Steve Yegge
eac8ecc667 fix(doctor): remove circular error message in --fix mode
When `bd doctor --fix` fails to apply a fix, it was showing
"Manual fix: Run 'bd doctor --fix' ..." which is circular and unhelpful.

Now extracts just the manual command from the fix message:
- "..., or manually: <cmd>" -> extracts <cmd>
- "bd doctor --fix or <alt>" -> extracts <alt>
- No alternative available -> shows nothing

Closes GH#403

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 01:08:20 -08:00
Steve Yegge
00cd799fc3 chore: close bd-forz (GH#444 fix) 2025-12-16 01:08:11 -08:00
Steve Yegge
7d35ced5ae feat(update): add --type flag to bd update command (GH#522)
Allow changing an issue type (bug, feature, task, epic, chore) via the
bd update command. The storage layer already supported issue_type in
allowedUpdateFields, this just exposes it through the CLI.

Changes:
- Add --type/-t flag to updateCmd in show.go
- Add IssueType field to UpdateArgs in protocol.go
- Handle issue_type in updatesFromArgs in server_issues_epics.go
- Add validation using ParseIssueType before update

Example usage:
  bd update ab-xyz --type epic

Fixes: #522
2025-12-16 01:08:11 -08:00
Steve Yegge
c4e30c0f0c chore: close bd-drmg (GH#483 fix) 2025-12-16 01:08:04 -08:00
Steve Yegge
0c9e78f42e fix: improve priority format documentation and error message (GH#517)
Claude was using word-based priorities like "medium" instead of numeric
values (0-4 or P0-P4), causing bd create commands to fail in a loop.

Changes:
- Update bd prime output to clearly document priority format with example
- Add explicit note: NOT "high"/"medium"/"low"
- Improve error message to mention that words are not valid

Closes #517

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 01:07:55 -08:00
Steve Yegge
3c58e0aa25 fix(hooks): pre-commit no longer blocks when .beads removed (GH#483)
Two fixes to make pre-commit hook more resilient:

1. Check if beads is actually initialized (has db, config, or jsonl)
   - Empty .beads directory no longer triggers sync attempt
   - Handles case where .beads was removed from git but dir lingers

2. Make sync failure a warning instead of blocking error
   - Beads issues shouldn't prevent code commits
   - User can still run 'bd sync --flush-only' manually

Also synced examples/git-hooks/pre-commit with template (worktree handling).

Closes #483

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 01:07:48 -08:00
Steve Yegge
de75e5181c feat(sync): improve divergence recovery UX (bd-vckm)
When sync branch diverges significantly from remote, provide clear
recovery options instead of a confusing rebase conflict error.

- Add CheckDivergence() to detect and report sync branch divergence
- Add ResetToRemote() to reset local sync branch to remote state
- Add --reset-remote and --force-push flags for recovery
- Improve error message when rebase fails to include recovery steps

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 01:07:34 -08:00
Steve Yegge
4bf369a618 fix(docs): use consistent in_progress status naming (GH#444)
Changed all user-facing documentation and help text to use `in_progress`
(underscore) instead of `in-progress` (hyphen) to match the canonical
status value.

Files updated:
- cmd/bd/ready.go - Short description
- cmd/bd/status.go - Long description
- commands/stats.md - Action suggestion
- README.md - Workflow description

Note: CSS class names, HTML IDs, and GitHub label mappings intentionally
kept with hyphens as they follow different conventions.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 01:07:33 -08:00
Steve Yegge
39e09449cc fix: orphan detection false positive with dots in directory name
Only treat issue IDs as hierarchical (parent.child) when the dot appears
AFTER the first hyphen. This prevents false positives when the project
directory name contains a dot (e.g., "my.project-abc123" was incorrectly
being treated as having parent "my").

Fixes GH#508

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 01:06:14 -08:00
Steve Yegge
2c86404d65 fix: resolve P2 sync noise and cleanup issues
- bd-6pni: Auto-filter tombstoned issues with mismatched prefixes during
  import instead of failing. Tombstones from contributor PRs with different
  test prefixes are pollution and safe to ignore.

- bd-ffr9: Stop recreating deletions.jsonl after tombstone migration.
  Added IsTombstoneMigrationComplete() check to all code paths that write
  to the legacy deletions manifest.

- bd-admx: Fix perpetual "JSONL file hash mismatch" warning. Now clears
  both export_hashes AND jsonl_file_hash when mismatch detected, so the
  warning doesn't repeat.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 00:56:06 -08:00
Steve Yegge
88ccce884c chore: update Go toolchain to 1.24.11 to address CVEs
Fixes #565. Updates toolchain from go1.24.2 to go1.24.11 to address:
- CVE-2025-22874: crypto/x509 ExtKeyUsageAny policy validation
- CVE-2025-47907: database/sql Postgres Scan race condition
- CVE-2025-58183: archive/tar unbounded allocation
- CVE-2025-58186: net/http unbounded headers
- CVE-2025-58187: crypto/x509 name constraint resource consumption
- CVE-2025-61729: crypto/x509 excessive resource consumption

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 00:52:54 -08:00
Steve Yegge
25ea1e7de3 docs: fix broken relative links across documentation
Fixes 46 broken relative links across 20 documentation files in docs/.

Changes:
- Added ../ prefix for root files (README.md, AGENTS.md)
- Removed ../ prefix for sibling docs files
- Removed dead links to non-existent files
- Fixed subdirectory paths

Based on PR #574 by chrisvaillancourt.

Co-Authored-By: Chris Vaillancourt <chrisvaillancourt@users.noreply.github.com>
2025-12-16 00:46:08 -08:00
Steve Yegge
8c45069228 fix(doctor,sync): clean up deletions manifest and reduce sync noise
- bd-8v5o: When doctor --fix hydrates issues from git history, also
  remove them from the deletions manifest to prevent perpetual skip
  warnings during sync

- bd-wsqt: Remove verbose per-issue "Skipping bd-xxx" messages during
  sync. Caller already shows summary of skipped issues.

Added RemoveDeletions() function to deletions package with tests.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 00:42:36 -08:00
Steve Yegge
171f7de250 Merge pull request #584 from rsnodgrass/repair-hashes
fix(rename-prefix): use hash IDs instead of sequential in --repair mode
2025-12-16 00:42:32 -08:00
Steve Yegge
4657ec7640 Merge pull request #569 from crcatala/feature/daemon-status-config
feat(daemon): show configuration in `bd daemon --status` output
2025-12-16 00:35:07 -08:00
Steve Yegge
07fc9bf094 Merge pull request #564 from deblasis/fix-daemon-stale-cache
fix(daemon): detect external db file replacement
2025-12-16 00:34:57 -08:00
Ryan Snodgrass
627ac1afb8 fix(import): skip cross-prefix content matches instead of triggering rename
When importing issues, if an incoming issue has the same content hash as an
existing issue but a DIFFERENT prefix, this should not be treated as a rename.
Cross-prefix content matches occur when importing issues from other projects
that happen to have identical content.

Previously, the importer would call handleRename which tries to create an issue
with the incoming prefix, failing prefix validation ("does not match configured
prefix" error).

The fix checks if prefixes differ before calling handleRename:
- Same prefix, different ID suffix → true rename, call handleRename
- Different prefix → skip incoming issue, keep existing unchanged

Added test: TestImportCrossPrefixContentMatch reproduces the bug scenario
where alpha-* issues exist but beta-* issues are imported with same content.
2025-12-16 00:29:19 -08:00
Ryan Snodgrass
421d41dfa0 docs: add detailed comments explaining ID formats and merge deletion logic
Document the intent and nuances of recent fixes:

internal/importer/utils.go:
- RenameImportedIssuePrefixes: explain the three ID formats (sequential,
  hash-based, hierarchical) and how prefix renaming preserves identity
- isValidIDSuffix: document why dots are allowed (hierarchical parent-child
  relationships) and what characters are rejected

cmd/bd/deletion_tracking.go:
- isIssueNotFoundError: explain why "not found" is success during merge
  (issue may be tombstoned, never existed locally, or manually deleted)
- Deletion loop: document what "accepted deletions" means and why we
  tolerate missing issues during the pruning phase
2025-12-16 00:17:40 -08:00
Ryan Snodgrass
e3d8119f8e fix(sync): tolerate "issue not found" during 3-way merge deletion
During sync, the 3-way merge logic tries to delete issues that were
removed remotely. If an issue is already gone (tombstoned or never
existed locally), that shouldn't be an error - the goal is just to
ensure the issue is deleted.

Changes:
- Add isIssueNotFoundError helper to detect missing issue errors
- Skip "issue not found" errors during merge deletion (count as success)
- Update stats output to show already-gone count when relevant
2025-12-16 00:15:35 -08:00
Brennon Bortz
68135806c6 feat(show): Display status for all dependent issues (#583)
Update bd show command to include status information for all dependency
types (children, blocks, related, discovered). Issues now display with
format [P1 - closed] instead of just [P1].

This provides better visibility into the state of dependent issues
without needing to run bd show on each individual issue.

Changes:
- Updated daemon mode formatting for all dependency types (lines 208, 214, 220, 226)
- Updated direct mode formatting for all dependency types (lines 400, 406, 412, 418)
- Changed format from "[P%d]" to "[P%d - %s]" with dash separator

Example output:
Children (9):
  ↳ pma-an8: Create config.py module [P1 - closed]
  ↳ pma-38g: Create utils.py module [P1 - open]

Blocks (1):
  ← pma-uzm: Adapt validate_outputs.py [P1 - blocked]

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-16 00:13:51 -08:00
Ryan Snodgrass
c7b45a8a40 fix(import): support hierarchical hash IDs in --rename-on-import
The isNumeric function was rejecting valid hierarchical hash IDs like
'6we.2' that contain dots for parent.child notation. This caused
`bd import --rename-on-import` to fail with "non-numeric suffix" errors.

Changes:
- Rename isNumeric to isValidIDSuffix for clarity
- Accept dots (.) in addition to alphanumeric for hierarchical IDs
- Update test cases to cover hierarchical ID formats
2025-12-16 00:12:10 -08:00
dependabot[bot]
d6df22fc75 chore(deps): bump golang.org/x/mod from 0.30.0 to 0.31.0 (#580)
Bumps [golang.org/x/mod](https://github.com/golang/mod) from 0.30.0 to 0.31.0.
- [Commits](https://github.com/golang/mod/compare/v0.30.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/mod
  dependency-version: 0.31.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-16 00:07:59 -08:00
Charles P. Cross
a69e94a958 Auto-disable daemon in git worktrees for safety (#567)
* feat: auto-disable daemon in git worktrees for safety

Implement worktree daemon compatibility as proposed in the analysis.
The daemon is now automatically disabled when running in a git worktree
unless sync-branch is configured.

Git worktrees share the same .beads directory, and the daemon commits
to whatever branch its working directory has checked out. This causes
commits to go to the wrong branch when using daemon in worktrees.

- Add shouldDisableDaemonForWorktree() helper that checks:
  1. If current directory is a git worktree (via git rev-parse)
  2. If sync-branch is configured (env var or config.yaml)
- Modify shouldAutoStartDaemon() to call the helper
- Modify daemon connection logic in main.go to skip connection
- Add FallbackWorktreeSafety constant for daemon status reporting
- Update warnWorktreeDaemon() to skip warning when sync-branch configured

- In worktree WITHOUT sync-branch: daemon auto-disabled, direct mode used
- In worktree WITH sync-branch: daemon enabled (commits go to dedicated branch)
- In regular repo: no change (daemon works as before)

- Added comprehensive unit tests for shouldDisableDaemonForWorktree()
- Added integration tests for shouldAutoStartDaemon() in worktree contexts
- Manual E2E testing verified correct behavior

- Updated WORKTREES.md with new automatic safety behavior
- Updated DAEMON.md with Git Worktrees section

* feat: check database config for sync-branch in worktree safety logic

Previously, the worktree daemon safety check only looked at:
- BEADS_SYNC_BRANCH environment variable
- sync-branch in config.yaml

This meant users who configured sync-branch via `bd config set sync-branch`
(which stores in the database) would still have daemon disabled in worktrees.

Now the check also reads sync.branch from the database config table,
making daemon work in worktrees when sync-branch is configured via any method.

Changes:
- Add IsConfiguredWithDB() function that checks env, config.yaml, AND database
- Add findBeadsDB() to locate database (worktree-aware via git-common-dir)
- Add getMainRepoRoot() helper using git rev-parse
- Add getConfigFromDB() for lightweight database reads
- Update shouldDisableDaemonForWorktree() to use IsConfiguredWithDB()
- Update warnWorktreeDaemon() to use IsConfiguredWithDB()
- Add test case for database config path

* refactor: use existing beads.FindDatabasePath() instead of duplicating code

Remove duplicate getMainRepoRoot() and findBeadsDB() functions from
syncbranch.go and use the existing beads.FindDatabasePath() which is
already worktree-aware.

Changes:
- Replace custom findBeadsDB() with beads.FindDatabasePath()
- Remove duplicate getMainRepoRoot() (git.GetMainRepoRoot() exists)
- Remove unused imports (exec, strings, filepath)
- Clean up debug logging in tests

---------

Co-authored-by: Charles P. Cross <cpdata@users.noreply.github.com>
2025-12-16 00:06:19 -08:00
Ryan Snodgrass
fa566a9700 fix(rename-prefix): use hash IDs instead of sequential in --repair mode
The --repair flag was generating sequential IDs (sageox-9895, sageox-9896)
instead of hash-based IDs (sageox-jwnv, sageox-urtm). This fix uses the
proper GenerateIssueID function from sqlite package to generate consistent
hash-based IDs during prefix repair operations.

Changes:
- Import sqlite package for hash ID generation
- Add generateRepairHashID helper that uses sqlite.GenerateIssueID
- Track used IDs within batch to avoid collisions
- Update test to verify hash IDs instead of sequential
2025-12-15 23:59:21 -08:00
Steve Yegge
9544558840 ci: add check to reject PRs with .beads/issues.jsonl changes
Contributors frequently fork the repo and accidentally include their local
.beads/issues.jsonl changes in PRs. This adds:

1. A new CI job that fails PRs containing .beads/issues.jsonl changes
2. Clear error message with fix instructions
3. Updated CONTRIBUTING.md with guidance

This should prevent the common issue of PRs including unintended database changes.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 23:43:30 -08:00
Steve Yegge
8e55b758aa chore(nix): update vendorHash for all Go dependency updates
Updated vendorHash after merging all Go dependency bumps:
- cobra 1.10.1 → 1.10.2
- x/term 0.37.0 → 0.38.0
- go-sqlite3 0.30.1 → 0.30.3
- anthropic-sdk 1.18.1 → 1.19.0

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 23:03:34 -08:00
Alessandro De Blasis
68d520dcae Merge branch 'main' of github.com:deblasis/beads into fix-daemon-stale-cache 2025-12-16 08:01:10 +01:00
Steve Yegge
c86a587880 chore(nix): recalculate vendorHash after more Go deps 2025-12-15 23:00:34 -08:00