@ainyc/canonry 2.2.3 → 2.4.2

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/cli.js CHANGED
@@ -1,9 +1,11 @@
1
1
  #!/usr/bin/env node --import tsx
2
2
  import {
3
+ CcReleaseSyncStatuses,
3
4
  CliError,
4
5
  EXIT_SYSTEM_ERROR,
5
6
  ProviderNames,
6
7
  RunKinds,
8
+ RunStatuses,
7
9
  coerceAgentProvider,
8
10
  computeCompetitorOverlap,
9
11
  configExists,
@@ -36,7 +38,7 @@ import {
36
38
  showFirstRunNotice,
37
39
  trackEvent,
38
40
  usageError
39
- } from "./chunk-MXUOJWNL.js";
41
+ } from "./chunk-Y7GCG4GD.js";
40
42
  import {
41
43
  apiKeys,
42
44
  competitors,
@@ -46,7 +48,7 @@ import {
46
48
  projects,
47
49
  querySnapshots,
48
50
  runs
49
- } from "./chunk-TAII35VC.js";
51
+ } from "./chunk-GZF3YIHY.js";
50
52
 
51
53
  // src/cli.ts
52
54
  import { pathToFileURL } from "url";
@@ -293,7 +295,7 @@ async function backfillAnswerVisibilityCommand(opts) {
293
295
  console.log(` Errors: ${providerErrors}`);
294
296
  }
295
297
  async function backfillInsightsCommand(project, opts) {
296
- const { IntelligenceService } = await import("./intelligence-service-C5LAYDFM.js");
298
+ const { IntelligenceService } = await import("./intelligence-service-KM64AW7J.js");
297
299
  const config = loadConfig();
298
300
  const db = createClient(config.database);
299
301
  migrate(db);
@@ -502,10 +504,315 @@ var BACKFILL_CLI_COMMANDS = [
502
504
  }
503
505
  ];
504
506
 
505
- // src/commands/bing.ts
507
+ // src/commands/backlinks.ts
506
508
  function getClient() {
507
509
  return createApiClient();
508
510
  }
511
+ function printJson(value) {
512
+ console.log(JSON.stringify(value, null, 2));
513
+ }
514
+ function formatInstallStatus(status) {
515
+ const lines = [];
516
+ lines.push(status.duckdbInstalled ? "DuckDB: installed" : "DuckDB: not installed");
517
+ if (status.duckdbVersion) lines.push(`Version: ${status.duckdbVersion}`);
518
+ lines.push(`Spec: ${status.duckdbSpec}`);
519
+ lines.push(`Plugin: ${status.pluginDir}`);
520
+ if (!status.duckdbInstalled) {
521
+ lines.push("");
522
+ lines.push("Run `canonry backlinks install` to enable backlinks.");
523
+ }
524
+ return lines.join("\n");
525
+ }
526
+ function formatSync(sync) {
527
+ const lines = [];
528
+ lines.push(`Release: ${sync.release}`);
529
+ lines.push(`Status: ${sync.status}`);
530
+ if (sync.phaseDetail) lines.push(`Phase: ${sync.phaseDetail}`);
531
+ if (typeof sync.projectsProcessed === "number") lines.push(`Projects: ${sync.projectsProcessed}`);
532
+ if (typeof sync.domainsDiscovered === "number") lines.push(`Domains: ${sync.domainsDiscovered}`);
533
+ if (sync.error) lines.push(`Error: ${sync.error}`);
534
+ return lines.join("\n");
535
+ }
536
+ function formatSummaryAndDomains(project, response) {
537
+ const lines = [];
538
+ lines.push(`Project: ${project}`);
539
+ if (!response.summary) {
540
+ lines.push("No ready release \u2014 run `canonry backlinks sync --release <id>` first.");
541
+ return lines.join("\n");
542
+ }
543
+ const s = response.summary;
544
+ lines.push(`Release: ${s.release}`);
545
+ lines.push(`Target: ${s.targetDomain}`);
546
+ lines.push(`Linking domains: ${s.totalLinkingDomains}`);
547
+ lines.push(`Total hosts: ${s.totalHosts}`);
548
+ lines.push(`Top-10 share: ${s.top10HostsShare}`);
549
+ if (response.rows.length > 0) {
550
+ lines.push("");
551
+ lines.push(`Top ${response.rows.length} linking domains (of ${response.total}):`);
552
+ for (const r of response.rows) {
553
+ lines.push(` ${String(r.numHosts).padStart(9)} ${r.linkingDomain}`);
554
+ }
555
+ }
556
+ return lines.join("\n");
557
+ }
558
+ function formatCachedReleases(rows) {
559
+ if (rows.length === 0) return "No cached releases.";
560
+ const lines = [];
561
+ lines.push("Release Status Bytes Last used");
562
+ for (const r of rows) {
563
+ const status = (r.syncStatus ?? "unknown").padEnd(12);
564
+ const bytes = String(r.bytes).padStart(12);
565
+ const lastUsed = r.lastUsedAt ?? "-";
566
+ lines.push(`${r.release.padEnd(30)} ${status} ${bytes} ${lastUsed}`);
567
+ }
568
+ return lines.join("\n");
569
+ }
570
+ function formatInstallResult(result) {
571
+ if (result.alreadyPresent) {
572
+ return `DuckDB already installed (${result.version}) at ${result.path}`;
573
+ }
574
+ return `DuckDB installed (${result.version}) at ${result.path}`;
575
+ }
576
+ async function pollSync(id, format) {
577
+ const client = getClient();
578
+ const terminal = /* @__PURE__ */ new Set([
579
+ CcReleaseSyncStatuses.ready,
580
+ CcReleaseSyncStatuses.failed
581
+ ]);
582
+ while (true) {
583
+ const syncs = await client.backlinksListSyncs();
584
+ const row = syncs.find((s) => s.id === id);
585
+ if (!row) throw new Error(`Release sync ${id} not found`);
586
+ if (terminal.has(row.status)) return row;
587
+ if (format !== "json") {
588
+ process.stderr.write(`\r${row.status}${row.phaseDetail ? ": " + row.phaseDetail : ""}`.padEnd(80));
589
+ }
590
+ await new Promise((r) => setTimeout(r, 2e3));
591
+ }
592
+ }
593
+ async function pollRun(runId, format) {
594
+ const client = getClient();
595
+ const terminal = /* @__PURE__ */ new Set([
596
+ RunStatuses.completed,
597
+ RunStatuses.failed,
598
+ RunStatuses.partial
599
+ ]);
600
+ while (true) {
601
+ const run = await client.getRun(runId);
602
+ if (terminal.has(run.status)) return run;
603
+ if (format !== "json") {
604
+ process.stderr.write(`\r${run.status}`.padEnd(40));
605
+ }
606
+ await new Promise((r) => setTimeout(r, 2e3));
607
+ }
608
+ }
609
+ async function backlinksInstall(opts = {}) {
610
+ const result = await getClient().backlinksInstall();
611
+ if (opts.format === "json") {
612
+ printJson(result);
613
+ return;
614
+ }
615
+ console.log(formatInstallResult(result));
616
+ }
617
+ async function backlinksDoctor(opts = {}) {
618
+ const status = await getClient().backlinksStatus();
619
+ if (opts.format === "json") {
620
+ printJson(status);
621
+ return;
622
+ }
623
+ console.log(formatInstallStatus(status));
624
+ }
625
+ async function backlinksSync(opts) {
626
+ const client = getClient();
627
+ const sync = await client.backlinksTriggerSync(opts.release);
628
+ const final = opts.wait ? await pollSync(sync.id, opts.format) : sync;
629
+ if (opts.format === "json") {
630
+ printJson(final);
631
+ return;
632
+ }
633
+ if (opts.wait) process.stderr.write("\n");
634
+ console.log(formatSync(final));
635
+ }
636
+ async function backlinksStatus(opts = {}) {
637
+ const sync = await getClient().backlinksLatestSync();
638
+ if (opts.format === "json") {
639
+ printJson(sync);
640
+ return;
641
+ }
642
+ if (!sync) {
643
+ console.log("No release syncs yet.");
644
+ return;
645
+ }
646
+ console.log(formatSync(sync));
647
+ }
648
+ async function backlinksList(opts) {
649
+ const client = getClient();
650
+ const response = await client.backlinksDomains(opts.project, {
651
+ limit: opts.limit ?? 50,
652
+ release: opts.release
653
+ });
654
+ if (opts.format === "json") {
655
+ printJson(response);
656
+ return;
657
+ }
658
+ console.log(formatSummaryAndDomains(opts.project, response));
659
+ }
660
+ async function backlinksReleases(opts = {}) {
661
+ const rows = await getClient().backlinksCachedReleases();
662
+ if (opts.format === "json") {
663
+ printJson(rows);
664
+ return;
665
+ }
666
+ console.log(formatCachedReleases(rows));
667
+ }
668
+ async function backlinksExtract(opts) {
669
+ const client = getClient();
670
+ const run = await client.backlinksExtract(opts.project, opts.release);
671
+ const final = opts.wait ? await pollRun(run.id, opts.format) : run;
672
+ if (opts.format === "json") {
673
+ printJson(final);
674
+ return;
675
+ }
676
+ if (opts.wait) process.stderr.write("\n");
677
+ console.log(`Run ${final.id} (${final.status})${final.error ? " \u2014 " + final.error : ""}`);
678
+ }
679
+ async function backlinksCachePrune(opts) {
680
+ if (!opts.release) {
681
+ throw new Error("Usage: canonry backlinks cache prune --release <id>");
682
+ }
683
+ const result = await getClient().backlinksPruneCache(opts.release);
684
+ if (opts.format === "json") {
685
+ printJson({ pruned: opts.release, ...result });
686
+ return;
687
+ }
688
+ console.log(`Pruned cache for ${opts.release}`);
689
+ }
690
+
691
+ // src/cli-commands/backlinks.ts
692
+ var BACKLINKS_CLI_COMMANDS = [
693
+ {
694
+ path: ["backlinks", "install"],
695
+ usage: "canonry backlinks install [--format json]",
696
+ options: {},
697
+ run: async (input) => {
698
+ await backlinksInstall({ format: input.format });
699
+ }
700
+ },
701
+ {
702
+ path: ["backlinks", "doctor"],
703
+ usage: "canonry backlinks doctor [--format json]",
704
+ options: {},
705
+ run: async (input) => {
706
+ await backlinksDoctor({ format: input.format });
707
+ }
708
+ },
709
+ {
710
+ path: ["backlinks", "sync"],
711
+ usage: "canonry backlinks sync --release <id> [--wait] [--format json]",
712
+ options: {
713
+ release: stringOption(),
714
+ wait: { type: "boolean" }
715
+ },
716
+ run: async (input) => {
717
+ const release = requireStringOption(input, "release", {
718
+ message: "--release is required",
719
+ usage: "canonry backlinks sync --release <id> [--wait]",
720
+ command: "backlinks sync"
721
+ });
722
+ await backlinksSync({
723
+ release,
724
+ wait: getBoolean(input.values, "wait"),
725
+ format: input.format
726
+ });
727
+ }
728
+ },
729
+ {
730
+ path: ["backlinks", "status"],
731
+ usage: "canonry backlinks status [--format json]",
732
+ options: {},
733
+ run: async (input) => {
734
+ await backlinksStatus({ format: input.format });
735
+ }
736
+ },
737
+ {
738
+ path: ["backlinks", "list"],
739
+ usage: "canonry backlinks list <project> [--limit <n>] [--release <id>] [--format json]",
740
+ options: {
741
+ limit: stringOption(),
742
+ release: stringOption()
743
+ },
744
+ run: async (input) => {
745
+ const project = requireProject(
746
+ input,
747
+ "backlinks list",
748
+ "canonry backlinks list <project> [--limit <n>] [--release <id>]"
749
+ );
750
+ const limit = parseIntegerOption(input, "limit", {
751
+ message: "--limit must be an integer",
752
+ usage: "canonry backlinks list <project> --limit <n>",
753
+ command: "backlinks list"
754
+ });
755
+ await backlinksList({
756
+ project,
757
+ limit,
758
+ release: getString(input.values, "release"),
759
+ format: input.format
760
+ });
761
+ }
762
+ },
763
+ {
764
+ path: ["backlinks", "releases"],
765
+ usage: "canonry backlinks releases [--format json]",
766
+ options: {},
767
+ run: async (input) => {
768
+ await backlinksReleases({ format: input.format });
769
+ }
770
+ },
771
+ {
772
+ path: ["backlinks", "extract"],
773
+ usage: "canonry backlinks extract <project> [--release <id>] [--wait] [--format json]",
774
+ options: {
775
+ release: stringOption(),
776
+ wait: { type: "boolean" }
777
+ },
778
+ run: async (input) => {
779
+ const project = requireProject(
780
+ input,
781
+ "backlinks extract",
782
+ "canonry backlinks extract <project> [--release <id>] [--wait]"
783
+ );
784
+ await backlinksExtract({
785
+ project,
786
+ release: getString(input.values, "release"),
787
+ wait: getBoolean(input.values, "wait"),
788
+ format: input.format
789
+ });
790
+ }
791
+ },
792
+ {
793
+ path: ["backlinks", "cache", "prune"],
794
+ usage: "canonry backlinks cache prune --release <id> [--format json]",
795
+ options: {
796
+ release: stringOption()
797
+ },
798
+ run: async (input) => {
799
+ const release = requireStringOption(input, "release", {
800
+ message: "--release is required",
801
+ usage: "canonry backlinks cache prune --release <id>",
802
+ command: "backlinks cache prune"
803
+ });
804
+ await backlinksCachePrune({
805
+ release,
806
+ format: input.format
807
+ });
808
+ }
809
+ }
810
+ ];
811
+
812
+ // src/commands/bing.ts
813
+ function getClient2() {
814
+ return createApiClient();
815
+ }
509
816
  async function bingConnect(project, opts) {
510
817
  const apiKey = opts?.apiKey;
511
818
  if (!apiKey) {
@@ -518,7 +825,7 @@ async function bingConnect(project, opts) {
518
825
  }
519
826
  });
