@canonry/canonry 4.129.1 → 4.130.0
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/README.md +1 -0
- package/assets/assets/{AuditHistoryPanel-wJqs99Ak.js → AuditHistoryPanel-Ydzb2Y_Y.js} +1 -1
- package/assets/assets/BacklinksPage-DYodEusK.js +1 -0
- package/assets/assets/{ChartPrimitives-DSr5ldMf.js → ChartPrimitives-D67hsnF7.js} +1 -1
- package/assets/assets/{HistoryPage-Ca-GGnTI.js → HistoryPage-_h9ITL1w.js} +1 -1
- package/assets/assets/ProjectPage-fCJKCcHE.js +8 -0
- package/assets/assets/{RunRow-O9TbOdQY.js → RunRow-DzUNyTE-.js} +1 -1
- package/assets/assets/{RunsPage-C1Sqd7AN.js → RunsPage-FTvAjptk.js} +1 -1
- package/assets/assets/{SettingsPage-DPFh62BV.js → SettingsPage-CvgpYEAt.js} +1 -1
- package/assets/assets/{TrafficPage-5vKoQyoP.js → TrafficPage-qaMW9k6o.js} +1 -1
- package/assets/assets/{TrafficSourceDetailPage-D17oADs8.js → TrafficSourceDetailPage-CRCso7_A.js} +1 -1
- package/assets/assets/{arrow-left-De5P5AIE.js → arrow-left-C--lHdP2.js} +1 -1
- package/assets/assets/{extract-error-message-BqMd-fQ6.js → extract-error-message-DVqYbKpB.js} +1 -1
- package/assets/assets/index-CdXn0JEf.js +210 -0
- package/assets/assets/{index-jymsMBpZ.css → index-JhX-wfQO.css} +1 -1
- package/assets/assets/trash-2-CyKRU3tR.js +1 -0
- package/assets/index.html +2 -2
- package/dist/{chunk-LPEE5AYY.js → chunk-5XU6WEMK.js} +649 -298
- package/dist/{chunk-K4FDDCYG.js → chunk-NVRJZU6V.js} +2742 -2626
- package/dist/{chunk-GYAKRVE2.js → chunk-QR5U2K3O.js} +508 -355
- package/dist/{chunk-WWZE7VDQ.js → chunk-WIALMCXM.js} +118 -1
- package/dist/cli.js +432 -182
- package/dist/index.js +4 -4
- package/dist/{intelligence-service-2QBAGT5X.js → intelligence-service-53GUE6EI.js} +2 -2
- package/dist/mcp.js +5 -5
- package/package.json +8 -8
- package/assets/assets/BacklinksPage-BBDExYo_.js +0 -1
- package/assets/assets/ProjectPage-BuaSDSwf.js +0 -7
- package/assets/assets/index-C1ABEgkr.js +0 -210
- package/assets/assets/trash-2-6ZpABj9G.js +0 -1
package/dist/cli.js
CHANGED
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
setTelemetrySource,
|
|
30
30
|
showFirstRunNotice,
|
|
31
31
|
trackEvent
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-QR5U2K3O.js";
|
|
33
33
|
import {
|
|
34
34
|
CliError,
|
|
35
35
|
EXIT_SYSTEM_ERROR,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
saveConfig,
|
|
47
47
|
saveConfigPatch,
|
|
48
48
|
usageError
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-WIALMCXM.js";
|
|
50
50
|
import {
|
|
51
51
|
apiKeys,
|
|
52
52
|
createClient,
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
projects,
|
|
55
55
|
queries,
|
|
56
56
|
renderReportHtml
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-5XU6WEMK.js";
|
|
58
58
|
import {
|
|
59
59
|
AdsOperationKinds,
|
|
60
60
|
AdsOperationStates,
|
|
@@ -66,6 +66,7 @@ import {
|
|
|
66
66
|
CitationStates,
|
|
67
67
|
READ_ONLY_SCOPE,
|
|
68
68
|
REPORT_PERIOD_OPTIONS,
|
|
69
|
+
ResearchRunStatuses,
|
|
69
70
|
RunStatuses,
|
|
70
71
|
TrafficEventKinds,
|
|
71
72
|
TrafficSeriesGranularities,
|
|
@@ -96,7 +97,7 @@ import {
|
|
|
96
97
|
providerQuotaPolicySchema,
|
|
97
98
|
resolveProviderInput,
|
|
98
99
|
winnabilityClassSchema
|
|
99
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-NVRJZU6V.js";
|
|
100
101
|
|
|
101
102
|
// src/cli.ts
|
|
102
103
|
import { pathToFileURL } from "url";
|
|
@@ -2574,6 +2575,254 @@ var DISCOVER_CLI_COMMANDS = [
|
|
|
2574
2575
|
}
|
|
2575
2576
|
];
|
|
2576
2577
|
|
|
2578
|
+
// src/commands/research.ts
|
|
2579
|
+
var TERMINAL_RESEARCH_STATUSES = /* @__PURE__ */ new Set([
|
|
2580
|
+
ResearchRunStatuses.completed,
|
|
2581
|
+
ResearchRunStatuses.partial,
|
|
2582
|
+
ResearchRunStatuses.failed
|
|
2583
|
+
]);
|
|
2584
|
+
var POLL_INTERVAL_MS3 = 2e3;
|
|
2585
|
+
var POLL_TIMEOUT_MS2 = 15 * 60 * 1e3;
|
|
2586
|
+
function getClient5() {
|
|
2587
|
+
return createApiClient();
|
|
2588
|
+
}
|
|
2589
|
+
async function researchRun(project, opts) {
|
|
2590
|
+
const client = getClient5();
|
|
2591
|
+
const request = {
|
|
2592
|
+
queries: opts.queries,
|
|
2593
|
+
provider: opts.provider,
|
|
2594
|
+
model: opts.model,
|
|
2595
|
+
location: opts.location,
|
|
2596
|
+
idempotencyKey: opts.idempotencyKey
|
|
2597
|
+
};
|
|
2598
|
+
const started = await client.startResearchRun(project, request);
|
|
2599
|
+
if (!opts.wait) {
|
|
2600
|
+
if (opts.format === "jsonl") {
|
|
2601
|
+
emitJsonl([{ project, ...started }]);
|
|
2602
|
+
return;
|
|
2603
|
+
}
|
|
2604
|
+
if (opts.format === "json") {
|
|
2605
|
+
console.log(JSON.stringify(started, null, 2));
|
|
2606
|
+
return;
|
|
2607
|
+
}
|
|
2608
|
+
printStarted(project, started);
|
|
2609
|
+
return;
|
|
2610
|
+
}
|
|
2611
|
+
const detail = await pollResearchRun(client, project, started.id, isMachineFormat(opts.format));
|
|
2612
|
+
printDetail(project, detail, opts.format);
|
|
2613
|
+
}
|
|
2614
|
+
async function researchList(project, opts) {
|
|
2615
|
+
const client = getClient5();
|
|
2616
|
+
const { runs } = await client.listResearchRuns(project, opts.limit === void 0 ? void 0 : { limit: opts.limit });
|
|
2617
|
+
if (opts.format === "json") {
|
|
2618
|
+
console.log(JSON.stringify({ runs }, null, 2));
|
|
2619
|
+
return;
|
|
2620
|
+
}
|
|
2621
|
+
if (opts.format === "jsonl") {
|
|
2622
|
+
emitJsonl(runs.map((run) => ({ project, ...run })));
|
|
2623
|
+
return;
|
|
2624
|
+
}
|
|
2625
|
+
if (runs.length === 0) {
|
|
2626
|
+
console.log(`No saved research runs for "${project}".`);
|
|
2627
|
+
return;
|
|
2628
|
+
}
|
|
2629
|
+
console.log(`Research history for "${project}" (${runs.length}):
|
|
2630
|
+
`);
|
|
2631
|
+
console.log(" ID STATUS QUERIES PROVIDER / MODEL CREATED");
|
|
2632
|
+
console.log(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
|
|
2633
|
+
for (const run of runs) {
|
|
2634
|
+
const model = run.resolvedModel ? `${run.provider} / ${run.resolvedModel}` : run.provider;
|
|
2635
|
+
console.log(` ${run.id.padEnd(36)} ${run.status.padEnd(10)} ${String(run.totalQueries).padStart(7)} ${model.slice(0, 32).padEnd(32)} ${run.createdAt}`);
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
async function researchShow(project, runId, opts) {
|
|
2639
|
+
const detail = await getClient5().getResearchRun(project, runId);
|
|
2640
|
+
printDetail(project, detail, opts.format);
|
|
2641
|
+
}
|
|
2642
|
+
async function pollResearchRun(client, project, runId, quiet) {
|
|
2643
|
+
if (!quiet) process.stderr.write(`Waiting for research run ${runId}`);
|
|
2644
|
+
const deadline = Date.now() + POLL_TIMEOUT_MS2;
|
|
2645
|
+
for (; ; ) {
|
|
2646
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS3));
|
|
2647
|
+
if (Date.now() > deadline) {
|
|
2648
|
+
throw new CliError({
|
|
2649
|
+
code: "RESEARCH_TIMEOUT",
|
|
2650
|
+
message: `Timed out waiting for research run ${runId} after ${POLL_TIMEOUT_MS2 / 1e3}s`
|
|
2651
|
+
});
|
|
2652
|
+
}
|
|
2653
|
+
const detail = await client.getResearchRun(project, runId);
|
|
2654
|
+
if (!quiet) process.stderr.write(".");
|
|
2655
|
+
if (TERMINAL_RESEARCH_STATUSES.has(detail.status)) {
|
|
2656
|
+
if (!quiet) process.stderr.write("\n");
|
|
2657
|
+
return detail;
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
function printStarted(project, run) {
|
|
2662
|
+
console.log(`Research run saved: ${run.id}`);
|
|
2663
|
+
console.log(` Status: ${run.status}`);
|
|
2664
|
+
console.log(` Queries: ${run.totalQueries}`);
|
|
2665
|
+
console.log(` Provider: ${run.provider}${run.resolvedModel ? ` / ${run.resolvedModel}` : ""}`);
|
|
2666
|
+
console.log(` Inspect: canonry research show ${project} ${run.id}`);
|
|
2667
|
+
console.log(" Nothing was added to tracked queries.");
|
|
2668
|
+
}
|
|
2669
|
+
function printDetail(project, detail, format) {
|
|
2670
|
+
if (format === "json") {
|
|
2671
|
+
console.log(JSON.stringify(detail, null, 2));
|
|
2672
|
+
return;
|
|
2673
|
+
}
|
|
2674
|
+
if (format === "jsonl") {
|
|
2675
|
+
emitJsonl(detail.queries.map((query) => ({ project, runId: detail.id, ...query })));
|
|
2676
|
+
return;
|
|
2677
|
+
}
|
|
2678
|
+
console.log(`Research run: ${detail.id}`);
|
|
2679
|
+
console.log(` Status: ${detail.status}`);
|
|
2680
|
+
console.log(` Provider: ${detail.provider}${detail.resolvedModel ? ` / ${detail.resolvedModel}` : ""}`);
|
|
2681
|
+
if (detail.location) console.log(` Location: ${detail.location.label}`);
|
|
2682
|
+
console.log(` Results: ${detail.completedQueries} completed, ${detail.failedQueries} failed, ${detail.totalQueries} total`);
|
|
2683
|
+
if (detail.error) console.log(` Error: ${detail.error}`);
|
|
2684
|
+
console.log(" Nothing was added to tracked queries.");
|
|
2685
|
+
if (detail.queries.length === 0) return;
|
|
2686
|
+
console.log("\n QUERY STATUS CITED MENTIONED");
|
|
2687
|
+
for (const query of detail.queries) {
|
|
2688
|
+
const cited = query.citationState === CitationStates.cited ? "yes" : query.citationState ? "no" : "\u2013";
|
|
2689
|
+
const mentioned = query.answerMentioned === null ? "\u2013" : query.answerMentioned ? "yes" : "no";
|
|
2690
|
+
console.log(` ${query.query.slice(0, 58).padEnd(58)} ${query.status.padEnd(10)} ${cited.padEnd(5)} ${mentioned}`);
|
|
2691
|
+
if (query.error) console.log(` Error: ${query.error}`);
|
|
2692
|
+
if (query.answerText) console.log(` Answer: ${query.answerText}`);
|
|
2693
|
+
if (query.groundingSources.length > 0) {
|
|
2694
|
+
console.log(" Sources:");
|
|
2695
|
+
for (const source of query.groundingSources) {
|
|
2696
|
+
console.log(` - ${source.title ? `${source.title}: ` : ""}${source.uri}`);
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
|
|
2702
|
+
// src/cli-commands/research.ts
|
|
2703
|
+
var RUN_USAGE = "canonry research run <project> <query...> [--query <text>] [--provider <name>] [--model <id>] [--location <label>|--no-location] [--idempotency-key <key>] [--wait] [--format json|jsonl]";
|
|
2704
|
+
function normalizeQueries(input, usage) {
|
|
2705
|
+
const positional = input.positionals.slice(1);
|
|
2706
|
+
const flagged = getStringArray(input.values, "query") ?? [];
|
|
2707
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2708
|
+
const queries2 = [];
|
|
2709
|
+
for (const raw of [...positional, ...flagged]) {
|
|
2710
|
+
const query = raw.trim();
|
|
2711
|
+
const key = query.toLocaleLowerCase();
|
|
2712
|
+
if (query && !seen.has(key)) {
|
|
2713
|
+
seen.add(key);
|
|
2714
|
+
queries2.push(query);
|
|
2715
|
+
}
|
|
2716
|
+
}
|
|
2717
|
+
if (queries2.length === 0) {
|
|
2718
|
+
throw usageError(`Error: at least one research query is required
|
|
2719
|
+
Usage: ${usage}`, {
|
|
2720
|
+
message: "at least one research query is required",
|
|
2721
|
+
details: { command: "research.run", usage }
|
|
2722
|
+
});
|
|
2723
|
+
}
|
|
2724
|
+
if (queries2.length > 50) {
|
|
2725
|
+
throw usageError(`Error: at most 50 research queries are allowed
|
|
2726
|
+
Usage: ${usage}`, {
|
|
2727
|
+
message: "at most 50 research queries are allowed",
|
|
2728
|
+
details: { command: "research.run", usage, queryCount: queries2.length }
|
|
2729
|
+
});
|
|
2730
|
+
}
|
|
2731
|
+
return queries2;
|
|
2732
|
+
}
|
|
2733
|
+
function parseResearchLimit(input, usage) {
|
|
2734
|
+
const limit = parseIntegerOption(input, "limit", {
|
|
2735
|
+
command: "research.list",
|
|
2736
|
+
usage,
|
|
2737
|
+
message: "--limit must be an integer"
|
|
2738
|
+
});
|
|
2739
|
+
if (limit === void 0) return void 0;
|
|
2740
|
+
if (limit >= 1 && limit <= 100) return limit;
|
|
2741
|
+
throw usageError(`Error: --limit must be between 1 and 100
|
|
2742
|
+
Usage: ${usage}`, {
|
|
2743
|
+
message: "--limit must be between 1 and 100",
|
|
2744
|
+
details: { command: "research.list", usage, option: "limit", value: limit }
|
|
2745
|
+
});
|
|
2746
|
+
}
|
|
2747
|
+
async function resolveLocation(project, label, noLocation, usage) {
|
|
2748
|
+
if (label && noLocation) {
|
|
2749
|
+
throw usageError(`Error: --location and --no-location cannot be used together
|
|
2750
|
+
Usage: ${usage}`, {
|
|
2751
|
+
message: "--location and --no-location cannot be used together",
|
|
2752
|
+
details: { command: "research.run", usage }
|
|
2753
|
+
});
|
|
2754
|
+
}
|
|
2755
|
+
if (noLocation) return null;
|
|
2756
|
+
if (!label) return void 0;
|
|
2757
|
+
const configured = await createApiClient().getProject(project);
|
|
2758
|
+
const location = configured.locations.find((candidate) => candidate.label === label);
|
|
2759
|
+
if (location) return location;
|
|
2760
|
+
throw usageError(`Error: location "${label}" is not configured for project "${project}"
|
|
2761
|
+
Usage: ${usage}`, {
|
|
2762
|
+
message: `location "${label}" is not configured for project "${project}"`,
|
|
2763
|
+
details: { command: "research.run", usage, location: label, project }
|
|
2764
|
+
});
|
|
2765
|
+
}
|
|
2766
|
+
var RESEARCH_CLI_COMMANDS = [
|
|
2767
|
+
{
|
|
2768
|
+
path: ["research", "run"],
|
|
2769
|
+
usage: RUN_USAGE,
|
|
2770
|
+
options: {
|
|
2771
|
+
query: multiStringOption(),
|
|
2772
|
+
provider: stringOption(),
|
|
2773
|
+
model: stringOption(),
|
|
2774
|
+
location: stringOption(),
|
|
2775
|
+
"no-location": { type: "boolean", default: false },
|
|
2776
|
+
"idempotency-key": stringOption(),
|
|
2777
|
+
wait: { type: "boolean", default: false }
|
|
2778
|
+
},
|
|
2779
|
+
run: async (input) => {
|
|
2780
|
+
const project = requireProject(input, "research.run", RUN_USAGE);
|
|
2781
|
+
const provider = getString(input.values, "provider")?.trim() || void 0;
|
|
2782
|
+
const model = getString(input.values, "model")?.trim() || void 0;
|
|
2783
|
+
if (model && !provider) {
|
|
2784
|
+
throw usageError(`Error: --model requires --provider
|
|
2785
|
+
Usage: ${RUN_USAGE}`, {
|
|
2786
|
+
message: "--model requires --provider",
|
|
2787
|
+
details: { command: "research.run", usage: RUN_USAGE }
|
|
2788
|
+
});
|
|
2789
|
+
}
|
|
2790
|
+
await researchRun(project, {
|
|
2791
|
+
queries: normalizeQueries(input, RUN_USAGE),
|
|
2792
|
+
provider,
|
|
2793
|
+
model,
|
|
2794
|
+
location: await resolveLocation(project, getString(input.values, "location"), getBoolean(input.values, "no-location"), RUN_USAGE),
|
|
2795
|
+
idempotencyKey: getString(input.values, "idempotency-key")?.trim() || void 0,
|
|
2796
|
+
wait: getBoolean(input.values, "wait"),
|
|
2797
|
+
format: input.format
|
|
2798
|
+
});
|
|
2799
|
+
}
|
|
2800
|
+
},
|
|
2801
|
+
{
|
|
2802
|
+
path: ["research", "list"],
|
|
2803
|
+
usage: "canonry research list <project> [--limit <n>] [--format json|jsonl]",
|
|
2804
|
+
options: { limit: stringOption() },
|
|
2805
|
+
run: async (input) => {
|
|
2806
|
+
const usage = "canonry research list <project> [--limit <n>] [--format json|jsonl]";
|
|
2807
|
+
const project = requireProject(input, "research.list", usage);
|
|
2808
|
+
await researchList(project, {
|
|
2809
|
+
limit: parseResearchLimit(input, usage),
|
|
2810
|
+
format: input.format
|
|
2811
|
+
});
|
|
2812
|
+
}
|
|
2813
|
+
},
|
|
2814
|
+
{
|
|
2815
|
+
path: ["research", "show"],
|
|
2816
|
+
usage: "canonry research show <project> <run-id> [--format json|jsonl]",
|
|
2817
|
+
run: async (input) => {
|
|
2818
|
+
const usage = "canonry research show <project> <run-id> [--format json|jsonl]";
|
|
2819
|
+
const project = requireProject(input, "research.show", usage);
|
|
2820
|
+
const runId = requirePositional(input, 1, { command: "research.show", usage, message: "research run ID is required" });
|
|
2821
|
+
await researchShow(project, runId, { format: input.format });
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
];
|
|
2825
|
+
|
|
2577
2826
|
// src/commands/doctor.ts
|
|
2578
2827
|
async function doctorCommand(opts) {
|
|
2579
2828
|
if (opts.all) {
|
|
@@ -2730,7 +2979,7 @@ var DOCTOR_CLI_COMMANDS = [
|
|
|
2730
2979
|
|
|
2731
2980
|
// src/commands/ads.ts
|
|
2732
2981
|
import fs3 from "fs";
|
|
2733
|
-
function
|
|
2982
|
+
function getClient6() {
|
|
2734
2983
|
return createApiClient();
|
|
2735
2984
|
}
|
|
2736
2985
|
function readRequest(inputPath, schema) {
|
|
@@ -2824,7 +3073,7 @@ async function adsConnect(project, opts) {
|
|
|
2824
3073
|
details: { project }
|
|
2825
3074
|
});
|
|
2826
3075
|
}
|
|
2827
|
-
const client =
|
|
3076
|
+
const client = getClient6();
|
|
2828
3077
|
const result = await client.adsConnect(project, { apiKey: opts.apiKey });
|
|
2829
3078
|
if (isMachineFormat(opts.format)) {
|
|
2830
3079
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2835,7 +3084,7 @@ async function adsConnect(project, opts) {
|
|
|
2835
3084
|
console.log("Schedule daily syncs with: canonry schedule set " + project + " --kind ads-sync --preset daily");
|
|
2836
3085
|
}
|
|
2837
3086
|
async function adsDisconnect(project, opts) {
|
|
2838
|
-
const client =
|
|
3087
|
+
const client = getClient6();
|
|
2839
3088
|
const result = await client.adsDisconnect(project);
|
|
2840
3089
|
if (isMachineFormat(opts?.format)) {
|
|
2841
3090
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2844,7 +3093,7 @@ async function adsDisconnect(project, opts) {
|
|
|
2844
3093
|
console.log(result.disconnected ? `Disconnected the ads connection for ${project}.` : "No ads connection to remove.");
|
|
2845
3094
|
}
|
|
2846
3095
|
async function adsStatus(project, opts) {
|
|
2847
|
-
const client =
|
|
3096
|
+
const client = getClient6();
|
|
2848
3097
|
const result = await client.getAdsStatus(project);
|
|
2849
3098
|
if (isMachineFormat(opts?.format)) {
|
|
2850
3099
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2856,7 +3105,7 @@ async function adsStatus(project, opts) {
|
|
|
2856
3105
|
}
|
|
2857
3106
|
}
|
|
2858
3107
|
async function adsAccount(project, opts) {
|
|
2859
|
-
const result = await
|
|
3108
|
+
const result = await getClient6().getAdsAccount(project);
|
|
2860
3109
|
if (isMachineFormat(opts?.format)) {
|
|
2861
3110
|
console.log(JSON.stringify(result, null, 2));
|
|
2862
3111
|
return;
|
|
@@ -2885,7 +3134,7 @@ async function adsGeoSearch(project, opts) {
|
|
|
2885
3134
|
});
|
|
2886
3135
|
}
|
|
2887
3136
|
const query = parsed.data;
|
|
2888
|
-
const result = await
|
|
3137
|
+
const result = await getClient6().searchAdsGeo(project, query);
|
|
2889
3138
|
if (opts.format === "jsonl") {
|
|
2890
3139
|
emitJsonl(result.results.map((location) => ({ project, query: result.query, ...location })));
|
|
2891
3140
|
return;
|
|
@@ -2904,7 +3153,7 @@ async function adsGeoSearch(project, opts) {
|
|
|
2904
3153
|
}
|
|
2905
3154
|
}
|
|
2906
3155
|
async function adsConversionPixels(project, opts) {
|
|
2907
|
-
const result = await
|
|
3156
|
+
const result = await getClient6().getAdsConversionPixels(project);
|
|
2908
3157
|
if (opts?.format === "jsonl") {
|
|
2909
3158
|
emitJsonl(result.pixels.map((pixel) => ({ project, ...pixel })));
|
|
2910
3159
|
return;
|
|
@@ -2925,7 +3174,7 @@ async function adsConversionPixels(project, opts) {
|
|
|
2925
3174
|
}
|
|
2926
3175
|
}
|
|
2927
3176
|
async function adsConversionEventSettings(project, opts) {
|
|
2928
|
-
const result = await
|
|
3177
|
+
const result = await getClient6().getAdsConversionEventSettings(project);
|
|
2929
3178
|
if (opts?.format === "jsonl") {
|
|
2930
3179
|
emitJsonl(result.eventSettings.map((eventSetting) => ({ project, ...eventSetting })));
|
|
2931
3180
|
return;
|
|
@@ -2950,7 +3199,7 @@ async function adsConversionEventSettings(project, opts) {
|
|
|
2950
3199
|
}
|
|
2951
3200
|
}
|
|
2952
3201
|
async function adsOperationGet(project, opts) {
|
|
2953
|
-
printOperation(await
|
|
3202
|
+
printOperation(await getClient6().getAdsOperation(project, opts.operationKey), opts.format);
|
|
2954
3203
|
}
|
|
2955
3204
|
async function adsOperationsUnresolved(project, opts) {
|
|
2956
3205
|
const query = {
|
|
@@ -2958,7 +3207,7 @@ async function adsOperationsUnresolved(project, opts) {
|
|
|
2958
3207
|
limit: opts?.limit,
|
|
2959
3208
|
cursor: opts?.cursor
|
|
2960
3209
|
};
|
|
2961
|
-
const client =
|
|
3210
|
+
const client = getClient6();
|
|
2962
3211
|
const result = Object.values(query).some((value) => value !== void 0) ? await client.getUnresolvedAdsOperations(project, query) : await client.getUnresolvedAdsOperations(project);
|
|
2963
3212
|
if (opts?.format === "jsonl") {
|
|
2964
3213
|
emitJsonl(result.operations.map((operation) => ({ project, ...operation })));
|
|
@@ -2980,13 +3229,13 @@ async function adsOperationsUnresolved(project, opts) {
|
|
|
2980
3229
|
}
|
|
2981
3230
|
async function adsOperationReconcile(project, opts) {
|
|
2982
3231
|
printReconciliation(
|
|
2983
|
-
await
|
|
3232
|
+
await getClient6().reconcileAdsOperation(project, opts.operationKey),
|
|
2984
3233
|
opts.format
|
|
2985
3234
|
);
|
|
2986
3235
|
}
|
|
2987
3236
|
async function adsOperationResumeActivation(project, opts) {
|
|
2988
3237
|
printActivation(
|
|
2989
|
-
await
|
|
3238
|
+
await getClient6().resumeAdsActivation(project, opts.operationKey),
|
|
2990
3239
|
opts.format
|
|
2991
3240
|
);
|
|
2992
3241
|
}
|
|
@@ -2995,61 +3244,61 @@ async function adsActivationGrantCreate(project, opts) {
|
|
|
2995
3244
|
opts.input,
|
|
2996
3245
|
adsActivationGrantCreateRequestSchema
|
|
2997
3246
|
);
|
|
2998
|
-
printActivationGrant(await
|
|
3247
|
+
printActivationGrant(await getClient6().createAdsActivationGrant(project, request), "Approved", opts.format);
|
|
2999
3248
|
}
|
|
3000
3249
|
async function adsActivationGrantRevoke(project, grantId, opts) {
|
|
3001
3250
|
printActivationGrant(
|
|
3002
|
-
await
|
|
3251
|
+
await getClient6().revokeAdsActivationGrant(project, grantId),
|
|
3003
3252
|
"Revoked",
|
|
3004
3253
|
opts?.format
|
|
3005
3254
|
);
|
|
3006
3255
|
}
|
|
3007
3256
|
async function adsImageUpload(project, opts) {
|
|
3008
3257
|
const request = readRequest(opts.input, adsImageUploadRequestSchema);
|
|
3009
|
-
printOperation(await
|
|
3258
|
+
printOperation(await getClient6().uploadAdsImage(project, request), opts.format);
|
|
3010
3259
|
}
|
|
3011
3260
|
async function adsCampaignCreate(project, opts) {
|
|
3012
3261
|
const request = readRequest(opts.input, adsCampaignCreateRequestSchema);
|
|
3013
|
-
printOperation(await
|
|
3262
|
+
printOperation(await getClient6().createAdsCampaign(project, request), opts.format);
|
|
3014
3263
|
}
|
|
3015
3264
|
async function adsCampaignUpdate(project, campaignId, opts) {
|
|
3016
3265
|
const request = readRequest(opts.input, adsCampaignUpdateRequestSchema);
|
|
3017
|
-
printOperation(await
|
|
3266
|
+
printOperation(await getClient6().updateAdsCampaign(project, campaignId, request), opts.format);
|
|
3018
3267
|
}
|
|
3019
3268
|
async function adsCampaignPause(project, campaignId, opts) {
|
|
3020
3269
|
const request = readRequest(opts.input, adsPauseRequestSchema);
|
|
3021
|
-
printOperation(await
|
|
3270
|
+
printOperation(await getClient6().pauseAdsCampaign(project, campaignId, request), opts.format);
|
|
3022
3271
|
}
|
|
3023
3272
|
async function adsCampaignActivateTree(project, campaignId, opts) {
|
|
3024
3273
|
const request = readRequest(opts.input, adsActivateTreeRequestSchema);
|
|
3025
|
-
printActivation(await
|
|
3274
|
+
printActivation(await getClient6().activateAdsCampaignTree(project, campaignId, request), opts.format);
|
|
3026
3275
|
}
|
|
3027
3276
|
async function adsAdGroupCreate(project, opts) {
|
|
3028
3277
|
const request = readRequest(opts.input, adsAdGroupCreateRequestSchema);
|
|
3029
|
-
printOperation(await
|
|
3278
|
+
printOperation(await getClient6().createAdsAdGroup(project, request), opts.format);
|
|
3030
3279
|
}
|
|
3031
3280
|
async function adsAdGroupUpdate(project, adGroupId, opts) {
|
|
3032
3281
|
const request = readRequest(opts.input, adsAdGroupUpdateRequestSchema);
|
|
3033
|
-
printOperation(await
|
|
3282
|
+
printOperation(await getClient6().updateAdsAdGroup(project, adGroupId, request), opts.format);
|
|
3034
3283
|
}
|
|
3035
3284
|
async function adsAdGroupPause(project, adGroupId, opts) {
|
|
3036
3285
|
const request = readRequest(opts.input, adsPauseRequestSchema);
|
|
3037
|
-
printOperation(await
|
|
3286
|
+
printOperation(await getClient6().pauseAdsAdGroup(project, adGroupId, request), opts.format);
|
|
3038
3287
|
}
|
|
3039
3288
|
async function adsAdCreate(project, opts) {
|
|
3040
3289
|
const request = readRequest(opts.input, adsAdCreateRequestSchema);
|
|
3041
|
-
printOperation(await
|
|
3290
|
+
printOperation(await getClient6().createAdsAd(project, request), opts.format);
|
|
3042
3291
|
}
|
|
3043
3292
|
async function adsAdUpdate(project, adId, opts) {
|
|
3044
3293
|
const request = readRequest(opts.input, adsAdUpdateRequestSchema);
|
|
3045
|
-
printOperation(await
|
|
3294
|
+
printOperation(await getClient6().updateAdsAd(project, adId, request), opts.format);
|
|
3046
3295
|
}
|
|
3047
3296
|
async function adsAdPause(project, adId, opts) {
|
|
3048
3297
|
const request = readRequest(opts.input, adsPauseRequestSchema);
|
|
3049
|
-
printOperation(await
|
|
3298
|
+
printOperation(await getClient6().pauseAdsAd(project, adId, request), opts.format);
|
|
3050
3299
|
}
|
|
3051
3300
|
async function adsSync(project, opts) {
|
|
3052
|
-
const client =
|
|
3301
|
+
const client = getClient6();
|
|
3053
3302
|
const result = await client.triggerAdsSync(project);
|
|
3054
3303
|
if (isMachineFormat(opts?.format)) {
|
|
3055
3304
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -3058,7 +3307,7 @@ async function adsSync(project, opts) {
|
|
|
3058
3307
|
console.log(`Ads sync queued (run ${result.runId}). Check progress with: canonry runs get ${result.runId}`);
|
|
3059
3308
|
}
|
|
3060
3309
|
async function adsCampaigns(project, opts) {
|
|
3061
|
-
const client =
|
|
3310
|
+
const client = getClient6();
|
|
3062
3311
|
const result = await client.getAdsCampaigns(project);
|
|
3063
3312
|
if (opts?.format === "jsonl") {
|
|
3064
3313
|
emitJsonl(result.campaigns.map((campaign) => ({ project, ...campaign })));
|
|
@@ -3085,7 +3334,7 @@ async function adsCampaigns(project, opts) {
|
|
|
3085
3334
|
}
|
|
3086
3335
|
}
|
|
3087
3336
|
async function adsInsights(project, opts) {
|
|
3088
|
-
const client =
|
|
3337
|
+
const client = getClient6();
|
|
3089
3338
|
const result = await client.getAdsInsights(project, {
|
|
3090
3339
|
level: opts?.level,
|
|
3091
3340
|
entityId: opts?.entity,
|
|
@@ -3114,7 +3363,7 @@ async function adsInsights(project, opts) {
|
|
|
3114
3363
|
}
|
|
3115
3364
|
}
|
|
3116
3365
|
async function adsSummary(project, opts) {
|
|
3117
|
-
const client =
|
|
3366
|
+
const client = getClient6();
|
|
3118
3367
|
const result = await client.getAdsSummary(project);
|
|
3119
3368
|
if (isMachineFormat(opts?.format)) {
|
|
3120
3369
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -3491,7 +3740,7 @@ Usage: ${usage}`, {
|
|
|
3491
3740
|
];
|
|
3492
3741
|
|
|
3493
3742
|
// src/commands/ga.ts
|
|
3494
|
-
function
|
|
3743
|
+
function getClient7() {
|
|
3495
3744
|
return createApiClient();
|
|
3496
3745
|
}
|
|
3497
3746
|
async function gaConnect(project, opts) {
|
|
@@ -3524,7 +3773,7 @@ async function gaConnect(project, opts) {
|
|
|
3524
3773
|
} else if (opts.keyJson) {
|
|
3525
3774
|
body.keyJson = opts.keyJson;
|
|
3526
3775
|
}
|
|
3527
|
-
const client =
|
|
3776
|
+
const client = getClient7();
|
|
3528
3777
|
const result = await client.gaConnect(project, body);
|
|
3529
3778
|
if (isMachineFormat(opts.format)) {
|
|
3530
3779
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -3539,7 +3788,7 @@ async function gaConnect(project, opts) {
|
|
|
3539
3788
|
}
|
|
3540
3789
|
}
|
|
3541
3790
|
async function gaDisconnect(project, format) {
|
|
3542
|
-
const client =
|
|
3791
|
+
const client = getClient7();
|
|
3543
3792
|
await client.gaDisconnect(project);
|
|
3544
3793
|
if (isMachineFormat(format)) {
|
|
3545
3794
|
console.log(JSON.stringify({ project, disconnected: true }, null, 2));
|
|
@@ -3548,7 +3797,7 @@ async function gaDisconnect(project, format) {
|
|
|
3548
3797
|
console.log(`GA4 disconnected from project "${project}".`);
|
|
3549
3798
|
}
|
|
3550
3799
|
async function gaStatus(project, format) {
|
|
3551
|
-
const client =
|
|
3800
|
+
const client = getClient7();
|
|
3552
3801
|
const result = await client.gaStatus(project);
|
|
3553
3802
|
if (isMachineFormat(format)) {
|
|
3554
3803
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -3574,7 +3823,7 @@ async function gaStatus(project, format) {
|
|
|
3574
3823
|
console.log(` Connected: ${result.createdAt ?? "unknown"}`);
|
|
3575
3824
|
}
|
|
3576
3825
|
async function gaSync(project, opts) {
|
|
3577
|
-
const client =
|
|
3826
|
+
const client = getClient7();
|
|
3578
3827
|
const body = {};
|
|
3579
3828
|
if (opts?.days) body.days = opts.days;
|
|
3580
3829
|
if (opts?.only) body.only = opts.only;
|
|
@@ -3594,7 +3843,7 @@ async function gaSync(project, opts) {
|
|
|
3594
3843
|
console.log(` Synced at: ${result.syncedAt}`);
|
|
3595
3844
|
}
|
|
3596
3845
|
async function gaTraffic(project, opts) {
|
|
3597
|
-
const client =
|
|
3846
|
+
const client = getClient7();
|
|
3598
3847
|
const params = {};
|
|
3599
3848
|
if (opts?.limit) params.limit = String(opts.limit);
|
|
3600
3849
|
if (opts?.window) params.window = opts.window;
|
|
@@ -3689,7 +3938,7 @@ async function gaTraffic(project, opts) {
|
|
|
3689
3938
|
}
|
|
3690
3939
|
}
|
|
3691
3940
|
async function gaAiReferralHistory(project, opts) {
|
|
3692
|
-
const client =
|
|
3941
|
+
const client = getClient7();
|
|
3693
3942
|
const result = await client.gaAiReferralHistory(project, opts?.window ? { window: opts.window } : void 0);
|
|
3694
3943
|
if (opts?.format === "json") {
|
|
3695
3944
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -3717,7 +3966,7 @@ async function gaAiReferralHistory(project, opts) {
|
|
|
3717
3966
|
}
|
|
3718
3967
|
}
|
|
3719
3968
|
async function gaSocialReferralHistory(project, opts) {
|
|
3720
|
-
const client =
|
|
3969
|
+
const client = getClient7();
|
|
3721
3970
|
const result = await client.gaSocialReferralHistory(project, opts?.window ? { window: opts.window } : void 0);
|
|
3722
3971
|
if (opts?.format === "json") {
|
|
3723
3972
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -3745,7 +3994,7 @@ async function gaSocialReferralHistory(project, opts) {
|
|
|
3745
3994
|
}
|
|
3746
3995
|
}
|
|
3747
3996
|
async function gaSessionHistory(project, opts) {
|
|
3748
|
-
const client =
|
|
3997
|
+
const client = getClient7();
|
|
3749
3998
|
const result = await client.gaSessionHistory(project, opts?.window ? { window: opts.window } : void 0);
|
|
3750
3999
|
if (opts?.format === "json") {
|
|
3751
4000
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -3776,7 +4025,7 @@ async function gaSessionHistory(project, opts) {
|
|
|
3776
4025
|
}
|
|
3777
4026
|
}
|
|
3778
4027
|
async function gaCoverage(project, format) {
|
|
3779
|
-
const client =
|
|
4028
|
+
const client = getClient7();
|
|
3780
4029
|
const result = await client.gaCoverage(project);
|
|
3781
4030
|
if (format === "json") {
|
|
3782
4031
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -3802,7 +4051,7 @@ async function gaCoverage(project, format) {
|
|
|
3802
4051
|
}
|
|
3803
4052
|
}
|
|
3804
4053
|
async function gaSocialReferralSummary(project, opts) {
|
|
3805
|
-
const client =
|
|
4054
|
+
const client = getClient7();
|
|
3806
4055
|
const traffic = await client.gaTraffic(project);
|
|
3807
4056
|
if (opts?.trend) {
|
|
3808
4057
|
const trend = await client.gaSocialReferralTrend(project);
|
|
@@ -3863,7 +4112,7 @@ async function gaSocialReferralSummary(project, opts) {
|
|
|
3863
4112
|
}
|
|
3864
4113
|
}
|
|
3865
4114
|
async function gaAttribution(project, opts) {
|
|
3866
|
-
const client =
|
|
4115
|
+
const client = getClient7();
|
|
3867
4116
|
const traffic = await client.gaTraffic(project);
|
|
3868
4117
|
const fmtTrend = (pct4) => pct4 === null ? "n/a" : `${pct4 >= 0 ? "+" : ""}${pct4}%`;
|
|
3869
4118
|
if (opts?.trend) {
|
|
@@ -4229,7 +4478,7 @@ var GA_CLI_COMMANDS = [
|
|
|
4229
4478
|
];
|
|
4230
4479
|
|
|
4231
4480
|
// src/commands/gbp.ts
|
|
4232
|
-
function
|
|
4481
|
+
function getClient8() {
|
|
4233
4482
|
return createApiClient();
|
|
4234
4483
|
}
|
|
4235
4484
|
function formatLocationsTable(response) {
|
|
@@ -4247,7 +4496,7 @@ function formatLocationsTable(response) {
|
|
|
4247
4496
|
return lines.join("\n");
|
|
4248
4497
|
}
|
|
4249
4498
|
async function gbpConnect(project, opts) {
|
|
4250
|
-
const client =
|
|
4499
|
+
const client = getClient8();
|
|
4251
4500
|
const { authUrl, redirectUri } = await client.googleConnect(project, {
|
|
4252
4501
|
type: "gbp",
|
|
4253
4502
|
publicUrl: opts.publicUrl
|
|
@@ -4266,7 +4515,7 @@ async function gbpConnect(project, opts) {
|
|
|
4266
4515
|
console.log("After authorizing, run `canonry gbp locations discover <project>` to fetch your locations.");
|
|
4267
4516
|
}
|
|
4268
4517
|
async function gbpDisconnect(project, opts) {
|
|
4269
|
-
const client =
|
|
4518
|
+
const client = getClient8();
|
|
4270
4519
|
await client.disconnectGbp(project);
|
|
4271
4520
|
if (isMachineFormat(opts.format)) {
|
|
4272
4521
|
console.log(JSON.stringify({ project, disconnected: true }, null, 2));
|
|
@@ -4275,7 +4524,7 @@ async function gbpDisconnect(project, opts) {
|
|
|
4275
4524
|
console.log(`Disconnected GBP from project "${project}" and removed all discovered locations.`);
|
|
4276
4525
|
}
|
|
4277
4526
|
async function gbpLocationsList(project, opts) {
|
|
4278
|
-
const client =
|
|
4527
|
+
const client = getClient8();
|
|
4279
4528
|
const response = await client.listGbpLocations(
|
|
4280
4529
|
project,
|
|
4281
4530
|
opts.selectedOnly ? { selected: true } : void 0
|
|
@@ -4287,7 +4536,7 @@ async function gbpLocationsList(project, opts) {
|
|
|
4287
4536
|
console.log(formatLocationsTable(response));
|
|
4288
4537
|
}
|
|
4289
4538
|
async function gbpAccounts(project, opts) {
|
|
4290
|
-
const client =
|
|
4539
|
+
const client = getClient8();
|
|
4291
4540
|
const response = await client.listGbpAccounts(project);
|
|
4292
4541
|
if (isMachineFormat(opts.format)) {
|
|
4293
4542
|
console.log(JSON.stringify(response, null, 2));
|
|
@@ -4312,7 +4561,7 @@ function formatAccountsTable(response) {
|
|
|
4312
4561
|
return lines.join("\n");
|
|
4313
4562
|
}
|
|
4314
4563
|
async function gbpLocationsDiscover(project, opts) {
|
|
4315
|
-
const client =
|
|
4564
|
+
const client = getClient8();
|
|
4316
4565
|
const hasBody = opts.selectAllNew !== void 0 || opts.account !== void 0 || opts.switchAccount;
|
|
4317
4566
|
const body = hasBody ? {
|
|
4318
4567
|
...opts.selectAllNew === void 0 ? {} : { selectAllNew: opts.selectAllNew },
|
|
@@ -4329,7 +4578,7 @@ Discovered ${response.totalDiscovered} location(s); ${response.totalSelected} se
|
|
|
4329
4578
|
console.log(formatLocationsTable(response));
|
|
4330
4579
|
}
|
|
4331
4580
|
async function gbpLocationSelect(project, opts) {
|
|
4332
|
-
const client =
|
|
4581
|
+
const client = getClient8();
|
|
4333
4582
|
const updated = await client.setGbpLocationSelection(project, opts.location, true);
|
|
4334
4583
|
if (isMachineFormat(opts.format)) {
|
|
4335
4584
|
console.log(JSON.stringify(updated, null, 2));
|
|
@@ -4338,7 +4587,7 @@ async function gbpLocationSelect(project, opts) {
|
|
|
4338
4587
|
console.log(`Selected ${opts.location} ("${updated.displayName}") for sync.`);
|
|
4339
4588
|
}
|
|
4340
4589
|
async function gbpLocationDeselect(project, opts) {
|
|
4341
|
-
const client =
|
|
4590
|
+
const client = getClient8();
|
|
4342
4591
|
const updated = await client.setGbpLocationSelection(project, opts.location, false);
|
|
4343
4592
|
if (isMachineFormat(opts.format)) {
|
|
4344
4593
|
console.log(JSON.stringify(updated, null, 2));
|
|
@@ -4347,7 +4596,7 @@ async function gbpLocationDeselect(project, opts) {
|
|
|
4347
4596
|
console.log(`Deselected ${opts.location} ("${updated.displayName}"). Future syncs will skip this location.`);
|
|
4348
4597
|
}
|
|
4349
4598
|
async function gbpSync(project, opts) {
|
|
4350
|
-
const client =
|
|
4599
|
+
const client = getClient8();
|
|
4351
4600
|
const { runId, status } = await client.triggerGbpSync(project, {
|
|
4352
4601
|
locationNames: opts.location ? [opts.location] : void 0,
|
|
4353
4602
|
daysOfMetrics: opts.days,
|
|
@@ -4383,7 +4632,7 @@ async function gbpSync(project, opts) {
|
|
|
4383
4632
|
console.log(`GBP sync ${final} (run ${runId}).`);
|
|
4384
4633
|
}
|
|
4385
4634
|
async function gbpMetrics(project, opts) {
|
|
4386
|
-
const client =
|
|
4635
|
+
const client = getClient8();
|
|
4387
4636
|
const response = await client.listGbpMetrics(project, { locationName: opts.location, metric: opts.metric });
|
|
4388
4637
|
if (isMachineFormat(opts.format)) {
|
|
4389
4638
|
console.log(JSON.stringify(response, null, 2));
|
|
@@ -4401,7 +4650,7 @@ async function gbpMetrics(project, opts) {
|
|
|
4401
4650
|
}
|
|
4402
4651
|
}
|
|
4403
4652
|
async function gbpKeywords(project, opts) {
|
|
4404
|
-
const client =
|
|
4653
|
+
const client = getClient8();
|
|
4405
4654
|
const response = await client.listGbpKeywords(project, { locationName: opts.location });
|
|
4406
4655
|
if (isMachineFormat(opts.format)) {
|
|
4407
4656
|
console.log(JSON.stringify(response, null, 2));
|
|
@@ -4418,7 +4667,7 @@ async function gbpKeywords(project, opts) {
|
|
|
4418
4667
|
}
|
|
4419
4668
|
}
|
|
4420
4669
|
async function gbpPlaceActions(project, opts) {
|
|
4421
|
-
const client =
|
|
4670
|
+
const client = getClient8();
|
|
4422
4671
|
const response = await client.listGbpPlaceActions(project, { locationName: opts.location });
|
|
4423
4672
|
if (isMachineFormat(opts.format)) {
|
|
4424
4673
|
console.log(JSON.stringify(response, null, 2));
|
|
@@ -4435,7 +4684,7 @@ async function gbpPlaceActions(project, opts) {
|
|
|
4435
4684
|
}
|
|
4436
4685
|
}
|
|
4437
4686
|
async function gbpLodging(project, opts) {
|
|
4438
|
-
const client =
|
|
4687
|
+
const client = getClient8();
|
|
4439
4688
|
const response = await client.listGbpLodging(project, { locationName: opts.location });
|
|
4440
4689
|
if (isMachineFormat(opts.format)) {
|
|
4441
4690
|
console.log(JSON.stringify(response, null, 2));
|
|
@@ -4452,7 +4701,7 @@ async function gbpLodging(project, opts) {
|
|
|
4452
4701
|
}
|
|
4453
4702
|
}
|
|
4454
4703
|
async function gbpAttributes(project, opts) {
|
|
4455
|
-
const client =
|
|
4704
|
+
const client = getClient8();
|
|
4456
4705
|
const response = await client.listGbpAttributes(project, { locationName: opts.location });
|
|
4457
4706
|
if (isMachineFormat(opts.format)) {
|
|
4458
4707
|
console.log(JSON.stringify(response, null, 2));
|
|
@@ -4477,7 +4726,7 @@ async function gbpAttributes(project, opts) {
|
|
|
4477
4726
|
}
|
|
4478
4727
|
}
|
|
4479
4728
|
async function gbpPlaces(project, opts) {
|
|
4480
|
-
const client =
|
|
4729
|
+
const client = getClient8();
|
|
4481
4730
|
const response = await client.listGbpPlaces(project, { locationName: opts.location });
|
|
4482
4731
|
if (isMachineFormat(opts.format)) {
|
|
4483
4732
|
console.log(JSON.stringify(response, null, 2));
|
|
@@ -4498,7 +4747,7 @@ function fmtDelta(pct4) {
|
|
|
4498
4747
|
return `${pct4 >= 0 ? "+" : ""}${pct4}%`;
|
|
4499
4748
|
}
|
|
4500
4749
|
async function gbpSummary(project, opts) {
|
|
4501
|
-
const client =
|
|
4750
|
+
const client = getClient8();
|
|
4502
4751
|
const s = await client.getGbpSummary(project, { locationName: opts.location });
|
|
4503
4752
|
if (isMachineFormat(opts.format)) {
|
|
4504
4753
|
console.log(JSON.stringify(s, null, 2));
|
|
@@ -4829,7 +5078,7 @@ var GET_CLI_COMMANDS = [
|
|
|
4829
5078
|
];
|
|
4830
5079
|
|
|
4831
5080
|
// src/commands/traffic.ts
|
|
4832
|
-
function
|
|
5081
|
+
function getClient9() {
|
|
4833
5082
|
return createApiClient();
|
|
4834
5083
|
}
|
|
4835
5084
|
function configString(value, fallback = "(unset)") {
|
|
@@ -4883,7 +5132,7 @@ async function trafficConnectWordpress(project, opts) {
|
|
|
4883
5132
|
details: { project }
|
|
4884
5133
|
});
|
|
4885
5134
|
}
|
|
4886
|
-
const client =
|
|
5135
|
+
const client = getClient9();
|
|
4887
5136
|
const result = await client.trafficConnectWordpress(project, {
|
|
4888
5137
|
baseUrl: opts.url,
|
|
4889
5138
|
username: opts.username,
|
|
@@ -4934,7 +5183,7 @@ async function trafficConnectCloudRun(project, opts) {
|
|
|
4934
5183
|
details: { project, keyFile: opts.serviceAccountKey }
|
|
4935
5184
|
});
|
|
4936
5185
|
}
|
|
4937
|
-
const client =
|
|
5186
|
+
const client = getClient9();
|
|
4938
5187
|
const result = await client.trafficConnectCloudRun(project, {
|
|
4939
5188
|
gcpProjectId: opts.gcpProject,
|
|
4940
5189
|
serviceName: opts.service,
|
|
@@ -5012,7 +5261,7 @@ async function trafficConnectVercel(project, opts) {
|
|
|
5012
5261
|
details: { project, environment: opts.environment }
|
|
5013
5262
|
});
|
|
5014
5263
|
}
|
|
5015
|
-
const client =
|
|
5264
|
+
const client = getClient9();
|
|
5016
5265
|
const result = await client.trafficConnectVercel(project, {
|
|
5017
5266
|
projectId: opts.projectId,
|
|
5018
5267
|
teamId: opts.teamId,
|
|
@@ -5043,7 +5292,7 @@ async function trafficBackfill(project, opts) {
|
|
|
5043
5292
|
details: { project }
|
|
5044
5293
|
});
|
|
5045
5294
|
}
|
|
5046
|
-
const client =
|
|
5295
|
+
const client = getClient9();
|
|
5047
5296
|
const submitted = await client.trafficBackfill(project, opts.source, {
|
|
5048
5297
|
days: opts.days
|
|
5049
5298
|
});
|
|
@@ -5112,7 +5361,7 @@ async function trafficSync(project, opts) {
|
|
|
5112
5361
|
details: { project }
|
|
5113
5362
|
});
|
|
5114
5363
|
}
|
|
5115
|
-
const client =
|
|
5364
|
+
const client = getClient9();
|
|
5116
5365
|
const result = await client.trafficSync(project, opts.source, {
|
|
5117
5366
|
sinceMinutes: opts.sinceMinutes
|
|
5118
5367
|
});
|
|
@@ -5150,7 +5399,7 @@ async function trafficReset(project, opts) {
|
|
|
5150
5399
|
details: { project, source: opts.source }
|
|
5151
5400
|
});
|
|
5152
5401
|
}
|
|
5153
|
-
const client =
|
|
5402
|
+
const client = getClient9();
|
|
5154
5403
|
const updated = await client.trafficReset(project, opts.source);
|
|
5155
5404
|
if (isMachineFormat(opts.format)) {
|
|
5156
5405
|
console.log(JSON.stringify(updated, null, 2));
|
|
@@ -5593,11 +5842,11 @@ var TRAFFIC_CLI_COMMANDS = [
|
|
|
5593
5842
|
];
|
|
5594
5843
|
|
|
5595
5844
|
// src/commands/competitor.ts
|
|
5596
|
-
function
|
|
5845
|
+
function getClient10() {
|
|
5597
5846
|
return createApiClient();
|
|
5598
5847
|
}
|
|
5599
5848
|
async function addCompetitors(project, domains, format) {
|
|
5600
|
-
const client =
|
|
5849
|
+
const client = getClient10();
|
|
5601
5850
|
const existing = await client.listCompetitors(project);
|
|
5602
5851
|
const existingDomains = existing.map((c) => c.domain);
|
|
5603
5852
|
const existingSet = new Set(existingDomains);
|
|
@@ -5621,7 +5870,7 @@ async function addCompetitors(project, domains, format) {
|
|
|
5621
5870
|
}
|
|
5622
5871
|
}
|
|
5623
5872
|
async function removeCompetitors(project, domains, format) {
|
|
5624
|
-
const client =
|
|
5873
|
+
const client = getClient10();
|
|
5625
5874
|
const existing = await client.listCompetitors(project);
|
|
5626
5875
|
const existingDomains = existing.map((c) => c.domain);
|
|
5627
5876
|
const requested = new Set(uniqueStrings(domains));
|
|
@@ -5650,7 +5899,7 @@ function uniqueStrings(values) {
|
|
|
5650
5899
|
return result;
|
|
5651
5900
|
}
|
|
5652
5901
|
async function listCompetitors(project, format) {
|
|
5653
|
-
const client =
|
|
5902
|
+
const client = getClient10();
|
|
5654
5903
|
const comps = await client.listCompetitors(project);
|
|
5655
5904
|
if (format === "json") {
|
|
5656
5905
|
console.log(JSON.stringify(comps, null, 2));
|
|
@@ -5749,7 +5998,7 @@ var COMPETITOR_CLI_COMMANDS = [
|
|
|
5749
5998
|
|
|
5750
5999
|
// src/commands/google.ts
|
|
5751
6000
|
var INDEXING_API_SCOPE_NOTICE = "Note: Google's Indexing API officially supports only pages with JobPosting or BroadcastEvent (livestream VideoObject) structured data. For other URL types, submissions are accepted (HTTP 200) but not guaranteed to be prioritized for crawling. For general pages, submit a sitemap and use URL Inspection to monitor status.";
|
|
5752
|
-
function
|
|
6001
|
+
function getClient11() {
|
|
5753
6002
|
return createApiClient();
|
|
5754
6003
|
}
|
|
5755
6004
|
async function waitForRunStatus2(client, runId, config) {
|
|
@@ -5789,7 +6038,7 @@ async function waitForRunStatus2(client, runId, config) {
|
|
|
5789
6038
|
});
|
|
5790
6039
|
}
|
|
5791
6040
|
async function googleConnect(project, opts) {
|
|
5792
|
-
const client =
|
|
6041
|
+
const client = getClient11();
|
|
5793
6042
|
const { authUrl, redirectUri } = await client.googleConnect(project, {
|
|
5794
6043
|
type: opts.type,
|
|
5795
6044
|
publicUrl: opts.publicUrl
|
|
@@ -5823,7 +6072,7 @@ Open this URL in your browser to authorize Google ${opts.type.toUpperCase()} acc
|
|
|
5823
6072
|
}
|
|
5824
6073
|
}
|
|
5825
6074
|
async function googleDisconnect(project, opts) {
|
|
5826
|
-
const client =
|
|
6075
|
+
const client = getClient11();
|
|
5827
6076
|
await client.googleDisconnect(project, opts.type);
|
|
5828
6077
|
if (isMachineFormat(opts.format)) {
|
|
5829
6078
|
console.log(JSON.stringify({ project, type: opts.type, disconnected: true }, null, 2));
|
|
@@ -5832,7 +6081,7 @@ async function googleDisconnect(project, opts) {
|
|
|
5832
6081
|
console.log(`Disconnected Google ${opts.type.toUpperCase()} from project "${project}".`);
|
|
5833
6082
|
}
|
|
5834
6083
|
async function googleStatus(project, format) {
|
|
5835
|
-
const client =
|
|
6084
|
+
const client = getClient11();
|
|
5836
6085
|
const connections = await client.googleConnections(project);
|
|
5837
6086
|
if (format === "json") {
|
|
5838
6087
|
console.log(JSON.stringify({ connections }, null, 2));
|
|
@@ -5859,7 +6108,7 @@ async function googleStatus(project, format) {
|
|
|
5859
6108
|
}
|
|
5860
6109
|
}
|
|
5861
6110
|
async function googleProperties(project, format) {
|
|
5862
|
-
const client =
|
|
6111
|
+
const client = getClient11();
|
|
5863
6112
|
const { sites } = await client.googleProperties(project);
|
|
5864
6113
|
if (format === "json") {
|
|
5865
6114
|
console.log(JSON.stringify({ sites }, null, 2));
|
|
@@ -5883,7 +6132,7 @@ async function googleProperties(project, format) {
|
|
|
5883
6132
|
Use "canonry google set-property <project> <siteUrl>" to select a property.`);
|
|
5884
6133
|
}
|
|
5885
6134
|
async function googleSetProperty(project, propertyUrl, format) {
|
|
5886
|
-
const client =
|
|
6135
|
+
const client = getClient11();
|
|
5887
6136
|
await client.googleSetProperty(project, "gsc", propertyUrl);
|
|
5888
6137
|
if (isMachineFormat(format)) {
|
|
5889
6138
|
console.log(JSON.stringify({ project, type: "gsc", propertyUrl }, null, 2));
|
|
@@ -5892,7 +6141,7 @@ async function googleSetProperty(project, propertyUrl, format) {
|
|
|
5892
6141
|
console.log(`GSC property set to "${propertyUrl}" for project "${project}".`);
|
|
5893
6142
|
}
|
|
5894
6143
|
async function googleSync(project, opts) {
|
|
5895
|
-
const client =
|
|
6144
|
+
const client = getClient11();
|
|
5896
6145
|
const run = await client.gscSync(project, { days: opts.days, full: opts.full });
|
|
5897
6146
|
if (!opts.wait && isMachineFormat(opts.format)) {
|
|
5898
6147
|
console.log(JSON.stringify(run, null, 2));
|
|
@@ -5922,7 +6171,7 @@ async function googleSync(project, opts) {
|
|
|
5922
6171
|
}
|
|
5923
6172
|
}
|
|
5924
6173
|
async function googlePerformanceDaily(project, opts) {
|
|
5925
|
-
const client =
|
|
6174
|
+
const client = getClient11();
|
|
5926
6175
|
const params = {};
|
|
5927
6176
|
if (opts.window) params.window = opts.window;
|
|
5928
6177
|
if (opts.startDate) params.startDate = opts.startDate;
|
|
@@ -5955,7 +6204,7 @@ async function googlePerformanceDaily(project, opts) {
|
|
|
5955
6204
|
}
|
|
5956
6205
|
}
|
|
5957
6206
|
async function googlePerformance(project, opts) {
|
|
5958
|
-
const client =
|
|
6207
|
+
const client = getClient11();
|
|
5959
6208
|
const params = {};
|
|
5960
6209
|
if (opts.days) {
|
|
5961
6210
|
const end = /* @__PURE__ */ new Date();
|
|
@@ -5994,7 +6243,7 @@ async function googlePerformance(project, opts) {
|
|
|
5994
6243
|
}
|
|
5995
6244
|
}
|
|
5996
6245
|
async function googleInspect(project, url, format) {
|
|
5997
|
-
const client =
|
|
6246
|
+
const client = getClient11();
|
|
5998
6247
|
const result = await client.gscInspect(project, url);
|
|
5999
6248
|
if (isMachineFormat(format)) {
|
|
6000
6249
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -6014,7 +6263,7 @@ URL Inspection: ${result.url}
|
|
|
6014
6263
|
console.log(` Inspected At: ${result.inspectedAt}`);
|
|
6015
6264
|
}
|
|
6016
6265
|
async function googleInspections(project, opts) {
|
|
6017
|
-
const client =
|
|
6266
|
+
const client = getClient11();
|
|
6018
6267
|
const params = {};
|
|
6019
6268
|
if (opts.url) params.url = opts.url;
|
|
6020
6269
|
const rows = await client.gscInspections(project, Object.keys(params).length > 0 ? params : void 0);
|
|
@@ -6042,7 +6291,7 @@ async function googleInspections(project, opts) {
|
|
|
6042
6291
|
}
|
|
6043
6292
|
}
|
|
6044
6293
|
async function googleCoverage(project, format) {
|
|
6045
|
-
const client =
|
|
6294
|
+
const client = getClient11();
|
|
6046
6295
|
const result = await client.gscCoverage(project);
|
|
6047
6296
|
if (isMachineFormat(format)) {
|
|
6048
6297
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -6088,7 +6337,7 @@ Index Coverage for "${project}"
|
|
|
6088
6337
|
}
|
|
6089
6338
|
}
|
|
6090
6339
|
async function googleSetSitemap(project, sitemapUrl, format) {
|
|
6091
|
-
const client =
|
|
6340
|
+
const client = getClient11();
|
|
6092
6341
|
await client.googleSetSitemap(project, "gsc", sitemapUrl);
|
|
6093
6342
|
if (isMachineFormat(format)) {
|
|
6094
6343
|
console.log(JSON.stringify({ project, type: "gsc", sitemapUrl }, null, 2));
|
|
@@ -6097,7 +6346,7 @@ async function googleSetSitemap(project, sitemapUrl, format) {
|
|
|
6097
6346
|
console.log(`GSC sitemap URL set to "${sitemapUrl}" for project "${project}".`);
|
|
6098
6347
|
}
|
|
6099
6348
|
async function googleListSitemaps(project, opts) {
|
|
6100
|
-
const client =
|
|
6349
|
+
const client = getClient11();
|
|
6101
6350
|
const result = await client.gscSitemaps(project);
|
|
6102
6351
|
if (opts.format === "json") {
|
|
6103
6352
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -6122,7 +6371,7 @@ Sitemaps for project "${project}":
|
|
|
6122
6371
|
}
|
|
6123
6372
|
}
|
|
6124
6373
|
async function googleInspectSitemap(project, opts) {
|
|
6125
|
-
const client =
|
|
6374
|
+
const client = getClient11();
|
|
6126
6375
|
const run = await client.gscInspectSitemap(project, {
|
|
6127
6376
|
sitemapUrl: opts.sitemapUrl
|
|
6128
6377
|
});
|
|
@@ -6158,7 +6407,7 @@ async function googleInspectSitemap(project, opts) {
|
|
|
6158
6407
|
}
|
|
6159
6408
|
}
|
|
6160
6409
|
async function googleCoverageHistory(project, opts) {
|
|
6161
|
-
const client =
|
|
6410
|
+
const client = getClient11();
|
|
6162
6411
|
const rows = await client.gscCoverageHistory(project, { limit: opts.limit });
|
|
6163
6412
|
if (opts.format === "json") {
|
|
6164
6413
|
console.log(JSON.stringify(rows, null, 2));
|
|
@@ -6183,7 +6432,7 @@ GSC Coverage History for "${project}" (${rows.length} snapshots):
|
|
|
6183
6432
|
}
|
|
6184
6433
|
}
|
|
6185
6434
|
async function googleDiscoverSitemaps(project, opts) {
|
|
6186
|
-
const client =
|
|
6435
|
+
const client = getClient11();
|
|
6187
6436
|
const result = await client.gscDiscoverSitemaps(project);
|
|
6188
6437
|
if (!opts.wait && isMachineFormat(opts.format)) {
|
|
6189
6438
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -6235,7 +6484,7 @@ Primary sitemap: ${result.primarySitemapUrl}`);
|
|
|
6235
6484
|
}
|
|
6236
6485
|
}
|
|
6237
6486
|
async function googleRequestIndexing(project, opts) {
|
|
6238
|
-
const client =
|
|
6487
|
+
const client = getClient11();
|
|
6239
6488
|
const body = { urls: [] };
|
|
6240
6489
|
if (opts.allUnindexed) {
|
|
6241
6490
|
body.allUnindexed = true;
|
|
@@ -6330,7 +6579,7 @@ async function googleRequestIndexing(project, opts) {
|
|
|
6330
6579
|
}
|
|
6331
6580
|
}
|
|
6332
6581
|
async function googleRefresh(project, format) {
|
|
6333
|
-
const client =
|
|
6582
|
+
const client = getClient11();
|
|
6334
6583
|
const run = await client.gscSync(project, {});
|
|
6335
6584
|
if (!isMachineFormat(format)) {
|
|
6336
6585
|
process.stderr.write("Refreshing GSC coverage data");
|
|
@@ -6353,7 +6602,7 @@ async function googleRefresh(project, format) {
|
|
|
6353
6602
|
await googleCoverage(project, format);
|
|
6354
6603
|
}
|
|
6355
6604
|
async function googleDeindexed(project, format) {
|
|
6356
|
-
const client =
|
|
6605
|
+
const client = getClient11();
|
|
6357
6606
|
const rows = await client.gscDeindexed(project);
|
|
6358
6607
|
if (format === "json") {
|
|
6359
6608
|
console.log(JSON.stringify(rows, null, 2));
|
|
@@ -6662,14 +6911,14 @@ var GOOGLE_CLI_COMMANDS = [
|
|
|
6662
6911
|
];
|
|
6663
6912
|
|
|
6664
6913
|
// src/commands/keys.ts
|
|
6665
|
-
function
|
|
6914
|
+
function getClient12() {
|
|
6666
6915
|
return createApiClient();
|
|
6667
6916
|
}
|
|
6668
6917
|
function keyStatus(key) {
|
|
6669
6918
|
return key.revokedAt ? "revoked" : "active";
|
|
6670
6919
|
}
|
|
6671
6920
|
async function listApiKeys(format) {
|
|
6672
|
-
const client =
|
|
6921
|
+
const client = getClient12();
|
|
6673
6922
|
const { keys } = await client.listApiKeys();
|
|
6674
6923
|
if (format === "json") {
|
|
6675
6924
|
console.log(JSON.stringify({ keys }, null, 2));
|
|
@@ -6702,7 +6951,7 @@ async function createApiKey(opts) {
|
|
|
6702
6951
|
displayMessage: 'Error: --read-only cannot be combined with --scope (it already implies the "read" scope).'
|
|
6703
6952
|
});
|
|
6704
6953
|
}
|
|
6705
|
-
const client =
|
|
6954
|
+
const client = getClient12();
|
|
6706
6955
|
const body = { name: opts.name };
|
|
6707
6956
|
const scopes = opts.readOnly ? [READ_ONLY_SCOPE] : explicitScopes;
|
|
6708
6957
|
if (scopes) body.scopes = scopes;
|
|
@@ -6725,7 +6974,7 @@ async function createApiKey(opts) {
|
|
|
6725
6974
|
console.log("\nSave this now \u2014 it will not be shown again.");
|
|
6726
6975
|
}
|
|
6727
6976
|
async function showApiKeySelf(format) {
|
|
6728
|
-
const client =
|
|
6977
|
+
const client = getClient12();
|
|
6729
6978
|
const key = await client.getApiKeySelf();
|
|
6730
6979
|
if (isMachineFormat(format)) {
|
|
6731
6980
|
console.log(JSON.stringify(key, null, 2));
|
|
@@ -6737,7 +6986,7 @@ async function showApiKeySelf(format) {
|
|
|
6737
6986
|
console.log(` Status: ${keyStatus(key)}`);
|
|
6738
6987
|
}
|
|
6739
6988
|
async function revokeApiKey(id, format) {
|
|
6740
|
-
const client =
|
|
6989
|
+
const client = getClient12();
|
|
6741
6990
|
const key = await client.revokeApiKey(id);
|
|
6742
6991
|
if (isMachineFormat(format)) {
|
|
6743
6992
|
console.log(JSON.stringify(key, null, 2));
|
|
@@ -6815,11 +7064,11 @@ var KEYS_CLI_COMMANDS = [
|
|
|
6815
7064
|
|
|
6816
7065
|
// src/commands/keyword.ts
|
|
6817
7066
|
import fs4 from "fs";
|
|
6818
|
-
function
|
|
7067
|
+
function getClient13() {
|
|
6819
7068
|
return createApiClient();
|
|
6820
7069
|
}
|
|
6821
7070
|
async function addKeywords(project, keywords, format) {
|
|
6822
|
-
const client =
|
|
7071
|
+
const client = getClient13();
|
|
6823
7072
|
await client.appendKeywords(project, keywords);
|
|
6824
7073
|
if (isMachineFormat(format)) {
|
|
6825
7074
|
console.log(JSON.stringify({
|
|
@@ -6832,7 +7081,7 @@ async function addKeywords(project, keywords, format) {
|
|
|
6832
7081
|
console.log(`Added ${keywords.length} key phrase(s) to "${project}".`);
|
|
6833
7082
|
}
|
|
6834
7083
|
async function replaceKeywords(project, keywords, format) {
|
|
6835
|
-
const client =
|
|
7084
|
+
const client = getClient13();
|
|
6836
7085
|
await client.putKeywords(project, keywords);
|
|
6837
7086
|
if (isMachineFormat(format)) {
|
|
6838
7087
|
console.log(JSON.stringify({
|
|
@@ -6845,7 +7094,7 @@ async function replaceKeywords(project, keywords, format) {
|
|
|
6845
7094
|
console.log(`Set ${keywords.length} key phrase(s) for "${project}".`);
|
|
6846
7095
|
}
|
|
6847
7096
|
async function removeKeywords(project, keywords, format) {
|
|
6848
|
-
const client =
|
|
7097
|
+
const client = getClient13();
|
|
6849
7098
|
const existing = await client.listKeywords(project);
|
|
6850
7099
|
const existingSet = new Set(existing.map((k) => k.keyword));
|
|
6851
7100
|
const removedKeywords = keywords.filter((k) => existingSet.has(k));
|
|
@@ -6862,7 +7111,7 @@ async function removeKeywords(project, keywords, format) {
|
|
|
6862
7111
|
console.log(`Removed ${removedKeywords.length} key phrase(s) from "${project}".`);
|
|
6863
7112
|
}
|
|
6864
7113
|
async function listKeywords(project, format) {
|
|
6865
|
-
const client =
|
|
7114
|
+
const client = getClient13();
|
|
6866
7115
|
const kws = await client.listKeywords(project);
|
|
6867
7116
|
if (format === "json") {
|
|
6868
7117
|
console.log(JSON.stringify(kws, null, 2));
|
|
@@ -6908,7 +7157,7 @@ async function importKeywords(project, filePath, format) {
|
|
|
6908
7157
|
console.log("No key phrases found in file.");
|
|
6909
7158
|
return;
|
|
6910
7159
|
}
|
|
6911
|
-
const client =
|
|
7160
|
+
const client = getClient13();
|
|
6912
7161
|
await client.appendKeywords(project, keywords);
|
|
6913
7162
|
if (isMachineFormat(format)) {
|
|
6914
7163
|
console.log(JSON.stringify({
|
|
@@ -6922,7 +7171,7 @@ async function importKeywords(project, filePath, format) {
|
|
|
6922
7171
|
console.log(`Imported ${keywords.length} key phrase(s) to "${project}".`);
|
|
6923
7172
|
}
|
|
6924
7173
|
async function generateKeywords(project, provider, opts) {
|
|
6925
|
-
const client =
|
|
7174
|
+
const client = getClient13();
|
|
6926
7175
|
const result = await client.generateKeywords(project, provider, opts.count);
|
|
6927
7176
|
const saved = Boolean(opts.save && result.keywords.length > 0);
|
|
6928
7177
|
if (!isMachineFormat(opts.format)) {
|
|
@@ -7095,11 +7344,11 @@ var KEYWORD_CLI_COMMANDS = [
|
|
|
7095
7344
|
|
|
7096
7345
|
// src/commands/query.ts
|
|
7097
7346
|
import fs5 from "fs";
|
|
7098
|
-
function
|
|
7347
|
+
function getClient14() {
|
|
7099
7348
|
return createApiClient();
|
|
7100
7349
|
}
|
|
7101
7350
|
async function addQueries(project, queries2, format) {
|
|
7102
|
-
const client =
|
|
7351
|
+
const client = getClient14();
|
|
7103
7352
|
await client.appendQueries(project, queries2);
|
|
7104
7353
|
if (isMachineFormat(format)) {
|
|
7105
7354
|
console.log(JSON.stringify({
|
|
@@ -7112,7 +7361,7 @@ async function addQueries(project, queries2, format) {
|
|
|
7112
7361
|
console.log(`Added ${queries2.length} ${queries2.length === 1 ? "query" : "queries"} to "${project}".`);
|
|
7113
7362
|
}
|
|
7114
7363
|
async function replaceQueries(project, queries2, opts) {
|
|
7115
|
-
const client =
|
|
7364
|
+
const client = getClient14();
|
|
7116
7365
|
const isJson = isMachineFormat(opts?.format);
|
|
7117
7366
|
if (opts?.dryRun) {
|
|
7118
7367
|
const preview = await client.previewReplaceQueries(project, queries2);
|
|
@@ -7148,7 +7397,7 @@ async function replaceQueries(project, queries2, opts) {
|
|
|
7148
7397
|
console.log(`Set ${queries2.length} ${queries2.length === 1 ? "query" : "queries"} for "${project}".`);
|
|
7149
7398
|
}
|
|
7150
7399
|
async function removeQueries(project, queries2, format) {
|
|
7151
|
-
const client =
|
|
7400
|
+
const client = getClient14();
|
|
7152
7401
|
const existing = await client.listQueries(project);
|
|
7153
7402
|
const existingSet = new Set(existing.map((q) => q.query));
|
|
7154
7403
|
const removedQueries = queries2.filter((q) => existingSet.has(q));
|
|
@@ -7165,7 +7414,7 @@ async function removeQueries(project, queries2, format) {
|
|
|
7165
7414
|
console.log(`Removed ${removedQueries.length} ${removedQueries.length === 1 ? "query" : "queries"} from "${project}".`);
|
|
7166
7415
|
}
|
|
7167
7416
|
async function listQueries(project, format) {
|
|
7168
|
-
const client =
|
|
7417
|
+
const client = getClient14();
|
|
7169
7418
|
const qs = await client.listQueries(project);
|
|
7170
7419
|
if (format === "json") {
|
|
7171
7420
|
console.log(JSON.stringify(qs, null, 2));
|
|
@@ -7211,7 +7460,7 @@ async function importQueries(project, filePath, format) {
|
|
|
7211
7460
|
console.log("No queries found in file.");
|
|
7212
7461
|
return;
|
|
7213
7462
|
}
|
|
7214
|
-
const client =
|
|
7463
|
+
const client = getClient14();
|
|
7215
7464
|
await client.appendQueries(project, queries2);
|
|
7216
7465
|
if (isMachineFormat(format)) {
|
|
7217
7466
|
console.log(JSON.stringify({
|
|
@@ -7225,7 +7474,7 @@ async function importQueries(project, filePath, format) {
|
|
|
7225
7474
|
console.log(`Imported ${queries2.length} ${queries2.length === 1 ? "query" : "queries"} to "${project}".`);
|
|
7226
7475
|
}
|
|
7227
7476
|
async function generateQueries(project, provider, opts) {
|
|
7228
|
-
const client =
|
|
7477
|
+
const client = getClient14();
|
|
7229
7478
|
const result = await client.generateQueries(project, provider, opts.count);
|
|
7230
7479
|
const saved = Boolean(opts.save && result.queries.length > 0);
|
|
7231
7480
|
if (!isMachineFormat(opts.format)) {
|
|
@@ -7720,11 +7969,11 @@ var MCP_CLI_COMMANDS = [
|
|
|
7720
7969
|
];
|
|
7721
7970
|
|
|
7722
7971
|
// src/commands/notify.ts
|
|
7723
|
-
function
|
|
7972
|
+
function getClient15() {
|
|
7724
7973
|
return createApiClient();
|
|
7725
7974
|
}
|
|
7726
7975
|
async function addNotification(project, opts) {
|
|
7727
|
-
const client =
|
|
7976
|
+
const client = getClient15();
|
|
7728
7977
|
const result = await client.createNotification(project, {
|
|
7729
7978
|
channel: "webhook",
|
|
7730
7979
|
url: opts.webhook,
|
|
@@ -7738,7 +7987,7 @@ async function addNotification(project, opts) {
|
|
|
7738
7987
|
printNotification(result);
|
|
7739
7988
|
}
|
|
7740
7989
|
async function listNotifications(project, format) {
|
|
7741
|
-
const client =
|
|
7990
|
+
const client = getClient15();
|
|
7742
7991
|
const results = await client.listNotifications(project);
|
|
7743
7992
|
if (format === "json") {
|
|
7744
7993
|
console.log(JSON.stringify(results, null, 2));
|
|
@@ -7759,7 +8008,7 @@ async function listNotifications(project, format) {
|
|
|
7759
8008
|
}
|
|
7760
8009
|
}
|
|
7761
8010
|
async function removeNotification(project, id, format) {
|
|
7762
|
-
const client =
|
|
8011
|
+
const client = getClient15();
|
|
7763
8012
|
await client.deleteNotification(project, id);
|
|
7764
8013
|
if (isMachineFormat(format)) {
|
|
7765
8014
|
console.log(JSON.stringify({ project, id, removed: true }, null, 2));
|
|
@@ -7768,7 +8017,7 @@ async function removeNotification(project, id, format) {
|
|
|
7768
8017
|
console.log(`Notification ${id} removed from "${project}"`);
|
|
7769
8018
|
}
|
|
7770
8019
|
async function testNotification(project, id, format) {
|
|
7771
|
-
const client =
|
|
8020
|
+
const client = getClient15();
|
|
7772
8021
|
const result = await client.testNotification(project, id);
|
|
7773
8022
|
if (isMachineFormat(format)) {
|
|
7774
8023
|
console.log(JSON.stringify({ project, id, ...result }, null, 2));
|
|
@@ -7963,11 +8212,11 @@ async function applyConfigs(filePaths, format) {
|
|
|
7963
8212
|
}
|
|
7964
8213
|
|
|
7965
8214
|
// src/commands/analytics.ts
|
|
7966
|
-
function
|
|
8215
|
+
function getClient16() {
|
|
7967
8216
|
return createApiClient();
|
|
7968
8217
|
}
|
|
7969
8218
|
async function showAnalytics(project, options) {
|
|
7970
|
-
const client =
|
|
8219
|
+
const client = getClient16();
|
|
7971
8220
|
const features = options.feature ? [options.feature] : ["metrics", "gaps", "sources"];
|
|
7972
8221
|
const results = {};
|
|
7973
8222
|
for (const feature of features) {
|
|
@@ -8170,7 +8419,7 @@ Source Origin Breakdown`);
|
|
|
8170
8419
|
}
|
|
8171
8420
|
|
|
8172
8421
|
// src/commands/sources.ts
|
|
8173
|
-
function
|
|
8422
|
+
function getClient17() {
|
|
8174
8423
|
return createApiClient();
|
|
8175
8424
|
}
|
|
8176
8425
|
var pct = (n) => `${(n * 100).toFixed(1)}%`;
|
|
@@ -8181,7 +8430,7 @@ async function showSources(project, options) {
|
|
|
8181
8430
|
details: { command: "sources", option: "limit", value: options.limit }
|
|
8182
8431
|
});
|
|
8183
8432
|
}
|
|
8184
|
-
const client =
|
|
8433
|
+
const client = getClient17();
|
|
8185
8434
|
const data = await client.getAnalyticsSources(project, { window: options.window, limit: options.limit });
|
|
8186
8435
|
if (options.format === "jsonl") {
|
|
8187
8436
|
emitJsonl(data.ranked.entries.map((e) => ({ project, ...e })));
|
|
@@ -8232,11 +8481,11 @@ function printRankedEntries(list, indent = "") {
|
|
|
8232
8481
|
}
|
|
8233
8482
|
|
|
8234
8483
|
// src/commands/evidence.ts
|
|
8235
|
-
function
|
|
8484
|
+
function getClient18() {
|
|
8236
8485
|
return createApiClient();
|
|
8237
8486
|
}
|
|
8238
8487
|
async function showEvidence(project, format) {
|
|
8239
|
-
const client =
|
|
8488
|
+
const client = getClient18();
|
|
8240
8489
|
const timeline = await client.getTimeline(project);
|
|
8241
8490
|
if (format === "json") {
|
|
8242
8491
|
const enriched = timeline.map((entry) => ({
|
|
@@ -8319,7 +8568,7 @@ async function exportResults(project, opts) {
|
|
|
8319
8568
|
}
|
|
8320
8569
|
|
|
8321
8570
|
// src/commands/history.ts
|
|
8322
|
-
function
|
|
8571
|
+
function getClient19() {
|
|
8323
8572
|
return createApiClient();
|
|
8324
8573
|
}
|
|
8325
8574
|
function originLabel(entry) {
|
|
@@ -8330,7 +8579,7 @@ function originLabel(entry) {
|
|
|
8330
8579
|
return entry.actor;
|
|
8331
8580
|
}
|
|
8332
8581
|
async function showHistory(project, format, opts = {}) {
|
|
8333
|
-
const client =
|
|
8582
|
+
const client = getClient19();
|
|
8334
8583
|
try {
|
|
8335
8584
|
const entries = project ? await client.getHistory(project, opts) : await client.getGlobalHistory(opts);
|
|
8336
8585
|
if (format === "json") {
|
|
@@ -8371,11 +8620,11 @@ async function showHistory(project, format, opts = {}) {
|
|
|
8371
8620
|
}
|
|
8372
8621
|
|
|
8373
8622
|
// src/commands/status.ts
|
|
8374
|
-
function
|
|
8623
|
+
function getClient20() {
|
|
8375
8624
|
return createApiClient();
|
|
8376
8625
|
}
|
|
8377
8626
|
async function showStatus(project, format) {
|
|
8378
|
-
const client =
|
|
8627
|
+
const client = getClient20();
|
|
8379
8628
|
const projectData = await client.getProject(project);
|
|
8380
8629
|
const latest = await getLatestRunSummary(client, project);
|
|
8381
8630
|
if (isMachineFormat(format)) {
|
|
@@ -8574,11 +8823,11 @@ var OPERATOR_CLI_COMMANDS = [
|
|
|
8574
8823
|
];
|
|
8575
8824
|
|
|
8576
8825
|
// src/commands/project.ts
|
|
8577
|
-
function
|
|
8826
|
+
function getClient21() {
|
|
8578
8827
|
return createApiClient();
|
|
8579
8828
|
}
|
|
8580
8829
|
async function createProject(name, opts) {
|
|
8581
|
-
const client =
|
|
8830
|
+
const client = getClient21();
|
|
8582
8831
|
const result = await client.putProject(name, {
|
|
8583
8832
|
displayName: opts.displayName,
|
|
8584
8833
|
canonicalDomain: opts.domain,
|
|
@@ -8596,7 +8845,7 @@ async function createProject(name, opts) {
|
|
|
8596
8845
|
console.log(`Project created: ${result.name} (${result.id})`);
|
|
8597
8846
|
}
|
|
8598
8847
|
async function listProjects(format) {
|
|
8599
|
-
const client =
|
|
8848
|
+
const client = getClient21();
|
|
8600
8849
|
const projects2 = await client.listProjects();
|
|
8601
8850
|
if (format === "json") {
|
|
8602
8851
|
console.log(JSON.stringify(projects2, null, 2));
|
|
@@ -8628,7 +8877,7 @@ async function listProjects(format) {
|
|
|
8628
8877
|
}
|
|
8629
8878
|
}
|
|
8630
8879
|
async function showProject(name, format) {
|
|
8631
|
-
const client =
|
|
8880
|
+
const client = getClient21();
|
|
8632
8881
|
const project = await client.getProject(name);
|
|
8633
8882
|
if (isMachineFormat(format)) {
|
|
8634
8883
|
console.log(JSON.stringify(project, null, 2));
|
|
@@ -8660,7 +8909,7 @@ async function showProject(name, format) {
|
|
|
8660
8909
|
if (project.updatedAt) console.log(` Updated: ${project.updatedAt}`);
|
|
8661
8910
|
}
|
|
8662
8911
|
async function updateProjectSettings(name, opts) {
|
|
8663
|
-
const client =
|
|
8912
|
+
const client = getClient21();
|
|
8664
8913
|
const project = await client.getProject(name);
|
|
8665
8914
|
let ownedDomains = opts.ownedDomains ?? project.ownedDomains ?? [];
|
|
8666
8915
|
if (opts.addOwnedDomain) {
|
|
@@ -8723,7 +8972,7 @@ async function updateProjectSettings(name, opts) {
|
|
|
8723
8972
|
}
|
|
8724
8973
|
}
|
|
8725
8974
|
async function deleteProject(name, opts) {
|
|
8726
|
-
const client =
|
|
8975
|
+
const client = getClient21();
|
|
8727
8976
|
const isJson = isMachineFormat(opts?.format);
|
|
8728
8977
|
if (opts?.dryRun) {
|
|
8729
8978
|
const preview = await client.previewProjectDelete(name);
|
|
@@ -8753,7 +9002,7 @@ async function deleteProject(name, opts) {
|
|
|
8753
9002
|
console.log(`Project deleted: ${name}`);
|
|
8754
9003
|
}
|
|
8755
9004
|
async function addLocation(project, opts) {
|
|
8756
|
-
const client =
|
|
9005
|
+
const client = getClient21();
|
|
8757
9006
|
const location = await client.addLocation(project, {
|
|
8758
9007
|
label: opts.label,
|
|
8759
9008
|
city: opts.city,
|
|
@@ -8768,7 +9017,7 @@ async function addLocation(project, opts) {
|
|
|
8768
9017
|
console.log(`Location added: ${opts.label} (${opts.city}, ${opts.region}, ${opts.country})`);
|
|
8769
9018
|
}
|
|
8770
9019
|
async function listLocations(project, format) {
|
|
8771
|
-
const client =
|
|
9020
|
+
const client = getClient21();
|
|
8772
9021
|
const result = await client.listLocations(project);
|
|
8773
9022
|
if (format === "json") {
|
|
8774
9023
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -8802,7 +9051,7 @@ async function listLocations(project, format) {
|
|
|
8802
9051
|
}
|
|
8803
9052
|
}
|
|
8804
9053
|
async function removeLocation(project, label, format) {
|
|
8805
|
-
const client =
|
|
9054
|
+
const client = getClient21();
|
|
8806
9055
|
await client.removeLocation(project, label);
|
|
8807
9056
|
if (isMachineFormat(format)) {
|
|
8808
9057
|
console.log(JSON.stringify({ project, label, removed: true }, null, 2));
|
|
@@ -8811,7 +9060,7 @@ async function removeLocation(project, label, format) {
|
|
|
8811
9060
|
console.log(`Location removed: ${label}`);
|
|
8812
9061
|
}
|
|
8813
9062
|
async function setDefaultLocation(project, label, format) {
|
|
8814
|
-
const client =
|
|
9063
|
+
const client = getClient21();
|
|
8815
9064
|
const result = await client.setDefaultLocation(project, label);
|
|
8816
9065
|
if (isMachineFormat(format)) {
|
|
8817
9066
|
console.log(JSON.stringify({ project, ...result }, null, 2));
|
|
@@ -9095,12 +9344,12 @@ var REPORT_CLI_COMMANDS = [
|
|
|
9095
9344
|
];
|
|
9096
9345
|
|
|
9097
9346
|
// src/commands/run.ts
|
|
9098
|
-
function
|
|
9347
|
+
function getClient22() {
|
|
9099
9348
|
return createApiClient();
|
|
9100
9349
|
}
|
|
9101
9350
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "partial", "failed", "cancelled"]);
|
|
9102
9351
|
async function triggerRun(project, opts) {
|
|
9103
|
-
const client =
|
|
9352
|
+
const client = getClient22();
|
|
9104
9353
|
const body = {};
|
|
9105
9354
|
if (opts?.provider) {
|
|
9106
9355
|
const providerInputs = opts.provider.split(",").map((s) => s.trim()).filter(Boolean);
|
|
@@ -9202,7 +9451,7 @@ async function triggerRun(project, opts) {
|
|
|
9202
9451
|
}
|
|
9203
9452
|
}
|
|
9204
9453
|
async function triggerRunAll(opts) {
|
|
9205
|
-
const client =
|
|
9454
|
+
const client = getClient22();
|
|
9206
9455
|
const projects2 = await client.listProjects();
|
|
9207
9456
|
if (projects2.length === 0) {
|
|
9208
9457
|
if (isMachineFormat(opts?.format)) {
|
|
@@ -9285,7 +9534,7 @@ async function triggerRunAll(opts) {
|
|
|
9285
9534
|
}
|
|
9286
9535
|
}
|
|
9287
9536
|
async function cancelRun(project, runId, format) {
|
|
9288
|
-
const client =
|
|
9537
|
+
const client = getClient22();
|
|
9289
9538
|
let targetId = runId;
|
|
9290
9539
|
if (!targetId) {
|
|
9291
9540
|
const runs = await client.listRuns(project);
|
|
@@ -9317,7 +9566,7 @@ To cancel by ID : canonry run cancel ${project} <run-id>`,
|
|
|
9317
9566
|
console.log(`Run ${result.id} cancelled.`);
|
|
9318
9567
|
}
|
|
9319
9568
|
async function showRun(id, format) {
|
|
9320
|
-
const client =
|
|
9569
|
+
const client = getClient22();
|
|
9321
9570
|
const run = await client.getRun(id);
|
|
9322
9571
|
if (isMachineFormat(format)) {
|
|
9323
9572
|
console.log(JSON.stringify(run, null, 2));
|
|
@@ -9326,7 +9575,7 @@ async function showRun(id, format) {
|
|
|
9326
9575
|
printRunDetail(run);
|
|
9327
9576
|
}
|
|
9328
9577
|
async function listRuns(project, opts) {
|
|
9329
|
-
const client =
|
|
9578
|
+
const client = getClient22();
|
|
9330
9579
|
const runs = await client.listRuns(project, opts?.limit, opts?.kind);
|
|
9331
9580
|
if (opts?.format === "json") {
|
|
9332
9581
|
console.log(JSON.stringify(runs, null, 2));
|
|
@@ -9349,13 +9598,13 @@ async function listRuns(project, opts) {
|
|
|
9349
9598
|
);
|
|
9350
9599
|
}
|
|
9351
9600
|
}
|
|
9352
|
-
var
|
|
9601
|
+
var POLL_TIMEOUT_MS3 = 10 * 60 * 1e3;
|
|
9353
9602
|
async function pollRun2(client, runId) {
|
|
9354
|
-
const deadline = Date.now() +
|
|
9603
|
+
const deadline = Date.now() + POLL_TIMEOUT_MS3;
|
|
9355
9604
|
for (; ; ) {
|
|
9356
9605
|
await new Promise((r) => setTimeout(r, 2e3));
|
|
9357
9606
|
if (Date.now() > deadline) {
|
|
9358
|
-
throw new Error(`Timed out waiting for run ${runId} after ${
|
|
9607
|
+
throw new Error(`Timed out waiting for run ${runId} after ${POLL_TIMEOUT_MS3 / 1e3}s`);
|
|
9359
9608
|
}
|
|
9360
9609
|
const run = await client.getRun(runId);
|
|
9361
9610
|
process.stderr.write(".");
|
|
@@ -9501,11 +9750,11 @@ var RUN_CLI_COMMANDS = [
|
|
|
9501
9750
|
];
|
|
9502
9751
|
|
|
9503
9752
|
// src/commands/schedule.ts
|
|
9504
|
-
function
|
|
9753
|
+
function getClient23() {
|
|
9505
9754
|
return createApiClient();
|
|
9506
9755
|
}
|
|
9507
9756
|
async function setSchedule(project, opts) {
|
|
9508
|
-
const client =
|
|
9757
|
+
const client = getClient23();
|
|
9509
9758
|
const body = {};
|
|
9510
9759
|
if (opts.kind) body.kind = opts.kind;
|
|
9511
9760
|
if (opts.sourceId) body.sourceId = opts.sourceId;
|
|
@@ -9522,7 +9771,7 @@ async function setSchedule(project, opts) {
|
|
|
9522
9771
|
printSchedule(result);
|
|
9523
9772
|
}
|
|
9524
9773
|
async function showSchedule(project, format, kind) {
|
|
9525
|
-
const client =
|
|
9774
|
+
const client = getClient23();
|
|
9526
9775
|
const result = await client.getSchedule(project, kind);
|
|
9527
9776
|
if (isMachineFormat(format)) {
|
|
9528
9777
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -9531,7 +9780,7 @@ async function showSchedule(project, format, kind) {
|
|
|
9531
9780
|
printSchedule(result);
|
|
9532
9781
|
}
|
|
9533
9782
|
async function enableSchedule(project, format, kind) {
|
|
9534
|
-
const client =
|
|
9783
|
+
const client = getClient23();
|
|
9535
9784
|
const current = await client.getSchedule(project, kind);
|
|
9536
9785
|
const body = { kind: current.kind, timezone: current.timezone, enabled: true };
|
|
9537
9786
|
if (current.preset) body.preset = current.preset;
|
|
@@ -9546,7 +9795,7 @@ async function enableSchedule(project, format, kind) {
|
|
|
9546
9795
|
console.log(`Schedule enabled for "${project}" (kind: ${result.kind})`);
|
|
9547
9796
|
}
|
|
9548
9797
|
async function disableSchedule(project, format, kind) {
|
|
9549
|
-
const client =
|
|
9798
|
+
const client = getClient23();
|
|
9550
9799
|
const current = await client.getSchedule(project, kind);
|
|
9551
9800
|
const body = { kind: current.kind, timezone: current.timezone, enabled: false };
|
|
9552
9801
|
if (current.preset) body.preset = current.preset;
|
|
@@ -9561,7 +9810,7 @@ async function disableSchedule(project, format, kind) {
|
|
|
9561
9810
|
console.log(`Schedule disabled for "${project}" (kind: ${result.kind})`);
|
|
9562
9811
|
}
|
|
9563
9812
|
async function removeSchedule(project, format, kind) {
|
|
9564
|
-
const client =
|
|
9813
|
+
const client = getClient23();
|
|
9565
9814
|
await client.deleteSchedule(project, kind);
|
|
9566
9815
|
const resolvedKind = kind ?? "answer-visibility";
|
|
9567
9816
|
if (isMachineFormat(format)) {
|
|
@@ -9679,11 +9928,11 @@ var SCHEDULE_CLI_COMMANDS = [
|
|
|
9679
9928
|
];
|
|
9680
9929
|
|
|
9681
9930
|
// src/commands/settings.ts
|
|
9682
|
-
function
|
|
9931
|
+
function getClient24() {
|
|
9683
9932
|
return createApiClient();
|
|
9684
9933
|
}
|
|
9685
9934
|
async function setProvider(name, opts) {
|
|
9686
|
-
const client =
|
|
9935
|
+
const client = getClient24();
|
|
9687
9936
|
const { format, ...payload } = opts;
|
|
9688
9937
|
const result = await client.updateProvider(name, payload);
|
|
9689
9938
|
if (isMachineFormat(format)) {
|
|
@@ -9699,7 +9948,7 @@ async function setProvider(name, opts) {
|
|
|
9699
9948
|
}
|
|
9700
9949
|
}
|
|
9701
9950
|
async function showSettings(format) {
|
|
9702
|
-
const client =
|
|
9951
|
+
const client = getClient24();
|
|
9703
9952
|
const config = loadConfig();
|
|
9704
9953
|
const settings = await client.getSettings();
|
|
9705
9954
|
if (isMachineFormat(format)) {
|
|
@@ -10249,7 +10498,7 @@ function wrapText(font, text, size, maxWidth) {
|
|
|
10249
10498
|
}
|
|
10250
10499
|
|
|
10251
10500
|
// src/commands/snapshot.ts
|
|
10252
|
-
function
|
|
10501
|
+
function getClient25() {
|
|
10253
10502
|
return createApiClient();
|
|
10254
10503
|
}
|
|
10255
10504
|
function slugify(value) {
|
|
@@ -10260,7 +10509,7 @@ function autoOutputPath(companyName, ext) {
|
|
|
10260
10509
|
return `${slugify(companyName)}-snapshot-${date}.${ext}`;
|
|
10261
10510
|
}
|
|
10262
10511
|
async function createSnapshotReport(companyName, opts) {
|
|
10263
|
-
const client =
|
|
10512
|
+
const client = getClient25();
|
|
10264
10513
|
const report = await client.createSnapshot({
|
|
10265
10514
|
companyName,
|
|
10266
10515
|
domain: opts.domain,
|
|
@@ -12599,11 +12848,11 @@ var SYSTEM_CLI_COMMANDS = [
|
|
|
12599
12848
|
];
|
|
12600
12849
|
|
|
12601
12850
|
// src/commands/technical-aeo.ts
|
|
12602
|
-
function
|
|
12851
|
+
function getClient26() {
|
|
12603
12852
|
return createApiClient();
|
|
12604
12853
|
}
|
|
12605
12854
|
async function technicalAeoScore(project, opts) {
|
|
12606
|
-
const client =
|
|
12855
|
+
const client = getClient26();
|
|
12607
12856
|
const score = await client.getTechnicalAeoScore(project, { runId: opts.runId });
|
|
12608
12857
|
if (isMachineFormat(opts.format)) {
|
|
12609
12858
|
console.log(JSON.stringify(score, null, 2));
|
|
@@ -12639,7 +12888,7 @@ async function technicalAeoScore(project, opts) {
|
|
|
12639
12888
|
console.log(lines.join("\n"));
|
|
12640
12889
|
}
|
|
12641
12890
|
async function technicalAeoPages(project, opts) {
|
|
12642
|
-
const client =
|
|
12891
|
+
const client = getClient26();
|
|
12643
12892
|
const status = opts.status === "success" || opts.status === "error" ? opts.status : void 0;
|
|
12644
12893
|
const res = await client.getTechnicalAeoPages(project, { runId: opts.runId, status, sort: opts.sort, limit: opts.limit });
|
|
12645
12894
|
if (opts.format === "jsonl") {
|
|
@@ -12665,7 +12914,7 @@ async function technicalAeoPages(project, opts) {
|
|
|
12665
12914
|
console.log(lines.join("\n"));
|
|
12666
12915
|
}
|
|
12667
12916
|
async function technicalAeoTrend(project, opts) {
|
|
12668
|
-
const client =
|
|
12917
|
+
const client = getClient26();
|
|
12669
12918
|
const res = await client.getTechnicalAeoTrend(project, { limit: opts.limit });
|
|
12670
12919
|
if (opts.format === "jsonl") {
|
|
12671
12920
|
emitJsonl(res.points.map((p) => ({ project, ...p })));
|
|
@@ -12687,7 +12936,7 @@ async function technicalAeoTrend(project, opts) {
|
|
|
12687
12936
|
console.log(lines.join("\n"));
|
|
12688
12937
|
}
|
|
12689
12938
|
async function technicalAeoRun(project, opts) {
|
|
12690
|
-
const client =
|
|
12939
|
+
const client = getClient26();
|
|
12691
12940
|
const { runId, status } = await client.triggerSiteAudit(project, {
|
|
12692
12941
|
sitemapUrl: opts.sitemapUrl,
|
|
12693
12942
|
limit: opts.limit
|
|
@@ -13046,7 +13295,7 @@ var VISIBILITY_STATS_CLI_COMMANDS = [
|
|
|
13046
13295
|
import fs15 from "fs";
|
|
13047
13296
|
|
|
13048
13297
|
// src/commands/wordpress.ts
|
|
13049
|
-
function
|
|
13298
|
+
function getClient27() {
|
|
13050
13299
|
return createApiClient();
|
|
13051
13300
|
}
|
|
13052
13301
|
async function loadYamlModule() {
|
|
@@ -13196,7 +13445,7 @@ async function wordpressConnect(project, opts) {
|
|
|
13196
13445
|
details: { project }
|
|
13197
13446
|
});
|
|
13198
13447
|
}
|
|
13199
|
-
const client =
|
|
13448
|
+
const client = getClient27();
|
|
13200
13449
|
const result = await client.wordpressConnect(project, {
|
|
13201
13450
|
url: opts.url,
|
|
13202
13451
|
stagingUrl: opts.stagingUrl,
|
|
@@ -13213,7 +13462,7 @@ async function wordpressConnect(project, opts) {
|
|
|
13213
13462
|
printWordpressStatus(project, result);
|
|
13214
13463
|
}
|
|
13215
13464
|
async function wordpressDisconnect(project, format) {
|
|
13216
|
-
const client =
|
|
13465
|
+
const client = getClient27();
|
|
13217
13466
|
await client.wordpressDisconnect(project);
|
|
13218
13467
|
if (isMachineFormat(format)) {
|
|
13219
13468
|
printJson2({ project, disconnected: true });
|
|
@@ -13222,7 +13471,7 @@ async function wordpressDisconnect(project, format) {
|
|
|
13222
13471
|
console.log(`WordPress disconnected from project "${project}".`);
|
|
13223
13472
|
}
|
|
13224
13473
|
async function wordpressStatus(project, format) {
|
|
13225
|
-
const client =
|
|
13474
|
+
const client = getClient27();
|
|
13226
13475
|
const result = await client.wordpressStatus(project);
|
|
13227
13476
|
if (isMachineFormat(format)) {
|
|
13228
13477
|
printJson2(result);
|
|
@@ -13231,7 +13480,7 @@ async function wordpressStatus(project, format) {
|
|
|
13231
13480
|
printWordpressStatus(project, result);
|
|
13232
13481
|
}
|
|
13233
13482
|
async function wordpressPages(project, opts) {
|
|
13234
|
-
const client =
|
|
13483
|
+
const client = getClient27();
|
|
13235
13484
|
const result = await client.wordpressPages(project, opts.env);
|
|
13236
13485
|
if (isMachineFormat(opts.format)) {
|
|
13237
13486
|
printJson2(result);
|
|
@@ -13240,7 +13489,7 @@ async function wordpressPages(project, opts) {
|
|
|
13240
13489
|
printPages(project, result.env, result.pages);
|
|
13241
13490
|
}
|
|
13242
13491
|
async function wordpressPage(project, slug, opts) {
|
|
13243
|
-
const client =
|
|
13492
|
+
const client = getClient27();
|
|
13244
13493
|
const result = await client.wordpressPage(project, slug, opts.env);
|
|
13245
13494
|
if (isMachineFormat(opts.format)) {
|
|
13246
13495
|
printJson2(result);
|
|
@@ -13249,7 +13498,7 @@ async function wordpressPage(project, slug, opts) {
|
|
|
13249
13498
|
printPageDetail(result);
|
|
13250
13499
|
}
|
|
13251
13500
|
async function wordpressCreatePage(project, body) {
|
|
13252
|
-
const client =
|
|
13501
|
+
const client = getClient27();
|
|
13253
13502
|
const result = await client.wordpressCreatePage(project, body);
|
|
13254
13503
|
if (isMachineFormat(body.format)) {
|
|
13255
13504
|
printJson2(result);
|
|
@@ -13260,7 +13509,7 @@ async function wordpressCreatePage(project, body) {
|
|
|
13260
13509
|
printPageDetail(result);
|
|
13261
13510
|
}
|
|
13262
13511
|
async function wordpressUpdatePage(project, body) {
|
|
13263
|
-
const client =
|
|
13512
|
+
const client = getClient27();
|
|
13264
13513
|
const result = await client.wordpressUpdatePage(project, body);
|
|
13265
13514
|
if (isMachineFormat(body.format)) {
|
|
13266
13515
|
printJson2(result);
|
|
@@ -13271,7 +13520,7 @@ async function wordpressUpdatePage(project, body) {
|
|
|
13271
13520
|
printPageDetail(result);
|
|
13272
13521
|
}
|
|
13273
13522
|
async function wordpressSetMeta(project, body) {
|
|
13274
|
-
const client =
|
|
13523
|
+
const client = getClient27();
|
|
13275
13524
|
const result = await client.wordpressSetMeta(project, body);
|
|
13276
13525
|
if (isMachineFormat(body.format)) {
|
|
13277
13526
|
printJson2(result);
|
|
@@ -13321,7 +13570,7 @@ async function wordpressBulkSetMeta(project, opts) {
|
|
|
13321
13570
|
details: { path: filePath }
|
|
13322
13571
|
});
|
|
13323
13572
|
}
|
|
13324
|
-
const client =
|
|
13573
|
+
const client = getClient27();
|
|
13325
13574
|
const result = await client.wordpressBulkSetMeta(project, { entries, env: opts.env });
|
|
13326
13575
|
if (isMachineFormat(opts.format)) {
|
|
13327
13576
|
printJson2(result);
|
|
@@ -13364,7 +13613,7 @@ async function wordpressBulkSetMeta(project, opts) {
|
|
|
13364
13613
|
Total: ${applied.length} applied, ${skipped.length} skipped, ${manual.length} manual`);
|
|
13365
13614
|
}
|
|
13366
13615
|
async function wordpressSchema(project, slug, opts) {
|
|
13367
|
-
const client =
|
|
13616
|
+
const client = getClient27();
|
|
13368
13617
|
const result = await client.wordpressSchema(project, slug, opts.env);
|
|
13369
13618
|
if (isMachineFormat(opts.format)) {
|
|
13370
13619
|
printJson2(result);
|
|
@@ -13375,7 +13624,7 @@ async function wordpressSchema(project, slug, opts) {
|
|
|
13375
13624
|
printSchemaBlocks(result.blocks);
|
|
13376
13625
|
}
|
|
13377
13626
|
async function wordpressSetSchema(project, body) {
|
|
13378
|
-
const client =
|
|
13627
|
+
const client = getClient27();
|
|
13379
13628
|
const result = await client.wordpressSetSchema(project, body);
|
|
13380
13629
|
if (isMachineFormat(body.format)) {
|
|
13381
13630
|
printJson2(result);
|
|
@@ -13423,7 +13672,7 @@ async function wordpressSchemaDeploy(project, opts) {
|
|
|
13423
13672
|
details: { path: filePath }
|
|
13424
13673
|
});
|
|
13425
13674
|
}
|
|
13426
|
-
const client =
|
|
13675
|
+
const client = getClient27();
|
|
13427
13676
|
const result = await client.wordpressSchemaDeploy(project, { profile: parsed, env: opts.env });
|
|
13428
13677
|
if (isMachineFormat(opts.format)) {
|
|
13429
13678
|
printJson2(result);
|
|
@@ -13462,7 +13711,7 @@ async function wordpressSchemaDeploy(project, opts) {
|
|
|
13462
13711
|
Total: ${deployed} deployed, ${stripped} stripped, ${skipped} skipped, ${failed} failed`);
|
|
13463
13712
|
}
|
|
13464
13713
|
async function wordpressSchemaStatus(project, opts) {
|
|
13465
|
-
const client =
|
|
13714
|
+
const client = getClient27();
|
|
13466
13715
|
const result = await client.wordpressSchemaStatus(project, opts.env);
|
|
13467
13716
|
if (isMachineFormat(opts.format)) {
|
|
13468
13717
|
printJson2(result);
|
|
@@ -13521,7 +13770,7 @@ async function wordpressOnboard(project, opts) {
|
|
|
13521
13770
|
});
|
|
13522
13771
|
}
|
|
13523
13772
|
}
|
|
13524
|
-
const client =
|
|
13773
|
+
const client = getClient27();
|
|
13525
13774
|
const result = await client.wordpressOnboard(project, {
|
|
13526
13775
|
url: opts.url,
|
|
13527
13776
|
username: opts.user,
|
|
@@ -13546,7 +13795,7 @@ async function wordpressOnboard(project, opts) {
|
|
|
13546
13795
|
}
|
|
13547
13796
|
}
|
|
13548
13797
|
async function wordpressLlmsTxt(project, opts) {
|
|
13549
|
-
const client =
|
|
13798
|
+
const client = getClient27();
|
|
13550
13799
|
const result = await client.wordpressLlmsTxt(project, opts.env);
|
|
13551
13800
|
if (isMachineFormat(opts.format)) {
|
|
13552
13801
|
printJson2(result);
|
|
@@ -13557,7 +13806,7 @@ async function wordpressLlmsTxt(project, opts) {
|
|
|
13557
13806
|
console.log(result.content ?? "(not found)");
|
|
13558
13807
|
}
|
|
13559
13808
|
async function wordpressSetLlmsTxt(project, body) {
|
|
13560
|
-
const client =
|
|
13809
|
+
const client = getClient27();
|
|
13561
13810
|
const result = await client.wordpressSetLlmsTxt(project, body);
|
|
13562
13811
|
if (isMachineFormat(body.format)) {
|
|
13563
13812
|
printJson2(result);
|
|
@@ -13566,7 +13815,7 @@ async function wordpressSetLlmsTxt(project, body) {
|
|
|
13566
13815
|
printManualAssist(`llms.txt update for "${project}"`, result);
|
|
13567
13816
|
}
|
|
13568
13817
|
async function wordpressAudit(project, opts) {
|
|
13569
|
-
const client =
|
|
13818
|
+
const client = getClient27();
|
|
13570
13819
|
const result = await client.wordpressAudit(project, opts.env);
|
|
13571
13820
|
if (isMachineFormat(opts.format)) {
|
|
13572
13821
|
printJson2(result);
|
|
@@ -13580,7 +13829,7 @@ async function wordpressAudit(project, opts) {
|
|
|
13580
13829
|
printAuditIssues(result.issues);
|
|
13581
13830
|
}
|
|
13582
13831
|
async function wordpressDiff(project, slug, format) {
|
|
13583
|
-
const client =
|
|
13832
|
+
const client = getClient27();
|
|
13584
13833
|
const result = await client.wordpressDiff(project, slug);
|
|
13585
13834
|
if (isMachineFormat(format)) {
|
|
13586
13835
|
printJson2(result);
|
|
@@ -13589,7 +13838,7 @@ async function wordpressDiff(project, slug, format) {
|
|
|
13589
13838
|
printDiff(result);
|
|
13590
13839
|
}
|
|
13591
13840
|
async function wordpressStagingStatus(project, format) {
|
|
13592
|
-
const client =
|
|
13841
|
+
const client = getClient27();
|
|
13593
13842
|
const result = await client.wordpressStagingStatus(project);
|
|
13594
13843
|
if (isMachineFormat(format)) {
|
|
13595
13844
|
printJson2(result);
|
|
@@ -13603,7 +13852,7 @@ async function wordpressStagingStatus(project, format) {
|
|
|
13603
13852
|
console.log(` Admin URL: ${result.adminUrl}`);
|
|
13604
13853
|
}
|
|
13605
13854
|
async function wordpressStagingPush(project, format) {
|
|
13606
|
-
const client =
|
|
13855
|
+
const client = getClient27();
|
|
13607
13856
|
const result = await client.wordpressStagingPush(project);
|
|
13608
13857
|
if (isMachineFormat(format)) {
|
|
13609
13858
|
printJson2(result);
|
|
@@ -14646,6 +14895,7 @@ var REGISTERED_CLI_COMMANDS = [
|
|
|
14646
14895
|
...CONTENT_CLI_COMMANDS,
|
|
14647
14896
|
...AGENT_CLI_COMMANDS,
|
|
14648
14897
|
...DISCOVER_CLI_COMMANDS,
|
|
14898
|
+
...RESEARCH_CLI_COMMANDS,
|
|
14649
14899
|
...TECHNICAL_AEO_CLI_COMMANDS,
|
|
14650
14900
|
...DOCTOR_CLI_COMMANDS,
|
|
14651
14901
|
...GET_CLI_COMMANDS,
|