framework
Version:
The (AI) Framework: turnkey, zero-config AI orchestration that wraps a coding-agent CLI (Claude Code) as a black box and takes you from an idea to a running app. Vite for AI.
31 lines • 1.51 kB
JavaScript
import { collectQueue } from './queue.js';
import { hasTickets } from './tickets.js';
import { buildOverview } from './overview.js';
/**
* Build the Overview dashboard: the {@link buildOverview} rollup (working now / queue) plus the
* per-project ticket presence the onboarding checklist reads. Forgiving — a project whose state
* cannot be read simply contributes nothing.
*/
export async function buildDashboard(projects, deps = {}) {
const hasTicketsFor = deps.tickets ?? (cwd => hasTickets(cwd).catch(() => false));
// Compute the queue once and hand it to buildOverview so the backlog is read a single time.
const queue = await (deps.queue ?? (p => collectQueue(p)))(projects);
const overview = await buildOverview(projects, { ...deps, queue: async () => queue });
// Most-recently-active first: the checklist takes the head of this list as the project to act
// on, so the order is the output here even though the timestamp itself is not.
const ordered = [...projects].sort((a, b) => (b.lastActivityAt ?? '').localeCompare(a.lastActivityAt ?? ''));
const projectStats = [];
for (const project of ordered) {
projectStats.push({ projectId: project.id, hasTickets: await hasTicketsFor(project.path) });
}
return {
totals: {
projects: projects.length,
openTodos: overview.queueOpen,
},
active: overview.active,
projects: projectStats,
queue,
};
}
//# sourceMappingURL=dashboard.js.map