Commit Graph

64 Commits

Author SHA1 Message Date
Steve Yegge
c416c7d266 Prevent test pollution in production database (bd-z528)
- Add warning when creating issues with 'Test' prefix
- Suggest BEADS_DB for isolated testing
- Document testing workflow in AGENTS.md
- Include examples for manual and automated testing

Amp-Thread-ID: https://ampcode.com/threads/T-fc7b7391-8881-4dd9-8e1f-28a2f95afb2b
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 22:50:58 -08:00
Steve Yegge
1065e66a75 Add bd cleanup command for bulk deletion of closed issues
Implements bd-jx90: simple cleanup command without API key requirement.

Features:
- Delete all closed issues with --force
- Filter by age with --older-than N (days)
- Preview with --dry-run
- Cascade deletion with --cascade
- JSON output support

Usage:
  bd cleanup --force                    # Delete all closed
  bd cleanup --older-than 30 --force    # Delete >30 days old
  bd cleanup --dry-run                  # Preview

Closes bd-jx90

Amp-Thread-ID: https://ampcode.com/threads/T-8d905db0-4ec7-411e-95de-1f044219dc9c
Co-authored-by: Amp <amp@ampcode.com>
2025-11-07 22:06:50 -08:00
Markus Flür
e7f532db93 Implementing an RPC monitoring solution with a web-ui as implementation example. (#244)
* bd sync: 2025-10-30 12:12:27

* Working on frontend

* bd sync: 2025-11-06 16:55:55

* feat: finish bd monitor human viewer

* Merge conflicts resolved and added tests

* bd sync: 2025-11-06 17:23:41

* bd sync: 2025-11-06 17:34:52

* feat: Add reload button and multiselect status filter to monitor

- Changed status filter from single select to multiselect with 'Open' selected by default
- Added reload button with visual feedback (hover/active states)
- Updated filterIssues() to handle multiple selected statuses
- Added reloadData() function that reloads both stats and issues
- Improved responsive design for mobile devices
- Filter controls now use flexbox layout with better spacing

* fix: Update monitor statistics to show Total, In Progress, Open, Closed

- Replaced 'Ready to Work' stat with 'In Progress' stat
- Reordered stats to show logical progression: Total -> In Progress -> Open -> Closed
- Updated loadStats() to fetch in-progress count from stats API
- Removed unnecessary separate API call for ready count

* fix: Correct API field names in monitor stats JavaScript

The JavaScript was using incorrect field names (stats.total, stats.by_status)
that don't match the actual types.Statistics struct which uses flat fields
with underscores (total_issues, in_progress_issues, etc).

Fixed by updating loadStats() to use correct field names:
- stats.total -> stats.total_issues
- stats.by_status?.['in-progress'] -> stats.in_progress_issues
- stats.by_status?.open -> stats.open_issues
- stats.by_status?.closed -> stats.closed_issues

Fixes beads-9

* bd sync: 2025-11-06 17:51:24

* bd sync: 2025-11-06 17:56:09

* fix: Make monitor require daemon to prevent SQLite locking

Implemented Option 1 from beads-eel: monitor now requires daemon and never
opens direct SQLite connection.

Changes:
- Added 'monitor' to noDbCommands list in main.go to skip normal DB initialization
- Added validateDaemonForMonitor() PreRun function that:
  - Finds database path using beads.FindDatabasePath()
  - Validates daemon is running and healthy
  - Fails gracefully with clear error message if no daemon
  - Only uses RPC connection, never opens SQLite directly

Benefits:
- Eliminates SQLite locking conflicts between monitor and daemon
- Users can now close/update issues via CLI while monitor runs
- Clear error messages guide users to start daemon first

Fixes beads-eel

* bd sync: 2025-11-06 18:03:50

* docs: Add bd daemons restart subcommand documentation

Added documentation for the 'bd daemons restart' subcommand across all documentation files:

- commands/daemons.md: Added full restart subcommand section with synopsis, description, arguments, flags, and examples
- README.md: Added restart examples to daemon management section
- AGENTS.md: Added restart examples with --json flag for agents

The restart command gracefully stops and starts a specific daemon by workspace path or PID,
useful after upgrading bd or when a daemon needs refreshing.

Fixes beads-11

* bd sync: 2025-11-06 18:13:16

* Separated the web ui from the general monitoring functionality

---------

Co-authored-by: Steve Yegge <stevey@sourcegraph.com>
2025-11-07 09:49:12 -08:00
Steve Yegge
e73f89edbe Add multi-repo patterns documentation for AI agents (bd-4b6u)
- Create docs/MULTI_REPO_AGENTS.md with comprehensive multi-repo patterns
- Document config options, routing behavior, troubleshooting, best practices
- Update AGENTS.md to reference new doc
- Update README.md documentation index

Amp-Thread-ID: https://ampcode.com/threads/T-645ccbf4-a5b6-44a1-bbd9-913447e17b49
Co-authored-by: Amp <amp@ampcode.com>
2025-11-06 19:53:29 -08:00
Steve Yegge
9c3ab7fba9 Document -short flag, update linting baseline, clarify bd edit MCP exclusion
- Enhanced CONTRIBUTING.md with -short flag usage guidance
- Updated LINTING.md: 22 issues baseline (down from 34)
- Added MCP exclusion note for bd edit command in AGENTS.md

Closes bd-iov0, bd-aec5439f, bd-fd8753d9
2025-11-06 19:42:01 -08:00
Steve Yegge
b23c472f55 Update AGENTS.md: use -short flag for all local tests
- Changed all test commands to 'go test -short ./...'
- Clarified that full tests run in CI
- Updated: Code Standards, Before Committing, Landing the Plane, Building and Testing, Release Process
- Agents should only run short tests; CI runs full suite
2025-11-06 18:48:23 -08:00
Steve Yegge
38489106c6 Add git cleanup step to 'land the plane' protocol
Amp-Thread-ID: https://ampcode.com/threads/T-c2d2b083-5566-4eea-9f8a-c4880a79e888
Co-authored-by: Amp <amp@ampcode.com>
2025-11-05 19:43:27 -08:00
Steve Yegge
d13a445557 Fix: Clarify bd merge uses beads-merge algorithm (vendored)
The standalone beads-merge binary is the same algorithm, not an alternative.
Both run identical code - just different packaging.
2025-11-05 19:35:02 -08:00
Steve Yegge
2d69817341 Update documentation for merge driver auto-configuration
- Add merge driver to bd init workflow in README.md
- Update AGENTS.md with auto-config details
- Document --skip-merge-driver flag
- Provide manual setup instructions
- Clarify beads-merge as alternative external tool

Completes bd-ggbc
2025-11-05 19:33:20 -08:00
Steve Yegge
b230a2270d feat: Add bd init --contributor and --team wizards
- Implement OSS contributor workflow wizard
  - Auto-detects fork relationships (upstream remote)
  - Checks push access (SSH vs HTTPS)
  - Creates separate planning repository
  - Configures auto-routing to keep planning out of PRs

- Implement team workflow wizard
  - Detects protected main branches
  - Creates sync branch if needed
  - Configures auto-commit/auto-push
  - Supports both direct and PR-based workflows

- Add comprehensive documentation
  - examples/contributor-workflow/README.md
  - examples/team-workflow/README.md
  - Updated AGENTS.md, README.md, QUICKSTART.md
  - Updated docs/MULTI_REPO_MIGRATION.md

Closes: bd-kla1, bd-twlr, bd-6z7l
Amp-Thread-ID: https://ampcode.com/threads/T-b4d124a2-447e-47d1-8124-d7c5dab9a97b
Co-authored-by: Amp <amp@ampcode.com>
2025-11-05 19:04:14 -08:00
Steve Yegge
349817afc9 Add multi-repo migration guide and bd migrate-issues command
- Created comprehensive migration guide at docs/MULTI_REPO_MIGRATION.md
  - Covers OSS contributor, team, multi-phase, and persona workflows
  - Step-by-step setup instructions with examples
  - Configuration reference and troubleshooting
- Implemented bd migrate-issues command
  - Move issues between repos with filtering (status/priority/labels/type)
  - Dependency preservation with upstream/downstream/closure options
  - Dry-run mode and strict validation
  - Interactive confirmation with --yes override
- Updated README.md and AGENTS.md with migration guide links

Completes: bd-c3ei, bd-mlcz
Part of epic: bd-8rd (Migration and onboarding for multi-repo)

Amp-Thread-ID: https://ampcode.com/threads/T-c5a7a780-b05e-4cc3-a7c1-5de107821b7e
Co-authored-by: Amp <amp@ampcode.com>
2025-11-05 18:44:02 -08:00
Steve Yegge
8f90b1f890 Less prescriptive landing protocol + recommend AGENTS.md session-ending hygiene
- AGENTS.md: Updated 'landing the plane' section to encourage creative,
  methodical conflict resolution instead of rigid step-by-step commands
- README.md: Added 'Configuring Your Own AGENTS.md' section recommending
  that project maintainers add session-ending protocols to their own
  AGENTS.md files to ensure proper database hygiene
2025-11-05 15:21:02 -08:00
Steve Yegge
095e40de7d Docs: add 'Landing the Plane' protocol to AGENTS.md 2025-11-05 14:47:38 -08:00
Steve Yegge
527e491216 docs: Enhance beads-merge documentation with setup instructions
- Add detailed installation steps for Git and Jujutsu users
- Explain 3-way merge algorithm and field-level merging
- Document configuration in .gitattributes and .jjconfig.toml
- Clarify how it prevents conflicts proactively vs resolving after
- Created bd-bzfy to track integration of beads-merge tool
2025-11-05 12:55:48 -08:00
Steve Yegge
55c9c45b2a Add --label as alias for --labels in bd create
Amp-Thread-ID: https://ampcode.com/threads/T-b13b6be4-b1aa-432f-9bbc-f2d31925fd11
Co-authored-by: Amp <amp@ampcode.com>
2025-11-05 11:23:34 -08:00
Steve Yegge
0875e50f85 docs: Document new bd list query facilities (pattern matching, date ranges, empty checks)
Amp-Thread-ID: https://ampcode.com/threads/T-4d8dfaab-6a44-4ee5-ad11-93b915bbe1dc
Co-authored-by: Amp <amp@ampcode.com>
2025-11-05 01:02:55 -08:00
Steve Yegge
cac9ae6647 Add routing integration tests and documentation
- Created routing_integration_test.go with comprehensive routing tests
- Tests cover maintainer/contributor detection, explicit overrides, end-to-end multi-repo
- Added docs/ROUTING.md documenting auto-routing feature
- Closed bd-6u6g, bd-zmi5, bd-nzt4, bd-btsm (routing tests)
- Updated bd-4ms and bd-8hf with progress notes

All routing tests pass. Multi-repo auto-routing is complete.

Amp-Thread-ID: https://ampcode.com/threads/T-2ea8b2ed-ceb7-432e-91f1-1f527b0e7b4d
Co-authored-by: Amp <amp@ampcode.com>
2025-11-04 23:12:42 -08:00
Steve Yegge
3af353ade3 Fix P0 bug: JSONL lookup now returns LAST match (bd-58c0)
Addresses code review feedback:

 P0 (Must Fix):
- Fix JSONL lookup to return LAST match, not FIRST (resurrection.go:160-162)
  - Changed from early return to scan all matches and keep last
  - Respects JSONL append-only semantics

 P1 (Should Fix):
- Add test for multiple JSONL versions
  - TestTryResurrectParent_MultipleVersionsInJSONL verifies correct behavior
- Document error message change in CHANGELOG.md
  - Old: "parent issue X does not exist"
  - New: "parent issue X does not exist and could not be resurrected from JSONL history"
  - Marked as breaking change for script parsers

 P2/P3 (Nice to Have):
- Add documentation to AGENTS.md explaining auto-resurrection behavior
- Document best-effort dependency resurrection

⏸️ Deferred (P1 - Optimize batch resurrection):
- Caching optimization deferred (no batch use cases currently)

All tests pass:
- Unit tests: internal/storage/sqlite/
- Integration test: TestImportWithDeletedParent
2025-11-04 22:25:33 -08:00
Steve Yegge
edf1f71fa7 Add comprehensive protected branch workflow documentation (bd-5ce8)
Created complete documentation suite for using beads with protected branches:

1. **docs/PROTECTED_BRANCHES.md** - Comprehensive 600+ line guide covering:
   - Quick start and setup
   - How git worktrees work
   - Daily workflow for agents and humans
   - Merging strategies (PR and direct)
   - Troubleshooting common issues
   - Platform-specific notes (GitHub, GitLab, Bitbucket)
   - Advanced topics (CI/CD, multi-clone sync, etc.)

2. **AGENTS.md** - Added "Protected Branch Workflow" section:
   - Quick reference for agents
   - No changes needed to agent workflows
   - Commands for setup and merging
   - Link to detailed docs

3. **README.md** - Updated with:
   - Protected branch support feature flag
   - Quick start instructions with --branch flag
   - Link to comprehensive guide

4. **examples/protected-branch/** - Working example with:
   - Step-by-step demo
   - Multi-clone sync workflow
   - GitHub Actions integration example
   - Directory structure explanation
   - Troubleshooting tips

All commands verified:
- bd init --branch <name>
- bd config get/set sync.branch
- bd sync --status
- bd sync --merge

Documentation is platform-agnostic and works with GitHub, GitLab,
Bitbucket, or any git platform with branch protection.

Closes bd-5ce8

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 18:41:51 -08:00
Steve Yegge
d46177d885 Enhance bd onboard with AI planning docs management guidance
Add comprehensive guidance for managing AI-generated planning documents
(Claude slop) to the bd onboard command. Addresses GitHub issue #196.

Changes:
- Add Managing AI-Generated Planning Documents section to onboard output
- Recommend using history/ directory for ephemeral planning files
- List common planning doc types (PLAN.md, IMPLEMENTATION.md, etc.)
- Provide .gitignore example and benefits explanation
- Add to Important Rules: Store AI planning docs in history/
- Update AGENTS.md with the same guidance to demonstrate the pattern
- Add comprehensive tests for onboard command

This uses inverted control: bd outputs guidance, AI agents intelligently
integrate it into their project's documentation (AGENTS.md, CLAUDE.md,
.cursorrules, etc.), respecting existing conventions.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 17:10:41 -08:00
Steve Yegge
4ee5b2c2c1 Add conflict marker detection to bd import/validate
- bd import now detects git conflict markers and shows resolution steps
- bd validate --checks=conflicts improved with clearer instructions
- Updated AGENTS.md with better conflict resolution docs
- Closes bd-7e7ddffa epic (repair tools complete)

Amp-Thread-ID: https://ampcode.com/threads/T-4a11a65b-56c2-4d92-8f68-66f0a56ab5e3
Co-authored-by: Amp <amp@ampcode.com>
2025-11-02 16:45:51 -08:00
Steve Yegge
38bdd3e251 Document migration inspection commands in user docs
- Add bd migrate --inspect and bd info --schema examples to README.md
- Update QUICKSTART.md migration section with AI agent workflow
- Expand AGENTS.md with migration safety invariants explanation
- Clarify when and why to use inspection before migrating

Makes the new AI-supervised migration features discoverable.

Amp-Thread-ID: https://ampcode.com/threads/T-de7e1141-87ac-4b4a-9cea-1b7bc4d51da9
Co-authored-by: Amp <amp@ampcode.com>
2025-11-02 14:18:32 -08:00
Steve Yegge
1abe4e75ad Add migration inspection tools for AI agents (bd-627d Phase 2)
Implemented:
- bd migrate --inspect --json: Shows migration plan, db state, warnings
- bd info --schema --json: Returns schema details for agents
- Migration invariants: Validates migrations post-execution
- Added ListMigrations() for introspection

Phase 1 (invariants) and Phase 2 (inspection) complete.
Next: Wire up MCP tools in beads-mcp server.

Amp-Thread-ID: https://ampcode.com/threads/T-c4674660-d640-405f-a929-b664e8699a48
Co-authored-by: Amp <amp@ampcode.com>
2025-11-02 14:03:14 -08:00
Steve Yegge
98ecaec2ec AGENTS.md: Strongly recommend git hooks installation 2025-11-01 22:23:59 -07:00
Steve Yegge
55ff80caee updated instructions 2025-11-01 20:23:46 -07:00
Steve Yegge
e5a3f8ce25 Add quoting guidance to AGENTS.md and SKILL.md
Fixes #194 - Claude Code was failing to quote titles/descriptions with
special characters. Added explicit warnings and examples showing proper
quoting for arguments containing spaces, apostrophes, and special chars.

Amp-Thread-ID: https://ampcode.com/threads/T-0570ff80-8115-479d-b39c-dbdf2ada5215
Co-authored-by: Amp <amp@ampcode.com>
2025-11-01 12:23:39 -07:00
Steve Yegge
cc7918daf4 Implement bd stale command (bd-c01f, closes #184)
- Add bd stale command to find abandoned/forgotten issues
- Support --days (default 30), --status, --limit, --json flags
- Implement GetStaleIssues in SQLite and Memory storage
- Add full RPC/daemon support
- Comprehensive test suite (6 tests, all passing)
- Update AGENTS.md documentation

Resolves GitHub issue #184

Amp-Thread-ID: https://ampcode.com/threads/T-f021ddb8-54e3-41bf-ba7a-071749663c1d
Co-authored-by: Amp <amp@ampcode.com>
2025-10-31 23:03:56 -07:00
Steve Yegge
427c88ea04 Remove outdated --resolve-collisions documentation (flag removed in v0.20.1) 2025-10-31 13:40:57 -07:00
Steve Yegge
932b293118 Document hash-based IDs and hierarchical children (bd-a5e2bd80.15)
Amp-Thread-ID: https://ampcode.com/threads/T-afcbc67c-4b83-47d4-8361-7c1ad08906a0
Co-authored-by: Amp <amp@ampcode.com>
2025-10-31 12:51:10 -07:00
Steve Yegge
e3afecca37 Remove sequential ID code path (bd-aa744b)
- Removed nextSequentialID() and getIDMode() functions
- Removed issue_counters table from schema
- Made SyncAllCounters() a no-op for backward compatibility
- Simplified ID generation to hash-only (adaptive length)
- Removed id_mode config setting
- Removed sequential ID tests and migration code
- Updated CONFIG.md and AGENTS.md to remove sequential ID references

Follow-up bd-2a70 will remove obsolete test files and renumber command.
2025-10-30 21:51:39 -07:00
Steve Yegge
0858bdb7ed Implement hash ID migration tool (bd-173)
- Add migrate-hash-ids command for converting sequential to hash-based IDs
- Integrate into bd migrate --to-hash-ids for transparent user experience
- Generate hash IDs for top-level issues, hierarchical IDs for children
- Update all references: dependencies, comments, text mentions
- Auto-backup database before migration
- Comprehensive tests covering migration scenarios
- Update AGENTS.md with migration documentation

Amp-Thread-ID: https://ampcode.com/threads/T-492f81db-5b0e-437a-b54d-ae4525dd7827
Co-authored-by: Amp <amp@ampcode.com>
2025-10-30 16:28:13 -07:00
Steve Yegge
86945f2ac4 Add event-driven daemon documentation and platform tests
- Document BEADS_DAEMON_MODE environment variable in AGENTS.md
- Add comprehensive platform tests for FileWatcher (Linux/macOS/Windows)
- Close bd-75, bd-79, bd-83, bd-85 (event-driven daemon epic complete)
2025-10-29 15:53:41 -07:00
Steve Yegge
9a109902b4 Consolidate documentation: move maintainer docs to docs/, remove redundant files
- Move RELEASING.md and LINTING.md to docs/ (maintainer-only content)
- Delete WORKFLOW.md (agent workflow content belongs in AGENTS.md)
- Delete TEXT_FORMATS.md (technical details belong in ADVANCED.md)
- Update all cross-references to point to new locations
- Keep CLAUDE.md (required by Claude Code)

Reduces root-level docs from 20 to 16 files with clearer organization.

Amp-Thread-ID: https://ampcode.com/threads/T-fe1db4f3-16c6-4a79-8887-c7f4c1f11c43
Co-authored-by: Amp <amp@ampcode.com>
2025-10-28 15:46:12 -07:00
Steve Yegge
5939018972 Restore bd edit command and close duplicate issues
- Restore bd edit command (lost in 671b966 --no-db refactor)
- Document in AGENTS.md with 'HUMANS ONLY' warning
- Close duplicate issues: bd-129, bd-150, bd-144, bd-173/178/180
- Resolve import collisions: 8 issues remapped to new IDs

Amp-Thread-ID: https://ampcode.com/threads/T-e4780c42-9a6e-4021-8f8e-120b26562c2d
Co-authored-by: Amp <amp@ampcode.com>
2025-10-27 17:45:11 -07:00
Steve Yegge
7591a3bf81 Add bd migrate command for database upgrades (bd-164)
- Implement bd migrate command with detection, version checking, and cleanup
- Update daemon to suggest bd migrate for version mismatches
- Enhance CLI version warnings to recommend bd migrate
- Add comprehensive tests for migration scenarios
- Document migration workflow in QUICKSTART.md and AGENTS.md

Completes bd-164 and epic bd-159

Amp-Thread-ID: https://ampcode.com/threads/T-34ea4682-8c48-44c2-8421-dc40f867773b
Co-authored-by: Amp <amp@ampcode.com>
2025-10-26 19:20:59 -07:00
Steve Yegge
4e38626361 Document bd daemons commands (bd-150)
Amp-Thread-ID: https://ampcode.com/threads/T-f1cff202-188b-4850-a909-c2750d24ad22
Co-authored-by: Amp <amp@ampcode.com>
2025-10-26 19:03:03 -07:00
Steve Yegge
5493559317 Sync AGENTS.md 2025-10-26 17:40:22 -07:00
Steve Yegge
2b43bde756 Update AGENTS.md with new sync workflow and batching behavior
- Document 30-second batching window
- Add 'Agent Session Workflow' section with bd sync instructions
- Update Pro Tips to emphasize running 'bd sync' at end of session
- Clarify auto-sync timing (30s debounce, 5s daemon poll)
2025-10-26 17:39:10 -07:00
Steve Yegge
ec7d824897 Fix bd init --quiet and clarify agent usage in docs
- Fix: bd init --quiet now skips interactive prompts and auto-installs hooks
- Docs: Add Git Workflow & Auto-Sync section to README
- Docs: Update AGENTS.md with --quiet flag guidance for agents
- Docs: Update WORKFLOW.md to explain auto-import after git pull
- Docs: Add FAQ entries about auto-sync behavior and who runs init
- Closes bd-127, bd-140, bd-141

Amp-Thread-ID: https://ampcode.com/threads/T-72f55d41-f16c-4541-b72a-8acc9013e87b
Co-authored-by: Amp <amp@ampcode.com>
2025-10-26 12:53:50 -07:00
Steve Yegge
3a42ca252d Implement exclusive lock protocol for daemon/external tool coexistence
- Add ExclusiveLock struct with JSON marshaling and validation
- Implement IsProcessAlive() with EPERM fail-safe behavior
- Add ShouldSkipDatabase() with stale lock cleanup
- Integrate lock checking into daemon sync cycle
- Return holder name on stale removal for better logging
- Case-insensitive hostname comparison
- Comprehensive unit tests (89.3% coverage)
- Documentation updates (ADVANCED.md, AGENTS.md)
- Add .beads/.exclusive-lock to .gitignore

Closes bd-115, bd-116, bd-117, bd-118, bd-119, bd-120, bd-121, bd-122

Amp-Thread-ID: https://ampcode.com/threads/T-0b835739-0d79-4ef9-aa62-8446a368c42d
Co-authored-by: Amp <amp@ampcode.com>
2025-10-25 23:32:47 -07:00
Steve Yegge
c2056152e6 Add bd info command to show database path and daemon status
Implements bd-145. Users can now easily determine which database file bd is using
and check daemon connection status.

Features:
- Shows absolute database path
- Displays daemon status (connected/mode/health/version)
- Shows issue count
- Supports --json output for programmatic use
- Works in both daemon and direct modes

Example output:
  bd info                    # Human-readable
  bd info --json             # JSON for agents
  bd info --no-daemon        # Force direct mode

Updated documentation in README.md and AGENTS.md.

Amp-Thread-ID: https://ampcode.com/threads/T-a33c0762-f800-4fea-9510-6a803d8aece8
Co-authored-by: Amp <amp@ampcode.com>
2025-10-25 16:43:44 -07:00
Steve Yegge
0344e1f08b Fix bd-51: Add git hooks to eliminate auto-flush race condition
- Added --flush-only flag to bd sync command
- Created pre-commit hook to flush pending changes before commit
- Created post-merge hook to import changes after pull/merge
- Added install script for easy setup
- Updated AGENTS.md with git hooks workflow
- Resolves race condition where daemon auto-flush fires after commit

Amp-Thread-ID: https://ampcode.com/threads/T-00b80d3a-4194-4c75-a60e-25a318cf9f91
Co-authored-by: Amp <amp@ampcode.com>
2025-10-24 22:17:06 -07:00
Steve Yegge
3195b8062b Add bd duplicates command for automated duplicate detection (bd-203)
- New 'bd duplicates' command finds content duplicates across database
- Groups by content hash (title, description, design, acceptance criteria)
- Chooses merge target by reference count or smallest ID
- Supports --auto-merge and --dry-run flags
- Added --dedupe-after flag to 'bd import' for post-import detection
- Comprehensive test coverage for duplicate detection
- Updated AGENTS.md and ADVANCED.md with usage examples

Amp-Thread-ID: https://ampcode.com/threads/T-6f99566f-c979-43ed-bd8f-5aa38b0f6191
Co-authored-by: Amp <amp@ampcode.com>
2025-10-24 13:45:04 -07:00
Steve Yegge
f5feee0d20 Remove global daemon from docs, deprecate bd repos command
- Stub out 'bd repos' command with deprecation message
- Remove 140+ lines of global daemon/multi-repo docs from ADVANCED.md
- Add architecture section explaining daemon/MCP/beads roles (LSP model)
- Update AGENTS.md, MCP README, FAQ.md to emphasize per-project daemons
- Update commands/daemon.md and commands/repos.md

Closes #140

Global daemon was removed in v0.16.0 due to cross-project pollution
risks. bd now uses per-project local daemons (one per workspace) for
complete database isolation, following LSP architecture patterns.

Amp-Thread-ID: https://ampcode.com/threads/T-c45147dc-8939-43bf-8fbd-303ed4a8d845
Co-authored-by: Amp <amp@ampcode.com>
2025-10-24 13:02:16 -07:00
Steve Yegge
f30544e148 Auto-detect and restart daemon on version mismatch (bd-89)
Implements automatic daemon version detection and restart when client
and daemon versions are incompatible. Eliminates need for manual
'bd daemon --stop' after upgrades.

Changes:
- Check daemon version during health check in PersistentPreRun
- Auto-restart mismatched daemon or fall back to direct mode
- Check version when starting daemon, auto-stop old daemon if incompatible
- Robust restart logic: sets working dir, cleans stale sockets, reaps processes
- Uses waitForSocketReadiness helper for reliable startup detection
- Updated AGENTS.md with version management documentation

Closes bd-89

Amp-Thread-ID: https://ampcode.com/threads/T-231a3701-c9c8-49e4-a1b0-e67c94e5c365
Co-authored-by: Amp <amp@ampcode.com>
2025-10-23 23:40:13 -07:00
Steve Yegge
5a6177b4bc Fix bd-73: Add git worktree detection and warnings
- Implement robust worktree detection using git-dir vs git-common-dir comparison
- Add prominent warning when daemon mode is active in a worktree
- Warn in 3 places: initial connection, auto-start, and daemon start command
- Show shared database path and clarify BEADS_AUTO_START_DAEMON behavior
- Document limitations and solutions in README.md and AGENTS.md
- Add comprehensive tests for detection and path truncation

Fixes #55

Amp-Thread-ID: https://ampcode.com/threads/T-254eb9e3-1a42-42d7-afdf-b7ca2d2dcb8b
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 23:05:00 -07:00
Steve Yegge
4ef995b0e4 Document merge command and AI duplicate detection workflow (bd-29)
- Add comprehensive merge command documentation to README.md
- Add AI agent duplicate detection workflow to AGENTS.md
- Include command syntax, examples, and best practices
- Close bd-29

Amp-Thread-ID: https://ampcode.com/threads/T-95a37593-fd67-4e99-bc84-ace580b4776d
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 11:48:12 -07:00
Steve Yegge
5aa5940147 Add multi-ID support to update, show, and label commands
Implements GitHub issue #58: Allow multiple issue IDs for batch operations.

Changes:
- update: Now accepts multiple IDs for batch status/priority updates
- show: Displays multiple issues with separators between them
- label add/remove: Apply labels to multiple issues at once
- All commands return arrays in JSON mode for consistency

Commands already supporting multiple IDs:
- close (already implemented)
- reopen (already implemented)

Updated AGENTS.md with correct multi-ID syntax examples.

Amp-Thread-ID: https://ampcode.com/threads/T-518a7593-6e16-4b08-8cf8-741992b5e3b6
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 22:18:22 -07:00
Steve Yegge
7f82708b90 Fix bd init to auto-import issues from git on fresh clone
Prevents agents from creating duplicate low-numbered issues when starting
with a fresh git clone that already has issues.jsonl in git history.

Changes:
- bd init now checks for existing issues in git after DB creation
- Auto-imports with collision resolution if found
- Updates AGENTS.md to simplify onboarding (just 'bd init')

Fixes the scenario where:
1. Fresh clone has .beads/issues.jsonl in git (212 issues)
2. Agent runs bd init (creates empty DB)
3. Agent starts creating bd-1, bd-2, etc (collisions with git)

Now bd init automatically imports all issues from git on first run.

Amp-Thread-ID: https://ampcode.com/threads/T-8a41f14d-d4c3-4c50-a18b-5f112110f138
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 20:38:35 -07:00
Steve Yegge
e1a445afd2 Remove global socket fallback, enforce local-only daemons
- Remove ~/.beads/bd.sock fallback in getSocketPath()
- Always return local socket path (.beads/bd.sock)
- Add migration warning if old global socket exists
- Update AGENTS.md to remove global daemon references
- Document breaking change in CHANGELOG.md
- Fix test isolation: tests now use temp .beads dir and chdir

Prevents cross-project daemon connections and database pollution.
Each project must use its own local daemon.

Amp-Thread-ID: https://ampcode.com/threads/T-c4454192-39c6-4c67-96a9-675cbfc4db92
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 20:35:55 -07:00