@ainyc/canonry 4.78.0 → 4.80.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/assets/agent-workspace/skills/canonry/references/canonry-cli.md +18 -0
- package/assets/assets/{BacklinksPage-CwXveumn.js → BacklinksPage-dRc62jAY.js} +1 -1
- package/assets/assets/{ChartPrimitives-DntKGI5J.js → ChartPrimitives-D2_IvTkk.js} +1 -1
- package/assets/assets/{ProjectPage-CVudiU8X.js → ProjectPage-DSuvRUIf.js} +1 -1
- package/assets/assets/{RunRow-DMtYXaxG.js → RunRow-C0MA3yuQ.js} +1 -1
- package/assets/assets/{RunsPage-Cz-YlucO.js → RunsPage-4uxTYgGy.js} +1 -1
- package/assets/assets/{SettingsPage-BCuG3C-0.js → SettingsPage-3-SLhcJ7.js} +1 -1
- package/assets/assets/{TrafficPage-DV8X47wa.js → TrafficPage-DZ50qwme.js} +1 -1
- package/assets/assets/{TrafficSourceDetailPage-BmYhK9jm.js → TrafficSourceDetailPage-CzK5TMFp.js} +1 -1
- package/assets/assets/{arrow-left-CUmHyNnF.js → arrow-left-BaZIkAXX.js} +1 -1
- package/assets/assets/{extract-error-message-DFjy9_zi.js → extract-error-message-cpvfuFqW.js} +1 -1
- package/assets/assets/{index-D9smxU6R.js → index-EnY_OBRd.js} +70 -70
- package/assets/assets/{trash-2-B_UtEEm8.js → trash-2-JpcztiS5.js} +1 -1
- package/assets/index.html +1 -1
- package/dist/{chunk-XI6YSTGE.js → chunk-2QBSRHSN.js} +187 -1
- package/dist/{chunk-KPN22EWK.js → chunk-AVN6Q6LM.js} +138 -2
- package/dist/{chunk-3WXARKUE.js → chunk-CXIGHPBE.js} +996 -324
- package/dist/{chunk-QKTIP6GC.js → chunk-LCABGFYN.js} +713 -286
- package/dist/cli.js +369 -148
- package/dist/index.d.ts +17 -0
- package/dist/index.js +4 -4
- package/dist/{intelligence-service-CDVUUG7O.js → intelligence-service-ZWW3I3NL.js} +2 -2
- package/dist/mcp.js +9 -3
- package/package.json +11 -10
package/dist/cli.js
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
setTelemetrySource,
|
|
28
28
|
showFirstRunNotice,
|
|
29
29
|
trackEvent
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-LCABGFYN.js";
|
|
31
31
|
import {
|
|
32
32
|
CliError,
|
|
33
33
|
EXIT_SYSTEM_ERROR,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
saveConfig,
|
|
45
45
|
saveConfigPatch,
|
|
46
46
|
usageError
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-2QBSRHSN.js";
|
|
48
48
|
import {
|
|
49
49
|
apiKeys,
|
|
50
50
|
createClient,
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
projects,
|
|
53
53
|
queries,
|
|
54
54
|
renderReportHtml
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-CXIGHPBE.js";
|
|
56
56
|
import {
|
|
57
57
|
CcReleaseSyncStatuses,
|
|
58
58
|
CheckScopes,
|
|
@@ -66,13 +66,14 @@ import {
|
|
|
66
66
|
factorStatusFromScore,
|
|
67
67
|
formatGbpMetricLabel,
|
|
68
68
|
formatIsoDate,
|
|
69
|
+
formatMicros,
|
|
69
70
|
formatRunErrorOneLine,
|
|
70
71
|
normalizeProjectAliases,
|
|
71
72
|
notificationEventSchema,
|
|
72
73
|
providerQuotaPolicySchema,
|
|
73
74
|
resolveProviderInput,
|
|
74
75
|
winnabilityClassSchema
|
|
75
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-AVN6Q6LM.js";
|
|
76
77
|
|
|
77
78
|
// src/cli.ts
|
|
78
79
|
import { pathToFileURL } from "url";
|
|
@@ -2230,10 +2231,229 @@ var DOCTOR_CLI_COMMANDS = [
|
|
|
2230
2231
|
}
|
|
2231
2232
|
];
|
|
2232
2233
|
|
|
2233
|
-
// src/commands/
|
|
2234
|
+
// src/commands/ads.ts
|
|
2234
2235
|
function getClient5() {
|
|
2235
2236
|
return createApiClient();
|
|
2236
2237
|
}
|
|
2238
|
+
function describeConnection(status) {
|
|
2239
|
+
const lines = [];
|
|
2240
|
+
lines.push(`Connected: ${status.connected ? "yes" : "no"}`);
|
|
2241
|
+
if (status.connected) {
|
|
2242
|
+
if (status.displayName) lines.push(`Account: ${status.displayName} (${status.adAccountId ?? "unknown id"})`);
|
|
2243
|
+
if (status.currencyCode) lines.push(`Currency: ${status.currencyCode}`);
|
|
2244
|
+
if (status.timezone) lines.push(`Timezone: ${status.timezone}`);
|
|
2245
|
+
if (status.status) lines.push(`Status: ${status.status}`);
|
|
2246
|
+
lines.push(`Last synced: ${status.lastSyncedAt ?? "never"}`);
|
|
2247
|
+
}
|
|
2248
|
+
return lines;
|
|
2249
|
+
}
|
|
2250
|
+
async function adsConnect(project, opts) {
|
|
2251
|
+
if (!opts.apiKey) {
|
|
2252
|
+
throw new CliError({
|
|
2253
|
+
code: "ADS_API_KEY_REQUIRED",
|
|
2254
|
+
message: "API key is required (pass --api-key)",
|
|
2255
|
+
displayMessage: "Error: --api-key is required (mint an SDK key in OpenAI Ads Manager)",
|
|
2256
|
+
details: { project }
|
|
2257
|
+
});
|
|
2258
|
+
}
|
|
2259
|
+
const client = getClient5();
|
|
2260
|
+
const result = await client.adsConnect(project, { apiKey: opts.apiKey });
|
|
2261
|
+
if (isMachineFormat(opts.format)) {
|
|
2262
|
+
console.log(JSON.stringify(result, null, 2));
|
|
2263
|
+
return;
|
|
2264
|
+
}
|
|
2265
|
+
console.log(`Connected OpenAI ad account for ${project}.`);
|
|
2266
|
+
for (const line of describeConnection(result)) console.log(line);
|
|
2267
|
+
console.log("Schedule daily syncs with: canonry schedule set " + project + " --kind ads-sync --preset daily");
|
|
2268
|
+
}
|
|
2269
|
+
async function adsDisconnect(project, opts) {
|
|
2270
|
+
const client = getClient5();
|
|
2271
|
+
const result = await client.adsDisconnect(project);
|
|
2272
|
+
if (isMachineFormat(opts?.format)) {
|
|
2273
|
+
console.log(JSON.stringify(result, null, 2));
|
|
2274
|
+
return;
|
|
2275
|
+
}
|
|
2276
|
+
console.log(result.disconnected ? `Disconnected the ads connection for ${project}.` : "No ads connection to remove.");
|
|
2277
|
+
}
|
|
2278
|
+
async function adsStatus(project, opts) {
|
|
2279
|
+
const client = getClient5();
|
|
2280
|
+
const result = await client.getAdsStatus(project);
|
|
2281
|
+
if (isMachineFormat(opts?.format)) {
|
|
2282
|
+
console.log(JSON.stringify(result, null, 2));
|
|
2283
|
+
return;
|
|
2284
|
+
}
|
|
2285
|
+
for (const line of describeConnection(result)) console.log(line);
|
|
2286
|
+
if (!result.connected) {
|
|
2287
|
+
console.log("Connect with: canonry ads connect " + project + " --api-key <sdk-key>");
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
async function adsSync(project, opts) {
|
|
2291
|
+
const client = getClient5();
|
|
2292
|
+
const result = await client.triggerAdsSync(project);
|
|
2293
|
+
if (isMachineFormat(opts?.format)) {
|
|
2294
|
+
console.log(JSON.stringify(result, null, 2));
|
|
2295
|
+
return;
|
|
2296
|
+
}
|
|
2297
|
+
console.log(`Ads sync queued (run ${result.runId}). Check progress with: canonry runs get ${result.runId}`);
|
|
2298
|
+
}
|
|
2299
|
+
async function adsCampaigns(project, opts) {
|
|
2300
|
+
const client = getClient5();
|
|
2301
|
+
const result = await client.getAdsCampaigns(project);
|
|
2302
|
+
if (opts?.format === "jsonl") {
|
|
2303
|
+
emitJsonl(result.campaigns.map((campaign) => ({ project, ...campaign })));
|
|
2304
|
+
return;
|
|
2305
|
+
}
|
|
2306
|
+
if (isMachineFormat(opts?.format)) {
|
|
2307
|
+
console.log(JSON.stringify(result, null, 2));
|
|
2308
|
+
return;
|
|
2309
|
+
}
|
|
2310
|
+
if (result.campaigns.length === 0) {
|
|
2311
|
+
console.log('No campaign snapshots. Run "canonry ads sync ' + project + '" first.');
|
|
2312
|
+
return;
|
|
2313
|
+
}
|
|
2314
|
+
for (const campaign of result.campaigns) {
|
|
2315
|
+
const budget = campaign.dailySpendLimitMicros != null ? `${formatMicros(campaign.dailySpendLimitMicros)}/day` : "no daily limit";
|
|
2316
|
+
console.log(`${campaign.name} [${campaign.status}] \u2014 ${campaign.adGroups.length} ad groups, ${budget}`);
|
|
2317
|
+
for (const group of campaign.adGroups) {
|
|
2318
|
+
const bid = group.maxBidMicros != null ? `max bid ${formatMicros(group.maxBidMicros)}` : "auto bid";
|
|
2319
|
+
console.log(` - ${group.name} [${group.status}] \u2014 ${group.ads.length} ads, ${bid}`);
|
|
2320
|
+
const hintLines = group.contextHints.flatMap((hint) => hint.split("\n")).filter(Boolean);
|
|
2321
|
+
for (const hint of hintLines.slice(0, 3)) console.log(` ${hint}`);
|
|
2322
|
+
if (hintLines.length > 3) console.log(` \u2026 and ${hintLines.length - 3} more hint lines`);
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
async function adsInsights(project, opts) {
|
|
2327
|
+
const client = getClient5();
|
|
2328
|
+
const result = await client.getAdsInsights(project, {
|
|
2329
|
+
level: opts?.level,
|
|
2330
|
+
entityId: opts?.entity,
|
|
2331
|
+
from: opts?.from,
|
|
2332
|
+
to: opts?.to
|
|
2333
|
+
});
|
|
2334
|
+
if (opts?.format === "jsonl") {
|
|
2335
|
+
emitJsonl(result.rows.map((row) => ({ project, ...row })));
|
|
2336
|
+
return;
|
|
2337
|
+
}
|
|
2338
|
+
if (isMachineFormat(opts?.format)) {
|
|
2339
|
+
console.log(JSON.stringify(result, null, 2));
|
|
2340
|
+
return;
|
|
2341
|
+
}
|
|
2342
|
+
if (result.rows.length === 0) {
|
|
2343
|
+
console.log('No paid-performance rollups in range. Run "canonry ads sync ' + project + '" first.');
|
|
2344
|
+
return;
|
|
2345
|
+
}
|
|
2346
|
+
const currency = result.currencyCode ?? "USD";
|
|
2347
|
+
console.log("DATE LEVEL ENTITY IMPR CLICKS SPEND CPC");
|
|
2348
|
+
for (const row of result.rows) {
|
|
2349
|
+
const cpc = row.cpcMicros != null ? formatMicros(row.cpcMicros, currency) : "\u2014";
|
|
2350
|
+
console.log(
|
|
2351
|
+
`${row.date} ${row.level.padEnd(9)} ${row.entityId.padEnd(36).slice(0, 36)} ${String(row.impressions).padStart(6)} ${String(row.clicks).padStart(6)} ${formatMicros(row.spendMicros, currency).padStart(9)} ${cpc}`
|
|
2352
|
+
);
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
async function adsSummary(project, opts) {
|
|
2356
|
+
const client = getClient5();
|
|
2357
|
+
const result = await client.getAdsSummary(project);
|
|
2358
|
+
if (isMachineFormat(opts?.format)) {
|
|
2359
|
+
console.log(JSON.stringify(result, null, 2));
|
|
2360
|
+
return;
|
|
2361
|
+
}
|
|
2362
|
+
if (!result.connected) {
|
|
2363
|
+
console.log("Not connected. Connect with: canonry ads connect " + project + " --api-key <sdk-key>");
|
|
2364
|
+
return;
|
|
2365
|
+
}
|
|
2366
|
+
console.log(`Account: ${result.displayName ?? "unknown"} (${result.currencyCode ?? "?"})`);
|
|
2367
|
+
console.log(`Structure: ${result.campaignCount} campaigns / ${result.adGroupCount} ad groups / ${result.adCount} ads`);
|
|
2368
|
+
console.log(`Window: ${result.window.from ?? "\u2014"} \u2192 ${result.window.to ?? "\u2014"}`);
|
|
2369
|
+
console.log(`Impressions: ${result.totals.impressions}`);
|
|
2370
|
+
console.log(`Clicks: ${result.totals.clicks}${result.totals.ctr != null ? ` (CTR ${(result.totals.ctr * 100).toFixed(2)}%)` : ""}`);
|
|
2371
|
+
console.log(`Spend: ${formatMicros(result.totals.spendMicros, result.currencyCode ?? "USD")}${result.totals.cpcMicros != null ? ` (CPC ${formatMicros(result.totals.cpcMicros, result.currencyCode ?? "USD")})` : ""}`);
|
|
2372
|
+
console.log(`Last synced: ${result.lastSyncedAt ?? "never"}`);
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
// src/cli-commands/ads.ts
|
|
2376
|
+
var ADS_CLI_COMMANDS = [
|
|
2377
|
+
{
|
|
2378
|
+
path: ["ads", "connect"],
|
|
2379
|
+
usage: "canonry ads connect <project> --api-key <sdk-key> [--format json]",
|
|
2380
|
+
options: {
|
|
2381
|
+
"api-key": stringOption()
|
|
2382
|
+
},
|
|
2383
|
+
run: async (input) => {
|
|
2384
|
+
const project = requireProject(input, "ads.connect", "canonry ads connect <project> --api-key <sdk-key> [--format json]");
|
|
2385
|
+
await adsConnect(project, {
|
|
2386
|
+
apiKey: getString(input.values, "api-key"),
|
|
2387
|
+
format: input.format
|
|
2388
|
+
});
|
|
2389
|
+
}
|
|
2390
|
+
},
|
|
2391
|
+
{
|
|
2392
|
+
path: ["ads", "disconnect"],
|
|
2393
|
+
usage: "canonry ads disconnect <project> [--format json]",
|
|
2394
|
+
run: async (input) => {
|
|
2395
|
+
const project = requireProject(input, "ads.disconnect", "canonry ads disconnect <project> [--format json]");
|
|
2396
|
+
await adsDisconnect(project, { format: input.format });
|
|
2397
|
+
}
|
|
2398
|
+
},
|
|
2399
|
+
{
|
|
2400
|
+
path: ["ads", "status"],
|
|
2401
|
+
usage: "canonry ads status <project> [--format json]",
|
|
2402
|
+
run: async (input) => {
|
|
2403
|
+
const project = requireProject(input, "ads.status", "canonry ads status <project> [--format json]");
|
|
2404
|
+
await adsStatus(project, { format: input.format });
|
|
2405
|
+
}
|
|
2406
|
+
},
|
|
2407
|
+
{
|
|
2408
|
+
path: ["ads", "sync"],
|
|
2409
|
+
usage: "canonry ads sync <project> [--format json]",
|
|
2410
|
+
run: async (input) => {
|
|
2411
|
+
const project = requireProject(input, "ads.sync", "canonry ads sync <project> [--format json]");
|
|
2412
|
+
await adsSync(project, { format: input.format });
|
|
2413
|
+
}
|
|
2414
|
+
},
|
|
2415
|
+
{
|
|
2416
|
+
path: ["ads", "campaigns"],
|
|
2417
|
+
usage: "canonry ads campaigns <project> [--format json|jsonl]",
|
|
2418
|
+
run: async (input) => {
|
|
2419
|
+
const project = requireProject(input, "ads.campaigns", "canonry ads campaigns <project> [--format json|jsonl]");
|
|
2420
|
+
await adsCampaigns(project, { format: input.format });
|
|
2421
|
+
}
|
|
2422
|
+
},
|
|
2423
|
+
{
|
|
2424
|
+
path: ["ads", "insights"],
|
|
2425
|
+
usage: "canonry ads insights <project> [--level campaign|ad_group] [--entity <id>] [--from YYYY-MM-DD] [--to YYYY-MM-DD] [--format json|jsonl]",
|
|
2426
|
+
options: {
|
|
2427
|
+
level: stringOption(),
|
|
2428
|
+
entity: stringOption(),
|
|
2429
|
+
from: stringOption(),
|
|
2430
|
+
to: stringOption()
|
|
2431
|
+
},
|
|
2432
|
+
run: async (input) => {
|
|
2433
|
+
const project = requireProject(input, "ads.insights", "canonry ads insights <project> [--level <level>] [--entity <id>] [--from <date>] [--to <date>] [--format json|jsonl]");
|
|
2434
|
+
await adsInsights(project, {
|
|
2435
|
+
level: getString(input.values, "level"),
|
|
2436
|
+
entity: getString(input.values, "entity"),
|
|
2437
|
+
from: getString(input.values, "from"),
|
|
2438
|
+
to: getString(input.values, "to"),
|
|
2439
|
+
format: input.format
|
|
2440
|
+
});
|
|
2441
|
+
}
|
|
2442
|
+
},
|
|
2443
|
+
{
|
|
2444
|
+
path: ["ads", "summary"],
|
|
2445
|
+
usage: "canonry ads summary <project> [--format json]",
|
|
2446
|
+
run: async (input) => {
|
|
2447
|
+
const project = requireProject(input, "ads.summary", "canonry ads summary <project> [--format json]");
|
|
2448
|
+
await adsSummary(project, { format: input.format });
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
];
|
|
2452
|
+
|
|
2453
|
+
// src/commands/ga.ts
|
|
2454
|
+
function getClient6() {
|
|
2455
|
+
return createApiClient();
|
|
2456
|
+
}
|
|
2237
2457
|
async function gaConnect(project, opts) {
|
|
2238
2458
|
if (!opts.propertyId) {
|
|
2239
2459
|
throw new CliError({
|
|
@@ -2264,7 +2484,7 @@ async function gaConnect(project, opts) {
|
|
|
2264
2484
|
} else if (opts.keyJson) {
|
|
2265
2485
|
body.keyJson = opts.keyJson;
|
|
2266
2486
|
}
|
|
2267
|
-
const client =
|
|
2487
|
+
const client = getClient6();
|
|
2268
2488
|
const result = await client.gaConnect(project, body);
|
|
2269
2489
|
if (isMachineFormat(opts.format)) {
|
|
2270
2490
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2279,7 +2499,7 @@ async function gaConnect(project, opts) {
|
|
|
2279
2499
|
}
|
|
2280
2500
|
}
|
|
2281
2501
|
async function gaDisconnect(project, format) {
|
|
2282
|
-
const client =
|
|
2502
|
+
const client = getClient6();
|
|
2283
2503
|
await client.gaDisconnect(project);
|
|
2284
2504
|
if (isMachineFormat(format)) {
|
|
2285
2505
|
console.log(JSON.stringify({ project, disconnected: true }, null, 2));
|
|
@@ -2288,7 +2508,7 @@ async function gaDisconnect(project, format) {
|
|
|
2288
2508
|
console.log(`GA4 disconnected from project "${project}".`);
|
|
2289
2509
|
}
|
|
2290
2510
|
async function gaStatus(project, format) {
|
|
2291
|
-
const client =
|
|
2511
|
+
const client = getClient6();
|
|
2292
2512
|
const result = await client.gaStatus(project);
|
|
2293
2513
|
if (isMachineFormat(format)) {
|
|
2294
2514
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2314,7 +2534,7 @@ async function gaStatus(project, format) {
|
|
|
2314
2534
|
console.log(` Connected: ${result.createdAt ?? "unknown"}`);
|
|
2315
2535
|
}
|
|
2316
2536
|
async function gaSync(project, opts) {
|
|
2317
|
-
const client =
|
|
2537
|
+
const client = getClient6();
|
|
2318
2538
|
const body = {};
|
|
2319
2539
|
if (opts?.days) body.days = opts.days;
|
|
2320
2540
|
if (opts?.only) body.only = opts.only;
|
|
@@ -2334,7 +2554,7 @@ async function gaSync(project, opts) {
|
|
|
2334
2554
|
console.log(` Synced at: ${result.syncedAt}`);
|
|
2335
2555
|
}
|
|
2336
2556
|
async function gaTraffic(project, opts) {
|
|
2337
|
-
const client =
|
|
2557
|
+
const client = getClient6();
|
|
2338
2558
|
const params = {};
|
|
2339
2559
|
if (opts?.limit) params.limit = String(opts.limit);
|
|
2340
2560
|
if (opts?.window) params.window = opts.window;
|
|
@@ -2424,7 +2644,7 @@ async function gaTraffic(project, opts) {
|
|
|
2424
2644
|
}
|
|
2425
2645
|
}
|
|
2426
2646
|
async function gaAiReferralHistory(project, opts) {
|
|
2427
|
-
const client =
|
|
2647
|
+
const client = getClient6();
|
|
2428
2648
|
const result = await client.gaAiReferralHistory(project, opts?.window ? { window: opts.window } : void 0);
|
|
2429
2649
|
if (opts?.format === "json") {
|
|
2430
2650
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2452,7 +2672,7 @@ async function gaAiReferralHistory(project, opts) {
|
|
|
2452
2672
|
}
|
|
2453
2673
|
}
|
|
2454
2674
|
async function gaSocialReferralHistory(project, opts) {
|
|
2455
|
-
const client =
|
|
2675
|
+
const client = getClient6();
|
|
2456
2676
|
const result = await client.gaSocialReferralHistory(project, opts?.window ? { window: opts.window } : void 0);
|
|
2457
2677
|
if (opts?.format === "json") {
|
|
2458
2678
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2480,7 +2700,7 @@ async function gaSocialReferralHistory(project, opts) {
|
|
|
2480
2700
|
}
|
|
2481
2701
|
}
|
|
2482
2702
|
async function gaSessionHistory(project, opts) {
|
|
2483
|
-
const client =
|
|
2703
|
+
const client = getClient6();
|
|
2484
2704
|
const result = await client.gaSessionHistory(project, opts?.window ? { window: opts.window } : void 0);
|
|
2485
2705
|
if (opts?.format === "json") {
|
|
2486
2706
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2505,7 +2725,7 @@ async function gaSessionHistory(project, opts) {
|
|
|
2505
2725
|
}
|
|
2506
2726
|
}
|
|
2507
2727
|
async function gaCoverage(project, format) {
|
|
2508
|
-
const client =
|
|
2728
|
+
const client = getClient6();
|
|
2509
2729
|
const result = await client.gaCoverage(project);
|
|
2510
2730
|
if (format === "json") {
|
|
2511
2731
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2531,7 +2751,7 @@ async function gaCoverage(project, format) {
|
|
|
2531
2751
|
}
|
|
2532
2752
|
}
|
|
2533
2753
|
async function gaSocialReferralSummary(project, opts) {
|
|
2534
|
-
const client =
|
|
2754
|
+
const client = getClient6();
|
|
2535
2755
|
const traffic = await client.gaTraffic(project);
|
|
2536
2756
|
if (opts?.trend) {
|
|
2537
2757
|
const trend = await client.gaSocialReferralTrend(project);
|
|
@@ -2592,7 +2812,7 @@ async function gaSocialReferralSummary(project, opts) {
|
|
|
2592
2812
|
}
|
|
2593
2813
|
}
|
|
2594
2814
|
async function gaAttribution(project, opts) {
|
|
2595
|
-
const client =
|
|
2815
|
+
const client = getClient6();
|
|
2596
2816
|
const traffic = await client.gaTraffic(project);
|
|
2597
2817
|
const fmtTrend = (pct3) => pct3 === null ? "n/a" : `${pct3 >= 0 ? "+" : ""}${pct3}%`;
|
|
2598
2818
|
if (opts?.trend) {
|
|
@@ -2919,7 +3139,7 @@ var GA_CLI_COMMANDS = [
|
|
|
2919
3139
|
];
|
|
2920
3140
|
|
|
2921
3141
|
// src/commands/gbp.ts
|
|
2922
|
-
function
|
|
3142
|
+
function getClient7() {
|
|
2923
3143
|
return createApiClient();
|
|
2924
3144
|
}
|
|
2925
3145
|
function formatLocationsTable(response) {
|
|
@@ -2937,7 +3157,7 @@ function formatLocationsTable(response) {
|
|
|
2937
3157
|
return lines.join("\n");
|
|
2938
3158
|
}
|
|
2939
3159
|
async function gbpConnect(project, opts) {
|
|
2940
|
-
const client =
|
|
3160
|
+
const client = getClient7();
|
|
2941
3161
|
const { authUrl, redirectUri } = await client.googleConnect(project, {
|
|
2942
3162
|
type: "gbp",
|
|
2943
3163
|
publicUrl: opts.publicUrl
|
|
@@ -2956,7 +3176,7 @@ async function gbpConnect(project, opts) {
|
|
|
2956
3176
|
console.log("After authorizing, run `canonry gbp locations discover <project>` to fetch your locations.");
|
|
2957
3177
|
}
|
|
2958
3178
|
async function gbpDisconnect(project, opts) {
|
|
2959
|
-
const client =
|
|
3179
|
+
const client = getClient7();
|
|
2960
3180
|
await client.disconnectGbp(project);
|
|
2961
3181
|
if (isMachineFormat(opts.format)) {
|
|
2962
3182
|
console.log(JSON.stringify({ project, disconnected: true }, null, 2));
|
|
@@ -2965,7 +3185,7 @@ async function gbpDisconnect(project, opts) {
|
|
|
2965
3185
|
console.log(`Disconnected GBP from project "${project}" and removed all discovered locations.`);
|
|
2966
3186
|
}
|
|
2967
3187
|
async function gbpLocationsList(project, opts) {
|
|
2968
|
-
const client =
|
|
3188
|
+
const client = getClient7();
|
|
2969
3189
|
const response = await client.listGbpLocations(
|
|
2970
3190
|
project,
|
|
2971
3191
|
opts.selectedOnly ? { selected: true } : void 0
|
|
@@ -2977,7 +3197,7 @@ async function gbpLocationsList(project, opts) {
|
|
|
2977
3197
|
console.log(formatLocationsTable(response));
|
|
2978
3198
|
}
|
|
2979
3199
|
async function gbpAccounts(project, opts) {
|
|
2980
|
-
const client =
|
|
3200
|
+
const client = getClient7();
|
|
2981
3201
|
const response = await client.listGbpAccounts(project);
|
|
2982
3202
|
if (isMachineFormat(opts.format)) {
|
|
2983
3203
|
console.log(JSON.stringify(response, null, 2));
|
|
@@ -3002,7 +3222,7 @@ function formatAccountsTable(response) {
|
|
|
3002
3222
|
return lines.join("\n");
|
|
3003
3223
|
}
|
|
3004
3224
|
async function gbpLocationsDiscover(project, opts) {
|
|
3005
|
-
const client =
|
|
3225
|
+
const client = getClient7();
|
|
3006
3226
|
const hasBody = opts.selectAllNew !== void 0 || opts.account !== void 0 || opts.switchAccount;
|
|
3007
3227
|
const body = hasBody ? {
|
|
3008
3228
|
...opts.selectAllNew === void 0 ? {} : { selectAllNew: opts.selectAllNew },
|
|
@@ -3019,7 +3239,7 @@ Discovered ${response.totalDiscovered} location(s); ${response.totalSelected} se
|
|
|
3019
3239
|
console.log(formatLocationsTable(response));
|
|
3020
3240
|
}
|
|
3021
3241
|
async function gbpLocationSelect(project, opts) {
|
|
3022
|
-
const client =
|
|
3242
|
+
const client = getClient7();
|
|
3023
3243
|
const updated = await client.setGbpLocationSelection(project, opts.location, true);
|
|
3024
3244
|
if (isMachineFormat(opts.format)) {
|
|
3025
3245
|
console.log(JSON.stringify(updated, null, 2));
|
|
@@ -3028,7 +3248,7 @@ async function gbpLocationSelect(project, opts) {
|
|
|
3028
3248
|
console.log(`Selected ${opts.location} ("${updated.displayName}") for sync.`);
|
|
3029
3249
|
}
|
|
3030
3250
|
async function gbpLocationDeselect(project, opts) {
|
|
3031
|
-
const client =
|
|
3251
|
+
const client = getClient7();
|
|
3032
3252
|
const updated = await client.setGbpLocationSelection(project, opts.location, false);
|
|
3033
3253
|
if (isMachineFormat(opts.format)) {
|
|
3034
3254
|
console.log(JSON.stringify(updated, null, 2));
|
|
@@ -3037,7 +3257,7 @@ async function gbpLocationDeselect(project, opts) {
|
|
|
3037
3257
|
console.log(`Deselected ${opts.location} ("${updated.displayName}"). Future syncs will skip this location.`);
|
|
3038
3258
|
}
|
|
3039
3259
|
async function gbpSync(project, opts) {
|
|
3040
|
-
const client =
|
|
3260
|
+
const client = getClient7();
|
|
3041
3261
|
const { runId, status } = await client.triggerGbpSync(project, {
|
|
3042
3262
|
locationNames: opts.location ? [opts.location] : void 0,
|
|
3043
3263
|
daysOfMetrics: opts.days,
|
|
@@ -3073,7 +3293,7 @@ async function gbpSync(project, opts) {
|
|
|
3073
3293
|
console.log(`GBP sync ${final} (run ${runId}).`);
|
|
3074
3294
|
}
|
|
3075
3295
|
async function gbpMetrics(project, opts) {
|
|
3076
|
-
const client =
|
|
3296
|
+
const client = getClient7();
|
|
3077
3297
|
const response = await client.listGbpMetrics(project, { locationName: opts.location, metric: opts.metric });
|
|
3078
3298
|
if (isMachineFormat(opts.format)) {
|
|
3079
3299
|
console.log(JSON.stringify(response, null, 2));
|
|
@@ -3091,7 +3311,7 @@ async function gbpMetrics(project, opts) {
|
|
|
3091
3311
|
}
|
|
3092
3312
|
}
|
|
3093
3313
|
async function gbpKeywords(project, opts) {
|
|
3094
|
-
const client =
|
|
3314
|
+
const client = getClient7();
|
|
3095
3315
|
const response = await client.listGbpKeywords(project, { locationName: opts.location });
|
|
3096
3316
|
if (isMachineFormat(opts.format)) {
|
|
3097
3317
|
console.log(JSON.stringify(response, null, 2));
|
|
@@ -3108,7 +3328,7 @@ async function gbpKeywords(project, opts) {
|
|
|
3108
3328
|
}
|
|
3109
3329
|
}
|
|
3110
3330
|
async function gbpPlaceActions(project, opts) {
|
|
3111
|
-
const client =
|
|
3331
|
+
const client = getClient7();
|
|
3112
3332
|
const response = await client.listGbpPlaceActions(project, { locationName: opts.location });
|
|
3113
3333
|
if (isMachineFormat(opts.format)) {
|
|
3114
3334
|
console.log(JSON.stringify(response, null, 2));
|
|
@@ -3125,7 +3345,7 @@ async function gbpPlaceActions(project, opts) {
|
|
|
3125
3345
|
}
|
|
3126
3346
|
}
|
|
3127
3347
|
async function gbpLodging(project, opts) {
|
|
3128
|
-
const client =
|
|
3348
|
+
const client = getClient7();
|
|
3129
3349
|
const response = await client.listGbpLodging(project, { locationName: opts.location });
|
|
3130
3350
|
if (isMachineFormat(opts.format)) {
|
|
3131
3351
|
console.log(JSON.stringify(response, null, 2));
|
|
@@ -3142,7 +3362,7 @@ async function gbpLodging(project, opts) {
|
|
|
3142
3362
|
}
|
|
3143
3363
|
}
|
|
3144
3364
|
async function gbpPlaces(project, opts) {
|
|
3145
|
-
const client =
|
|
3365
|
+
const client = getClient7();
|
|
3146
3366
|
const response = await client.listGbpPlaces(project, { locationName: opts.location });
|
|
3147
3367
|
if (isMachineFormat(opts.format)) {
|
|
3148
3368
|
console.log(JSON.stringify(response, null, 2));
|
|
@@ -3163,7 +3383,7 @@ function fmtDelta(pct3) {
|
|
|
3163
3383
|
return `${pct3 >= 0 ? "+" : ""}${pct3}%`;
|
|
3164
3384
|
}
|
|
3165
3385
|
async function gbpSummary(project, opts) {
|
|
3166
|
-
const client =
|
|
3386
|
+
const client = getClient7();
|
|
3167
3387
|
const s = await client.getGbpSummary(project, { locationName: opts.location });
|
|
3168
3388
|
if (isMachineFormat(opts.format)) {
|
|
3169
3389
|
console.log(JSON.stringify(s, null, 2));
|
|
@@ -3481,7 +3701,7 @@ var GET_CLI_COMMANDS = [
|
|
|
3481
3701
|
];
|
|
3482
3702
|
|
|
3483
3703
|
// src/commands/traffic.ts
|
|
3484
|
-
function
|
|
3704
|
+
function getClient8() {
|
|
3485
3705
|
return createApiClient();
|
|
3486
3706
|
}
|
|
3487
3707
|
function configString(value, fallback = "(unset)") {
|
|
@@ -3535,7 +3755,7 @@ async function trafficConnectWordpress(project, opts) {
|
|
|
3535
3755
|
details: { project }
|
|
3536
3756
|
});
|
|
3537
3757
|
}
|
|
3538
|
-
const client =
|
|
3758
|
+
const client = getClient8();
|
|
3539
3759
|
const result = await client.trafficConnectWordpress(project, {
|
|
3540
3760
|
baseUrl: opts.url,
|
|
3541
3761
|
username: opts.username,
|
|
@@ -3586,7 +3806,7 @@ async function trafficConnectCloudRun(project, opts) {
|
|
|
3586
3806
|
details: { project, keyFile: opts.serviceAccountKey }
|
|
3587
3807
|
});
|
|
3588
3808
|
}
|
|
3589
|
-
const client =
|
|
3809
|
+
const client = getClient8();
|
|
3590
3810
|
const result = await client.trafficConnectCloudRun(project, {
|
|
3591
3811
|
gcpProjectId: opts.gcpProject,
|
|
3592
3812
|
serviceName: opts.service,
|
|
@@ -3664,7 +3884,7 @@ async function trafficConnectVercel(project, opts) {
|
|
|
3664
3884
|
details: { project, environment: opts.environment }
|
|
3665
3885
|
});
|
|
3666
3886
|
}
|
|
3667
|
-
const client =
|
|
3887
|
+
const client = getClient8();
|
|
3668
3888
|
const result = await client.trafficConnectVercel(project, {
|
|
3669
3889
|
projectId: opts.projectId,
|
|
3670
3890
|
teamId: opts.teamId,
|
|
@@ -3695,7 +3915,7 @@ async function trafficBackfill(project, opts) {
|
|
|
3695
3915
|
details: { project }
|
|
3696
3916
|
});
|
|
3697
3917
|
}
|
|
3698
|
-
const client =
|
|
3918
|
+
const client = getClient8();
|
|
3699
3919
|
const submitted = await client.trafficBackfill(project, opts.source, {
|
|
3700
3920
|
days: opts.days
|
|
3701
3921
|
});
|
|
@@ -3764,7 +3984,7 @@ async function trafficSync(project, opts) {
|
|
|
3764
3984
|
details: { project }
|
|
3765
3985
|
});
|
|
3766
3986
|
}
|
|
3767
|
-
const client =
|
|
3987
|
+
const client = getClient8();
|
|
3768
3988
|
const result = await client.trafficSync(project, opts.source, {
|
|
3769
3989
|
sinceMinutes: opts.sinceMinutes
|
|
3770
3990
|
});
|
|
@@ -3802,7 +4022,7 @@ async function trafficReset(project, opts) {
|
|
|
3802
4022
|
details: { project, source: opts.source }
|
|
3803
4023
|
});
|
|
3804
4024
|
}
|
|
3805
|
-
const client =
|
|
4025
|
+
const client = getClient8();
|
|
3806
4026
|
const updated = await client.trafficReset(project, opts.source);
|
|
3807
4027
|
if (isMachineFormat(opts.format)) {
|
|
3808
4028
|
console.log(JSON.stringify(updated, null, 2));
|
|
@@ -4224,11 +4444,11 @@ var TRAFFIC_CLI_COMMANDS = [
|
|
|
4224
4444
|
];
|
|
4225
4445
|
|
|
4226
4446
|
// src/commands/competitor.ts
|
|
4227
|
-
function
|
|
4447
|
+
function getClient9() {
|
|
4228
4448
|
return createApiClient();
|
|
4229
4449
|
}
|
|
4230
4450
|
async function addCompetitors(project, domains, format) {
|
|
4231
|
-
const client =
|
|
4451
|
+
const client = getClient9();
|
|
4232
4452
|
const existing = await client.listCompetitors(project);
|
|
4233
4453
|
const existingDomains = existing.map((c) => c.domain);
|
|
4234
4454
|
const existingSet = new Set(existingDomains);
|
|
@@ -4252,7 +4472,7 @@ async function addCompetitors(project, domains, format) {
|
|
|
4252
4472
|
}
|
|
4253
4473
|
}
|
|
4254
4474
|
async function removeCompetitors(project, domains, format) {
|
|
4255
|
-
const client =
|
|
4475
|
+
const client = getClient9();
|
|
4256
4476
|
const existing = await client.listCompetitors(project);
|
|
4257
4477
|
const existingDomains = existing.map((c) => c.domain);
|
|
4258
4478
|
const requested = new Set(uniqueStrings(domains));
|
|
@@ -4281,7 +4501,7 @@ function uniqueStrings(values) {
|
|
|
4281
4501
|
return result;
|
|
4282
4502
|
}
|
|
4283
4503
|
async function listCompetitors(project, format) {
|
|
4284
|
-
const client =
|
|
4504
|
+
const client = getClient9();
|
|
4285
4505
|
const comps = await client.listCompetitors(project);
|
|
4286
4506
|
if (format === "json") {
|
|
4287
4507
|
console.log(JSON.stringify(comps, null, 2));
|
|
@@ -4380,7 +4600,7 @@ var COMPETITOR_CLI_COMMANDS = [
|
|
|
4380
4600
|
|
|
4381
4601
|
// src/commands/google.ts
|
|
4382
4602
|
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.";
|
|
4383
|
-
function
|
|
4603
|
+
function getClient10() {
|
|
4384
4604
|
return createApiClient();
|
|
4385
4605
|
}
|
|
4386
4606
|
async function waitForRunStatus2(client, runId, config) {
|
|
@@ -4420,7 +4640,7 @@ async function waitForRunStatus2(client, runId, config) {
|
|
|
4420
4640
|
});
|
|
4421
4641
|
}
|
|
4422
4642
|
async function googleConnect(project, opts) {
|
|
4423
|
-
const client =
|
|
4643
|
+
const client = getClient10();
|
|
4424
4644
|
const { authUrl, redirectUri } = await client.googleConnect(project, {
|
|
4425
4645
|
type: opts.type,
|
|
4426
4646
|
publicUrl: opts.publicUrl
|
|
@@ -4454,7 +4674,7 @@ Open this URL in your browser to authorize Google ${opts.type.toUpperCase()} acc
|
|
|
4454
4674
|
}
|
|
4455
4675
|
}
|
|
4456
4676
|
async function googleDisconnect(project, opts) {
|
|
4457
|
-
const client =
|
|
4677
|
+
const client = getClient10();
|
|
4458
4678
|
await client.googleDisconnect(project, opts.type);
|
|
4459
4679
|
if (isMachineFormat(opts.format)) {
|
|
4460
4680
|
console.log(JSON.stringify({ project, type: opts.type, disconnected: true }, null, 2));
|
|
@@ -4463,7 +4683,7 @@ async function googleDisconnect(project, opts) {
|
|
|
4463
4683
|
console.log(`Disconnected Google ${opts.type.toUpperCase()} from project "${project}".`);
|
|
4464
4684
|
}
|
|
4465
4685
|
async function googleStatus(project, format) {
|
|
4466
|
-
const client =
|
|
4686
|
+
const client = getClient10();
|
|
4467
4687
|
const connections = await client.googleConnections(project);
|
|
4468
4688
|
if (format === "json") {
|
|
4469
4689
|
console.log(JSON.stringify({ connections }, null, 2));
|
|
@@ -4490,7 +4710,7 @@ async function googleStatus(project, format) {
|
|
|
4490
4710
|
}
|
|
4491
4711
|
}
|
|
4492
4712
|
async function googleProperties(project, format) {
|
|
4493
|
-
const client =
|
|
4713
|
+
const client = getClient10();
|
|
4494
4714
|
const { sites } = await client.googleProperties(project);
|
|
4495
4715
|
if (format === "json") {
|
|
4496
4716
|
console.log(JSON.stringify({ sites }, null, 2));
|
|
@@ -4514,7 +4734,7 @@ async function googleProperties(project, format) {
|
|
|
4514
4734
|
Use "canonry google set-property <project> <siteUrl>" to select a property.`);
|
|
4515
4735
|
}
|
|
4516
4736
|
async function googleSetProperty(project, propertyUrl, format) {
|
|
4517
|
-
const client =
|
|
4737
|
+
const client = getClient10();
|
|
4518
4738
|
await client.googleSetProperty(project, "gsc", propertyUrl);
|
|
4519
4739
|
if (isMachineFormat(format)) {
|
|
4520
4740
|
console.log(JSON.stringify({ project, type: "gsc", propertyUrl }, null, 2));
|
|
@@ -4523,7 +4743,7 @@ async function googleSetProperty(project, propertyUrl, format) {
|
|
|
4523
4743
|
console.log(`GSC property set to "${propertyUrl}" for project "${project}".`);
|
|
4524
4744
|
}
|
|
4525
4745
|
async function googleSync(project, opts) {
|
|
4526
|
-
const client =
|
|
4746
|
+
const client = getClient10();
|
|
4527
4747
|
const run = await client.gscSync(project, { days: opts.days, full: opts.full });
|
|
4528
4748
|
if (!opts.wait && isMachineFormat(opts.format)) {
|
|
4529
4749
|
console.log(JSON.stringify(run, null, 2));
|
|
@@ -4553,7 +4773,7 @@ async function googleSync(project, opts) {
|
|
|
4553
4773
|
}
|
|
4554
4774
|
}
|
|
4555
4775
|
async function googlePerformanceDaily(project, opts) {
|
|
4556
|
-
const client =
|
|
4776
|
+
const client = getClient10();
|
|
4557
4777
|
const params = {};
|
|
4558
4778
|
if (opts.window) params.window = opts.window;
|
|
4559
4779
|
if (opts.startDate) params.startDate = opts.startDate;
|
|
@@ -4586,7 +4806,7 @@ async function googlePerformanceDaily(project, opts) {
|
|
|
4586
4806
|
}
|
|
4587
4807
|
}
|
|
4588
4808
|
async function googlePerformance(project, opts) {
|
|
4589
|
-
const client =
|
|
4809
|
+
const client = getClient10();
|
|
4590
4810
|
const params = {};
|
|
4591
4811
|
if (opts.days) {
|
|
4592
4812
|
const end = /* @__PURE__ */ new Date();
|
|
@@ -4625,7 +4845,7 @@ async function googlePerformance(project, opts) {
|
|
|
4625
4845
|
}
|
|
4626
4846
|
}
|
|
4627
4847
|
async function googleInspect(project, url, format) {
|
|
4628
|
-
const client =
|
|
4848
|
+
const client = getClient10();
|
|
4629
4849
|
const result = await client.gscInspect(project, url);
|
|
4630
4850
|
if (isMachineFormat(format)) {
|
|
4631
4851
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -4645,7 +4865,7 @@ URL Inspection: ${result.url}
|
|
|
4645
4865
|
console.log(` Inspected At: ${result.inspectedAt}`);
|
|
4646
4866
|
}
|
|
4647
4867
|
async function googleInspections(project, opts) {
|
|
4648
|
-
const client =
|
|
4868
|
+
const client = getClient10();
|
|
4649
4869
|
const params = {};
|
|
4650
4870
|
if (opts.url) params.url = opts.url;
|
|
4651
4871
|
const rows = await client.gscInspections(project, Object.keys(params).length > 0 ? params : void 0);
|
|
@@ -4673,7 +4893,7 @@ async function googleInspections(project, opts) {
|
|
|
4673
4893
|
}
|
|
4674
4894
|
}
|
|
4675
4895
|
async function googleCoverage(project, format) {
|
|
4676
|
-
const client =
|
|
4896
|
+
const client = getClient10();
|
|
4677
4897
|
const result = await client.gscCoverage(project);
|
|
4678
4898
|
if (isMachineFormat(format)) {
|
|
4679
4899
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -4719,7 +4939,7 @@ Index Coverage for "${project}"
|
|
|
4719
4939
|
}
|
|
4720
4940
|
}
|
|
4721
4941
|
async function googleSetSitemap(project, sitemapUrl, format) {
|
|
4722
|
-
const client =
|
|
4942
|
+
const client = getClient10();
|
|
4723
4943
|
await client.googleSetSitemap(project, "gsc", sitemapUrl);
|
|
4724
4944
|
if (isMachineFormat(format)) {
|
|
4725
4945
|
console.log(JSON.stringify({ project, type: "gsc", sitemapUrl }, null, 2));
|
|
@@ -4728,7 +4948,7 @@ async function googleSetSitemap(project, sitemapUrl, format) {
|
|
|
4728
4948
|
console.log(`GSC sitemap URL set to "${sitemapUrl}" for project "${project}".`);
|
|
4729
4949
|
}
|
|
4730
4950
|
async function googleListSitemaps(project, opts) {
|
|
4731
|
-
const client =
|
|
4951
|
+
const client = getClient10();
|
|
4732
4952
|
const result = await client.gscSitemaps(project);
|
|
4733
4953
|
if (opts.format === "json") {
|
|
4734
4954
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -4753,7 +4973,7 @@ Sitemaps for project "${project}":
|
|
|
4753
4973
|
}
|
|
4754
4974
|
}
|
|
4755
4975
|
async function googleInspectSitemap(project, opts) {
|
|
4756
|
-
const client =
|
|
4976
|
+
const client = getClient10();
|
|
4757
4977
|
const run = await client.gscInspectSitemap(project, {
|
|
4758
4978
|
sitemapUrl: opts.sitemapUrl
|
|
4759
4979
|
});
|
|
@@ -4789,7 +5009,7 @@ async function googleInspectSitemap(project, opts) {
|
|
|
4789
5009
|
}
|
|
4790
5010
|
}
|
|
4791
5011
|
async function googleCoverageHistory(project, opts) {
|
|
4792
|
-
const client =
|
|
5012
|
+
const client = getClient10();
|
|
4793
5013
|
const rows = await client.gscCoverageHistory(project, { limit: opts.limit });
|
|
4794
5014
|
if (opts.format === "json") {
|
|
4795
5015
|
console.log(JSON.stringify(rows, null, 2));
|
|
@@ -4814,7 +5034,7 @@ GSC Coverage History for "${project}" (${rows.length} snapshots):
|
|
|
4814
5034
|
}
|
|
4815
5035
|
}
|
|
4816
5036
|
async function googleDiscoverSitemaps(project, opts) {
|
|
4817
|
-
const client =
|
|
5037
|
+
const client = getClient10();
|
|
4818
5038
|
const result = await client.gscDiscoverSitemaps(project);
|
|
4819
5039
|
if (!opts.wait && isMachineFormat(opts.format)) {
|
|
4820
5040
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -4866,7 +5086,7 @@ Primary sitemap: ${result.primarySitemapUrl}`);
|
|
|
4866
5086
|
}
|
|
4867
5087
|
}
|
|
4868
5088
|
async function googleRequestIndexing(project, opts) {
|
|
4869
|
-
const client =
|
|
5089
|
+
const client = getClient10();
|
|
4870
5090
|
const body = { urls: [] };
|
|
4871
5091
|
if (opts.allUnindexed) {
|
|
4872
5092
|
body.allUnindexed = true;
|
|
@@ -4961,7 +5181,7 @@ async function googleRequestIndexing(project, opts) {
|
|
|
4961
5181
|
}
|
|
4962
5182
|
}
|
|
4963
5183
|
async function googleRefresh(project, format) {
|
|
4964
|
-
const client =
|
|
5184
|
+
const client = getClient10();
|
|
4965
5185
|
const run = await client.gscSync(project, {});
|
|
4966
5186
|
if (!isMachineFormat(format)) {
|
|
4967
5187
|
process.stderr.write("Refreshing GSC coverage data");
|
|
@@ -4984,7 +5204,7 @@ async function googleRefresh(project, format) {
|
|
|
4984
5204
|
await googleCoverage(project, format);
|
|
4985
5205
|
}
|
|
4986
5206
|
async function googleDeindexed(project, format) {
|
|
4987
|
-
const client =
|
|
5207
|
+
const client = getClient10();
|
|
4988
5208
|
const rows = await client.gscDeindexed(project);
|
|
4989
5209
|
if (format === "json") {
|
|
4990
5210
|
console.log(JSON.stringify(rows, null, 2));
|
|
@@ -5293,14 +5513,14 @@ var GOOGLE_CLI_COMMANDS = [
|
|
|
5293
5513
|
];
|
|
5294
5514
|
|
|
5295
5515
|
// src/commands/keys.ts
|
|
5296
|
-
function
|
|
5516
|
+
function getClient11() {
|
|
5297
5517
|
return createApiClient();
|
|
5298
5518
|
}
|
|
5299
5519
|
function keyStatus(key) {
|
|
5300
5520
|
return key.revokedAt ? "revoked" : "active";
|
|
5301
5521
|
}
|
|
5302
5522
|
async function listApiKeys(format) {
|
|
5303
|
-
const client =
|
|
5523
|
+
const client = getClient11();
|
|
5304
5524
|
const { keys } = await client.listApiKeys();
|
|
5305
5525
|
if (format === "json") {
|
|
5306
5526
|
console.log(JSON.stringify({ keys }, null, 2));
|
|
@@ -5325,7 +5545,7 @@ async function listApiKeys(format) {
|
|
|
5325
5545
|
}
|
|
5326
5546
|
}
|
|
5327
5547
|
async function createApiKey(opts) {
|
|
5328
|
-
const client =
|
|
5548
|
+
const client = getClient11();
|
|
5329
5549
|
const body = { name: opts.name };
|
|
5330
5550
|
if (opts.scopes && opts.scopes.length > 0) body.scopes = opts.scopes;
|
|
5331
5551
|
const created = await client.createApiKey(body);
|
|
@@ -5341,7 +5561,7 @@ async function createApiKey(opts) {
|
|
|
5341
5561
|
console.log("\nSave this now \u2014 it will not be shown again.");
|
|
5342
5562
|
}
|
|
5343
5563
|
async function revokeApiKey(id, format) {
|
|
5344
|
-
const client =
|
|
5564
|
+
const client = getClient11();
|
|
5345
5565
|
const key = await client.revokeApiKey(id);
|
|
5346
5566
|
if (isMachineFormat(format)) {
|
|
5347
5567
|
console.log(JSON.stringify(key, null, 2));
|
|
@@ -5408,11 +5628,11 @@ var KEYS_CLI_COMMANDS = [
|
|
|
5408
5628
|
|
|
5409
5629
|
// src/commands/keyword.ts
|
|
5410
5630
|
import fs2 from "fs";
|
|
5411
|
-
function
|
|
5631
|
+
function getClient12() {
|
|
5412
5632
|
return createApiClient();
|
|
5413
5633
|
}
|
|
5414
5634
|
async function addKeywords(project, keywords, format) {
|
|
5415
|
-
const client =
|
|
5635
|
+
const client = getClient12();
|
|
5416
5636
|
await client.appendKeywords(project, keywords);
|
|
5417
5637
|
if (isMachineFormat(format)) {
|
|
5418
5638
|
console.log(JSON.stringify({
|
|
@@ -5425,7 +5645,7 @@ async function addKeywords(project, keywords, format) {
|
|
|
5425
5645
|
console.log(`Added ${keywords.length} key phrase(s) to "${project}".`);
|
|
5426
5646
|
}
|
|
5427
5647
|
async function replaceKeywords(project, keywords, format) {
|
|
5428
|
-
const client =
|
|
5648
|
+
const client = getClient12();
|
|
5429
5649
|
await client.putKeywords(project, keywords);
|
|
5430
5650
|
if (isMachineFormat(format)) {
|
|
5431
5651
|
console.log(JSON.stringify({
|
|
@@ -5438,7 +5658,7 @@ async function replaceKeywords(project, keywords, format) {
|
|
|
5438
5658
|
console.log(`Set ${keywords.length} key phrase(s) for "${project}".`);
|
|
5439
5659
|
}
|
|
5440
5660
|
async function removeKeywords(project, keywords, format) {
|
|
5441
|
-
const client =
|
|
5661
|
+
const client = getClient12();
|
|
5442
5662
|
const existing = await client.listKeywords(project);
|
|
5443
5663
|
const existingSet = new Set(existing.map((k) => k.keyword));
|
|
5444
5664
|
const removedKeywords = keywords.filter((k) => existingSet.has(k));
|
|
@@ -5455,7 +5675,7 @@ async function removeKeywords(project, keywords, format) {
|
|
|
5455
5675
|
console.log(`Removed ${removedKeywords.length} key phrase(s) from "${project}".`);
|
|
5456
5676
|
}
|
|
5457
5677
|
async function listKeywords(project, format) {
|
|
5458
|
-
const client =
|
|
5678
|
+
const client = getClient12();
|
|
5459
5679
|
const kws = await client.listKeywords(project);
|
|
5460
5680
|
if (format === "json") {
|
|
5461
5681
|
console.log(JSON.stringify(kws, null, 2));
|
|
@@ -5501,7 +5721,7 @@ async function importKeywords(project, filePath, format) {
|
|
|
5501
5721
|
console.log("No key phrases found in file.");
|
|
5502
5722
|
return;
|
|
5503
5723
|
}
|
|
5504
|
-
const client =
|
|
5724
|
+
const client = getClient12();
|
|
5505
5725
|
await client.appendKeywords(project, keywords);
|
|
5506
5726
|
if (isMachineFormat(format)) {
|
|
5507
5727
|
console.log(JSON.stringify({
|
|
@@ -5515,7 +5735,7 @@ async function importKeywords(project, filePath, format) {
|
|
|
5515
5735
|
console.log(`Imported ${keywords.length} key phrase(s) to "${project}".`);
|
|
5516
5736
|
}
|
|
5517
5737
|
async function generateKeywords(project, provider, opts) {
|
|
5518
|
-
const client =
|
|
5738
|
+
const client = getClient12();
|
|
5519
5739
|
const result = await client.generateKeywords(project, provider, opts.count);
|
|
5520
5740
|
const saved = Boolean(opts.save && result.keywords.length > 0);
|
|
5521
5741
|
if (!isMachineFormat(opts.format)) {
|
|
@@ -5688,11 +5908,11 @@ var KEYWORD_CLI_COMMANDS = [
|
|
|
5688
5908
|
|
|
5689
5909
|
// src/commands/query.ts
|
|
5690
5910
|
import fs3 from "fs";
|
|
5691
|
-
function
|
|
5911
|
+
function getClient13() {
|
|
5692
5912
|
return createApiClient();
|
|
5693
5913
|
}
|
|
5694
5914
|
async function addQueries(project, queries2, format) {
|
|
5695
|
-
const client =
|
|
5915
|
+
const client = getClient13();
|
|
5696
5916
|
await client.appendQueries(project, queries2);
|
|
5697
5917
|
if (isMachineFormat(format)) {
|
|
5698
5918
|
console.log(JSON.stringify({
|
|
@@ -5705,7 +5925,7 @@ async function addQueries(project, queries2, format) {
|
|
|
5705
5925
|
console.log(`Added ${queries2.length} ${queries2.length === 1 ? "query" : "queries"} to "${project}".`);
|
|
5706
5926
|
}
|
|
5707
5927
|
async function replaceQueries(project, queries2, opts) {
|
|
5708
|
-
const client =
|
|
5928
|
+
const client = getClient13();
|
|
5709
5929
|
const isJson = isMachineFormat(opts?.format);
|
|
5710
5930
|
if (opts?.dryRun) {
|
|
5711
5931
|
const preview = await client.previewReplaceQueries(project, queries2);
|
|
@@ -5741,7 +5961,7 @@ async function replaceQueries(project, queries2, opts) {
|
|
|
5741
5961
|
console.log(`Set ${queries2.length} ${queries2.length === 1 ? "query" : "queries"} for "${project}".`);
|
|
5742
5962
|
}
|
|
5743
5963
|
async function removeQueries(project, queries2, format) {
|
|
5744
|
-
const client =
|
|
5964
|
+
const client = getClient13();
|
|
5745
5965
|
const existing = await client.listQueries(project);
|
|
5746
5966
|
const existingSet = new Set(existing.map((q) => q.query));
|
|
5747
5967
|
const removedQueries = queries2.filter((q) => existingSet.has(q));
|
|
@@ -5758,7 +5978,7 @@ async function removeQueries(project, queries2, format) {
|
|
|
5758
5978
|
console.log(`Removed ${removedQueries.length} ${removedQueries.length === 1 ? "query" : "queries"} from "${project}".`);
|
|
5759
5979
|
}
|
|
5760
5980
|
async function listQueries(project, format) {
|
|
5761
|
-
const client =
|
|
5981
|
+
const client = getClient13();
|
|
5762
5982
|
const qs = await client.listQueries(project);
|
|
5763
5983
|
if (format === "json") {
|
|
5764
5984
|
console.log(JSON.stringify(qs, null, 2));
|
|
@@ -5804,7 +6024,7 @@ async function importQueries(project, filePath, format) {
|
|
|
5804
6024
|
console.log("No queries found in file.");
|
|
5805
6025
|
return;
|
|
5806
6026
|
}
|
|
5807
|
-
const client =
|
|
6027
|
+
const client = getClient13();
|
|
5808
6028
|
await client.appendQueries(project, queries2);
|
|
5809
6029
|
if (isMachineFormat(format)) {
|
|
5810
6030
|
console.log(JSON.stringify({
|
|
@@ -5818,7 +6038,7 @@ async function importQueries(project, filePath, format) {
|
|
|
5818
6038
|
console.log(`Imported ${queries2.length} ${queries2.length === 1 ? "query" : "queries"} to "${project}".`);
|
|
5819
6039
|
}
|
|
5820
6040
|
async function generateQueries(project, provider, opts) {
|
|
5821
|
-
const client =
|
|
6041
|
+
const client = getClient13();
|
|
5822
6042
|
const result = await client.generateQueries(project, provider, opts.count);
|
|
5823
6043
|
const saved = Boolean(opts.save && result.queries.length > 0);
|
|
5824
6044
|
if (!isMachineFormat(opts.format)) {
|
|
@@ -6313,11 +6533,11 @@ var MCP_CLI_COMMANDS = [
|
|
|
6313
6533
|
];
|
|
6314
6534
|
|
|
6315
6535
|
// src/commands/notify.ts
|
|
6316
|
-
function
|
|
6536
|
+
function getClient14() {
|
|
6317
6537
|
return createApiClient();
|
|
6318
6538
|
}
|
|
6319
6539
|
async function addNotification(project, opts) {
|
|
6320
|
-
const client =
|
|
6540
|
+
const client = getClient14();
|
|
6321
6541
|
const result = await client.createNotification(project, {
|
|
6322
6542
|
channel: "webhook",
|
|
6323
6543
|
url: opts.webhook,
|
|
@@ -6331,7 +6551,7 @@ async function addNotification(project, opts) {
|
|
|
6331
6551
|
printNotification(result);
|
|
6332
6552
|
}
|
|
6333
6553
|
async function listNotifications(project, format) {
|
|
6334
|
-
const client =
|
|
6554
|
+
const client = getClient14();
|
|
6335
6555
|
const results = await client.listNotifications(project);
|
|
6336
6556
|
if (format === "json") {
|
|
6337
6557
|
console.log(JSON.stringify(results, null, 2));
|
|
@@ -6352,7 +6572,7 @@ async function listNotifications(project, format) {
|
|
|
6352
6572
|
}
|
|
6353
6573
|
}
|
|
6354
6574
|
async function removeNotification(project, id, format) {
|
|
6355
|
-
const client =
|
|
6575
|
+
const client = getClient14();
|
|
6356
6576
|
await client.deleteNotification(project, id);
|
|
6357
6577
|
if (isMachineFormat(format)) {
|
|
6358
6578
|
console.log(JSON.stringify({ project, id, removed: true }, null, 2));
|
|
@@ -6361,7 +6581,7 @@ async function removeNotification(project, id, format) {
|
|
|
6361
6581
|
console.log(`Notification ${id} removed from "${project}"`);
|
|
6362
6582
|
}
|
|
6363
6583
|
async function testNotification(project, id, format) {
|
|
6364
|
-
const client =
|
|
6584
|
+
const client = getClient14();
|
|
6365
6585
|
const result = await client.testNotification(project, id);
|
|
6366
6586
|
if (isMachineFormat(format)) {
|
|
6367
6587
|
console.log(JSON.stringify({ project, id, ...result }, null, 2));
|
|
@@ -6556,11 +6776,11 @@ async function applyConfigs(filePaths, format) {
|
|
|
6556
6776
|
}
|
|
6557
6777
|
|
|
6558
6778
|
// src/commands/analytics.ts
|
|
6559
|
-
function
|
|
6779
|
+
function getClient15() {
|
|
6560
6780
|
return createApiClient();
|
|
6561
6781
|
}
|
|
6562
6782
|
async function showAnalytics(project, options) {
|
|
6563
|
-
const client =
|
|
6783
|
+
const client = getClient15();
|
|
6564
6784
|
const features = options.feature ? [options.feature] : ["metrics", "gaps", "sources"];
|
|
6565
6785
|
const results = {};
|
|
6566
6786
|
for (const feature of features) {
|
|
@@ -6678,7 +6898,7 @@ Source Origin Breakdown`);
|
|
|
6678
6898
|
}
|
|
6679
6899
|
|
|
6680
6900
|
// src/commands/sources.ts
|
|
6681
|
-
function
|
|
6901
|
+
function getClient16() {
|
|
6682
6902
|
return createApiClient();
|
|
6683
6903
|
}
|
|
6684
6904
|
var pct = (n) => `${(n * 100).toFixed(1)}%`;
|
|
@@ -6689,7 +6909,7 @@ async function showSources(project, options) {
|
|
|
6689
6909
|
details: { command: "sources", option: "limit", value: options.limit }
|
|
6690
6910
|
});
|
|
6691
6911
|
}
|
|
6692
|
-
const client =
|
|
6912
|
+
const client = getClient16();
|
|
6693
6913
|
const data = await client.getAnalyticsSources(project, { window: options.window, limit: options.limit });
|
|
6694
6914
|
if (options.format === "jsonl") {
|
|
6695
6915
|
emitJsonl(data.ranked.entries.map((e) => ({ project, ...e })));
|
|
@@ -6740,11 +6960,11 @@ function printRankedEntries(list, indent = "") {
|
|
|
6740
6960
|
}
|
|
6741
6961
|
|
|
6742
6962
|
// src/commands/evidence.ts
|
|
6743
|
-
function
|
|
6963
|
+
function getClient17() {
|
|
6744
6964
|
return createApiClient();
|
|
6745
6965
|
}
|
|
6746
6966
|
async function showEvidence(project, format) {
|
|
6747
|
-
const client =
|
|
6967
|
+
const client = getClient17();
|
|
6748
6968
|
const timeline = await client.getTimeline(project);
|
|
6749
6969
|
if (format === "json") {
|
|
6750
6970
|
const enriched = timeline.map((entry) => ({
|
|
@@ -6811,11 +7031,11 @@ async function loadLatestRunForExport(client, project) {
|
|
|
6811
7031
|
}
|
|
6812
7032
|
|
|
6813
7033
|
// src/commands/history.ts
|
|
6814
|
-
function
|
|
7034
|
+
function getClient18() {
|
|
6815
7035
|
return createApiClient();
|
|
6816
7036
|
}
|
|
6817
7037
|
async function showHistory(project, format) {
|
|
6818
|
-
const client =
|
|
7038
|
+
const client = getClient18();
|
|
6819
7039
|
try {
|
|
6820
7040
|
const entries = await client.getHistory(project);
|
|
6821
7041
|
if (format === "json") {
|
|
@@ -6854,11 +7074,11 @@ async function showHistory(project, format) {
|
|
|
6854
7074
|
}
|
|
6855
7075
|
|
|
6856
7076
|
// src/commands/status.ts
|
|
6857
|
-
function
|
|
7077
|
+
function getClient19() {
|
|
6858
7078
|
return createApiClient();
|
|
6859
7079
|
}
|
|
6860
7080
|
async function showStatus(project, format) {
|
|
6861
|
-
const client =
|
|
7081
|
+
const client = getClient19();
|
|
6862
7082
|
const projectData = await client.getProject(project);
|
|
6863
7083
|
const latest = await getLatestRunSummary(client, project);
|
|
6864
7084
|
if (isMachineFormat(format)) {
|
|
@@ -7014,11 +7234,11 @@ var OPERATOR_CLI_COMMANDS = [
|
|
|
7014
7234
|
];
|
|
7015
7235
|
|
|
7016
7236
|
// src/commands/project.ts
|
|
7017
|
-
function
|
|
7237
|
+
function getClient20() {
|
|
7018
7238
|
return createApiClient();
|
|
7019
7239
|
}
|
|
7020
7240
|
async function createProject(name, opts) {
|
|
7021
|
-
const client =
|
|
7241
|
+
const client = getClient20();
|
|
7022
7242
|
const result = await client.putProject(name, {
|
|
7023
7243
|
displayName: opts.displayName,
|
|
7024
7244
|
canonicalDomain: opts.domain,
|
|
@@ -7034,7 +7254,7 @@ async function createProject(name, opts) {
|
|
|
7034
7254
|
console.log(`Project created: ${result.name} (${result.id})`);
|
|
7035
7255
|
}
|
|
7036
7256
|
async function listProjects(format) {
|
|
7037
|
-
const client =
|
|
7257
|
+
const client = getClient20();
|
|
7038
7258
|
const projects2 = await client.listProjects();
|
|
7039
7259
|
if (format === "json") {
|
|
7040
7260
|
console.log(JSON.stringify(projects2, null, 2));
|
|
@@ -7066,7 +7286,7 @@ async function listProjects(format) {
|
|
|
7066
7286
|
}
|
|
7067
7287
|
}
|
|
7068
7288
|
async function showProject(name, format) {
|
|
7069
|
-
const client =
|
|
7289
|
+
const client = getClient20();
|
|
7070
7290
|
const project = await client.getProject(name);
|
|
7071
7291
|
if (isMachineFormat(format)) {
|
|
7072
7292
|
console.log(JSON.stringify(project, null, 2));
|
|
@@ -7095,7 +7315,7 @@ async function showProject(name, format) {
|
|
|
7095
7315
|
if (project.updatedAt) console.log(` Updated: ${project.updatedAt}`);
|
|
7096
7316
|
}
|
|
7097
7317
|
async function updateProjectSettings(name, opts) {
|
|
7098
|
-
const client =
|
|
7318
|
+
const client = getClient20();
|
|
7099
7319
|
const project = await client.getProject(name);
|
|
7100
7320
|
let ownedDomains = opts.ownedDomains ?? project.ownedDomains ?? [];
|
|
7101
7321
|
if (opts.addOwnedDomain) {
|
|
@@ -7132,7 +7352,7 @@ async function updateProjectSettings(name, opts) {
|
|
|
7132
7352
|
console.log(`Project updated: ${result.name}`);
|
|
7133
7353
|
}
|
|
7134
7354
|
async function deleteProject(name, opts) {
|
|
7135
|
-
const client =
|
|
7355
|
+
const client = getClient20();
|
|
7136
7356
|
const isJson = isMachineFormat(opts?.format);
|
|
7137
7357
|
if (opts?.dryRun) {
|
|
7138
7358
|
const preview = await client.previewProjectDelete(name);
|
|
@@ -7162,7 +7382,7 @@ async function deleteProject(name, opts) {
|
|
|
7162
7382
|
console.log(`Project deleted: ${name}`);
|
|
7163
7383
|
}
|
|
7164
7384
|
async function addLocation(project, opts) {
|
|
7165
|
-
const client =
|
|
7385
|
+
const client = getClient20();
|
|
7166
7386
|
const location = await client.addLocation(project, {
|
|
7167
7387
|
label: opts.label,
|
|
7168
7388
|
city: opts.city,
|
|
@@ -7177,7 +7397,7 @@ async function addLocation(project, opts) {
|
|
|
7177
7397
|
console.log(`Location added: ${opts.label} (${opts.city}, ${opts.region}, ${opts.country})`);
|
|
7178
7398
|
}
|
|
7179
7399
|
async function listLocations(project, format) {
|
|
7180
|
-
const client =
|
|
7400
|
+
const client = getClient20();
|
|
7181
7401
|
const result = await client.listLocations(project);
|
|
7182
7402
|
if (format === "json") {
|
|
7183
7403
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -7211,7 +7431,7 @@ async function listLocations(project, format) {
|
|
|
7211
7431
|
}
|
|
7212
7432
|
}
|
|
7213
7433
|
async function removeLocation(project, label, format) {
|
|
7214
|
-
const client =
|
|
7434
|
+
const client = getClient20();
|
|
7215
7435
|
await client.removeLocation(project, label);
|
|
7216
7436
|
if (isMachineFormat(format)) {
|
|
7217
7437
|
console.log(JSON.stringify({ project, label, removed: true }, null, 2));
|
|
@@ -7220,7 +7440,7 @@ async function removeLocation(project, label, format) {
|
|
|
7220
7440
|
console.log(`Location removed: ${label}`);
|
|
7221
7441
|
}
|
|
7222
7442
|
async function setDefaultLocation(project, label, format) {
|
|
7223
|
-
const client =
|
|
7443
|
+
const client = getClient20();
|
|
7224
7444
|
const result = await client.setDefaultLocation(project, label);
|
|
7225
7445
|
if (isMachineFormat(format)) {
|
|
7226
7446
|
console.log(JSON.stringify({ project, ...result }, null, 2));
|
|
@@ -7461,12 +7681,12 @@ var REPORT_CLI_COMMANDS = [
|
|
|
7461
7681
|
];
|
|
7462
7682
|
|
|
7463
7683
|
// src/commands/run.ts
|
|
7464
|
-
function
|
|
7684
|
+
function getClient21() {
|
|
7465
7685
|
return createApiClient();
|
|
7466
7686
|
}
|
|
7467
7687
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "partial", "failed", "cancelled"]);
|
|
7468
7688
|
async function triggerRun(project, opts) {
|
|
7469
|
-
const client =
|
|
7689
|
+
const client = getClient21();
|
|
7470
7690
|
const body = {};
|
|
7471
7691
|
if (opts?.provider) {
|
|
7472
7692
|
const providerInputs = opts.provider.split(",").map((s) => s.trim()).filter(Boolean);
|
|
@@ -7568,7 +7788,7 @@ async function triggerRun(project, opts) {
|
|
|
7568
7788
|
}
|
|
7569
7789
|
}
|
|
7570
7790
|
async function triggerRunAll(opts) {
|
|
7571
|
-
const client =
|
|
7791
|
+
const client = getClient21();
|
|
7572
7792
|
const projects2 = await client.listProjects();
|
|
7573
7793
|
if (projects2.length === 0) {
|
|
7574
7794
|
if (isMachineFormat(opts?.format)) {
|
|
@@ -7651,7 +7871,7 @@ async function triggerRunAll(opts) {
|
|
|
7651
7871
|
}
|
|
7652
7872
|
}
|
|
7653
7873
|
async function cancelRun(project, runId, format) {
|
|
7654
|
-
const client =
|
|
7874
|
+
const client = getClient21();
|
|
7655
7875
|
let targetId = runId;
|
|
7656
7876
|
if (!targetId) {
|
|
7657
7877
|
const runs = await client.listRuns(project);
|
|
@@ -7683,7 +7903,7 @@ To cancel by ID : canonry run cancel ${project} <run-id>`,
|
|
|
7683
7903
|
console.log(`Run ${result.id} cancelled.`);
|
|
7684
7904
|
}
|
|
7685
7905
|
async function showRun(id, format) {
|
|
7686
|
-
const client =
|
|
7906
|
+
const client = getClient21();
|
|
7687
7907
|
const run = await client.getRun(id);
|
|
7688
7908
|
if (isMachineFormat(format)) {
|
|
7689
7909
|
console.log(JSON.stringify(run, null, 2));
|
|
@@ -7692,7 +7912,7 @@ async function showRun(id, format) {
|
|
|
7692
7912
|
printRunDetail(run);
|
|
7693
7913
|
}
|
|
7694
7914
|
async function listRuns(project, opts) {
|
|
7695
|
-
const client =
|
|
7915
|
+
const client = getClient21();
|
|
7696
7916
|
const runs = await client.listRuns(project, opts?.limit, opts?.kind);
|
|
7697
7917
|
if (opts?.format === "json") {
|
|
7698
7918
|
console.log(JSON.stringify(runs, null, 2));
|
|
@@ -7867,11 +8087,11 @@ var RUN_CLI_COMMANDS = [
|
|
|
7867
8087
|
];
|
|
7868
8088
|
|
|
7869
8089
|
// src/commands/schedule.ts
|
|
7870
|
-
function
|
|
8090
|
+
function getClient22() {
|
|
7871
8091
|
return createApiClient();
|
|
7872
8092
|
}
|
|
7873
8093
|
async function setSchedule(project, opts) {
|
|
7874
|
-
const client =
|
|
8094
|
+
const client = getClient22();
|
|
7875
8095
|
const body = {};
|
|
7876
8096
|
if (opts.kind) body.kind = opts.kind;
|
|
7877
8097
|
if (opts.sourceId) body.sourceId = opts.sourceId;
|
|
@@ -7888,7 +8108,7 @@ async function setSchedule(project, opts) {
|
|
|
7888
8108
|
printSchedule(result);
|
|
7889
8109
|
}
|
|
7890
8110
|
async function showSchedule(project, format, kind) {
|
|
7891
|
-
const client =
|
|
8111
|
+
const client = getClient22();
|
|
7892
8112
|
const result = await client.getSchedule(project, kind);
|
|
7893
8113
|
if (isMachineFormat(format)) {
|
|
7894
8114
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -7897,7 +8117,7 @@ async function showSchedule(project, format, kind) {
|
|
|
7897
8117
|
printSchedule(result);
|
|
7898
8118
|
}
|
|
7899
8119
|
async function enableSchedule(project, format, kind) {
|
|
7900
|
-
const client =
|
|
8120
|
+
const client = getClient22();
|
|
7901
8121
|
const current = await client.getSchedule(project, kind);
|
|
7902
8122
|
const body = { kind: current.kind, timezone: current.timezone, enabled: true };
|
|
7903
8123
|
if (current.preset) body.preset = current.preset;
|
|
@@ -7912,7 +8132,7 @@ async function enableSchedule(project, format, kind) {
|
|
|
7912
8132
|
console.log(`Schedule enabled for "${project}" (kind: ${result.kind})`);
|
|
7913
8133
|
}
|
|
7914
8134
|
async function disableSchedule(project, format, kind) {
|
|
7915
|
-
const client =
|
|
8135
|
+
const client = getClient22();
|
|
7916
8136
|
const current = await client.getSchedule(project, kind);
|
|
7917
8137
|
const body = { kind: current.kind, timezone: current.timezone, enabled: false };
|
|
7918
8138
|
if (current.preset) body.preset = current.preset;
|
|
@@ -7927,7 +8147,7 @@ async function disableSchedule(project, format, kind) {
|
|
|
7927
8147
|
console.log(`Schedule disabled for "${project}" (kind: ${result.kind})`);
|
|
7928
8148
|
}
|
|
7929
8149
|
async function removeSchedule(project, format, kind) {
|
|
7930
|
-
const client =
|
|
8150
|
+
const client = getClient22();
|
|
7931
8151
|
await client.deleteSchedule(project, kind);
|
|
7932
8152
|
const resolvedKind = kind ?? "answer-visibility";
|
|
7933
8153
|
if (isMachineFormat(format)) {
|
|
@@ -8045,11 +8265,11 @@ var SCHEDULE_CLI_COMMANDS = [
|
|
|
8045
8265
|
];
|
|
8046
8266
|
|
|
8047
8267
|
// src/commands/settings.ts
|
|
8048
|
-
function
|
|
8268
|
+
function getClient23() {
|
|
8049
8269
|
return createApiClient();
|
|
8050
8270
|
}
|
|
8051
8271
|
async function setProvider(name, opts) {
|
|
8052
|
-
const client =
|
|
8272
|
+
const client = getClient23();
|
|
8053
8273
|
const { format, ...payload } = opts;
|
|
8054
8274
|
const result = await client.updateProvider(name, payload);
|
|
8055
8275
|
if (isMachineFormat(format)) {
|
|
@@ -8065,7 +8285,7 @@ async function setProvider(name, opts) {
|
|
|
8065
8285
|
}
|
|
8066
8286
|
}
|
|
8067
8287
|
async function showSettings(format) {
|
|
8068
|
-
const client =
|
|
8288
|
+
const client = getClient23();
|
|
8069
8289
|
const config = loadConfig();
|
|
8070
8290
|
const settings = await client.getSettings();
|
|
8071
8291
|
if (isMachineFormat(format)) {
|
|
@@ -8615,7 +8835,7 @@ function wrapText(font, text, size, maxWidth) {
|
|
|
8615
8835
|
}
|
|
8616
8836
|
|
|
8617
8837
|
// src/commands/snapshot.ts
|
|
8618
|
-
function
|
|
8838
|
+
function getClient24() {
|
|
8619
8839
|
return createApiClient();
|
|
8620
8840
|
}
|
|
8621
8841
|
function slugify(value) {
|
|
@@ -8626,7 +8846,7 @@ function autoOutputPath(companyName, ext) {
|
|
|
8626
8846
|
return `${slugify(companyName)}-snapshot-${date}.${ext}`;
|
|
8627
8847
|
}
|
|
8628
8848
|
async function createSnapshotReport(companyName, opts) {
|
|
8629
|
-
const client =
|
|
8849
|
+
const client = getClient24();
|
|
8630
8850
|
const report = await client.createSnapshot({
|
|
8631
8851
|
companyName,
|
|
8632
8852
|
domain: opts.domain,
|
|
@@ -10710,11 +10930,11 @@ var SYSTEM_CLI_COMMANDS = [
|
|
|
10710
10930
|
];
|
|
10711
10931
|
|
|
10712
10932
|
// src/commands/technical-aeo.ts
|
|
10713
|
-
function
|
|
10933
|
+
function getClient25() {
|
|
10714
10934
|
return createApiClient();
|
|
10715
10935
|
}
|
|
10716
10936
|
async function technicalAeoScore(project, opts) {
|
|
10717
|
-
const client =
|
|
10937
|
+
const client = getClient25();
|
|
10718
10938
|
const score = await client.getTechnicalAeoScore(project);
|
|
10719
10939
|
if (isMachineFormat(opts.format)) {
|
|
10720
10940
|
console.log(JSON.stringify(score, null, 2));
|
|
@@ -10750,7 +10970,7 @@ async function technicalAeoScore(project, opts) {
|
|
|
10750
10970
|
console.log(lines.join("\n"));
|
|
10751
10971
|
}
|
|
10752
10972
|
async function technicalAeoPages(project, opts) {
|
|
10753
|
-
const client =
|
|
10973
|
+
const client = getClient25();
|
|
10754
10974
|
const status = opts.status === "success" || opts.status === "error" ? opts.status : void 0;
|
|
10755
10975
|
const res = await client.getTechnicalAeoPages(project, { status, sort: opts.sort, limit: opts.limit });
|
|
10756
10976
|
if (opts.format === "jsonl") {
|
|
@@ -10776,7 +10996,7 @@ async function technicalAeoPages(project, opts) {
|
|
|
10776
10996
|
console.log(lines.join("\n"));
|
|
10777
10997
|
}
|
|
10778
10998
|
async function technicalAeoTrend(project, opts) {
|
|
10779
|
-
const client =
|
|
10999
|
+
const client = getClient25();
|
|
10780
11000
|
const res = await client.getTechnicalAeoTrend(project, { limit: opts.limit });
|
|
10781
11001
|
if (opts.format === "jsonl") {
|
|
10782
11002
|
emitJsonl(res.points.map((p) => ({ project, ...p })));
|
|
@@ -10798,7 +11018,7 @@ async function technicalAeoTrend(project, opts) {
|
|
|
10798
11018
|
console.log(lines.join("\n"));
|
|
10799
11019
|
}
|
|
10800
11020
|
async function technicalAeoRun(project, opts) {
|
|
10801
|
-
const client =
|
|
11021
|
+
const client = getClient25();
|
|
10802
11022
|
const { runId, status } = await client.triggerSiteAudit(project, {
|
|
10803
11023
|
sitemapUrl: opts.sitemapUrl,
|
|
10804
11024
|
limit: opts.limit
|
|
@@ -10917,7 +11137,7 @@ var TECHNICAL_AEO_CLI_COMMANDS = [
|
|
|
10917
11137
|
import fs11 from "fs";
|
|
10918
11138
|
|
|
10919
11139
|
// src/commands/wordpress.ts
|
|
10920
|
-
function
|
|
11140
|
+
function getClient26() {
|
|
10921
11141
|
return createApiClient();
|
|
10922
11142
|
}
|
|
10923
11143
|
async function loadYamlModule() {
|
|
@@ -11067,7 +11287,7 @@ async function wordpressConnect(project, opts) {
|
|
|
11067
11287
|
details: { project }
|
|
11068
11288
|
});
|
|
11069
11289
|
}
|
|
11070
|
-
const client =
|
|
11290
|
+
const client = getClient26();
|
|
11071
11291
|
const result = await client.wordpressConnect(project, {
|
|
11072
11292
|
url: opts.url,
|
|
11073
11293
|
stagingUrl: opts.stagingUrl,
|
|
@@ -11084,7 +11304,7 @@ async function wordpressConnect(project, opts) {
|
|
|
11084
11304
|
printWordpressStatus(project, result);
|
|
11085
11305
|
}
|
|
11086
11306
|
async function wordpressDisconnect(project, format) {
|
|
11087
|
-
const client =
|
|
11307
|
+
const client = getClient26();
|
|
11088
11308
|
await client.wordpressDisconnect(project);
|
|
11089
11309
|
if (isMachineFormat(format)) {
|
|
11090
11310
|
printJson2({ project, disconnected: true });
|
|
@@ -11093,7 +11313,7 @@ async function wordpressDisconnect(project, format) {
|
|
|
11093
11313
|
console.log(`WordPress disconnected from project "${project}".`);
|
|
11094
11314
|
}
|
|
11095
11315
|
async function wordpressStatus(project, format) {
|
|
11096
|
-
const client =
|
|
11316
|
+
const client = getClient26();
|
|
11097
11317
|
const result = await client.wordpressStatus(project);
|
|
11098
11318
|
if (isMachineFormat(format)) {
|
|
11099
11319
|
printJson2(result);
|
|
@@ -11102,7 +11322,7 @@ async function wordpressStatus(project, format) {
|
|
|
11102
11322
|
printWordpressStatus(project, result);
|
|
11103
11323
|
}
|
|
11104
11324
|
async function wordpressPages(project, opts) {
|
|
11105
|
-
const client =
|
|
11325
|
+
const client = getClient26();
|
|
11106
11326
|
const result = await client.wordpressPages(project, opts.env);
|
|
11107
11327
|
if (isMachineFormat(opts.format)) {
|
|
11108
11328
|
printJson2(result);
|
|
@@ -11111,7 +11331,7 @@ async function wordpressPages(project, opts) {
|
|
|
11111
11331
|
printPages(project, result.env, result.pages);
|
|
11112
11332
|
}
|
|
11113
11333
|
async function wordpressPage(project, slug, opts) {
|
|
11114
|
-
const client =
|
|
11334
|
+
const client = getClient26();
|
|
11115
11335
|
const result = await client.wordpressPage(project, slug, opts.env);
|
|
11116
11336
|
if (isMachineFormat(opts.format)) {
|
|
11117
11337
|
printJson2(result);
|
|
@@ -11120,7 +11340,7 @@ async function wordpressPage(project, slug, opts) {
|
|
|
11120
11340
|
printPageDetail(result);
|
|
11121
11341
|
}
|
|
11122
11342
|
async function wordpressCreatePage(project, body) {
|
|
11123
|
-
const client =
|
|
11343
|
+
const client = getClient26();
|
|
11124
11344
|
const result = await client.wordpressCreatePage(project, body);
|
|
11125
11345
|
if (isMachineFormat(body.format)) {
|
|
11126
11346
|
printJson2(result);
|
|
@@ -11131,7 +11351,7 @@ async function wordpressCreatePage(project, body) {
|
|
|
11131
11351
|
printPageDetail(result);
|
|
11132
11352
|
}
|
|
11133
11353
|
async function wordpressUpdatePage(project, body) {
|
|
11134
|
-
const client =
|
|
11354
|
+
const client = getClient26();
|
|
11135
11355
|
const result = await client.wordpressUpdatePage(project, body);
|
|
11136
11356
|
if (isMachineFormat(body.format)) {
|
|
11137
11357
|
printJson2(result);
|
|
@@ -11142,7 +11362,7 @@ async function wordpressUpdatePage(project, body) {
|
|
|
11142
11362
|
printPageDetail(result);
|
|
11143
11363
|
}
|
|
11144
11364
|
async function wordpressSetMeta(project, body) {
|
|
11145
|
-
const client =
|
|
11365
|
+
const client = getClient26();
|
|
11146
11366
|
const result = await client.wordpressSetMeta(project, body);
|
|
11147
11367
|
if (isMachineFormat(body.format)) {
|
|
11148
11368
|
printJson2(result);
|
|
@@ -11192,7 +11412,7 @@ async function wordpressBulkSetMeta(project, opts) {
|
|
|
11192
11412
|
details: { path: filePath }
|
|
11193
11413
|
});
|
|
11194
11414
|
}
|
|
11195
|
-
const client =
|
|
11415
|
+
const client = getClient26();
|
|
11196
11416
|
const result = await client.wordpressBulkSetMeta(project, { entries, env: opts.env });
|
|
11197
11417
|
if (isMachineFormat(opts.format)) {
|
|
11198
11418
|
printJson2(result);
|
|
@@ -11235,7 +11455,7 @@ async function wordpressBulkSetMeta(project, opts) {
|
|
|
11235
11455
|
Total: ${applied.length} applied, ${skipped.length} skipped, ${manual.length} manual`);
|
|
11236
11456
|
}
|
|
11237
11457
|
async function wordpressSchema(project, slug, opts) {
|
|
11238
|
-
const client =
|
|
11458
|
+
const client = getClient26();
|
|
11239
11459
|
const result = await client.wordpressSchema(project, slug, opts.env);
|
|
11240
11460
|
if (isMachineFormat(opts.format)) {
|
|
11241
11461
|
printJson2(result);
|
|
@@ -11246,7 +11466,7 @@ async function wordpressSchema(project, slug, opts) {
|
|
|
11246
11466
|
printSchemaBlocks(result.blocks);
|
|
11247
11467
|
}
|
|
11248
11468
|
async function wordpressSetSchema(project, body) {
|
|
11249
|
-
const client =
|
|
11469
|
+
const client = getClient26();
|
|
11250
11470
|
const result = await client.wordpressSetSchema(project, body);
|
|
11251
11471
|
if (isMachineFormat(body.format)) {
|
|
11252
11472
|
printJson2(result);
|
|
@@ -11294,7 +11514,7 @@ async function wordpressSchemaDeploy(project, opts) {
|
|
|
11294
11514
|
details: { path: filePath }
|
|
11295
11515
|
});
|
|
11296
11516
|
}
|
|
11297
|
-
const client =
|
|
11517
|
+
const client = getClient26();
|
|
11298
11518
|
const result = await client.wordpressSchemaDeploy(project, { profile: parsed, env: opts.env });
|
|
11299
11519
|
if (isMachineFormat(opts.format)) {
|
|
11300
11520
|
printJson2(result);
|
|
@@ -11333,7 +11553,7 @@ async function wordpressSchemaDeploy(project, opts) {
|
|
|
11333
11553
|
Total: ${deployed} deployed, ${stripped} stripped, ${skipped} skipped, ${failed} failed`);
|
|
11334
11554
|
}
|
|
11335
11555
|
async function wordpressSchemaStatus(project, opts) {
|
|
11336
|
-
const client =
|
|
11556
|
+
const client = getClient26();
|
|
11337
11557
|
const result = await client.wordpressSchemaStatus(project, opts.env);
|
|
11338
11558
|
if (isMachineFormat(opts.format)) {
|
|
11339
11559
|
printJson2(result);
|
|
@@ -11392,7 +11612,7 @@ async function wordpressOnboard(project, opts) {
|
|
|
11392
11612
|
});
|
|
11393
11613
|
}
|
|
11394
11614
|
}
|
|
11395
|
-
const client =
|
|
11615
|
+
const client = getClient26();
|
|
11396
11616
|
const result = await client.wordpressOnboard(project, {
|
|
11397
11617
|
url: opts.url,
|
|
11398
11618
|
username: opts.user,
|
|
@@ -11417,7 +11637,7 @@ async function wordpressOnboard(project, opts) {
|
|
|
11417
11637
|
}
|
|
11418
11638
|
}
|
|
11419
11639
|
async function wordpressLlmsTxt(project, opts) {
|
|
11420
|
-
const client =
|
|
11640
|
+
const client = getClient26();
|
|
11421
11641
|
const result = await client.wordpressLlmsTxt(project, opts.env);
|
|
11422
11642
|
if (isMachineFormat(opts.format)) {
|
|
11423
11643
|
printJson2(result);
|
|
@@ -11428,7 +11648,7 @@ async function wordpressLlmsTxt(project, opts) {
|
|
|
11428
11648
|
console.log(result.content ?? "(not found)");
|
|
11429
11649
|
}
|
|
11430
11650
|
async function wordpressSetLlmsTxt(project, body) {
|
|
11431
|
-
const client =
|
|
11651
|
+
const client = getClient26();
|
|
11432
11652
|
const result = await client.wordpressSetLlmsTxt(project, body);
|
|
11433
11653
|
if (isMachineFormat(body.format)) {
|
|
11434
11654
|
printJson2(result);
|
|
@@ -11437,7 +11657,7 @@ async function wordpressSetLlmsTxt(project, body) {
|
|
|
11437
11657
|
printManualAssist(`llms.txt update for "${project}"`, result);
|
|
11438
11658
|
}
|
|
11439
11659
|
async function wordpressAudit(project, opts) {
|
|
11440
|
-
const client =
|
|
11660
|
+
const client = getClient26();
|
|
11441
11661
|
const result = await client.wordpressAudit(project, opts.env);
|
|
11442
11662
|
if (isMachineFormat(opts.format)) {
|
|
11443
11663
|
printJson2(result);
|
|
@@ -11451,7 +11671,7 @@ async function wordpressAudit(project, opts) {
|
|
|
11451
11671
|
printAuditIssues(result.issues);
|
|
11452
11672
|
}
|
|
11453
11673
|
async function wordpressDiff(project, slug, format) {
|
|
11454
|
-
const client =
|
|
11674
|
+
const client = getClient26();
|
|
11455
11675
|
const result = await client.wordpressDiff(project, slug);
|
|
11456
11676
|
if (isMachineFormat(format)) {
|
|
11457
11677
|
printJson2(result);
|
|
@@ -11460,7 +11680,7 @@ async function wordpressDiff(project, slug, format) {
|
|
|
11460
11680
|
printDiff(result);
|
|
11461
11681
|
}
|
|
11462
11682
|
async function wordpressStagingStatus(project, format) {
|
|
11463
|
-
const client =
|
|
11683
|
+
const client = getClient26();
|
|
11464
11684
|
const result = await client.wordpressStagingStatus(project);
|
|
11465
11685
|
if (isMachineFormat(format)) {
|
|
11466
11686
|
printJson2(result);
|
|
@@ -11474,7 +11694,7 @@ async function wordpressStagingStatus(project, format) {
|
|
|
11474
11694
|
console.log(` Admin URL: ${result.adminUrl}`);
|
|
11475
11695
|
}
|
|
11476
11696
|
async function wordpressStagingPush(project, format) {
|
|
11477
|
-
const client =
|
|
11697
|
+
const client = getClient26();
|
|
11478
11698
|
const result = await client.wordpressStagingPush(project);
|
|
11479
11699
|
if (isMachineFormat(format)) {
|
|
11480
11700
|
printJson2(result);
|
|
@@ -12492,6 +12712,7 @@ var REGISTERED_CLI_COMMANDS = [
|
|
|
12492
12712
|
...BING_CLI_COMMANDS,
|
|
12493
12713
|
...WORDPRESS_CLI_COMMANDS,
|
|
12494
12714
|
...CDP_CLI_COMMANDS,
|
|
12715
|
+
...ADS_CLI_COMMANDS,
|
|
12495
12716
|
...GA_CLI_COMMANDS,
|
|
12496
12717
|
...GBP_CLI_COMMANDS,
|
|
12497
12718
|
...TRAFFIC_CLI_COMMANDS,
|