@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.
Files changed (141) hide show
  1. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +8 -0
  2. package/assets/assets/{AccessControls-B5TqDgeq.js → AccessControls-CteIuEGI.js} +1 -1
  3. package/assets/assets/{AuditHistoryPanel-DgxiizOW.js → AuditHistoryPanel-DqJGiLsf.js} +1 -1
  4. package/assets/assets/{BacklinksPage-Ay6pdphx.js → BacklinksPage-DotWEPQt.js} +1 -1
  5. package/assets/assets/{HistoryPage-B11eFH21.js → HistoryPage-aOd198dT.js} +1 -1
  6. package/assets/assets/MeasurementPropertyPage-CuaKVK8x.js +4 -0
  7. package/assets/assets/{ProjectPage-DoY0hftd.js → ProjectPage-O9oufMgi.js} +4 -4
  8. package/assets/assets/{RunsPage-BPBmuQAS.js → RunsPage-DIXMrc-N.js} +1 -1
  9. package/assets/assets/{SettingsPage-ClKnP8xy.js → SettingsPage-BuGb6AGa.js} +1 -1
  10. package/assets/assets/SiteHealthSection-CweaKjCo.js +2 -0
  11. package/assets/assets/TrafficPage-B7MaQalp.js +40 -0
  12. package/assets/assets/{TrafficSourceDetailPage-DQu0YNt2.js → TrafficSourceDetailPage-BPtjnF9s.js} +1 -1
  13. package/assets/assets/{card-DYMyvhB9.js → card-DoV-8Txo.js} +1 -1
  14. package/assets/assets/{extract-error-message-BRM1I_3L.js → extract-error-message-DKQJJlZ-.js} +1 -1
  15. package/assets/assets/{format-helpers-DrkFERj3.js → format-helpers-BWnMmkiO.js} +1 -1
  16. package/assets/assets/index-Z63c4PeO.js +39 -0
  17. package/assets/assets/{query-client-gRFnU4VF.js → query-client-vB35tVTz.js} +1 -1
  18. package/assets/assets/{react-query-lH82FULK.js → react-query-BI0567qs.js} +1 -1
  19. package/assets/assets/{react-sigma_core.esm.min-D09H4byP.js → react-sigma_core.esm.min-hGyOC4V_.js} +1 -1
  20. package/assets/assets/{service-Cx0HSnE9.js → service-c4YvpVKX.js} +1 -1
  21. package/assets/index.html +6 -6
  22. package/dist/ads-MREK2AGL.js +544 -0
  23. package/dist/agent-4RUZ3MC4.js +70 -0
  24. package/dist/agent-ask-YLTYBEYH.js +139 -0
  25. package/dist/agent-conversations-QA6IKDGR.js +52 -0
  26. package/dist/agent-memory-MEQAJOB3.js +92 -0
  27. package/dist/agent-providers-AXYPDJHL.js +55 -0
  28. package/dist/agent-transcript-SMNQNYCD.js +77 -0
  29. package/dist/analytics-4OR64IGV.js +240 -0
  30. package/dist/apply-CQXCFXAH.js +175 -0
  31. package/dist/backfill-TMXCNVOB.js +41 -0
  32. package/dist/backlinks-6KFAQGYV.js +303 -0
  33. package/dist/bing-HFCACTAC.js +418 -0
  34. package/dist/bootstrap-SQVQXOJC.js +326 -0
  35. package/dist/cdp-IACL7EXU.js +162 -0
  36. package/dist/chunk-4MJYGB56.js +124 -0
  37. package/dist/chunk-5N6245R7.js +1160 -0
  38. package/dist/chunk-6BPZHNDC.js +617 -0
  39. package/dist/chunk-6GO5VVAC.js +15 -0
  40. package/dist/chunk-7244X3K6.js +609 -0
  41. package/dist/chunk-7XE2IRBG.js +204 -0
  42. package/dist/chunk-AOJU5LKX.js +8 -0
  43. package/dist/chunk-AWCWIQAU.js +2686 -0
  44. package/dist/{chunk-JBZZEIM2.js → chunk-BBOHY2DQ.js} +2 -13
  45. package/dist/{chunk-AZFPA7JV.js → chunk-BU3VAG5J.js} +6 -4
  46. package/dist/{chunk-4YCGZGA3.js → chunk-BYOK6Z4F.js} +2 -2
  47. package/dist/chunk-DSNSD5J3.js +971 -0
  48. package/dist/chunk-EGIZNSDA.js +94 -0
  49. package/dist/chunk-ELCLGWUT.js +83 -0
  50. package/dist/chunk-FC4XND45.js +38 -0
  51. package/dist/chunk-GNKOBKPW.js +58 -0
  52. package/dist/chunk-HEGXGCGL.js +524 -0
  53. package/dist/chunk-I6KNMZ77.js +232 -0
  54. package/dist/{chunk-HLVEB5TB.js → chunk-IIOEAJTV.js} +7 -5
  55. package/dist/chunk-ILDT4LPB.js +1273 -0
  56. package/dist/chunk-JY3RLZGB.js +30 -0
  57. package/dist/{chunk-PLYJX67A.js → chunk-K5I45PZI.js} +8084 -13939
  58. package/dist/chunk-KXAOMTXN.js +1034 -0
  59. package/dist/chunk-LK2BG6EX.js +145 -0
  60. package/dist/chunk-MJNUSPO4.js +15 -0
  61. package/dist/chunk-MKAC7HKH.js +9178 -0
  62. package/dist/chunk-MLKGABMK.js +9 -0
  63. package/dist/{chunk-SFMWHPMX.js → chunk-O4RMPA6H.js} +13765 -13737
  64. package/dist/chunk-O77IBNVO.js +8264 -0
  65. package/dist/chunk-OFL4PTYU.js +644 -0
  66. package/dist/chunk-QLPLENDT.js +133 -0
  67. package/dist/chunk-R2J4SNKF.js +78 -0
  68. package/dist/{chunk-KEATAHXH.js → chunk-RVUCY4ZV.js} +358 -581
  69. package/dist/chunk-SNFBJKAW.js +530 -0
  70. package/dist/chunk-TALC5DX5.js +420 -0
  71. package/dist/chunk-TSENU4GG.js +18 -0
  72. package/dist/{chunk-HAHXPJQ5.js → chunk-V5D4XNWV.js} +16 -1684
  73. package/dist/chunk-VJWDBFSL.js +69 -0
  74. package/dist/chunk-XEBKF4N5.js +8 -0
  75. package/dist/chunk-Y4GK7GCV.js +15376 -0
  76. package/dist/{chunk-A3WSAAQS.js → chunk-YSEC6TIB.js} +7917 -33199
  77. package/dist/chunk-Z7IUAJOF.js +13 -0
  78. package/dist/citations-NSBBWRZ4.js +106 -0
  79. package/dist/{cli-catalog-MO6Z2CIZ.js → cli-catalog-OFWJMNMD.js} +5 -3
  80. package/dist/cli-commands-WVBL337U.js +19 -0
  81. package/dist/cli.js +35 -29
  82. package/dist/competitor-V4OHORBC.js +561 -0
  83. package/dist/content-RUXRI5IC.js +257 -0
  84. package/dist/dashboard-JXB2YAQJ.js +71 -0
  85. package/dist/demo-55ZNUOXU.js +75 -0
  86. package/dist/{demo-server-GIWDJGJX.js → demo-server-XO7PHM4I.js} +22 -9
  87. package/dist/discover-JJQ564HS.js +372 -0
  88. package/dist/discover-eval-KLEKZ6U4.js +282 -0
  89. package/dist/doctor-JAMQZCMZ.js +152 -0
  90. package/dist/evidence-YRSB7GFE.js +57 -0
  91. package/dist/export-cmd-MHML4OYU.js +49 -0
  92. package/dist/ga-LSXPE2MN.js +911 -0
  93. package/dist/gbp-RMKMLOC7.js +370 -0
  94. package/dist/google-JQ4T6JTQ.js +946 -0
  95. package/dist/google-marketing-J6SEODYC.js +403 -0
  96. package/dist/health-cmd-MV2JM2C3.js +64 -0
  97. package/dist/history-SRRH7A2E.js +90 -0
  98. package/dist/index.d.ts +43 -4
  99. package/dist/index.js +29 -6
  100. package/dist/init-ZJZFUERV.js +432 -0
  101. package/dist/insights-PMMGNWZH.js +63 -0
  102. package/dist/intelligence-service-KCSU6ZUJ.js +15 -0
  103. package/dist/keys-TS7NZANS.js +116 -0
  104. package/dist/keyword-VNCKDUGC.js +164 -0
  105. package/dist/logs-VH3WOTZJ.js +30 -0
  106. package/dist/mcp-DG2RROB3.js +14 -0
  107. package/dist/mcp.js +14 -5
  108. package/dist/measurement-plan-4T35TUGG.js +42 -0
  109. package/dist/notify-BWHUSKL7.js +125 -0
  110. package/dist/organic-evidence-QX4SXXJP.js +53 -0
  111. package/dist/overview-7IHUTKUV.js +213 -0
  112. package/dist/project-JXLSWDE2.js +460 -0
  113. package/dist/query-S75EL25H.js +211 -0
  114. package/dist/research-KFTV3IP4.js +200 -0
  115. package/dist/results-export-GTKVBU34.js +27 -0
  116. package/dist/run-26HDIRHF.js +31 -0
  117. package/dist/schedule-N6G4SVHQ.js +177 -0
  118. package/dist/search-MI32EPYM.js +42 -0
  119. package/dist/serve-XLGE42AG.js +598 -0
  120. package/dist/session-W5DXWIYM.js +47 -0
  121. package/dist/settings-T7WI2UVE.js +107 -0
  122. package/dist/skills-F3WPKPTK.js +33 -0
  123. package/dist/snapshot-PD3EAVEX.js +538 -0
  124. package/dist/src-XDUXMJC3.js +316 -0
  125. package/dist/status-PUH7JFZ4.js +126 -0
  126. package/dist/support-ARF4HER7.js +24 -0
  127. package/dist/technical-aeo-AUFWWJIP.js +625 -0
  128. package/dist/telemetry-XBYT7G2K.js +118 -0
  129. package/dist/tools-GVHIRWSN.js +41 -0
  130. package/dist/traffic-B3HW2ZWG.js +1295 -0
  131. package/dist/users-M5HNQZYI.js +170 -0
  132. package/dist/visibility-stats-Y7GJKMHN.js +241 -0
  133. package/dist/wordpress-GCIURYPN.js +600 -0
  134. package/package.json +1 -1
  135. package/assets/assets/MeasurementPropertyPage-1UYI7mzP.js +0 -4
  136. package/assets/assets/SiteHealthSection-PWjKMmEn.js +0 -2
  137. package/assets/assets/TrafficPage-DkfGiJXR.js +0 -40
  138. package/assets/assets/index-CG1Jox52.js +0 -39
  139. package/dist/chunk-4QQYYRHV.js +0 -23082
  140. package/dist/cli-commands-FOJR3HHU.js +0 -15
  141. package/dist/intelligence-service-XQCNWAPL.js +0 -9
