fix(sync): use inline import for --import-only with redirect (bd-ysal)

When running `bd sync --import-only` from a directory with `.beads/redirect`,
the subprocess-based import could fail to update staleness metadata correctly
because the subprocess might resolve paths differently than the parent process.

The fix uses inline import (calling importIssuesCore directly) instead of
spawning a subprocess. This ensures:
1. The same store and dbPath are used throughout
2. Path resolution is consistent with the parent process
3. Staleness metadata is updated correctly in the redirected database

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
beads/crew/wolf
2026-01-06 18:51:38 -08:00
committed by Steve Yegge
parent cca2016376
commit 94997bd619
2 changed files with 93 additions and 1 deletions

View File

@@ -110,12 +110,13 @@ Use --merge to merge the sync branch back to main branch.`,
}
// If import-only mode, just import and exit
// Use inline import to avoid subprocess path resolution issues with .beads/redirect (bd-ysal)
if importOnly {
if dryRun {
fmt.Println("→ [DRY RUN] Would import from JSONL")
} else {
fmt.Println("→ Importing from JSONL...")
if err := importFromJSONL(ctx, jsonlPath, renameOnImport, noGitHistory); err != nil {
if err := importFromJSONLInline(ctx, jsonlPath, renameOnImport, noGitHistory); err != nil {
FatalError("importing: %v", err)
}
fmt.Println("✓ Import complete")