@vibiz/cli 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/vibiz.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  formatUsd,
12
12
  mergeEnvFile,
13
13
  oneKeyMessage
14
- } from "./chunk-RH4VCBQY.js";
14
+ } from "./chunk-UN6FFY7S.js";
15
15
 
16
16
  // packages/cli/src/main.ts
17
17
  import { spawn } from "node:child_process";
@@ -972,6 +972,84 @@ var ONE_KEY_PATHS = ` Then the app loads the rest at start:
972
972
  https://app.vibiz.app/v1/app/env?format=shell)" && exec <your server>
973
973
  CI / build step npx @vibiz/cli env pull --format dotenv -o .env.production`;
974
974
 
975
+ // packages/cli/src/dns-records.ts
976
+ var DNS_RECORDS_USAGE = [
977
+ "usage: vibiz domains records <domain> [--json]",
978
+ " vibiz domains records add <domain> <TYPE> <name> <value> [--ttl n] [--priority n]",
979
+ " vibiz domains records remove <domain> <id> [--force]"
980
+ ].join("\n");
981
+ var MANAGED_LABEL = {
982
+ hosting: "managed by Vibiz: hosting",
983
+ email: "managed by Vibiz: email",
984
+ default: "managed by Vibiz: DNS default"
985
+ };
986
+ function recordLine(r) {
987
+ const value = r.type === "TXT" ? JSON.stringify(r.value) : r.value;
988
+ return [
989
+ `${r.type.padEnd(6)}${(r.name || "@").padEnd(26)}${value}${r.priority !== null ? ` (priority ${r.priority})` : ""}`,
990
+ r.ttl !== null ? `ttl ${r.ttl}` : null,
991
+ r.managed_by ? MANAGED_LABEL[r.managed_by] : "yours",
992
+ `id ${r.id}`
993
+ ].filter(Boolean).join(" \xB7 ");
994
+ }
995
+ var whole = (flag, v, example) => {
996
+ if (v === void 0) return void 0;
997
+ if (!/^\d+$/.test(v.trim())) {
998
+ throw new Error(`--${flag} is a whole number, like --${flag} ${example}. "${v}" is not.`);
999
+ }
1000
+ return Number(v);
1001
+ };
1002
+ async function dnsRecordsCommand(io, vibiz2, flags, args) {
1003
+ const json = (v) => io.log(JSON.stringify(v, null, 2));
1004
+ const records = vibiz2.domains.records;
1005
+ const [first, domain, ...rest] = args;
1006
+ if (first === "add") {
1007
+ const [type, name, value, extra] = rest;
1008
+ if (!domain || !type || name === void 0 || value === void 0 || extra !== void 0) {
1009
+ throw new Error(
1010
+ `${DNS_RECORDS_USAGE}
1011
+ Quote the value, and use @ (or "") as the name for the domain itself: vibiz domains records add example.com TXT @ "v=spf1 -all"`
1012
+ );
1013
+ }
1014
+ const ttl = whole("ttl", flags.ttl, "3600");
1015
+ const priority = whole("priority", flags.priority, "10");
1016
+ const input = {
1017
+ type: type.toUpperCase(),
1018
+ name,
1019
+ value,
1020
+ ...ttl !== void 0 ? { ttl } : {},
1021
+ ...priority !== void 0 ? { priority } : {}
1022
+ };
1023
+ const out = await records.add(domain, input);
1024
+ if (flags.json) return json(out);
1025
+ io.log(`${out.created ? "Added" : "Already there"}: ${out.fqdn}`);
1026
+ io.log(` ${recordLine(out)}`);
1027
+ io.log(`check: dig +short ${out.type} ${out.fqdn}`);
1028
+ io.log(" New records usually answer within a minute or two.");
1029
+ return;
1030
+ }
1031
+ if (first === "remove" || first === "rm") {
1032
+ const [id, extra] = rest;
1033
+ if (!domain || !id || extra !== void 0) throw new Error(DNS_RECORDS_USAGE);
1034
+ const out = await records.remove(domain, id, { force: !!flags.force });
1035
+ if (flags.json) return json(out);
1036
+ io.log(`Removed ${out.type} ${out.fqdn}: ${out.value}`);
1037
+ return;
1038
+ }
1039
+ if (!first || domain !== void 0 || first.startsWith("-")) throw new Error(DNS_RECORDS_USAGE);
1040
+ const list2 = await records.list(first);
1041
+ if (flags.json) return json(list2);
1042
+ io.log(`${list2.domain}: ${list2.data.length} DNS record${list2.data.length === 1 ? "" : "s"}`);
1043
+ for (const r of list2.data) io.log(` ${recordLine(r)}`);
1044
+ io.log(`Add one: vibiz domains records add ${list2.domain} <TYPE> <name> <value>`);
1045
+ if (list2.data.some((r) => r.managed)) {
1046
+ io.log(
1047
+ "Leave the managed ones: Vibiz keeps them for hosting, email and HTTPS (removing one needs --force)."
1048
+ );
1049
+ }
1050
+ io.log(`In the console: ${list2.console_url}`);
1051
+ }
1052
+
975
1053
  // packages/cli/src/email-marketing.ts
