@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.
73 lines • 3.75 kB
TypeScript
/**
* Audit orchestrator for `goat-flow audit`.
* Loads config, extracts facts, runs build checks (pass/fail) and optional
* harness completeness checks (--harness, deterministic pass/fail per concern).
* Returns an AuditReport consumed by renderers and the dashboard.
*/
import type { AgentId, ReadonlyFS } from "../types.js";
import type { AuditContext, AuditConcern, AuditConcernKey, AuditFactProfile, AuditReport, AuditScope } from "./types.js";
export { createAuditFactsView } from "./audit-facts-view.js";
/** Runtime switches that choose audit scope, fact depth, and optional diagnostics. */
type AuditHarnessOption = Record<"harness", boolean>;
/**
* Caller-supplied switches for a single `runAudit` invocation. Every field beyond `agentFilter` and
* the inherited `harness` flag is optional and off by default, so the common audit path stays the
* deterministic build checks; the optional fields turn on the more expensive diagnostics (drift,
* content lint, full deny-hook runtime validation) or trade fact depth for dashboard speed.
*/
interface AuditOptions extends AuditHarnessOption {
agentFilter: AgentId | null;
/** Optional drift check. Defaults to false when omitted. */
checkDrift?: boolean;
/** Optional cold-path content lint. Defaults to false when omitted. */
checkContent?: boolean;
/** Optional summary-mode downgrade for expensive deny-hook runtime validation. */
denyMechanismEvidenceLevel?: "full" | "static" | "present-only";
/** Optional fact profile. Dashboard summary omits stack facts by contract. */
factProfile?: AuditFactProfile;
/** Optional development/test profiler for audit-path timing. */
profile?: AuditProfiler;
/** Internal label used to separate aggregate, per-agent, and single audit spans. */
profileScope?: "aggregate" | "per-agent" | "single";
/** Internal batch option: project-level auto drift should run on aggregate only. */
shouldRunAutoDrift?: boolean;
}
/** Synchronous profiler seam used by dashboard development benchmarks. */
interface AuditProfiler {
span<T>(name: string, fn: () => T): T;
}
/**
* Run harness checks and return the scope results plus per-concern scores.
*
* @param ctx - audit context containing facts, config, checks, and target filesystem access
*/
export declare function computeHarness(ctx: AuditContext): {
scope: AuditScope;
concerns: Record<AuditConcernKey, AuditConcern>;
};
/**
* Run the audit against a project and return the full report.
*
* @param fs - filesystem adapter scoped to the target project
* @param projectPath - absolute or relative target project root passed to fact extraction and checks
* @param options - audit switches controlling agent filtering, harness, drift, content, and fact profile
* @returns full audit report with setup, agent, optional harness, drift, and content sections
*/
export declare function runAudit(fs: ReadonlyFS, projectPath: string, options: AuditOptions): AuditReport;
/**
* Run aggregate + per-agent audits sharing a single config/structure/provenance pass.
* Eliminates the N+1 pattern where each per-agent audit re-parses config and facts.
*
* @param fs - filesystem adapter scoped to the target project
* @param projectPath - target project root reused by aggregate and per-agent runs
* @param options - aggregate audit switches reused by the per-agent runs
* @param agentIds - supported agent ids to audit individually after the aggregate run
*/
export declare function runAuditBatch(fs: ReadonlyFS, projectPath: string, options: AuditOptions, agentIds: AgentId[]): {
aggregate: AuditReport;
perAgent: {
id: string;
audit: AuditReport;
}[];
};
//# sourceMappingURL=audit.d.ts.map