@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.
132 lines • 6.2 kB
TypeScript
import type { AgentId, SharedFacts } from "../types.js";
import type { AuditReport } from "../audit/types.js";
import type { QualityHistoryEntry } from "../quality/history.js";
import { type QualityMode } from "../quality/schema.js";
/**
* Build the forward-slash project sub-path that goes inside a Bash snippet in
* the prompt. On Windows `path.resolve` returns backslashes and (worse) drive-
* prefixes POSIX-shape inputs; `path.posix.join` keeps the input shape and
* forces forward-slash separators for the appended segment. Backslashes are
* normalised first so UNC roots (`\\server\share`) survive as `//server/share`;
* the leading slash that `posix.join` collapses on UNC inputs is then restored
* so quality writes still target the network share, not a local absolute path.
*
* @param projectPath - absolute project root; may be a Windows path or a UNC root (`\\server\share`)
* @param sub - POSIX-shaped sub-path to append, e.g. `.goat-flow/logs/quality`
* @returns forward-slash path safe to embed in a generated Bash snippet, with the UNC root preserved
*/
export declare function toShellProjectPath(projectPath: string, sub: string): string;
/** Inputs needed to compose an agent quality-review prompt for one project. */
export interface QualityInput {
agent: AgentId;
projectPath: string;
auditReport: AuditReport | null;
auditUnavailableReason?: AuditUnavailableReason | undefined;
priorReport?: QualityHistoryEntry | null;
qualityMode?: QualityMode;
selectedProjectPath?: string;
runDate?: string;
sharedFacts?: SharedFacts | null;
}
/**
* Why an audit summary could not be embedded in a quality prompt: the audit run
* itself failed, or fast cache-only mode found no cached report to reuse.
*/
export type AuditUnavailableReason = "audit-failed" | "fast-cache-only";
/** Structured quality command payload returned to CLI and dashboard callers. */
export interface QualityPayload {
command: "quality";
agent: AgentId;
auditStatus: "pass" | "fail" | "unavailable";
auditSummary: string;
prompt: string;
}
/**
* Format one date as YYYY-MM-DD using the local calendar day, not UTC.
*
* @param date - day to format; defaults to the current local time
* @returns the date as a zero-padded YYYY-MM-DD string
*/
export declare function formatLocalDate(date?: Date): string;
/**
* Render one JSON-safe string literal for the embedded example block.
*
* @param value - raw string to embed in the prompt's JSON example
* @returns the value as a quoted, escaped JSON string literal
*/
export declare function jsonString(value: string): string;
/**
* Render a Bash single-quoted literal so generated snippets do not expand `$` or backticks.
*
* @param value - raw string to quote for a generated shell snippet
* @returns a single-quoted Bash literal with embedded quotes escaped as `'\''`
*/
export declare function shellSingleQuote(value: string): string;
/**
* Infer the report scope from package metadata; recover as consumer when metadata is unreadable.
*
* @param projectPath - project root whose `package.json` name field is inspected
* @returns `framework-self` when the package is `@blundergoat/goat-flow`, otherwise `consumer`
* (also `consumer` when `package.json` is missing or unparseable)
*/
export declare function inferQualityScope(projectPath: string): "framework-self" | "consumer";
/**
* Render the audit summary block because reviewers need setup failures before qualitative judgment.
*
* @param report - completed audit report whose scope results and concern scores are summarised
* @returns a Markdown block listing setup/agent pass-fail plus harness-completeness percentages
*/
export declare function renderAuditSummary(report: AuditReport): string;
/**
* Render the summary text returned when no audit report is embedded.
*
* @param reason - why audit data is absent (failed run vs fast cache miss)
* @returns a one-line summary phrased for that reason
*/
export declare function renderAuditUnavailableSummary(reason: AuditUnavailableReason): string;
/**
* Render the heading used when no audit report is embedded.
*
* @param reason - why audit data is absent (failed run vs fast cache miss)
* @returns a bold Markdown heading marking the audit as not-loaded or unavailable
*/
export declare function renderAuditUnavailableHeading(reason: AuditUnavailableReason): string;
/**
* Render the fallback note used when audit data is unavailable.
*
* @param reason - why audit data is absent (failed run vs fast cache miss)
* @returns a blockquote telling the reviewer not to infer setup failure from the gap
*/
export declare function renderDegradedNote(reason: AuditUnavailableReason): string;
/**
* Return the operator-facing label for a quality prompt mode.
*
* @param mode - quality prompt mode being rendered
* @returns the human-readable label shown to operators (e.g. `Harness Engineering`)
*/
export declare function qualityModeLabel(mode: QualityMode): string;
/**
* Describe which workspace or target the selected quality mode should assess.
*
* @param mode - quality prompt mode being rendered
* @returns a sentence naming the workspace or target the mode's assessment covers
*/
export declare function qualityModeTargetScope(mode: QualityMode): string;
/**
* Escape Markdown table cell content emitted from scorer details.
*
* @param value - raw cell text that may contain pipes or newlines
* @returns single-line cell text with `|` escaped and line breaks flattened to spaces
*/
export declare function markdownTableCell(value: string): string;
export declare function renderPriorReportContext(priorReport: QualityHistoryEntry | null, qualityMode: QualityMode): string;
export declare function renderBoundedLearningLoopContext(sharedFacts: SharedFacts | null | undefined, qualityMode: QualityMode): string;
export declare function appendFocusedReportContract(lines: string[], input: {
agent: AgentId;
projectPath: string;
auditStatus: QualityPayload["auditStatus"];
qualityMode: QualityMode;
priorReport: QualityHistoryEntry | null;
runDate: string;
}): void;
//# sourceMappingURL=compose-quality-common.d.ts.map