976
1054
  var EMAIL_MARKETING_SUBCOMMANDS = [
977
1055
  "contacts",
@@ -3184,6 +3262,14 @@ var HELP = `vibiz \u2014 website, database and sign-in for a new business, in on
3184
3262
  move a bought name to another project (full-access keys)
3185
3263
  vibiz domains point <name> <host or IP|none>
3186
3264
  a bought name used by an app elsewhere: we point it there
3265
+ vibiz domains records <domain> [--json] a bought domain's DNS records; the ones Vibiz keeps
3266
+ (hosting, email, DNS defaults) are marked managed
3267
+ vibiz domains records add <domain> <TYPE> <name> <value> [--ttl n] [--priority n]
3268
+ add a record (A, AAAA, CNAME, MX, TXT, CAA; name @ for
3269
+ the domain itself), e.g. a TXT another service asks
3270
+ for to verify the domain (full-access keys)
3271
+ vibiz domains records remove <domain> <id> [--force]
3272
+ remove one; a managed one needs --force (full-access keys)
3187
3273
  vibiz domains renew <domain> [--years 1] renew now from credits (full-access keys)
3188
3274
  vibiz domains auto-renew <domain> on|off renew from credits 30 days before expiry (default on)
3189
3275
  vibiz domains transfer-code <domain> the code to move it to another registrar (full-access keys)
@@ -3463,6 +3549,8 @@ var HELP = `vibiz \u2014 website, database and sign-in for a new business, in on
3463
3549
  (anthropic/claude-sonnet-5.5): app.vibiz.app/docs/ai
3464
3550
  vibiz ai models [search\u2026] [--all] [--json] the Vibiz models and the model each runs, with prices;
3465
3551
  --all (or a search) lists every model you can call
3552
+ vibiz ai budget [<dollars>] [--project id | --all] a project's daily AI budget: show it, or set it
3553
+ (--all: every project with AI). Full-access key to change.
3466
3554
  vibiz ai keys [set|test|remove google] [--project id]
3467
3555
  your own Google key: calls it serves run only on it
3468
3556
  and cost 0 here. set reads GEMINI_API_KEY or a hidden
@@ -3487,6 +3575,8 @@ var HELP = `vibiz \u2014 website, database and sign-in for a new business, in on
3487
3575
  vibiz billing [--json] the account's credits: balance, card, auto-recharge
3488
3576
  vibiz billing top-up <dollars> [--open] a payment link to add credits (a person pays there)
3489
3577
  vibiz billing history [--kind usage,topup] what came in and what used it
3578
+ vibiz billing limit [<dollars>] the account's daily spend limit (all projects, AI and
3579
+ web data): show it, or raise it. Full-access key to change.
3490
3580
  vibiz billing auto-recharge on|off [--threshold 5] [--amount 25] (full-access key)
3491
3581
  vibiz metrics [--period 7d] [--json] request counts, error rate and latency by capability
3492
3582
  vibiz keys [create <name> [--limited] | access <id> full|limited | revoke <id>]
@@ -4571,6 +4661,8 @@ async function runCli(argv2, io) {
4571
4661
  "no-browser": { type: "boolean", default: false },
4572
4662
  elsewhere: { type: "boolean", default: false },
4573
4663
  "points-to": { type: "string" },
4664
+ ttl: { type: "string" },
4665
+ priority: { type: "string" },
4574
4666
  "replace-mx": { type: "boolean", default: false },
4575
4667
  say: { type: "string" },
4576
4668
  prompt: { type: "string" },
@@ -5775,6 +5867,10 @@ ${link.url}`
5775
5867
  case "domains": {
5776
5868
  const vibiz2 = await io.client();
5777
5869
  const [sub, arg, third] = positionals;
5870
+ if (sub === "records") {
5871
+ await dnsRecordsCommand(io, vibiz2, values, positionals.slice(1));
5872
+ return;
5873
+ }
5778
5874
  if (sub && BUY_DOMAIN_COMMANDS.has(sub)) {
5779
5875
  await buyDomainsCommand(io, vibiz2, values, sub, arg, third);
5780
5876
  return;
@@ -5802,7 +5898,7 @@ ${link.url}`
5802
5898
  }
5803
5899
  if (sub)
5804
5900
  throw new Error(
5805
- "usage: vibiz domains [add | verify | remove | search | buy | owned | use | move | point | renew | auto-renew | transfer-code | owner]"
5901
+ "usage: vibiz domains [add | verify | remove | search | buy | owned | use | move | point | records | renew | auto-renew | transfer-code | owner]"
5806
5902
  );
5807
5903
  print(await d.list(id));
5808
5904
  return;
@@ -6242,6 +6338,10 @@ ${await oneKeyLines(vibiz2, id)}`);
6242
6338
  return;
6243
6339
  }
6244
6340
  case "ai": {
6341
+ if (positionals[0] === "budget") {
6342
+ await aiBudgetCommand(io, positionals.slice(1), values);
6343
+ return;
6344
+ }
6245
6345
  if (positionals[0] === "keys") {
6246
6346
  await aiKeysCommand(io, positionals.slice(1), values);
6247
6347
  return;
@@ -6509,6 +6609,26 @@ The credits show in \`vibiz billing\` a few seconds after paying.`
6509
6609
  );
6510
6610
  return;
6511
6611
  }
6612
+ if (sub === "limit") {
6613
+ if (arg === void 0) {
6614
+ const b2 = await vibiz2.billing.get();
6615
+ io.log(
6616
+ values.json ? JSON.stringify({ daily_spend_limit_usd: b2.daily_spend_limit_usd }, null, 2) : `Daily spend limit: $${b2.daily_spend_limit_usd} a day (UTC). Raise it: vibiz billing limit <dollars>`
6617
+ );
6618
+ return;
6619
+ }
6620
+ const usdLimit = Number(arg.replace(/^\$/, ""));
6621
+ if (!Number.isFinite(usdLimit) || usdLimit <= 0) {
6622
+ throw new Error(
6623
+ "usage: vibiz billing limit <dollars a day>, e.g. vibiz billing limit 50"
6624
+ );
6625
+ }
6626
+ const b = await vibiz2.billing.update({ daily_spend_limit_usd: usdLimit });
6627
+ io.log(
6628
+ values.json ? JSON.stringify(b, null, 2) : `Daily spend limit: $${b.daily_spend_limit_usd} a day. It applies at once; the day resets at 00:00 UTC.`
6629
+ );
6630
+ return;
6631
+ }
6512
6632
  if (sub === "auto-recharge") {
6513
6633
  if (arg !== "on" && arg !== "off") {
6514
6634
  throw new Error(
@@ -6585,7 +6705,7 @@ Store the key now: it is not shown again.`
6585
6705
  return;
6586
6706
  }
6587
6707
  case "docs": {
6588
- const { DOC_TOPICS, DOCS } = await import("./src-KEH4ULRK.js");
6708
+ const { DOC_TOPICS, DOCS } = await import("./src-47ADQ5ZZ.js");
6589
6709
  const topic = positionals[0];
6590
6710
  if (!topic || !DOC_TOPICS.includes(topic)) {
6591
6711
  for (const t of DOC_TOPICS) io.log(` vibiz docs ${t.padEnd(13)} ${DOCS[t].title}`);
@@ -6610,7 +6730,7 @@ ${DOCS[topic].body}`);
6610
6730
  if (positionals[0])
6611
6731
  throw new Error('usage: vibiz mcp (serve over stdio) | vibiz mcp add --clients "<client>"');
6612
6732
  io.local();
6613
- const { serveStdio } = await import("./src-KEH4ULRK.js");
6733
+ const { serveStdio } = await import("./src-47ADQ5ZZ.js");
6614
6734
  await serveStdio({ version: cliVersion() });
6615
6735
  return;
6616
6736
  }
@@ -6647,6 +6767,42 @@ function cliErrorLines(err) {
6647
6767
  }
6648
6768
  return [`\u2715 ${err instanceof Error ? err.message : String(err)}`];
6649
6769
  }
6770
+ async function aiBudgetCommand(io, args, values) {
6771
+ const vibiz2 = await io.client();
6772
+ const [raw] = args;
6773
+ const amount = raw === void 0 ? void 0 : Number(raw.replace(/^\$/, ""));
6774
+ if (amount !== void 0 && (!Number.isFinite(amount) || amount < 0)) {
6775
+ throw new Error(
6776
+ "usage: vibiz ai budget [<dollars a day>] [--project id | --all], e.g. vibiz ai budget 5 --all"
6777
+ );
6778
+ }
6779
+ const ids = values.all ? (await vibiz2.projects.list()).map((p) => ({ id: p.id, name: p.name })) : [{ id: values.project ?? await io.project(), name: "" }];
6780
+ const rows = [];
6781
+ for (const p of ids) {
6782
+ try {
6783
+ const r = amount === void 0 ? await vibiz2.projectAi.get(p.id) : await vibiz2.projectAi.update(p.id, { daily_budget_usd: amount });
6784
+ rows.push({
6785
+ project: p.name || p.id,
6786
+ daily_budget_usd: r.settings.daily_budget_usd,
6787
+ spent_today_usd: r.spent_today_usd
6788
+ });
6789
+ } catch (e) {
6790
+ if (values.all) continue;
6791
+ throw e;
6792
+ }
6793
+ }
6794
+ if (values.json) {
6795
+ io.log(JSON.stringify(rows, null, 2));
6796
+ return;
6797
+ }
6798
+ for (const r of rows) {
6799
+ const budget = r.daily_budget_usd === null ? "no budget" : `$${r.daily_budget_usd}/day`;
6800
+ io.log(`${r.project} ${budget} \xB7 spent today $${r.spent_today_usd.toFixed(2)}`);
6801
+ }
6802
+ if (!rows.length) io.log("No project with AI here. Add it with: vibiz add ai");
6803
+ else if (amount !== void 0) io.log("Set. It applies at once; the day resets at 00:00 UTC.");
6804
+ else io.log("Change it: vibiz ai budget <dollars> (--all for every project with AI)");
6805
+ }
6650
6806
  function modelLine(m) {
6651
6807
  const runs = m.model ? `${m.model.name} (${m.model.maker})` : `${m.name} (${m.maker ?? ""})`;
6652
6808
  const p = m.pricing ?? {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibiz/cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "The Vibiz Stack CLI and MCP server: website, database, sign-in, email and AI for a new business, from your terminal or your AI agent.",
5
5
  "keywords": [
6
6
  "vibiz",