@canonry/canonry 7.51.5 → 7.51.6

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.
Files changed (116) hide show
  1. package/dist/ads-ABAT3K4K.js +544 -0
  2. package/dist/agent-5G4DRLYX.js +70 -0
  3. package/dist/agent-ask-UDVCZRO7.js +139 -0
  4. package/dist/agent-conversations-5E4JP2QZ.js +52 -0
  5. package/dist/agent-memory-7IIJ4HGZ.js +92 -0
  6. package/dist/agent-providers-BOXPUXZ4.js +55 -0
  7. package/dist/agent-transcript-4O56G6PQ.js +77 -0
  8. package/dist/analytics-PKMWX5XL.js +240 -0
  9. package/dist/apply-OK4XEBDA.js +175 -0
  10. package/dist/backfill-2OT56CX2.js +41 -0
  11. package/dist/backlinks-547WCHND.js +303 -0
  12. package/dist/bing-ZVBV4ZD5.js +418 -0
  13. package/dist/bootstrap-HUB7XQ73.js +326 -0
  14. package/dist/cdp-KQKQ4PWJ.js +162 -0
  15. package/dist/chunk-2G6IP3MO.js +517 -0
  16. package/dist/chunk-42D2LE2B.js +1273 -0
  17. package/dist/chunk-4MJYGB56.js +124 -0
  18. package/dist/chunk-63ISSSGX.js +9150 -0
  19. package/dist/{chunk-PLYJX67A.js → chunk-6G6FTDWC.js} +8080 -13939
  20. package/dist/chunk-6GO5VVAC.js +15 -0
  21. package/dist/{chunk-4YCGZGA3.js → chunk-73P65KPW.js} +2 -2
  22. package/dist/chunk-7B2Q4NJE.js +133 -0
  23. package/dist/{chunk-JBZZEIM2.js → chunk-7WZ2FPB4.js} +2 -13
  24. package/dist/chunk-AOJU5LKX.js +8 -0
  25. package/dist/chunk-B2FR2ZQ4.js +420 -0
  26. package/dist/{chunk-HAHXPJQ5.js → chunk-B5J675KK.js} +16 -1684
  27. package/dist/{chunk-SFMWHPMX.js → chunk-D6COIM3U.js} +17128 -17143
  28. package/dist/{chunk-A3WSAAQS.js → chunk-DGVUTH7W.js} +9086 -34522
  29. package/dist/chunk-ELCLGWUT.js +83 -0
  30. package/dist/chunk-GO2J7SYT.js +1034 -0
  31. package/dist/chunk-HACZUMGM.js +145 -0
  32. package/dist/chunk-HM4NNKLG.js +94 -0
  33. package/dist/chunk-I3A56PFP.js +58 -0
  34. package/dist/chunk-I77PLCWG.js +961 -0
  35. package/dist/chunk-ISOQPVPY.js +232 -0
  36. package/dist/chunk-KFT5LOP2.js +610 -0
  37. package/dist/chunk-MLKGABMK.js +9 -0
  38. package/dist/chunk-MMEO22MF.js +38 -0
  39. package/dist/chunk-NHQ2U5I4.js +78 -0
  40. package/dist/chunk-PCXRFT3N.js +530 -0
  41. package/dist/chunk-PITHTCAX.js +15376 -0
  42. package/dist/chunk-QWKPSFGL.js +30 -0
  43. package/dist/chunk-RKIXES2B.js +609 -0
  44. package/dist/chunk-TSENU4GG.js +18 -0
  45. package/dist/{chunk-HLVEB5TB.js → chunk-TUTKNUMV.js} +7 -5
  46. package/dist/chunk-U3AHE2RT.js +1160 -0
  47. package/dist/chunk-UQ3MOZGC.js +644 -0
  48. package/dist/{chunk-AZFPA7JV.js → chunk-VBCE4CLX.js} +6 -4
  49. package/dist/chunk-VJWDBFSL.js +69 -0
  50. package/dist/chunk-VYMZ3QXG.js +8264 -0
  51. package/dist/chunk-WAULJDKO.js +2686 -0
  52. package/dist/chunk-WDFI5YMD.js +204 -0
  53. package/dist/chunk-XEBKF4N5.js +8 -0
  54. package/dist/chunk-Z7IUAJOF.js +13 -0
  55. package/dist/{chunk-KEATAHXH.js → chunk-ZWJRY5UI.js} +358 -581
  56. package/dist/chunk-ZXUAWVWM.js +15 -0
  57. package/dist/citations-UYB2RU5U.js +106 -0
  58. package/dist/{cli-catalog-MO6Z2CIZ.js → cli-catalog-F6FI7NB2.js} +5 -3
  59. package/dist/cli-commands-ZG5ILKDA.js +19 -0
  60. package/dist/cli.js +35 -29
  61. package/dist/competitor-EKP4R7YY.js +561 -0
  62. package/dist/content-DREE6JF3.js +257 -0
  63. package/dist/dashboard-ZALEOLLU.js +71 -0
  64. package/dist/demo-JG4Y22O4.js +75 -0
  65. package/dist/{demo-server-GIWDJGJX.js → demo-server-3A4J2C65.js} +22 -9
  66. package/dist/discover-W6GMD2HS.js +372 -0
  67. package/dist/discover-eval-CKFZHRBW.js +282 -0
  68. package/dist/doctor-TNGBSUMA.js +152 -0
  69. package/dist/evidence-3H2GFQBZ.js +57 -0
  70. package/dist/export-cmd-WUIKU5GK.js +49 -0
  71. package/dist/ga-JI6REFO4.js +911 -0
  72. package/dist/gbp-4ENDM5NS.js +370 -0
  73. package/dist/google-HKQSCLOC.js +946 -0
  74. package/dist/google-marketing-KQR5J2S4.js +403 -0
  75. package/dist/health-cmd-TS7EMMCS.js +64 -0
  76. package/dist/history-MSD5DK6K.js +90 -0
  77. package/dist/index.d.ts +47 -47
  78. package/dist/index.js +29 -6
  79. package/dist/init-L6WAEOWX.js +432 -0
  80. package/dist/insights-RTZ3IZTD.js +63 -0
  81. package/dist/intelligence-service-TH52PCNJ.js +15 -0
  82. package/dist/keys-625DZBRM.js +116 -0
  83. package/dist/keyword-CW46RNRR.js +164 -0
  84. package/dist/logs-V33SHBIW.js +30 -0
  85. package/dist/mcp-DFEDPSEG.js +14 -0
  86. package/dist/mcp.js +14 -5
  87. package/dist/measurement-plan-6W37RUOP.js +42 -0
  88. package/dist/notify-DSUOT7WO.js +125 -0
  89. package/dist/organic-evidence-BMN6L4OB.js +53 -0
  90. package/dist/overview-WRRMBZ6S.js +213 -0
  91. package/dist/project-2GJIU3FE.js +460 -0
  92. package/dist/query-3XPMGJUA.js +211 -0
  93. package/dist/research-V433CKJ4.js +200 -0
  94. package/dist/results-export-RGBU7QQQ.js +27 -0
  95. package/dist/run-NIAC6OJN.js +31 -0
  96. package/dist/schedule-KDWXRIE7.js +177 -0
  97. package/dist/search-626MPUJN.js +42 -0
  98. package/dist/serve-73SMMASI.js +557 -0
  99. package/dist/session-7WWOETZB.js +47 -0
  100. package/dist/settings-VKFQO6F2.js +107 -0
  101. package/dist/skills-5HC5H7TE.js +33 -0
  102. package/dist/snapshot-BSJUHFBC.js +538 -0
  103. package/dist/src-F6HM73TN.js +316 -0
  104. package/dist/status-V4OWP7LZ.js +126 -0
  105. package/dist/support-ARF4HER7.js +24 -0
  106. package/dist/technical-aeo-TG7CGU3F.js +625 -0
  107. package/dist/telemetry-O2IUNUBW.js +118 -0
  108. package/dist/tools-2GJIDKND.js +41 -0
  109. package/dist/traffic-XV4I3UPH.js +1295 -0
  110. package/dist/users-VGBLDL5K.js +170 -0
  111. package/dist/visibility-stats-UKJYJ6PP.js +241 -0
  112. package/dist/wordpress-JZA7CGC6.js +600 -0
  113. package/package.json +1 -1
  114. package/dist/chunk-4QQYYRHV.js +0 -23082
  115. package/dist/cli-commands-FOJR3HHU.js +0 -15
  116. package/dist/intelligence-service-XQCNWAPL.js +0 -9
