@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,257 @@
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
+ usageError
13
+ } from "./chunk-HGMYEDAQ.js";
14
+ import {
15
+ contentTargetDismissRequestSchema,
16
+ formatPercent
17
+ } from "./chunk-O4RMPA6H.js";
18
+ import "./chunk-MLKGABMK.js";
19
+
20
+ // src/commands/content.ts
21
+ var WINNABILITY_COVERAGE_CHECK_ID = "content.winnability.coverage";
22
+ async function listContentDismissals(project, opts) {
23
+ const response = await createApiClient().getContentDismissals(project);
24
+ if (opts.format === "jsonl") {
25
+ emitJsonl(response.dismissals.map((row) => ({ project, ...row })));
26
+ return;
27
+ }
28
+ if (isMachineFormat(opts.format)) {
29
+ console.log(JSON.stringify(response, null, 2));
30
+ return;
31
+ }
32
+ if (response.dismissals.length === 0) {
33
+ console.log("No addressed content targets.");
34
+ return;
35
+ }
36
+ for (const row of response.dismissals) {
37
+ console.log(`${row.targetRef} \xB7 ${row.dismissedAt}`);
38
+ if (row.addressedUrl) console.log(` Addressed URL: ${row.addressedUrl}`);
39
+ if (row.note) console.log(` Note: ${row.note}`);
40
+ }
41
+ }
42
+ async function dismissContentTarget(project, request, opts) {
43
+ const parsed = contentTargetDismissRequestSchema.safeParse(request);
44
+ if (!parsed.success) throw usageError(parsed.error.issues[0]?.message ?? "Invalid content dismissal.");
45
+ const response = await createApiClient().dismissContentTarget(project, parsed.data);
46
+ if (isMachineFormat(opts.format)) {
47
+ console.log(JSON.stringify(response, null, 2));
48
+ return;
49
+ }
50
+ console.log(`Marked ${response.targetRef} addressed. Restore with canonry content restore ${project} ${response.targetRef}.`);
51
+ }
52
+ async function restoreContentTarget(project, targetRef, opts) {
53
+ await createApiClient().restoreContentTarget(project, targetRef);
54
+ if (isMachineFormat(opts.format)) {
55
+ console.log(JSON.stringify({ targetRef, restored: true }, null, 2));
56
+ return;
57
+ }
58
+ console.log(`Restored ${targetRef}. It can appear in content targets when still eligible.`);
59
+ }
60
+ async function listContentTargets(project, opts) {
61
+ const client = createApiClient();
62
+ const response = await client.getContentTargets(project, {
63
+ limit: opts.limit,
64
+ includeInProgress: opts.includeInProgress,
65
+ winnabilityClass: opts.winnabilityClass,
66
+ ownable: opts.ownable
67
+ });
68
+ if (opts.format === "json") {
69
+ console.log(JSON.stringify(response, null, 2));
70
+ return;
71
+ }
72
+ if (opts.format === "jsonl") {
73
+ emitJsonl(
74
+ response.targets.map((target) => ({
75
+ project,
76
+ latestRunId: response.contextMetrics.latestRunId,
77
+ ...target
78
+ }))
79
+ );
80
+ return;
81
+ }
82
+ if (response.targets.length === 0) {
83
+ console.log("No content targets surfaced. (Run `canonry run` to generate fresh signal.)");
84
+ return;
85
+ }
86
+ console.log(
87
+ `${response.targets.length} target${response.targets.length === 1 ? "" : "s"} (latestRunId=${response.contextMetrics.latestRunId})`
88
+ );
89
+ console.log("");
90
+ for (const target of response.targets) {
91
+ const action = target.action.toUpperCase().padEnd(11);
92
+ const score = target.score.toFixed(1).padStart(6);
93
+ const conf = target.actionConfidence.padEnd(6);
94
+ const surface = target.winnabilityClass === "ceded" ? "CEDED " : "ownable";
95
+ console.log(`${action} ${score} conf=${conf} [${surface}] ${target.query}`);
96
+ console.log(` target ref: ${target.targetRef}`);
97
+ if (target.ourBestPage) {
98
+ const posLabel = target.ourBestPage.gscAvgPosition !== null ? `pos #${target.ourBestPage.gscAvgPosition}` : "no GSC ranking";
99
+ console.log(` our page: ${target.ourBestPage.url} (${posLabel})`);
100
+ }
101
+ if (target.winningCompetitor) {
102
+ console.log(` winning: ${target.winningCompetitor.url} (${target.winningCompetitor.citationCount}\xD7 cited)`);
103
+ }
104
+ if (target.drivers.length > 0) {
105
+ console.log(` why: ${target.drivers.join(" \xB7 ")}`);
106
+ }
107
+ if (target.existingAction) {
108
+ console.log(` in-flight action: ${target.existingAction.actionId} (${target.existingAction.state})`);
109
+ }
110
+ console.log("");
111
+ }
112
+ }
113
+ async function listContentSources(project, opts) {
114
+ const client = createApiClient();
115
+ const response = await client.getContentSources(project);
116
+ if (opts.format === "json") {
117
+ console.log(JSON.stringify(response, null, 2));
118
+ return;
119
+ }
120
+ if (opts.format === "jsonl") {
121
+ emitJsonl(response.sources.map((row) => ({ project, ...row })));
122
+ return;
123
+ }
124
+ if (response.sources.length === 0) {
125
+ console.log("No grounding sources captured yet.");
126
+ return;
127
+ }
128
+ for (const row of response.sources) {
129
+ console.log(`Q: ${row.query}`);
130
+ if (row.groundingSources.length === 0) {
131
+ console.log(" (no grounding sources)");
132
+ } else {
133
+ for (const g of row.groundingSources) {
134
+ const tag = g.isOurDomain ? "OURS " : g.isCompetitor ? "COMP " : "OTHER ";
135
+ console.log(` ${tag} ${g.uri} (${g.citationCount}\xD7)`);
136
+ }
137
+ }
138
+ console.log("");
139
+ }
140
+ }
141
+ async function listContentGaps(project, opts) {
142
+ const client = createApiClient();
143
+ const response = await client.getContentGaps(project);
144
+ if (opts.format === "json") {
145
+ console.log(JSON.stringify(response, null, 2));
146
+ return;
147
+ }
148
+ if (opts.format === "jsonl") {
149
+ emitJsonl(response.gaps.map((gap) => ({ project, ...gap })));
150
+ return;
151
+ }
152
+ if (response.gaps.length === 0) {
153
+ console.log("No competitor-only-cited queries detected.");
154
+ return;
155
+ }
156
+ console.log(`${response.gaps.length} gap${response.gaps.length === 1 ? "" : "s"} found`);
157
+ console.log("");
158
+ for (const gap of response.gaps) {
159
+ const missPct = formatPercent(gap.missRate);
160
+ console.log(`${missPct.padStart(6)} ${gap.competitorCount} competitor(s) ${gap.query}`);
161
+ console.log(` competitors: ${gap.competitorDomains.join(", ")}`);
162
+ console.log("");
163
+ }
164
+ }
165
+ async function generateContentBrief(project, targetRef, opts) {
166
+ const client = createApiClient();
167
+ await warnIfWinnabilityCoverageIsLow(client, project, opts.format);
168
+ const response = await client.synthesizeContentBrief(project, targetRef, {
169
+ provider: opts.provider,
170
+ model: opts.model,
171
+ forceRefresh: opts.force
172
+ });
173
+ if (isMachineFormat(opts.format)) {
174
+ console.log(JSON.stringify(response, null, 2));
175
+ return;
176
+ }
177
+ const b = response.brief;
178
+ console.log(`Brief for: ${b.targetQuery}`);
179
+ console.log(`Surface: ${b.winnabilityClass}`);
180
+ console.log(`Provider: ${response.provider} / ${response.model}`);
181
+ console.log("");
182
+ console.log(`Angle: ${b.angle}`);
183
+ console.log(`Why winnable: ${b.whyWinnable}`);
184
+ console.log(`Schema hookup: ${b.schemaHookup}`);
185
+ console.log(`Controllable surface: ${b.controllableSurfaceRationale}`);
186
+ }
187
+ async function tryGetBrief(client, project, targetRef) {
188
+ try {
189
+ return await client.getContentBrief(project, targetRef);
190
+ } catch (err) {
191
+ if (err instanceof CliError && err.code === "NOT_FOUND") return null;
192
+ throw err;
193
+ }
194
+ }
195
+ async function contentMap(project, opts) {
196
+ const client = createApiClient();
197
+ await warnIfWinnabilityCoverageIsLow(client, project, opts.format);
198
+ const [classifications, targets] = await Promise.all([
199
+ client.getDomainClassifications(project),
200
+ client.getContentTargets(project, { ownable: true })
201
+ ]);
202
+ const ownable = await Promise.all(
203
+ targets.targets.map(async (target) => ({
204
+ ...target,
205
+ brief: (await tryGetBrief(client, project, target.targetRef))?.brief ?? null
206
+ }))
207
+ );
208
+ if (opts.format === "json") {
209
+ console.log(JSON.stringify({ classifications: classifications.classifications, ownable }, null, 2));
210
+ return;
211
+ }
212
+ if (opts.format === "jsonl") {
213
+ emitJsonl(ownable.map((row) => ({ project, ...row })));
214
+ return;
215
+ }
216
+ const ceded = classifications.classifications.filter(
217
+ (c) => c.competitorType === "ota-aggregator" || c.competitorType === "editorial-media"
218
+ );
219
+ console.log(
220
+ `${classifications.classifications.length} domain(s) classified (${ceded.length} ceded surface${ceded.length === 1 ? "" : "s"}) \xB7 ${ownable.length} ownable target(s)`
221
+ );
222
+ console.log("");
223
+ for (const row of ownable) {
224
+ const score = row.score.toFixed(1).padStart(6);
225
+ const briefMark = row.brief ? "brief \u2713" : "brief \u2014";
226
+ console.log(`${score} ${briefMark} ${row.query}`);
227
+ if (row.brief) {
228
+ console.log(` angle: ${row.brief.angle}`);
229
+ }
230
+ }
231
+ }
232
+ function shouldWarn(check) {
233
+ return check?.status === "warn" || check?.status === "fail";
234
+ }
235
+ async function warnIfWinnabilityCoverageIsLow(client, project, format) {
236
+ if (isMachineFormat(format)) return;
237
+ let check;
238
+ try {
239
+ const report = await client.runDoctor({ project, checkIds: [WINNABILITY_COVERAGE_CHECK_ID] });
240
+ check = report.checks.find((candidate) => candidate.id === WINNABILITY_COVERAGE_CHECK_ID);
241
+ } catch {
242
+ return;
243
+ }
244
+ if (!shouldWarn(check)) return;
245
+ const remediation = check.remediation ? ` ${check.remediation}` : "";
246
+ console.error(`Warning: ${check.summary}${remediation}`);
247
+ }
248
+ export {
249
+ contentMap,
250
+ dismissContentTarget,
251
+ generateContentBrief,
252
+ listContentDismissals,
253
+ listContentGaps,
254
+ listContentSources,
255
+ listContentTargets,
256
+ restoreContentTarget
257
+ };
@@ -0,0 +1,71 @@
1
+ import {
2
+ clearDashboardPassword,
3
+ loadConfigRaw
4
+ } from "./chunk-OFL4PTYU.js";
5
+ import {
6
+ isMachineFormat
7
+ } from "./chunk-HGMYEDAQ.js";
8
+ import {
9
+ anyUsersExist
10
+ } from "./chunk-YSEC6TIB.js";
11
+ import "./chunk-Y4GK7GCV.js";
12
+ import "./chunk-QLPLENDT.js";
13
+ import {
14
+ createClient
15
+ } from "./chunk-MKAC7HKH.js";
16
+ import "./chunk-O4RMPA6H.js";
17
+ import "./chunk-MLKGABMK.js";
18
+
19
+ // src/commands/dashboard.ts
20
+ import fs from "fs";
21
+ function namedAccountsInUse() {
22
+ const database = loadConfigRaw()?.database;
23
+ if (typeof database !== "string" || !fs.existsSync(database)) return false;
24
+ try {
25
+ const db = createClient(database);
26
+ try {
27
+ return anyUsersExist(db);
28
+ } finally {
29
+ db.$client.close();
30
+ }
31
+ } catch {
32
+ return false;
33
+ }
34
+ }
35
+ function nextStepsFor(cleared, namedAccounts) {
36
+ if (namedAccounts) {
37
+ return [
38
+ "This install signs in with named accounts, so the shared dashboard password is not used and clearing it does not change who can sign in.",
39
+ 'To restore an account, run "canonry user list", then "canonry user delete <name>" and "canonry user create".'
40
+ ];
41
+ }
42
+ if (!cleared) {
43
+ return ["If the dashboard still asks for a password, restart the server: it keeps the password it started with."];
44
+ }
45
+ return [
46
+ "Restart the server to apply the reset. Until then it still accepts the old password.",
47
+ // First-run setup on a loopback bind takes the password from any process
48
+ // that can open a loopback connection (docs/deployment.md).
49
+ "Then open the dashboard and create the new password right away. Until one is set, a server that listens only on this machine accepts it from any local connection, so stop any port forwarder (ssh -R, ngrok tcp, tailscale serve --tcp) first."
50
+ ];
51
+ }
52
+ async function resetDashboardPassword(opts) {
53
+ const { cleared, configPath } = clearDashboardPassword();
54
+ const namedAccounts = namedAccountsInUse();
55
+ const nextSteps = nextStepsFor(cleared, namedAccounts);
56
+ if (isMachineFormat(opts.format)) {
57
+ console.log(JSON.stringify({
58
+ reset: cleared,
59
+ configPath,
60
+ restartRequired: cleared && !namedAccounts,
61
+ namedAccounts,
62
+ nextSteps
63
+ }, null, 2));
64
+ return;
65
+ }
66
+ console.log(cleared ? `Dashboard password cleared from ${configPath}.` : `No dashboard password is set in ${configPath}; nothing to reset.`);
67
+ for (const step of nextSteps) console.log(step);
68
+ }
69
+ export {
70
+ resetDashboardPassword
71
+ };
@@ -0,0 +1,75 @@
1
+ import {
2
+ DEFAULT_DEMO_TRUSTED_PROXIES,
3
+ trustedProxiesProblem,
4
+ trustedProxyProblem
5
+ } from "./chunk-RB2F4D3Z.js";
6
+ import {
7
+ CliError,
8
+ isMachineFormat
9
+ } from "./chunk-HGMYEDAQ.js";
10
+ import "./chunk-MLKGABMK.js";
11
+
12
+ // src/commands/demo.ts
13
+ function parseDemoListenOptions(options) {
14
+ const rawPort = options.port ?? "4188";
15
+ const port = Number(rawPort);
16
+ if (!/^\d+$/.test(rawPort) || !Number.isSafeInteger(port) || port < 1 || port > 65535) {
17
+ throw new CliError({ code: "INVALID_PORT", message: "Demo port must be an integer between 1 and 65535.", exitCode: 1 });
18
+ }
19
+ const host = options.host ?? "127.0.0.1";
20
+ if (!host.trim() || /[\s/]/.test(host)) {
21
+ throw new CliError({ code: "INVALID_HOST", message: "Demo host must be an IP address or hostname.", exitCode: 1 });
22
+ }
23
+ return { host, port };
24
+ }
25
+ function parseDemoTrustedProxies(values) {
26
+ if (!values?.length) return [...DEFAULT_DEMO_TRUSTED_PROXIES];
27
+ for (const value of values) {
28
+ const problem = trustedProxyProblem(value);
29
+ if (problem) {
30
+ throw new CliError({ code: "INVALID_TRUST_PROXY", message: `--trust-proxy ${JSON.stringify(value)} ${problem}.`, details: { value }, exitCode: 1 });
31
+ }
32
+ }
33
+ const combined = trustedProxiesProblem(values);
34
+ if (combined) {
35
+ const named = values.map((value) => JSON.stringify(value)).join(", ");
36
+ throw new CliError({ code: "INVALID_TRUST_PROXY", message: `--trust-proxy values ${named} together ${combined}.`, details: { values: [...values] }, exitCode: 1 });
37
+ }
38
+ return [...values];
39
+ }
40
+ async function demoCommand(options) {
41
+ const { host, port } = parseDemoListenOptions(options);
42
+ const trustProxy = parseDemoTrustedProxies(options.trustProxy);
43
+ const { createDemoServer } = await import("./demo-server-XO7PHM4I.js");
44
+ const app = await createDemoServer({ trustProxy });
45
+ let stopping = false;
46
+ const stop = () => {
47
+ if (stopping) return;
48
+ stopping = true;
49
+ void app.close().catch(() => {
50
+ process.exitCode = 1;
51
+ });
52
+ };
53
+ process.once("SIGINT", stop);
54
+ process.once("SIGTERM", stop);
55
+ app.addHook("onClose", async () => {
56
+ process.removeListener("SIGINT", stop);
57
+ process.removeListener("SIGTERM", stop);
58
+ });
59
+ try {
60
+ await app.listen({ host, port });
61
+ } catch (error) {
62
+ await app.close();
63
+ throw error;
64
+ }
65
+ const url = `http://${host.includes(":") ? `[${host}]` : host}:${port}`;
66
+ const result = { status: "ready", mode: "view-only", sampleData: true, url };
67
+ if (isMachineFormat(options.format ?? "text")) console.log(JSON.stringify(result));
68
+ else console.log(`Canonry view-only demo: ${url}
69
+ Fictional sample data. No provider calls or background runs. Ctrl+C to stop.`);
70
+ }
71
+ export {
72
+ demoCommand,
73
+ parseDemoListenOptions,
74
+ parseDemoTrustedProxies
75
+ };
@@ -5,15 +5,30 @@ import {
5
5
  computeFactorAverages,
6
6
  layoutSiteCrawlGraphInput,
7
7
  persistSiteCrawlGraphLayout
8
- } from "./chunk-4YCGZGA3.js";
8
+ } from "./chunk-BYOK6Z4F.js";
9
9
  import {
10
- PACKAGE_VERSION,
11
10
  canonryMcpTools
12
- } from "./chunk-KEATAHXH.js";
11
+ } from "./chunk-RVUCY4ZV.js";
12
+ import "./chunk-EGIZNSDA.js";
13
+ import "./chunk-LK2BG6EX.js";
14
+ import {
15
+ PACKAGE_VERSION
16
+ } from "./chunk-AOJU5LKX.js";
13
17
  import "./chunk-HGMYEDAQ.js";
