UNPKG

@vibe-validate/git

Version:

Git utilities for vibe-validate - tree hash calculation, branch sync, and post-merge cleanup

65 lines 1.87 kB
/** * YAML Output Detection Utilities * * Efficient detection and extraction of YAML output from command execution. * * Unlike traditional YAML frontmatter (which has leading and trailing `---`), * this is used for commands that output YAML as their entire output: * * ``` * > preamble from package manager * --- * yaml: content * goes: here * (no trailing ---) * ``` * * @package @vibe-validate/git */ /** * Extract YAML output content from command output * * Uses a single efficient regex pass instead of multiple string scans. * Handles both Unix (\n) and Windows (\r\n) line endings. * * @param output - Raw output that may contain YAML * @returns YAML content (including `---` separator) or null if no YAML found * * @example * ```typescript * extractYamlContent("---\nkey: value") * // Returns: "---\nkey: value" * * extractYamlContent("preamble\n---\nkey: value") * // Returns: "---\nkey: value" * * extractYamlContent("no yaml here") * // Returns: null * ``` */ export declare function extractYamlContent(output: string): string | null; /** * Extract YAML content and preamble from command output * * Useful when you need to separate package manager noise (preamble) from YAML output. * * @param output - Raw output that may contain preamble + YAML * @returns Object with yaml content and preamble, or null if no YAML found * * @example * ```typescript * extractYamlWithPreamble("> pnpm test\n---\nkey: value") * // Returns: { yaml: "---\nkey: value", preamble: "> pnpm test" } * * extractYamlWithPreamble("---\nkey: value") * // Returns: { yaml: "---\nkey: value", preamble: "" } * * extractYamlWithPreamble("no yaml") * // Returns: null * ``` */ export declare function extractYamlWithPreamble(output: string): { yaml: string; preamble: string; } | null; //# sourceMappingURL=yaml-detection.d.ts.map