/** * `SKILL.md` parser — frontmatter (minimal YAML subset) + body. * * **Why a hand-rolled YAML parser rather than `js-yaml` or `yaml`?** The SDK * 2.0 has zero runtime dependencies except `ws`. Adding a 60–100 KB YAML * parser to every install for the bounded skill-frontmatter shape would be * disproportionate. The frontmatter contract (`skills.md` §2) covers a * narrow YAML subset: top-level map → scalars, lists, and shallow maps. The * 29-skill OSS survey shows no anchors, no refs, no flow-style collections, * no tag types. We implement that subset, document the limits, and reject * anything we don't support as a parse error. * * Supported YAML features: * * - `key: value` block-style map entries (top-level). * - Scalar values: bare strings, single-quoted, double-quoted (with `\n` / * `\t` / `\"` / `\\` escapes), numbers, booleans (`true`/`false`/`yes`/`no`/`on`/`off`), * null (`null`/`~`). * - Folded scalars: `>` and `>-`. * - Literal scalars: `|` and `|-`. * - Block sequences: `- item` lists, possibly of strings or `{ key: value }` maps. * - Inline flow scalars on one line: `[a, b, c]` and `{ a: 1, b: 2 }` (shallow only). * - Comments: `#` to end of line. * * Unsupported (rejected): anchors (`&`/`*`), explicit tags (`!!str`), * complex keys, multi-line flow collections, nested maps under list entries * beyond one level. * * Trailing blank lines inside literal/folded blocks are stripped per `-` * chomp; `>+` / `|+` keep blanks (rare in skill frontmatter — supported). */ import type { JsonValue } from '../qar/json.js'; /** * Frontmatter parse result. Carries the original raw text for the body so the * SDK can pipe it to `get_skill` later without re-reading the disk. */ export interface FrontmatterParseResult { /** Parsed top-level YAML map. Always a plain object; never a list. */ readonly frontmatter: Readonly>; /** Markdown body verbatim, with frontmatter (and its delimiters) stripped. */ readonly body: string; } /** * Parse a `SKILL.md` document. * * Format: `---\n\n---\n`. The leading delimiter must be on the * first line; trailing CR characters are normalized. * * Throws `SkillParseError` on: * - missing frontmatter delimiters * - YAML parse failure inside the subset we support * - top-level YAML value that isn't a map */ export declare function parseSkillDocument(text: string): FrontmatterParseResult; /** * Thrown by `parseSkillDocument` and the underlying YAML walker. The * manager wraps these into `sdk.skill.error` events with the offending * skill's path attached. */ export declare class SkillParseError extends Error { constructor(message: string); } //# sourceMappingURL=parser.d.ts.map