Add tracer-bullet Kanban baseline with live issues read path

This commit is contained in:
zenchantlive 2026-02-11 17:55:26 -08:00
parent 7537ec27b0
commit c09420dc68
15 changed files with 748 additions and 8 deletions

33
src/lib/read-issues.ts Normal file
View file

@ -0,0 +1,33 @@
import fs from 'node:fs/promises';
import path from 'node:path';
import { parseIssuesJsonl } from './parser';
import { canonicalizeWindowsPath } from './pathing';
import type { BeadIssue } from './types';
export interface ReadIssuesOptions {
projectRoot?: string;
includeTombstones?: boolean;
}
export function resolveIssuesJsonlPath(projectRoot: string = process.cwd()): string {
const absolute = path.resolve(projectRoot, '.beads', 'issues.jsonl');
return canonicalizeWindowsPath(absolute);
}
export async function readIssuesFromDisk(options: ReadIssuesOptions = {}): Promise<BeadIssue[]> {
const issuesPath = resolveIssuesJsonlPath(options.projectRoot);
try {
const jsonl = await fs.readFile(issuesPath, 'utf8');
return parseIssuesJsonl(jsonl, {
includeTombstones: options.includeTombstones ?? false,
});
} catch (error) {
if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
return [];
}
throw error;
}
}