UNPKG

@meldscience/meld

Version:

pipeable one-shot prompt scripting toolkit

45 lines (44 loc) 1.38 kB
export interface MeldOptions { inputFile: string; outputFile?: string; dryRun?: boolean; } export interface Command { raw: string; command: string; lineNumber: number; } export interface CommandResult { command: Command; output: string; error?: Error; } export declare class Meld { private options; constructor(options: MeldOptions); /** * Main entry point. Orchestrates reading file, extracting commands, * executing them, and replacing placeholders. */ process(): Promise<string>; /** * Scans markdown content for lines containing @cmd[...] * @param content entire markdown file text * @returns array of Command objects */ extractCommands(content: string): Promise<Command[]>; /** * Executes a single shell command synchronously. * @param cmd object containing the command string * @returns command result with output */ executeCommand(cmd: Command): Promise<CommandResult>; /** * Replaces each @cmd[...] in the original content with its execution result. * If there's an error, it inserts the error message into a fenced code block. * @param content original markdown * @param results command results * @returns final processed markdown */ replaceCommands(content: string, results: CommandResult[]): Promise<string>; }