Commit Graph

1541 Commits

Author SHA1 Message Date
Steve Yegge 319f1adaeb Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-24 00:03:21 -08:00
Steve Yegge dbb3000d69 bd sync: 2025-11-24 00:03:20 2025-11-24 00:03:20 -08:00
Steve Yegge 2560b11f80 feat: Add --start flag to bd daemon, show help with no args
Currently 'bd daemon' with no args immediately starts the daemon. This is
inconsistent with other daemon management commands like --stop, --status,
etc. and makes the command less discoverable for new users.

Changes:
- Add --start flag to explicitly start daemon
- Show help text when no operation flags provided
- Update auto-start logic to use --start flag
- Update startDaemon() to pass --start when forking
- Update all documentation to use 'bd daemon --start'
- Update MCP Python client error messages

The MCP docs already incorrectly showed 'bd daemon start' which doesn't
work, so this change fixes that documentation bug while improving UX.

Auto-start still works correctly - it now passes --start internally.

Fixes bd-gfu

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 00:03:07 -08:00
Steve Yegge a5429195b7 bd sync: 2025-11-24 00:01:30 2025-11-24 00:01:30 -08:00
Steve Yegge 95b1577521 bd sync: 2025-11-23 23:52:35 2025-11-23 23:52:35 -08:00
Steve Yegge bc5d3690ce bd sync: 2025-11-23 23:41:14 2025-11-23 23:41:14 -08:00
Steve Yegge d45cff5085 feat: Handle FOREIGN KEY constraint violations gracefully during import (bd-koab)
When importing JSONL after merges that include deletions, FK constraint
violations can occur if an issue references a deleted issue. Previously,
import would fail completely. Now it continues and reports skipped dependencies.

Changes:
- Add SkippedDependencies field to Result/ImportResult structs
- Update importDependencies() to detect FK violations using IsForeignKeyConstraintError()
- Log warnings for each skipped dependency with issue IDs and type
- Continue importing remaining dependencies instead of failing
- Display summary of all skipped dependencies at end of import

Example output:
  Warning: Skipping dependency due to missing reference: bd-b → bd-a (blocks)

  ⚠️  Warning: Skipped 2 dependencies due to missing references:
    - bd-b → bd-a (blocks)
    - bd-c → bd-a (parent-child)

  This can happen after merges that delete issues referenced by other issues.
  The import continued successfully - you may want to review the skipped dependencies.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 23:32:34 -08:00
Steve Yegge e2e04c011a bd sync: 2025-11-23 23:11:21 2025-11-23 23:11:21 -08:00
Steve Yegge d1641c7d2e Fix bd-afd: Auto-fix metadata.json jsonl_export mismatch
## Summary

When metadata.json gets deleted (git clean, merge conflict, rebase), the
version tracking code auto-recreates it using DefaultConfig() which hardcoded
jsonl_export to 'issues.jsonl'. But many repos (including beads itself) use
'beads.jsonl', causing a mismatch between config and actual JSONL file.

## Changes

1. **bd doctor --fix auto-detection** (cmd/bd/doctor/fix/database_config.go)
   - New DatabaseConfig() fix function that auto-detects actual JSONL file
   - Prefers beads.jsonl over issues.jsonl (canonical name)
   - Skips backup files and merge artifacts
   - Wired into doctor.go applyFixes()

2. **Version tracking auto-detection** (cmd/bd/version_tracking.go)
   - trackBdVersion() now scans for existing JSONL files before defaulting
   - Prevents mismatches when metadata.json gets recreated
   - Added findActualJSONLFile() helper function

3. **Canonical default name** (internal/configfile/configfile.go)
   - DefaultConfig() changed from issues.jsonl to beads.jsonl
   - Aligns with canonical naming convention

4. **FindJSONLPath preference** (internal/beads/beads.go)
   - Now prefers beads.jsonl over issues.jsonl when scanning
   - Default changed from issues.jsonl to beads.jsonl

5. **Test coverage**
   - Added comprehensive tests for DatabaseConfig fix
   - Updated configfile tests for new default
   - Verified backup file skipping logic

## Testing

- All existing tests pass
- New tests verify auto-fix behavior
- Integration tested with simulated mismatches

Closes: bd-afd
2025-11-23 23:11:08 -08:00
Steve Yegge bee0e44187 bd sync: apply DB changes after import 2025-11-23 23:05:29 -08:00
Steve Yegge 2f7f77055f Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 23:05:29 -08:00
Steve Yegge 3006e67eef bd sync: 2025-11-23 23:05:28 2025-11-23 23:05:28 -08:00
Steve Yegge e5bb6ed6dc bd sync: 2025-11-23 22:55:37 2025-11-23 22:55:37 -08:00
Steve Yegge 21d246f502 bd sync: apply DB changes after import 2025-11-23 22:54:16 -08:00
Steve Yegge 0e956d733b Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 22:54:16 -08:00
Steve Yegge 7e41f2b4a5 bd sync: 2025-11-23 22:54:08 2025-11-23 22:54:08 -08:00
Steve Yegge dfcbb7d3af Optimize sync_test.go: eliminate redundant git init calls
- Add setupGitRepo(), setupGitRepoWithBranch(), and setupMinimalGitRepo() helpers
- Refactor 19 test functions to use shared git repo setup
- Reduces duplicate git initialization boilerplate by ~300 lines
- All tests pass with improved maintainability

