@blundergoat/goat-flow
Version:
AI coding agent harness and local dashboard for Claude Code, OpenAI Codex, Google Antigravity, and GitHub Copilot - setup audits, guardrails, structured skills, deny hooks, and persistent learning loops.
79 lines • 3.29 kB
JavaScript
/** Format a score delta for the compact history table, keeping first-run cells blank. */
function formatDelta(delta) {
if (delta === null)
return "";
if (delta > 0)
return ` (+${delta})`;
if (delta < 0)
return ` (${delta})`;
return " (+0)";
}
/**
* Render quality-history rows for CLI text output.
*
* @param rows - Rows returned by `buildQualityHistoryRows`.
* @param options - Active filters used to render empty-state and limit hints.
* @returns Markdown-like text table for terminal output.
*/
export function renderQualityHistoryText(rows, options) {
if (rows.length === 0) {
const scope = options.agent ? ` for ${options.agent}` : "";
const modeScope = options.qualityMode
? ` in ${options.qualityMode} mode`
: "";
return [
`No saved quality history${scope}${modeScope}.`,
"Generate a prompt with `goat-flow quality . --agent <id>`; the agent writes its report directly to `.goat-flow/logs/quality/`.",
].join("\n");
}
const lines = [
"date | agent | mode | setup_total | system_total | blocker | major | minor",
];
for (const row of rows) {
lines.push([
row.date,
row.agent,
row.qualityMode,
`${row.setupTotal}${formatDelta(row.setupDelta)}`,
String(row.systemTotal),
String(row.blockerCount),
String(row.majorCount),
String(row.minorCount),
].join(" | "));
}
if (!options.includeAll) {
lines.push("");
lines.push("Use `--all` to lift the 20-run default. Diff ids are saved report basenames under `.goat-flow/logs/quality/`.");
}
return lines.join("\n");
}
/**
* Render a quality diff for CLI text output.
*
* The four fixed sections mirror the lifecycle buckets because saved-report
* diffs are scanned by humans and shell output, not just JSON clients.
*
* @param diff - Diff returned by `buildQualityDiff`.
* @returns Human-readable diff grouped by finding lifecycle.
*/
export function renderQualityDiffText(diff) {
const header = `Setup ${diff.from.report.scores.setup.total}/100 → ${diff.to.report.scores.setup.total}/100 (${diff.setupDelta >= 0 ? `+${diff.setupDelta}` : diff.setupDelta}). System ${diff.from.report.scores.system.total}/100 → ${diff.to.report.scores.system.total}/100 (${diff.systemDelta >= 0 ? `+${diff.systemDelta}` : diff.systemDelta}).`;
const lines = [header, ""];
/** Render one labeled diff section. */
const renderSection = (title, rows) => {
lines.push(`${title} (${rows.length})`);
for (const row of rows) {
lines.push(`${row.id} | ${row.severity} | ${row.type} | ${row.summary}`);
}
if (rows.length === 0)
lines.push("(none)");
lines.push("");
};
renderSection("Resolved", diff.resolved);
renderSection("New", diff.newFindings);
renderSection("Persisted", diff.persisted);
renderSection("Stuck", diff.stuck);
lines.push("Stuck counter resets on history gaps. For strict persistence tracking, ensure at least one quality run lands within every 30-day window.");
return lines.join("\n");
}
//# sourceMappingURL=history-render.js.map