@@ -0,0 +1,164 @@
1
+ import {
2
+ createApiClient
3
+ } from "./chunk-B5J675KK.js";
4
+ import "./chunk-UQ3MOZGC.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 "./chunk-D6COIM3U.js";
14
+ import "./chunk-MLKGABMK.js";
15
+
16
+ // src/commands/keyword.ts
17
+ import fs from "fs";
18
+ function getClient() {
19
+ return createApiClient();
20
+ }
21
+ async function addKeywords(project, keywords, format) {
22
+ const client = getClient();
23
+ await client.appendKeywords(project, keywords);
24
+ if (isMachineFormat(format)) {
25
+ console.log(JSON.stringify({
26
+ project,
27
+ keywords,
28
+ addedCount: keywords.length
29
+ }, null, 2));
30
+ return;
31
+ }
32
+ console.log(`Added ${keywords.length} key phrase(s) to "${project}".`);
33
+ }
34
+ async function replaceKeywords(project, keywords, format) {
35
+ const client = getClient();
36
+ await client.putKeywords(project, keywords);
37
+ if (isMachineFormat(format)) {
38
+ console.log(JSON.stringify({
39
+ project,
40
+ keywords,
41
+ replacedCount: keywords.length
42
+ }, null, 2));
43
+ return;
44
+ }
45
+ console.log(`Set ${keywords.length} key phrase(s) for "${project}".`);
46
+ }
47
+ async function removeKeywords(project, keywords, format) {
48
+ const client = getClient();
49
+ const existing = await client.listKeywords(project);
50
+ const existingSet = new Set(existing.map((k) => k.keyword));
51
+ const removedKeywords = keywords.filter((k) => existingSet.has(k));
52
+ await client.deleteKeywords(project, keywords);
53
+ if (isMachineFormat(format)) {
54
+ console.log(JSON.stringify({
55
+ project,
56
+ keywords,
57
+ removedKeywords,
58
+ removedCount: removedKeywords.length
59
+ }, null, 2));
60
+ return;
61
+ }
62
+ console.log(`Removed ${removedKeywords.length} key phrase(s) from "${project}".`);
63
+ }
64
+ async function listKeywords(project, format) {
65
+ const client = getClient();
66
+ const kws = await client.listKeywords(project);
67
+ if (format === "json") {
68
+ console.log(JSON.stringify(kws, null, 2));
69
+ return;
70
+ } else if (format === "jsonl") {
71
+ emitJsonl(kws.map((kw) => ({ project, ...kw })));
72
+ return;
73
+ }
74
+ if (kws.length === 0) {
75
+ console.log(`No key phrases found for "${project}".`);
76
+ return;
77
+ }
78
+ console.log(`Key phrases for "${project}" (${kws.length}):
79
+ `);
80
+ for (const kw of kws) {
81
+ console.log(` ${kw.keyword}`);
82
+ }
83
+ }
84
+ async function importKeywords(project, filePath, format) {
85
+ if (!fs.existsSync(filePath)) {
86
+ throw new CliError({
87
+ code: "KEYWORD_IMPORT_FILE_NOT_FOUND",
88
+ message: `File not found: ${filePath}`,
89
+ displayMessage: `Error: file not found: ${filePath}`,
90
+ details: {
91
+ project,
92
+ filePath
93
+ }
94
+ });
95
+ }
96
+ const content = fs.readFileSync(filePath, "utf-8");
97
+ const keywords = content.split("\n").map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
98
+ if (keywords.length === 0) {
99
+ if (isMachineFormat(format)) {
100
+ console.log(JSON.stringify({
101
+ project,
102
+ filePath,
103
+ keywords: [],
104
+ importedCount: 0
105
+ }, null, 2));
106
+ return;
107
+ }
108
+ console.log("No key phrases found in file.");
109
+ return;
110
+ }
111
+ const client = getClient();
112
+ await client.appendKeywords(project, keywords);
113
+ if (isMachineFormat(format)) {
114
+ console.log(JSON.stringify({
115
+ project,
116
+ filePath,
117
+ keywords,
118
+ importedCount: keywords.length
119
+ }, null, 2));
120
+ return;
121
+ }
122
+ console.log(`Imported ${keywords.length} key phrase(s) to "${project}".`);
123
+ }
124
+ async function generateKeywords(project, provider, opts) {
125
+ const client = getClient();
126
+ const result = await client.generateKeywords(project, provider, opts.count);
127
+ const saved = Boolean(opts.save && result.keywords.length > 0);
128
+ if (!isMachineFormat(opts.format)) {
129
+ console.log(`Generated ${result.keywords.length} key phrase(s) using ${result.provider}:
130
+ `);
131
+ for (const kw of result.keywords) {
132
+ console.log(` ${kw}`);
133
+ }
134
+ if (result.keywords.length > 0 && !saved) {
135
+ console.log(`
136
+ To add these, run: canonry keyword add ${project} <phrase>...`);
137
+ }
138
+ }
139
+ if (saved) {
140
+ await client.appendKeywords(project, result.keywords);
141
+ if (!isMachineFormat(opts.format)) {
142
+ console.log(`
143
+ Saved ${result.keywords.length} key phrase(s) to "${project}".`);
144
+ }
145
+ }
146
+ if (isMachineFormat(opts.format)) {
147
+ console.log(JSON.stringify({
148
+ project,
149
+ provider: result.provider,
150
+ keywords: result.keywords,
151
+ generatedCount: result.keywords.length,
152
+ saved,
153
+ savedCount: saved ? result.keywords.length : 0
154
+ }, null, 2));
155
+ }
156
+ }
157
+ export {
158
+ addKeywords,
159
+ generateKeywords,
160
+ importKeywords,
161
+ listKeywords,
162
+ removeKeywords,
163
+ replaceKeywords
164
+ };
@@ -0,0 +1,30 @@
1
+ import {
2
+ createApiClient
3
+ } from "./chunk-B5J675KK.js";
4
+ import "./chunk-UQ3MOZGC.js";
5
+ import "./chunk-AOJU5LKX.js";
6
+ import {
7
+ isMachineFormat,
8
+ usageError
9
+ } from "./chunk-HGMYEDAQ.js";
10
+ import {
11
+ logQuerySchema
12
+ } from "./chunk-D6COIM3U.js";
13
+ import "./chunk-MLKGABMK.js";
14
+
15
+ // src/commands/logs.ts
16
+ async function showOperationalLogs(query, format) {
17
+ const parsed = logQuerySchema.safeParse(query);
18
+ if (!parsed.success) throw usageError("Invalid logs filters", { details: { issues: parsed.error.issues } });
19
+ const result = await createApiClient().listOperationalLogs(parsed.data);
20
+ if (isMachineFormat(format)) {
21
+ console.log(JSON.stringify(result, null, 2));
22
+ return;
23
+ }
24
+ console.log(`Runtime logs (${result.retention}; ${result.entries.length} entries; ${result.dropped} evicted; ${result.captureErrors ?? 0} capture errors). Separate from audit history.`);
25
+ for (const entry of result.entries) console.log(`${entry.ts} ${entry.level} [${entry.module}] ${entry.action}${entry.message ? ` ${entry.message}` : ""} ${JSON.stringify(entry.context)}`);
26
+ if (result.nextCursor) console.log(`Next cursor: ${result.nextCursor}`);
27
+ }
28
+ export {
29
+ showOperationalLogs
30
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ installMcp,
3
+ printMcpConfig,
4
+ renderClientSnippet
5
+ } from "./chunk-WDFI5YMD.js";
6
+ import "./chunk-VJWDBFSL.js";
7
+ import "./chunk-HGMYEDAQ.js";
8
+ import "./chunk-D6COIM3U.js";
9
+ import "./chunk-MLKGABMK.js";
10
+ export {
11
+ installMcp,
12
+ printMcpConfig,
13
+ renderClientSnippet
14
+ };
package/dist/mcp.js CHANGED
@@ -1,16 +1,25 @@
1
1
  import {
2
2
  autoSyncSkills
3
- } from "./chunk-HLVEB5TB.js";
3
+ } from "./chunk-TUTKNUMV.js";
4
4
  import {
5
- createApiClient,
6
5
  createCanonryMcpServer
7
- } from "./chunk-HAHXPJQ5.js";
8
- import "./chunk-KEATAHXH.js";
6
+ } from "./chunk-PCXRFT3N.js";
7
+ import "./chunk-4MJYGB56.js";
8
+ import {
9
+ createApiClient
10
+ } from "./chunk-B5J675KK.js";
11
+ import "./chunk-UQ3MOZGC.js";
12
+ import "./chunk-B2FR2ZQ4.js";
13
+ import "./chunk-ZWJRY5UI.js";
14
+ import "./chunk-HM4NNKLG.js";
15
+ import "./chunk-HACZUMGM.js";
16
+ import "./chunk-AOJU5LKX.js";
9
17
  import "./chunk-HGMYEDAQ.js";
