@vibiz/cli 0.3.0 → 0.3.1

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-ICBMMOJM.js";
14
+ } from "./chunk-RH4VCBQY.js";
15
15
 
16
16
  // packages/cli/src/main.ts
17
17
  import { spawn } from "node:child_process";
@@ -362,7 +362,9 @@ var VibizApp = class _VibizApp {
362
362
  /**
363
363
  * Any action, billed to the project: web data (`web.scrape`, `web.search`, `web.crawl`,
364
364
  * `web.screenshot`, `web.design`, `ads.library`, `places.search`, `reviews`, `social.profile`,
365
- * `social.posts`, `ecommerce.product`, `linkedin.company`) or `email.send`.
365
+ * `social.posts`, `ecommerce.product`, `linkedin.company`, and SEO data: `seo.serp`,
366
+ * `seo.keywords`, `seo.keyword_ideas`, `seo.domain`, `seo.backlinks`, `seo.audit`,
367
+ * `seo.ai_mentions`) or `email.send`.
366
368
  */
367
369
  actions = {
368
370
  run: (name, input) => this.request(`/app/actions/${encodeURIComponent(name)}`, {
@@ -2803,10 +2805,177 @@ function printOutput(io, action, out) {
2803
2805
  `);
2804
2806
  }
2805
2807
  return;
2808
+ case "seo.serp":
2809
+ io.log(
2810
+ `${out.keyword} (${out.location}, ${out.device}${out.total_results ? `, ${num(out.total_results)} results` : ""})
2811
+ `
2812
+ );
2813
+ table2(
2814
+ io,
2815
+ ["#", "type", "domain", "title"],
2816
+ (out.results ?? []).map((r) => [r.position, r.type, r.domain ?? "", r.title ?? r.url])
2817
+ );
2818
+ if (out.features?.length) io.log(`
2819
+ on the page: ${out.features.join(", ")}`);
2820
+ return;
2821
+ case "seo.keywords":
2822
+ table2(
2823
+ io,
2824
+ ["keyword", "searches/mo", "cpc", "competition"],
2825
+ (out.keywords ?? []).map((k) => [
2826
+ k.keyword,
2827
+ num(k.search_volume),
2828
+ money2(k.cpc_usd),
2829
+ k.competition ?? ""
2830
+ ])
2831
+ );
2832
+ return;
2833
+ case "seo.keyword_ideas":
2834
+ table2(
2835
+ io,
2836
+ ["keyword", "searches/mo", "cpc", "competition", "difficulty"],
2837
+ (out.ideas ?? []).map((k) => [
2838
+ k.keyword,
2839
+ num(k.search_volume),
2840
+ money2(k.cpc_usd),
2841
+ k.competition ?? "",
2842
+ k.difficulty ?? ""
2843
+ ])
2844
+ );
2845
+ if (out.total) io.log(`
2846
+ ${num(out.total)} ideas in all`);
2847
+ return;
2848
+ case "seo.domain":
2849
+ io.log(
2850
+ `${out.domain} ${num(out.organic?.keywords)} keywords \xB7 ~${num(out.organic?.traffic_estimate)} visits/mo \xB7 worth ${money2(out.organic?.traffic_value_usd)}/mo in ads
2851
+ `
2852
+ );
2853
+ table2(
2854
+ io,
2855
+ ["#", "keyword", "searches/mo", "url"],
2856
+ (out.top_keywords ?? []).map((k) => [
2857
+ k.position ?? "",
2858
+ k.keyword,
2859
+ num(k.search_volume),
2860
+ k.url ?? ""
2861
+ ])
2862
+ );
2863
+ io.log("\ncompetitors");
2864
+ table2(
2865
+ io,
2866
+ ["domain", "shared keywords", "visits/mo"],
2867
+ (out.competitors ?? []).map((c) => [
2868
+ c.domain,
2869
+ num(c.common_keywords),
2870
+ num(c.traffic_estimate)
2871
+ ])
2872
+ );
2873
+ return;
2874
+ case "seo.backlinks": {
2875
+ const s = out.summary ?? {};
2876
+ io.log(
2877
+ `${out.target} ${num(s.backlinks)} backlinks from ${num(s.referring_domains)} domains \xB7 rank ${s.rank ?? "?"} \xB7 ${num(s.broken_backlinks)} broken
2878
+ `
2879
+ );
2880
+ table2(
2881
+ io,
2882
+ ["from", "anchor", "follow", "since"],
2883
+ (out.backlinks ?? []).map((b) => [
2884
+ b.from_url,
2885
+ b.anchor ?? "",
2886
+ b.dofollow === false ? "nofollow" : "follow",
2887
+ b.first_seen?.slice(0, 10) ?? ""
2888
+ ])
2889
+ );
2890
+ return;
2891
+ }
2892
+ case "seo.audit":
2893
+ io.log(
2894
+ `${out.url} ${out.status_code ?? "?"} score ${out.score ?? "?"} ${out.load_time_ms ?? "?"} ms ${out.word_count ?? "?"} words links ${out.links?.internal ?? "?"} in / ${out.links?.external ?? "?"} out`
2895
+ );
2896
+ io.log(`title ${out.title ?? "(none)"}`);
2897
+ io.log(`description ${out.description ?? "(none)"}`);
2898
+ io.log(`h1 ${out.h1?.length ? out.h1.join(" | ") : "(none)"}
2899
+ `);
2900
+ if (!out.issues?.length) io.log("No issues found.");
2901
+ for (const i of out.issues ?? []) io.log(`${String(i.severity).padEnd(7)} ${i.message}`);
2902
+ return;
2903
+ case "seo.ai_mentions":
2904
+ io.log(
2905
+ `${out.target} ${out.total} mentions (${Object.entries(out.by_platform ?? {}).map(([p, n]) => `${p} ${n}`).join(", ")})
2906
+ `
2907
+ );
2908
+ for (const m of out.mentions ?? []) {
2909
+ io.log(`${m.platform}: ${m.question ?? ""}`);
2910
+ if (m.answer_excerpt) io.log(` ${m.answer_excerpt}`);
2911
+ if (m.url) io.log(` ${m.url}`);
2912
+ io.log("");
2913
+ }
2914
+ return;
2806
2915
  default:
2807
2916
  io.log(JSON.stringify(out, null, 2));
2808
2917
  }
2809
2918
  }
2919
+ var num = (v) => typeof v === "number" ? Math.round(v).toLocaleString("en-US") : "\u2013";
2920
+ var money2 = (v) => typeof v === "number" ? `$${v.toFixed(2)}` : "\u2013";
2921
+ function table2(io, head, rows) {
2922
+ if (!rows.length) return io.log("(none)");
2923
+ const cells = [head, ...rows.map((r) => r.map((c) => String(c ?? "")))].map(
2924
+ (r) => r.map((c) => c.length > 60 ? `${c.slice(0, 59)}\u2026` : c)
2925
+ );
2926
+ const widths = head.map((_, i) => Math.max(...cells.map((r) => (r[i] ?? "").length)));
2927
+ for (const r of cells) {
2928
+ io.log(
2929
+ r.map((c, i) => c.padEnd(widths[i] ?? 0)).join(" ").trimEnd()
2930
+ );
2931
+ }
2932
+ }
2933
+ var SEO_USAGE = 'vibiz seo serp "<keyword>" | keywords k1,k2 | ideas "<keyword>" | domain example.com | backlinks example.com | audit <url> | ai example.com [--location "United States"] [--language en] [--limit n] [--project id] [--json]';
2934
+ var SEO_ACTIONS = {
2935
+ serp: "seo.serp",
2936
+ keywords: "seo.keywords",
2937
+ ideas: "seo.keyword_ideas",
2938
+ keyword_ideas: "seo.keyword_ideas",
2939
+ domain: "seo.domain",
2940
+ backlinks: "seo.backlinks",
2941
+ audit: "seo.audit",
2942
+ ai: "seo.ai_mentions",
2943
+ ai_mentions: "seo.ai_mentions"
2944
+ };
2945
+ async function seoCommand(io, args, flags) {
2946
+ const [what = "", ...rest] = args;
2947
+ const target = rest.join(" ").trim();
2948
+ const action = SEO_ACTIONS[what.replace(/-/g, "_")];
2949
+ if (!action || !target) throw usage(SEO_USAGE);
2950
+ const extra = flags.input ? JSON.parse(flags.input) : {};
2951
+ const limit = int(flags.limit, "limit");
2952
+ const depth = int(flags.depth, "depth");
2953
+ const locale = {
2954
+ ...flags.location ? { location: flags.location } : {},
2955
+ ...flags.language ? { language: flags.language } : {}
2956
+ };
2957
+ const lim = limit ? { limit } : {};
2958
+ const keywords = target.split(/[,\n]/).map((k) => k.trim()).filter(Boolean);
2959
+ const input = {
2960
+ "seo.serp": {
2961
+ keyword: target,
2962
+ ...locale,
2963
+ ...depth ? { depth } : {},
2964
+ ...flags.device ? { device: flags.device } : {}
2965
+ },
2966
+ "seo.keywords": { keywords, ...locale },
2967
+ "seo.keyword_ideas": { keywords, ...locale, ...lim },
2968
+ "seo.domain": { domain: target, ...locale, ...lim },
2969
+ "seo.backlinks": { target, ...lim },
2970
+ "seo.audit": { url: target },
2971
+ "seo.ai_mentions": {
2972
+ target,
2973
+ ...lim,
2974
+ ...flags.platform ? { platform: flags.platform } : {}
2975
+ }
2976
+ };
2977
+ return runOne(io, await io.client(), action, { ...input[action], ...extra }, flags);
2978
+ }
2810
2979
  async function runOne(io, vibiz2, action, input, flags) {
2811
2980
  const res = flags.project ? await vibiz2.projects.runAction(flags.project, action, input) : await vibiz2.actions.run(action, input);
2812
2981
  if (flags.json) {
@@ -3170,6 +3339,18 @@ var HELP = `vibiz \u2014 website, database and sign-in for a new business, in on
3170
3339
  ads on Facebook and Instagram from the Meta Ad Library;
3171
3340
  a page URL or page id (or --page "<name>") is one
3172
3341
  advertiser's ads; --all includes stopped ads
3342
+ vibiz seo serp "<keyword>" [--location "United States"] [--language en] [--depth 10] [--device mobile]
3343
+ who ranks on Google for a keyword
3344
+ vibiz seo keywords k1,k2,\u2026 monthly searches, CPC and competition (up to 1000)
3345
+ vibiz seo ideas "<keyword>" [--limit 50] related keywords with volume and difficulty
3346
+ vibiz seo domain example.com [--limit 20] a site's search traffic, top keywords, competitors
3347
+ vibiz seo backlinks example.com [--limit 20]
3348
+ who links to a domain or page
3349
+ vibiz seo audit <url> one page's on-page SEO and the issues to fix
3350
+ vibiz seo ai example.com [--platform chatgpt|google]
3351
+ how often ChatGPT and Google AI Overviews mention it.
3352
+ Every seo command: --location, --language, --project,
3353
+ --json
3173
3354
  vibiz runs [--action a] [--since 1d] [--project id] [--json] past runs, newest first
3174
3355
  vibiz runs <run_id> [--json] one run's input and output again
3175
3356
  vibiz actions [--json] every action and its input fields
@@ -3187,6 +3368,9 @@ var HELP = `vibiz \u2014 website, database and sign-in for a new business, in on
3187
3368
  social.posts Instagram or TikTok posts for a hashtag
3188
3369
  ecommerce.product price, stock, images of a product
3189
3370
  linkedin.company a public LinkedIn company page
3371
+ seo.serp, seo.keywords, seo.keyword_ideas,
3372
+ seo.domain, seo.backlinks, seo.audit,
3373
+ seo.ai_mentions SEO data (vibiz seo)
3190
3374
  vibiz send --to <addr> --subject <s> --text <body> [--html-file f] [--from info]
3191
3375
  send email from this project's address
3192
3376
  vibiz email inbox [--view inbox|starred|sent|archive|spam|trash|all] [--q words] [--unread] [--mailbox id]
@@ -3902,7 +4086,7 @@ var SOCIAL_LABELS = {
3902
4086
  };
3903
4087
  var socialLabel = (platform3) => SOCIAL_LABELS[platform3] ?? platform3;
3904
4088
  var cents2 = (n) => `$${(n / 100).toFixed(2)}`;
3905
- var money2 = (n, currency = "usd") => {
4089
+ var money3 = (n, currency = "usd") => {
3906
4090
  if (currency === "usd") return cents2(n);
3907
4091
  try {
3908
4092
  const f = new Intl.NumberFormat("en-US", {
@@ -4083,25 +4267,25 @@ function printAnalytics(io, r) {
4083
4267
  io.log(
4084
4268
  ` ${r.timeseries.map((p) => bars[Math.round(p.visitors / peak * (bars.length - 1))]).join("")}`
4085
4269
  );
4086
- const table2 = (title, rows) => {
4270
+ const table3 = (title, rows) => {
4087
4271
  if (!rows.length) return;
4088
4272
  io.log(`
4089
4273
  ${title}`);
4090
4274
  for (const [label, n] of rows) io.log(` ${String(n).padStart(6)} ${label}`);
4091
4275
  };
4092
- table2(
4276
+ table3(
4093
4277
  "top pages (pageviews)",
4094
4278
  r.top_pages.map((p) => [p.path, p.pageviews])
4095
4279
  );
4096
- table2(
4280
+ table3(
4097
4281
  "sources (visitors)",
4098
4282
  r.sources.map((s) => [s.source, s.visitors])
4099
4283
  );
4100
- table2(
4284
+ table3(
4101
4285
  "countries (visitors)",
4102
4286
  r.countries.map((c) => [c.country, c.visitors])
4103
4287
  );
4104
- table2(
4288
+ table3(
4105
4289
  "events",
4106
4290
  r.events.map((e) => [e.name, e.count])
4107
4291
  );
@@ -4425,6 +4609,10 @@ async function runCli(argv2, io) {
4425
4609
  tag: { type: "string" },
4426
4610
  limit: { type: "string" },
4427
4611
  country: { type: "string" },
4612
+ location: { type: "string" },
4613
+ depth: { type: "string" },
4614
+ device: { type: "string" },
4615
+ platform: { type: "string" },
4428
4616
  "max-pages": { type: "string" },
4429
4617
  action: { type: "string" },
4430
4618
  cursor: { type: "string" },
@@ -4973,7 +5161,7 @@ ${link.url}`);
4973
5161
  for (const x of p.prices) {
4974
5162
  const every = x.interval ? ` / ${x.interval_count && x.interval_count > 1 ? `${x.interval_count} ` : ""}${x.interval}` : "";
4975
5163
  io.log(
4976
- ` ${x.id} ${money2(x.unit_amount_cents, x.currency)}${every}${x.lookup_key ? ` ${x.lookup_key}` : ""}${x.active ? "" : " (inactive)"}`
5164
+ ` ${x.id} ${money3(x.unit_amount_cents, x.currency)}${every}${x.lookup_key ? ` ${x.lookup_key}` : ""}${x.active ? "" : " (inactive)"}`
4977
5165
  );
4978
5166
  }
4979
5167
  }
@@ -5019,7 +5207,7 @@ ${c.url}`));
5019
5207
  if (!list2.data.length) io.log("No payments yet.");
5020
5208
  for (const p of list2.data) {
5021
5209
  io.log(
5022
- `${p.created_at.slice(0, 10)} ${p.id} ${money2(p.amount_cents, p.currency).padStart(10)} net ${p.account === "own" ? money2(p.net_cents, p.currency) : cents2(p.net_cents)} ${p.status}${p.customer_email ? ` ${p.customer_email}` : ""}`
5210
+ `${p.created_at.slice(0, 10)} ${p.id} ${money3(p.amount_cents, p.currency).padStart(10)} net ${p.account === "own" ? money3(p.net_cents, p.currency) : cents2(p.net_cents)} ${p.status}${p.customer_email ? ` ${p.customer_email}` : ""}`
5023
5211
  );
5024
5212
  }
5025
5213
  });
@@ -5305,9 +5493,9 @@ ${link.url}`
5305
5493
  (a) => a.id === input.account_id
5306
5494
  );
5307
5495
  const currency = google?.details.ad_accounts?.find((a) => a.id === input.ad_account_id)?.currency ?? null;
5308
- const money3 = formatMinor(input.daily_budget_cents, currency);
5496
+ const money4 = formatMinor(input.daily_budget_cents, currency);
5309
5497
  await sure(
5310
- `This creates the ${input.campaign_type} campaign "${input.name}" (${money3} a day) on the live Google Ads account, ${input.start === "active" ? "ACTIVE: it starts spending" : "paused: nothing is spent until you resume it"}.`
5498
+ `This creates the ${input.campaign_type} campaign "${input.name}" (${money4} a day) on the live Google Ads account, ${input.start === "active" ? "ACTIVE: it starts spending" : "paused: nothing is spent until you resume it"}.`
5311
5499
  );
5312
5500
  ch = await vibiz2.projects.social.createCampaign(id, { ...input, confirm: true }, env);
5313
5501
  }
@@ -5328,9 +5516,9 @@ ${link.url}`
5328
5516
  if (!list2.data.length)
5329
5517
  io.log("No campaigns (connect ads: vibiz social connect meta --ads).");
5330
5518
  for (const c of list2.data) {
5331
- const money3 = (v) => formatMinor(v, c.currency);
5519
+ const money4 = (v) => formatMinor(v, c.currency);
5332
5520
  io.log(
5333
- `${c.id} ${c.status.padEnd(14)} ${money3(c.daily_budget_cents)}/day spent ${money3(c.spend_cents)} ${c.name}`
5521
+ `${c.id} ${c.status.padEnd(14)} ${money4(c.daily_budget_cents)}/day spent ${money4(c.spend_cents)} ${c.name}`
5334
5522
  );
5335
5523
  }
5336
5524
  });
@@ -5751,6 +5939,19 @@ ${await oneKeyLines(vibiz2, id)}`);
5751
5939
  ...values.cursor ? { cursor: values.cursor } : {}
