import { readFile, writeFile } from "node:fs/promises";
export async function seedQuestion(APP_DIR: string) {
  // Supply identical synthetic question text through the real replay ACP elicitation.
  const fixture = `${APP_DIR}/apps/server/src/orchestration-v2/testkit/fixtures/acp_elicitation/registry_transcript.ndjson`;
  const original = await readFile(fixture, "utf8");
  const records = original.trim().split("\n").map((line) => JSON.parse(line));
  const request = records.find((entry) => entry.label === "elicitation.request");
  request.frame.params.requestedSchema.title = "Preview review";
  const question = request.frame.params.requestedSchema.properties.schema_vs_ui_flexibility;
  question.title = "Review preview";
  question.description = "## Markdown preview\n\nFirst line\nSecond line\n\n- Keep Markdown headings\n- Keep Markdown lists\n\nDoes this preview look correct?";
  question.enum = ["Looks correct", "Needs changes"];
  await writeFile(fixture, records.map((entry) => JSON.stringify(entry)).join("\n") + "\n");
}
