mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-29 04:59:51 +00:00
wip: zen
This commit is contained in:
parent
4dc3cb9115
commit
cf069dd046
5 changed files with 105 additions and 15 deletions
20
packages/console/core/script/credit-workspace.ts
Normal file
20
packages/console/core/script/credit-workspace.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { Billing } from "../src/billing.js"
|
||||
|
||||
// get input from command line
|
||||
const workspaceID = process.argv[2]
|
||||
const dollarAmount = process.argv[3]
|
||||
|
||||
if (!workspaceID || !dollarAmount) {
|
||||
console.error("Usage: bun credit-workspace.ts <workspaceID> <dollarAmount>")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const amountInDollars = parseFloat(dollarAmount)
|
||||
if (isNaN(amountInDollars) || amountInDollars <= 0) {
|
||||
console.error("Error: dollarAmount must be a positive number")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
await Billing.grantCredit(workspaceID, amountInDollars)
|
||||
|
||||
console.log(`Added payment of $${amountInDollars.toFixed(2)} to workspace ${workspaceID}`)
|
||||
Loading…
Add table
Add a link
Reference in a new issue