/** * Skill/guidance loaders with context placeholder resolution. * * - `loadSkills()` loads universal skill definitions from a directory. * - `parseSkillFile()` parses a single skill file (YAML frontmatter + markdown body). * - `resolvePlaceholders()` resolves `{{context:}}` placeholders. * - `resolveGuidancePlaceholders()` resolves `{{guidance:}}` placeholders. * - `resolveGlossaryPlaceholders()` resolves `{{glossary:}}` placeholders. * - `resolveSkillBodies()` applies all three across a skill set — the production entry point. * - `loadGuidanceLayers()` loads guidance layers registered in `index.yaml`. * * Requirements: 2.1, 2.6, 1.8, 16.11, guidance-layers-never-resolve/AC-6..AC-10, * plain-language-vocabulary/AC-8 */ import type { GlossaryTerm } from '@rasensio/aidlc-content'; import type { Skill, GuidanceLayer } from '../core/types.js'; /** * Maximum size (bytes) for inline placeholder resolution. Larger files get a * read-instruction. Deliberately small: guidance layers live in ONE place * (`.aidlc/guidance/`) so an edited or newly installed layer (compliance packs * like SOC2/HIPAA included) applies without recompiling skills — inlining * bakes a stale copy into every compiled skill. The skip-risk of a pointer is * carried by the read-instruction's MUST wording, not by duplication. * * A compliance pack layer bypasses this bound entirely via `always_pointer`, since * its text may not be inlined at any size. Exported so a test can prove its * fixture is genuinely under the threshold — a large fixture would pass whether the * flag worked or not. */ export declare const INLINE_THRESHOLD_BYTES = 2048; /** * Parse a single skill file (YAML frontmatter delimited by `---` + markdown body). * * @param content - Raw file content. * @param filePath - Path to the file (used in error messages). * @returns Parsed `Skill` object. * @throws If frontmatter is missing or invalid. */ export declare function parseSkillFile(content: string, filePath: string): Skill; /** * Load all skill definitions from a directory. * * Reads all `.md` files in the given directory and parses them as skill files. * * @param skillsDir - Absolute path to the skills directory. * @returns Array of parsed `Skill` objects. */ export declare function loadSkills(skillsDir: string): Skill[]; /** * Resolve `{{context:}}` placeholders in a string. * * - Small targets (≤ 2KB): inline the content directly. * - Larger targets: emit a visible, repo-relative read-instruction. * - Unresolvable: produce a warning and leave a visible marker. * * @param body - The string containing placeholders. * @param contextDir - Absolute path to the `.aidlc/context/` directory. * @param projectRoot - Absolute project root, used to make emitted paths relative. * Required rather than optional so no call site can silently bake an absolute path. * @returns Object with resolved string and any warnings produced. */ export declare function resolvePlaceholders(body: string, contextDir: string, projectRoot: string): { resolved: string; warnings: string[]; }; /** * Resolve `{{guidance:}}` placeholders in a string using loaded guidance layers. * * Applies the same `INLINE_THRESHOLD_BYTES` bound as `resolvePlaceholders` * (guidance-layers-never-resolve/AC-6): a small layer inlines, a large one becomes * a read-instruction. Previously this inlined unconditionally, which would have * added ~12KB to a single skill body for the layers this framework ships. * * @param body - The string containing placeholders. * @param layers - Already-loaded guidance layers to resolve against. * @param guidanceRelDir - Repo-relative directory holding the layers, e.g. `.aidlc/guidance`. * @returns Object with resolved string and any warnings produced. */ export declare function resolveGuidancePlaceholders(body: string, layers: GuidanceLayer[], guidanceRelDir?: string): { resolved: string; warnings: string[]; }; /** * Resolve `{{glossary:}}` placeholders in a string. * * Two deliberate differences from the other two resolvers: * * - **No `INLINE_THRESHOLD_BYTES` bound.** A gloss is one sentence, so it always * inlines. The bound exists for guidance because a layer is a multi-KB * document; emitting "read the glossary" instead of the explanation would * defeat the entire point of explaining a word in the dialog * (plain-language-vocabulary/DD-3). * - **Matching is case-insensitive**, so `{{glossary:Instance}}` at the start of * a sentence resolves to the canonical lowercase entry. * * An unresolved term warns and leaves a visible marker rather than throwing: a * content typo must not break a user's `aidlc update`. The hard failure lives in * the content test suite instead, because a warning alone is precisely how * `{{guidance:}}` stayed inert for 17 days (DD-4). * * @param body - The string containing placeholders. * @param terms - Canonical glossary loaded from the content package. * @returns Object with resolved string and any warnings produced. */ export declare function resolveGlossaryPlaceholders(body: string, terms: GlossaryTerm[]): { resolved: string; warnings: string[]; }; /** * Resolve all three placeholder kinds across a whole skill set. * * This is the production entry point the resolvers lacked: the first two were * written in the initial framework commit, unit-tested, and never called, so * every emitted skill body shipped its placeholders verbatim * (guidance-layers-never-resolve/AC-13). * * Pass order is load-bearing. Glossary runs **last** so that a definition can * never be shadowed by an inlined guidance layer or context doc that happens to * contain placeholder-shaped text — the earlier passes inline whole files, and * anything they bring in should still get its terms glossed. * * @param skills - Skills loaded from the content package. * @param opts.projectRoot - Absolute project root. * @param opts.layers - Active guidance layers for this project. * @param opts.glossary - Canonical glossary terms from the content package. * @returns Skills with resolved bodies, plus collected warnings. */ export declare function resolveSkillBodies(skills: Skill[], opts: { projectRoot: string; layers: GuidanceLayer[]; glossary: GlossaryTerm[]; }): { skills: Skill[]; warnings: string[]; }; /** Result of loading guidance layers from disk. */ export interface LoadedGuidance { layers: GuidanceLayer[]; warnings: string[]; } /** * Load guidance layers from `.aidlc/guidance/` using `index.yaml` for registration. * * Loading rules (Req 16.10, 16.11): * - Active = registered in index.yaml AND present on disk. * - Registered but missing → warning, other layers still load. * - Present but unregistered → silently inactive. * * @param guidanceDir - Absolute path to the `.aidlc/guidance/` directory. * @returns Loaded layers and any warnings. */ export declare function loadGuidanceLayers(guidanceDir: string): LoadedGuidance; /** * Parse a guidance layer file (YAML frontmatter + markdown body). * * @param content - Raw file content. * @param filePath - Path for error messages. * @returns Parsed guidance layer, or null on failure. */ export declare function parseGuidanceFile(content: string, filePath: string): GuidanceLayer | null; //# sourceMappingURL=loaders.d.ts.map