520
827
  }
521
- const client = getClient();
828
+ const client = getClient2();
522
829
  const result = await client.bingConnect(project, { apiKey });
523
830
  if (opts?.format === "json") {
524
831
  console.log(JSON.stringify(result, null, 2));
@@ -539,7 +846,7 @@ Set the active site with: canonry bing set-site ${project} <url>`);
539
846
  }
540
847
  }
541
848
  async function bingDisconnect(project, format) {
542
- const client = getClient();
849
+ const client = getClient2();
543
850
  await client.bingDisconnect(project);
544
851
  if (format === "json") {
545
852
  console.log(JSON.stringify({ project, disconnected: true }, null, 2));
@@ -548,7 +855,7 @@ async function bingDisconnect(project, format) {
548
855
  console.log(`Bing Webmaster Tools disconnected from project "${project}".`);
549
856
  }
550
857
  async function bingStatus(project, format) {
551
- const client = getClient();
858
+ const client = getClient2();
552
859
  const result = await client.bingStatus(project);
553
860
  if (format === "json") {
554
861
  console.log(JSON.stringify(result, null, 2));
@@ -566,7 +873,7 @@ async function bingStatus(project, format) {
566
873
  console.log(` Updated: ${result.updatedAt}`);
567
874
  }
568
875
  async function bingSites(project, format) {
569
- const client = getClient();
876
+ const client = getClient2();
570
877
  const result = await client.bingSites(project);
571
878
  if (format === "json") {
572
879
  console.log(JSON.stringify(result, null, 2));
@@ -588,7 +895,7 @@ async function bingSites(project, format) {
588
895
  Use "canonry bing set-site <project> <url>" to select a site.`);
589
896
  }
