@vibiz/cli 0.3.9 → 0.3.12

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-P5FM76IE.js";
14
+ } from "./chunk-NNIG26UF.js";
15
15
 
16
16
  // packages/cli/src/main.ts
17
17
  import { spawn } from "node:child_process";
@@ -3427,6 +3427,8 @@ var HELP = `vibiz \u2014 website, database and sign-in for a new business, in on
3427
3427
  to Request indexing for the ones not indexed
3428
3428
  vibiz search sync set up and read Google and Bing now (daily otherwise)
3429
3429
  vibiz search connections the account's Google and Bing accounts
3430
+ vibiz search push on|off push pages Google hasn't crawled to its Indexing API
3431
+ (owner, off by default, 200 a day per Google Cloud project)
3430
3432
  vibiz search connect google --key <file.json> [--owner-email <email>]
3431
3433
  add a Google key file (service account): every
3432
3434
  project goes into Search Console, no sign-in
@@ -3573,11 +3575,12 @@ var HELP = `vibiz \u2014 website, database and sign-in for a new business, in on
3573
3575
  --all (or a search) lists every model you can call
3574
3576
  vibiz ai budget [<dollars>] [--project id | --all] a project's daily AI budget: show it, or set it
3575
3577
  (--all: every project with AI). Full-access key to change.
3576
- vibiz ai keys [set|test|remove google] [--project id]
3577
- your own Google key: calls it serves run only on it
3578
- and cost 0 here. set reads GEMINI_API_KEY or a hidden
3579
- prompt; --vertex sa.json [--gcp-project p] [--region r]
3580
- for Vertex AI (Google Cloud credits)
3578
+ vibiz ai keys [add|set|test|remove google|fal] [--project id]
3579
+ your own Google or fal key: calls it serves run only on
3580
+ it and cost 0 here. add reads GEMINI_API_KEY / FAL_KEY,
3581
+ --key-file path, or a hidden prompt; --vertex sa.json
3582
+ [--gcp-project p] [--region r] for Vertex AI. A fal key
3583
+ also runs any fal endpoint as fal/<endpoint id>
3581
3584
  vibiz files [--since 4h] [--until \u2026] [--type image|video|audio|other] [--source upload|ai]
3582
3585
  [--model m] [--tag t] [--limit n] [--dev] [--json]
3583
3586
  the project's Files: every image, video and audio the AI
@@ -3601,7 +3604,7 @@ var HELP = `vibiz \u2014 website, database and sign-in for a new business, in on
3601
3604
  web data): show it, or raise it. Full-access key to change.
3602
3605
  vibiz billing auto-recharge on|off [--threshold 5] [--amount 25] (full-access key)
3603
3606
  vibiz metrics [--period 7d] [--json] request counts, error rate and latency by capability
3604
- vibiz keys [create <name> [--limited] | access <id> full|limited | revoke <id>]
3607
+ vibiz keys [create <name> [--limited|--read-all] | access [<id> full|read|limited | <id> allow <permission>] | permissions | revoke <id>]
3605
3608
  named API keys, one per person or agent: full
3606
3609
  access by default; Limited ones never move live
3607
3610
  money or read production secrets
@@ -3752,7 +3755,7 @@ function printDomains(io, list2, only) {
3752
3755
  io.log(` ${x.next_step}`);
3753
3756
  }
3754
3757
  }
3755
- var accessLabel = (access) => access === "agent" ? "Limited access" : "full access";
3758
+ var accessLabel = (access, preset, grants) => access !== "agent" ? "full access" : preset === "read_all" ? "Read everything" : grants?.length ? `Limited + ${grants.length} permission${grants.length === 1 ? "" : "s"}` : "Limited access";
3756
3759
  var BUY_DOMAIN_COMMANDS = /* @__PURE__ */ new Set([
3757
3760
  "search",
3758
3761
  "buy",
@@ -4726,6 +4729,7 @@ async function runCli(argv2, io) {
4726
4729
  grace: { type: "string" },
4727
4730
  owner: { type: "boolean", default: false },
4728
4731
  limited: { type: "boolean", default: false },
4732
+ "read-all": { type: "boolean", default: false },
4729
4733
  own: { type: "boolean", default: false },
4730
4734
  "client-id": { type: "string" },
4731
4735
  file: { type: "string" },
@@ -4757,6 +4761,7 @@ async function runCli(argv2, io) {
4757
4761
  region: { type: "string" },
4758
4762
  "gcp-project": { type: "string" },
4759
4763
  "use-for": { type: "string" },
4764
+ "key-file": { type: "string" },
4760
4765
  ads: { type: "boolean", default: false },
4761
4766
  media: { type: "string", multiple: true },
4762
4767
  at: { type: "string" },
@@ -6774,23 +6779,52 @@ The credits show in \`vibiz billing\` a few seconds after paying.`
6774
6779
  const vibiz2 = await io.client();
