@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.
49 lines • 2.87 kB
TypeScript
/**
* Parses learning-loop bucket markdown into the entry list behind generated INDEX.md files.
* One parser covers all four buckets: footguns/lessons/patterns split per `## <Kind>:` heading
* (skipping `## Resolved Entries` sections and `**Status:** resolved` entries), while decisions
* derive one entry per ADR file. Hooks are extracted mechanically - first sentence of the
* bucket-specific lead paragraph - so regeneration stays deterministic and never needs
* hand-curated metadata. Nothing here reads the clock; `index-fresh` re-runs this parser and
* diffs, so any time-derived output would break freshness detection.
*/
import type { ReadonlyFS } from "../types.js";
import type { GoatFlowConfig } from "../config/types.js";
/** Learning-loop buckets that receive a generated INDEX.md. */
export type IndexBucket = "footguns" | "lessons" | "patterns" | "decisions";
/** Generation order for the four indexed buckets; stable so command output is deterministic. */
export declare const INDEX_BUCKETS: IndexBucket[];
/**
* One generated index row. The anchor is the entry's verbatim heading line (semantic anchor,
* never a line number) so `(search: "...")` retrieval survives bucket edits.
*/
export interface IndexEntry {
/** Entry heading text without the `## <Kind>:` prefix; decisions carry the full H1 text. */
title: string;
/** Bucket-relative source file name the row links to (INDEX.md sits in the same directory). */
sourceFile: string;
/** Grep needle for the `(search: "...")` anchor - heading line, cut before any embedded quote. */
anchor: string;
/** One-sentence routing hook extracted mechanically from the entry body. */
hook: string;
}
/**
* Resolve the four indexed bucket directories from loaded project config.
*
* @param config - validated goat-flow config carrying the footguns/lessons/decisions paths
* @returns bucket-keyed relative directory paths; patterns falls back to the fixed convention path
*/
export declare function resolveIndexBucketPaths(config: GoatFlowConfig): Record<IndexBucket, string>;
/**
* Parse one learning-loop bucket directory into the deterministic entry list a generated
* INDEX.md is rendered from. Files come back lexicographically sorted (ADR number order for
* decisions) with entries in document order, so repeated runs over unchanged content always
* produce the same list.
*
* @param fs - read-only filesystem adapter rooted at the target project
* @param dirPath - bucket directory path relative to the project root
* @param bucket - which bucket grammar to apply (entry headings vs one-ADR-per-file)
* @returns active-entry rows; empty when the directory is missing or holds no active entries
*/
export declare function parseBucket(fs: ReadonlyFS, dirPath: string, bucket: IndexBucket): IndexEntry[];
//# sourceMappingURL=parse-bucket.d.ts.map