590
897
  async function bingSetSite(project, siteUrl, format) {
591
- const client = getClient();
898
+ const client = getClient2();
592
899
  await client.bingSetSite(project, siteUrl);
593
900
  if (format === "json") {
594
901
  console.log(JSON.stringify({ project, siteUrl }, null, 2));
@@ -597,7 +904,7 @@ async function bingSetSite(project, siteUrl, format) {
597
904
  console.log(`Bing site set to "${siteUrl}" for project "${project}".`);
598
905
  }
599
906
  async function bingCoverage(project, format) {
600
- const client = getClient();
907
+ const client = getClient2();
601
908
  const result = await client.bingCoverage(project);
602
909
  if (format === "json") {
603
910
  console.log(JSON.stringify(result, null, 2));
@@ -645,7 +952,7 @@ Bing Index Coverage for "${project}"
645
952
  }
646
953
  }
647
954
  async function bingCoverageHistory(project, opts) {
648
- const client = getClient();
955
+ const client = getClient2();
649
956
  const rows = await client.bingCoverageHistory(project, { limit: opts.limit });
650
957
  if (opts.format === "json") {
651
958
  console.log(JSON.stringify(rows, null, 2));
@@ -665,7 +972,7 @@ Bing Coverage History for "${project}" (${rows.length} snapshots):
665
972
  }
666
973
  }
667
974
  async function bingInspect(project, url, format) {
668
- const client = getClient();
975
+ const client = getClient2();
669
976
  const result = await client.bingInspectUrl(project, url);
670
977
  if (format === "json") {
671
978
  console.log(JSON.stringify(result, null, 2));
@@ -684,7 +991,7 @@ Bing URL Inspection: ${result.url}
684
991
  console.log(` Inspected At: ${result.inspectedAt}`);
685
992
  }
686
993
  async function bingInspections(project, opts) {
687
- const client = getClient();
994
+ const client = getClient2();
688
995
  const params = {};
689
996
  if (opts.url) params.url = opts.url;
690
997
  const rows = await client.bingInspections(project, Object.keys(params).length > 0 ? params : void 0);
@@ -710,7 +1017,7 @@ async function bingInspections(project, opts) {
710
1017
  }
711
1018
  }
712
1019
  async function bingRefresh(project, format) {
713
- const client = getClient();
1020
+ const client = getClient2();
714
1021
  const rows = await client.bingInspections(project);
715
1022
  const uniqueUrls = [...new Set(rows.map((r) => r.url))];
716
1023
  if (uniqueUrls.length === 0) {
@@ -750,7 +1057,7 @@ async function bingRefresh(project, format) {
750
1057
  await bingCoverage(project, format);
751
1058
  }
752
1059
  async function bingRequestIndexing(project, opts) {
753
- const client = getClient();
1060
+ const client = getClient2();
754
1061
  const body = {};
755
1062
  if (opts.allUnindexed) {
756
1063
  body.allUnindexed = true;
@@ -785,7 +1092,7 @@ async function bingRequestIndexing(project, opts) {
785
1092
  }
786
1093
  }
787
1094
  async function bingPerformance(project, format) {
788
- const client = getClient();
1095
+ const client = getClient2();
789
1096
  const rows = await client.bingPerformance(project);
790
1097
  if (format === "json") {
791
1098
  console.log(JSON.stringify(rows, null, 2));
@@ -971,7 +1278,7 @@ var BING_CLI_COMMANDS = [
971
1278
  ];
972
1279
 
973
1280
  // src/commands/cdp.ts
974
- function getClient2() {
1281
+ function getClient3() {
975
1282
  return createApiClient();
976
1283
  }
977
1284
  async function cdpConnect(opts) {
@@ -997,7 +1304,7 @@ async function cdpConnect(opts) {
997
1304
  console.log("Restart canonry server for changes to take effect.");
998
1305
  }
999
1306
  async function cdpStatus(format) {
1000
- const client = getClient2();
1307
+ const client = getClient3();
1001
1308
  try {
1002
1309
  const status = await client.getCdpStatus();
1003
1310
  if (format === "json") {
@@ -1055,7 +1362,7 @@ async function cdpScreenshot(query, opts) {
1055
1362
  }
1056
1363
  });
1057
1364
  }
1058
- const client = getClient2();
1365
+ const client = getClient3();
1059
1366
  const body = { query };
1060
1367
  if (opts?.targets) {
1061
1368
  body.targets = opts.targets.split(",").map((s) => s.trim());
@@ -1162,7 +1469,7 @@ var CDP_CLI_COMMANDS = [
1162
1469
  ];
1163
1470
 
1164
1471
  // src/commands/ga.ts
1165
- function getClient3() {
1472
+ function getClient4() {
1166
1473
  return createApiClient();
1167
1474
  }
1168
1475
  async function gaConnect(project, opts) {
@@ -1195,7 +1502,7 @@ async function gaConnect(project, opts) {
1195
1502
  } else if (opts.keyJson) {
1196
1503
  body.keyJson = opts.keyJson;
1197
1504
  }
1198
- const client = getClient3();
1505
+ const client = getClient4();
1199
1506
  const result = await client.gaConnect(project, body);
1200
1507
  if (opts.format === "json") {
1201
1508
  console.log(JSON.stringify(result, null, 2));
@@ -1210,7 +1517,7 @@ async function gaConnect(project, opts) {
1210
1517
  }
1211
1518
  }
1212
1519
  async function gaDisconnect(project, format) {
1213
- const client = getClient3();
1520
+ const client = getClient4();
1214
1521
  await client.gaDisconnect(project);
1215
1522
  if (format === "json") {
1216
1523
  console.log(JSON.stringify({ project, disconnected: true }, null, 2));
@@ -1219,7 +1526,7 @@ async function gaDisconnect(project, format) {
1219
1526
  console.log(`GA4 disconnected from project "${project}".`);
1220
1527
  }
1221
1528
  async function gaStatus(project, format) {
1222
- const client = getClient3();
1529
+ const client = getClient4();
1223
1530
  const result = await client.gaStatus(project);
1224
1531
  if (format === "json") {
1225
1532
  console.log(JSON.stringify(result, null, 2));
@@ -1245,7 +1552,7 @@ async function gaStatus(project, format) {
1245
1552
  console.log(` Connected: ${result.createdAt ?? "unknown"}`);
1246
1553
  }
1247
1554
  async function gaSync(project, opts) {
1248
- const client = getClient3();
1555
+ const client = getClient4();
1249
1556
  const body = {};
1250
1557
  if (opts?.days) body.days = opts.days;
1251
1558
  if (opts?.only) body.only = opts.only;
@@ -1265,7 +1572,7 @@ async function gaSync(project, opts) {
1265
1572
  console.log(` Synced at: ${result.syncedAt}`);
1266
1573
  }
1267
1574
  async function gaTraffic(project, opts) {
1268
- const client = getClient3();
1575
+ const client = getClient4();
1269
1576
  const params = {};
1270
1577
  if (opts?.limit) params.limit = String(opts.limit);
1271
1578
  if (opts?.window) params.window = opts.window;
@@ -1340,7 +1647,7 @@ async function gaTraffic(project, opts) {
1340
1647
  }
1341
1648
  }
1342
1649
  async function gaAiReferralHistory(project, opts) {
1343
- const client = getClient3();
1650
+ const client = getClient4();
1344
1651
  const result = await client.gaAiReferralHistory(project, opts?.window ? { window: opts.window } : void 0);
1345
1652
  if (opts?.format === "json") {
1346
1653
  console.log(JSON.stringify(result, null, 2));
@@ -1365,7 +1672,7 @@ async function gaAiReferralHistory(project, opts) {
1365
1672
  }
1366
1673
  }
1367
1674
  async function gaSocialReferralHistory(project, opts) {
1368
- const client = getClient3();
1675
+ const client = getClient4();
1369
1676
  const result = await client.gaSocialReferralHistory(project, opts?.window ? { window: opts.window } : void 0);
1370
1677
  if (opts?.format === "json") {
1371
1678
  console.log(JSON.stringify(result, null, 2));
@@ -1390,7 +1697,7 @@ async function gaSocialReferralHistory(project, opts) {
1390
1697
  }
1391
1698
  }
1392
1699
  async function gaSessionHistory(project, opts) {
1393
- const client = getClient3();
1700
+ const client = getClient4();
1394
1701
  const result = await client.gaSessionHistory(project, opts?.window ? { window: opts.window } : void 0);
1395
1702
  if (opts?.format === "json") {
1396
1703
  console.log(JSON.stringify(result, null, 2));
@@ -1412,7 +1719,7 @@ async function gaSessionHistory(project, opts) {
1412
1719
  }
1413
1720
  }
1414
1721
  async function gaCoverage(project, format) {
1415
- const client = getClient3();
1722
+ const client = getClient4();
1416
1723
  const result = await client.gaCoverage(project);
1417
1724
  if (format === "json") {
1418
1725
  console.log(JSON.stringify(result, null, 2));
@@ -1435,7 +1742,7 @@ async function gaCoverage(project, format) {
1435
1742
  }
1436
1743
  }
1437
1744
  async function gaSocialReferralSummary(project, opts) {
1438
- const client = getClient3();
1745
+ const client = getClient4();
1439
1746
  const traffic = await client.gaTraffic(project);
1440
1747
  if (opts?.trend) {
1441
1748
  const trend = await client.gaSocialReferralTrend(project);
@@ -1496,7 +1803,7 @@ async function gaSocialReferralSummary(project, opts) {
1496
1803
  }
1497
1804
  }
1498
1805
  async function gaAttribution(project, opts) {
1499
- const client = getClient3();
1806
+ const client = getClient4();
1500
1807
  const traffic = await client.gaTraffic(project);
1501
1808
  const fmtTrend = (pct) => pct === null ? "n/a" : `${pct >= 0 ? "+" : ""}${pct}%`;
1502
1809
  if (opts?.trend) {
@@ -1789,11 +2096,11 @@ var GA_CLI_COMMANDS = [
1789
2096
  ];
1790
2097
 
1791
2098
  // src/commands/competitor.ts
1792
- function getClient4() {
2099
+ function getClient5() {
1793
2100
  return createApiClient();
1794
2101
  }
1795
2102
  async function addCompetitors(project, domains, format) {
1796
- const client = getClient4();
2103
+ const client = getClient5();
1797
2104
  const existing = await client.listCompetitors(project);
1798
2105
  const existingDomains = existing.map((c) => c.domain);
1799
2106
  const addedDomains = domains.filter((domain) => !existingDomains.includes(domain));
@@ -1815,7 +2122,7 @@ async function addCompetitors(project, domains, format) {
1815
2122
  }
1816
2123
  }
1817
2124
  async function listCompetitors(project, format) {
1818
- const client = getClient4();
2125
+ const client = getClient5();
1819
2126
  const comps = await client.listCompetitors(project);
1820
2127
  if (format === "json") {
1821
2128
  console.log(JSON.stringify(comps, null, 2));
@@ -1874,7 +2181,7 @@ var COMPETITOR_CLI_COMMANDS = [
1874
2181
  ];
1875
2182
 
1876
2183
  // src/commands/google.ts
1877
- function getClient5() {
2184
+ function getClient6() {
1878
2185
  return createApiClient();
1879
2186
  }
1880
2187
  async function waitForRunStatus(client, runId, config) {
@@ -1914,7 +2221,7 @@ async function waitForRunStatus(client, runId, config) {
1914
2221
  });
1915
2222
  }
1916
2223
  async function googleConnect(project, opts) {
1917
- const client = getClient5();
2224
+ const client = getClient6();
1918
2225
  const { authUrl, redirectUri } = await client.googleConnect(project, {
1919
2226
  type: opts.type,
1920
2227
  publicUrl: opts.publicUrl
@@ -1948,7 +2255,7 @@ Open this URL in your browser to authorize Google ${opts.type.toUpperCase()} acc
1948
2255
  }
1949
2256
  }
1950
2257
  async function googleDisconnect(project, opts) {
1951
- const client = getClient5();
2258
+ const client = getClient6();
1952
2259
  await client.googleDisconnect(project, opts.type);
1953
2260
  if (opts.format === "json") {
1954
2261
  console.log(JSON.stringify({ project, type: opts.type, disconnected: true }, null, 2));
@@ -1957,7 +2264,7 @@ async function googleDisconnect(project, opts) {
1957
2264
  console.log(`Disconnected Google ${opts.type.toUpperCase()} from project "${project}".`);
1958
2265
  }
1959
2266
  async function googleStatus(project, format) {
1960
- const client = getClient5();
2267
+ const client = getClient6();
1961
2268
  const connections = await client.googleConnections(project);
1962
2269
  if (format === "json") {
1963
2270
  console.log(JSON.stringify({ connections }, null, 2));
@@ -1981,7 +2288,7 @@ async function googleStatus(project, format) {
1981
2288
  }
1982
2289
  }
1983
2290
  async function googleProperties(project, format) {
1984
- const client = getClient5();
2291
+ const client = getClient6();
1985
2292
  const { sites } = await client.googleProperties(project);
1986
2293
  if (format === "json") {
1987
2294
  console.log(JSON.stringify({ sites }, null, 2));
@@ -2002,7 +2309,7 @@ async function googleProperties(project, format) {
2002
2309
  Use "canonry google set-property <project> <siteUrl>" to select a property.`);
2003
2310
  }
2004
2311
  async function googleSetProperty(project, propertyUrl, format) {
2005
- const client = getClient5();
2312
+ const client = getClient6();
2006
2313
  await client.googleSetProperty(project, "gsc", propertyUrl);
2007
2314
  if (format === "json") {
2008
2315
  console.log(JSON.stringify({ project, type: "gsc", propertyUrl }, null, 2));
@@ -2011,7 +2318,7 @@ async function googleSetProperty(project, propertyUrl, format) {
2011
2318
  console.log(`GSC property set to "${propertyUrl}" for project "${project}".`);
2012
2319
  }
2013
2320
  async function googleSync(project, opts) {
2014
- const client = getClient5();
2321
+ const client = getClient6();
2015
2322
  const run = await client.gscSync(project, { days: opts.days, full: opts.full });
2016
2323
  if (!opts.wait && opts.format === "json") {
2017
2324
  console.log(JSON.stringify(run, null, 2));
@@ -2041,7 +2348,7 @@ async function googleSync(project, opts) {
2041
2348
  }
2042
2349
  }
2043
2350
  async function googlePerformance(project, opts) {
2044
- const client = getClient5();
2351
+ const client = getClient6();
2045
2352
  const params = {};
2046
2353
  if (opts.days) {
2047
2354
  const end = /* @__PURE__ */ new Date();
@@ -2077,7 +2384,7 @@ async function googlePerformance(project, opts) {
2077
2384
  }
2078
2385
  }
2079
2386
  async function googleInspect(project, url, format) {
2080
- const client = getClient5();
2387
+ const client = getClient6();
2081
2388
  const result = await client.gscInspect(project, url);
2082
2389
  if (format === "json") {
2083
2390
  console.log(JSON.stringify(result, null, 2));
@@ -2097,7 +2404,7 @@ URL Inspection: ${result.url}
2097
2404
  console.log(` Inspected At: ${result.inspectedAt}`);
2098
2405
  }
2099
2406
  async function googleInspections(project, opts) {
2100
- const client = getClient5();
2407
+ const client = getClient6();
2101
2408
  const params = {};
2102
2409
  if (opts.url) params.url = opts.url;
2103
2410
  const rows = await client.gscInspections(project, Object.keys(params).length > 0 ? params : void 0);
@@ -2122,7 +2429,7 @@ async function googleInspections(project, opts) {
2122
2429
  }
2123
2430
  }
2124
2431
  async function googleCoverage(project, format) {
2125
- const client = getClient5();
2432
+ const client = getClient6();
2126
2433
  const result = await client.gscCoverage(project);
2127
2434
  if (format === "json") {
2128
2435
  console.log(JSON.stringify(result, null, 2));
@@ -2168,7 +2475,7 @@ Index Coverage for "${project}"
2168
2475
  }
2169
2476
  }
2170
2477
  async function googleSetSitemap(project, sitemapUrl, format) {
2171
- const client = getClient5();
2478
+ const client = getClient6();
2172
2479
  await client.googleSetSitemap(project, "gsc", sitemapUrl);
2173
2480
  if (format === "json") {
2174
2481
  console.log(JSON.stringify({ project, type: "gsc", sitemapUrl }, null, 2));
@@ -2177,7 +2484,7 @@ async function googleSetSitemap(project, sitemapUrl, format) {
2177
2484
  console.log(`GSC sitemap URL set to "${sitemapUrl}" for project "${project}".`);
2178
2485
  }
2179
2486
  async function googleListSitemaps(project, opts) {
2180
- const client = getClient5();
2487
+ const client = getClient6();
2181
2488
  const result = await client.gscSitemaps(project);
2182
2489
  if (opts.format === "json") {
2183
2490
  console.log(JSON.stringify(result, null, 2));
@@ -2199,7 +2506,7 @@ Sitemaps for project "${project}":
2199
2506
  }
2200
2507
  }
2201
2508
  async function googleInspectSitemap(project, opts) {
2202
- const client = getClient5();
2509
+ const client = getClient6();
2203
2510
  const run = await client.gscInspectSitemap(project, {
2204
2511
  sitemapUrl: opts.sitemapUrl
2205
2512
  });
@@ -2235,7 +2542,7 @@ async function googleInspectSitemap(project, opts) {
2235
2542
  }
2236
2543
  }
2237
2544
  async function googleCoverageHistory(project, opts) {
2238
- const client = getClient5();
2545
+ const client = getClient6();
2239
2546
  const rows = await client.gscCoverageHistory(project, { limit: opts.limit });
2240
2547
  if (opts.format === "json") {
2241
2548
  console.log(JSON.stringify(rows, null, 2));
@@ -2257,7 +2564,7 @@ GSC Coverage History for "${project}" (${rows.length} snapshots):
2257
2564
  }
2258
2565
  }
2259
2566
  async function googleDiscoverSitemaps(project, opts) {
2260
- const client = getClient5();
2567
+ const client = getClient6();
2261
2568
  const result = await client.gscDiscoverSitemaps(project);
2262
2569
  if (!opts.wait && opts.format === "json") {
2263
2570
  console.log(JSON.stringify(result, null, 2));
@@ -2309,7 +2616,7 @@ Primary sitemap: ${result.primarySitemapUrl}`);
2309
2616
  }
2310
2617
  }
2311
2618
  async function googleRequestIndexing(project, opts) {
2312
- const client = getClient5();
2619
+ const client = getClient6();
2313
2620
  const body = { urls: [] };
2314
2621
  if (opts.allUnindexed) {
2315
2622
  body.allUnindexed = true;
@@ -2389,7 +2696,7 @@ async function googleRequestIndexing(project, opts) {
2389
2696
  }
2390
2697
  }
2391
2698
  async function googleRefresh(project, format) {
2392
- const client = getClient5();
2699
+ const client = getClient6();
2393
2700
  const run = await client.gscSync(project, {});
2394
2701
  if (format !== "json") {
2395
2702
  process.stderr.write("Refreshing GSC coverage data");
@@ -2412,7 +2719,7 @@ async function googleRefresh(project, format) {
2412
2719
  await googleCoverage(project, format);
2413
2720
  }
2414
2721
  async function googleDeindexed(project, format) {
2415
- const client = getClient5();
2722
+ const client = getClient6();
2416
2723
  const rows = await client.gscDeindexed(project);
2417
2724
  if (format === "json") {
2418
2725
  console.log(JSON.stringify(rows, null, 2));
@@ -2701,11 +3008,11 @@ var GOOGLE_CLI_COMMANDS = [
2701
3008
 
2702
3009
  // src/commands/keyword.ts
2703
3010
  import fs from "fs";
2704
- function getClient6() {
3011
+ function getClient7() {
2705
3012
  return createApiClient();
2706
3013
  }
2707
3014
  async function addKeywords(project, keywords, format) {
2708
- const client = getClient6();
3015
+ const client = getClient7();
2709
3016
  await client.appendKeywords(project, keywords);
2710
3017
  if (format === "json") {
2711
3018
  console.log(JSON.stringify({
@@ -2718,7 +3025,7 @@ async function addKeywords(project, keywords, format) {
2718
3025
  console.log(`Added ${keywords.length} key phrase(s) to "${project}".`);
2719
3026
  }
2720
3027
  async function removeKeywords(project, keywords, format) {
2721
- const client = getClient6();
3028
+ const client = getClient7();
2722
3029
  const existing = await client.listKeywords(project);
2723
3030
  const existingSet = new Set(existing.map((k) => k.keyword));
2724
3031
  const removedKeywords = keywords.filter((k) => existingSet.has(k));
@@ -2735,7 +3042,7 @@ async function removeKeywords(project, keywords, format) {
2735
3042
  console.log(`Removed ${removedKeywords.length} key phrase(s) from "${project}".`);
2736
3043
  }
2737
3044
  async function listKeywords(project, format) {
2738
- const client = getClient6();
3045
+ const client = getClient7();
2739
3046
  const kws = await client.listKeywords(project);
2740
3047
  if (format === "json") {
2741
3048
  console.log(JSON.stringify(kws, null, 2));
@@ -2778,7 +3085,7 @@ async function importKeywords(project, filePath, format) {
2778
3085
  console.log("No key phrases found in file.");
2779
3086
  return;
2780
3087
  }
2781
- const client = getClient6();
3088
+ const client = getClient7();
2782
3089
  await client.appendKeywords(project, keywords);
2783
3090
  if (format === "json") {
2784
3091
  console.log(JSON.stringify({
@@ -2792,7 +3099,7 @@ async function importKeywords(project, filePath, format) {
2792
3099
  console.log(`Imported ${keywords.length} key phrase(s) to "${project}".`);
2793
3100
  }
2794
3101
  async function generateKeywords(project, provider, opts) {
2795
- const client = getClient6();
3102
+ const client = getClient7();
2796
3103
  const result = await client.generateKeywords(project, provider, opts.count);
2797
3104
  const saved = Boolean(opts.save && result.keywords.length > 0);
2798
3105
  if (opts.format !== "json") {
@@ -2946,11 +3253,11 @@ var KEYWORD_CLI_COMMANDS = [
2946
3253
  ];
2947
3254
 
2948
3255
  // src/commands/notify.ts
2949
- function getClient7() {
3256
+ function getClient8() {
2950
3257
  return createApiClient();
2951
3258
  }
2952
3259
  async function addNotification(project, opts) {
2953
- const client = getClient7();
3260
+ const client = getClient8();
2954
3261
  const result = await client.createNotification(project, {
2955
3262
  channel: "webhook",
2956
3263
  url: opts.webhook,
@@ -2964,7 +3271,7 @@ async function addNotification(project, opts) {
2964
3271
  printNotification(result);
2965
3272
  }
2966
3273
  async function listNotifications(project, format) {
2967
- const client = getClient7();
3274
+ const client = getClient8();
2968
3275
  const results = await client.listNotifications(project);
2969
3276
  if (format === "json") {
2970
3277
  console.log(JSON.stringify(results, null, 2));
@@ -2982,7 +3289,7 @@ async function listNotifications(project, format) {
2982
3289
  }
2983
3290
  }
2984
3291
  async function removeNotification(project, id, format) {
2985
- const client = getClient7();
3292
+ const client = getClient8();
2986
3293
  await client.deleteNotification(project, id);
2987
3294
  if (format === "json") {
2988
3295
  console.log(JSON.stringify({ project, id, removed: true }, null, 2));
@@ -2991,7 +3298,7 @@ async function removeNotification(project, id, format) {
2991
3298
  console.log(`Notification ${id} removed from "${project}"`);
2992
3299
  }
2993
3300
  async function testNotification(project, id, format) {
2994
- const client = getClient7();
3301
+ const client = getClient8();
2995
3302
  const result = await client.testNotification(project, id);
2996
3303
  if (format === "json") {
2997
3304
  console.log(JSON.stringify({ project, id, ...result }, null, 2));
@@ -3182,11 +3489,11 @@ async function applyConfigs(filePaths, format) {
3182
3489
  }
3183
3490
 
3184
3491
  // src/commands/analytics.ts
3185
- function getClient8() {
3492
+ function getClient9() {
3186
3493
  return createApiClient();
3187
3494
  }
3188
3495
  async function showAnalytics(project, options) {
3189
- const client = getClient8();
3496
+ const client = getClient9();
3190
3497
  const features = options.feature ? [options.feature] : ["metrics", "gaps", "sources"];
3191
3498
  const results = {};
3192
3499
  for (const feature of features) {
@@ -3289,11 +3596,11 @@ Source Origin Breakdown`);
3289
3596
  }
3290
3597
 
3291
3598
  // src/commands/evidence.ts
3292
- function getClient9() {
3599
+ function getClient10() {
3293
3600
  return createApiClient();
3294
3601
  }
3295
3602
  async function showEvidence(project, format) {
3296
- const client = getClient9();
3603
+ const client = getClient10();
3297
3604
  const timeline = await client.getTimeline(project);
3298
3605
  if (format === "json") {
3299
3606
  const enriched = timeline.map((entry) => ({
@@ -3353,11 +3660,11 @@ async function loadLatestRunForExport(client, project) {
3353
3660
  }
3354
3661
 
3355
3662
  // src/commands/history.ts
3356
- function getClient10() {
3663
+ function getClient11() {
3357
3664
  return createApiClient();
3358
3665
  }
3359
3666
  async function showHistory(project, format) {
3360
- const client = getClient10();
3667
+ const client = getClient11();
3361
3668
  try {
3362
3669
  const entries = await client.getHistory(project);
3363
3670
  if (format === "json") {
@@ -3392,11 +3699,11 @@ async function showHistory(project, format) {
3392
3699
  }
3393
3700
 
3394
3701
  // src/commands/status.ts
3395
- function getClient11() {
3702
+ function getClient12() {
3396
3703
  return createApiClient();
3397
3704
  }
3398
3705
  async function showStatus(project, format) {
3399
- const client = getClient11();
3706
+ const client = getClient12();
3400
3707
  const projectData = await client.getProject(project);
3401
3708
  const latest = await getLatestRunSummary(client, project);
3402
3709
  if (format === "json") {
@@ -3527,11 +3834,11 @@ var OPERATOR_CLI_COMMANDS = [
3527
3834
  ];
3528
3835
 
3529
3836
  // src/commands/project.ts
3530
- function getClient12() {
3837
+ function getClient13() {
3531
3838
  return createApiClient();
3532
3839
  }
3533
3840
  async function createProject(name, opts) {
3534
- const client = getClient12();
3841
+ const client = getClient13();
3535
3842
  const result = await client.putProject(name, {
3536
3843
  displayName: opts.displayName,
3537
3844
  canonicalDomain: opts.domain,
@@ -3546,7 +3853,7 @@ async function createProject(name, opts) {
3546
3853
  console.log(`Project created: ${result.name} (${result.id})`);
3547
3854
  }
3548
3855
  async function listProjects(format) {
3549
- const client = getClient12();
3856
+ const client = getClient13();
3550
3857
  const projects2 = await client.listProjects();
3551
3858
  if (format === "json") {
3552
3859
  console.log(JSON.stringify(projects2, null, 2));
@@ -3574,7 +3881,7 @@ async function listProjects(format) {
3574
3881
  }
3575
3882
  }
3576
3883
  async function showProject(name, format) {
3577
- const client = getClient12();
3884
+ const client = getClient13();
3578
3885
  const project = await client.getProject(name);
3579
3886
  if (format === "json") {
3580
3887
  console.log(JSON.stringify(project, null, 2));
@@ -3600,7 +3907,7 @@ async function showProject(name, format) {
3600
3907
  if (project.updatedAt) console.log(` Updated: ${project.updatedAt}`);
3601
3908
  }
3602
3909
  async function updateProjectSettings(name, opts) {
3603
- const client = getClient12();
3910
+ const client = getClient13();
3604
3911
  const project = await client.getProject(name);
3605
3912
  let ownedDomains = opts.ownedDomains ?? project.ownedDomains ?? [];
3606
3913
  if (opts.addOwnedDomain) {
@@ -3625,7 +3932,7 @@ async function updateProjectSettings(name, opts) {
3625
3932
  console.log(`Project updated: ${result.name}`);
3626
3933
  }
3627
3934
  async function deleteProject(name, format) {
3628
- const client = getClient12();
3935
+ const client = getClient13();
3629
3936
  await client.deleteProject(name);
3630
3937
  if (format === "json") {
3631
3938
  console.log(JSON.stringify({ name, deleted: true }, null, 2));
@@ -3634,7 +3941,7 @@ async function deleteProject(name, format) {
3634
3941
  console.log(`Project deleted: ${name}`);
3635
3942
  }
3636
3943
  async function addLocation(project, opts) {
3637
- const client = getClient12();
3944
+ const client = getClient13();
3638
3945
  const location = await client.addLocation(project, {
3639
3946
  label: opts.label,
3640
3947
  city: opts.city,
@@ -3649,7 +3956,7 @@ async function addLocation(project, opts) {
3649
3956
  console.log(`Location added: ${opts.label} (${opts.city}, ${opts.region}, ${opts.country})`);
3650
3957
  }
3651
3958
  async function listLocations(project, format) {
3652
- const client = getClient12();
3959
+ const client = getClient13();
3653
3960
  const result = await client.listLocations(project);
3654
3961
  if (format === "json") {
3655
3962
  console.log(JSON.stringify(result, null, 2));
@@ -3675,7 +3982,7 @@ async function listLocations(project, format) {
3675
3982
  }
3676
3983
  }
3677
3984
  async function removeLocation(project, label, format) {
3678
- const client = getClient12();
3985
+ const client = getClient13();
3679
3986
  await client.removeLocation(project, label);
3680
3987
  if (format === "json") {
3681
3988
  console.log(JSON.stringify({ project, label, removed: true }, null, 2));
@@ -3684,7 +3991,7 @@ async function removeLocation(project, label, format) {
3684
3991
  console.log(`Location removed: ${label}`);
3685
3992
  }
3686
3993
  async function setDefaultLocation(project, label, format) {
3687
- const client = getClient12();
3994
+ const client = getClient13();
3688
3995
  const result = await client.setDefaultLocation(project, label);
3689
3996
  if (format === "json") {
3690
3997
  console.log(JSON.stringify({ project, ...result }, null, 2));
@@ -3863,12 +4170,12 @@ var PROJECT_CLI_COMMANDS = [
3863
4170
  ];
3864
4171
 
3865
4172
  // src/commands/run.ts
3866
- function getClient13() {
4173
+ function getClient14() {
3867
4174
  return createApiClient();
3868
4175
  }
3869
4176
  var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "partial", "failed", "cancelled"]);
3870
4177
  async function triggerRun(project, opts) {
3871
- const client = getClient13();
4178
+ const client = getClient14();
3872
4179
  const body = {};
3873
4180
  if (opts?.provider) {
3874
4181
  const providerInputs = opts.provider.split(",").map((s) => s.trim()).filter(Boolean);
@@ -3892,7 +4199,7 @@ async function triggerRun(project, opts) {
3892
4199
  const settled = await Promise.all(
3893
4200
  locationRuns.map(async (r) => {
3894
4201
  if (!r.id || r.status === "conflict") return r;
3895
- const final = await pollRun(client, r.id);
4202
+ const final = await pollRun2(client, r.id);
3896
4203
  return { ...r, ...final };
3897
4204
  })
3898
4205
  );
@@ -3917,7 +4224,7 @@ async function triggerRun(project, opts) {
3917
4224
  process.stderr.write(`Waiting for ${pending.length} run(s)`);
3918
4225
  await Promise.all(
3919
4226
  pending.map(async (r) => {
3920
- const final = await pollRun(client, r.id);
4227
+ const final = await pollRun2(client, r.id);
3921
4228
  r.status = final.status;
3922
4229
  })
3923
4230
  );
@@ -3934,7 +4241,7 @@ async function triggerRun(project, opts) {
3934
4241
  const run = response;
3935
4242
  if (opts?.wait && run.id && !TERMINAL_STATUSES.has(run.status)) {
3936
4243
  process.stderr.write(`Run ${run.id} started`);
3937
- const result = await pollRun(client, run.id);
4244
+ const result = await pollRun2(client, run.id);
3938
4245
  if (opts?.format === "json") {
3939
4246
  console.log(JSON.stringify(result, null, 2));
3940
4247
  } else {
@@ -3964,7 +4271,7 @@ async function triggerRun(project, opts) {
3964
4271
  }
3965
4272
  }
3966
4273
  async function triggerRunAll(opts) {
3967
- const client = getClient13();
4274
+ const client = getClient14();
3968
4275
  const projects2 = await client.listProjects();
3969
4276
  if (projects2.length === 0) {
3970
4277
  if (opts?.format === "json") {
@@ -4001,7 +4308,7 @@ async function triggerRunAll(opts) {
4001
4308
  if (pending.length > 0) {
4002
4309
  process.stderr.write(`Waiting for ${pending.length} run(s)`);
4003
4310
  await Promise.all(pending.map(async (r) => {
4004
- const final = await pollRun(client, r.runId);
4311
+ const final = await pollRun2(client, r.runId);
4005
4312
  r.status = final.status;
4006
4313
  }));
4007
4314
  process.stderr.write("\n");
@@ -4022,7 +4329,7 @@ async function triggerRunAll(opts) {
4022
4329
  }
4023
4330
  }
4024
4331
  async function cancelRun(project, runId, format) {
4025
- const client = getClient13();
4332
+ const client = getClient14();
4026
4333
  let targetId = runId;
4027
4334
  if (!targetId) {
4028
4335
  const runs2 = await client.listRuns(project);
@@ -4054,7 +4361,7 @@ To cancel by ID : canonry run cancel ${project} <run-id>`,
4054
4361
  console.log(`Run ${result.id} cancelled.`);
4055
4362
  }
4056
4363
  async function showRun(id, format) {
4057
- const client = getClient13();
4364
+ const client = getClient14();
4058
4365
  const run = await client.getRun(id);
4059
4366
  if (format === "json") {
4060
4367
  console.log(JSON.stringify(run, null, 2));
@@ -4063,7 +4370,7 @@ async function showRun(id, format) {
4063
4370
  printRunDetail(run);
4064
4371
  }
4065
4372
  async function listRuns(project, opts) {
4066
- const client = getClient13();
4373
+ const client = getClient14();
4067
4374
  const runs2 = await client.listRuns(project, opts?.limit);
4068
4375
  if (opts?.format === "json") {
4069
4376
  console.log(JSON.stringify(runs2, null, 2));
@@ -4084,7 +4391,7 @@ async function listRuns(project, opts) {
4084
4391
  }
4085
4392
  }
4086
4393
  var POLL_TIMEOUT_MS = 10 * 60 * 1e3;
4087
- async function pollRun(client, runId) {
4394
+ async function pollRun2(client, runId) {
4088
4395
  const deadline = Date.now() + POLL_TIMEOUT_MS;
4089
4396
  for (; ; ) {
4090
4397
  await new Promise((r) => setTimeout(r, 2e3));
@@ -4208,11 +4515,11 @@ var RUN_CLI_COMMANDS = [
4208
4515
  ];
4209
4516
 
4210
4517
  // src/commands/schedule.ts
4211
- function getClient14() {
4518
+ function getClient15() {
4212
4519
  return createApiClient();
4213
4520
  }
4214
4521
  async function setSchedule(project, opts) {
4215
- const client = getClient14();
4522
+ const client = getClient15();
4216
4523
  const body = {};
4217
4524
  if (opts.preset) body.preset = opts.preset;
4218
4525
  if (opts.cron) body.cron = opts.cron;
@@ -4227,7 +4534,7 @@ async function setSchedule(project, opts) {
4227
4534
  printSchedule(result);
4228
4535
  }
4229
4536
  async function showSchedule(project, format) {
4230
- const client = getClient14();
4537
+ const client = getClient15();
4231
4538
  const result = await client.getSchedule(project);
4232
4539
  if (format === "json") {
4233
4540
  console.log(JSON.stringify(result, null, 2));
@@ -4236,7 +4543,7 @@ async function showSchedule(project, format) {
4236
4543
  printSchedule(result);
4237
4544
  }
4238
4545
  async function enableSchedule(project, format) {
4239
- const client = getClient14();
4546
+ const client = getClient15();
4240
4547
  const current = await client.getSchedule(project);
4241
4548
  const body = { timezone: current.timezone, enabled: true };
4242
4549
  if (current.preset) body.preset = current.preset;
@@ -4250,7 +4557,7 @@ async function enableSchedule(project, format) {
4250
4557
  console.log(`Schedule enabled for "${project}"`);
4251
4558
  }
4252
4559
  async function disableSchedule(project, format) {
4253
- const client = getClient14();
4560
+ const client = getClient15();
4254
4561
  const current = await client.getSchedule(project);
4255
4562
  const body = { timezone: current.timezone, enabled: false };
4256
4563
  if (current.preset) body.preset = current.preset;
@@ -4264,7 +4571,7 @@ async function disableSchedule(project, format) {
4264
4571
  console.log(`Schedule disabled for "${project}"`);
4265
4572
  }
4266
4573
  async function removeSchedule(project, format) {
4267
- const client = getClient14();
4574
+ const client = getClient15();
4268
4575
  await client.deleteSchedule(project);
4269
4576
  if (format === "json") {
4270
4577
  console.log(JSON.stringify({ project, removed: true }, null, 2));
@@ -4371,11 +4678,11 @@ var SCHEDULE_CLI_COMMANDS = [
4371
4678
  ];
4372
4679
 
4373
4680
  // src/commands/settings.ts
4374
- function getClient15() {
4681
+ function getClient16() {
4375
4682
  return createApiClient();
4376
4683
  }
4377
4684
  async function setProvider(name, opts) {
4378
- const client = getClient15();
4685
+ const client = getClient16();
4379
4686
  const { format, ...payload } = opts;
4380
4687
  const result = await client.updateProvider(name, payload);
4381
4688
  if (format === "json") {
@@ -4391,7 +4698,7 @@ async function setProvider(name, opts) {
4391
4698
  }
4392
4699
  }
4393
4700
  async function showSettings(format) {
4394
- const client = getClient15();
4701
+ const client = getClient16();
4395
4702
  const config = loadConfig();
4396
4703
  const settings = await client.getSettings();
4397
4704
  if (format === "json") {
@@ -4894,7 +5201,7 @@ function wrapText(font, text, size, maxWidth) {
4894
5201
  }
4895
5202
 
4896
5203
  // src/commands/snapshot.ts
4897
- function getClient16() {
5204
+ function getClient17() {
4898
5205
  return createApiClient();
4899
5206
  }
4900
5207
  function slugify(value) {
@@ -4905,7 +5212,7 @@ function autoOutputPath(companyName, ext) {
4905
5212
  return `${slugify(companyName)}-snapshot-${date}.${ext}`;
4906
5213
  }
4907
5214
  async function createSnapshotReport(companyName, opts) {
4908
- const client = getClient16();
5215
+ const client = getClient17();
4909
5216
  const report = await client.createSnapshot({
4910
5217
  companyName,
4911
5218
  domain: opts.domain,
@@ -6198,10 +6505,10 @@ var SYSTEM_CLI_COMMANDS = [
6198
6505
  import fs7 from "fs";
6199
6506
 
6200
6507
  // src/commands/wordpress.ts
6201
- function getClient17() {
6508
+ function getClient18() {
6202
6509
  return createApiClient();
6203
6510
  }
6204
- function printJson(value) {
6511
+ function printJson2(value) {
6205
6512
  console.log(JSON.stringify(value, null, 2));
6206
6513
  }
6207
6514
  function printSiteStatus(label, status) {
@@ -6345,7 +6652,7 @@ async function wordpressConnect(project, opts) {
6345
6652
  details: { project }
6346
6653
  });
6347
6654
  }
6348
- const client = getClient17();
6655
+ const client = getClient18();
6349
6656
  const result = await client.wordpressConnect(project, {
6350
6657
  url: opts.url,
6351
6658
  stagingUrl: opts.stagingUrl,
@@ -6354,7 +6661,7 @@ async function wordpressConnect(project, opts) {
6354
6661
  defaultEnv: opts.defaultEnv
6355
6662
  });
6356
6663
  if (opts.format === "json") {
6357
- printJson(result);
6664
+ printJson2(result);
6358
6665
  return;
6359
6666
  }
6360
6667
  console.log(`WordPress connected for project "${project}".
@@ -6362,46 +6669,46 @@ async function wordpressConnect(project, opts) {
6362
6669
  printWordpressStatus(project, result);
6363
6670
  }
6364
6671
  async function wordpressDisconnect(project, format) {
6365
- const client = getClient17();
6672
+ const client = getClient18();
6366
6673
  await client.wordpressDisconnect(project);
6367
6674
  if (format === "json") {
6368
- printJson({ project, disconnected: true });
6675
+ printJson2({ project, disconnected: true });
6369
6676
  return;
6370
6677
  }
6371
6678
  console.log(`WordPress disconnected from project "${project}".`);
6372
6679
  }
6373
6680
  async function wordpressStatus(project, format) {
6374
- const client = getClient17();
6681
+ const client = getClient18();
6375
6682
  const result = await client.wordpressStatus(project);
6376
6683
  if (format === "json") {
6377
- printJson(result);
6684
+ printJson2(result);
6378
6685
  return;
6379
6686
  }
6380
6687
  printWordpressStatus(project, result);
6381
6688
  }
6382
6689
  async function wordpressPages(project, opts) {
6383
- const client = getClient17();
6690
+ const client = getClient18();
6384
6691
  const result = await client.wordpressPages(project, opts.env);
6385
6692
  if (opts.format === "json") {
6386
- printJson(result);
6693
+ printJson2(result);
6387
6694
  return;
6388
6695
  }
6389
6696
  printPages(project, result.env, result.pages);
6390
6697
  }
6391
6698
  async function wordpressPage(project, slug, opts) {
6392
- const client = getClient17();
6699
+ const client = getClient18();
6393
6700
  const result = await client.wordpressPage(project, slug, opts.env);
6394
6701
  if (opts.format === "json") {
6395
- printJson(result);
6702
+ printJson2(result);
6396
6703
  return;
6397
6704
  }
6398
6705
  printPageDetail(result);
6399
6706
  }
6400
6707
  async function wordpressCreatePage(project, body) {
6401
- const client = getClient17();
6708
+ const client = getClient18();
6402
6709
  const result = await client.wordpressCreatePage(project, body);
6403
6710
  if (body.format === "json") {
6404
- printJson(result);
6711
+ printJson2(result);
6405
6712
  return;
6406
6713
  }
6407
6714
  console.log(`Created WordPress page "${result.slug}" in ${result.env}.
@@ -6409,10 +6716,10 @@ async function wordpressCreatePage(project, body) {
6409
6716
  printPageDetail(result);
6410
6717
  }
6411
6718
  async function wordpressUpdatePage(project, body) {
6412
- const client = getClient17();
6719
+ const client = getClient18();
6413
6720
  const result = await client.wordpressUpdatePage(project, body);
6414
6721
  if (body.format === "json") {
6415
- printJson(result);
6722
+ printJson2(result);
6416
6723
  return;
6417
6724
  }
6418
6725
  console.log(`Updated WordPress page "${body.currentSlug}" in ${result.env}.
@@ -6420,10 +6727,10 @@ async function wordpressUpdatePage(project, body) {
6420
6727
  printPageDetail(result);
6421
6728
  }
6422
6729
  async function wordpressSetMeta(project, body) {
6423
- const client = getClient17();
6730
+ const client = getClient18();
6424
6731
  const result = await client.wordpressSetMeta(project, body);
6425
6732
  if (body.format === "json") {
6426
- printJson(result);
6733
+ printJson2(result);
6427
6734
  return;
6428
6735
  }
6429
6736
  console.log(`Updated SEO meta for "${body.slug}" in ${result.env}.
@@ -6470,10 +6777,10 @@ async function wordpressBulkSetMeta(project, opts) {
6470
6777
  details: { path: filePath }
6471
6778
  });
6472
6779
  }
6473
- const client = getClient17();
6780
+ const client = getClient18();
6474
6781
  const result = await client.wordpressBulkSetMeta(project, { entries, env: opts.env });
6475
6782
  if (opts.format === "json") {
6476
- printJson(result);
6783
+ printJson2(result);
6477
6784
  return;
6478
6785
  }
6479
6786
  const applied = result.results.filter((r) => r.status === "applied");
@@ -6513,10 +6820,10 @@ async function wordpressBulkSetMeta(project, opts) {
6513
6820
  Total: ${applied.length} applied, ${skipped.length} skipped, ${manual.length} manual`);
6514
6821
  }
6515
6822
  async function wordpressSchema(project, slug, opts) {
6516
- const client = getClient17();
6823
+ const client = getClient18();
6517
6824
  const result = await client.wordpressSchema(project, slug, opts.env);
6518
6825
  if (opts.format === "json") {
6519
- printJson(result);
6826
+ printJson2(result);
6520
6827
  return;
6521
6828
  }
6522
6829
  console.log(`Schema for "${slug}" (${result.env}):
@@ -6524,10 +6831,10 @@ async function wordpressSchema(project, slug, opts) {
6524
6831
  printSchemaBlocks(result.blocks);
6525
6832
  }
6526
6833
  async function wordpressSetSchema(project, body) {
6527
- const client = getClient17();
6834
+ const client = getClient18();
6528
6835
  const result = await client.wordpressSetSchema(project, body);
6529
6836
  if (body.format === "json") {
6530
- printJson(result);
6837
+ printJson2(result);
6531
6838
  return;
6532
6839
  }
6533
6840
  printManualAssist(`Schema update for "${body.slug}"`, result);
@@ -6572,10 +6879,10 @@ async function wordpressSchemaDeploy(project, opts) {
6572
6879
  details: { path: filePath }
6573
6880
  });
6574
6881
  }
6575
- const client = getClient17();
6882
+ const client = getClient18();
6576
6883
  const result = await client.wordpressSchemaDeploy(project, { profile: parsed, env: opts.env });
6577
6884
  if (opts.format === "json") {
6578
- printJson(result);
6885
+ printJson2(result);
6579
6886
  return;
6580
6887
  }
6581
6888
  console.log(`Schema deploy (${result.env}):
@@ -6611,10 +6918,10 @@ async function wordpressSchemaDeploy(project, opts) {
6611
6918
  Total: ${deployed} deployed, ${stripped} stripped, ${skipped} skipped, ${failed} failed`);
6612
6919
  }
6613
6920
  async function wordpressSchemaStatus(project, opts) {
6614
- const client = getClient17();
6921
+ const client = getClient18();
6615
6922
  const result = await client.wordpressSchemaStatus(project, opts.env);
6616
6923
  if (opts.format === "json") {
6617
- printJson(result);
6924
+ printJson2(result);
6618
6925
  return;
6619
6926
  }
6620
6927
  console.log(`Schema status (${result.env}):
@@ -6670,7 +6977,7 @@ async function wordpressOnboard(project, opts) {
6670
6977
  });
6671
6978
  }
6672
6979
  }
6673
- const client = getClient17();
6980
+ const client = getClient18();
6674
6981
  const result = await client.wordpressOnboard(project, {
6675
6982
  url: opts.url,
6676
6983
  username: opts.user,
@@ -6682,7 +6989,7 @@ async function wordpressOnboard(project, opts) {
6682
6989
  skipSubmit: opts.skipSubmit
6683
6990
  });
6684
6991
  if (opts.format === "json") {
6685
- printJson(result);
6992
+ printJson2(result);
6686
6993
  return;
6687
6994
  }
6688
6995
  console.log(`WordPress onboarding for "${project}":
@@ -6695,10 +7002,10 @@ async function wordpressOnboard(project, opts) {
6695
7002
  }
6696
7003
  }
6697
7004
  async function wordpressLlmsTxt(project, opts) {
6698
- const client = getClient17();
7005
+ const client = getClient18();
6699
7006
  const result = await client.wordpressLlmsTxt(project, opts.env);
6700
7007
  if (opts.format === "json") {
6701
- printJson(result);
7008
+ printJson2(result);
6702
7009
  return;
6703
7010
  }
6704
7011
  console.log(`llms.txt for "${project}" (${result.env}): ${result.url}
@@ -6706,19 +7013,19 @@ async function wordpressLlmsTxt(project, opts) {
6706
7013
  console.log(result.content ?? "(not found)");
6707
7014
  }
6708
7015
  async function wordpressSetLlmsTxt(project, body) {
6709
- const client = getClient17();
7016
+ const client = getClient18();
6710
7017
  const result = await client.wordpressSetLlmsTxt(project, body);
6711
7018
  if (body.format === "json") {
6712
- printJson(result);
7019
+ printJson2(result);
6713
7020
  return;
6714
7021
  }
6715
7022
  printManualAssist(`llms.txt update for "${project}"`, result);
6716
7023
  }
6717
7024
  async function wordpressAudit(project, opts) {
6718
- const client = getClient17();
7025
+ const client = getClient18();
6719
7026
  const result = await client.wordpressAudit(project, opts.env);
6720
7027
  if (opts.format === "json") {
6721
- printJson(result);
7028
+ printJson2(result);
6722
7029
  return;
6723
7030
  }
6724
7031
  console.log(`WordPress audit for "${project}" (${result.env}):
@@ -6729,19 +7036,19 @@ async function wordpressAudit(project, opts) {
6729
7036
  printAuditIssues(result.issues);
6730
7037
  }
6731
7038
  async function wordpressDiff(project, slug, format) {
6732
- const client = getClient17();
7039
+ const client = getClient18();
6733
7040
  const result = await client.wordpressDiff(project, slug);
6734
7041
  if (format === "json") {
6735
- printJson(result);
7042
+ printJson2(result);
6736
7043
  return;
6737
7044
  }
6738
7045
  printDiff(result);
6739
7046
  }
6740
7047
  async function wordpressStagingStatus(project, format) {
6741
- const client = getClient17();
7048
+ const client = getClient18();
6742
7049
  const result = await client.wordpressStagingStatus(project);
6743
7050
  if (format === "json") {
6744
- printJson(result);
7051
+ printJson2(result);
6745
7052
  return;
6746
7053
  }
6747
7054
  console.log(`WordPress staging status for "${project}":
@@ -6752,10 +7059,10 @@ async function wordpressStagingStatus(project, format) {
6752
7059
  console.log(` Admin URL: ${result.adminUrl}`);
6753
7060
  }
6754
7061
  async function wordpressStagingPush(project, format) {
6755
- const client = getClient17();
7062
+ const client = getClient18();
6756
7063
  const result = await client.wordpressStagingPush(project);
6757
7064
  if (format === "json") {
6758
- printJson(result);
7065
+ printJson2(result);
6759
7066
  return;
6760
7067
  }
6761
7068
  printManualAssist(`Staging push for "${project}"`, result);
@@ -7718,6 +8025,7 @@ Usage: ${usage}`, {
7718
8025
  // src/cli-commands.ts
7719
8026
  var REGISTERED_CLI_COMMANDS = [
7720
8027
  ...BACKFILL_CLI_COMMANDS,
8028
+ ...BACKLINKS_CLI_COMMANDS,
7721
8029
  ...SYSTEM_CLI_COMMANDS,
7722
8030
  ...PROJECT_CLI_COMMANDS,
7723
8031
  ...KEYWORD_CLI_COMMANDS,