Add durable tracked backlog lifecycle

This commit is contained in:
thePR0M3TH3AN committed 2026-09-27 16:44:19 -04:00
1 parent 4b4a0f38f9
commit 13a3bcd5b3
12 files changed
+697 -19

No files matched your search

+28 -1
View File
@@ -1,4 +1,4 @@
import { existsSync, readFileSync } from 'node:fs';
import { existsSync, readFileSync, readdirSync } from 'node:fs';
import { join } from 'node:path';
import { DatabaseSync } from 'node:sqlite';
import { fileHash } from './files.mjs';
@@ -113,6 +113,33 @@ export function diagnoseProject({ repository, env = process.env }) {
});
}
}
const managerWorktree = (manifest.external ?? []).find((entry) =>
entry.type === 'worktree' && entry.area === 'session-manager');
if (managerWorktree) {
const backlogRoot = join(managerWorktree.path, '.torch', 'backlog');
if (!existsSync(backlogRoot)) {
findings.push({ severity: 'error', code: 'BACKLOG_DIRECTORY_MISSING', path: backlogRoot });
} else {
const tasks = [];
for (const name of readdirSync(backlogRoot).filter((entry) => entry.endsWith('.json'))) {
try {
const task = parseJsonYaml(join(backlogRoot, name));
if (task.schema !== 'torch.dev/backlog-item/v1alpha1' || !task.id || !task.state) throw new Error('invalid task schema');
if (!['completed', 'cancelled'].includes(task.state)) {
tasks.push({ id: task.id, state: task.state, owner: task.owner, revision: task.revision });
}
} catch (error) {
findings.push({
severity: 'error', code: 'BACKLOG_TASK_INVALID', path: join(backlogRoot, name), message: error.message,
});
}
}
if (tasks.length) findings.push({
severity: tasks.some((task) => task.state === 'blocked') ? 'warning' : 'info',
code: 'BACKLOG_ACTIVITY', tasks,
});
}
}
}
if (config?.project?.id && manifest?.projectId && config.project.id !== manifest.projectId) {