import assert from "node:assert/strict"; import test from "node:test"; import { mkdtemp, readFile, rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { DEFAULT_CONFIG } from "../src/domain"; import { bootstrapProject } from "../src/persistence"; import { createState } from "../src/state"; import { buildHiveMission } from "../src/studio"; import { writeSwarmDefinition } from "../src/swarm"; test("optional OMP swarm definition creates a fan-out/fan-in DAG", async () => { const parent = await mkdtemp(join(tmpdir(), "pom-swarm-")); try { const state = createState("Swarm Test", parent, DEFAULT_CONFIG, true); await bootstrapProject(state); const mission = buildHiveMission(state, DEFAULT_CONFIG, "stage"); const relative = await writeSwarmDefinition(state, mission, "parallel"); const yaml = await readFile(join(state.projectRoot, relative), "utf8"); assert.match(yaml, /^swarm:/); assert.match(yaml, /mode: parallel/); assert.match(yaml, /reports_to:\n\s+- integrator/); assert.match(yaml, /integrator:/); assert.match(yaml, /waits_for:/); } finally { await rm(parent, { recursive: true, force: true }); } });