14
18
  import {
15
19
  HISTORY_WINDOW_RUNS,
16
- IntelligenceService,
20
+ IntelligenceService
21
+ } from "./chunk-KXAOMTXN.js";
22
+ import {
23
+ determineCitationState
24
+ } from "./chunk-FC4XND45.js";
25
+ import {
26
+ apiRoutes,
27
+ assessConversionTrackingIntegrity
28
+ } from "./chunk-YSEC6TIB.js";
29
+ import "./chunk-Y4GK7GCV.js";
30
+ import "./chunk-QLPLENDT.js";
31
+ import {
17
32
  adsAdGroups,
18
33
  adsAds,
19
34
  adsCampaigns,
@@ -22,8 +37,6 @@ import {
22
37
  aiReferralEventsHourly,
23
38
  aiUserFetchEventsHourly,
24
39
  apiKeys,
25
- apiRoutes,
26
- assessConversionTrackingIntegrity,
27
40
  auditLog,
28
41
  backlinkDomains,
29
42
  backlinkSummaries,
@@ -35,7 +48,6 @@ import {
35
48
  conversionTrackingContracts,
36
49
  crawlerEventsHourly,
37
50
  createClient,
38
- determineCitationState,
39
51
  discoveryProbes,
40
52
  discoverySessions,
41
53
  gaAcquisitionDaily,
@@ -87,7 +99,7 @@ import {
87
99
  siteCrawlPages,
88
100
  siteCrawlSnapshots,
89
101
  trafficSources
90
- } from "./chunk-A3WSAAQS.js";
102
+ } from "./chunk-MKAC7HKH.js";
91
103
  import {
92
104
  AI_ENGINE_DOMAINS,
93
105
  RunKinds,
@@ -119,7 +131,8 @@ import {
119
131
  roundPreservingTotal,
120
132
  siteAuditPageFactorSchema,
121
133
  wilsonInterval
122
- } from "./chunk-SFMWHPMX.js";
134
+ } from "./chunk-O4RMPA6H.js";
135
+ import "./chunk-MLKGABMK.js";
123
136
 
124
137
  // src/demo-server.ts
125
138
  import { dirname, join as join2 } from "path";