5752
5940
  });
5753
5941
  }
5942
+ // SEO data (docs: actions, seo.*): `vibiz seo <what> …`.
5943
+ case "seo":
5944
+ return seoCommand(io, positionals, {
5945
+ json: values.json,
5946
+ ...values.input ? { input: values.input } : {},
5947
+ ...values.location ? { location: values.location } : {},
5948
+ ...values.language ? { language: values.language } : {},
5949
+ ...values.limit ? { limit: values.limit } : {},
5950
+ ...values.depth ? { depth: values.depth } : {},
5951
+ ...values.device ? { device: values.device } : {},
5952
+ ...values.platform ? { platform: values.platform } : {},
5953
+ ...values.project ? { project: values.project } : {}
5954
+ });
5754
5955
  case "run": {
5755
5956
  if (!passthrough.length) {
5756
5957
  const action = positionals[0];
@@ -6384,7 +6585,7 @@ Store the key now: it is not shown again.`
6384
6585
  return;
6385
6586
  }
6386
6587
  case "docs": {
6387
- const { DOC_TOPICS, DOCS } = await import("./src-MRGQURG7.js");
6588
+ const { DOC_TOPICS, DOCS } = await import("./src-KEH4ULRK.js");
6388
6589
  const topic = positionals[0];
6389
6590
  if (!topic || !DOC_TOPICS.includes(topic)) {
6390
6591
  for (const t of DOC_TOPICS) io.log(` vibiz docs ${t.padEnd(13)} ${DOCS[t].title}`);
@@ -6409,7 +6610,7 @@ ${DOCS[topic].body}`);
6409
6610
  if (positionals[0])
6410
6611
  throw new Error('usage: vibiz mcp (serve over stdio) | vibiz mcp add --clients "<client>"');
6411
6612
  io.local();
6412
- const { serveStdio } = await import("./src-MRGQURG7.js");
6613
+ const { serveStdio } = await import("./src-KEH4ULRK.js");
6413
6614
  await serveStdio({ version: cliVersion() });
6414
6615
  return;
6415
6616
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibiz/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
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",