10
18
  import {
11
19
  isReadOnlyKey,
12
20
  updateCheckEnvOptOut
13
- } from "./chunk-SFMWHPMX.js";
21
+ } from "./chunk-D6COIM3U.js";
22
+ import "./chunk-MLKGABMK.js";
14
23
 
15
24
  // src/mcp/cli.ts
16
25
  import { randomUUID } from "crypto";
@@ -0,0 +1,42 @@
1
+ import {
2
+ ADVANCED_MEASUREMENT_OPERATIONS,
3
+ applyMeasurementPlanAssignments,
4
+ applyMeasurementPlanGroups,
5
+ discoverMeasurementTargets,
6
+ listMeasurementPlanVersions,
7
+ previewMeasurementPlanAssignments,
8
+ previewMeasurementPlanGroups,
9
+ publishMeasurementPlan,
10
+ replaceMeasurementPlanAssignments,
11
+ retireMeasurementPlanSegment,
12
+ runAdvancedMeasurementOperation,
13
+ showMeasurementPlan,
14
+ showMeasurementProperty,
15
+ showMeasurementPropertyEvidence,
16
+ showMeasurementReport
17
+ } from "./chunk-2G6IP3MO.js";
18
+ import "./chunk-B5J675KK.js";
19
+ import "./chunk-UQ3MOZGC.js";
20
+ import "./chunk-Z7IUAJOF.js";
21
+ import "./chunk-HACZUMGM.js";
22
+ import "./chunk-AOJU5LKX.js";
23
+ import "./chunk-HGMYEDAQ.js";
24
+ import "./chunk-D6COIM3U.js";
25
+ import "./chunk-MLKGABMK.js";
26
+ export {
27
+ ADVANCED_MEASUREMENT_OPERATIONS,
28
+ applyMeasurementPlanAssignments,
29
+ applyMeasurementPlanGroups,
30
+ discoverMeasurementTargets,
31
+ listMeasurementPlanVersions,
32
+ previewMeasurementPlanAssignments,
33
+ previewMeasurementPlanGroups,
34
+ publishMeasurementPlan,
35
+ replaceMeasurementPlanAssignments,
36
+ retireMeasurementPlanSegment,
37
+ runAdvancedMeasurementOperation,
38
+ showMeasurementPlan,
39
+ showMeasurementProperty,
40
+ showMeasurementPropertyEvidence,
41
+ showMeasurementReport
42
+ };
@@ -0,0 +1,125 @@
1
+ import {
2
+ createApiClient
3
+ } from "./chunk-B5J675KK.js";
4
+ import "./chunk-UQ3MOZGC.js";
5
+ import {
6
+ emitJsonl
7
+ } from "./chunk-Z7IUAJOF.js";
8
+ import "./chunk-AOJU5LKX.js";
9
+ import {
10
+ isMachineFormat,
11
+ usageError
12
+ } from "./chunk-HGMYEDAQ.js";
13
+ import {
14
+ notificationEventSchema
15
+ } from "./chunk-D6COIM3U.js";
16
+ import "./chunk-MLKGABMK.js";
17
+
18
+ // src/commands/notify.ts
19
+ function getClient() {
20
+ return createApiClient();
21
+ }
22
+ async function addNotification(project, opts) {
23
+ const client = getClient();
24
+ const result = await client.createNotification(project, {
25
+ channel: "webhook",
26
+ url: opts.webhook,
27
+ events: opts.events
28
+ });
29
+ if (isMachineFormat(opts.format)) {
30
+ console.log(JSON.stringify(result, null, 2));
31
+ return;
32
+ }
33
+ console.log(`Notification created for "${project}":`);
34
+ printNotification(result);
35
+ }
36
+ async function listNotifications(project, format) {
37
+ const client = getClient();
38
+ const results = await client.listNotifications(project);
39
+ if (format === "json") {
40
+ console.log(JSON.stringify(results, null, 2));
41
+ return;
42
+ } else if (format === "jsonl") {
43
+ emitJsonl(results);
44
+ return;
45
+ }
46
+ if (results.length === 0) {
47
+ console.log(`No notifications configured for "${project}"`);
48
+ return;
49
+ }
50
+ console.log(`Notifications for "${project}":
51
+ `);
52
+ for (const n of results) {
53
+ printNotification(n);
54
+ console.log();
55
+ }
56
+ }
57
+ async function removeNotification(project, id, format) {
58
+ const client = getClient();
59
+ await client.deleteNotification(project, id);
60
+ if (isMachineFormat(format)) {
61
+ console.log(JSON.stringify({ project, id, removed: true }, null, 2));
62
+ return;
63
+ }
64
+ console.log(`Notification ${id} removed from "${project}"`);
65
+ }
66
+ async function testNotification(project, id, format) {
67
+ const client = getClient();
68
+ const result = await client.testNotification(project, id);
69
+ if (isMachineFormat(format)) {
70
+ console.log(JSON.stringify({ project, id, ...result }, null, 2));
71
+ return;
72
+ }
73
+ if (result.ok) {
74
+ console.log(`Test webhook delivered successfully (HTTP ${result.status})`);
75
+ } else {
76
+ console.error(`Test webhook failed: HTTP ${result.status}`);
77
+ }
78
+ }
79
+ var EVENT_DESCRIPTIONS = {
80
+ "citation.lost": "A query lost its citation status",
81
+ "citation.gained": "A query gained citation status",
82
+ "run.completed": "An AEO sweep completed successfully",
83
+ "run.failed": "An AEO sweep failed",
84
+ "insight.critical": "A critical-severity insight was generated",
85
+ "insight.high": "A high-severity insight was generated",
86
+ "health.degraded": "A scheduled health check found the measurement degraded, daily data stopped arriving, or the website stopped answering (sent when a check starts failing or gets worse, not every pass)",
87
+ "health.recovered": "A degraded health check is passing again, or a website that was paged as down answers again",
88
+ "health.urgent": "An urgent problem started: the website is down, GA4 or Search Console data is stale, or a sync keeps failing. A webhook that lists this receives only the health events it lists, so it is not sent routine warnings",
89
+ "health.urgent-resolved": "The urgent problems that were reported have cleared (the website check and the scheduled health pass each send their own)",
90
+ "review.negative": "A new or edited Google review at or below the project's negative-review threshold, 3 stars by default (Business Profile reviews, or the public listing when Google has not enabled review access)",
91
+ "review.rating-dropped": "A location's public Google rating fell (sent for locations without Business Profile review access)"
92
+ };
93
+ function listEvents(format, target = "local") {
94
+ if (target === "server") return getClient().listNotificationEvents().then((events) => printEvents(events, format));
95
+ if (target !== "local") throw usageError("--target must be local or server");
96
+ printEvents(notificationEventSchema.options, format);
97
+ }
98
+ function printEvents(events, format) {
99
+ const catalog = events.map((e) => ({ event: e, description: EVENT_DESCRIPTIONS[e] ?? "" }));
100
+ if (format === "json") {
101
+ console.log(JSON.stringify(catalog, null, 2));
102
+ return;
103
+ } else if (format === "jsonl") {
104
+ emitJsonl(catalog);
105
+ return;
106
+ }
107
+ console.log("Available notification events:\n");
108
+ for (const event of events) {
109
+ console.log(` ${event.padEnd(20)} ${EVENT_DESCRIPTIONS[event] ?? ""}`);
110
+ }
111
+ }
112
+ function printNotification(n) {
113
+ console.log(` ID: ${n.id}`);
114
+ console.log(` Channel: ${n.channel}`);
115
+ console.log(` URL: ${n.urlDisplay ?? n.url}`);
116
+ console.log(` Events: ${n.events.join(", ")}`);
117
+ console.log(` Enabled: ${n.enabled ? "yes" : "no"}`);
118
+ }
119
+ export {
120
+ addNotification,
121
+ listEvents,
122
+ listNotifications,
123
+ removeNotification,
124
+ testNotification
125
+ };
@@ -0,0 +1,53 @@
1
+ import {
2
+ createApiClient
3
+ } from "./chunk-B5J675KK.js";
4
+ import "./chunk-UQ3MOZGC.js";
5
+ import "./chunk-AOJU5LKX.js";
6
+ import {
7
+ isMachineFormat
8
+ } from "./chunk-HGMYEDAQ.js";
9
+ import "./chunk-D6COIM3U.js";
10
+ import "./chunk-MLKGABMK.js";
11
+
12
+ // src/commands/organic-evidence.ts
13
+ async function showOrganicEvidence(project, opts) {
14
+ const data = await createApiClient().getOrganicEvidence(project, opts.period);
15
+ if (isMachineFormat(opts.format)) {
16
+ console.log(JSON.stringify(data, null, 2));
17
+ return;
18
+ }
19
+ printOrganicEvidence(project, data);
20
+ }
21
+ function formatCounts(clicks, impressions) {
22
+ return `${clicks} clicks / ${impressions} impressions`;
23
+ }
24
+ function printOrganicEvidence(project, data) {
25
+ const asOf = data.asOfDate ? ` through ${data.asOfDate}` : "";
26
+ console.log(`Organic evidence: ${project} (${data.periodDays} days${asOf})`);
27
+ console.log(`Coverage: GSC ${data.coverage.gsc ? "yes" : "no"} \xB7 GA4 ${data.coverage.ga4 ? "yes" : "no"} \xB7 server ${data.coverage.server ? "yes" : "no"} \xB7 AI visibility ${data.coverage.visibility ? "yes" : "no"}`);
28
+ if (data.gsc) {
29
+ console.log(`Google Search: ${formatCounts(data.gsc.propertyTotals.clicks, data.gsc.propertyTotals.impressions)} (named non-brand: ${formatCounts(data.gsc.namedNonBrand.clicks, data.gsc.namedNonBrand.impressions)})`);
30
+ }
31
+ if (data.ga4) console.log(`GA4 organic: ${data.ga4.organicSessions} sessions`);
32
+ if (data.gaAiReferrals) console.log(`GA4 AI referrals: ${data.gaAiReferrals.organicSessions} organic, ${data.gaAiReferrals.paidSessions} paid sessions`);
33
+ if (data.server) {
34
+ const s = data.server;
35
+ const fetchTotal = s.userFetchHits.verified + s.userFetchHits.claimedUnverified + s.userFetchHits.unknownAiLike;
36
+ console.log(`Server AI: ${s.crawlerHits.verified} verified + ${s.crawlerHits.claimedUnverified} claimed + ${s.crawlerHits.unknownAiLike} heuristic crawls; ${fetchTotal} user-agent fetches (${s.userFetchHits.verified} verified, ${s.userFetchHits.claimedUnverified} claimed, ${s.userFetchHits.unknownAiLike} heuristic); ${s.referralSessions.organic} organic referrals, ${s.referralSessions.paid} paid, ${s.referralSessions.unknown} unclassified`);
37
+ }
38
+ if (data.visibility) {
39
+ const v = data.visibility;
40
+ console.log(`Latest AI visibility: ${v.mentionedPairs}/${v.answerPairs} mentioned, ${v.citedPairs}/${v.answerPairs} cited (${Math.floor(v.ageDays)}d old)`);
41
+ }
42
+ if (data.findings.length > 0) {
43
+ console.log("\nFindings:");
44
+ for (const finding of data.findings) console.log(`- ${finding.title}: ${finding.detail}`);
45
+ }
46
+ if (data.limitations.length > 0) {
47
+ console.log("\nLimitations:");
48
+ for (const limitation of data.limitations) console.log(`- ${limitation.detail}`);
49
+ }
50
+ }
51
+ export {
52
+ showOrganicEvidence
53
+ };
@@ -0,0 +1,213 @@
1
+ import {
2
+ runAdmissionLines
3
+ } from "./chunk-KFT5LOP2.js";
4
+ import {
5
+ createApiClient
6
+ } from "./chunk-B5J675KK.js";
7
+ import "./chunk-UQ3MOZGC.js";
8
+ import "./chunk-Z7IUAJOF.js";
9
+ import "./chunk-AOJU5LKX.js";
10
+ import {
11
+ isMachineFormat
12
+ } from "./chunk-HGMYEDAQ.js";
13
+ import {
14
+ formatPercent
15
+ } from "./chunk-D6COIM3U.js";
16
+ import "./chunk-MLKGABMK.js";
17
+
18
+ // src/commands/overview.ts
19
+ async function showOverview(project, opts) {
20
+ const client = createApiClient();
21
+ const overview = await client.getProjectOverview(project, {
22
+ location: opts.location,
23
+ since: opts.since
24
+ });
25
+ if (isMachineFormat(opts.format)) {
26
+ console.log(JSON.stringify(overview, null, 2));
27
+ return;
28
+ }
29
+ renderHuman(overview);
30
+ }
31
+ async function showAllOverviews(opts) {
32
+ const client = createApiClient();
33
+ const projects = await client.listProjects();
34
+ if (projects.length === 0) {
35
+ if (isMachineFormat(opts.format)) {
36
+ console.log("[]");
37
+ return;
38
+ }
39
+ console.log("No projects configured. Add one with `canonry project create`.");
40
+ return;
41
+ }
42
+ const overviews = await Promise.all(
43
+ projects.map(
44
+ (p) => client.getProjectOverview(p.name, { location: opts.location, since: opts.since })
45
+ )
46
+ );
47
+ if (isMachineFormat(opts.format)) {
48
+ console.log(JSON.stringify(overviews, null, 2));
49
+ return;
50
+ }
51
+ console.log(`
52
+ Overviews (${overviews.length} project${overviews.length === 1 ? "" : "s"}):
53
+ `);
54
+ const cols = { project: 20, mention: 10, cited: 10, share: 42, queries: 10 };
55
+ console.log(` ${cell("Project", cols.project)}${cell("Mention", cols.mention)}${cell("Cited", cols.cited)}${cell("Mention share \xB7 scope", cols.share)}${cell("Queries", cols.queries)}Latest run`);
56
+ for (const ov of overviews) {
57
+ const project = ov.project.displayName || ov.project.name;
58
+ const queries = `${ov.queryCounts.citedQueries}/${ov.queryCounts.totalQueries}`;
59
+ const latest = ov.latestRun.run?.finishedAt ?? ov.latestRun.run?.createdAt ?? "\u2014";
60
+ console.log(
61
+ ` ${cell(project, cols.project)}${cell(ov.scores.mention.value, cols.mention)}${cell(ov.scores.visibility.value, cols.cited)}${cell(`${ov.scores.mentionShare.value} \xB7 ${ov.scores.mentionShare.scope} queries`, cols.share)}${cell(queries, cols.queries)}${latest}`
62
+ );
63
+ }
64
+ console.log();
65
+ }
66
+ function cell(value, width) {
67
+ if (value.length >= width) return `${value.slice(0, width - 1)} `;
68
+ return value.padEnd(width);
69
+ }
70
+ function renderHuman(overview) {
71
+ const {
72
+ project: meta,
73
+ latestRun,
74
+ health,
75
+ topInsights,
76
+ queryCounts,
77
+ providers,
78
+ transitions,
79
+ scores,
80
+ citationMovement,
81
+ mentionMovement,
82
+ movementComparison,
83
+ competitors,
84
+ providerScores,
85
+ attentionItems,
86
+ runHistory,
87
+ suggestedQueries,
88
+ dateRangeLabel,
89
+ contextLabel
90
+ } = overview;
91
+ console.log(`Overview: ${meta.displayName ?? meta.name} (${meta.name})`);
92
+ console.log(` Domain: ${meta.canonicalDomain}`);
93
+ console.log(` Context: ${contextLabel} \xB7 ${dateRangeLabel}`);
94
+ if (latestRun.run) {
95
+ const finished = latestRun.run.finishedAt ?? "\u2014";
96
+ console.log(`
97
+ Latest run: ${latestRun.run.id} (${latestRun.run.status}, ${finished})`);
98
+ console.log(` Total runs: ${latestRun.totalRuns}`);
99
+ } else {
100
+ console.log("\n No runs yet.");
101
+ }
102
+ const admission = runAdmissionLines(meta.name, latestRun.admission, latestRun.manualAdmission);
103
+ if (admission.length > 0) console.log(`
104
+ ${admission.map((line) => ` ${line}`).join("\n")}`);
105
+ console.log("\nScores:");
106
+ printScore("Mention ", scores.mention);
107
+ printScore("Visibility ", scores.visibility);
108
+ printScore("Mention share ", scores.mentionShare);
109
+ printMentionShareBreakdown(scores.mentionShare);
110
+ printScore("Mention gaps ", scores.mentionGaps);
111
+ printScore("Gap queries ", scores.gapQueries);
112
+ printScore("Index coverage ", scores.indexCoverage);
113
+ printScore("Competitor press.", scores.competitorPressure);
114
+ printScore("Run status ", scores.runStatus);
115
+ const brandedSentiment = overview.sentiment?.branded;
116
+ if (overview.sentiment?.configured && brandedSentiment && brandedSentiment.coverage.judged > 0 && brandedSentiment.score.favorableRate !== null) {
117
+ console.log(`
118
+ Sentiment: ${brandedSentiment.score.favorableDisplay} favorable \xB7 branded queries`);
119
+ console.log(` ${brandedSentiment.coverage.counts.favorable} favorable / ${brandedSentiment.coverage.judged} judged${brandedSentiment.provisional ? " \xB7 provisional" : ""}`);
120
+ }
121
+ console.log(`
122
+ Queries cited: ${queryCounts.citedQueries}/${queryCounts.totalQueries} (${formatPercent(queryCounts.citedRate)})`);
123
+ console.log(` Queries mentioned: ${queryCounts.mentionedQueries}/${queryCounts.totalQueries} (${formatPercent(queryCounts.mentionRate)})`);
124
+ if (movementComparison.hasPreviousRun) {
125
+ const comparisonLabel = movementComparison.querySetChanged ? `changed (+${movementComparison.addedQueryCount} added, -${movementComparison.removedQueryCount} removed); movement compares ${movementComparison.comparableQueryCount} shared` : `unchanged; ${movementComparison.comparableQueryCount} comparable`;
126
+ console.log(` Query basket: ${comparisonLabel}`);
127
+ console.log(` Citation movement: +${citationMovement.gained} gained, -${citationMovement.lost} lost (${citationMovement.tone})`);
128
+ console.log(` Mention movement: +${mentionMovement.gained} gained, -${mentionMovement.lost} lost (${mentionMovement.tone})`);
129
+ } else {
130
+ console.log(" Movement: first sweep; no comparison yet");
131
+ }
132
+ if (providers.length > 0) {
133
+ console.log("\n Providers:");
134
+ for (const p of providers) {
135
+ console.log(` ${p.provider.padEnd(12)} ${p.cited}/${p.total} (${formatPercent(p.citedRate)})`);
136
+ }
137
+ }
138
+ if (providerScores.length > 0) {
139
+ console.log("\n Models:");
140
+ for (const m of providerScores) {
141
+ const label = `${m.provider}/${m.model ?? "unknown"}`.padEnd(28);
142
+ console.log(` ${label} ${m.cited}/${m.total} (${formatPercent(m.score, "percent")})`);
143
+ }
144
+ }
145
+ if (transitions.since) {
146
+ console.log(`
147
+ Transitions since ${transitions.since}: +${transitions.gained} gained, -${transitions.lost} lost, ${transitions.emerging} emerging`);
148
+ }
149
+ if (competitors.length > 0) {
150
+ console.log("\n Competitors:");
151
+ for (const c of competitors) {
152
+ console.log(` ${c.domain.padEnd(28)} ${c.citationCount}/${c.totalQueries} ${c.pressureLabel}`);
153
+ }
154
+ }
155
+ if (attentionItems.length > 0) {
156
+ console.log("\n Attention:");
157
+ for (const item of attentionItems) {
158
+ console.log(` [${item.actionLabel}] ${item.title}`);
159
+ if (item.detail) console.log(` ${item.detail}`);
160
+ }
161
+ }
162
+ if (health) {
163
+ console.log(`
164
+ Health: ${formatPercent(health.overallCitedRate)} cited (${health.citedPairs}/${health.totalPairs} pairs)`);
165
+ }
166
+ if (topInsights.length > 0) {
167
+ console.log("\n Top insights:");
168
+ for (const insight of topInsights) {
169
+ console.log(` [${insight.severity.toUpperCase()}] ${insight.type} \u2014 ${insight.title}`);
170
+ }
171
+ }
172
+ if (runHistory.length > 0) {
173
+ console.log(`
174
+ Run history (last ${runHistory.length}):`);
175
+ for (const point of runHistory) {
176
+ const bar = "\u2588".repeat(Math.round(point.citationRate / 10));
177
+ console.log(` ${point.createdAt.slice(0, 10)} ${formatPercent(point.citationRate, "percent").padStart(6)} ${bar}`);
178
+ }
179
+ }
180
+ if (suggestedQueries.rows.length > 0) {
181
+ const moreLabel = suggestedQueries.totalCandidates > suggestedQueries.rows.length ? ` (showing ${suggestedQueries.rows.length} of ${suggestedQueries.totalCandidates})` : "";
182
+ console.log(`
183
+ Suggested queries to track${moreLabel}:`);
184
+ for (const s of suggestedQueries.rows) {
185
+ console.log(` + ${s.query}`);
186
+ console.log(` ${s.reason}`);
187
+ }
188
+ console.log(` (add via: canonry query add ${meta.name} "<query>")`);
189
+ }
190
+ }
191
+ function printScore(prefix, score) {
192
+ const tone = `[${score.tone}]`.padEnd(11);
193
+ const value = score.value.padEnd(8);
194
+ console.log(` ${prefix} ${tone} ${value} ${score.delta}`);
195
+ }
196
+ function printMentionShareBreakdown(mentionShare) {
197
+ const legacyCompatible = mentionShare.breakdown;
198
+ const ranking = legacyCompatible.ranking ?? [];
199
+ const project = ranking.find((row) => row.kind === "project");
200
+ if (!project) return;
201
+ const competitors = ranking.filter((row) => row.kind === "competitor");
202
+ console.log(` you${" ".repeat(28)} ${project.mentionSnapshots} mentions (${formatPercent(project.share)} of combined)`);
203
+ for (const row of competitors.slice(0, 3)) {
204
+ console.log(` ${(row.domain ?? "").padEnd(30)} ${row.mentionSnapshots} mentions (${formatPercent(row.share)} of combined)`);
205
+ }
206
+ if (competitors.length > 3) {
207
+ console.log(` + ${competitors.length - 3} more competitor${competitors.length - 3 === 1 ? "" : "s"} (--format json for full breakdown)`);
208
+ }
209
+ }
210
+ export {
211
+ showAllOverviews,
212
+ showOverview
213
+ };