@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.
118 lines • 5.79 kB
TypeScript
/** Top-level artifact categories that the skill-quality engine scores. */
export type ArtifactKind = "skill" | "shared-reference";
/** Discovery provenance preserved in reports so mirrors and templates stay distinct. */
export type ArtifactSource = "workflow" | "installed" | "agent-mirror" | "github-mirror" | "shared-reference";
/** Rubric subtype selected after detection; each subtype owns a separate score profile. */
export type ArtifactSubtype = "workflow" | "dispatcher" | "report" | "playbook" | "index" | "meta";
/** Stable metric keys used by scoring output, fixtures, and config overrides. */
export type MetricName = "trigger-clarity" | "workflow-completeness" | "gate-quality" | "evidence-testability" | "cold-start" | "token-cost" | "tool-deps" | "write-risk" | "skill-reference-fit";
/** Directory to crawl plus the source label carried into artifact reports. */
interface WalkRoot {
dir: string;
source: ArtifactSource;
}
/** Ordered matching rules that assign an artifact to a rubric subtype. */
export interface SubtypeDetection {
/** Artifact kinds this subtype applies to. Empty array = any. */
kinds: ArtifactKind[];
/** Exact artifact-name matches that route to this subtype. */
namePatterns: string[];
/** Heading-style regex sources (case-insensitive). Any match counts. */
headingPatterns: string[];
/** Heading-style regex sources that veto this subtype if present. */
mustNotHave: string[];
}
/** Detection rule and metric weights for one artifact subtype. */
interface SubtypeProfile {
/** Detection rules in priority order; first matching subtype wins. */
detection: SubtypeDetection;
/** Per-metric max scores for this subtype. */
profile: Record<MetricName, number>;
/** Human-readable description of when this subtype applies. */
notes: string;
}
/** Shared-reference composition settings used before an artifact is scored. */
interface CompositionConfig {
/** Path to the shared preamble loaded by every skill (relative to project root). */
skillPreamblePath: string | null;
/** Path to the shared conventions appended when SKILL.md mentions it. */
skillConventionsPath: string | null;
/** Regex source for matching skill-local references (capture group 1 = relative path). */
skillReferencePattern: string;
/** Hard cap on total composed-content size; excess is truncated with a fit note. */
maxComposedBytes: number;
}
/** Configurable regex vocabulary for the gate-quality metric. */
interface GateVocabularyConfig {
/** Patterns that count as a verification-gate signal (+5 points). */
verificationGate: string[];
/** Patterns that count as an explicit pass/fail signal (+3 points). */
explicitPass: string[];
/** Patterns that count as a human-stop signal (+2 points). */
humanStop: string[];
}
/** Normalized quality configuration after defaults and user YAML are merged. */
export interface QualityConfig {
/** Walk roots for artifact discovery, in priority order. */
walkRoots: {
skills: WalkRoot[];
references: WalkRoot[];
};
composition: CompositionConfig;
/** Hard cap on bytes read per artifact; excess is truncated with a fit note. */
maxArtifactBytes: number;
gateVocabulary: GateVocabularyConfig;
/** Single regex source compiled into the tool-dependency scorer. */
toolKeywordsRegex: string;
/** Subtype profiles indexed by subtype name. Order in this object is detection priority. */
subtypes: Record<ArtifactSubtype, SubtypeProfile>;
/** Path to the in-tree expected-scores fixture. */
fixturePath: string;
/** Additional fixtures consumer projects may declare. */
additionalFixtures: string[];
}
/** Goat-flow's calibrated defaults. Mirrors the legacy hardcoded values exactly. */
export declare const DEFAULT_QUALITY_CONFIG: QualityConfig;
/**
* Merge a raw quality config (read from YAML) on top of `DEFAULT_QUALITY_CONFIG`.
*
* Each section falls back independently because project YAML is user-authored:
* one invalid override should not discard unrelated valid rubric settings.
*
* @param raw - Parsed `quality` block from `.goat-flow/config.yaml`.
* @returns Normalized quality config with defaults filled in for missing or invalid fields.
*/
export declare function mergeQualityConfig(raw: unknown): QualityConfig;
/**
* Deep-clone a quality config so callers can mutate nested arrays safely.
*
* @param config - Normalized quality config to clone.
* @returns Independent copy with no shared mutable arrays or nested objects.
*/
export declare function cloneQualityConfig(config: QualityConfig): QualityConfig;
/**
* Load `.goat-flow/config.yaml` and return its merged `quality` section,
* falling back to `DEFAULT_QUALITY_CONFIG` if the file is missing or has
* no `quality` block.
*
* @param projectRoot - Project root that may contain `.goat-flow/config.yaml`.
* @returns Normalized quality config for the project.
*/
export declare function loadQualityConfig(projectRoot: string): QualityConfig;
/**
* Compile an array of regex sources into a single OR'd RegExp.
*
* @param patterns - Valid regex sources to combine.
* @returns Case-insensitive matcher, or a never-match regex when the list is empty.
*/
export declare function compilePatternList(patterns: string[]): RegExp;
/**
* Compute the maximum possible score for a subtype profile.
*
* @param config - Normalized quality config containing subtype profiles.
* @param subtype - Subtype whose metric weights should be summed.
* @returns Sum of all metric maxima for the subtype.
*/
export declare function profileMaxForSubtype(config: QualityConfig, subtype: ArtifactSubtype): number;
export {};
//# sourceMappingURL=quality-config.d.ts.map