// engine/spec-reader.ts — Shared helper for reading spec file content from disk
import { existsSync } from 'node:fs';
import { readFile } from 'node:fs/promises';
/**
 * Attempt to read the content of a spec file from disk.
 * Returns null when specPath is undefined, the file does not exist, or a read
 * error occurs. Callers should substitute a placeholder when null is returned.
 */
export async function readSpecContent(specPath) {
    if (specPath === undefined) {
        return null;
    }
    try {
        if (existsSync(specPath)) {
            return await readFile(specPath, 'utf-8');
        }
    }
    catch {
        // ignore filesystem errors — callers handle null
    }
    return null;
}
//# sourceMappingURL=spec-reader.js.map