Commit Graph

2877 Commits

Author SHA1 Message Date
Steve Yegge
3a6a8abe54 bd sync: 2025-11-27 17:01:20 2025-11-27 17:01:21 -08:00
Steve Yegge
39ed52726c bd sync: 2025-11-27 15:18:08 2025-11-27 15:18:08 -08:00
Steve Yegge
1d5fd64383 fix(daemon): add cross-process locking to registry (bd-5bj)
The global daemon registry (~/.beads/registry.json) could be corrupted
when multiple daemons from different workspaces wrote simultaneously.

Changes:
- Add file locking (flock) for cross-process synchronization
- Use atomic writes (temp file + rename) to prevent partial writes
- Keep entire read-modify-write cycle under single lock
- Add FlockExclusiveBlocking and FlockUnlock to lockfile package

This prevents race conditions that caused JSON corruption like `]]`.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 14:22:42 -08:00
Steve Yegge
c196a554cc bd sync: 2025-11-27 14:22:28 2025-11-27 14:22:28 -08:00
Steve Yegge
e96782f78e bd sync: apply DB changes after import 2025-11-27 13:23:19 -08:00
Steve Yegge
2bcfcd1c9b Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-27 13:23:19 -08:00
Steve Yegge
3f609267d4 fix: doctor deletions check and onboard docs improvements
- Fix doctor to treat empty deletions.jsonl as valid (0 entries OK status)
- Fix HydrateDeletionsManifest to create empty file when no deletions found
- Add --parent flag documentation to onboard command
- Add CLI --help tip throughout onboard documentation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 13:23:14 -08:00
Steve Yegge
cbf748e06a bd sync: 2025-11-27 13:02:18 2025-11-27 13:02:18 -08:00
Steve Yegge
650dcd42f6 fix(tests): resolve short test performance regression (bd-0v4)
Short tests were timing out after 13+ minutes due to:

1. TestZFCSkipsExportAfterImport spawning subprocess that tried to
   auto-start daemon - now skipped in short mode

2. TestVersionFlag taking 5+ seconds because --version flag did not
   skip PersistentPreRun daemon startup - added early return

3. TestGetVersionsSince* had hardcoded version expectations that
   became stale - made tests dynamic using versionChanges array

