Commit Graph

92 Commits

Author SHA1 Message Date
Ryan Snodgrass
84b4562fda Merge upstream/main into subtle-ux-improvements
Resolves conflicts and converts new defer/undefer commands from
fatih/color to the lipgloss semantic color system.

Key changes:
- Added StatusDeferred case in graph.go with ui.RenderAccent
- Converted status.go to use ui package for colorized output
- Converted defer.go/undefer.go to use ui package
- Merged GroupID and Aliases for status command
- Updated pre-commit hook version to 0.31.0
- Ran go mod tidy to remove fatih/color dependency
2025-12-20 17:22:43 -08:00
Ryan Snodgrass
6ca141712c refactor(ui): standardize on lipgloss semantic color system
Replace all fatih/color usages with internal/ui package that provides:
- Semantic color tokens (Pass, Warn, Fail, Accent, Muted)
- Adaptive light/dark mode support via Lipgloss AdaptiveColor
- Ayu theme colors for consistent, accessible output
- Tufte-inspired data-ink ratio principles

Files migrated: 35 command files in cmd/bd/

Add docs/ui-philosophy.md documenting:
- Semantic token usage guidelines
- Light/dark terminal optimization rationale
- Tufte and perceptual UI/UX theory application
- When to use (and not use) color in CLI output
2025-12-20 17:09:50 -08:00
Doug Campos
c7c212f8a1 fix(init): handle read-only gitignore gracefully in stealth mode (#663)
When the global gitignore file is read-only (e.g., symlink to immutable
location), print manual instructions instead of failing with an error.
2025-12-20 16:43:43 -08:00
Steve Yegge
7b758271ed feat(audit): add append-only agent audit trail (.beads/interactions.jsonl)
Implements audit logging for agent interactions to support auditing and
dataset generation (fixes #649).

New features:
- .beads/interactions.jsonl (append-only audit log)
- bd audit record: log LLM calls, tool calls, or pipe JSON via stdin
- bd audit label <id>: append labels (good/bad) for dataset curation
- bd compact --audit: optionally log LLM prompt/response during compaction
- bd init: creates empty interactions.jsonl
- bd sync: includes interactions.jsonl in staging

Audit entries are append-only - labeling creates new entries that
reference parent entries by ID.

Closes #649

Co-authored-by: Dmitry Chichkov <dchichkov@nvidia.com>

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 03:24:51 -08:00
matt wilkie
f1380e8b17 Refactor init command and remove redundant @AGENTS.md (#648) 2025-12-19 17:50:41 -08:00
Christian Catalan
cb5ebfc667 fix(init): update output to show hash-based ID format
The bd init and quickstart commands displayed outdated ID format
examples showing sequential IDs (prefix-1, prefix-2, ...) but beads
has used content-based hash IDs since bd-8e05.

Updated output now correctly shows:
  Issues will be named: prefix-<hash> (e.g., prefix-a3f2dd)

This matches the actual GenerateHashID implementation in
internal/types/id_generator.go which generates 6-8 char hex hashes.



test(init): update test expectations to match hash-based ID format

Tests were checking for the old sequential format (prefix-1, prefix-2)
but the code now outputs hash-based format (prefix-<hash>).

Co-authored-by: cc-vps <crcatala+vps@gmail.com>
2025-12-18 20:33:25 -08:00
Steve Yegge
52f3363b0f fix: resolve all golangci-lint errors
- errcheck: explicitly discard error returns for git config --unset
- gosec G304: add nolint for safe file read from hardcoded list
- gosec G306: add nolint for .gitattributes (must be world-readable)
- unparam: remove unused gitDir param, use _ for unused ctx
- unparam: change functions with always-nil error returns to void

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 17:50:25 -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
matt wilkie
e01b7412d9 feat: add Git worktree compatibility (PR #478)
Adds comprehensive Git worktree support for beads issue tracking:

Core changes:
- New internal/git/gitdir.go package for worktree detection
- GetGitDir() returns proper .git location (main repo, not worktree)
- Updated all hooks to use git.GetGitDir() instead of local helper
- BeadsDir() now prioritizes main repository's .beads directory

Features:
- Hooks auto-install in main repo when run from worktree
- Shared .beads directory across all worktrees
- Config option no-install-hooks to disable auto-install
- New bd worktree subcommand for diagnostics

Documentation:
- New docs/WORKTREES.md with setup instructions
- Updated CHANGELOG.md and AGENT_INSTRUCTIONS.md

Testing:
- Updated tests to use exported git.GetGitDir()
- Added worktree detection tests

Co-authored-by: Claude <noreply@anthropic.com>
Closes: #478
2025-12-13 12:50:33 -08:00
Steve Yegge
de7b511765 fix(stealth): use project-specific paths in global gitignore (#538)
Stealth mode was adding generic `.beads/` pattern to global gitignore,
which ignored ALL .beads/ folders across all repositories. Users who
want stealth mode in one project but open beads usage in others were
blocked.

Now uses absolute project paths instead:
- `/path/to/project/.beads/`
- `/path/to/project/.claude/settings.local.json`

This allows multiple stealth projects while other repos can use beads
openly.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 10:58:23 -08:00
Ryan Stortz
4254c3f2f5 feat(config): add BD_NO_INSTALL_HOOKS environment variable to disable git hook installation (#500)
* feat(config): add no-install-hooks config to disable git hook installation

Add `no-install-hooks` boolean config that prevents git hook installation
during `bd init`. This can be set via:
- Environment variable: BD_NO_INSTALL_HOOKS=1
- Global config: ~/.config/bd/config.yaml with `no-install-hooks: true`
- Local config: .beads/config.yaml with `no-install-hooks: true`

The existing `--skip-hooks` flag continues to work and takes precedence.
Default behavior unchanged: hooks install by default.

* docs: add no-install-hooks to configuration documentation

- Add no-install-hooks to Supported Settings table in CONFIG.md
- Add example in config file section
- Add "Disabling Hook Installation" section to GIT_INTEGRATION.md
  with examples for flag, env var, and config file methods
2025-12-13 06:38:26 -08:00
Steve Yegge
ce119551f6 fix(init): use correct gitRef in error message, remove unused var
Small fixes from code review:
- Error message now shows actual gitRef instead of hardcoded HEAD
- Removed unused lineNum variable in readFirstIssueFromGit

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 14:51:32 -08:00
Steve Yegge
0d2dc53c67 fix(init): bootstrap from sync-branch when configured (bd-0is)
When sync-branch is configured in config.yaml, bd init now reads from
that branch (origin/<branch> first, then local <branch>) instead of
HEAD. This ensures fresh clones correctly import issues from the sync
branch.

Key changes:
- checkGitForIssues() now returns gitRef (third return value)
- New getLocalSyncBranch() reads sync-branch directly from config.yaml
  (not cached global config) to handle test environments where CWD changes
- importFromGit() accepts gitRef parameter to read from correct branch
- Added readFirstIssueFromGit() for prefix auto-detection from git
- Fixed macOS symlink issue: filepath.EvalSymlinks() ensures /var and
  /private/var paths are normalized before filepath.Rel()

Part of GitHub issue #464 (beads deletes issues in multi-clone environments)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 14:47:02 -08:00
Steve Yegge
d880fceb0f fixed GH issue #444 2025-12-01 21:26:25 -08:00
Steve Yegge
3df138445a fix(init): allow fresh clones with JSONL to run bd init (bd-4h9)
Previously, bd init blocked when JSONL existed with issues but no database,
telling users to run 'bd doctor --fix'. But doctor --fix just ran bd migrate
which requires an existing database - creating a circular dependency.

Now:
- bd init allows fresh clones (JSONL exists, no database) to proceed
- bd init creates the database and imports from JSONL automatically
- bd doctor --fix runs bd init (not migrate) when there's no database

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 21:18:23 -08:00
Steve Yegge
f8c87aba73 feat(sync): read sync-branch from config.yaml (bd-io0)
sync.branch config was lost on clone because it was only stored in
the database (which is gitignored). Now syncbranch.Get() checks:
1. BEADS_SYNC_BRANCH env var (highest)
2. config.yaml sync-branch (tracked, persists across clones)
3. Database config (local override)
4. Empty (use current branch)

Changes:
- Update syncbranch.Get() to check config.yaml
- Update config.yaml template with sync-branch option
- Set sync-branch: beads-sync in this repo config.yaml

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 10:55:41 -08:00
Steve Yegge
0b13a0df3c fix: support git worktrees in hooks installation
Use `git rev-parse --git-dir` instead of hardcoded `.git` path to find
the actual git directory. In worktrees, `.git` is a file containing a
gitdir pointer, not a directory.

Changes:
- Add getGitDir() helper in hooks.go
- Update installHooks(), uninstallHooks(), CheckGitHooks() to use it
- Update hooksInstalled(), detectExistingHooks(), installGitHooks() in init.go
- Update checkHooksQuick() in doctor.go
- Update GitHooks() in doctor/fix/hooks.go
- Update tests to use real git repos via `git init`

Fixes bd-63l

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 23:19:57 -08:00
Steve Yegge
d5f2d91d04 fix(ci): more changes to fix failing CI (#415)
Fixes from maphew including:
- Remove test for deleted isPathWithinDir function
- Add gosec nolint directives for safe file operations
- Add rm -rf .beads before init in CI workflow
- Simplify panic handling and file operations

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

Co-Authored-By: maphew <maphew@users.noreply.github.com>
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 22:24:29 -08:00
Steve Yegge
cd114b7bd5 feat: extract error handling helpers FatalError/WarnError (bd-s0z)
Create reusable error handling helpers to reduce boilerplate and
enforce consistency across the codebase:

- FatalError(format, args...): writes "Error: ..." to stderr and exits
- FatalErrorWithHint(message, hint): includes actionable suggestion
- WarnError(format, args...): writes "Warning: ..." to stderr

Prototyped in create.go to validate the approach - converted 13 error
patterns and 5 warning patterns. This reduces code from:

    fmt.Fprintf(os.Stderr, "Error: %v\n", err)
    os.Exit(1)

To simply:

    FatalError("%v", err)

Also fixed countIssuesInJSONLFile reference after earlier refactoring.

See docs/ERROR_HANDLING.md for the three-pattern guideline.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 23:28:30 -08:00
Steve Yegge
40b07045c7 refactor: deduplicate FindJSONLInDir function (bd-8a5)
Extract shared JSONL file discovery logic to internal/utils/path.go.
Both autoimport and beads packages now use this shared implementation.

Changes:
- Add utils.FindJSONLInDir with common logic
- Update autoimport.go to use utils.FindJSONLInDir
- Update beads.go to delegate to utils.FindJSONLInDir
- Update server_export_import_auto.go to use utils.FindJSONLInDir
- Move FindJSONLInDir test to utils/path_test.go
- Fix pre-existing duplicate countIssuesInJSONLFile in init.go

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 23:07:53 -08:00
Steve Yegge
3a4840169d fix(init): add safety guard to prevent overwriting existing data
bd init now refuses when:
- JSONL file exists with >0 issues (fresh clone scenario)
- Database file already exists (already initialized)

Suggests `bd doctor --fix` for fresh clones and provides clear guidance.
Added --force flag to bypass the safety guard when needed.

Closes: bd-emg

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 22:15:13 -08:00
Jimmy Stridh
bb16f247c6 fix(init): error on invalid JSON instead of overwriting settings (#404)
Previously, setupClaudeSettings would silently create an empty settings
map when json.Unmarshal failed, then write just a prompt field to the
file - destroying all existing user settings (permissions, hooks, etc).

Now returns a clear error asking the user to fix the JSON syntax
manually, preserving their original file contents.

Also properly handles permission errors when reading existing files.

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

Co-authored-by: Jimmy Stridh <jimmystridh@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-11-28 18:51:27 -08:00
Steve Yegge
6294ef0cc6 fix(init,import): preserve metadata.json and improve prefix detection
- bd init now preserves existing metadata.json settings instead of
  overwriting with defaults (bd-zai)
- bd init detects existing JSONL filename (beads.jsonl vs issues.jsonl)
  when creating new metadata.json
- bd import now correctly reports prefix source ("issues" vs "directory")
- bd import avoids using ".beads" as prefix when run from inside .beads/

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 22:57:17 -08:00
Steve Yegge
340b3507b9 fix: expand tilde in global gitignore path from git config
git config --global core.excludesfile may return paths like ~/...
which Go does not expand. This caused setupGlobalGitIgnore to fail
when users had configured their gitignore with a tilde path.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 19:06:50 -08:00
Dane Bertram
81d23790dc refactor: remove global gitattributes setup from init --stealth mode (#391)
Removes global gitattributes setup from stealth mode, keeping only the global gitignore configuration. CI failures are pre-existing (TestZFCSkipsExportAfterImport timeout).
2025-11-26 14:31:23 -08:00
Steve Yegge
ddced40153 fix: add nosec annotations for gosec lint warnings 2025-11-25 18:22:05 -08:00
Dane Bertram
c33e984d66 feat(init): add --stealth flag for invisible beads usage (#381)
Adds `bd init --stealth` to enable beads usage without affecting repo collaborators:
- Global gitattributes: configures beads merge driver across all repos
- Global gitignore: prevents .beads/ and .claude/settings.local.json from being committed
- Claude Code integration: adds 'bd onboard' instruction automatically
- Respects existing global git config files, only creates when necessary

Perfect for personal experimentation or contributing to repos where not everyone uses beads.

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-25 14:46:01 -08:00
Steve Yegge
8d6696af40 docs: Complete error handling audit
- Add comprehensive audit document tracking all error patterns
- Update ERROR_HANDLING.md with metadata distinction guidelines
- Document init.go error handling patterns with metadata notes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 00:35:04 -08:00
Steve Yegge
1c715bc61c Fix bd-fwul: Add executable bit validation for git hooks
Added validation to hooksInstalled() to check if hook files have the
executable bit set. Previously we only checked for file existence and
marker strings, which meant hooks could appear installed but fail
silently if they weren't executable.

The fix adds Mode().Perm() & 0111 checks for both pre-commit and
post-merge hooks after verifying their content.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 21:48:54 -08:00
Steve Yegge
19098b92ee Fix unused variable in init.go
Remove unused yellow color variable that was causing build warning.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 20:32:49 -08:00
Steve Yegge
83246c8a2c Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 20:22:03 -08:00
Steve Yegge
e3e0a04496 Add configurable export error handling policies (bd-exug)
Implements flexible error handling for export operations with four policies:
- strict: Fail-fast on any error (default for user exports)
- best-effort: Skip errors with warnings (default for auto-exports)
- partial: Retry then skip with manifest tracking
- required-core: Fail on core data, skip enrichments

Key features:
- Per-project configuration via `bd config set export.error_policy`
- Separate policy for auto-exports: `auto_export.error_policy`
- Retry with exponential backoff (configurable attempts/delay)
- Optional export manifests documenting completeness
- Per-issue encoding error handling

This allows users to choose the right trade-off between data integrity
and system availability for their specific project needs.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 20:21:51 -08:00
Steve Yegge
035b006e25 fix: Support both canonical and legacy JSONL filenames in merge driver check
The mergeDriverInstalled() function was only checking for the legacy
"beads.jsonl" filename, but installMergeDriver() writes the canonical
"issues.jsonl" filename. This caused false negatives where users with
the correct canonical configuration would be incorrectly flagged as
"not installed", potentially triggering unnecessary reinstalls.

Changes:
- Update mergeDriverInstalled() to check for both filenames
- Add test for canonical issues.jsonl filename detection
- Ensure existing correct configs are not unnecessarily overwritten

This fixes the inconsistency found during code review of bd-3sz0.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 20:07:26 -08:00
Steve Yegge
1c8dd49f17 fix: Auto-repair stale merge driver configs with invalid placeholders
Old bd versions (<0.24.0) installed merge driver with invalid %L/%R
placeholders. Git only supports %O (base), %A (current), %B (other).

Changes:
- mergeDriverInstalled() now detects %L/%R and returns false to trigger repair
- bd init automatically fixes stale configs during initialization
- bd doctor --fix also repairs stale configs
- Added comprehensive test coverage for auto-repair

Fixes: bd-3sz0
Epic: bd-tbz3 (all sub-issues now complete)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 19:56:38 -08:00
Steve Yegge
a1062fcf5f Fix: add missing yellow color function in init.go
The yellow color function was referenced but not defined, causing
CI build failures.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 19:55:59 -08:00
Steve Yegge
a4c38d53b4 fix: Auto-configure sync.branch during bd init (bd-flil)
- bd init now auto-sets sync.branch to current git branch
- Fixes 'bd sync --status' error after fresh bd init
- Changed all branch detection to use 'git symbolic-ref' instead of 'git rev-parse' to work in fresh repos without commits
- Updated init.go, init_team.go, sync.go, version.go

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 19:42:21 -08:00
Steve Yegge
6cb950412a Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 19:25:39 -08:00
Steve Yegge
ec4117d08a bd init: Default to YES for git hooks and merge driver
Fixes bd-bxha

Previously, bd init prompted users to install git hooks and merge driver,
which could result in incomplete setup if declined. Changed to install
both by default for better out-of-the-box experience.

Changes:
- Install git hooks automatically unless --skip-hooks is passed
- Install merge driver automatically unless --skip-merge-driver is passed
- Remove interactive prompts (no longer needed)
- Add warning messages on failure with suggestion to run bd doctor --fix
- Add --skip-hooks flag for explicit opt-out

Users who want to skip installation can now use:
  bd init --skip-hooks --skip-merge-driver

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 19:25:33 -08:00
Steve Yegge
3a36d0b95f Run bd doctor at end of bd init to verify setup
Implements bd-zwtq: After bd init completes, run doctor diagnostics
to catch configuration problems before user encounters them in normal
workflow. If any warnings or errors are detected, show a summary with
issue names and messages, then direct user to run 'bd doctor --fix'.

This helps users immediately identify and fix setup issues like:
- Missing git hooks
- Unconfigured merge driver
- Missing agent documentation
- Metadata tracking not initialized

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 19:18:48 -08:00
Steve Yegge
c4c5c8063a Fix: Change default JSONL filename from beads.jsonl to issues.jsonl
The canonical beads database name is issues.jsonl. Tens of thousands of users
have issues.jsonl, and beads.jsonl was only used by the Beads project itself
due to git history pollution.

Changes:
- Updated bd doctor to warn about beads.jsonl instead of issues.jsonl
- Changed default config from beads.jsonl to issues.jsonl
- Reversed precedence in checkGitForIssues to prefer issues.jsonl
- Updated git merge driver config to use issues.jsonl
- Updated all tests to expect issues.jsonl as the default

issues.jsonl is now the canonical default; beads.jsonl is legacy

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 23:34:22 -08:00
Steve Yegge
ddd209e26a fix: Correct git merge driver placeholders from %L/%R to %A/%B
Git merge drivers only support three placeholders:
- %O (ancestor/base)
- %A (current version)
- %B (other branch's version)

The code was incorrectly using %L and %R, which don't exist in git,
causing them to be passed through literally and breaking JSONL merges.

Changes:
- Fixed merge driver config in init.go, merge.go, README.md, docs
- Added detection in bd doctor with clear error messages
- Added auto-fix in bd doctor --fix
- Added proactive warning in bd sync before git pull
- Added reactive error detection after merge failures
- Updated all tests to use correct placeholders

Now users get helpful guidance at every step:
1. bd doctor detects the issue
2. bd doctor --fix auto-corrects it
3. bd sync warns before pulling if misconfigured
4. Error messages suggest bd doctor --fix when merge fails

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 20:40:18 -05:00
Steve Yegge
57253f93a3 Context propagation with graceful cancellation (bd-rtp, bd-yb8, bd-2o2)
Complete implementation of signal-aware context propagation for graceful
cancellation across all commands and storage operations.

Key changes:

1. Signal-aware contexts (bd-rtp):
   - Added rootCtx/rootCancel in main.go using signal.NotifyContext()
   - Set up in PersistentPreRun, cancelled in PersistentPostRun
   - Daemon uses same pattern in runDaemonLoop()
   - Handles SIGINT/SIGTERM for graceful shutdown

2. Context propagation (bd-yb8):
   - All commands now use rootCtx instead of context.Background()
   - sqlite.New() receives context for cancellable operations
   - Database operations respect context cancellation
   - Storage layer propagates context through all queries

3. Cancellation tests (bd-2o2):
   - Added import_cancellation_test.go with comprehensive tests
   - Added export cancellation test in export_test.go
   - Tests verify database integrity after cancellation
   - All cancellation tests passing

Fixes applied during review:
   - Fixed rootCtx lifecycle (removed premature defer from PersistentPreRun)
   - Fixed test context contamination (reset rootCtx in test cleanup)
   - Fixed export tests missing context setup

Impact:
   - Pressing Ctrl+C during import/export now cancels gracefully
   - No database corruption or hanging transactions
   - Clean shutdown of all operations

Tested:
   - go build ./cmd/bd ✓
   - go test ./cmd/bd -run TestImportCancellation ✓
   - go test ./cmd/bd -run TestExportCommand ✓
   - Manual Ctrl+C testing verified

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 21:57:23 -05:00
Steve Yegge
e1c8853748 feat: Add .beads/README.md generation during bd init (bd-m7ge)
Automatically creates a promotional README.md in the .beads directory
when bd init is run. The README explains what Beads is, provides
essential commands, highlights key benefits for AI-assisted workflows,
and encourages developers to try Beads in their own projects.

Changes:
- Added createReadme() function to generate compelling README content
- Integrated README creation in both regular and --no-db init modes
- README creation is idempotent (skips if already exists)
- Non-fatal warnings if README creation fails

The README is designed to get open source contributors excited about
using Beads for their AI-assisted development workflows.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 19:24:26 -05:00
Codex Agent
bf9b2c83fb Annotate gosec-safe file accesses 2025-11-17 10:12:46 -07:00
Codex Agent
7b63b5a30b Fix CI regressions and stabilize tests 2025-11-17 10:06:35 -07:00
Steve Yegge
f4a2f87aff Fix #274: Add automatic .beads/.gitignore upgrade (#300)
* Fix #274: Add automatic .beads/.gitignore upgrade

Implements three mechanisms to ensure users get updated gitignore:

1. bd doctor --fix: Manually upgrade gitignore
2. Daemon auto-upgrade: Upgrades on startup if outdated
3. bd init idempotent: Safe to re-run, always updates gitignore

The gitignore template now lives in cmd/bd/doctor/gitignore.go
for consistent updates across all three mechanisms.

Fixes: #274

* Remove test binary

Amp-Thread-ID: https://ampcode.com/threads/T-7042cfcc-ac97-43d7-a40f-3fa1bb4e1c2b
Co-authored-by: Amp <amp@ampcode.com>

* Fix critical issues: remove merge artifact and apply gitignore template

- Remove .beads/beads.left.jsonl (merge artifact that shouldn't be committed)
- Apply new gitignore template to .beads/.gitignore (was missing patterns)

Amp-Thread-ID: https://ampcode.com/threads/T-7042cfcc-ac97-43d7-a40f-3fa1bb4e1c2b
Co-authored-by: Amp <amp@ampcode.com>

* bd sync: 2025-11-12 11:09:30

* Retrigger CI

Amp-Thread-ID: https://ampcode.com/threads/T-8d532264-6d5e-4b68-88e9-e4511851b64a
Co-authored-by: Amp <amp@ampcode.com>

* Fix duplicate DoctorCheck type definition

* Trigger CI after fixing type conflict

Amp-Thread-ID: https://ampcode.com/threads/T-8d532264-6d5e-4b68-88e9-e4511851b64a
Co-authored-by: Amp <amp@ampcode.com>

---------

Co-authored-by: Amp <amp@ampcode.com>
2025-11-12 12:46:27 -08:00
Steve Yegge
d482d9ea6e bd sync: 2025-11-09 14:13:48 2025-11-09 14:13:48 -08:00
Yashwanth Reddy
8f37904c9c Add auto-detection of issue prefix from git history (#277)
- Check existing JSONL issues before falling back to directory name on initialization
- Implement readFirstIssueFromJSONL() to extract prefix from first issue
- Added tests for readFirstIssueFromJSONL
2025-11-09 11:22:12 -08:00
Steve Yegge
734579b1a2 Remove version field from metadata.json
- Removes noisy version mismatch warnings on every bd upgrade
- Version field in metadata.json was redundant with daemon version checking via RPC
- Daemon version mismatches still detected via HealthResponse
- Removes checkVersionMismatch() function and related test file
- Updates .beads/.gitignore to properly ignore merge artifacts

Amp-Thread-ID: https://ampcode.com/threads/T-7ba8aff2-97a0-4d0c-9008-e858bdfadd61
Co-authored-by: Amp <amp@ampcode.com>
2025-11-08 18:16:39 -08:00
Steve Yegge
54702b59a2 Fix #264 and #262: Remove stale --resolve-collisions references
- Update examples/git-hooks README to use 'bd hooks install' instead of non-existent install.sh
- Fix post-merge hook error message to not suggest --resolve-collisions flag (removed in v0.20)
- Clean up all doc references to --resolve-collisions (flag removed, hash IDs prevent collisions)

Fixes #264 (git hooks installer missing)
Fixes #262 (misleading error message)

Amp-Thread-ID: https://ampcode.com/threads/T-c9f0e4cb-fba2-4db2-a3d5-36dc1892be9d
Co-authored-by: Amp <amp@ampcode.com>
2025-11-08 13:18:50 -08:00