{"version":3,"file":"seed.cjs","names":["p","colors","icons"],"sources":["../../../src/cli/commands/seed.ts"],"sourcesContent":["import * as p from \"@clack/prompts\";\nimport type { SeedResult } from \"../../contract\";\nimport { colors, icons } from \"../../utils/theme\";\nimport type { CommandContext, ResultRenderer } from \"./context\";\n\n/**\n * Production seeding is explicit (#865): `bos seed --env production` must be\n * confirmed, and the owner bootstrap demands env-provided credentials\n * (enforced in the handler) — never config defaults, never boot side effects.\n * Non-interactive stdin cannot confirm, so it must say so with `--yes`\n * explicitly rather than hanging on a prompt nobody can answer.\n */\nexport const seedPreCall = async (ctx: CommandContext): Promise<void> => {\n  const input = ctx.input as { env?: string; yes?: boolean; [key: string]: unknown };\n  if (input.env !== \"production\" || input.yes === true) return;\n  if (process.stdin.isTTY !== true) {\n    console.error(\n      \"bos seed --env production writes production data — non-interactive environments must pass --yes to confirm\",\n    );\n    process.exit(1);\n  }\n  console.log();\n  const confirmed = await p.confirm({\n    message: \"Seed the production databases? This writes data outside the deploy train.\",\n    initialValue: false,\n  });\n  if (p.isCancel(confirmed) || confirmed !== true) {\n    console.log(colors.dim(\"Aborted — nothing was written.\"));\n    process.exit(1);\n  }\n  input.yes = true;\n};\n\nexport const seedRenderers: Record<string, ResultRenderer> = {\n  seed: async (result, _ctx) => {\n    const r = result as SeedResult;\n    console.log();\n    if (r.status === \"error\") {\n      console.error(colors.error(`${icons.err} ${r.error ?? \"bos seed failed\"}`));\n      return;\n    }\n    if (r.status === \"skipped\") {\n      console.log(`  ${colors.dim(icons.ok)} skipped — ${r.error ?? \"nothing to seed\"}`);\n      return;\n    }\n    const verb = r.status === \"already-seeded\" ? \"already seeded\" : \"seeded\";\n    console.log(`  ${colors.green(icons.ok)} ${verb} (version ${r.version}) [${r.env}]`);\n    if (r.workspaces?.length) {\n      console.log(colors.dim(`  schemas ensured: ${r.workspaces.join(\", \")}`));\n    }\n    if (r.owner) {\n      console.log(\n        `  ${colors.green(icons.ok)} owner admin (${r.owner.mode}) → ${r.owner.accountId}`,\n      );\n    }\n    for (const step of r.steps ?? []) {\n      console.log(`  ${colors.green(icons.ok)} step ${step.step}`);\n    }\n    if (r.status === \"already-seeded\") {\n      console.log(colors.dim(\"  bump seed.version (or pass --force) to re-run\"));\n    }\n    console.log();\n  },\n};\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,cAAc,OAAO,QAAuC;CACvE,MAAM,QAAQ,IAAI;CAClB,IAAI,MAAM,QAAQ,gBAAgB,MAAM,QAAQ,MAAM;CACtD,IAAI,QAAQ,MAAM,UAAU,MAAM;EAChC,QAAQ,MACN,4GACF;EACA,QAAQ,KAAK,CAAC;CAChB;CACA,QAAQ,IAAI;CACZ,MAAM,YAAY,MAAMA,eAAE,QAAQ;EAChC,SAAS;EACT,cAAc;CAChB,CAAC;CACD,IAAIA,eAAE,SAAS,SAAS,KAAK,cAAc,MAAM;EAC/C,QAAQ,IAAIC,qBAAO,IAAI,gCAAgC,CAAC;EACxD,QAAQ,KAAK,CAAC;CAChB;CACA,MAAM,MAAM;AACd;AAEA,MAAa,gBAAgD,EAC3D,MAAM,OAAO,QAAQ,SAAS;CAC5B,MAAM,IAAI;CACV,QAAQ,IAAI;CACZ,IAAI,EAAE,WAAW,SAAS;EACxB,QAAQ,MAAMA,qBAAO,MAAM,GAAGC,oBAAM,IAAI,GAAG,EAAE,SAAS,mBAAmB,CAAC;EAC1E;CACF;CACA,IAAI,EAAE,WAAW,WAAW;EAC1B,QAAQ,IAAI,KAAKD,qBAAO,IAAIC,oBAAM,EAAE,EAAE,aAAa,EAAE,SAAS,mBAAmB;EACjF;CACF;CACA,MAAM,OAAO,EAAE,WAAW,mBAAmB,mBAAmB;CAChE,QAAQ,IAAI,KAAKD,qBAAO,MAAMC,oBAAM,EAAE,EAAE,GAAG,KAAK,YAAY,EAAE,QAAQ,KAAK,EAAE,IAAI,EAAE;CACnF,IAAI,EAAE,YAAY,QAChB,QAAQ,IAAID,qBAAO,IAAI,sBAAsB,EAAE,WAAW,KAAK,IA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