From d6f73ce9797aec980e3d390307f8645a7364f625 Mon Sep 17 00:00:00 2001 From: zenchantlive Date: Tue, 24 Mar 2026 19:07:19 -0500 Subject: [PATCH] fix: restore JSONL fallback when Dolt is unavailable readIssuesFromDisk was throwing when Dolt was unreachable instead of falling back to .beads/issues.jsonl on disk. This broke the app for users without Dolt installed. Restores the JSONL fallback path: try Dolt first, then read from the git-tracked JSONL file, return empty array if neither is available. Fixes #22 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/lib/read-issues.ts | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/lib/read-issues.ts b/src/lib/read-issues.ts index f5a6353..2ab98ab 100644 --- a/src/lib/read-issues.ts +++ b/src/lib/read-issues.ts @@ -1,5 +1,7 @@ +import fs from 'node:fs/promises'; import path from 'node:path'; +import { parseIssuesJsonl } from './parser'; import { buildProjectContext } from './project-context'; import { readIssuesViaDolt } from './read-issues-dolt'; import type { BeadIssueWithProject, ProjectSource } from './types'; @@ -56,12 +58,25 @@ export async function readIssuesFromDisk(options: ReadIssuesOptions = {}): Promi addedAt: options.projectAddedAt ?? null, }); - // Dolt-only: throw if unreachable + // Try Dolt first const viaDolt = await readIssuesViaDolt(projectRoot, options); if (viaDolt !== null) { return viaDolt.map((issue) => ({ ...issue, project })); } - // No fallback - fail fast to indicate Dolt is not running - throw new Error('Dolt unreachable - ensure Dolt is running: bd dolt start'); + // Fall back to JSONL on disk when Dolt is unavailable + for (const candidate of resolveIssuesJsonlPathCandidates(projectRoot)) { + try { + const text = await fs.readFile(candidate, 'utf8'); + const issues = parseIssuesJsonl(text, { + includeTombstones: options.includeTombstones, + skipAgentFilter: options.skipAgentFilter, + }); + return issues.map((issue) => ({ ...issue, project })); + } catch { + continue; + } + } + + return []; }