Related to bd-ktng
2025-11-23 22:54:05 -08:00
Steve Yegge c9a2e7a8b2 Fix bd-v0y: Remove mtime fast-path in hasJSONLChanged
Git doesn't preserve mtime on checkout, causing false negatives where
hasJSONLChanged() incorrectly returns false after git pull updates JSONL.
This caused bd sync to overwrite pulled JSONL instead of importing it,
resurrecting deleted issues.

Solution: Always compute content hash for comparison (Option 1).
Performance impact is minimal (~10-50ms for sync operations).

Changes:
- cmd/bd/integrity.go: Remove mtime fast-path, always compute hash
- cmd/bd/sync.go: Remove mtime storage after import
- cmd/bd/import.go: Remove mtime storage after import
- cmd/bd/daemon_sync.go: Remove mtime storage and update comments
- cmd/bd/daemon_sync_test.go: Remove mtime assertions from tests

All tests pass. Existing test 'mtime changed but content same - git
operation scenario' verifies the fix works correctly.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 22:53:54 -08:00
Steve Yegge 7491c142d4 bd sync: 2025-11-23 22:47:28 2025-11-23 22:47:28 -08:00
Steve Yegge e4cd9a896d bd sync: 2025-11-23 22:47:12 2025-11-23 22:47:12 -08:00
Steve Yegge f5e96f9a7b Update bd JSONL after rebase 2025-11-23 22:39:58 -08:00
Steve Yegge e7dfe284b5 bd sync: 2025-11-23 22:38:58 2025-11-23 22:38:58 -08:00
Steve Yegge f5cc3ff85a bd sync: apply DB changes after import 2025-11-23 22:33:05 -08:00
Steve Yegge fee336e4ff Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 22:33:05 -08:00
Steve Yegge 839292657a bd sync: 2025-11-23 22:33:04 2025-11-23 22:33:04 -08:00
Steve Yegge 133c30d0d5 bd sync: apply DB changes after import 2025-11-23 22:32:42 -08:00
Steve Yegge e594596835 bd sync: 2025-11-23 22:32:29 2025-11-23 22:32:29 -08:00
Steve Yegge 3192c26709 bd sync: apply DB changes after import 2025-11-23 22:32:13 -08:00
Steve Yegge 26615721e9 Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 22:32:12 -08:00
Steve Yegge ca46d550a4 bd sync: 2025-11-23 22:32:11 2025-11-23 22:32:11 -08:00
Steve Yegge ed11a13f1b bd sync: 2025-11-23 22:28:15 2025-11-23 22:28:15 -08:00
Steve Yegge 3009b42e06 bd sync: 2025-11-23 22:27:52 2025-11-23 22:27:52 -08:00
Steve Yegge 8b530ff809 bd sync: 2025-11-23 22:26:56 2025-11-23 22:26:57 -08:00
Steve Yegge 94c3471d42 bd sync: apply DB changes after import 2025-11-23 22:26:02 -08:00
Steve Yegge 8f465df351 Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 22:26:01 -08:00
Steve Yegge ed9b46d163 bd sync: 2025-11-23 22:26:00 2025-11-23 22:26:00 -08:00
Steve Yegge 1f27256525 bd sync: 2025-11-23 22:09:36 2025-11-23 22:13:24 -08:00
Steve Yegge 5703f38858 bd sync: 2025-11-23 22:12:49 2025-11-23 22:12:49 -08:00
Steve Yegge 07e2e89657 bd sync: 2025-11-23 22:12:32 2025-11-23 22:12:32 -08:00
Steve Yegge 8bc8611918 bd sync: 2025-11-23 22:06:45 2025-11-23 22:06:45 -08:00
Steve Yegge 31d9de0ac4 bd sync: 2025-11-23 22:04:05 2025-11-23 22:04:05 -08:00
Steve Yegge ebf6e36b31 bd sync: apply DB changes after import 2025-11-23 21:59:16 -08:00
Steve Yegge 82b64e205c bd sync: 2025-11-23 21:54:01 2025-11-23 21:54:01 -08:00
Steve Yegge bddc4a3d21 bd sync: apply DB changes after import 2025-11-23 21:52:14 -08:00
Steve Yegge 9e6a1b8af8 Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 21:51:58 -08:00
Steve Yegge 4c483ae112 bd sync: 2025-11-23 21:51:52 2025-11-23 21:51:52 -08:00
Steve Yegge 7da626ca94 bd sync: apply DB changes after import 2025-11-23 21:49:07 -08:00
Steve Yegge 3804aa616f Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 21:49:07 -08:00
Steve Yegge bcf7650c2c bd sync: 2025-11-23 21:49:06 2025-11-23 21:49:06 -08:00
Steve Yegge 3ef55ffc28 Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-23 21:48:58 -08:00