diff options
| author | Frank <[email protected]> | 2026-03-03 00:25:03 -0500 |
|---|---|---|
| committer | Frank <[email protected]> | 2026-03-03 00:25:03 -0500 |
| commit | 6aa4928e9e9430f8d1e9b009fd4a64f400fe0da9 (patch) | |
| tree | d0267534d1bd2e3331fc70ca177be4eef5d85530 /packages/console/core/script/update-limits.ts | |
| parent | 9f150b07764c44ab5265d7cc2a3fa4e5909094b2 (diff) | |
| download | opencode-6aa4928e9e9430f8d1e9b009fd4a64f400fe0da9.tar.gz opencode-6aa4928e9e9430f8d1e9b009fd4a64f400fe0da9.zip | |
wip: zen
Diffstat (limited to 'packages/console/core/script/update-limits.ts')
| -rwxr-xr-x | packages/console/core/script/update-limits.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/packages/console/core/script/update-limits.ts b/packages/console/core/script/update-limits.ts new file mode 100755 index 000000000..8f2579312 --- /dev/null +++ b/packages/console/core/script/update-limits.ts @@ -0,0 +1,28 @@ +#!/usr/bin/env bun + +import { $ } from "bun" +import path from "path" +import os from "os" +import { Subscription } from "../src/subscription" + +const root = path.resolve(process.cwd(), "..", "..", "..") +const secrets = await $`bun sst secret list`.cwd(root).text() + +// read value +const lines = secrets.split("\n") +const oldValue = lines.find((line) => line.startsWith("ZEN_LIMITS"))?.split("=")[1] ?? "{}" +if (!oldValue) throw new Error("ZEN_LIMITS not found") + +// store the prettified json to a temp file +const filename = `limits-${Date.now()}.json` +const tempFile = Bun.file(path.join(os.tmpdir(), filename)) +await tempFile.write(JSON.stringify(JSON.parse(oldValue), null, 2)) +console.log("tempFile", tempFile.name) + +// open temp file in vim and read the file on close +await $`vim ${tempFile.name}` +const newValue = JSON.stringify(JSON.parse(await tempFile.text())) +Subscription.validate(JSON.parse(newValue)) + +// update the secret +await $`bun sst secret set ZEN_LIMITS ${newValue}` |