6775
6780
  const [sub, arg] = positionals;
6776
6781
  if (sub === "create") {
6777
- if (!arg) throw new Error("usage: vibiz keys create <name> [--limited]");
6778
- const key = await vibiz2.apiKeys.create(arg, { access: values.limited ? "agent" : "owner" });
6782
+ if (!arg) throw new Error("usage: vibiz keys create <name> [--limited|--read-all]");
6783
+ const key = await vibiz2.apiKeys.create(arg, {
6784
+ preset: values["read-all"] ? "read_all" : values.limited ? "limited" : "full"
6785
+ });
6779
6786
  io.log(
6780
- `${key.name} ${key.id} ${accessLabel(key.access)}
6787
+ `${key.name} ${key.id} ${accessLabel(key.access, key.preset, key.grants)}
6781
6788
  ${key.secret}
6782
6789
 
6783
6790
  Store the key now: it is not shown again.`
6784
6791
  );
6785
6792
  return;
6786
6793
  }
6794
+ if (sub === "permissions") {
6795
+ for (const p of await vibiz2.apiKeys.permissions()) {
6796
+ io.log(`${p.id.padEnd(28)} ${p.label}`);
6797
+ }
6798
+ return;
6799
+ }
6787
6800
  if (sub === "access") {
6788
6801
  const level = positionals[2];
6789
- if (!arg || level !== "full" && level !== "limited") {
6790
- throw new Error("usage: vibiz keys access <key id> full|limited");
6802
+ if (!arg) {
6803
+ const me = await vibiz2.whoami();
6804
+ io.log(
6805
+ `${me.key.name} (${me.key.id}): ${accessLabel(me.key.access, me.key.preset, me.key.grants)}`
6806
+ );
6807
+ for (const g of me.key.grants ?? []) io.log(` ${g}`);
6808
+ if (me.access_url) io.log(`Change it in the console: ${me.access_url}`);
6809
+ return;
6810
+ }
6811
+ if (level === "allow") {
6812
+ const perm = positionals[3];
6813
+ if (!perm) throw new Error("usage: vibiz keys access <key id> allow <permission>");
6814
+ const key = (await vibiz2.apiKeys.list()).find((k3) => k3.id === arg);
6815
+ if (!key) throw new Error(`No key ${arg} on this account (vibiz keys lists them).`);
6816
+ const k2 = await vibiz2.apiKeys.setGrants(arg, [.../* @__PURE__ */ new Set([...key.grants ?? [], perm])]);
6817
+ io.log(`${k2.name} (${k2.id}) now has ${accessLabel(k2.access, k2.preset, k2.grants)}.`);
6818
+ return;
6791
6819
  }
6792
- const k = await vibiz2.apiKeys.setAccess(arg, level === "full" ? "owner" : "agent");
6793
- io.log(`${k.name} (${k.id}) now has ${accessLabel(k.access)}.`);
6820
+ const preset = level === "full" ? "full" : level === "read" ? "read_all" : level === "limited" ? "limited" : null;
6821
+ if (!preset) {
6822
+ throw new Error(
6823
+ "usage: vibiz keys access [<key id> full|read|limited | <key id> allow <permission>]"
6824
+ );
6825
+ }
6826
+ const k = await vibiz2.apiKeys.setPreset(arg, preset);
6827
+ io.log(`${k.name} (${k.id}) now has ${accessLabel(k.access, k.preset, k.grants)}.`);
6794
6828
  return;
6795
6829
  }
6796
6830
  if (sub === "revoke") {
@@ -6801,7 +6835,7 @@ Store the key now: it is not shown again.`
6801
6835
  }
6802
6836
  for (const k of await vibiz2.apiKeys.list()) {
6803
6837
  io.log(
6804
- `${k.id} ${k.name.padEnd(20)} ${k.prefix}\u2026 ${accessLabel(k.access).padEnd(14)} ${k.revoked_at ? "revoked" : "active"}`
6838
+ `${k.id} ${k.name.padEnd(20)} ${k.prefix}\u2026 ${accessLabel(k.access, k.preset, k.grants).padEnd(22)} ${k.revoked_at ? "revoked" : "active"}`
6805
6839
  );
6806
6840
  }
6807
6841
  return;
@@ -6821,7 +6855,7 @@ Store the key now: it is not shown again.`
6821
6855
  return;
6822
6856
  }
6823
6857
  case "docs": {
6824
- const { DOC_TOPICS, DOCS } = await import("./src-NZUCICOH.js");
6858
+ const { DOC_TOPICS, DOCS } = await import("./src-BDMYQOXL.js");
6825
6859
  const topic = positionals[0];
6826
6860
  if (!topic || !DOC_TOPICS.includes(topic)) {
6827
6861
  for (const t of DOC_TOPICS) io.log(` vibiz docs ${t.padEnd(13)} ${DOCS[t].title}`);
@@ -6846,7 +6880,7 @@ ${DOCS[topic].body}`);
6846
6880
  if (positionals[0])
