import { readFile } from "node:fs/promises"; import path from "node:path"; export async function readWorkspaceFile(filePath: string, cwd: string) { const resolved = path.resolve(cwd, filePath); const relative = path.relative(cwd, resolved); if (relative.startsWith("..") || path.isAbsolute(relative)) { throw new Error(`--body-file must stay within the active workspace: ${filePath}`); } return readFile(resolved, "utf8"); }