import type { KnowledgeEntry } from '../../types/index.js'; import type { ScaffoldWarning } from '../../types/index.js'; import type { AssemblyMode } from '../../types/index.js'; type Volatility = 'stable' | 'evolving' | 'fast-moving'; interface KBSource { url: string; anchor?: string; retrieved?: string; hash?: string; } interface KBFrontmatter { name: string; description: string; topics: string[]; volatility: Volatility; lastReviewed: string | null; versionPin: string | null; sources: KBSource[]; } /** * Extract and parse YAML frontmatter from knowledge base file content. * Returns null if frontmatter is missing or has no name field. */ export declare function extractKBFrontmatter(content: string): KBFrontmatter | null; /** * Extract only the "Deep Guidance" section from a knowledge file body. * * Knowledge files with dual-channel distribution contain a "## Summary" * section (content that overlaps with the command prompt) and a * "## Deep Guidance" section (supplementary expertise). When assembling * CLI prompts, we load only the Deep Guidance to avoid redundancy with * the prompt text the user already sees. * * Returns null if no "## Deep Guidance" heading is found — callers * should fall back to the full body for backward compatibility. */ export declare function extractDeepGuidance(body: string): string | null; /** * Scan knowledgeDir recursively for .md files. * Returns a map of entry name → absolute file path. * Gracefully returns an empty map if the directory does not exist. */ export declare function buildIndex(knowledgeDir: string): Map; /** * Like buildIndex(), but checks /.scaffold/knowledge/ first. * Local overrides take precedence over global entries by the same name. * Emits a stderr warning for duplicate names within the local override dir. */ export declare function buildIndexWithOverrides(projectRoot: string, globalKnowledgeDir: string): Map; /** * Load the named knowledge base entries from the index. * Missing entries produce FRONTMATTER_KB_ENTRY_MISSING warnings (non-fatal). */ export declare function loadEntries(index: Map, names: string[]): { entries: KnowledgeEntry[]; warnings: ScaffoldWarning[]; }; /** Knowledge entry injected for adoption-mode steps (brownfield R3, D11). */ export declare const ADOPTION_KNOWLEDGE_ENTRY = "brownfield-adoption"; /** * Append the brownfield-adoption knowledge entry when assembling in * adoption mode. Pure; never mutates the input; dedupes. */ export declare function withAdoptionKnowledge(names: string[], mode: AssemblyMode): string[]; /** * Load knowledge entries with FULL content (Summary + Deep Guidance). * Used by scaffold build to generate self-contained command files * where no runtime assembly is available to inject knowledge. * * Unlike loadEntries() which prefers Deep Guidance only (for CLI assembly), * this always returns the complete body after frontmatter. */ export declare function loadFullEntries(index: Map, names: string[]): { entries: KnowledgeEntry[]; warnings: ScaffoldWarning[]; }; export {}; //# sourceMappingURL=knowledge-loader.d.ts.map