import { readFileSync } from "node:fs";

const layer = process.argv[2];
if (!layer) {
  console.error("A test layer is required.");
  process.exit(2);
}

const manifest = JSON.parse(readFileSync("tasks.manifest.json", "utf8"));
const task = manifest.tasks.find((item) => item.task_id === "TASK-WP0-01");
const applicable = task.layers.includes(layer);

if (applicable) {
  console.error(`TASK-WP0-01 assigns ${layer}; a real layer runner is required.`);
  process.exit(1);
}

console.log(
  JSON.stringify({
    layer,
    status: "not_applicable",
    task_id: task.task_id,
  }),
);
