opencode/packages/console/core/script/promote-black.ts

23 lines
652 B
TypeScript
Raw Normal View History

2026-01-07 12:34:10 +08:00
#!/usr/bin/env bun
import { $ } from "bun"
import path from "path"
import { BlackData } from "../src/black"
const stage = process.argv[2]
if (!stage) throw new Error("Stage is required")
const root = path.resolve(process.cwd(), "..", "..", "..")
// read the secret
const ret = await $`bun sst secret list`.cwd(root).text()
const lines = ret.split("\n")
2026-01-23 01:40:42 +08:00
const value = lines.find((line) => line.startsWith("ZEN_BLACK_LIMITS"))?.split("=")[1]
if (!value) throw new Error("ZEN_BLACK_LIMITS not found")
2026-01-07 12:34:10 +08:00
// validate value
BlackData.validate(JSON.parse(value))
// update the secret
2026-01-23 01:40:42 +08:00
await $`bun sst secret set ZEN_BLACK_LIMITS ${value} --stage ${stage}`