@canonry/canonry 7.51.5 → 7.52.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 +8 -0
- package/assets/assets/{AccessControls-B5TqDgeq.js → AccessControls-CteIuEGI.js} +1 -1
- package/assets/assets/{AuditHistoryPanel-DgxiizOW.js → AuditHistoryPanel-DqJGiLsf.js} +1 -1
- package/assets/assets/{BacklinksPage-Ay6pdphx.js → BacklinksPage-DotWEPQt.js} +1 -1
- package/assets/assets/{HistoryPage-B11eFH21.js → HistoryPage-aOd198dT.js} +1 -1
- package/assets/assets/MeasurementPropertyPage-CuaKVK8x.js +4 -0
- package/assets/assets/{ProjectPage-DoY0hftd.js → ProjectPage-O9oufMgi.js} +4 -4
- package/assets/assets/{RunsPage-BPBmuQAS.js → RunsPage-DIXMrc-N.js} +1 -1
- package/assets/assets/{SettingsPage-ClKnP8xy.js → SettingsPage-BuGb6AGa.js} +1 -1
- package/assets/assets/SiteHealthSection-CweaKjCo.js +2 -0
- package/assets/assets/TrafficPage-B7MaQalp.js +40 -0
- package/assets/assets/{TrafficSourceDetailPage-DQu0YNt2.js → TrafficSourceDetailPage-BPtjnF9s.js} +1 -1
- package/assets/assets/{card-DYMyvhB9.js → card-DoV-8Txo.js} +1 -1
- package/assets/assets/{extract-error-message-BRM1I_3L.js → extract-error-message-DKQJJlZ-.js} +1 -1
- package/assets/assets/{format-helpers-DrkFERj3.js → format-helpers-BWnMmkiO.js} +1 -1
- package/assets/assets/index-Z63c4PeO.js +39 -0
- package/assets/assets/{query-client-gRFnU4VF.js → query-client-vB35tVTz.js} +1 -1
- package/assets/assets/{react-query-lH82FULK.js → react-query-BI0567qs.js} +1 -1
- package/assets/assets/{react-sigma_core.esm.min-D09H4byP.js → react-sigma_core.esm.min-hGyOC4V_.js} +1 -1
- package/assets/assets/{service-Cx0HSnE9.js → service-c4YvpVKX.js} +1 -1
- package/assets/index.html +6 -6
- package/dist/ads-MREK2AGL.js +544 -0
- package/dist/agent-4RUZ3MC4.js +70 -0
- package/dist/agent-ask-YLTYBEYH.js +139 -0
- package/dist/agent-conversations-QA6IKDGR.js +52 -0
- package/dist/agent-memory-MEQAJOB3.js +92 -0
- package/dist/agent-providers-AXYPDJHL.js +55 -0
- package/dist/agent-transcript-SMNQNYCD.js +77 -0
- package/dist/analytics-4OR64IGV.js +240 -0
- package/dist/apply-CQXCFXAH.js +175 -0
- package/dist/backfill-TMXCNVOB.js +41 -0
- package/dist/backlinks-6KFAQGYV.js +303 -0
- package/dist/bing-HFCACTAC.js +418 -0
- package/dist/bootstrap-SQVQXOJC.js +326 -0
- package/dist/cdp-IACL7EXU.js +162 -0
- package/dist/chunk-4MJYGB56.js +124 -0
- package/dist/chunk-5N6245R7.js +1160 -0
- package/dist/chunk-6BPZHNDC.js +617 -0
- package/dist/chunk-6GO5VVAC.js +15 -0
- package/dist/chunk-7244X3K6.js +609 -0
- package/dist/chunk-7XE2IRBG.js +204 -0
- package/dist/chunk-AOJU5LKX.js +8 -0
- package/dist/chunk-AWCWIQAU.js +2686 -0
- package/dist/{chunk-JBZZEIM2.js → chunk-BBOHY2DQ.js} +2 -13
- package/dist/{chunk-AZFPA7JV.js → chunk-BU3VAG5J.js} +6 -4
- package/dist/{chunk-4YCGZGA3.js → chunk-BYOK6Z4F.js} +2 -2
- package/dist/chunk-DSNSD5J3.js +971 -0
- package/dist/chunk-EGIZNSDA.js +94 -0
- package/dist/chunk-ELCLGWUT.js +83 -0
- package/dist/chunk-FC4XND45.js +38 -0
- package/dist/chunk-GNKOBKPW.js +58 -0
- package/dist/chunk-HEGXGCGL.js +524 -0
- package/dist/chunk-I6KNMZ77.js +232 -0
- package/dist/{chunk-HLVEB5TB.js → chunk-IIOEAJTV.js} +7 -5
- package/dist/chunk-ILDT4LPB.js +1273 -0
- package/dist/chunk-JY3RLZGB.js +30 -0
- package/dist/{chunk-PLYJX67A.js → chunk-K5I45PZI.js} +8084 -13939
- package/dist/chunk-KXAOMTXN.js +1034 -0
- package/dist/chunk-LK2BG6EX.js +145 -0
- package/dist/chunk-MJNUSPO4.js +15 -0
- package/dist/chunk-MKAC7HKH.js +9178 -0
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/{chunk-SFMWHPMX.js → chunk-O4RMPA6H.js} +13765 -13737
- package/dist/chunk-O77IBNVO.js +8264 -0
- package/dist/chunk-OFL4PTYU.js +644 -0
- package/dist/chunk-QLPLENDT.js +133 -0
- package/dist/chunk-R2J4SNKF.js +78 -0
- package/dist/{chunk-KEATAHXH.js → chunk-RVUCY4ZV.js} +358 -581
- package/dist/chunk-SNFBJKAW.js +530 -0
- package/dist/chunk-TALC5DX5.js +420 -0
- package/dist/chunk-TSENU4GG.js +18 -0
- package/dist/{chunk-HAHXPJQ5.js → chunk-V5D4XNWV.js} +16 -1684
- package/dist/chunk-VJWDBFSL.js +69 -0
- package/dist/chunk-XEBKF4N5.js +8 -0
- package/dist/chunk-Y4GK7GCV.js +15376 -0
- package/dist/{chunk-A3WSAAQS.js → chunk-YSEC6TIB.js} +7917 -33199
- package/dist/chunk-Z7IUAJOF.js +13 -0
- package/dist/citations-NSBBWRZ4.js +106 -0
- package/dist/{cli-catalog-MO6Z2CIZ.js → cli-catalog-OFWJMNMD.js} +5 -3
- package/dist/cli-commands-WVBL337U.js +19 -0
- package/dist/cli.js +35 -29
- package/dist/competitor-V4OHORBC.js +561 -0
- package/dist/content-RUXRI5IC.js +257 -0
- package/dist/dashboard-JXB2YAQJ.js +71 -0
- package/dist/demo-55ZNUOXU.js +75 -0
- package/dist/{demo-server-GIWDJGJX.js → demo-server-XO7PHM4I.js} +22 -9
- package/dist/discover-JJQ564HS.js +372 -0
- package/dist/discover-eval-KLEKZ6U4.js +282 -0
- package/dist/doctor-JAMQZCMZ.js +152 -0
- package/dist/evidence-YRSB7GFE.js +57 -0
- package/dist/export-cmd-MHML4OYU.js +49 -0
- package/dist/ga-LSXPE2MN.js +911 -0
- package/dist/gbp-RMKMLOC7.js +370 -0
- package/dist/google-JQ4T6JTQ.js +946 -0
- package/dist/google-marketing-J6SEODYC.js +403 -0
- package/dist/health-cmd-MV2JM2C3.js +64 -0
- package/dist/history-SRRH7A2E.js +90 -0
- package/dist/index.d.ts +43 -4
- package/dist/index.js +29 -6
- package/dist/init-ZJZFUERV.js +432 -0
- package/dist/insights-PMMGNWZH.js +63 -0
- package/dist/intelligence-service-KCSU6ZUJ.js +15 -0
- package/dist/keys-TS7NZANS.js +116 -0
- package/dist/keyword-VNCKDUGC.js +164 -0
- package/dist/logs-VH3WOTZJ.js +30 -0
- package/dist/mcp-DG2RROB3.js +14 -0
- package/dist/mcp.js +14 -5
- package/dist/measurement-plan-4T35TUGG.js +42 -0
- package/dist/notify-BWHUSKL7.js +125 -0
- package/dist/organic-evidence-QX4SXXJP.js +53 -0
- package/dist/overview-7IHUTKUV.js +213 -0
- package/dist/project-JXLSWDE2.js +460 -0
- package/dist/query-S75EL25H.js +211 -0
- package/dist/research-KFTV3IP4.js +200 -0
- package/dist/results-export-GTKVBU34.js +27 -0
- package/dist/run-26HDIRHF.js +31 -0
- package/dist/schedule-N6G4SVHQ.js +177 -0
- package/dist/search-MI32EPYM.js +42 -0
- package/dist/serve-XLGE42AG.js +598 -0
- package/dist/session-W5DXWIYM.js +47 -0
- package/dist/settings-T7WI2UVE.js +107 -0
- package/dist/skills-F3WPKPTK.js +33 -0
- package/dist/snapshot-PD3EAVEX.js +538 -0
- package/dist/src-XDUXMJC3.js +316 -0
- package/dist/status-PUH7JFZ4.js +126 -0
- package/dist/support-ARF4HER7.js +24 -0
- package/dist/technical-aeo-AUFWWJIP.js +625 -0
- package/dist/telemetry-XBYT7G2K.js +118 -0
- package/dist/tools-GVHIRWSN.js +41 -0
- package/dist/traffic-B3HW2ZWG.js +1295 -0
- package/dist/users-M5HNQZYI.js +170 -0
- package/dist/visibility-stats-Y7GJKMHN.js +241 -0
- package/dist/wordpress-GCIURYPN.js +600 -0
- package/package.json +1 -1
- package/assets/assets/MeasurementPropertyPage-1UYI7mzP.js +0 -4
- package/assets/assets/SiteHealthSection-PWjKMmEn.js +0 -2
- package/assets/assets/TrafficPage-DkfGiJXR.js +0 -40
- package/assets/assets/index-CG1Jox52.js +0 -39
- package/dist/chunk-4QQYYRHV.js +0 -23082
- package/dist/cli-commands-FOJR3HHU.js +0 -15
- package/dist/intelligence-service-XQCNWAPL.js +0 -9
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createApiClient
|
|
3
|
+
} from "./chunk-V5D4XNWV.js";
|
|
4
|
+
import "./chunk-OFL4PTYU.js";
|
|
5
|
+
import {
|
|
6
|
+
emitJsonl
|
|
7
|
+
} from "./chunk-Z7IUAJOF.js";
|
|
8
|
+
import "./chunk-AOJU5LKX.js";
|
|
9
|
+
import {
|
|
10
|
+
CliError,
|
|
11
|
+
isMachineFormat
|
|
12
|
+
} from "./chunk-HGMYEDAQ.js";
|
|
13
|
+
import {
|
|
14
|
+
USER_PASSWORD_MIN_LENGTH,
|
|
15
|
+
UserRoles,
|
|
16
|
+
formatIsoDate
|
|
17
|
+
} from "./chunk-O4RMPA6H.js";
|
|
18
|
+
import "./chunk-MLKGABMK.js";
|
|
19
|
+
|
|
20
|
+
// src/cli-prompt.ts
|
|
21
|
+
import readline from "readline";
|
|
22
|
+
async function promptHiddenInput(question) {
|
|
23
|
+
const input = process.stdin;
|
|
24
|
+
const output = process.stdout;
|
|
25
|
+
if (!input.isTTY) {
|
|
26
|
+
const rl2 = readline.createInterface({ input, output });
|
|
27
|
+
try {
|
|
28
|
+
return await new Promise((resolve) => {
|
|
29
|
+
rl2.question(question, resolve);
|
|
30
|
+
});
|
|
31
|
+
} finally {
|
|
32
|
+
rl2.close();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const rl = readline.createInterface({ input, output, terminal: true });
|
|
36
|
+
const mutable = rl;
|
|
37
|
+
const originalWrite = mutable._writeToOutput?.bind(rl);
|
|
38
|
+
let muted = false;
|
|
39
|
+
mutable._writeToOutput = (chunk) => {
|
|
40
|
+
if (muted) {
|
|
41
|
+
output.write("");
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
originalWrite?.(chunk);
|
|
45
|
+
};
|
|
46
|
+
try {
|
|
47
|
+
return await new Promise((resolve) => {
|
|
48
|
+
rl.question(question, (answer) => {
|
|
49
|
+
output.write("\n");
|
|
50
|
+
resolve(answer);
|
|
51
|
+
});
|
|
52
|
+
muted = true;
|
|
53
|
+
});
|
|
54
|
+
} finally {
|
|
55
|
+
muted = false;
|
|
56
|
+
if (originalWrite) mutable._writeToOutput = originalWrite;
|
|
57
|
+
rl.close();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function readAllStdin() {
|
|
61
|
+
const chunks = [];
|
|
62
|
+
for await (const chunk of process.stdin) {
|
|
63
|
+
chunks.push(Buffer.from(chunk));
|
|
64
|
+
}
|
|
65
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/commands/users.ts
|
|
69
|
+
function getClient() {
|
|
70
|
+
return createApiClient();
|
|
71
|
+
}
|
|
72
|
+
var ROLE_NAMES = Object.values(UserRoles);
|
|
73
|
+
function parseRole(role) {
|
|
74
|
+
const normalized = role.trim().toLowerCase();
|
|
75
|
+
if (ROLE_NAMES.includes(normalized)) return normalized;
|
|
76
|
+
throw new CliError({
|
|
77
|
+
code: "CLI_USAGE_ERROR",
|
|
78
|
+
message: `Unknown role "${role}" \u2014 choose ${ROLE_NAMES.join(" or ")}`,
|
|
79
|
+
displayMessage: `Error: unknown role "${role}". Choose ${ROLE_NAMES.join(" or ")}.`
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
async function listUsers(format) {
|
|
83
|
+
const client = getClient();
|
|
84
|
+
const { users } = await client.listUsers();
|
|
85
|
+
if (format === "json") {
|
|
86
|
+
console.log(JSON.stringify({ users }, null, 2));
|
|
87
|
+
return;
|
|
88
|
+
} else if (format === "jsonl") {
|
|
89
|
+
emitJsonl(users);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (users.length === 0) {
|
|
93
|
+
console.log("No accounts yet \u2014 the dashboard opens without a sign-in.");
|
|
94
|
+
console.log("Create the first one with: canonry user create --name <name> --role admin");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
console.log(`${"NAME".padEnd(24)} ${"ROLE".padEnd(8)} ${"CREATED".padEnd(12)} LAST SIGN-IN`);
|
|
98
|
+
for (const user of users) {
|
|
99
|
+
const lastLogin = user.lastLoginAt ? formatIsoDate(user.lastLoginAt) : "never";
|
|
100
|
+
console.log(
|
|
101
|
+
`${user.name.padEnd(24)} ${user.role.padEnd(8)} ${formatIsoDate(user.createdAt).padEnd(12)} ${lastLogin}`
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async function createUser(opts) {
|
|
106
|
+
const role = parseRole(opts.role);
|
|
107
|
+
const password = opts.passwordStdin ? (await (opts.readStdin ?? readAllStdin)()).replace(/\r?\n$/, "") : await askForPassword();
|
|
108
|
+
if (password.length < USER_PASSWORD_MIN_LENGTH) {
|
|
109
|
+
throw new CliError({
|
|
110
|
+
code: "CLI_USAGE_ERROR",
|
|
111
|
+
message: "Password too short",
|
|
112
|
+
displayMessage: `Error: the password must be at least ${USER_PASSWORD_MIN_LENGTH} characters.`
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
const client = getClient();
|
|
116
|
+
const wasFirst = await isFirstAccount(client);
|
|
117
|
+
const created = await client.createUser({ name: opts.name, role, password });
|
|
118
|
+
if (isMachineFormat(opts.format)) {
|
|
119
|
+
console.log(JSON.stringify(created, null, 2));
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
printCreated(created, wasFirst);
|
|
123
|
+
}
|
|
124
|
+
async function askForPassword() {
|
|
125
|
+
const first = await promptHiddenInput("Password: ");
|
|
126
|
+
const second = await promptHiddenInput("Confirm password: ");
|
|
127
|
+
if (first !== second) {
|
|
128
|
+
throw new CliError({
|
|
129
|
+
code: "CLI_USAGE_ERROR",
|
|
130
|
+
message: "Passwords do not match",
|
|
131
|
+
displayMessage: "Error: the two passwords do not match. Nothing was created."
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return first;
|
|
135
|
+
}
|
|
136
|
+
async function isFirstAccount(client) {
|
|
137
|
+
try {
|
|
138
|
+
const { users } = await client.listUsers();
|
|
139
|
+
return users.length === 0;
|
|
140
|
+
} catch {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function printCreated(created, wasFirst) {
|
|
145
|
+
console.log(`Account "${created.name}" created with ${created.role} access.
|
|
146
|
+
`);
|
|
147
|
+
if (wasFirst) {
|
|
148
|
+
console.log("This is the first account on this install, so the dashboard now asks");
|
|
149
|
+
console.log("everyone to sign in. API keys are unaffected and keep working as before.\n");
|
|
150
|
+
}
|
|
151
|
+
if (created.role === UserRoles.viewer) {
|
|
152
|
+
console.log("A viewer can read everything and change nothing.");
|
|
153
|
+
} else {
|
|
154
|
+
console.log("An administrator can do everything the install could already do.");
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async function deleteUser(name, format) {
|
|
158
|
+
const client = getClient();
|
|
159
|
+
const result = await client.deleteUser(name);
|
|
160
|
+
if (isMachineFormat(format)) {
|
|
161
|
+
console.log(JSON.stringify(result, null, 2));
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
console.log(`Account "${result.name}" deleted. Any browser signed in as them is signed out now.`);
|
|
165
|
+
}
|
|
166
|
+
export {
|
|
167
|
+
createUser,
|
|
168
|
+
deleteUser,
|
|
169
|
+
listUsers
|
|
170
|
+
};
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createApiClient
|
|
3
|
+
} from "./chunk-V5D4XNWV.js";
|
|
4
|
+
import "./chunk-OFL4PTYU.js";
|
|
5
|
+
import {
|
|
6
|
+
emitJsonl
|
|
7
|
+
} from "./chunk-Z7IUAJOF.js";
|
|
8
|
+
import "./chunk-AOJU5LKX.js";
|
|
9
|
+
import {
|
|
10
|
+
isMachineFormat
|
|
11
|
+
} from "./chunk-HGMYEDAQ.js";
|
|
12
|
+
import {
|
|
13
|
+
formatPercent,
|
|
14
|
+
isVisibilityCompareClassMetric,
|
|
15
|
+
shareOfVoiceLabel,
|
|
16
|
+
shareOfVoiceReason
|
|
17
|
+
} from "./chunk-O4RMPA6H.js";
|
|
18
|
+
import "./chunk-MLKGABMK.js";
|
|
19
|
+
|
|
20
|
+
// src/commands/visibility-stats.ts
|
|
21
|
+
async function showVisibilityStats(project, opts) {
|
|
22
|
+
const client = createApiClient();
|
|
23
|
+
const data = await client.getVisibilityStats(project, {
|
|
24
|
+
since: opts.since,
|
|
25
|
+
until: opts.until,
|
|
26
|
+
month: opts.month,
|
|
27
|
+
lastRuns: opts.lastRuns,
|
|
28
|
+
groupBy: opts.byProvider ? "provider" : void 0,
|
|
29
|
+
shareOfVoice: opts.shareOfVoice,
|
|
30
|
+
queryClass: opts.queryClass
|
|
31
|
+
});
|
|
32
|
+
if (opts.format === "jsonl") {
|
|
33
|
+
emitJsonl(data.queries.map((q) => ({ project: data.project, runCount: data.window.runCount, ...q })));
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (opts.format === "json") {
|
|
37
|
+
console.log(JSON.stringify(data, null, 2));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
printVisibilityStats(data);
|
|
41
|
+
}
|
|
42
|
+
async function showVisibilityCompare(project, opts) {
|
|
43
|
+
if (!opts.from || !opts.to) throw new Error("visibility-compare requires --from <YYYY-MM> and --to <YYYY-MM>");
|
|
44
|
+
const client = createApiClient();
|
|
45
|
+
const data = await client.getVisibilityCompare(project, opts.from, opts.to, { scope: opts.scope, scopeKey: opts.scopeKey, marketKey: opts.marketKey, provider: opts.provider, location: opts.location });
|
|
46
|
+
if (isMachineFormat(opts.format)) {
|
|
47
|
+
console.log(JSON.stringify(data, null, 2));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
printVisibilityCompare(data);
|
|
51
|
+
}
|
|
52
|
+
function periodCell(p) {
|
|
53
|
+
if (p.availability === "classification-unavailable") return "unavailable: query classification";
|
|
54
|
+
if (p.availability === "no-competitive-frame") {
|
|
55
|
+
return `unavailable: no competitive frame (${p.numerator} observed)`;
|
|
56
|
+
}
|
|
57
|
+
if (p.point === null || p.ciLow === null || p.ciHigh === null) return "no data";
|
|
58
|
+
return `${formatPercent(p.point)} [${formatPercent(p.ciLow)}, ${formatPercent(p.ciHigh)}]`;
|
|
59
|
+
}
|
|
60
|
+
function verdictCell(m) {
|
|
61
|
+
switch (m.verdict) {
|
|
62
|
+
case "within-noise":
|
|
63
|
+
return "within noise";
|
|
64
|
+
case "insufficient-data":
|
|
65
|
+
return "no data";
|
|
66
|
+
case "moved":
|
|
67
|
+
return `moved ${m.direction === "down" ? "down" : m.direction === "up" ? "up" : ""}`.trim();
|
|
68
|
+
case "model-discontinuous":
|
|
69
|
+
return "model discontinuity";
|
|
70
|
+
case "model-unknown":
|
|
71
|
+
return "model unknown";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function metricQueryClassLabel(metric) {
|
|
75
|
+
if (metric.queryClass === "branded") return "branded queries";
|
|
76
|
+
if (metric.queryClass === "non-brand") return "non-brand queries";
|
|
77
|
+
if (metric.queryClass === "pooled") return "pooled queries; classification unavailable";
|
|
78
|
+
return "all queries";
|
|
79
|
+
}
|
|
80
|
+
function selectionLabel(selection) {
|
|
81
|
+
if (!selection) return null;
|
|
82
|
+
const parts = [];
|
|
83
|
+
if (selection.scope && selection.scope !== "project") parts.push(`${selection.scope} ${selection.scopeKey ?? ""}`.trim());
|
|
84
|
+
if (selection.marketKey) parts.push(`market ${selection.marketKey}`);
|
|
85
|
+
if (selection.provider) parts.push(`engine ${selection.provider}`);
|
|
86
|
+
if (selection.location) parts.push(`location ${selection.location}`);
|
|
87
|
+
return parts.length > 0 ? parts.join(" \xB7 ") : null;
|
|
88
|
+
}
|
|
89
|
+
function printVisibilityCompare(data) {
|
|
90
|
+
console.log(`AEO month over month: ${data.project} ${data.from.month} -> ${data.to.month}`);
|
|
91
|
+
const selection = selectionLabel(data.selection);
|
|
92
|
+
if (selection) console.log(`Selection: ${selection}`);
|
|
93
|
+
const b = data.basket;
|
|
94
|
+
const excl = [];
|
|
95
|
+
if (b.excludedFromOnly > 0) excl.push(`${b.excludedFromOnly} only in ${data.from.month}`);
|
|
96
|
+
if (b.excludedToOnly > 0) excl.push(`${b.excludedToOnly} only in ${data.to.month}`);
|
|
97
|
+
if (b.excludedProviders.length > 0) excl.push(`engines dropped: ${b.excludedProviders.join(", ")}`);
|
|
98
|
+
console.log(`Basket: ${b.queryCount} quer${b.queryCount === 1 ? "y" : "ies"}, ${b.providers.length} engine(s)${excl.length ? ` (excluded: ${excl.join("; ")})` : ""}`);
|
|
99
|
+
const sweeps = `Sweeps: ${data.from.month} ${data.from.runCount}, ${data.to.month} ${data.to.runCount}`;
|
|
100
|
+
const low = data.from.lowRunCount || data.to.lowRunCount;
|
|
101
|
+
console.log(low ? `${sweeps} (below the 5-sweep floor \u2014 intervals are wide, a "moved" verdict is unlikely to be reachable)` : sweeps);
|
|
102
|
+
if (data.continuity.status !== "comparable") {
|
|
103
|
+
console.log(`Continuity: ${data.continuity.status.replace("-", " ")} \u2014 no directional call is made.`);
|
|
104
|
+
}
|
|
105
|
+
console.log("");
|
|
106
|
+
if (data.classComparison) {
|
|
107
|
+
const frame = data.classComparison;
|
|
108
|
+
console.log(`Class metrics basket (frozen Advanced): ${frame.basket.queryCount} queries; engines: ${frame.basket.providers.join(", ") || "none"}`);
|
|
109
|
+
const classSweeps = `Class basket sweeps: ${frame.from.month} ${frame.from.runCount}, ${frame.to.month} ${frame.to.runCount}; continuity: ${frame.continuity.status}`;
|
|
110
|
+
const classLow = frame.from.lowRunCount || frame.to.lowRunCount;
|
|
111
|
+
console.log(classLow ? `${classSweeps} (below the 5-sweep floor \u2014 class intervals are wide, a "moved" verdict is unlikely to be reachable)` : classSweeps);
|
|
112
|
+
for (const provider of frame.continuity.providers) {
|
|
113
|
+
if (provider.status !== "included") console.log(`Class basket excludes ${provider.provider}: ${provider.fromModels.join("/") || "?"} -> ${provider.toModels.join("/") || "?"} (${provider.status})`);
|
|
114
|
+
}
|
|
115
|
+
console.log("");
|
|
116
|
+
}
|
|
117
|
+
const rows = data.metrics.map((m) => ({
|
|
118
|
+
label: `${m.label} \xB7 ${metricQueryClassLabel(m)}${data.classComparison && isVisibilityCompareClassMetric(m.key) ? " \xB7 class basket" : ""}${m.driftRobust ? " *" : ""}`,
|
|
119
|
+
to: periodCell(m.to),
|
|
120
|
+
from: periodCell(m.from),
|
|
121
|
+
verdict: verdictCell(m)
|
|
122
|
+
}));
|
|
123
|
+
rows.push({
|
|
124
|
+
label: "Queries named (count)",
|
|
125
|
+
to: `${data.queriesMentioned.to.count} of ${data.queriesMentioned.to.of}`,
|
|
126
|
+
from: `${data.queriesMentioned.from.count} of ${data.queriesMentioned.from.of}`,
|
|
127
|
+
verdict: ""
|
|
128
|
+
});
|
|
129
|
+
const w = (sel, head) => Math.max(head.length, ...rows.map((r) => sel(r).length));
|
|
130
|
+
const lw = w((r) => r.label, "Metric");
|
|
131
|
+
const tw = w((r) => r.to, data.to.month);
|
|
132
|
+
const fw = w((r) => r.from, data.from.month);
|
|
133
|
+
console.log(` ${"Metric".padEnd(lw)} ${data.to.month.padEnd(tw)} ${data.from.month.padEnd(fw)} Verdict`);
|
|
134
|
+
for (const r of rows) {
|
|
135
|
+
console.log(` ${r.label.padEnd(lw)} ${r.to.padEnd(tw)} ${r.from.padEnd(fw)} ${r.verdict}`);
|
|
136
|
+
}
|
|
137
|
+
console.log("");
|
|
138
|
+
console.log(" * share of voice is less exposed to broad model-wide naming propensity; model continuity is still required.");
|
|
139
|
+
for (const provider of data.continuity.providers) {
|
|
140
|
+
if (provider.status !== "included") {
|
|
141
|
+
console.log(` Excluded for model continuity: ${provider.provider} (${provider.fromModels.join("/") || "?"} -> ${provider.toModels.join("/") || "?"}; ${provider.status.replace("-", " ")})`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function citedCell(c) {
|
|
146
|
+
return `${c.cited}/${c.total}`;
|
|
147
|
+
}
|
|
148
|
+
function mentionedCell(c) {
|
|
149
|
+
return `${c.mentioned}/${c.checked}`;
|
|
150
|
+
}
|
|
151
|
+
function printVisibilityStats(data) {
|
|
152
|
+
const w = data.window;
|
|
153
|
+
const windowParts = [`${w.runCount} run(s)`];
|
|
154
|
+
if (w.lastRuns !== null) windowParts.push(`last ${w.lastRuns}`);
|
|
155
|
+
if (w.since !== null) windowParts.push(`since ${w.since}`);
|
|
156
|
+
if (w.until !== null) windowParts.push(`until ${w.until}`);
|
|
157
|
+
console.log("Visibility stats (cited = source list, mentioned = answer text)");
|
|
158
|
+
console.log(`Window: ${windowParts.join(" \xB7 ")}`);
|
|
159
|
+
console.log('Cited = cited/total snapshots \xB7 Mentioned = mentioned/checked (checked excludes "not checked")');
|
|
160
|
+
console.log("");
|
|
161
|
+
if (data.queries.length === 0) {
|
|
162
|
+
console.log("No answer-visibility snapshots in this window \u2014 run a sweep first (canonry run <project>).");
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const rows = data.queries.map((q) => ({
|
|
166
|
+
label: q.query,
|
|
167
|
+
cited: citedCell(q),
|
|
168
|
+
citedPct: formatPercent(q.citedRate),
|
|
169
|
+
ment: mentionedCell(q),
|
|
170
|
+
mentPct: formatPercent(q.mentionRate)
|
|
171
|
+
}));
|
|
172
|
+
const queryWidth = Math.max(7, ...rows.map((r) => r.label.length));
|
|
173
|
+
const citedWidth = Math.max(7, ...rows.map((r) => r.cited.length));
|
|
174
|
+
const mentWidth = Math.max(9, ...rows.map((r) => r.ment.length));
|
|
175
|
+
const header = [
|
|
176
|
+
"Query".padEnd(queryWidth),
|
|
177
|
+
"Cited".padEnd(citedWidth),
|
|
178
|
+
"Cited%".padStart(7),
|
|
179
|
+
"Mentioned".padEnd(mentWidth),
|
|
180
|
+
"Ment%".padStart(7)
|
|
181
|
+
].join(" ");
|
|
182
|
+
console.log(header);
|
|
183
|
+
console.log("\u2500".repeat(header.length));
|
|
184
|
+
for (const r of rows) {
|
|
185
|
+
console.log(
|
|
186
|
+
[
|
|
187
|
+
r.label.padEnd(queryWidth),
|
|
188
|
+
r.cited.padEnd(citedWidth),
|
|
189
|
+
r.citedPct.padStart(7),
|
|
190
|
+
r.ment.padEnd(mentWidth),
|
|
191
|
+
r.mentPct.padStart(7)
|
|
192
|
+
].join(" ")
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
console.log("\u2500".repeat(header.length));
|
|
196
|
+
console.log(
|
|
197
|
+
[
|
|
198
|
+
"TOTAL".padEnd(queryWidth),
|
|
199
|
+
citedCell(data.totals).padEnd(citedWidth),
|
|
200
|
+
formatPercent(data.totals.citedRate).padStart(7),
|
|
201
|
+
mentionedCell(data.totals).padEnd(mentWidth),
|
|
202
|
+
formatPercent(data.totals.mentionRate).padStart(7)
|
|
203
|
+
].join(" ")
|
|
204
|
+
);
|
|
205
|
+
if (data.groupBy === "provider" && data.byProvider && data.byProvider.length > 0) {
|
|
206
|
+
console.log("");
|
|
207
|
+
console.log("By provider (pooled across queries):");
|
|
208
|
+
const provWidth = Math.max(8, ...data.byProvider.map((p) => p.provider.length));
|
|
209
|
+
for (const p of data.byProvider) {
|
|
210
|
+
console.log(
|
|
211
|
+
[
|
|
212
|
+
` ${p.provider}`.padEnd(provWidth + 2),
|
|
213
|
+
citedCell(p).padEnd(citedWidth),
|
|
214
|
+
formatPercent(p.citedRate).padStart(7),
|
|
215
|
+
mentionedCell(p).padEnd(mentWidth),
|
|
216
|
+
formatPercent(p.mentionRate).padStart(7)
|
|
217
|
+
].join(" ")
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
const sov = data.shareOfVoice;
|
|
222
|
+
if (sov) {
|
|
223
|
+
console.log("");
|
|
224
|
+
const pctStr = sov.availability !== void 0 ? shareOfVoiceLabel(sov.percent, sov) : sov.percent !== null ? formatPercent(sov.percent, "percent") : sov.competitorCount === 0 ? "\u2014 (no competitors configured)" : sov.snapshotsWithAnswerText === 0 ? "\u2014 (no answer text in scope)" : "\u2014 (no brands mentioned in scope)";
|
|
225
|
+
const scope = sov.queryClass === "pooled" ? "pooled queries \xB7 classification unavailable" : `${sov.queryClass} queries`;
|
|
226
|
+
console.log(
|
|
227
|
+
`Share of voice (${scope}${sov.measurementScope === "all-markets" ? " \xB7 all markets" : ""}): ${pctStr} (you ${sov.projectMentions} vs competitors ${sov.competitorMentions} brand mentions across ${sov.snapshotsWithAnswerText} answers)`
|
|
228
|
+
);
|
|
229
|
+
if (sov.reason) console.log(` ${shareOfVoiceReason(sov.reason)}`);
|
|
230
|
+
if (sov.queryClass === "non-brand") {
|
|
231
|
+
console.log(" branded queries excluded on purpose \u2014 re-run with --query-class branded for brand recall");
|
|
232
|
+
}
|
|
233
|
+
for (const c of sov.perCompetitor.slice(0, 8)) {
|
|
234
|
+
console.log(` ${c.domain}: ${c.mentions}`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
export {
|
|
239
|
+
showVisibilityCompare,
|
|
240
|
+
showVisibilityStats
|
|
241
|
+
};
|