@ainyc/canonry 4.24.1 → 4.26.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 -1
- package/assets/agent-workspace/skills/aero/references/aeo-discovery.md +89 -0
- package/assets/agent-workspace/skills/canonry-setup/references/canonry-cli.md +15 -0
- package/assets/assets/{index-BzD9HUxc.js → index-X1r0qycv.js} +84 -84
- package/assets/index.html +1 -1
- package/dist/{chunk-6EJ54OX7.js → chunk-2FAEQ56I.js} +92 -2
- package/dist/{chunk-E5PZ23OS.js → chunk-H4RE4WLW.js} +1130 -305
- package/dist/{chunk-EUGCQSFC.js → chunk-HVW665A4.js} +135 -1
- package/dist/{chunk-OYYFXKRK.js → chunk-PN24DAGC.js} +127 -2
- package/dist/cli.js +440 -125
- package/dist/index.js +4 -4
- package/dist/{intelligence-service-NVN2PAR7.js → intelligence-service-VUBODIGG.js} +2 -2
- package/dist/mcp.js +9 -3
- package/package.json +10 -10
package/dist/cli.js
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
setTelemetrySource,
|
|
21
21
|
showFirstRunNotice,
|
|
22
22
|
trackEvent
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-H4RE4WLW.js";
|
|
24
24
|
import {
|
|
25
25
|
CliError,
|
|
26
26
|
EXIT_SYSTEM_ERROR,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
saveConfig,
|
|
37
37
|
saveConfigPatch,
|
|
38
38
|
usageError
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-2FAEQ56I.js";
|
|
40
40
|
import {
|
|
41
41
|
apiKeys,
|
|
42
42
|
competitors,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
queries,
|
|
50
50
|
querySnapshots,
|
|
51
51
|
runs
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-PN24DAGC.js";
|
|
53
53
|
import {
|
|
54
54
|
CcReleaseSyncStatuses,
|
|
55
55
|
CheckScopes,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
providerQuotaPolicySchema,
|
|
70
70
|
resolveProviderInput,
|
|
71
71
|
skillsClientSchema
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-HVW665A4.js";
|
|
73
73
|
|
|
74
74
|
// src/cli.ts
|
|
75
75
|
import { pathToFileURL } from "url";
|
|
@@ -621,7 +621,7 @@ function readStoredGroundingSources(rawResponse) {
|
|
|
621
621
|
return result;
|
|
622
622
|
}
|
|
623
623
|
async function backfillInsightsCommand(project, opts) {
|
|
624
|
-
const { IntelligenceService } = await import("./intelligence-service-
|
|
624
|
+
const { IntelligenceService } = await import("./intelligence-service-VUBODIGG.js");
|
|
625
625
|
const config = loadConfig();
|
|
626
626
|
const db = createClient(config.database);
|
|
627
627
|
migrate(db);
|
|
@@ -1956,6 +1956,306 @@ var CDP_CLI_COMMANDS = [
|
|
|
1956
1956
|
}
|
|
1957
1957
|
];
|
|
1958
1958
|
|
|
1959
|
+
// src/commands/discover.ts
|
|
1960
|
+
var TERMINAL_DISCOVERY_STATUSES = /* @__PURE__ */ new Set([
|
|
1961
|
+
"completed",
|
|
1962
|
+
"failed"
|
|
1963
|
+
]);
|
|
1964
|
+
function getClient4() {
|
|
1965
|
+
return createApiClient();
|
|
1966
|
+
}
|
|
1967
|
+
async function discoverRun(project, opts) {
|
|
1968
|
+
const client = getClient4();
|
|
1969
|
+
const body = {};
|
|
1970
|
+
if (opts.icp) body.icpDescription = opts.icp;
|
|
1971
|
+
if (opts.dedupThreshold !== void 0) body.dedupThreshold = opts.dedupThreshold;
|
|
1972
|
+
if (opts.maxProbes !== void 0) body.maxProbes = opts.maxProbes;
|
|
1973
|
+
const start = await client.triggerDiscoveryRun(project, body);
|
|
1974
|
+
if (!opts.wait) {
|
|
1975
|
+
if (opts.format === "json") {
|
|
1976
|
+
console.log(JSON.stringify(start, null, 2));
|
|
1977
|
+
return;
|
|
1978
|
+
}
|
|
1979
|
+
console.log(`Discovery run started: ${start.runId}`);
|
|
1980
|
+
console.log(` Session: ${start.sessionId}`);
|
|
1981
|
+
console.log(` Status: ${start.status}`);
|
|
1982
|
+
console.log(` Tail: canonry discover show ${project} ${start.sessionId}`);
|
|
1983
|
+
return;
|
|
1984
|
+
}
|
|
1985
|
+
const final = await pollSession(client, project, start.sessionId);
|
|
1986
|
+
if (opts.format === "json") {
|
|
1987
|
+
console.log(JSON.stringify(final, null, 2));
|
|
1988
|
+
return;
|
|
1989
|
+
}
|
|
1990
|
+
printSessionDetail(final);
|
|
1991
|
+
}
|
|
1992
|
+
async function discoverSeed(project, opts) {
|
|
1993
|
+
await discoverRun(project, opts);
|
|
1994
|
+
}
|
|
1995
|
+
async function discoverProbe(project, sessionId, opts) {
|
|
1996
|
+
const client = getClient4();
|
|
1997
|
+
const session = await client.getDiscoverySession(project, sessionId);
|
|
1998
|
+
if (opts.format === "json") {
|
|
1999
|
+
console.log(JSON.stringify(session, null, 2));
|
|
2000
|
+
return;
|
|
2001
|
+
}
|
|
2002
|
+
printSessionDetail(session);
|
|
2003
|
+
}
|
|
2004
|
+
async function discoverList(project, opts) {
|
|
2005
|
+
const client = getClient4();
|
|
2006
|
+
const sessions = await client.listDiscoverySessions(project, opts.limit !== void 0 ? { limit: opts.limit } : void 0);
|
|
2007
|
+
if (opts.format === "json") {
|
|
2008
|
+
console.log(JSON.stringify(sessions, null, 2));
|
|
2009
|
+
return;
|
|
2010
|
+
}
|
|
2011
|
+
if (sessions.length === 0) {
|
|
2012
|
+
console.log(`No discovery sessions for "${project}".`);
|
|
2013
|
+
return;
|
|
2014
|
+
}
|
|
2015
|
+
console.log(`Discovery sessions for "${project}" (${sessions.length}):
|
|
2016
|
+
`);
|
|
2017
|
+
console.log(" ID STATUS PROBES CITED WASTED ASPIR. CREATED");
|
|
2018
|
+
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");
|
|
2019
|
+
for (const s of sessions) {
|
|
2020
|
+
const id = s.id.padEnd(36);
|
|
2021
|
+
const status = (s.status ?? "").padEnd(10);
|
|
2022
|
+
const probes = String(s.probeCount ?? 0).padStart(6);
|
|
2023
|
+
const cited = String(s.citedCount ?? 0).padStart(5);
|
|
2024
|
+
const wasted = String(s.wastedCount ?? 0).padStart(6);
|
|
2025
|
+
const asp = String(s.aspirationalCount ?? 0).padStart(6);
|
|
2026
|
+
console.log(` ${id} ${status} ${probes} ${cited} ${wasted} ${asp} ${s.createdAt}`);
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
async function discoverShow(project, sessionId, opts) {
|
|
2030
|
+
const client = getClient4();
|
|
2031
|
+
const session = await client.getDiscoverySession(project, sessionId);
|
|
2032
|
+
if (opts.format === "json") {
|
|
2033
|
+
console.log(JSON.stringify(session, null, 2));
|
|
2034
|
+
return;
|
|
2035
|
+
}
|
|
2036
|
+
printSessionDetail(session);
|
|
2037
|
+
}
|
|
2038
|
+
async function discoverPromotePreview(project, sessionId, opts) {
|
|
2039
|
+
const client = getClient4();
|
|
2040
|
+
const preview = await client.previewDiscoveryPromote(project, sessionId);
|
|
2041
|
+
if (opts.format === "json") {
|
|
2042
|
+
console.log(JSON.stringify(preview, null, 2));
|
|
2043
|
+
return;
|
|
2044
|
+
}
|
|
2045
|
+
console.log(`Promote preview for session ${sessionId} (status: ${preview.status}):`);
|
|
2046
|
+
console.log(` Cited (${preview.queriesByBucket.cited.length})`);
|
|
2047
|
+
for (const q of preview.queriesByBucket.cited.slice(0, 10)) console.log(` + ${q}`);
|
|
2048
|
+
console.log(` Wasted-surface (${preview.queriesByBucket["wasted-surface"].length})`);
|
|
2049
|
+
for (const q of preview.queriesByBucket["wasted-surface"].slice(0, 10)) console.log(` + ${q}`);
|
|
2050
|
+
console.log(` Aspirational (${preview.queriesByBucket.aspirational.length})`);
|
|
2051
|
+
for (const q of preview.queriesByBucket.aspirational.slice(0, 10)) console.log(` + ${q}`);
|
|
2052
|
+
if (preview.suggestedCompetitors.length > 0) {
|
|
2053
|
+
console.log(` Suggested new competitors:`);
|
|
2054
|
+
for (const c of preview.suggestedCompetitors) console.log(` - ${c.domain} (${c.hits} hits)`);
|
|
2055
|
+
}
|
|
2056
|
+
console.log(`
|
|
2057
|
+
(PR 2 will add \`canonry discover promote\` to actually merge these into the project.)`);
|
|
2058
|
+
}
|
|
2059
|
+
function printSessionDetail(session) {
|
|
2060
|
+
console.log(`Discovery session: ${session.id}`);
|
|
2061
|
+
console.log(` Status: ${session.status}`);
|
|
2062
|
+
if (session.icpDescription) console.log(` ICP: ${session.icpDescription}`);
|
|
2063
|
+
if (session.seedProvider) console.log(` Seed provider: ${session.seedProvider}`);
|
|
2064
|
+
if (session.dedupThreshold != null) console.log(` Dedup thresh: ${session.dedupThreshold}`);
|
|
2065
|
+
if (session.seedCountRaw != null && session.seedCount != null) {
|
|
2066
|
+
console.log(` Seed candidates: ${session.seedCount} (raw ${session.seedCountRaw})`);
|
|
2067
|
+
}
|
|
2068
|
+
if (session.probeCount != null) console.log(` Probes: ${session.probeCount}`);
|
|
2069
|
+
console.log(` Buckets: cited=${session.citedCount ?? 0} wasted-surface=${session.wastedCount ?? 0} aspirational=${session.aspirationalCount ?? 0}`);
|
|
2070
|
+
if (session.competitorMap.length > 0) {
|
|
2071
|
+
console.log(` Top recurring competitor domains:`);
|
|
2072
|
+
for (const c of session.competitorMap.slice(0, 10)) console.log(` - ${c.domain} (${c.hits} hits)`);
|
|
2073
|
+
}
|
|
2074
|
+
if (session.error) console.log(` Error: ${session.error}`);
|
|
2075
|
+
if (session.startedAt) console.log(` Started: ${session.startedAt}`);
|
|
2076
|
+
if (session.finishedAt) console.log(` Finished: ${session.finishedAt}`);
|
|
2077
|
+
console.log(` Created: ${session.createdAt}`);
|
|
2078
|
+
if (session.probes && session.probes.length > 0) {
|
|
2079
|
+
const sorted = [...session.probes].sort((a, b) => (a.bucket ?? "").localeCompare(b.bucket ?? ""));
|
|
2080
|
+
console.log(`
|
|
2081
|
+
Probes (${session.probes.length}):`);
|
|
2082
|
+
for (const p of sorted) {
|
|
2083
|
+
const bucket = (p.bucket ?? "\u2013").padEnd(15);
|
|
2084
|
+
const cit = p.citationState === "cited" ? "C" : "c";
|
|
2085
|
+
console.log(` [${cit}] ${bucket} ${p.query}`);
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
var POLL_INTERVAL_MS = 3e3;
|
|
2090
|
+
var POLL_TIMEOUT_MS = 15 * 60 * 1e3;
|
|
2091
|
+
async function pollSession(client, project, sessionId) {
|
|
2092
|
+
process.stderr.write(`Waiting for discovery session ${sessionId}`);
|
|
2093
|
+
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
2094
|
+
for (; ; ) {
|
|
2095
|
+
await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
|
|
2096
|
+
if (Date.now() > deadline) {
|
|
2097
|
+
throw new CliError({
|
|
2098
|
+
code: "DISCOVERY_TIMEOUT",
|
|
2099
|
+
message: `Timed out waiting for discovery session ${sessionId} after ${POLL_TIMEOUT_MS / 1e3}s`
|
|
2100
|
+
});
|
|
2101
|
+
}
|
|
2102
|
+
const session = await client.getDiscoverySession(project, sessionId);
|
|
2103
|
+
process.stderr.write(".");
|
|
2104
|
+
if (TERMINAL_DISCOVERY_STATUSES.has(session.status)) {
|
|
2105
|
+
process.stderr.write("\n");
|
|
2106
|
+
return session;
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
|
|
2111
|
+
// src/cli-commands/discover.ts
|
|
2112
|
+
function parseFloatOption(values, key, usage) {
|
|
2113
|
+
const raw = values[key];
|
|
2114
|
+
if (typeof raw !== "string" || raw.length === 0) return void 0;
|
|
2115
|
+
const parsed = Number.parseFloat(raw);
|
|
2116
|
+
if (Number.isNaN(parsed)) {
|
|
2117
|
+
throw usageError(`Error: --${key} must be a number
|
|
2118
|
+
Usage: ${usage}`, {
|
|
2119
|
+
message: `--${key} must be a number`,
|
|
2120
|
+
details: { command: "discover", usage, option: key, value: raw }
|
|
2121
|
+
});
|
|
2122
|
+
}
|
|
2123
|
+
return parsed;
|
|
2124
|
+
}
|
|
2125
|
+
var DISCOVER_CLI_COMMANDS = [
|
|
2126
|
+
{
|
|
2127
|
+
path: ["discover", "run"],
|
|
2128
|
+
usage: 'canonry discover run <project> [--icp "..."] [--dedup-threshold 0.85] [--max-probes 100] [--wait] [--format json]',
|
|
2129
|
+
options: {
|
|
2130
|
+
icp: stringOption(),
|
|
2131
|
+
"dedup-threshold": stringOption(),
|
|
2132
|
+
"max-probes": stringOption(),
|
|
2133
|
+
wait: { type: "boolean", default: false }
|
|
2134
|
+
},
|
|
2135
|
+
run: async (input) => {
|
|
2136
|
+
const project = requireProject(
|
|
2137
|
+
input,
|
|
2138
|
+
"discover.run",
|
|
2139
|
+
'canonry discover run <project> [--icp "..."] [--wait] [--format json]'
|
|
2140
|
+
);
|
|
2141
|
+
const usage = 'canonry discover run <project> [--icp "..."] [--dedup-threshold 0.85] [--max-probes 100] [--wait] [--format json]';
|
|
2142
|
+
await discoverRun(project, {
|
|
2143
|
+
icp: getString(input.values, "icp"),
|
|
2144
|
+
dedupThreshold: parseFloatOption(input.values, "dedup-threshold", usage),
|
|
2145
|
+
maxProbes: parseIntegerOption(input, "max-probes", {
|
|
2146
|
+
command: "discover.run",
|
|
2147
|
+
usage,
|
|
2148
|
+
message: "--max-probes must be an integer"
|
|
2149
|
+
}),
|
|
2150
|
+
wait: getBoolean(input.values, "wait"),
|
|
2151
|
+
format: input.format
|
|
2152
|
+
});
|
|
2153
|
+
}
|
|
2154
|
+
},
|
|
2155
|
+
{
|
|
2156
|
+
path: ["discover", "seed"],
|
|
2157
|
+
usage: 'canonry discover seed <project> [--icp "..."] [--dedup-threshold 0.85] [--max-probes 100] [--wait] [--format json]',
|
|
2158
|
+
options: {
|
|
2159
|
+
icp: stringOption(),
|
|
2160
|
+
"dedup-threshold": stringOption(),
|
|
2161
|
+
"max-probes": stringOption(),
|
|
2162
|
+
wait: { type: "boolean", default: false }
|
|
2163
|
+
},
|
|
2164
|
+
run: async (input) => {
|
|
2165
|
+
const project = requireProject(
|
|
2166
|
+
input,
|
|
2167
|
+
"discover.seed",
|
|
2168
|
+
'canonry discover seed <project> [--icp "..."] [--wait] [--format json]'
|
|
2169
|
+
);
|
|
2170
|
+
const usage = 'canonry discover seed <project> [--icp "..."] [--dedup-threshold 0.85] [--max-probes 100] [--wait] [--format json]';
|
|
2171
|
+
await discoverSeed(project, {
|
|
2172
|
+
icp: getString(input.values, "icp"),
|
|
2173
|
+
dedupThreshold: parseFloatOption(input.values, "dedup-threshold", usage),
|
|
2174
|
+
maxProbes: parseIntegerOption(input, "max-probes", {
|
|
2175
|
+
command: "discover.seed",
|
|
2176
|
+
usage,
|
|
2177
|
+
message: "--max-probes must be an integer"
|
|
2178
|
+
}),
|
|
2179
|
+
wait: getBoolean(input.values, "wait"),
|
|
2180
|
+
format: input.format
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2183
|
+
},
|
|
2184
|
+
{
|
|
2185
|
+
path: ["discover", "probe"],
|
|
2186
|
+
usage: "canonry discover probe <project> <session-id> [--format json]",
|
|
2187
|
+
run: async (input) => {
|
|
2188
|
+
const project = requireProject(
|
|
2189
|
+
input,
|
|
2190
|
+
"discover.probe",
|
|
2191
|
+
"canonry discover probe <project> <session-id> [--format json]"
|
|
2192
|
+
);
|
|
2193
|
+
const sessionId = requirePositional(input, 1, {
|
|
2194
|
+
command: "discover.probe",
|
|
2195
|
+
usage: "canonry discover probe <project> <session-id> [--format json]",
|
|
2196
|
+
message: "session ID is required"
|
|
2197
|
+
});
|
|
2198
|
+
await discoverProbe(project, sessionId, { format: input.format });
|
|
2199
|
+
}
|
|
2200
|
+
},
|
|
2201
|
+
{
|
|
2202
|
+
path: ["discover", "list"],
|
|
2203
|
+
usage: "canonry discover list <project> [--limit <n>] [--format json]",
|
|
2204
|
+
options: {
|
|
2205
|
+
limit: stringOption()
|
|
2206
|
+
},
|
|
2207
|
+
run: async (input) => {
|
|
2208
|
+
const project = requireProject(
|
|
2209
|
+
input,
|
|
2210
|
+
"discover.list",
|
|
2211
|
+
"canonry discover list <project> [--limit <n>] [--format json]"
|
|
2212
|
+
);
|
|
2213
|
+
await discoverList(project, {
|
|
2214
|
+
limit: parseIntegerOption(input, "limit", {
|
|
2215
|
+
command: "discover.list",
|
|
2216
|
+
usage: "canonry discover list <project> [--limit <n>] [--format json]",
|
|
2217
|
+
message: "--limit must be an integer"
|
|
2218
|
+
}),
|
|
2219
|
+
format: input.format
|
|
2220
|
+
});
|
|
2221
|
+
}
|
|
2222
|
+
},
|
|
2223
|
+
{
|
|
2224
|
+
path: ["discover", "show"],
|
|
2225
|
+
usage: "canonry discover show <project> <session-id> [--format json]",
|
|
2226
|
+
run: async (input) => {
|
|
2227
|
+
const project = requireProject(
|
|
2228
|
+
input,
|
|
2229
|
+
"discover.show",
|
|
2230
|
+
"canonry discover show <project> <session-id> [--format json]"
|
|
2231
|
+
);
|
|
2232
|
+
const sessionId = requirePositional(input, 1, {
|
|
2233
|
+
command: "discover.show",
|
|
2234
|
+
usage: "canonry discover show <project> <session-id> [--format json]",
|
|
2235
|
+
message: "session ID is required"
|
|
2236
|
+
});
|
|
2237
|
+
await discoverShow(project, sessionId, { format: input.format });
|
|
2238
|
+
}
|
|
2239
|
+
},
|
|
2240
|
+
{
|
|
2241
|
+
path: ["discover", "promote", "preview"],
|
|
2242
|
+
usage: "canonry discover promote preview <project> <session-id> [--format json]",
|
|
2243
|
+
run: async (input) => {
|
|
2244
|
+
const project = requireProject(
|
|
2245
|
+
input,
|
|
2246
|
+
"discover.promote.preview",
|
|
2247
|
+
"canonry discover promote preview <project> <session-id> [--format json]"
|
|
2248
|
+
);
|
|
2249
|
+
const sessionId = requirePositional(input, 1, {
|
|
2250
|
+
command: "discover.promote.preview",
|
|
2251
|
+
usage: "canonry discover promote preview <project> <session-id> [--format json]",
|
|
2252
|
+
message: "session ID is required"
|
|
2253
|
+
});
|
|
2254
|
+
await discoverPromotePreview(project, sessionId, { format: input.format });
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
];
|
|
2258
|
+
|
|
1959
2259
|
// src/commands/doctor.ts
|
|
1960
2260
|
async function doctorCommand(opts) {
|
|
1961
2261
|
const client = createApiClient();
|
|
@@ -2043,7 +2343,7 @@ var DOCTOR_CLI_COMMANDS = [
|
|
|
2043
2343
|
];
|
|
2044
2344
|
|
|
2045
2345
|
// src/commands/ga.ts
|
|
2046
|
-
function
|
|
2346
|
+
function getClient5() {
|
|
2047
2347
|
return createApiClient();
|
|
2048
2348
|
}
|
|
2049
2349
|
async function gaConnect(project, opts) {
|
|
@@ -2076,7 +2376,7 @@ async function gaConnect(project, opts) {
|
|
|
2076
2376
|
} else if (opts.keyJson) {
|
|
2077
2377
|
body.keyJson = opts.keyJson;
|
|
2078
2378
|
}
|
|
2079
|
-
const client =
|
|
2379
|
+
const client = getClient5();
|
|
2080
2380
|
const result = await client.gaConnect(project, body);
|
|
2081
2381
|
if (opts.format === "json") {
|
|
2082
2382
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2091,7 +2391,7 @@ async function gaConnect(project, opts) {
|
|
|
2091
2391
|
}
|
|
2092
2392
|
}
|
|
2093
2393
|
async function gaDisconnect(project, format) {
|
|
2094
|
-
const client =
|
|
2394
|
+
const client = getClient5();
|
|
2095
2395
|
await client.gaDisconnect(project);
|
|
2096
2396
|
if (format === "json") {
|
|
2097
2397
|
console.log(JSON.stringify({ project, disconnected: true }, null, 2));
|
|
@@ -2100,7 +2400,7 @@ async function gaDisconnect(project, format) {
|
|
|
2100
2400
|
console.log(`GA4 disconnected from project "${project}".`);
|
|
2101
2401
|
}
|
|
2102
2402
|
async function gaStatus(project, format) {
|
|
2103
|
-
const client =
|
|
2403
|
+
const client = getClient5();
|
|
2104
2404
|
const result = await client.gaStatus(project);
|
|
2105
2405
|
if (format === "json") {
|
|
2106
2406
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2126,7 +2426,7 @@ async function gaStatus(project, format) {
|
|
|
2126
2426
|
console.log(` Connected: ${result.createdAt ?? "unknown"}`);
|
|
2127
2427
|
}
|
|
2128
2428
|
async function gaSync(project, opts) {
|
|
2129
|
-
const client =
|
|
2429
|
+
const client = getClient5();
|
|
2130
2430
|
const body = {};
|
|
2131
2431
|
if (opts?.days) body.days = opts.days;
|
|
2132
2432
|
if (opts?.only) body.only = opts.only;
|
|
@@ -2146,7 +2446,7 @@ async function gaSync(project, opts) {
|
|
|
2146
2446
|
console.log(` Synced at: ${result.syncedAt}`);
|
|
2147
2447
|
}
|
|
2148
2448
|
async function gaTraffic(project, opts) {
|
|
2149
|
-
const client =
|
|
2449
|
+
const client = getClient5();
|
|
2150
2450
|
const params = {};
|
|
2151
2451
|
if (opts?.limit) params.limit = String(opts.limit);
|
|
2152
2452
|
if (opts?.window) params.window = opts.window;
|
|
@@ -2236,7 +2536,7 @@ async function gaTraffic(project, opts) {
|
|
|
2236
2536
|
}
|
|
2237
2537
|
}
|
|
2238
2538
|
async function gaAiReferralHistory(project, opts) {
|
|
2239
|
-
const client =
|
|
2539
|
+
const client = getClient5();
|
|
2240
2540
|
const result = await client.gaAiReferralHistory(project, opts?.window ? { window: opts.window } : void 0);
|
|
2241
2541
|
if (opts?.format === "json") {
|
|
2242
2542
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2261,7 +2561,7 @@ async function gaAiReferralHistory(project, opts) {
|
|
|
2261
2561
|
}
|
|
2262
2562
|
}
|
|
2263
2563
|
async function gaSocialReferralHistory(project, opts) {
|
|
2264
|
-
const client =
|
|
2564
|
+
const client = getClient5();
|
|
2265
2565
|
const result = await client.gaSocialReferralHistory(project, opts?.window ? { window: opts.window } : void 0);
|
|
2266
2566
|
if (opts?.format === "json") {
|
|
2267
2567
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2286,7 +2586,7 @@ async function gaSocialReferralHistory(project, opts) {
|
|
|
2286
2586
|
}
|
|
2287
2587
|
}
|
|
2288
2588
|
async function gaSessionHistory(project, opts) {
|
|
2289
|
-
const client =
|
|
2589
|
+
const client = getClient5();
|
|
2290
2590
|
const result = await client.gaSessionHistory(project, opts?.window ? { window: opts.window } : void 0);
|
|
2291
2591
|
if (opts?.format === "json") {
|
|
2292
2592
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2308,7 +2608,7 @@ async function gaSessionHistory(project, opts) {
|
|
|
2308
2608
|
}
|
|
2309
2609
|
}
|
|
2310
2610
|
async function gaCoverage(project, format) {
|
|
2311
|
-
const client =
|
|
2611
|
+
const client = getClient5();
|
|
2312
2612
|
const result = await client.gaCoverage(project);
|
|
2313
2613
|
if (format === "json") {
|
|
2314
2614
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -2331,7 +2631,7 @@ async function gaCoverage(project, format) {
|
|
|
2331
2631
|
}
|
|
2332
2632
|
}
|
|
2333
2633
|
async function gaSocialReferralSummary(project, opts) {
|
|
2334
|
-
const client =
|
|
2634
|
+
const client = getClient5();
|
|
2335
2635
|
const traffic = await client.gaTraffic(project);
|
|
2336
2636
|
if (opts?.trend) {
|
|
2337
2637
|
const trend = await client.gaSocialReferralTrend(project);
|
|
@@ -2392,7 +2692,7 @@ async function gaSocialReferralSummary(project, opts) {
|
|
|
2392
2692
|
}
|
|
2393
2693
|
}
|
|
2394
2694
|
async function gaAttribution(project, opts) {
|
|
2395
|
-
const client =
|
|
2695
|
+
const client = getClient5();
|
|
2396
2696
|
const traffic = await client.gaTraffic(project);
|
|
2397
2697
|
const fmtTrend = (pct2) => pct2 === null ? "n/a" : `${pct2 >= 0 ? "+" : ""}${pct2}%`;
|
|
2398
2698
|
if (opts?.trend) {
|
|
@@ -2719,7 +3019,7 @@ var GA_CLI_COMMANDS = [
|
|
|
2719
3019
|
];
|
|
2720
3020
|
|
|
2721
3021
|
// src/commands/traffic.ts
|
|
2722
|
-
function
|
|
3022
|
+
function getClient6() {
|
|
2723
3023
|
return createApiClient();
|
|
2724
3024
|
}
|
|
2725
3025
|
async function trafficConnectWordpress(project, opts) {
|
|
@@ -2770,7 +3070,7 @@ async function trafficConnectWordpress(project, opts) {
|
|
|
2770
3070
|
details: { project }
|
|
2771
3071
|
});
|
|
2772
3072
|
}
|
|
2773
|
-
const client =
|
|
3073
|
+
const client = getClient6();
|
|
2774
3074
|
const result = await client.trafficConnectWordpress(project, {
|
|
2775
3075
|
baseUrl: opts.url,
|
|
2776
3076
|
username: opts.username,
|
|
@@ -2821,7 +3121,7 @@ async function trafficConnectCloudRun(project, opts) {
|
|
|
2821
3121
|
details: { project, keyFile: opts.serviceAccountKey }
|
|
2822
3122
|
});
|
|
2823
3123
|
}
|
|
2824
|
-
const client =
|
|
3124
|
+
const client = getClient6();
|
|
2825
3125
|
const result = await client.trafficConnectCloudRun(project, {
|
|
2826
3126
|
gcpProjectId: opts.gcpProject,
|
|
2827
3127
|
serviceName: opts.service,
|
|
@@ -2852,7 +3152,7 @@ async function trafficBackfill(project, opts) {
|
|
|
2852
3152
|
details: { project }
|
|
2853
3153
|
});
|
|
2854
3154
|
}
|
|
2855
|
-
const client =
|
|
3155
|
+
const client = getClient6();
|
|
2856
3156
|
const submitted = await client.trafficBackfill(project, opts.source, {
|
|
2857
3157
|
days: opts.days
|
|
2858
3158
|
});
|
|
@@ -2921,7 +3221,7 @@ async function trafficSync(project, opts) {
|
|
|
2921
3221
|
details: { project }
|
|
2922
3222
|
});
|
|
2923
3223
|
}
|
|
2924
|
-
const client =
|
|
3224
|
+
const client = getClient6();
|
|
2925
3225
|
const result = await client.trafficSync(project, opts.source, {
|
|
2926
3226
|
sinceMinutes: opts.sinceMinutes
|
|
2927
3227
|
});
|
|
@@ -3267,11 +3567,11 @@ var TRAFFIC_CLI_COMMANDS = [
|
|
|
3267
3567
|
];
|
|
3268
3568
|
|
|
3269
3569
|
// src/commands/competitor.ts
|
|
3270
|
-
function
|
|
3570
|
+
function getClient7() {
|
|
3271
3571
|
return createApiClient();
|
|
3272
3572
|
}
|
|
3273
3573
|
async function addCompetitors(project, domains, format) {
|
|
3274
|
-
const client =
|
|
3574
|
+
const client = getClient7();
|
|
3275
3575
|
const existing = await client.listCompetitors(project);
|
|
3276
3576
|
const existingDomains = existing.map((c) => c.domain);
|
|
3277
3577
|
const existingSet = new Set(existingDomains);
|
|
@@ -3295,7 +3595,7 @@ async function addCompetitors(project, domains, format) {
|
|
|
3295
3595
|
}
|
|
3296
3596
|
}
|
|
3297
3597
|
async function removeCompetitors(project, domains, format) {
|
|
3298
|
-
const client =
|
|
3598
|
+
const client = getClient7();
|
|
3299
3599
|
const existing = await client.listCompetitors(project);
|
|
3300
3600
|
const existingDomains = existing.map((c) => c.domain);
|
|
3301
3601
|
const requested = new Set(uniqueStrings(domains));
|
|
@@ -3324,7 +3624,7 @@ function uniqueStrings(values) {
|
|
|
3324
3624
|
return result;
|
|
3325
3625
|
}
|
|
3326
3626
|
async function listCompetitors(project, format) {
|
|
3327
|
-
const client =
|
|
3627
|
+
const client = getClient7();
|
|
3328
3628
|
const comps = await client.listCompetitors(project);
|
|
3329
3629
|
if (format === "json") {
|
|
3330
3630
|
console.log(JSON.stringify(comps, null, 2));
|
|
@@ -3420,7 +3720,7 @@ var COMPETITOR_CLI_COMMANDS = [
|
|
|
3420
3720
|
|
|
3421
3721
|
// src/commands/google.ts
|
|
3422
3722
|
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.";
|
|
3423
|
-
function
|
|
3723
|
+
function getClient8() {
|
|
3424
3724
|
return createApiClient();
|
|
3425
3725
|
}
|
|
3426
3726
|
async function waitForRunStatus2(client, runId, config) {
|
|
@@ -3460,7 +3760,7 @@ async function waitForRunStatus2(client, runId, config) {
|
|
|
3460
3760
|
});
|
|
3461
3761
|
}
|
|
3462
3762
|
async function googleConnect(project, opts) {
|
|
3463
|
-
const client =
|
|
3763
|
+
const client = getClient8();
|
|
3464
3764
|
const { authUrl, redirectUri } = await client.googleConnect(project, {
|
|
3465
3765
|
type: opts.type,
|
|
3466
3766
|
publicUrl: opts.publicUrl
|
|
@@ -3494,7 +3794,7 @@ Open this URL in your browser to authorize Google ${opts.type.toUpperCase()} acc
|
|
|
3494
3794
|
}
|
|
3495
3795
|
}
|
|
3496
3796
|
async function googleDisconnect(project, opts) {
|
|
3497
|
-
const client =
|
|
3797
|
+
const client = getClient8();
|
|
3498
3798
|
await client.googleDisconnect(project, opts.type);
|
|
3499
3799
|
if (opts.format === "json") {
|
|
3500
3800
|
console.log(JSON.stringify({ project, type: opts.type, disconnected: true }, null, 2));
|
|
@@ -3503,7 +3803,7 @@ async function googleDisconnect(project, opts) {
|
|
|
3503
3803
|
console.log(`Disconnected Google ${opts.type.toUpperCase()} from project "${project}".`);
|
|
3504
3804
|
}
|
|
3505
3805
|
async function googleStatus(project, format) {
|
|
3506
|
-
const client =
|
|
3806
|
+
const client = getClient8();
|
|
3507
3807
|
const connections = await client.googleConnections(project);
|
|
3508
3808
|
if (format === "json") {
|
|
3509
3809
|
console.log(JSON.stringify({ connections }, null, 2));
|
|
@@ -3527,7 +3827,7 @@ async function googleStatus(project, format) {
|
|
|
3527
3827
|
}
|
|
3528
3828
|
}
|
|
3529
3829
|
async function googleProperties(project, format) {
|
|
3530
|
-
const client =
|
|
3830
|
+
const client = getClient8();
|
|
3531
3831
|
const { sites } = await client.googleProperties(project);
|
|
3532
3832
|
if (format === "json") {
|
|
3533
3833
|
console.log(JSON.stringify({ sites }, null, 2));
|
|
@@ -3548,7 +3848,7 @@ async function googleProperties(project, format) {
|
|
|
3548
3848
|
Use "canonry google set-property <project> <siteUrl>" to select a property.`);
|
|
3549
3849
|
}
|
|
3550
3850
|
async function googleSetProperty(project, propertyUrl, format) {
|
|
3551
|
-
const client =
|
|
3851
|
+
const client = getClient8();
|
|
3552
3852
|
await client.googleSetProperty(project, "gsc", propertyUrl);
|
|
3553
3853
|
if (format === "json") {
|
|
3554
3854
|
console.log(JSON.stringify({ project, type: "gsc", propertyUrl }, null, 2));
|
|
@@ -3557,7 +3857,7 @@ async function googleSetProperty(project, propertyUrl, format) {
|
|
|
3557
3857
|
console.log(`GSC property set to "${propertyUrl}" for project "${project}".`);
|
|
3558
3858
|
}
|
|
3559
3859
|
async function googleSync(project, opts) {
|
|
3560
|
-
const client =
|
|
3860
|
+
const client = getClient8();
|
|
3561
3861
|
const run = await client.gscSync(project, { days: opts.days, full: opts.full });
|
|
3562
3862
|
if (!opts.wait && opts.format === "json") {
|
|
3563
3863
|
console.log(JSON.stringify(run, null, 2));
|
|
@@ -3587,7 +3887,7 @@ async function googleSync(project, opts) {
|
|
|
3587
3887
|
}
|
|
3588
3888
|
}
|
|
3589
3889
|
async function googlePerformance(project, opts) {
|
|
3590
|
-
const client =
|
|
3890
|
+
const client = getClient8();
|
|
3591
3891
|
const params = {};
|
|
3592
3892
|
if (opts.days) {
|
|
3593
3893
|
const end = /* @__PURE__ */ new Date();
|
|
@@ -3623,7 +3923,7 @@ async function googlePerformance(project, opts) {
|
|
|
3623
3923
|
}
|
|
3624
3924
|
}
|
|
3625
3925
|
async function googleInspect(project, url, format) {
|
|
3626
|
-
const client =
|
|
3926
|
+
const client = getClient8();
|
|
3627
3927
|
const result = await client.gscInspect(project, url);
|
|
3628
3928
|
if (format === "json") {
|
|
3629
3929
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -3643,7 +3943,7 @@ URL Inspection: ${result.url}
|
|
|
3643
3943
|
console.log(` Inspected At: ${result.inspectedAt}`);
|
|
3644
3944
|
}
|
|
3645
3945
|
async function googleInspections(project, opts) {
|
|
3646
|
-
const client =
|
|
3946
|
+
const client = getClient8();
|
|
3647
3947
|
const params = {};
|
|
3648
3948
|
if (opts.url) params.url = opts.url;
|
|
3649
3949
|
const rows = await client.gscInspections(project, Object.keys(params).length > 0 ? params : void 0);
|
|
@@ -3668,7 +3968,7 @@ async function googleInspections(project, opts) {
|
|
|
3668
3968
|
}
|
|
3669
3969
|
}
|
|
3670
3970
|
async function googleCoverage(project, format) {
|
|
3671
|
-
const client =
|
|
3971
|
+
const client = getClient8();
|
|
3672
3972
|
const result = await client.gscCoverage(project);
|
|
3673
3973
|
if (format === "json") {
|
|
3674
3974
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -3714,7 +4014,7 @@ Index Coverage for "${project}"
|
|
|
3714
4014
|
}
|
|
3715
4015
|
}
|
|
3716
4016
|
async function googleSetSitemap(project, sitemapUrl, format) {
|
|
3717
|
-
const client =
|
|
4017
|
+
const client = getClient8();
|
|
3718
4018
|
await client.googleSetSitemap(project, "gsc", sitemapUrl);
|
|
3719
4019
|
if (format === "json") {
|
|
3720
4020
|
console.log(JSON.stringify({ project, type: "gsc", sitemapUrl }, null, 2));
|
|
@@ -3723,7 +4023,7 @@ async function googleSetSitemap(project, sitemapUrl, format) {
|
|
|
3723
4023
|
console.log(`GSC sitemap URL set to "${sitemapUrl}" for project "${project}".`);
|
|
3724
4024
|
}
|
|
3725
4025
|
async function googleListSitemaps(project, opts) {
|
|
3726
|
-
const client =
|
|
4026
|
+
const client = getClient8();
|
|
3727
4027
|
const result = await client.gscSitemaps(project);
|
|
3728
4028
|
if (opts.format === "json") {
|
|
3729
4029
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -3745,7 +4045,7 @@ Sitemaps for project "${project}":
|
|
|
3745
4045
|
}
|
|
3746
4046
|
}
|
|
3747
4047
|
async function googleInspectSitemap(project, opts) {
|
|
3748
|
-
const client =
|
|
4048
|
+
const client = getClient8();
|
|
3749
4049
|
const run = await client.gscInspectSitemap(project, {
|
|
3750
4050
|
sitemapUrl: opts.sitemapUrl
|
|
3751
4051
|
});
|
|
@@ -3781,7 +4081,7 @@ async function googleInspectSitemap(project, opts) {
|
|
|
3781
4081
|
}
|
|
3782
4082
|
}
|
|
3783
4083
|
async function googleCoverageHistory(project, opts) {
|
|
3784
|
-
const client =
|
|
4084
|
+
const client = getClient8();
|
|
3785
4085
|
const rows = await client.gscCoverageHistory(project, { limit: opts.limit });
|
|
3786
4086
|
if (opts.format === "json") {
|
|
3787
4087
|
console.log(JSON.stringify(rows, null, 2));
|
|
@@ -3803,7 +4103,7 @@ GSC Coverage History for "${project}" (${rows.length} snapshots):
|
|
|
3803
4103
|
}
|
|
3804
4104
|
}
|
|
3805
4105
|
async function googleDiscoverSitemaps(project, opts) {
|
|
3806
|
-
const client =
|
|
4106
|
+
const client = getClient8();
|
|
3807
4107
|
const result = await client.gscDiscoverSitemaps(project);
|
|
3808
4108
|
if (!opts.wait && opts.format === "json") {
|
|
3809
4109
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -3855,7 +4155,7 @@ Primary sitemap: ${result.primarySitemapUrl}`);
|
|
|
3855
4155
|
}
|
|
3856
4156
|
}
|
|
3857
4157
|
async function googleRequestIndexing(project, opts) {
|
|
3858
|
-
const client =
|
|
4158
|
+
const client = getClient8();
|
|
3859
4159
|
const body = { urls: [] };
|
|
3860
4160
|
if (opts.allUnindexed) {
|
|
3861
4161
|
body.allUnindexed = true;
|
|
@@ -3950,7 +4250,7 @@ async function googleRequestIndexing(project, opts) {
|
|
|
3950
4250
|
}
|
|
3951
4251
|
}
|
|
3952
4252
|
async function googleRefresh(project, format) {
|
|
3953
|
-
const client =
|
|
4253
|
+
const client = getClient8();
|
|
3954
4254
|
const run = await client.gscSync(project, {});
|
|
3955
4255
|
if (format !== "json") {
|
|
3956
4256
|
process.stderr.write("Refreshing GSC coverage data");
|
|
@@ -3973,7 +4273,7 @@ async function googleRefresh(project, format) {
|
|
|
3973
4273
|
await googleCoverage(project, format);
|
|
3974
4274
|
}
|
|
3975
4275
|
async function googleDeindexed(project, format) {
|
|
3976
|
-
const client =
|
|
4276
|
+
const client = getClient8();
|
|
3977
4277
|
const rows = await client.gscDeindexed(project);
|
|
3978
4278
|
if (format === "json") {
|
|
3979
4279
|
console.log(JSON.stringify(rows, null, 2));
|
|
@@ -4262,11 +4562,11 @@ var GOOGLE_CLI_COMMANDS = [
|
|
|
4262
4562
|
|
|
4263
4563
|
// src/commands/keyword.ts
|
|
4264
4564
|
import fs2 from "fs";
|
|
4265
|
-
function
|
|
4565
|
+
function getClient9() {
|
|
4266
4566
|
return createApiClient();
|
|
4267
4567
|
}
|
|
4268
4568
|
async function addKeywords(project, keywords, format) {
|
|
4269
|
-
const client =
|
|
4569
|
+
const client = getClient9();
|
|
4270
4570
|
await client.appendKeywords(project, keywords);
|
|
4271
4571
|
if (format === "json") {
|
|
4272
4572
|
console.log(JSON.stringify({
|
|
@@ -4279,7 +4579,7 @@ async function addKeywords(project, keywords, format) {
|
|
|
4279
4579
|
console.log(`Added ${keywords.length} key phrase(s) to "${project}".`);
|
|
4280
4580
|
}
|
|
4281
4581
|
async function replaceKeywords(project, keywords, format) {
|
|
4282
|
-
const client =
|
|
4582
|
+
const client = getClient9();
|
|
4283
4583
|
await client.putKeywords(project, keywords);
|
|
4284
4584
|
if (format === "json") {
|
|
4285
4585
|
console.log(JSON.stringify({
|
|
@@ -4292,7 +4592,7 @@ async function replaceKeywords(project, keywords, format) {
|
|
|
4292
4592
|
console.log(`Set ${keywords.length} key phrase(s) for "${project}".`);
|
|
4293
4593
|
}
|
|
4294
4594
|
async function removeKeywords(project, keywords, format) {
|
|
4295
|
-
const client =
|
|
4595
|
+
const client = getClient9();
|
|
4296
4596
|
const existing = await client.listKeywords(project);
|
|
4297
4597
|
const existingSet = new Set(existing.map((k) => k.keyword));
|
|
4298
4598
|
const removedKeywords = keywords.filter((k) => existingSet.has(k));
|
|
@@ -4309,7 +4609,7 @@ async function removeKeywords(project, keywords, format) {
|
|
|
4309
4609
|
console.log(`Removed ${removedKeywords.length} key phrase(s) from "${project}".`);
|
|
4310
4610
|
}
|
|
4311
4611
|
async function listKeywords(project, format) {
|
|
4312
|
-
const client =
|
|
4612
|
+
const client = getClient9();
|
|
4313
4613
|
const kws = await client.listKeywords(project);
|
|
4314
4614
|
if (format === "json") {
|
|
4315
4615
|
console.log(JSON.stringify(kws, null, 2));
|
|
@@ -4352,7 +4652,7 @@ async function importKeywords(project, filePath, format) {
|
|
|
4352
4652
|
console.log("No key phrases found in file.");
|
|
4353
4653
|
return;
|
|
4354
4654
|
}
|
|
4355
|
-
const client =
|
|
4655
|
+
const client = getClient9();
|
|
4356
4656
|
await client.appendKeywords(project, keywords);
|
|
4357
4657
|
if (format === "json") {
|
|
4358
4658
|
console.log(JSON.stringify({
|
|
@@ -4366,7 +4666,7 @@ async function importKeywords(project, filePath, format) {
|
|
|
4366
4666
|
console.log(`Imported ${keywords.length} key phrase(s) to "${project}".`);
|
|
4367
4667
|
}
|
|
4368
4668
|
async function generateKeywords(project, provider, opts) {
|
|
4369
|
-
const client =
|
|
4669
|
+
const client = getClient9();
|
|
4370
4670
|
const result = await client.generateKeywords(project, provider, opts.count);
|
|
4371
4671
|
const saved = Boolean(opts.save && result.keywords.length > 0);
|
|
4372
4672
|
if (opts.format !== "json") {
|
|
@@ -4539,11 +4839,11 @@ var KEYWORD_CLI_COMMANDS = [
|
|
|
4539
4839
|
|
|
4540
4840
|
// src/commands/query.ts
|
|
4541
4841
|
import fs3 from "fs";
|
|
4542
|
-
function
|
|
4842
|
+
function getClient10() {
|
|
4543
4843
|
return createApiClient();
|
|
4544
4844
|
}
|
|
4545
4845
|
async function addQueries(project, queries2, format) {
|
|
4546
|
-
const client =
|
|
4846
|
+
const client = getClient10();
|
|
4547
4847
|
await client.appendQueries(project, queries2);
|
|
4548
4848
|
if (format === "json") {
|
|
4549
4849
|
console.log(JSON.stringify({
|
|
@@ -4556,7 +4856,7 @@ async function addQueries(project, queries2, format) {
|
|
|
4556
4856
|
console.log(`Added ${queries2.length} ${queries2.length === 1 ? "query" : "queries"} to "${project}".`);
|
|
4557
4857
|
}
|
|
4558
4858
|
async function replaceQueries(project, queries2, format) {
|
|
4559
|
-
const client =
|
|
4859
|
+
const client = getClient10();
|
|
4560
4860
|
await client.putQueries(project, queries2);
|
|
4561
4861
|
if (format === "json") {
|
|
4562
4862
|
console.log(JSON.stringify({
|
|
@@ -4569,7 +4869,7 @@ async function replaceQueries(project, queries2, format) {
|
|
|
4569
4869
|
console.log(`Set ${queries2.length} ${queries2.length === 1 ? "query" : "queries"} for "${project}".`);
|
|
4570
4870
|
}
|
|
4571
4871
|
async function removeQueries(project, queries2, format) {
|
|
4572
|
-
const client =
|
|
4872
|
+
const client = getClient10();
|
|
4573
4873
|
const existing = await client.listQueries(project);
|
|
4574
4874
|
const existingSet = new Set(existing.map((q) => q.query));
|
|
4575
4875
|
const removedQueries = queries2.filter((q) => existingSet.has(q));
|
|
@@ -4586,7 +4886,7 @@ async function removeQueries(project, queries2, format) {
|
|
|
4586
4886
|
console.log(`Removed ${removedQueries.length} ${removedQueries.length === 1 ? "query" : "queries"} from "${project}".`);
|
|
4587
4887
|
}
|
|
4588
4888
|
async function listQueries(project, format) {
|
|
4589
|
-
const client =
|
|
4889
|
+
const client = getClient10();
|
|
4590
4890
|
const qs = await client.listQueries(project);
|
|
4591
4891
|
if (format === "json") {
|
|
4592
4892
|
console.log(JSON.stringify(qs, null, 2));
|
|
@@ -4629,7 +4929,7 @@ async function importQueries(project, filePath, format) {
|
|
|
4629
4929
|
console.log("No queries found in file.");
|
|
4630
4930
|
return;
|
|
4631
4931
|
}
|
|
4632
|
-
const client =
|
|
4932
|
+
const client = getClient10();
|
|
4633
4933
|
await client.appendQueries(project, queries2);
|
|
4634
4934
|
if (format === "json") {
|
|
4635
4935
|
console.log(JSON.stringify({
|
|
@@ -4643,7 +4943,7 @@ async function importQueries(project, filePath, format) {
|
|
|
4643
4943
|
console.log(`Imported ${queries2.length} ${queries2.length === 1 ? "query" : "queries"} to "${project}".`);
|
|
4644
4944
|
}
|
|
4645
4945
|
async function generateQueries(project, provider, opts) {
|
|
4646
|
-
const client =
|
|
4946
|
+
const client = getClient10();
|
|
4647
4947
|
const result = await client.generateQueries(project, provider, opts.count);
|
|
4648
4948
|
const saved = Boolean(opts.save && result.queries.length > 0);
|
|
4649
4949
|
if (opts.format !== "json") {
|
|
@@ -5127,11 +5427,11 @@ var MCP_CLI_COMMANDS = [
|
|
|
5127
5427
|
];
|
|
5128
5428
|
|
|
5129
5429
|
// src/commands/notify.ts
|
|
5130
|
-
function
|
|
5430
|
+
function getClient11() {
|
|
5131
5431
|
return createApiClient();
|
|
5132
5432
|
}
|
|
5133
5433
|
async function addNotification(project, opts) {
|
|
5134
|
-
const client =
|
|
5434
|
+
const client = getClient11();
|
|
5135
5435
|
const result = await client.createNotification(project, {
|
|
5136
5436
|
channel: "webhook",
|
|
5137
5437
|
url: opts.webhook,
|
|
@@ -5145,7 +5445,7 @@ async function addNotification(project, opts) {
|
|
|
5145
5445
|
printNotification(result);
|
|
5146
5446
|
}
|
|
5147
5447
|
async function listNotifications(project, format) {
|
|
5148
|
-
const client =
|
|
5448
|
+
const client = getClient11();
|
|
5149
5449
|
const results = await client.listNotifications(project);
|
|
5150
5450
|
if (format === "json") {
|
|
5151
5451
|
console.log(JSON.stringify(results, null, 2));
|
|
@@ -5163,7 +5463,7 @@ async function listNotifications(project, format) {
|
|
|
5163
5463
|
}
|
|
5164
5464
|
}
|
|
5165
5465
|
async function removeNotification(project, id, format) {
|
|
5166
|
-
const client =
|
|
5466
|
+
const client = getClient11();
|
|
5167
5467
|
await client.deleteNotification(project, id);
|
|
5168
5468
|
if (format === "json") {
|
|
5169
5469
|
console.log(JSON.stringify({ project, id, removed: true }, null, 2));
|
|
@@ -5172,7 +5472,7 @@ async function removeNotification(project, id, format) {
|
|
|
5172
5472
|
console.log(`Notification ${id} removed from "${project}"`);
|
|
5173
5473
|
}
|
|
5174
5474
|
async function testNotification(project, id, format) {
|
|
5175
|
-
const client =
|
|
5475
|
+
const client = getClient11();
|
|
5176
5476
|
const result = await client.testNotification(project, id);
|
|
5177
5477
|
if (format === "json") {
|
|
5178
5478
|
console.log(JSON.stringify({ project, id, ...result }, null, 2));
|
|
@@ -5363,11 +5663,11 @@ async function applyConfigs(filePaths, format) {
|
|
|
5363
5663
|
}
|
|
5364
5664
|
|
|
5365
5665
|
// src/commands/analytics.ts
|
|
5366
|
-
function
|
|
5666
|
+
function getClient12() {
|
|
5367
5667
|
return createApiClient();
|
|
5368
5668
|
}
|
|
5369
5669
|
async function showAnalytics(project, options) {
|
|
5370
|
-
const client =
|
|
5670
|
+
const client = getClient12();
|
|
5371
5671
|
const features = options.feature ? [options.feature] : ["metrics", "gaps", "sources"];
|
|
5372
5672
|
const results = {};
|
|
5373
5673
|
for (const feature of features) {
|
|
@@ -5470,11 +5770,11 @@ Source Origin Breakdown`);
|
|
|
5470
5770
|
}
|
|
5471
5771
|
|
|
5472
5772
|
// src/commands/evidence.ts
|
|
5473
|
-
function
|
|
5773
|
+
function getClient13() {
|
|
5474
5774
|
return createApiClient();
|
|
5475
5775
|
}
|
|
5476
5776
|
async function showEvidence(project, format) {
|
|
5477
|
-
const client =
|
|
5777
|
+
const client = getClient13();
|
|
5478
5778
|
const timeline = await client.getTimeline(project);
|
|
5479
5779
|
if (format === "json") {
|
|
5480
5780
|
const enriched = timeline.map((entry) => ({
|
|
@@ -5534,11 +5834,11 @@ async function loadLatestRunForExport(client, project) {
|
|
|
5534
5834
|
}
|
|
5535
5835
|
|
|
5536
5836
|
// src/commands/history.ts
|
|
5537
|
-
function
|
|
5837
|
+
function getClient14() {
|
|
5538
5838
|
return createApiClient();
|
|
5539
5839
|
}
|
|
5540
5840
|
async function showHistory(project, format) {
|
|
5541
|
-
const client =
|
|
5841
|
+
const client = getClient14();
|
|
5542
5842
|
try {
|
|
5543
5843
|
const entries = await client.getHistory(project);
|
|
5544
5844
|
if (format === "json") {
|
|
@@ -5573,11 +5873,11 @@ async function showHistory(project, format) {
|
|
|
5573
5873
|
}
|
|
5574
5874
|
|
|
5575
5875
|
// src/commands/status.ts
|
|
5576
|
-
function
|
|
5876
|
+
function getClient15() {
|
|
5577
5877
|
return createApiClient();
|
|
5578
5878
|
}
|
|
5579
5879
|
async function showStatus(project, format) {
|
|
5580
|
-
const client =
|
|
5880
|
+
const client = getClient15();
|
|
5581
5881
|
const projectData = await client.getProject(project);
|
|
5582
5882
|
const latest = await getLatestRunSummary(client, project);
|
|
5583
5883
|
if (format === "json") {
|
|
@@ -5708,11 +6008,11 @@ var OPERATOR_CLI_COMMANDS = [
|
|
|
5708
6008
|
];
|
|
5709
6009
|
|
|
5710
6010
|
// src/commands/project.ts
|
|
5711
|
-
function
|
|
6011
|
+
function getClient16() {
|
|
5712
6012
|
return createApiClient();
|
|
5713
6013
|
}
|
|
5714
6014
|
async function createProject(name, opts) {
|
|
5715
|
-
const client =
|
|
6015
|
+
const client = getClient16();
|
|
5716
6016
|
const result = await client.putProject(name, {
|
|
5717
6017
|
displayName: opts.displayName,
|
|
5718
6018
|
canonicalDomain: opts.domain,
|
|
@@ -5727,7 +6027,7 @@ async function createProject(name, opts) {
|
|
|
5727
6027
|
console.log(`Project created: ${result.name} (${result.id})`);
|
|
5728
6028
|
}
|
|
5729
6029
|
async function listProjects(format) {
|
|
5730
|
-
const client =
|
|
6030
|
+
const client = getClient16();
|
|
5731
6031
|
const projects2 = await client.listProjects();
|
|
5732
6032
|
if (format === "json") {
|
|
5733
6033
|
console.log(JSON.stringify(projects2, null, 2));
|
|
@@ -5755,7 +6055,7 @@ async function listProjects(format) {
|
|
|
5755
6055
|
}
|
|
5756
6056
|
}
|
|
5757
6057
|
async function showProject(name, format) {
|
|
5758
|
-
const client =
|
|
6058
|
+
const client = getClient16();
|
|
5759
6059
|
const project = await client.getProject(name);
|
|
5760
6060
|
if (format === "json") {
|
|
5761
6061
|
console.log(JSON.stringify(project, null, 2));
|
|
@@ -5781,7 +6081,7 @@ async function showProject(name, format) {
|
|
|
5781
6081
|
if (project.updatedAt) console.log(` Updated: ${project.updatedAt}`);
|
|
5782
6082
|
}
|
|
5783
6083
|
async function updateProjectSettings(name, opts) {
|
|
5784
|
-
const client =
|
|
6084
|
+
const client = getClient16();
|
|
5785
6085
|
const project = await client.getProject(name);
|
|
5786
6086
|
let ownedDomains = opts.ownedDomains ?? project.ownedDomains ?? [];
|
|
5787
6087
|
if (opts.addOwnedDomain) {
|
|
@@ -5806,7 +6106,7 @@ async function updateProjectSettings(name, opts) {
|
|
|
5806
6106
|
console.log(`Project updated: ${result.name}`);
|
|
5807
6107
|
}
|
|
5808
6108
|
async function deleteProject(name, format) {
|
|
5809
|
-
const client =
|
|
6109
|
+
const client = getClient16();
|
|
5810
6110
|
await client.deleteProject(name);
|
|
5811
6111
|
if (format === "json") {
|
|
5812
6112
|
console.log(JSON.stringify({ name, deleted: true }, null, 2));
|
|
@@ -5815,7 +6115,7 @@ async function deleteProject(name, format) {
|
|
|
5815
6115
|
console.log(`Project deleted: ${name}`);
|
|
5816
6116
|
}
|
|
5817
6117
|
async function addLocation(project, opts) {
|
|
5818
|
-
const client =
|
|
6118
|
+
const client = getClient16();
|
|
5819
6119
|
const location = await client.addLocation(project, {
|
|
5820
6120
|
label: opts.label,
|
|
5821
6121
|
city: opts.city,
|
|
@@ -5830,7 +6130,7 @@ async function addLocation(project, opts) {
|
|
|
5830
6130
|
console.log(`Location added: ${opts.label} (${opts.city}, ${opts.region}, ${opts.country})`);
|
|
5831
6131
|
}
|
|
5832
6132
|
async function listLocations(project, format) {
|
|
5833
|
-
const client =
|
|
6133
|
+
const client = getClient16();
|
|
5834
6134
|
const result = await client.listLocations(project);
|
|
5835
6135
|
if (format === "json") {
|
|
5836
6136
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -5856,7 +6156,7 @@ async function listLocations(project, format) {
|
|
|
5856
6156
|
}
|
|
5857
6157
|
}
|
|
5858
6158
|
async function removeLocation(project, label, format) {
|
|
5859
|
-
const client =
|
|
6159
|
+
const client = getClient16();
|
|
5860
6160
|
await client.removeLocation(project, label);
|
|
5861
6161
|
if (format === "json") {
|
|
5862
6162
|
console.log(JSON.stringify({ project, label, removed: true }, null, 2));
|
|
@@ -5865,7 +6165,7 @@ async function removeLocation(project, label, format) {
|
|
|
5865
6165
|
console.log(`Location removed: ${label}`);
|
|
5866
6166
|
}
|
|
5867
6167
|
async function setDefaultLocation(project, label, format) {
|
|
5868
|
-
const client =
|
|
6168
|
+
const client = getClient16();
|
|
5869
6169
|
const result = await client.setDefaultLocation(project, label);
|
|
5870
6170
|
if (format === "json") {
|
|
5871
6171
|
console.log(JSON.stringify({ project, ...result }, null, 2));
|
|
@@ -6097,18 +6397,21 @@ var REPORT_CLI_COMMANDS = [
|
|
|
6097
6397
|
];
|
|
6098
6398
|
|
|
6099
6399
|
// src/commands/run.ts
|
|
6100
|
-
function
|
|
6400
|
+
function getClient17() {
|
|
6101
6401
|
return createApiClient();
|
|
6102
6402
|
}
|
|
6103
6403
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "partial", "failed", "cancelled"]);
|
|
6104
6404
|
async function triggerRun(project, opts) {
|
|
6105
|
-
const client =
|
|
6405
|
+
const client = getClient17();
|
|
6106
6406
|
const body = {};
|
|
6107
6407
|
if (opts?.provider) {
|
|
6108
6408
|
const providerInputs = opts.provider.split(",").map((s) => s.trim()).filter(Boolean);
|
|
6109
6409
|
const resolved = providerInputs.flatMap((p) => resolveProviderInput(p));
|
|
6110
6410
|
body.providers = resolved.length > 0 ? resolved : providerInputs;
|
|
6111
6411
|
}
|
|
6412
|
+
if (opts?.queries?.length) {
|
|
6413
|
+
body.queries = opts.queries;
|
|
6414
|
+
}
|
|
6112
6415
|
if (opts?.location) {
|
|
6113
6416
|
body.location = opts.location;
|
|
6114
6417
|
}
|
|
@@ -6198,7 +6501,7 @@ async function triggerRun(project, opts) {
|
|
|
6198
6501
|
}
|
|
6199
6502
|
}
|
|
6200
6503
|
async function triggerRunAll(opts) {
|
|
6201
|
-
const client =
|
|
6504
|
+
const client = getClient17();
|
|
6202
6505
|
const projects2 = await client.listProjects();
|
|
6203
6506
|
if (projects2.length === 0) {
|
|
6204
6507
|
if (opts?.format === "json") {
|
|
@@ -6256,7 +6559,7 @@ async function triggerRunAll(opts) {
|
|
|
6256
6559
|
}
|
|
6257
6560
|
}
|
|
6258
6561
|
async function cancelRun(project, runId, format) {
|
|
6259
|
-
const client =
|
|
6562
|
+
const client = getClient17();
|
|
6260
6563
|
let targetId = runId;
|
|
6261
6564
|
if (!targetId) {
|
|
6262
6565
|
const runs2 = await client.listRuns(project);
|
|
@@ -6288,7 +6591,7 @@ To cancel by ID : canonry run cancel ${project} <run-id>`,
|
|
|
6288
6591
|
console.log(`Run ${result.id} cancelled.`);
|
|
6289
6592
|
}
|
|
6290
6593
|
async function showRun(id, format) {
|
|
6291
|
-
const client =
|
|
6594
|
+
const client = getClient17();
|
|
6292
6595
|
const run = await client.getRun(id);
|
|
6293
6596
|
if (format === "json") {
|
|
6294
6597
|
console.log(JSON.stringify(run, null, 2));
|
|
@@ -6297,7 +6600,7 @@ async function showRun(id, format) {
|
|
|
6297
6600
|
printRunDetail(run);
|
|
6298
6601
|
}
|
|
6299
6602
|
async function listRuns(project, opts) {
|
|
6300
|
-
const client =
|
|
6603
|
+
const client = getClient17();
|
|
6301
6604
|
const runs2 = await client.listRuns(project, opts?.limit);
|
|
6302
6605
|
if (opts?.format === "json") {
|
|
6303
6606
|
console.log(JSON.stringify(runs2, null, 2));
|
|
@@ -6317,13 +6620,13 @@ async function listRuns(project, opts) {
|
|
|
6317
6620
|
);
|
|
6318
6621
|
}
|
|
6319
6622
|
}
|
|
6320
|
-
var
|
|
6623
|
+
var POLL_TIMEOUT_MS2 = 10 * 60 * 1e3;
|
|
6321
6624
|
async function pollRun2(client, runId) {
|
|
6322
|
-
const deadline = Date.now() +
|
|
6625
|
+
const deadline = Date.now() + POLL_TIMEOUT_MS2;
|
|
6323
6626
|
for (; ; ) {
|
|
6324
6627
|
await new Promise((r) => setTimeout(r, 2e3));
|
|
6325
6628
|
if (Date.now() > deadline) {
|
|
6326
|
-
throw new Error(`Timed out waiting for run ${runId} after ${
|
|
6629
|
+
throw new Error(`Timed out waiting for run ${runId} after ${POLL_TIMEOUT_MS2 / 1e3}s`);
|
|
6327
6630
|
}
|
|
6328
6631
|
const run = await client.getRun(runId);
|
|
6329
6632
|
process.stderr.write(".");
|
|
@@ -6384,9 +6687,10 @@ var RUN_CLI_COMMANDS = [
|
|
|
6384
6687
|
},
|
|
6385
6688
|
{
|
|
6386
6689
|
path: ["run"],
|
|
6387
|
-
usage: "canonry run <project|--all> [--provider <name>] [--location <label>] [--all-locations] [--no-location] [--wait] [--format json]",
|
|
6690
|
+
usage: "canonry run <project|--all> [--provider <name>] [--query <q>...] [--location <label>] [--all-locations] [--no-location] [--wait] [--format json]",
|
|
6388
6691
|
options: {
|
|
6389
6692
|
provider: stringOption(),
|
|
6693
|
+
query: multiStringOption(),
|
|
6390
6694
|
wait: { type: "boolean", default: false },
|
|
6391
6695
|
all: { type: "boolean", default: false },
|
|
6392
6696
|
location: stringOption(),
|
|
@@ -6404,6 +6708,15 @@ var RUN_CLI_COMMANDS = [
|
|
|
6404
6708
|
}
|
|
6405
6709
|
});
|
|
6406
6710
|
}
|
|
6711
|
+
if (getStringArray(input.values, "query")?.length) {
|
|
6712
|
+
throw usageError("Error: --query cannot be combined with --all (query scope is project-specific)", {
|
|
6713
|
+
message: "--query cannot be combined with --all (query scope is project-specific)",
|
|
6714
|
+
details: {
|
|
6715
|
+
command: "run",
|
|
6716
|
+
usage: "canonry run <project> --query <q>... [--provider <name>] [--wait] [--format json]"
|
|
6717
|
+
}
|
|
6718
|
+
});
|
|
6719
|
+
}
|
|
6407
6720
|
await triggerRunAll({
|
|
6408
6721
|
provider: getString(input.values, "provider"),
|
|
6409
6722
|
wait: getBoolean(input.values, "wait"),
|
|
@@ -6416,11 +6729,12 @@ var RUN_CLI_COMMANDS = [
|
|
|
6416
6729
|
const project = requireProject(
|
|
6417
6730
|
input,
|
|
6418
6731
|
"run",
|
|
6419
|
-
"canonry run <project> [--provider <name>] [--wait] [--format json]",
|
|
6732
|
+
"canonry run <project> [--provider <name>] [--query <q>...] [--wait] [--format json]",
|
|
6420
6733
|
"project name is required (or use --all)"
|
|
6421
6734
|
);
|
|
6422
6735
|
await triggerRun(project, {
|
|
6423
6736
|
provider: getString(input.values, "provider"),
|
|
6737
|
+
queries: getStringArray(input.values, "query"),
|
|
6424
6738
|
wait: getBoolean(input.values, "wait"),
|
|
6425
6739
|
location: getString(input.values, "location"),
|
|
6426
6740
|
allLocations: getBoolean(input.values, "all-locations"),
|
|
@@ -6450,11 +6764,11 @@ var RUN_CLI_COMMANDS = [
|
|
|
6450
6764
|
];
|
|
6451
6765
|
|
|
6452
6766
|
// src/commands/schedule.ts
|
|
6453
|
-
function
|
|
6767
|
+
function getClient18() {
|
|
6454
6768
|
return createApiClient();
|
|
6455
6769
|
}
|
|
6456
6770
|
async function setSchedule(project, opts) {
|
|
6457
|
-
const client =
|
|
6771
|
+
const client = getClient18();
|
|
6458
6772
|
const body = {};
|
|
6459
6773
|
if (opts.kind) body.kind = opts.kind;
|
|
6460
6774
|
if (opts.sourceId) body.sourceId = opts.sourceId;
|
|
@@ -6471,7 +6785,7 @@ async function setSchedule(project, opts) {
|
|
|
6471
6785
|
printSchedule(result);
|
|
6472
6786
|
}
|
|
6473
6787
|
async function showSchedule(project, format, kind) {
|
|
6474
|
-
const client =
|
|
6788
|
+
const client = getClient18();
|
|
6475
6789
|
const result = await client.getSchedule(project, kind);
|
|
6476
6790
|
if (format === "json") {
|
|
6477
6791
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -6480,7 +6794,7 @@ async function showSchedule(project, format, kind) {
|
|
|
6480
6794
|
printSchedule(result);
|
|
6481
6795
|
}
|
|
6482
6796
|
async function enableSchedule(project, format, kind) {
|
|
6483
|
-
const client =
|
|
6797
|
+
const client = getClient18();
|
|
6484
6798
|
const current = await client.getSchedule(project, kind);
|
|
6485
6799
|
const body = { kind: current.kind, timezone: current.timezone, enabled: true };
|
|
6486
6800
|
if (current.preset) body.preset = current.preset;
|
|
@@ -6495,7 +6809,7 @@ async function enableSchedule(project, format, kind) {
|
|
|
6495
6809
|
console.log(`Schedule enabled for "${project}" (kind: ${result.kind})`);
|
|
6496
6810
|
}
|
|
6497
6811
|
async function disableSchedule(project, format, kind) {
|
|
6498
|
-
const client =
|
|
6812
|
+
const client = getClient18();
|
|
6499
6813
|
const current = await client.getSchedule(project, kind);
|
|
6500
6814
|
const body = { kind: current.kind, timezone: current.timezone, enabled: false };
|
|
6501
6815
|
if (current.preset) body.preset = current.preset;
|
|
@@ -6510,7 +6824,7 @@ async function disableSchedule(project, format, kind) {
|
|
|
6510
6824
|
console.log(`Schedule disabled for "${project}" (kind: ${result.kind})`);
|
|
6511
6825
|
}
|
|
6512
6826
|
async function removeSchedule(project, format, kind) {
|
|
6513
|
-
const client =
|
|
6827
|
+
const client = getClient18();
|
|
6514
6828
|
await client.deleteSchedule(project, kind);
|
|
6515
6829
|
const resolvedKind = kind ?? "answer-visibility";
|
|
6516
6830
|
if (format === "json") {
|
|
@@ -6627,11 +6941,11 @@ var SCHEDULE_CLI_COMMANDS = [
|
|
|
6627
6941
|
];
|
|
6628
6942
|
|
|
6629
6943
|
// src/commands/settings.ts
|
|
6630
|
-
function
|
|
6944
|
+
function getClient19() {
|
|
6631
6945
|
return createApiClient();
|
|
6632
6946
|
}
|
|
6633
6947
|
async function setProvider(name, opts) {
|
|
6634
|
-
const client =
|
|
6948
|
+
const client = getClient19();
|
|
6635
6949
|
const { format, ...payload } = opts;
|
|
6636
6950
|
const result = await client.updateProvider(name, payload);
|
|
6637
6951
|
if (format === "json") {
|
|
@@ -6647,7 +6961,7 @@ async function setProvider(name, opts) {
|
|
|
6647
6961
|
}
|
|
6648
6962
|
}
|
|
6649
6963
|
async function showSettings(format) {
|
|
6650
|
-
const client =
|
|
6964
|
+
const client = getClient19();
|
|
6651
6965
|
const config = loadConfig();
|
|
6652
6966
|
const settings = await client.getSettings();
|
|
6653
6967
|
if (format === "json") {
|
|
@@ -7444,7 +7758,7 @@ function wrapText(font, text, size, maxWidth) {
|
|
|
7444
7758
|
}
|
|
7445
7759
|
|
|
7446
7760
|
// src/commands/snapshot.ts
|
|
7447
|
-
function
|
|
7761
|
+
function getClient20() {
|
|
7448
7762
|
return createApiClient();
|
|
7449
7763
|
}
|
|
7450
7764
|
function slugify(value) {
|
|
@@ -7455,7 +7769,7 @@ function autoOutputPath(companyName, ext) {
|
|
|
7455
7769
|
return `${slugify(companyName)}-snapshot-${date}.${ext}`;
|
|
7456
7770
|
}
|
|
7457
7771
|
async function createSnapshotReport(companyName, opts) {
|
|
7458
|
-
const client =
|
|
7772
|
+
const client = getClient20();
|
|
7459
7773
|
const report = await client.createSnapshot({
|
|
7460
7774
|
companyName,
|
|
7461
7775
|
domain: opts.domain,
|
|
@@ -9257,7 +9571,7 @@ var SYSTEM_CLI_COMMANDS = [
|
|
|
9257
9571
|
import fs12 from "fs";
|
|
9258
9572
|
|
|
9259
9573
|
// src/commands/wordpress.ts
|
|
9260
|
-
function
|
|
9574
|
+
function getClient21() {
|
|
9261
9575
|
return createApiClient();
|
|
9262
9576
|
}
|
|
9263
9577
|
function printJson2(value) {
|
|
@@ -9404,7 +9718,7 @@ async function wordpressConnect(project, opts) {
|
|
|
9404
9718
|
details: { project }
|
|
9405
9719
|
});
|
|
9406
9720
|
}
|
|
9407
|
-
const client =
|
|
9721
|
+
const client = getClient21();
|
|
9408
9722
|
const result = await client.wordpressConnect(project, {
|
|
9409
9723
|
url: opts.url,
|
|
9410
9724
|
stagingUrl: opts.stagingUrl,
|
|
@@ -9421,7 +9735,7 @@ async function wordpressConnect(project, opts) {
|
|
|
9421
9735
|
printWordpressStatus(project, result);
|
|
9422
9736
|
}
|
|
9423
9737
|
async function wordpressDisconnect(project, format) {
|
|
9424
|
-
const client =
|
|
9738
|
+
const client = getClient21();
|
|
9425
9739
|
await client.wordpressDisconnect(project);
|
|
9426
9740
|
if (format === "json") {
|
|
9427
9741
|
printJson2({ project, disconnected: true });
|
|
@@ -9430,7 +9744,7 @@ async function wordpressDisconnect(project, format) {
|
|
|
9430
9744
|
console.log(`WordPress disconnected from project "${project}".`);
|
|
9431
9745
|
}
|
|
9432
9746
|
async function wordpressStatus(project, format) {
|
|
9433
|
-
const client =
|
|
9747
|
+
const client = getClient21();
|
|
9434
9748
|
const result = await client.wordpressStatus(project);
|
|
9435
9749
|
if (format === "json") {
|
|
9436
9750
|
printJson2(result);
|
|
@@ -9439,7 +9753,7 @@ async function wordpressStatus(project, format) {
|
|
|
9439
9753
|
printWordpressStatus(project, result);
|
|
9440
9754
|
}
|
|
9441
9755
|
async function wordpressPages(project, opts) {
|
|
9442
|
-
const client =
|
|
9756
|
+
const client = getClient21();
|
|
9443
9757
|
const result = await client.wordpressPages(project, opts.env);
|
|
9444
9758
|
if (opts.format === "json") {
|
|
9445
9759
|
printJson2(result);
|
|
@@ -9448,7 +9762,7 @@ async function wordpressPages(project, opts) {
|
|
|
9448
9762
|
printPages(project, result.env, result.pages);
|
|
9449
9763
|
}
|
|
9450
9764
|
async function wordpressPage(project, slug, opts) {
|
|
9451
|
-
const client =
|
|
9765
|
+
const client = getClient21();
|
|
9452
9766
|
const result = await client.wordpressPage(project, slug, opts.env);
|
|
9453
9767
|
if (opts.format === "json") {
|
|
9454
9768
|
printJson2(result);
|
|
@@ -9457,7 +9771,7 @@ async function wordpressPage(project, slug, opts) {
|
|
|
9457
9771
|
printPageDetail(result);
|
|
9458
9772
|
}
|
|
9459
9773
|
async function wordpressCreatePage(project, body) {
|
|
9460
|
-
const client =
|
|
9774
|
+
const client = getClient21();
|
|
9461
9775
|
const result = await client.wordpressCreatePage(project, body);
|
|
9462
9776
|
if (body.format === "json") {
|
|
9463
9777
|
printJson2(result);
|
|
@@ -9468,7 +9782,7 @@ async function wordpressCreatePage(project, body) {
|
|
|
9468
9782
|
printPageDetail(result);
|
|
9469
9783
|
}
|
|
9470
9784
|
async function wordpressUpdatePage(project, body) {
|
|
9471
|
-
const client =
|
|
9785
|
+
const client = getClient21();
|
|
9472
9786
|
const result = await client.wordpressUpdatePage(project, body);
|
|
9473
9787
|
if (body.format === "json") {
|
|
9474
9788
|
printJson2(result);
|
|
@@ -9479,7 +9793,7 @@ async function wordpressUpdatePage(project, body) {
|
|
|
9479
9793
|
printPageDetail(result);
|
|
9480
9794
|
}
|
|
9481
9795
|
async function wordpressSetMeta(project, body) {
|
|
9482
|
-
const client =
|
|
9796
|
+
const client = getClient21();
|
|
9483
9797
|
const result = await client.wordpressSetMeta(project, body);
|
|
9484
9798
|
if (body.format === "json") {
|
|
9485
9799
|
printJson2(result);
|
|
@@ -9529,7 +9843,7 @@ async function wordpressBulkSetMeta(project, opts) {
|
|
|
9529
9843
|
details: { path: filePath }
|
|
9530
9844
|
});
|
|
9531
9845
|
}
|
|
9532
|
-
const client =
|
|
9846
|
+
const client = getClient21();
|
|
9533
9847
|
const result = await client.wordpressBulkSetMeta(project, { entries, env: opts.env });
|
|
9534
9848
|
if (opts.format === "json") {
|
|
9535
9849
|
printJson2(result);
|
|
@@ -9572,7 +9886,7 @@ async function wordpressBulkSetMeta(project, opts) {
|
|
|
9572
9886
|
Total: ${applied.length} applied, ${skipped.length} skipped, ${manual.length} manual`);
|
|
9573
9887
|
}
|
|
9574
9888
|
async function wordpressSchema(project, slug, opts) {
|
|
9575
|
-
const client =
|
|
9889
|
+
const client = getClient21();
|
|
9576
9890
|
const result = await client.wordpressSchema(project, slug, opts.env);
|
|
9577
9891
|
if (opts.format === "json") {
|
|
9578
9892
|
printJson2(result);
|
|
@@ -9583,7 +9897,7 @@ async function wordpressSchema(project, slug, opts) {
|
|
|
9583
9897
|
printSchemaBlocks(result.blocks);
|
|
9584
9898
|
}
|
|
9585
9899
|
async function wordpressSetSchema(project, body) {
|
|
9586
|
-
const client =
|
|
9900
|
+
const client = getClient21();
|
|
9587
9901
|
const result = await client.wordpressSetSchema(project, body);
|
|
9588
9902
|
if (body.format === "json") {
|
|
9589
9903
|
printJson2(result);
|
|
@@ -9631,7 +9945,7 @@ async function wordpressSchemaDeploy(project, opts) {
|
|
|
9631
9945
|
details: { path: filePath }
|
|
9632
9946
|
});
|
|
9633
9947
|
}
|
|
9634
|
-
const client =
|
|
9948
|
+
const client = getClient21();
|
|
9635
9949
|
const result = await client.wordpressSchemaDeploy(project, { profile: parsed, env: opts.env });
|
|
9636
9950
|
if (opts.format === "json") {
|
|
9637
9951
|
printJson2(result);
|
|
@@ -9670,7 +9984,7 @@ async function wordpressSchemaDeploy(project, opts) {
|
|
|
9670
9984
|
Total: ${deployed} deployed, ${stripped} stripped, ${skipped} skipped, ${failed} failed`);
|
|
9671
9985
|
}
|
|
9672
9986
|
async function wordpressSchemaStatus(project, opts) {
|
|
9673
|
-
const client =
|
|
9987
|
+
const client = getClient21();
|
|
9674
9988
|
const result = await client.wordpressSchemaStatus(project, opts.env);
|
|
9675
9989
|
if (opts.format === "json") {
|
|
9676
9990
|
printJson2(result);
|
|
@@ -9729,7 +10043,7 @@ async function wordpressOnboard(project, opts) {
|
|
|
9729
10043
|
});
|
|
9730
10044
|
}
|
|
9731
10045
|
}
|
|
9732
|
-
const client =
|
|
10046
|
+
const client = getClient21();
|
|
9733
10047
|
const result = await client.wordpressOnboard(project, {
|
|
9734
10048
|
url: opts.url,
|
|
9735
10049
|
username: opts.user,
|
|
@@ -9754,7 +10068,7 @@ async function wordpressOnboard(project, opts) {
|
|
|
9754
10068
|
}
|
|
9755
10069
|
}
|
|
9756
10070
|
async function wordpressLlmsTxt(project, opts) {
|
|
9757
|
-
const client =
|
|
10071
|
+
const client = getClient21();
|
|
9758
10072
|
const result = await client.wordpressLlmsTxt(project, opts.env);
|
|
9759
10073
|
if (opts.format === "json") {
|
|
9760
10074
|
printJson2(result);
|
|
@@ -9765,7 +10079,7 @@ async function wordpressLlmsTxt(project, opts) {
|
|
|
9765
10079
|
console.log(result.content ?? "(not found)");
|
|
9766
10080
|
}
|
|
9767
10081
|
async function wordpressSetLlmsTxt(project, body) {
|
|
9768
|
-
const client =
|
|
10082
|
+
const client = getClient21();
|
|
9769
10083
|
const result = await client.wordpressSetLlmsTxt(project, body);
|
|
9770
10084
|
if (body.format === "json") {
|
|
9771
10085
|
printJson2(result);
|
|
@@ -9774,7 +10088,7 @@ async function wordpressSetLlmsTxt(project, body) {
|
|
|
9774
10088
|
printManualAssist(`llms.txt update for "${project}"`, result);
|
|
9775
10089
|
}
|
|
9776
10090
|
async function wordpressAudit(project, opts) {
|
|
9777
|
-
const client =
|
|
10091
|
+
const client = getClient21();
|
|
9778
10092
|
const result = await client.wordpressAudit(project, opts.env);
|
|
9779
10093
|
if (opts.format === "json") {
|
|
9780
10094
|
printJson2(result);
|
|
@@ -9788,7 +10102,7 @@ async function wordpressAudit(project, opts) {
|
|
|
9788
10102
|
printAuditIssues(result.issues);
|
|
9789
10103
|
}
|
|
9790
10104
|
async function wordpressDiff(project, slug, format) {
|
|
9791
|
-
const client =
|
|
10105
|
+
const client = getClient21();
|
|
9792
10106
|
const result = await client.wordpressDiff(project, slug);
|
|
9793
10107
|
if (format === "json") {
|
|
9794
10108
|
printJson2(result);
|
|
@@ -9797,7 +10111,7 @@ async function wordpressDiff(project, slug, format) {
|
|
|
9797
10111
|
printDiff(result);
|
|
9798
10112
|
}
|
|
9799
10113
|
async function wordpressStagingStatus(project, format) {
|
|
9800
|
-
const client =
|
|
10114
|
+
const client = getClient21();
|
|
9801
10115
|
const result = await client.wordpressStagingStatus(project);
|
|
9802
10116
|
if (format === "json") {
|
|
9803
10117
|
printJson2(result);
|
|
@@ -9811,7 +10125,7 @@ async function wordpressStagingStatus(project, format) {
|
|
|
9811
10125
|
console.log(` Admin URL: ${result.adminUrl}`);
|
|
9812
10126
|
}
|
|
9813
10127
|
async function wordpressStagingPush(project, format) {
|
|
9814
|
-
const client =
|
|
10128
|
+
const client = getClient21();
|
|
9815
10129
|
const result = await client.wordpressStagingPush(project);
|
|
9816
10130
|
if (format === "json") {
|
|
9817
10131
|
printJson2(result);
|
|
@@ -10809,6 +11123,7 @@ var REGISTERED_CLI_COMMANDS = [
|
|
|
10809
11123
|
...INTELLIGENCE_CLI_COMMANDS,
|
|
10810
11124
|
...CONTENT_CLI_COMMANDS,
|
|
10811
11125
|
...AGENT_CLI_COMMANDS,
|
|
11126
|
+
...DISCOVER_CLI_COMMANDS,
|
|
10812
11127
|
...DOCTOR_CLI_COMMANDS,
|
|
10813
11128
|
...MCP_CLI_COMMANDS
|
|
10814
11129
|
];
|