6847
6881
  throw new Error('usage: vibiz mcp (serve over stdio) | vibiz mcp add --clients "<client>"');
6848
6882
  io.local();
6849
- const { serveStdio } = await import("./src-NZUCICOH.js");
6883
+ const { serveStdio } = await import("./src-BDMYQOXL.js");
6850
6884
  await serveStdio({ version: cliVersion() });
6851
6885
  return;
6852
6886
  }
@@ -6877,6 +6911,11 @@ function cliErrorLines(err) {
6877
6911
  out.push(` field: ${d.field}`);
6878
6912
  }
6879
6913
  if (d?.approval_id) out.push(` approval_id: ${d.approval_id}`);
6914
+ if (err.grantUrl) {
6915
+ out.push(` Allow it for this key: ${err.grantUrl}`);
6916
+ if (d?.console_url) out.push(` Or do it yourself in the console: ${d.console_url}`);
6917
+ return out;
6918
+ }
6880
6919
  if (d?.next_step) out.push(` ${d.next_step}`);
6881
6920
  if (d?.console_url && !d.next_step?.includes(d.console_url)) out.push(` ${d.console_url}`);
6882
6921
  return out;
@@ -6927,8 +6966,28 @@ function modelLine(m) {
6927
6966
  }
6928
6967
  async function aiKeysCommand(io, args, values) {
6929
6968
  const vibiz2 = await io.client();
6930
- const [sub = "list", provider = "google"] = args;
6931
- if (provider !== "google") throw new Error("Supported provider: google");
6969
+ const [rawSub = "list", rawProvider = "google"] = args;
6970
+ const sub = rawSub === "add" ? "set" : rawSub;
6971
+ if (rawProvider !== "google" && rawProvider !== "fal") {
6972
+ throw new Error('Supported providers: "google", "fal" (vibiz ai keys add fal)');
6973
+ }
6974
+ const provider = rawProvider;
6975
+ const readKey = async (envNames, what) => {
6976
+ if (values["key-file"]) {
6977
+ const text = (await io.local().readFile(values["key-file"])).toString();
6978
+ return text.split(/\r?\n/)[0]?.trim() ?? "";
6979
+ }
6980
+ for (const n of envNames) if (io.env[n]) return io.env[n];
6981
+ const typed = await io.promptHidden(`${what} (hidden): `);
6982
+ if (!typed)
6983
+ throw secretNeeded(io, what, envNames[0], [
6984
+ "ai",
6985
+ "keys",
6986
+ ...args,
6987
+ ...values.project ? ["--project", values.project] : []
6988
+ ]);
6989
+ return typed;
6990
+ };
6932
6991
  const scope = values.project ? { projectId: values.project } : {};
6933
6992
  const show = (k) => {
6934
6993
  if (values.json) return io.log(JSON.stringify(k, null, 2));
@@ -6939,7 +6998,7 @@ async function aiKeysCommand(io, args, values) {
6939
6998
  );
6940
6999
  return;
6941
7000
  }
6942
- const kind = k.type === "vertex" ? `Vertex AI ${k.vertex?.project_id} ${k.vertex?.region}` : "API key";
7001
+ const kind = k.type === "vertex" ? `Vertex AI ${k.vertex?.project_id} ${k.vertex?.region}` : k.type === "fal_key" ? "fal key" : "API key";
6943
7002
  io.log(
6944
7003
  `${dot(k.last_error ? "failed" : "ready")} ${k.provider} (${where}): ${kind} \u2026${k.last4}`
6945
7004
  );
@@ -6964,6 +7023,17 @@ async function aiKeysCommand(io, args, values) {
6964
7023
  return;
6965
7024
  }
6966
7025
  case "set": {
7026
+ if (provider === "fal") {
7027
+ const key2 = await readKey(["FAL_KEY"], "The fal key (from fal.ai/dashboard/keys)");
7028
+ show(
7029
+ await vibiz2.aiKeys.set(
7030
+ provider,
7031
+ { type: "fal_key", api_key: key2.trim(), ...useFor ? { use_for: useFor } : {} },
7032
+ scope
7033
+ )
7034
+ );
7035
+ return;
7036
+ }
6967
7037
  if (values.vertex) {
6968
7038
  const file = (await io.local().readFile(values.vertex)).toString();
6969
7039
  show(
@@ -6981,14 +7051,7 @@ async function aiKeysCommand(io, args, values) {
6981
7051
  );
6982
7052
  return;
6983
7053
  }
6984
- const key = io.env.GEMINI_API_KEY || io.env.GOOGLE_API_KEY || await io.promptHidden("API key (hidden): ");
6985
- if (!key)
6986
- throw secretNeeded(io, "The Gemini API key", "GEMINI_API_KEY", [
6987
- "ai",
6988
- "keys",
6989
- ...args,
6990
- ...values.project ? ["--project", values.project] : []
6991
- ]);
7054
+ const key = await readKey(["GEMINI_API_KEY", "GOOGLE_API_KEY"], "The Gemini API key");
6992
7055
  show(
6993
7056
  await vibiz2.aiKeys.set(
6994
7057
  provider,
@@ -7010,7 +7073,9 @@ async function aiKeysCommand(io, args, values) {
7010
7073
  return;
7011
7074
  }
7012
7075
  default:
7013
- throw new Error("usage: vibiz ai keys [list | set | test | remove] [google] [--project id]");
7076
+ throw new Error(
7077
+ "usage: vibiz ai keys [list | add | test | remove] [google | fal] [--project id] [--key-file path]"
7078
+ );
7014
7079
  }
7015
7080
  }
7016
7081
  var SITE_SEARCH_WORDS = /* @__PURE__ */ new Set([
@@ -7019,7 +7084,8 @@ var SITE_SEARCH_WORDS = /* @__PURE__ */ new Set([
7019
7084
  "pages",
7020
7085
  "sync",
7021
7086
  "connect",
7022
- "connections"
7087
+ "connections",
7088
+ "push"
7023
7089
  ]);
7024
7090
  async function siteSearchCommand(io, positionals, values) {
7025
7091
  const vibiz2 = await io.client();
@@ -7038,6 +7104,16 @@ async function siteSearchCommand(io, positionals, values) {
7038
7104
  if (out2.console_url) io.log(`Manage: ${out2.console_url}`);
7039
7105
  return;
7040
7106
  }
7107
+ if (sub === "push") {
7108
+ if (arg !== "on" && arg !== "off") throw new Error("usage: vibiz search push on|off");
7109
+ const out2 = await vibiz2.search.setGooglePush(arg === "on");
7110
+ if (values.json) return print(out2);
7111
+ io.log(
7112
+ arg === "on" ? "Pushing pages to Google is on: up to 200 pages a day Google hasn't crawled yet, across your sites. Google says its Indexing API is meant for job-posting and livestream pages and may ignore other pages." : "Pushing pages to Google is off."
7113
+ );
7114
+ for (const c of out2.data) if (c.push?.note) io.log(`Note: ${c.push.note}`);
7115
+ return;
7116
+ }
7041
7117
  if (sub === "connect") {
7042
7118
  if (arg !== "google") {
7043
7119
  throw new Error(
@@ -7093,7 +7169,7 @@ async function siteSearchCommand(io, positionals, values) {
7093
7169
  out = await vibiz2.search.update(id, { submit_free_address: arg === "on" });
7094
7170
  else
7095
7171
  throw new Error(
7096
- "usage: vibiz search [submit | sync | pages [--not-indexed] | free-address on|off | connections | connect google] [--json]"
7172
+ "usage: vibiz search [submit | sync | pages [--not-indexed] | free-address on|off | push on|off | connections | connect google] [--json]"
7097
7173
  );
7098
7174
  if (values.json) return print(out);
7099
7175
  const s = out.indexnow;
@@ -7124,10 +7200,16 @@ async function siteSearchCommand(io, positionals, values) {
7124
7200
  `Clicks 28d: ${g.clicks_28d} from ${g.impressions_28d} impressions${g.position_28d !== null ? `, average position ${g.position_28d}` : ""}`
7125
7201
  );
7126
7202
  if (g.note) io.log(`Google note: ${g.note}`);
7203
+ if (g.push?.enabled) {
7204
+ io.log(
7205
+ `Pushed: ${g.push.pushed_today} today, ${g.push.pushed_total} in all, ${g.push.indexed_after_push} indexed since`
7206
+ );
7207
+ if (g.push.note) io.log(`Push note: ${g.push.note}`);
7208
+ }
7127
7209
  }
7128
7210
  if (out.bing?.connected) {
7129
7211
  io.log(
7130
- `Bing: ${out.bing.verified_at ? "verified" : "not verified yet"}${out.bing.clicks_28d !== null ? `, ${out.bing.clicks_28d} clicks 28d` : ""}`
7212
+ `Bing: ${out.bing.verified_at ? "verified" : "not verified yet"}${out.bing.indexed != null ? `, ${out.bing.indexed} indexed` : ""}${out.bing.clicks_28d !== null ? `, ${out.bing.clicks_28d} clicks 28d` : ""}${out.bing.submitted_total ? `, ${out.bing.submitted_total} pages sent (${out.bing.submitted_today} today)` : ""}`
7131
7213
  );
7132
7214
  if (out.bing.note) io.log(`Bing note: ${out.bing.note}`);
7133
7215
  }
@@ -7324,6 +7406,8 @@ ${text}`);
7324
7406
  };
7325
7407
  runCli(argv, terminal).then(notice).catch(async (err) => {
7326
7408
  for (const line2 of cliErrorLines(err)) console.error(line2);
7409
+ if (err instanceof VibizApiError && err.grantUrl && process.stdin.isTTY && process.stdout.isTTY)
7410
+ openUrl(err.grantUrl);
7327
7411
  await notice();
7328
7412
  process.exit(1);
7329
7413
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibiz/cli",
3
- "version": "0.3.9",
3
+ "version": "0.3.12",
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",