@@ -0,0 +1,625 @@
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
+ RatioUnits,
14
+ SiteAuditIssueRecommendationScopes,
15
+ formatPercent
16
+ } from "./chunk-O4RMPA6H.js";
17
+ import "./chunk-MLKGABMK.js";
18
+
19
+ // src/commands/technical-aeo.ts
20
+ function getClient() {
21
+ return createApiClient();
22
+ }
23
+ async function technicalAeoIssues(project, opts) {
24
+ const res = await getClient().getSiteAuditIssues(project, opts);
25
+ if (opts.format === "jsonl") {
26
+ const { issues, ...context } = res;
27
+ emitJsonl([{ kind: "site-health-issues-header", ...context }]);
28
+ emitJsonl(issues.map((issue) => ({ kind: "site-health-issue", ...context, ...issue })));
29
+ return;
30
+ }
31
+ if (isMachineFormat(opts.format)) {
32
+ console.log(JSON.stringify(res, null, 2));
33
+ return;
34
+ }
35
+ const lines = [`Stored audit issues for "${project}":`, ...issueEvidenceProvenance(res)];
36
+ if (res.issues.length === 0) lines.push("No issue groups returned; use the evidence coverage above when interpreting this result.");
37
+ for (const issue of res.issues) {
38
+ const severity = issue.severity === null ? "" : ` \xB7 ${issue.severity}`;
39
+ lines.push("", `[${issue.disposition}${severity}] ${issue.code} \xB7 ${issue.affectedPages} page(s)`, issue.message);
40
+ lines.push(`Issue: ${issue.id}${issue.stableIdentity ? "" : " (identity is specific to this scan)"}`);
41
+ for (const example of issue.examples) lines.push(` ${example.url}`);
42
+ if (issue.examplesTruncated) lines.push("More affected pages are available with site-health issue-pages.");
43
+ if (issue.messageTruncated) lines.push("The saved message is shortened; inspect the affected pages for context.");
44
+ }
45
+ if (res.nextCursor) lines.push("", `Next cursor: ${res.nextCursor}`);
46
+ console.log(lines.join("\n"));
47
+ }
48
+ async function technicalAeoIssuePages(project, opts) {
49
+ const res = await getClient().getSiteAuditIssuePages(project, opts.issueId, opts);
50
+ if (opts.format === "jsonl") {
51
+ const { pages, ...context } = res;
52
+ emitJsonl([{ kind: "site-health-issue-pages-header", ...context }]);
53
+ emitJsonl(pages.map((page) => ({ kind: "site-health-issue-page", ...context, ...page })));
54
+ return;
55
+ }
56
+ if (isMachineFormat(opts.format)) {
57
+ console.log(JSON.stringify(res, null, 2));
58
+ return;
59
+ }
60
+ const lines = [`Pages for audit issue ${res.issueId}:`, ...issueEvidenceProvenance(res)];
61
+ if (res.pages.length === 0) lines.push("No affected pages returned; unavailable or partial evidence does not establish a clean site.");
62
+ for (const page of res.pages) {
63
+ lines.push("", page.url, page.message);
64
+ if (page.messageTruncated) lines.push("The saved message is shortened.");
65
+ if (page.recommendations.length > 0) {
66
+ lines.push(page.recommendationsScope === SiteAuditIssueRecommendationScopes.issue ? "Guidance for this issue:" : "Guidance for this page\u2019s whole factor (not issue-specific):");
67
+ for (const recommendation of page.recommendations) lines.push(` ${recommendation}`);
68
+ }
69
+ if (page.recommendationsTruncated) lines.push("Additional guidance was omitted from this bounded result.");
70
+ }
71
+ if (res.nextCursor) lines.push("", `Next cursor: ${res.nextCursor}`);
72
+ console.log(lines.join("\n"));
73
+ }
74
+ function issueEvidenceProvenance(res) {
75
+ return [
76
+ `Scan: ${res.runId ?? "none"} \xB7 attempt ${res.attemptId ?? "unknown"} \xB7 audited ${res.auditedAt ?? "unknown"} \xB7 status ${res.runStatus ?? "unknown"}`,
77
+ `Evidence: ${res.state} \xB7 crawl ${res.runId === null ? "unavailable" : res.complete ? "complete" : "partial"}${res.termination ? ` (${res.termination})` : ""}`,
78
+ `Page findings: ${res.coverage.pageFindings}; cross-page checks: ${res.coverage.crossPage}. Finding evidence for ${res.coverage.pagesWithFindingEvidence}/${res.coverage.auditedPages} audited page(s).`,
79
+ `${res.coverage.pagesWithoutFindingEvidence} audited page(s) lack finding evidence; ${res.coverage.omittedFindings} malformed or uncoded finding(s) omitted.`,
80
+ `Total in this stored selection: ${res.total ?? "unknown"}.`
81
+ ];
82
+ }
83
+ async function technicalAeoScore(project, opts) {
84
+ const client = getClient();
85
+ const score = await client.getTechnicalAeoScore(project, { runId: opts.runId });
86
+ if (isMachineFormat(opts.format)) {
87
+ console.log(JSON.stringify(score, null, 2));
88
+ return;
89
+ }
90
+ if (!score.hasData) {
91
+ console.log(
92
+ `No technical audit yet for "${project}". Run \`canonry technical-aeo run ${project}\` to generate one.`
93
+ );
94
+ return;
95
+ }
96
+ const lines = [];
97
+ const delta = score.deltaScore == null ? "" : ` (${score.deltaScore >= 0 ? "+" : ""}${score.deltaScore} vs prev)`;
98
+ lines.push(`Technical AEO: ${score.aggregateScore}/100${delta}`);
99
+ lines.push(
100
+ `Audited ${score.pagesAudited} page(s) \xB7 ${score.pagesSkipped} skipped \xB7 ${score.pagesErrored} errored \xB7 sitemap ${score.sitemapUrl}`
101
+ );
102
+ lines.push(`As of ${score.auditedAt}`);
103
+ if (score.factors.length > 0) {
104
+ lines.push("");
105
+ lines.push(`${"Factor".padEnd(32)}${"Share".padStart(7)}${"Avg".padStart(6)}${"Status".padStart(9)} Pass/Part/Fail`);
106
+ for (const f of score.factors) {
107
+ lines.push(
108
+ `${f.name.slice(0, 31).padEnd(32)}${formatPercent(f.sharePct, RatioUnits.percent).padStart(7)}${String(f.avgScore).padStart(6)}${f.status.padStart(9)} ${f.pagesPassing}/${f.pagesPartial}/${f.pagesFailing}`
109
+ );
110
+ }
111
+ }
112
+ if (score.prioritizedFixes.length > 0) {
113
+ lines.push("");
114
+ lines.push("Prioritized fixes:");
115
+ score.prioritizedFixes.forEach((fix, i) => lines.push(` ${i + 1}. ${fix}`));
116
+ }
117
+ console.log(lines.join("\n"));
118
+ }
119
+ async function technicalAeoPages(project, opts) {
120
+ const client = getClient();
121
+ const status = opts.status === "success" || opts.status === "error" ? opts.status : void 0;
122
+ const res = await client.getTechnicalAeoPages(project, { runId: opts.runId, status, sort: opts.sort, limit: opts.limit });
123
+ if (opts.format === "jsonl") {
124
+ emitJsonl(res.pages.map((p) => ({ project, runId: res.runId, ...p })));
125
+ return;
126
+ }
127
+ if (opts.format === "json") {
128
+ console.log(JSON.stringify(res, null, 2));
129
+ return;
130
+ }
131
+ if (res.pages.length === 0) {
132
+ console.log(`No audited pages for "${project}". Run \`canonry technical-aeo run ${project}\` first.`);
133
+ return;
134
+ }
135
+ const lines = [];
136
+ lines.push(`${res.pages.length} of ${res.total} page(s) from run ${res.runId}:
137
+ `);
138
+ lines.push(`${"Score".padStart(5)} ${"Status".padEnd(7)} URL`);
139
+ for (const p of res.pages) {
140
+ const tail = p.status === "error" ? ` ${p.error ?? "error"}` : "";
141
+ lines.push(`${String(p.overallScore).padStart(5)} ${p.status.padEnd(7)} ${p.url}${tail}`);
142
+ }
143
+ console.log(lines.join("\n"));
144
+ }
145
+ async function technicalAeoTrend(project, opts) {
146
+ const client = getClient();
147
+ const res = await client.getTechnicalAeoTrend(project, { limit: opts.limit });
148
+ if (opts.format === "jsonl") {
149
+ emitJsonl(res.points.map((p) => ({ project, ...p })));
150
+ return;
151
+ }
152
+ if (opts.format === "json") {
153
+ console.log(JSON.stringify(res, null, 2));
154
+ return;
155
+ }
156
+ if (res.points.length === 0) {
157
+ console.log(`No audits yet for "${project}". Run \`canonry technical-aeo run ${project}\` first.`);
158
+ return;
159
+ }
160
+ const lines = [];
161
+ lines.push(`${"Date".padEnd(26)} ${"Score".padStart(5)} Pages`);
162
+ for (const p of res.points) {
163
+ lines.push(`${p.auditedAt.padEnd(26)} ${String(p.aggregateScore).padStart(5)} ${p.pagesAudited}`);
164
+ }
165
+ console.log(lines.join("\n"));
166
+ }
167
+ async function technicalAeoProgress(project, opts) {
168
+ const progress = await getClient().getTechnicalAeoProgress(project, opts.runId);
169
+ if (isMachineFormat(opts.format)) {
170
+ console.log(JSON.stringify(progress, null, 2));
171
+ return;
172
+ }
173
+ const lines = [
174
+ `Site Health progress: ${progress.phase} (${progress.status})`,
175
+ `Run: ${progress.runId}`
176
+ ];
177
+ if (progress.attempt) {
178
+ lines.push(
179
+ `Pages: ${progress.attempt.pagesDiscovered} found \xB7 ${progress.attempt.pagesFetched} checked \xB7 ${progress.attempt.pagesErrored} failed`,
180
+ `Eligible: ${progress.attempt.pagesEligible} \xB7 Links found: ${progress.attempt.edgesDiscovered}`,
181
+ `Updated: ${progress.attempt.lastUpdatedAt}`
182
+ );
183
+ } else {
184
+ lines.push("Pages: waiting for the crawl to start");
185
+ }
186
+ lines.push(`Layout: ${progress.layout.state}`);
187
+ if (progress.error) lines.push(`Error: ${progress.error}`);
188
+ console.log(lines.join("\n"));
189
+ }
190
+ async function technicalAeoCrawl(project, opts) {
191
+ const crawl = await getClient().getTechnicalAeoCrawl(project, { runId: opts.runId, date: opts.date });
192
+ if (isMachineFormat(opts.format)) {
193
+ console.log(JSON.stringify(crawl, null, 2));
194
+ return;
195
+ }
196
+ if (!crawl.hasCrawlData) {
197
+ if (opts.date) {
198
+ console.log([`No persisted site crawl for "${project}" on ${opts.date}.`, ...availableScanDateLines(crawl.availableScanDates)].join("\n"));
199
+ return;
200
+ }
201
+ console.log(`No persisted site crawl for "${project}". Run \`canonry technical-aeo run ${project}\` first.`);
202
+ return;
203
+ }
204
+ const lines = [
205
+ `Site crawl: ${crawl.complete ? "complete" : "partial"} (${crawl.runStatus ?? "unknown"})`,
206
+ `Root: ${crawl.rootUrl ?? "-"}`,
207
+ `Pages: ${crawl.counts.pagesFetched} fetched \xB7 ${crawl.counts.pagesDiscovered} discovered \xB7 ${crawl.counts.pagesEligible} eligible`,
208
+ `Links: ${crawl.counts.edges} internal/external observations \xB7 ${crawl.counts.findings} findings`,
209
+ `Dead links: ${formatDeadLinkState(crawl.deadLinks)}`
210
+ ];
211
+ lines.push(...inventorySummaryLines(crawl.inventorySummary));
212
+ if (crawl.termination) lines.push(`Stopped: ${crawl.termination}`);
213
+ console.log(lines.join("\n"));
214
+ }
215
+ async function technicalAeoSubgraph(project, opts) {
216
+ const res = await getClient().getSiteHealthSubgraph(project, opts);
217
+ if (isMachineFormat(opts.format)) {
218
+ console.log(JSON.stringify(res, null, 2));
219
+ return;
220
+ }
221
+ if (!res.hasCrawlData) {
222
+ console.log(`No persisted Site Health crawl for "${project}". Run \`canonry technical-aeo run ${project}\` first.`);
223
+ return;
224
+ }
225
+ if (res.state !== "ready") {
226
+ console.log(`Site Health subgraph details are unavailable for crawl ${res.runId ?? "-"}.`);
227
+ return;
228
+ }
229
+ const focus = res.focusUrl ?? res.focusNodeKey ?? "crawl root";
230
+ const totalQualifier = res.countAccuracy === "lower-bound" ? "at least " : "";
231
+ const lines = [
232
+ `Site Health subgraph: ${focus} (${res.hops} hop${res.hops === 1 ? "" : "s"})`,
233
+ `${res.nodes.length} of ${totalQualifier}${res.totalNodes} node(s) \xB7 ${res.edges.length} of ${totalQualifier}${res.totalEdges} edge(s)`,
234
+ `Crawl: ${res.complete ? "complete" : `partial (${res.termination ?? "incomplete"})`}`
235
+ ];
236
+ if (res.countAccuracy === "lower-bound") lines.push("Count accuracy: lower bound; traversal reached a cap, so totals and omissions may be higher.");
237
+ if (res.truncated) lines.push(`Truncated: at least ${res.omittedNodes} node(s) and ${res.omittedEdges} edge(s) omitted. Narrow or refocus the request.`);
238
+ if (!res.complete) lines.push(`Partial crawl: ${res.termination ?? "incomplete"}. Results describe only persisted observations.`);
239
+ console.log(lines.join("\n"));
240
+ }
241
+ async function technicalAeoPath(project, opts) {
242
+ const res = await getClient().getSiteHealthPath(project, opts);
243
+ if (isMachineFormat(opts.format)) {
244
+ console.log(JSON.stringify(res, null, 2));
245
+ return;
246
+ }
247
+ if (res.state === "no-crawl") {
248
+ console.log(`No persisted Site Health crawl for "${project}". Run \`canonry technical-aeo run ${project}\` first.`);
249
+ return;
250
+ }
251
+ if (res.state === "details-unavailable") {
252
+ console.log(`Site Health path details are unavailable for crawl ${res.runId ?? "-"}.`);
253
+ return;
254
+ }
255
+ if (res.state === "unreachable") {
256
+ const qualification = res.complete ? "" : ` in the partial crawl (${res.termination ?? "incomplete"}); this is not a site-wide conclusion`;
257
+ console.log(`No directed followable path found${qualification} to ${res.to?.url ?? "the requested destination"} within ${res.maxDepth} hop(s).`);
258
+ return;
259
+ }
260
+ if (res.state === "truncated") {
261
+ const qualification = res.complete ? "" : ` The crawl is partial (${res.termination ?? "incomplete"}), so this is not a site-wide conclusion.`;
262
+ console.log(`Path search reached its exploration cap before resolving ${res.to?.url ?? "the requested destination"}. Narrow the route or reduce max depth.${qualification}`);
263
+ return;
264
+ }
265
+ const lines = [res.nodes.map((node) => node.url).join("\n\u2192 ")];
266
+ if (!res.complete) lines.push("", `Partial crawl: ${res.termination ?? "incomplete"}. This path covers only persisted observations.`);
267
+ console.log(lines.join("\n"));
268
+ }
269
+ async function technicalAeoChanges(project, opts) {
270
+ const res = await getClient().getSiteHealthChanges(project, opts);
271
+ if (opts.format === "jsonl") {
272
+ if (res.state === "ready") {
273
+ const { changes, ...header } = res;
274
+ emitJsonl([{ kind: "site-health-changes-header", ...header }]);
275
+ emitJsonl(changes.map((record) => ({ project, fromRunId: res.fromRunId, toRunId: res.toRunId, ...record })));
276
+ } else {
277
+ emitJsonl([{ kind: "site-health-changes-header", ...res }]);
278
+ }
279
+ return;
280
+ }
281
+ if (isMachineFormat(opts.format)) {
282
+ console.log(JSON.stringify(res, null, 2));
283
+ return;
284
+ }
285
+ if (res.state === "unavailable") {
286
+ console.log(`Site Health changes unavailable: ${res.reason.replaceAll("-", " ")}.`);
287
+ return;
288
+ }
289
+ if (res.state === "incompatible") {
290
+ console.log(`Site Health changes unavailable: snapshots use incompatible ${res.mismatchedVersions.join(", ")} versions.`);
291
+ return;
292
+ }
293
+ const lines = [
294
+ `Site Health changes: ${res.fromRunId} \u2192 ${res.toRunId}`,
295
+ `Filters: ${res.filters.scope} \xB7 ${res.filters.change}`
296
+ ];
297
+ if (res.summaryState === "exact" && res.summary !== null && res.total !== null) {
298
+ lines.push(`Pages: +${res.summary.pages.added} / -${res.summary.pages.removed} / ${res.summary.pages.changed} changed`);
299
+ lines.push(`Links: +${res.summary.links.added} / -${res.summary.links.removed} / ${res.summary.links.changed}`);
300
+ lines.push(`${res.changes.length} of ${res.total} change(s)${res.nextCursor ? " (more available)" : ""}`);
301
+ } else {
302
+ lines.push(`Summary: omitted on continuation; ${res.changes.length} returned change(s)${res.nextCursor ? " (more available)" : ""}`);
303
+ }
304
+ if (res.changes.length > 0) {
305
+ lines.push("", "Changes:");
306
+ for (const record of res.changes) lines.push(` ${formatSiteHealthChangeRecord(record)}`);
307
+ }
308
+ if (res.nextCursor) lines.push(`Next cursor: ${res.nextCursor}`);
309
+ console.log(lines.join("\n"));
310
+ }
311
+ function formatSiteHealthChangeRecord(record) {
312
+ const target = record.entity === "page" ? record.after?.url ?? record.before?.url ?? record.key : (() => {
313
+ const edge = record.after ?? record.before;
314
+ return edge ? `${edge.sourceUrl} \u2192 ${edge.targetUrl}` : record.key;
315
+ })();
316
+ const fields = record.changedFields.length > 0 ? ` (${record.changedFields.join(", ")})` : "";
317
+ return `${record.entity} ${record.change}: ${target}${fields}`;
318
+ }
319
+ function partialCrawlNote(res) {
320
+ if (!res.hasCrawlData || res.complete !== false) return null;
321
+ return `Partial crawl (${res.termination ?? "incomplete"}): pages and links beyond the crawl budget were not observed, so a missing page or link is not proof it does not exist.`;
322
+ }
323
+ function availableScanDateLines(dates) {
324
+ if (!dates) return [];
325
+ return [
326
+ `Known scan dates: ${dates.totalDates} distinct dates`,
327
+ `Recent dates: ${dates.recentDates.join(", ") || "none"}`,
328
+ `Same month and day: ${dates.matchingMonthDayDates.join(", ") || "none"} (${dates.matchingMonthDayTotal} distinct dates)`
329
+ ];
330
+ }
331
+ function inventorySummaryLines(summary) {
332
+ if (!summary) return [];
333
+ return [
334
+ `Stored canonical pages: ${summary.total} total \xB7 ${summary.eligible} eligible \xB7 ${summary.excluded} excluded`,
335
+ ...summary.excludedReasons.map((reason) => `Excluded \xB7 ${reason.healthReason}: ${reason.pages}`)
336
+ ];
337
+ }
338
+ async function technicalAeoCrawlPages(project, opts) {
339
+ const res = await getClient().getTechnicalAeoCrawlPages(project, opts);
340
+ if (opts.format === "jsonl") {
341
+ emitJsonl([{
342
+ kind: "technical-aeo-crawl-pages-header",
343
+ project,
344
+ runId: res.runId,
345
+ complete: res.complete,
346
+ runSelection: res.runSelection,
347
+ requestedDate: res.requestedDate,
348
+ availableScanDates: res.availableScanDates,
349
+ inventorySummary: res.inventorySummary,
350
+ healthReasonCounts: res.healthReasonCounts,
351
+ termination: res.termination,
352
+ total: res.total,
353
+ nextCursor: res.nextCursor
354
+ }]);
355
+ emitJsonl(res.pages.map((page) => ({ project, runId: res.runId, ...page })));
356
+ return;
357
+ }
358
+ if (opts.format === "json") {
359
+ console.log(JSON.stringify(res, null, 2));
360
+ return;
361
+ }
362
+ const note = partialCrawlNote(res);
363
+ const inventoryLines = inventorySummaryLines(res.inventorySummary);
364
+ if (res.pages.length === 0) {
365
+ console.log([opts.date && !res.hasCrawlData ? `No persisted crawl pages for "${project}" on ${opts.date}.` : `No persisted crawl pages for "${project}".`, ...availableScanDateLines(res.availableScanDates), ...inventoryLines, ...note ? [note] : []].join("\n"));
366
+ return;
367
+ }
368
+ const lines = [`${res.pages.length} of ${res.total} crawl page(s)${res.nextCursor ? " (more available)" : ""}:`, ""];
369
+ lines.push(...inventoryLines);
370
+ lines.push(`${"Depth".padStart(5)} ${"Score".padStart(5)} ${"Page state".padEnd(21)} URL`);
371
+ for (const page of res.pages) {
372
+ lines.push(`${String(page.depth ?? "-").padStart(5)} ${String(page.auditScore ?? "-").padStart(5)} ${(page.healthReason ?? page.healthState ?? page.indexabilityState).slice(0, 21).padEnd(21)} ${page.url}`);
373
+ }
374
+ if (res.nextCursor) lines.push(`
375
+ Next cursor: ${res.nextCursor}`);
376
+ if (note) lines.push("", note);
377
+ console.log(lines.join("\n"));
378
+ }
379
+ async function technicalAeoPageAudit(project, opts) {
380
+ const res = await getClient().getTechnicalAeoPageAudit(project, {
381
+ runId: opts.runId,
382
+ nodeKey: opts.nodeKey,
383
+ url: opts.url
384
+ });
385
+ if (isMachineFormat(opts.format)) {
386
+ console.log(JSON.stringify(res, null, 2));
387
+ return;
388
+ }
389
+ if (res.state === "no-crawl") {
390
+ console.log(`No persisted Site Health crawl for "${project}". Run \`canonry technical-aeo run ${project}\` first.`);
391
+ return;
392
+ }
393
+ const provenance = [`Run: ${res.runId} \xB7 ${res.complete ? "complete" : "partial"}`];
394
+ if (!res.complete) provenance.push(`Partial crawl: ${res.termination ?? "termination reason unavailable"}`);
395
+ if (res.state === "details-unavailable") {
396
+ console.log([
397
+ "Page audit details are unavailable for this retained crawl.",
398
+ ...provenance
399
+ ].join("\n"));
400
+ return;
401
+ }
402
+ if (res.state === "not-found") {
403
+ console.log([
404
+ "The selected page was not found in this crawl.",
405
+ ...provenance
406
+ ].join("\n"));
407
+ return;
408
+ }
409
+ const lines = [
410
+ `Page audit: ${res.auditScore == null ? "not scored" : `${res.auditScore}/100`} \xB7 ${res.url}`,
411
+ ...provenance
412
+ ];
413
+ if (res.state === "not-audited") {
414
+ lines.push(`Audit evidence unavailable: page state is ${res.auditState}.`);
415
+ console.log(lines.join("\n"));
416
+ return;
417
+ }
418
+ if (res.evidenceState === "scores-only") {
419
+ lines.push("Evidence: scores only; this historical row predates persisted finding prose.");
420
+ }
421
+ if (res.criticalDefects.length > 0) {
422
+ lines.push("", "Score-independent defects:");
423
+ for (const defect of res.criticalDefects) {
424
+ lines.push(` [${defect.severity}] [${defect.id}] ${defect.detail}`);
425
+ lines.push(` Fix: ${defect.recommendation}`);
426
+ }
427
+ }
428
+ if (res.factors.length > 0) {
429
+ lines.push("", "Factors:");
430
+ for (const factor of res.factors) {
431
+ const share = typeof factor.sharePct === "number" ? ` \xB7 worth ${formatPercent(factor.sharePct, RatioUnits.percent)} of the page score` : "";
432
+ lines.push(` ${factor.name}: ${factor.score}/100 (${factor.status})${share}`);
433
+ for (const finding of factor.findings) lines.push(` [${finding.code}] ${finding.message}`);
434
+ for (const recommendation of factor.recommendations) lines.push(` Fix: ${recommendation}`);
435
+ }
436
+ }
437
+ console.log(lines.join("\n"));
438
+ }
439
+ async function technicalAeoStructure(project, opts) {
440
+ const res = await getClient().getTechnicalAeoStructure(project, opts);
441
+ if (opts.format === "jsonl") {
442
+ emitJsonl([{
443
+ kind: "technical-aeo-structure-header",
444
+ project,
445
+ runId: res.runId,
446
+ complete: res.complete,
447
+ termination: res.termination,
448
+ parentPath: res.parentPath,
449
+ returned: res.children.length,
450
+ nextCursor: res.nextCursor
451
+ }]);
452
+ emitJsonl(res.children.map((child) => ({ project, runId: res.runId, parentPath: res.parentPath, ...child })));
453
+ return;
454
+ }
455
+ if (opts.format === "json") {
456
+ console.log(JSON.stringify(res, null, 2));
457
+ return;
458
+ }
459
+ const note = partialCrawlNote(res);
460
+ if (res.children.length === 0) {
461
+ console.log([`No crawl structure below ${res.parentPath} for "${project}".`, ...note ? [note] : []].join("\n"));
462
+ return;
463
+ }
464
+ const lines = [`${res.children.length} child path(s) below ${res.parentPath}${res.nextCursor ? " (more available)" : ""}:`, ""];
465
+ for (const child of res.children) {
466
+ lines.push(`${String(child.pageCount).padStart(5)} pages ${String(child.inventoryEligibleCount).padStart(5)} eligible ${child.path}`);
467
+ }
468
+ if (res.nextCursor) lines.push(`
469
+ Next cursor: ${res.nextCursor}`);
470
+ if (note) lines.push("", note);
471
+ console.log(lines.join("\n"));
472
+ }
473
+ async function technicalAeoInternalLinks(project, opts) {
474
+ const res = await getClient().getTechnicalAeoInternalLinks(project, opts);
475
+ if (opts.format === "jsonl") {
476
+ emitJsonl([{
477
+ kind: "technical-aeo-internal-links-header",
478
+ project,
479
+ runId: res.runId,
480
+ complete: res.complete,
481
+ termination: res.termination,
482
+ total: res.total,
483
+ nextCursor: res.nextCursor
484
+ }]);
485
+ emitJsonl(res.edges.map((edge) => ({ project, runId: res.runId, ...edge })));
486
+ return;
487
+ }
488
+ if (opts.format === "json") {
489
+ console.log(JSON.stringify(res, null, 2));
490
+ return;
491
+ }
492
+ const note = partialCrawlNote(res);
493
+ if (res.edges.length === 0) {
494
+ console.log([`No persisted internal links for "${project}".`, ...note ? [note] : []].join("\n"));
495
+ return;
496
+ }
497
+ const lines = [`${res.edges.length} of ${res.total} internal link(s)${res.nextCursor ? " (more available)" : ""}:`, ""];
498
+ for (const edge of res.edges) {
499
+ lines.push(`${edge.followable ? "follow" : "nofollow"} \xD7${edge.occurrences} ${edge.sourceUrl} \u2192 ${edge.targetUrl}`);
500
+ }
501
+ if (res.nextCursor) lines.push(`
502
+ Next cursor: ${res.nextCursor}`);
503
+ if (note) lines.push("", note);
504
+ console.log(lines.join("\n"));
505
+ }
506
+ async function technicalAeoLinkNeighbors(project, opts) {
507
+ const res = await getClient().getTechnicalAeoInternalLinkNeighbors(project, opts);
508
+ if (isMachineFormat(opts.format)) {
509
+ console.log(JSON.stringify(res, null, 2));
510
+ return;
511
+ }
512
+ const title = res.url ?? res.nodeKey ?? "page";
513
+ const note = partialCrawlNote(res);
514
+ const none = note ? " (none observed in this partial crawl)" : " (none)";
515
+ const lines = [`Internal links for ${title}:`, "", "Inbound:"];
516
+ for (const edge of res.inbound) lines.push(` ${edge.sourceUrl} \u2192 ${edge.targetUrl}`);
517
+ if (res.inbound.length === 0) lines.push(none);
518
+ if (res.inboundTruncated) lines.push(" (truncated)");
519
+ lines.push("", "Outbound:");
520
+ for (const edge of res.outbound) lines.push(` ${edge.sourceUrl} \u2192 ${edge.targetUrl}`);
521
+ if (res.outbound.length === 0) lines.push(none);
522
+ if (res.outboundTruncated) lines.push(" (truncated)");
523
+ if (note) lines.push("", note);
524
+ console.log(lines.join("\n"));
525
+ }
526
+ async function technicalAeoDeadLinks(project, opts) {
527
+ const res = await getClient().getTechnicalAeoDeadLinks(project, opts);
528
+ if (opts.format === "jsonl") {
529
+ if ("deadLinks" in res) {
530
+ const { deadLinks, ...header } = res;
531
+ emitJsonl([{ kind: "technical-aeo-dead-links-header", ...header }]);
532
+ emitJsonl(deadLinks.map((finding) => ({ project, runId: res.runId, state: res.state, ...finding })));
533
+ } else {
534
+ emitJsonl([{ kind: "technical-aeo-dead-links-header", ...res }]);
535
+ }
536
+ return;
537
+ }
538
+ if (isMachineFormat(opts.format)) {
539
+ console.log(JSON.stringify(res, null, 2));
540
+ return;
541
+ }
542
+ if (res.state === "disabled") {
543
+ console.log(`Dead-link checks were disabled for crawl ${res.runId}. Re-run with \`--check-dead-links\` to enable them.`);
544
+ return;
545
+ }
546
+ if (res.state === "unavailable") {
547
+ console.log(`No dead-link check is available for "${project}".`);
548
+ return;
549
+ }
550
+ const lines = [`Dead links: ${res.found} found from ${res.checked} checked (${res.state})`];
551
+ for (const finding of res.deadLinks) lines.push(`${finding.sourceUrl ?? "-"} \u2192 ${finding.targetUrl ?? "-"}`);
552
+ if (res.unverified > 0) lines.push(unverifiedNote(res.unverified));
553
+ if (res.nextCursor) lines.push(`Next cursor: ${res.nextCursor}`);
554
+ console.log(lines.join("\n"));
555
+ }
556
+ function unverifiedNote(unverified) {
557
+ return `${unverified} link${unverified === 1 ? "" : "s"} could not be checked (the crawler never got a response). Not counted as broken; re-run to retry.`;
558
+ }
559
+ function formatDeadLinkState(value) {
560
+ if (value.state === "disabled") return "disabled (opt in with --check-dead-links)";
561
+ if (value.state === "unavailable") return "unavailable";
562
+ const unverified = value.unverified ?? 0;
563
+ const suffix = unverified > 0 ? `, ${unverified} unchecked` : "";
564
+ return `${value.found ?? 0} found / ${value.checked ?? 0} checked${suffix} (${value.state})`;
565
+ }
566
+ async function technicalAeoRun(project, opts) {
567
+ const client = getClient();
568
+ const { runId, status } = await client.triggerSiteAudit(project, {
569
+ sitemapUrl: opts.sitemapUrl,
570
+ limit: opts.limit,
571
+ maxPages: opts.maxPages,
572
+ maxEdges: opts.maxEdges,
573
+ maxDepth: opts.maxDepth,
574
+ // Explicit opt-in: absence and false are both intentionally disabled.
575
+ checkDeadLinks: opts.checkDeadLinks === true,
576
+ includeGeo: opts.includeGeo === true,
577
+ includeAgentSkills: opts.includeAgentSkills ?? true
578
+ });
579
+ if (!opts.wait) {
580
+ if (isMachineFormat(opts.format)) {
581
+ console.log(JSON.stringify({ runId, status }, null, 2));
582
+ return;
583
+ }
584
+ console.log(
585
+ `Site audit started (run ${runId}, status ${status}). Use \`canonry runs get ${runId}\` to check status, or pass --wait.`
586
+ );
587
+ return;
588
+ }
589
+ const terminal = /* @__PURE__ */ new Set(["completed", "partial", "failed", "cancelled"]);
590
+ const start = Date.now();
591
+ const timeoutMs = 15 * 60 * 1e3;
592
+ if (!isMachineFormat(opts.format)) process.stderr.write("Auditing");
593
+ let final = status;
594
+ while (!terminal.has(final) && Date.now() - start < timeoutMs) {
595
+ await new Promise((r) => setTimeout(r, 2e3));
596
+ const run = await client.getRun(runId);
597
+ if (!isMachineFormat(opts.format)) process.stderr.write(".");
598
+ final = run.status;
599
+ }
600
+ if (!isMachineFormat(opts.format)) process.stderr.write("\n");
601
+ if (isMachineFormat(opts.format)) {
602
+ console.log(JSON.stringify({ runId, status: final }, null, 2));
603
+ return;
604
+ }
605
+ console.log(`Site audit ${final} (run ${runId}).`);
606
+ }
607
+ export {
608
+ technicalAeoChanges,
609
+ technicalAeoCrawl,
610
+ technicalAeoCrawlPages,
611
+ technicalAeoDeadLinks,
612
+ technicalAeoInternalLinks,
613
+ technicalAeoIssuePages,
614
+ technicalAeoIssues,
615
+ technicalAeoLinkNeighbors,
616
+ technicalAeoPageAudit,
617
+ technicalAeoPages,
618
+ technicalAeoPath,
619
+ technicalAeoProgress,
620
+ technicalAeoRun,
621
+ technicalAeoScore,
622
+ technicalAeoStructure,
623
+ technicalAeoSubgraph,
624
+ technicalAeoTrend
625
+ };