Short tests now complete in ~8 seconds instead of timing out.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 01:36:57 -08:00
Steve Yegge
6aa0f58f86 bd sync: apply DB changes after import 2025-11-27 01:36:31 -08:00
Steve Yegge
d59ee64a93 bd sync: 2025-11-27 01:36:23 2025-11-27 01:36:31 -08:00
Steve Yegge
bba6dd1d70 bd sync: apply DB changes after import 2025-11-27 01:25:49 -08:00
Steve Yegge
a4abbebf9c Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-27 01:25:48 -08:00
Steve Yegge
ecd54639b7 bd sync: 2025-11-27 01:25:47 2025-11-27 01:25:47 -08:00
Steve Yegge
e481938f29 bd sync: 2025-11-27 01:06:58 2025-11-27 01:07:05 -08:00
Steve Yegge
45c048ab96 chore: Bump version to 0.26.0
Release highlights:
- bd doctor --check-health for lightweight startup hook health checks
- --no-git-history flag to prevent spurious deletions
- gh2jsonl --id-mode hash for content-based ID generation
- Critical MCP protocol stdin fix (PR #400)
- Git worktree staleness fix (#399)
- Multi-part prefix support (#398)
- bd sync commit scope fix

Updated all component versions:
- bd CLI: 0.25.1 -> 0.26.0
- Plugin: 0.25.1 -> 0.26.0
- MCP server: 0.25.1 -> 0.26.0
- npm package: 0.25.1 -> 0.26.0

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 01:06:45 -08:00
Steve Yegge
427f8f4112 bd sync: 2025-11-27 00:58:39 2025-11-27 00:58:39 -08:00
Steve Yegge
5d10095345 bd sync: 2025-11-27 00:55:29 2025-11-27 00:55:30 -08:00
Steve Yegge
99fff192eb fix(hooks): prevent rebase failures from deletions.jsonl writes
Two fixes to prevent git pull --rebase from failing:

1. Skip hook execution during rebase operations by detecting
   .git/rebase-merge or .git/rebase-apply directories

2. Use --no-git-history flag to prevent git-history-backfill
   from writing to deletions.jsonl during imports

The root cause was that post-checkout hooks were running during
rebase, triggering the git-history-backfill which appends to
deletions.jsonl. This created uncommitted changes that blocked
the rebase from continuing.

Bump hooks version to 0.26.0 (requires bd version bump to take effect).

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 00:55:30 -08:00
Steve Yegge
1c2aa6159b fix: Add defense-in-depth check for --no-auto-import flag (bd-4t7)
- autoImportIfNewer() now directly checks noAutoImport flag
- Ensures auto-import is blocked even if caller forgets to check autoImportEnabled
- Added TestAutoImportIfNewer_NoAutoImportFlag test to verify the fix

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 00:54:29 -08:00
Steve Yegge
7e5c0b3285 Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-27 00:54:20 -08:00
Steve Yegge
056bd9443c bd sync: 2025-11-27 00:54:19 2025-11-27 00:54:19 -08:00
Steve Yegge
101f094c91 fix(hooks): prevent rebase failures from deletions.jsonl writes
Two fixes to prevent git pull --rebase from failing:

1. Skip hook execution during rebase operations by detecting
   .git/rebase-merge or .git/rebase-apply directories

2. Use --no-git-history flag to prevent git-history-backfill
   from writing to deletions.jsonl during imports

The root cause was that post-checkout hooks were running during
rebase, triggering the git-history-backfill which appends to
deletions.jsonl. This created uncommitted changes that blocked
the rebase from continuing.

Bump hooks version to 0.26.0.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 00:51:07 -08:00
Steve Yegge
5c979275a2 Merge branch 'main' of https://github.com/steveyegge/beads 2025-11-27 00:45:41 -08:00
Steve Yegge
0bf9313971 bd sync: 2025-11-27 00:29:59 2025-11-27 00:35:31 -08:00
Steve Yegge
44446b6978 Merge branch 'fix/mcp-stdin' 2025-11-27 00:30:39 -08:00
Steve Yegge
62d1dc959e docs: sync skill CLI reference with current docs
Update examples/claude-code-skill/references/CLI_REFERENCE.md to match
docs/CLI_REFERENCE.md. The skill version was ~17% smaller and missing
newer sections like Global Flags, Sandbox Mode, Orphan Handling, etc.

Fixes #401

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 00:29:01 -08:00
Steve Yegge
4e113fcde0 bd sync: 2025-11-27 00:27:39 2025-11-27 00:27:39 -08:00
Steve Yegge
ef571f6735 bd sync: 2025-11-27 00:25:09 2025-11-27 00:25:09 -08:00
Steve Yegge
a70456297f bd sync: 2025-11-27 00:25:01 2025-11-27 00:25:01 -08:00
Steve Yegge
ebf2a0a89a Merge pull request #400 from cleak/fix/mcp-stdin
fix(beads-mcp): prevent subprocess stdin inheritance breaking MCP protocol
2025-11-27 00:19:05 -08:00
Steve Yegge
cdc156428c fix(staleness): use RFC3339Nano precision for last_import_time (#399)
The staleness check compares last_import_time against JSONL file mtime.
File mtime has nanosecond precision, but last_import_time was stored with
only second precision (RFC3339). This caused a race condition where the
stored time could be slightly earlier than the file mtime, triggering
false "Database out of sync" errors - particularly in git worktrees.

Changed all 6 locations that set last_import_time to use RFC3339Nano.
The CheckStaleness parser already handles both formats, so this is
backward compatible.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 00:11:01 -08:00
Steve Yegge
e8ffac63ba bd sync: 2025-11-26 23:59:43 2025-11-26 23:59:43 -08:00
Steve Yegge
d51ddb0b03 fix(beads): also fix FindJSONLPath to skip deletions.jsonl (bd-tqo)
Code review follow-up:
- Fix misleading docstring in FindJSONLInDir (does not return empty)
- Fix same bug in beads.FindJSONLPath (also fell back to matches[0])
- Add comprehensive tests for FindJSONLPath skipping deletions

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 23:44:04 -08:00
Steve Yegge
887c958567 fix(autoimport): prevent export to wrong JSONL file (bd-tqo)
Add FindJSONLInDir helper that correctly prefers issues.jsonl over other
.jsonl files. Previously, glob patterns could return deletions.jsonl or
merge artifacts (beads.base.jsonl, etc.) first alphabetically, causing
issue data to be written to the wrong file.

This fixes the root cause of deletions.jsonl corruption where full issue
objects were written instead of deletion records, leading to all issues
being purged during sync.

Changes:
- Add FindJSONLInDir() in internal/autoimport with proper file selection
- Update AutoImportIfNewer() to use FindJSONLInDir
- Update CheckStaleness() to use FindJSONLInDir
- Update triggerExport() in RPC server to use FindJSONLInDir
- Add comprehensive tests for FindJSONLInDir

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 23:25:32 -08:00
Steve Yegge
1b0e8cd1fb bd sync: 2025-11-26 23:25:20 2025-11-26 23:25:20 -08:00
Steve Yegge
30aa8e3c2a bd sync: 2025-11-26 23:17:21 2025-11-26 23:17:21 -08:00
Steve Yegge
224715d1d5 bd sync: 2025-11-26 23:14:29 2025-11-26 23:14:29 -08:00
Steve Yegge
1322e7e80a chore: remove corrupted deletions.jsonl (contained issue data instead of deletion records) 2025-11-26 23:14:10 -08:00
Steve Yegge
5506486dc5 feat(import,sync): add --no-git-history flag to prevent spurious deletions
Fixes bd-0b2: The git history backfill mechanism was causing data loss
during JSONL filename migrations (beads.jsonl → issues.jsonl). When issues
existed in the old filename's git history, the backfill incorrectly treated
them as "deleted" and purged them from the database.

Changes:
- Add NoGitHistory field to importer.Options and ImportOptions structs
- Modify purgeDeletedIssues() to skip git history check when flag is set
- Add --no-git-history flag to bd import command
- Add --no-git-history flag to bd sync command
- Update purge_test.go to pass Options argument

Usage:
  bd import -i .beads/issues.jsonl --no-git-history
  bd sync --no-git-history

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 23:10:43 -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
dfc68ed8f6 bd sync: 2025-11-26 22:46:36 2025-11-26 22:46:36 -08:00
Steve Yegge
b5e58b0814 chore: file bugs discovered during issues.jsonl migration
New bugs filed:
- bd-zai: bd init resets metadata.json jsonl_export
- bd-8an: bd import auto-detects wrong prefix
- bd-0b2: Need --no-git-history flag
- bd-4pv: bd export only outputs 1 issue after corruption
- bd-4t7: Auto-import runs despite --no-auto-import flag
2025-11-26 22:30:33 -08:00
Steve Yegge
503c9a966e chore: file bugs discovered during issues.jsonl migration 2025-11-26 22:29:15 -08:00
Steve Yegge
83672a792b chore: close resolved beads, update issues.jsonl 2025-11-26 22:26:22 -08:00
Steve Yegge
985bd9be20 fix: standardize on issues.jsonl, clear corrupted deletions manifest 2025-11-26 22:23:14 -08:00
Steve Yegge
016db76325 bd sync: 2025-11-26 22:17:11 2025-11-26 22:17:11 -08:00
Steve Yegge
3704ef4329 bd sync: 2025-11-26 22:11:38 2025-11-26 22:11:38 -08:00
Steve Yegge
5a25bdb221 chore: update metadata.json to use issues.jsonl as canonical export 2025-11-26 22:11:33 -08:00
Steve Yegge
03b9cf03c0 chore: remove legacy beads.jsonl, standardize on issues.jsonl 2025-11-26 22:10:44 -08:00