15 lines
583 B
TypeScript
15 lines
583 B
TypeScript
// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`.
|
||
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");
|
||
}
|