mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-28 12:39:43 +00:00
Some checks are pending
deploy / deploy (push) Waiting to run
generate / generate (push) Waiting to run
nix-eval / nix-eval (push) Waiting to run
typecheck / typecheck (push) Waiting to run
nix-hashes / compute-hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
nix-hashes / compute-hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
nix-hashes / compute-hash (macos-15-intel, x86_64-darwin) (push) Waiting to run
nix-hashes / compute-hash (macos-latest, aarch64-darwin) (push) Waiting to run
nix-hashes / update-hashes (push) Blocked by required conditions
publish / version (push) Waiting to run
publish / build-cli (push) Blocked by required conditions
publish / sign-cli-windows (push) Blocked by required conditions
publish / build-tauri (map[host:blacksmith-4vcpu-ubuntu-2404 target:x86_64-unknown-linux-gnu]) (push) Blocked by required conditions
publish / build-tauri (map[host:blacksmith-4vcpu-windows-2025 target:x86_64-pc-windows-msvc]) (push) Blocked by required conditions
publish / build-tauri (map[host:blacksmith-8vcpu-ubuntu-2404-arm target:aarch64-unknown-linux-gnu]) (push) Blocked by required conditions
publish / build-tauri (map[host:macos-latest target:aarch64-apple-darwin]) (push) Blocked by required conditions
publish / build-tauri (map[host:macos-latest target:x86_64-apple-darwin]) (push) Blocked by required conditions
publish / build-tauri (map[host:windows-2025 target:aarch64-pc-windows-msvc]) (push) Blocked by required conditions
publish / build-electron (map[host:blacksmith-4vcpu-ubuntu-2404 platform_flag:--linux target:aarch64-unknown-linux-gnu]) (push) Blocked by required conditions
publish / build-electron (map[host:blacksmith-4vcpu-ubuntu-2404 platform_flag:--linux target:x86_64-unknown-linux-gnu]) (push) Blocked by required conditions
publish / build-electron (map[host:blacksmith-4vcpu-windows-2025 platform_flag:--win target:x86_64-pc-windows-msvc]) (push) Blocked by required conditions
publish / build-electron (map[host:macos-latest platform_flag:--mac --arm64 target:aarch64-apple-darwin]) (push) Blocked by required conditions
publish / build-electron (map[host:macos-latest platform_flag:--mac --x64 target:x86_64-apple-darwin]) (push) Blocked by required conditions
publish / build-electron (map[host:windows-2025 platform_flag:--win --arm64 target:aarch64-pc-windows-msvc]) (push) Blocked by required conditions
publish / publish (push) Blocked by required conditions
storybook / storybook build (push) Waiting to run
test / unit (linux) (push) Waiting to run
test / unit (windows) (push) Waiting to run
test / e2e (linux) (push) Waiting to run
test / e2e (windows) (push) Waiting to run
43 lines
1.5 KiB
TypeScript
Executable file
43 lines
1.5 KiB
TypeScript
Executable file
#!/usr/bin/env bun
|
|
|
|
import { $ } from "bun"
|
|
import path from "path"
|
|
import os from "os"
|
|
import { ZenData } from "../src/model"
|
|
|
|
const root = path.resolve(process.cwd(), "..", "..", "..")
|
|
const models = await $`bun sst secret list --stage frank`.cwd(root).text()
|
|
const PARTS = 30
|
|
|
|
// read the line starting with "ZEN_MODELS"
|
|
const lines = models.split("\n")
|
|
const oldValues = Array.from({ length: PARTS }, (_, i) => {
|
|
const value = lines
|
|
.find((line) => line.startsWith(`ZEN_MODELS${i + 1}=`))
|
|
?.split("=")
|
|
.slice(1)
|
|
.join("=")
|
|
if (!value) throw new Error(`ZEN_MODELS${i + 1} not found`)
|
|
return value
|
|
})
|
|
|
|
// store the prettified json to a temp file
|
|
const filename = `models-${Date.now()}.json`
|
|
const tempFile = Bun.file(path.join(os.tmpdir(), filename))
|
|
await tempFile.write(JSON.stringify(JSON.parse(oldValues.join("")), 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()))
|
|
ZenData.validate(JSON.parse(newValue))
|
|
|
|
// update the secret
|
|
const chunk = Math.ceil(newValue.length / PARTS)
|
|
const newValues = Array.from({ length: PARTS }, (_, i) =>
|
|
newValue.slice(chunk * i, i === PARTS - 1 ? undefined : chunk * (i + 1)),
|
|
)
|
|
|
|
const envFile = Bun.file(path.join(os.tmpdir(), `models-${Date.now()}.env`))
|
|
await envFile.write(newValues.map((v, i) => `ZEN_MODELS${i + 1}="${v.replace(/"/g, '\\"')}"`).join("\n"))
|
|
await $`bun sst secret load ${envFile.name} --stage frank`.cwd(root)
|