Skip to content

Commit b9b014c

Browse files
committed
chore(run): guard missing strategy spec path with explicit ENOENT-safe message
1 parent 7ccd579 commit b9b014c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scripts/strategy-run.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env node
2+
import { existsSync } from "node:fs";
23
import { mkdir, readFile, writeFile } from "node:fs/promises";
34
import path from "node:path";
45
import process from "node:process";
@@ -222,7 +223,12 @@ async function main() {
222223
process.exit(1);
223224
}
224225

225-
const spec = await loadJson(path.resolve(String(args.spec)));
226+
const specPath = path.resolve(String(args.spec));
227+
if (!existsSync(specPath)) {
228+
console.error(`spec file not found: ${specPath}`);
229+
process.exit(1);
230+
}
231+
const spec = await loadJson(specPath);
226232
const steps = Array.isArray(spec?.plan?.steps) ? spec.plan.steps : [];
227233
if (steps.length === 0) {
228234
console.error("strategy plan.steps is required");

0 commit comments

Comments
 (0)