@canonry/canonry 7.130.0 → 7.131.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 (109) hide show
  1. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +5 -3
  2. package/dist/{activity-VIJVNTMK.js → activity-URKAZ4QI.js} +4 -4
  3. package/dist/{ads-PLZRG4BQ.js → ads-OEKDHREI.js} +4 -4
  4. package/dist/{agent-RFRMOTLE.js → agent-TBU46LO6.js} +6 -6
  5. package/dist/{agent-ask-CB756SUB.js → agent-ask-EDJZGROO.js} +25 -21
  6. package/dist/agent-conversations-BQKCD4CA.js +44 -0
  7. package/dist/{agent-journeys-PLYAVLGB.js → agent-journeys-ASY5XCAJ.js} +3 -3
  8. package/dist/agent-memory-HAGNNLCP.js +74 -0
  9. package/dist/agent-providers-WUDOCAHF.js +49 -0
  10. package/dist/agent-transcript-4MAQ7NCM.js +62 -0
  11. package/dist/{analytics-W6B2FQSA.js → analytics-RYRF5TFC.js} +3 -3
  12. package/dist/{answerability-BDOOPOJF.js → answerability-7VPMCZHE.js} +3 -3
  13. package/dist/{apply-LCANKKT5.js → apply-BNTPH5FW.js} +8 -5
  14. package/dist/{backfill-E3EVDP2O.js → backfill-2DYJLCOU.js} +5 -5
  15. package/dist/{backlinks-ZXSN3XNV.js → backlinks-5HZTCZFW.js} +11 -6
  16. package/dist/{bing-FMDKRCXN.js → bing-S6BOIOTS.js} +31 -17
  17. package/dist/{bootstrap-IHKKYDBO.js → bootstrap-EITWL66P.js} +6 -6
  18. package/dist/{cdp-ASPLW35M.js → cdp-TY2TZB7J.js} +13 -7
  19. package/dist/{chunk-MI575M4K.js → chunk-3CDHCDCE.js} +25 -24
  20. package/dist/{chunk-JUZ4ZCOX.js → chunk-3GAJD5NP.js} +3 -3
  21. package/dist/{chunk-MARIMDMX.js → chunk-3LXRY57V.js} +60 -48
  22. package/dist/{chunk-XVEPR3ZC.js → chunk-3STPYNCP.js} +3 -3
  23. package/dist/{chunk-Z77D43M5.js → chunk-623X526L.js} +1 -1
  24. package/dist/{chunk-76N4UIAF.js → chunk-63FHJJUO.js} +435 -444
  25. package/dist/chunk-APKBR2BP.js +40 -0
  26. package/dist/{chunk-VEDGR4LZ.js → chunk-BJWPYUKT.js} +1 -1
  27. package/dist/{chunk-37MF5NMW.js → chunk-CBREBUUV.js} +1 -1
  28. package/dist/{chunk-NUYKLS2R.js → chunk-CUXA47XW.js} +2 -2
  29. package/dist/{chunk-HH6FQW5W.js → chunk-DYDATNE5.js} +6 -3
  30. package/dist/{chunk-NUBJTRIV.js → chunk-HMCDVKHS.js} +4 -4
  31. package/dist/{chunk-S6X3HHSN.js → chunk-IPUZGRSN.js} +2 -2
  32. package/dist/{chunk-WZPKPA6I.js → chunk-KJX5CMPC.js} +1 -1
  33. package/dist/{chunk-4ISL4JNK.js → chunk-LXFLUFQT.js} +2 -2
  34. package/dist/{chunk-5U4HCSI6.js → chunk-NK4G4JPQ.js} +2 -2
  35. package/dist/{chunk-JMJSAK2H.js → chunk-NYZH7SM2.js} +2 -2
  36. package/dist/{chunk-MQFH765X.js → chunk-P4ETUNQR.js} +3 -3
  37. package/dist/{chunk-VON4PHNS.js → chunk-RGT2S3VS.js} +35 -15
  38. package/dist/{chunk-KQQERQJ2.js → chunk-RSB3X7UR.js} +2 -2
  39. package/dist/{chunk-52J7GFCK.js → chunk-T6CABZ3N.js} +1 -1
  40. package/dist/{chunk-GVCL4XBU.js → chunk-UFVVOJU3.js} +2 -2
  41. package/dist/{chunk-BERGWPA7.js → chunk-WEJOT2VP.js} +1 -1
  42. package/dist/{chunk-4KITKJPN.js → chunk-WIQBXZMU.js} +4 -4
  43. package/dist/{chunk-ZHWJJVCT.js → chunk-X3ES2XOJ.js} +1 -1
  44. package/dist/{chunk-QRIKJT6Y.js → chunk-Y7JEJNNS.js} +32 -3
  45. package/dist/{chunk-GXLF45FF.js → chunk-ZSVQTHX3.js} +7 -6
  46. package/dist/{citations-YWXR3WBL.js → citations-ERRYYKNY.js} +7 -5
  47. package/dist/{cli-catalog-RT3QPDLR.js → cli-catalog-ETUQDYOX.js} +3 -3
  48. package/dist/{cli-commands-6J6A5ULK.js → cli-commands-ORLKC2XM.js} +7 -6
  49. package/dist/cli.js +30 -19
  50. package/dist/{competitor-6ZTA2SZH.js → competitor-IC6KRZAD.js} +7 -4
  51. package/dist/{content-DJYGQ5CP.js → content-3Y6ZKQHG.js} +6 -5
  52. package/dist/{dashboard-F7NFKQLL.js → dashboard-XBS4EVSA.js} +4 -4
  53. package/dist/{demo-653PUOIB.js → demo-7D4W32J6.js} +2 -2
  54. package/dist/{demo-server-PVBLYPC5.js → demo-server-CGOD7EPX.js} +5 -5
  55. package/dist/{discover-3E7QM2TL.js → discover-34E5JIM5.js} +3 -3
  56. package/dist/{discover-eval-NAZPA6PV.js → discover-eval-TLH2MMNK.js} +41 -16
  57. package/dist/{doctor-OFFSPNBK.js → doctor-SGJQPWRI.js} +3 -3
  58. package/dist/{evidence-VOSSML2G.js → evidence-TFFVSNEL.js} +6 -5
  59. package/dist/{export-cmd-IVACTDSV.js → export-cmd-YRG7CEVX.js} +3 -3
  60. package/dist/{ga-BX4C7TPI.js → ga-VVJWYWQX.js} +6 -5
  61. package/dist/{gbp-SV3J2VG3.js → gbp-RYA62WDX.js} +23 -10
  62. package/dist/{google-J23OD7TR.js → google-5HRSXPUF.js} +13 -12
  63. package/dist/{google-marketing-TTLXMDMD.js → google-marketing-UGMDLFPE.js} +1 -1
  64. package/dist/{health-cmd-26AHD5XL.js → health-cmd-WUBFEQX6.js} +3 -3
  65. package/dist/{history-QWBRFDQR.js → history-5GFG76UO.js} +5 -3
  66. package/dist/index.d.ts +29 -29
  67. package/dist/index.js +15 -15
  68. package/dist/{init-URQ4E3XR.js → init-CHZSBQOK.js} +10 -9
  69. package/dist/{insights-PMTHHZ2H.js → insights-LWLKXKNO.js} +3 -3
  70. package/dist/{intelligence-service-GPA7IGDX.js → intelligence-service-LMVQQRPN.js} +2 -2
  71. package/dist/{journeys-IA7TF753.js → journeys-IQLWLZBY.js} +3 -3
  72. package/dist/{keys-DOHLZTRI.js → keys-3VVORLK2.js} +3 -3
  73. package/dist/{keyword-3C2ZU6OB.js → keyword-3MWGUBHL.js} +7 -4
  74. package/dist/{logs-P7VRVZ5N.js → logs-PSV4DZ6F.js} +3 -3
  75. package/dist/{mcp-6NA62OAY.js → mcp-NNBM3MLW.js} +5 -4
  76. package/dist/mcp.js +8 -8
  77. package/dist/{measurement-plan-RHKCARVE.js → measurement-plan-M4VLA2ZN.js} +5 -4
  78. package/dist/{notify-ODCY7TD3.js → notify-EDSJINE5.js} +3 -3
  79. package/dist/{organic-evidence-76P5AYB3.js → organic-evidence-VBT6URMQ.js} +3 -3
  80. package/dist/{overview-5T776SEB.js → overview-LRNI342W.js} +6 -6
  81. package/dist/{project-ITMGW45M.js → project-HO4GOEC4.js} +3 -3
  82. package/dist/{project-setup-A3Q6ZX73.js → project-setup-AXVIZND6.js} +4 -4
  83. package/dist/{query-3QAQITK3.js → query-E2D2K6MD.js} +8 -5
  84. package/dist/{research-R74N3VRL.js → research-Z3IZQH2M.js} +3 -3
  85. package/dist/{results-export-23GY45AY.js → results-export-TVWWLJQA.js} +3 -3
  86. package/dist/{run-ID66JYBN.js → run-RJDJPROH.js} +4 -4
  87. package/dist/{schedule-HZ2CRUAL.js → schedule-NVDN72YG.js} +3 -3
  88. package/dist/{search-DM5WWMTE.js → search-A4PBZ53D.js} +3 -3
  89. package/dist/{serve-3QDHKCHE.js → serve-7WPMQUVW.js} +16 -16
  90. package/dist/{session-ZN3YZI2D.js → session-VPJH4TRC.js} +8 -8
  91. package/dist/{settings-SIEKVYD7.js → settings-EYEXRKTM.js} +5 -5
  92. package/dist/{sitemaps-M4IAZLK2.js → sitemaps-4HCWZJOZ.js} +3 -3
  93. package/dist/{skills-J6LWTNU5.js → skills-GPYMDDRH.js} +2 -2
  94. package/dist/{snapshot-SM3BVX5M.js → snapshot-SNR7KBK4.js} +3 -3
  95. package/dist/{status-BHJJOUCK.js → status-VTQJVZFU.js} +12 -6
  96. package/dist/{support-FPXXXJPZ.js → support-H7ANOX67.js} +1 -1
  97. package/dist/{technical-aeo-4DJWWPUN.js → technical-aeo-IDMFUDXP.js} +7 -5
  98. package/dist/{telemetry-LKVQUSO7.js → telemetry-DA43ILAA.js} +4 -4
  99. package/dist/{tools-Y67PVNIJ.js → tools-F3FZEG5K.js} +7 -7
  100. package/dist/{traffic-QSZYZHFW.js → traffic-EPWP3D2K.js} +21 -29
  101. package/dist/{trends-WIHWJVJR.js → trends-IVYSKMND.js} +3 -3
  102. package/dist/{users-HQOPQRTP.js → users-ZJMBGWUF.js} +3 -3
  103. package/dist/{visibility-stats-MCY5CAUC.js → visibility-stats-M2I3SUES.js} +11 -5
  104. package/dist/{wordpress-IB5YOJSM.js → wordpress-BGIOJPIF.js} +3 -3
  105. package/package.json +1 -1
  106. package/dist/agent-conversations-RRI7T74B.js +0 -51
  107. package/dist/agent-memory-R5Q7DLRZ.js +0 -91
  108. package/dist/agent-providers-HNMGZ7GY.js +0 -58
  109. package/dist/agent-transcript-N6ZBTF72.js +0 -76
package/dist/cli.js CHANGED
@@ -1,14 +1,15 @@
1
1
  #!/usr/bin/env node --import tsx
2
2
  import {
3
3
  REGISTERED_CLI_COMMANDS
4
- } from "./chunk-76N4UIAF.js";
4
+ } from "./chunk-63FHJJUO.js";
5
5
  import "./chunk-6GO5VVAC.js";
6
6
  import {
7
7
  buildSetupState,
8
8
  runPendingServeHandoff
9
- } from "./chunk-5U4HCSI6.js";
9
+ } from "./chunk-NK4G4JPQ.js";
10
10
  import "./chunk-VJWDBFSL.js";
11
- import "./chunk-MARIMDMX.js";
11
+ import "./chunk-3LXRY57V.js";
12
+ import "./chunk-APKBR2BP.js";
12
13
  import "./chunk-TSENU4GG.js";
13
14
  import "./chunk-ALU56PI7.js";
14
15
  import {
@@ -24,33 +25,34 @@ import {
24
25
  showFirstRunNotice,
25
26
  trackCliCommandFinished,
26
27
  trackEvent
27
- } from "./chunk-WZPKPA6I.js";
28
+ } from "./chunk-KJX5CMPC.js";
28
29
  import {
29
30
  autoSyncSkills,
30
31
  formatAutoSyncNotice
31
- } from "./chunk-JMJSAK2H.js";
32
- import "./chunk-KQQERQJ2.js";
33
- import "./chunk-52J7GFCK.js";
32
+ } from "./chunk-NYZH7SM2.js";
33
+ import "./chunk-RSB3X7UR.js";
34
+ import "./chunk-T6CABZ3N.js";
34
35
  import {
35
36
  accessFilterFromArgs,
36
37
  dispatchRegisteredCommand,
37
38
  printCliCatalog
38
- } from "./chunk-MQFH765X.js";
39
+ } from "./chunk-P4ETUNQR.js";
39
40
  import {
40
41
  resolveCliAccess
41
- } from "./chunk-ZHWJJVCT.js";
42
+ } from "./chunk-X3ES2XOJ.js";
42
43
  import "./chunk-Z7IUAJOF.js";
43
- import "./chunk-Z77D43M5.js";
44
+ import "./chunk-623X526L.js";
44
45
  import "./chunk-ZHXPH7WB.js";
45
46
  import "./chunk-AOJU5LKX.js";
46
47
  import {
47
48
  CliError,
48
- EXIT_SYSTEM_ERROR,
49
+ exitCodeFor,
49
50
  isMachineFormat,
50
51
  printCliError,
51
52
  usageError
52
- } from "./chunk-QRIKJT6Y.js";
53
+ } from "./chunk-Y7JEJNNS.js";
53
54
  import {
55
+ AppError,
54
56
  OperationAccesses
55
57
  } from "./chunk-FGEBFVHB.js";
56
58
 
@@ -204,6 +206,11 @@ var TELEMETRY_ERROR_CODES = /* @__PURE__ */ new Set([
204
206
  "RUN_FILL_IN_PROGRESS",
205
207
  "RUN_FILL_INCOMPLETE",
206
208
  "RUN_FAILED",
209
+ // A batch command that failed for some of its items, with the most severe
210
+ // of their exit codes: `run --all` could not start a run for a project, or
211
+ // `bing refresh` could not re-inspect a URL.
212
+ "RUNS_NOT_STARTED",
213
+ "BING_REFRESH_INCOMPLETE",
207
214
  "API_ERROR",
208
215
  "CLI_ERROR",
209
216
  "CLI_USAGE_ERROR",
@@ -217,12 +224,16 @@ var TELEMETRY_ERROR_CODES = /* @__PURE__ */ new Set([
217
224
  "DAEMON_START_TIMEOUT",
218
225
  "UNEXPECTED_RESPONSE_FORMAT",
219
226
  "STORED_ONLY_REFUSED",
220
- "CONFIG_REQUIRED"
227
+ "CONFIG_REQUIRED",
228
+ // `agent ask` streamed a turn that did not finish.
229
+ "AGENT_TURN_FAILED",
230
+ // A file or stdin the caller named could not be read (`cli-input.ts`).
231
+ "FILE_READ_ERROR"
221
232
  ]);
222
233
  function telemetryErrorCode(err) {
223
- if (!(err instanceof CliError)) return "CLI_ERROR";
234
+ if (!(err instanceof CliError || err instanceof AppError)) return "CLI_ERROR";
224
235
  if (TELEMETRY_ERROR_CODES.has(err.code)) return err.code;
225
- return typeof err.details?.httpStatus === "number" ? "API_ERROR" : "CLI_ERROR";
236
+ return err instanceof CliError && typeof err.details?.httpStatus === "number" ? "API_ERROR" : "CLI_ERROR";
226
237
  }
227
238
  async function runCli(args = process.argv.slice(2)) {
228
239
  args = normalizeLeadingGlobalOptions(args);
@@ -234,7 +245,7 @@ async function runCli(args = process.argv.slice(2)) {
234
245
  return 0;
235
246
  } catch (error) {
236
247
  printCliError(error, format);
237
- return error instanceof CliError ? error.exitCode : EXIT_SYSTEM_ERROR;
248
+ return exitCodeFor(error);
238
249
  }
239
250
  }
240
251
  if (args.includes("--version") || args.includes("-v")) {
@@ -254,7 +265,7 @@ async function runCli(args = process.argv.slice(2)) {
254
265
  return 0;
255
266
  } catch (error) {
256
267
  printCliError(error, format);
257
- return error instanceof CliError ? error.exitCode : EXIT_SYSTEM_ERROR;
268
+ return exitCodeFor(error);
258
269
  }
259
270
  }
260
271
  if (command === "demo") {
@@ -263,7 +274,7 @@ async function runCli(args = process.argv.slice(2)) {
263
274
  return 0;
264
275
  } catch (error) {
265
276
  printCliError(error, format);
266
- return error instanceof CliError ? error.exitCode : EXIT_SYSTEM_ERROR;
277
+ return exitCodeFor(error);
267
278
  }
268
279
  }
269
280
  if (!storedOnlyMode && !isHelpRequest && command !== "telemetry" && command !== "init" && isTelemetryEnabled() && isFirstRun()) {
@@ -338,7 +349,7 @@ Run "cnry --help" for usage.`, {
338
349
  });
339
350
  }
340
351
  printCliError(err, format);
341
- return err instanceof CliError ? err.exitCode : EXIT_SYSTEM_ERROR;
352
+ return exitCodeFor(err);
342
353
  }
343
354
  }
344
355
  async function main(args = process.argv.slice(2)) {
@@ -1,7 +1,10 @@
1
+ import {
2
+ readInputText
3
+ } from "./chunk-APKBR2BP.js";
1
4
  import {
2
5
  createApiClient
3
- } from "./chunk-KQQERQJ2.js";
4
- import "./chunk-52J7GFCK.js";
6
+ } from "./chunk-RSB3X7UR.js";
7
+ import "./chunk-T6CABZ3N.js";
5
8
  import {
6
9
  emitJsonl
7
10
  } from "./chunk-Z7IUAJOF.js";
@@ -10,7 +13,7 @@ import {
10
13
  CliError,
11
14
  isMachineFormat,
12
15
  usageError
13
- } from "./chunk-QRIKJT6Y.js";
16
+ } from "./chunk-Y7JEJNNS.js";
14
17
  import {
15
18
  CompetitorChangeKinds,
16
19
  CompetitorShareImpactCaveats,
@@ -97,7 +100,7 @@ async function importCompetitors(project, filePath, format, completion = {}) {
97
100
  if (!fs.existsSync(filePath)) {
98
101
  throw new CliError({ code: "COMPETITOR_IMPORT_FILE_NOT_FOUND", message: `File not found: ${filePath}`, details: { filePath } });
99
102
  }
100
- const content = fs.readFileSync(filePath, "utf8");
103
+ const content = readInputText(filePath, `The competitor import file ${filePath}`);
101
104
  let entries;
102
105
  if (filePath.toLowerCase().endsWith(".json")) {
103
106
  try {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-KQQERQJ2.js";
4
- import "./chunk-52J7GFCK.js";
3
+ } from "./chunk-RSB3X7UR.js";
4
+ import "./chunk-T6CABZ3N.js";
5
5
  import {
6
6
  emitJsonl
7
7
  } from "./chunk-Z7IUAJOF.js";
@@ -10,10 +10,11 @@ import {
10
10
  CliError,
11
11
  isMachineFormat,
12
12
  usageError
13
- } from "./chunk-QRIKJT6Y.js";
13
+ } from "./chunk-Y7JEJNNS.js";
14
14
  import {
15
15
  contentTargetDismissRequestSchema,
16
- formatPercent
16
+ formatPercent,
17
+ shellQuote
17
18
  } from "./chunk-FGEBFVHB.js";
18
19
 
19
20
  // src/commands/content.ts
@@ -79,7 +80,7 @@ async function listContentTargets(project, opts) {
79
80
  return;
80
81
  }
81
82
  if (response.targets.length === 0) {
82
- console.log("No content targets surfaced. (Run `canonry run` to generate fresh signal.)");
83
+ console.log(`No content targets surfaced. (Run \`canonry run ${shellQuote(project)}\` to generate fresh signal.)`);
83
84
  return;
84
85
  }
85
86
  console.log(
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  clearDashboardPassword,
3
3
  loadConfigRaw
4
- } from "./chunk-52J7GFCK.js";
4
+ } from "./chunk-T6CABZ3N.js";
5
5
  import {
6
6
  isMachineFormat
7
- } from "./chunk-QRIKJT6Y.js";
7
+ } from "./chunk-Y7JEJNNS.js";
8
8
  import {
9
9
  anyUsersExist
10
- } from "./chunk-NUBJTRIV.js";
10
+ } from "./chunk-HMCDVKHS.js";
11
11
  import "./chunk-7PTUA52C.js";
12
12
  import "./chunk-C4JM5HJW.js";
13
13
  import {
@@ -35,7 +35,7 @@ function nextStepsFor(cleared, namedAccounts) {
35
35
  if (namedAccounts) {
36
36
  return [
37
37
  "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.",
38
- 'To restore an account, run "canonry user list", then "canonry user delete <name>" and "canonry user create".'
38
+ 'To restore an account, run "canonry user list", then "canonry user delete <name>" and "canonry user create --name <name> --role <admin|viewer>".'
39
39
  ];
40
40
  }
41
41
  if (!cleared) {
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  CliError,
8
8
  isMachineFormat
9
- } from "./chunk-QRIKJT6Y.js";
9
+ } from "./chunk-Y7JEJNNS.js";
10
10
  import "./chunk-FGEBFVHB.js";
11
11
 
12
12
  // src/commands/demo.ts
@@ -40,7 +40,7 @@ function parseDemoTrustedProxies(values) {
40
40
  async function demoCommand(options) {
41
41
  const { host, port } = parseDemoListenOptions(options);
42
42
  const trustProxy = parseDemoTrustedProxies(options.trustProxy);
43
- const { createDemoServer } = await import("./demo-server-PVBLYPC5.js");
43
+ const { createDemoServer } = await import("./demo-server-CGOD7EPX.js");
44
44
  const app = await createDemoServer({ trustProxy });
45
45
  let stopping = false;
46
46
  const stop = () => {
@@ -8,18 +8,18 @@ import {
8
8
  } from "./chunk-PABT3HDP.js";
9
9
  import {
10
10
  canonryMcpTools
11
- } from "./chunk-S6X3HHSN.js";
11
+ } from "./chunk-IPUZGRSN.js";
12
12
  import "./chunk-UX3HJV2V.js";
13
- import "./chunk-VEDGR4LZ.js";
13
+ import "./chunk-BJWPYUKT.js";
14
14
  import "./chunk-ZHXPH7WB.js";
15
15
  import {
16
16
  PACKAGE_VERSION
17
17
  } from "./chunk-AOJU5LKX.js";
18
- import "./chunk-QRIKJT6Y.js";
18
+ import "./chunk-Y7JEJNNS.js";
19
19
  import {
20
20
  HISTORY_WINDOW_RUNS,
21
21
  IntelligenceService
22
- } from "./chunk-BERGWPA7.js";
22
+ } from "./chunk-WEJOT2VP.js";
23
23
  import {
24
24
  determineCitationState
25
25
  } from "./chunk-LJ65QBRP.js";
@@ -27,7 +27,7 @@ import "./chunk-VRY5M7CR.js";
27
27
  import {
28
28
  apiRoutes,
29
29
  assessConversionTrackingIntegrity
30
- } from "./chunk-NUBJTRIV.js";
30
+ } from "./chunk-HMCDVKHS.js";
31
31
  import "./chunk-7PTUA52C.js";
32
32
  import "./chunk-C4JM5HJW.js";
33
33
  import {
@@ -5,8 +5,8 @@ import {
5
5
  } from "./chunk-QHQZ2226.js";
6
6
  import {
7
7
  createApiClient
8
- } from "./chunk-KQQERQJ2.js";
9
- import "./chunk-52J7GFCK.js";
8
+ } from "./chunk-RSB3X7UR.js";
9
+ import "./chunk-T6CABZ3N.js";
10
10
  import {
11
11
  emitJsonl
12
12
  } from "./chunk-Z7IUAJOF.js";
@@ -14,7 +14,7 @@ import "./chunk-AOJU5LKX.js";
14
14
  import {
15
15
  CliError,
16
16
  isMachineFormat
17
- } from "./chunk-QRIKJT6Y.js";
17
+ } from "./chunk-Y7JEJNNS.js";
18
18
  import {
19
19
  DiscoveryPromoteCompetitorSkipReasons,
20
20
  describeError
@@ -1,12 +1,16 @@
1
+ import {
2
+ readInputDocument
3
+ } from "./chunk-APKBR2BP.js";
1
4
  import {
2
5
  createApiClient
3
- } from "./chunk-KQQERQJ2.js";
4
- import "./chunk-52J7GFCK.js";
6
+ } from "./chunk-RSB3X7UR.js";
7
+ import "./chunk-T6CABZ3N.js";
5
8
  import "./chunk-AOJU5LKX.js";
6
9
  import {
7
10
  CliError,
8
- EXIT_USER_ERROR
9
- } from "./chunk-QRIKJT6Y.js";
11
+ EXIT_USER_ERROR,
12
+ parseCliInput
13
+ } from "./chunk-Y7JEJNNS.js";
10
14
  import "./chunk-FGEBFVHB.js";
11
15
 
12
16
  // src/commands/discover-eval.ts
@@ -14,6 +18,7 @@ import fs from "fs";
14
18
  import path from "path";
15
19
 
16
20
  // src/discovery-eval.ts
21
+ import { z } from "zod";
17
22
  var DISCOVERY_EVAL_PANEL = [
18
23
  {
19
24
  slug: "eval-local-single-intent",
@@ -56,6 +61,22 @@ var DISCOVERY_EVAL_PANEL = [
56
61
  locations: []
57
62
  }
58
63
  ];
64
+ var discoveryEvalBaselineSchema = z.object({
65
+ capturedAt: z.string(),
66
+ scorecards: z.array(z.object({
67
+ shape: z.string(),
68
+ seedCountRaw: z.number(),
69
+ canonicalCount: z.number(),
70
+ canonicalCountTruncated: z.boolean(),
71
+ retention: z.number(),
72
+ brandShare: z.number(),
73
+ groundingShare: z.number(),
74
+ bandPairFraction: z.number().nullable(),
75
+ probeCount: z.number(),
76
+ warning: z.string().nullable(),
77
+ durationSeconds: z.number().nullable()
78
+ }))
79
+ });
59
80
  var EVAL_CANONICAL_FLOOR = 8;
60
81
  var EVAL_BANDS = {
61
82
  /** canonicalCount must be >= baseline * this factor (and >= the floor). */
@@ -226,6 +247,17 @@ function renderHuman(scorecards, verdict) {
226
247
  console.log("No baseline compared (wrote or missing baseline).");
227
248
  }
228
249
  }
250
+ function readBaseline(baselinePath) {
251
+ if (!fs.existsSync(baselinePath)) {
252
+ throw new CliError({
253
+ code: "EVAL_NO_BASELINE",
254
+ message: `no baseline at ${baselinePath}; run with --update-baseline to capture one`,
255
+ exitCode: EXIT_USER_ERROR
256
+ });
257
+ }
258
+ const what = "The discovery eval baseline";
259
+ return parseCliInput(discoveryEvalBaselineSchema, readInputDocument(baselinePath, what, "json"), what, { source: baselinePath });
260
+ }
229
261
  async function discoverEvalWithClient(client, opts) {
230
262
  const selected = opts.shapes && opts.shapes.length > 0 ? DISCOVERY_EVAL_PANEL.filter((s) => opts.shapes.includes(s.slug)) : DISCOVERY_EVAL_PANEL;
231
263
  if (selected.length === 0) {
@@ -235,11 +267,12 @@ async function discoverEvalWithClient(client, opts) {
235
267
  exitCode: EXIT_USER_ERROR
236
268
  });
237
269
  }
238
- const scorecards = await runDiscoveryEvalPanel(client, selected, opts);
239
270
  const baselinePath = path.resolve(opts.baseline ?? DEFAULT_BASELINE_PATH);
240
- if (opts.updateBaseline) {
241
- const baseline2 = { capturedAt: (/* @__PURE__ */ new Date()).toISOString(), scorecards };
242
- fs.writeFileSync(baselinePath, JSON.stringify(baseline2, null, 2) + "\n");
271
+ const baseline = opts.updateBaseline ? void 0 : readBaseline(baselinePath);
272
+ const scorecards = await runDiscoveryEvalPanel(client, selected, opts);
273
+ if (baseline === void 0) {
274
+ const written = { capturedAt: (/* @__PURE__ */ new Date()).toISOString(), scorecards };
275
+ fs.writeFileSync(baselinePath, JSON.stringify(written, null, 2) + "\n");
243
276
  if (opts.format === "json" || opts.format === "jsonl") {
244
277
  console.log(JSON.stringify({ scorecards, baselineWritten: baselinePath }, null, 2));
245
278
  } else {
@@ -248,14 +281,6 @@ async function discoverEvalWithClient(client, opts) {
248
281
  }
249
282
  return;
250
283
  }
251
- if (!fs.existsSync(baselinePath)) {
252
- throw new CliError({
253
- code: "EVAL_NO_BASELINE",
254
- message: `no baseline at ${baselinePath}; run with --update-baseline to capture one`,
255
- exitCode: EXIT_USER_ERROR
256
- });
257
- }
258
- const baseline = JSON.parse(fs.readFileSync(baselinePath, "utf8"));
259
284
  const verdict = compareToBaseline(scorecards, baseline);
260
285
  if (opts.format === "json" || opts.format === "jsonl") {
261
286
  console.log(JSON.stringify({ scorecards, verdict, baseline: { capturedAt: baseline.capturedAt } }, null, 2));
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-KQQERQJ2.js";
4
- import "./chunk-52J7GFCK.js";
3
+ } from "./chunk-RSB3X7UR.js";
4
+ import "./chunk-T6CABZ3N.js";
5
5
  import {
6
6
  emitJsonl
7
7
  } from "./chunk-Z7IUAJOF.js";
@@ -9,7 +9,7 @@ import "./chunk-AOJU5LKX.js";
9
9
  import {
10
10
  CliError,
11
11
  EXIT_USER_ERROR
12
- } from "./chunk-QRIKJT6Y.js";
12
+ } from "./chunk-Y7JEJNNS.js";
13
13
  import {
14
14
  CheckScopes,
15
15
  CheckStatuses
@@ -1,16 +1,17 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-KQQERQJ2.js";
4
- import "./chunk-52J7GFCK.js";
3
+ } from "./chunk-RSB3X7UR.js";
4
+ import "./chunk-T6CABZ3N.js";
5
5
  import {
6
6
  emitJsonl
7
7
  } from "./chunk-Z7IUAJOF.js";
8
8
  import "./chunk-AOJU5LKX.js";
9
- import "./chunk-QRIKJT6Y.js";
9
+ import "./chunk-Y7JEJNNS.js";
10
10
  import {
11
11
  CitationStates,
12
12
  citationStateToCited,
13
- isCitationStateMeasured
13
+ isCitationStateMeasured,
14
+ shellQuote
14
15
  } from "./chunk-FGEBFVHB.js";
15
16
 
16
17
  // src/commands/evidence.ts
@@ -45,7 +46,7 @@ async function showEvidence(project, format) {
45
46
  return;
46
47
  }
47
48
  if (timeline.length === 0) {
48
- console.log('No query evidence yet. Trigger a run first with "canonry run".');
49
+ console.log(`No query evidence yet. Trigger a run first with "canonry run ${shellQuote(project)}".`);
49
50
  return;
50
51
  }
51
52
  console.log(`Evidence: ${project}
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-KQQERQJ2.js";
4
- import "./chunk-52J7GFCK.js";
3
+ } from "./chunk-RSB3X7UR.js";
4
+ import "./chunk-T6CABZ3N.js";
5
5
  import "./chunk-AOJU5LKX.js";
6
6
  import {
7
7
  isEndpointMissing,
8
8
  isMachineFormat
9
- } from "./chunk-QRIKJT6Y.js";
9
+ } from "./chunk-Y7JEJNNS.js";
10
10
  import {
11
11
  isRedactedNotificationUrl
12
12
  } from "./chunk-FGEBFVHB.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-KQQERQJ2.js";
4
- import "./chunk-52J7GFCK.js";
3
+ } from "./chunk-RSB3X7UR.js";
4
+ import "./chunk-T6CABZ3N.js";
5
5
  import {
6
6
  emitJsonl
7
7
  } from "./chunk-Z7IUAJOF.js";
@@ -10,7 +10,7 @@ import {
10
10
  CliError,
11
11
  isMachineFormat,
12
12
  usageError
13
- } from "./chunk-QRIKJT6Y.js";
13
+ } from "./chunk-Y7JEJNNS.js";
14
14
  import {
15
15
  GA_OVERVIEW_METRICS,
16
16
  GA_OVERVIEW_METRIC_ORDER,
@@ -25,7 +25,8 @@ import {
25
25
  gaAcquisitionQuerySchema,
26
26
  gaSearchLandingHasSearchData,
27
27
  gaSearchLandingPageLabel,
28
- isGaOverviewWindow
28
+ isGaOverviewWindow,
29
+ shellQuote
29
30
  } from "./chunk-FGEBFVHB.js";
30
31
 
31
32
  // src/commands/ga.ts
@@ -99,7 +100,7 @@ async function gaConnect(project, opts) {
99
100
  if (result.authMethod === "service-account" && result.clientEmail) {
100
101
  console.log(` Auth: service account (${result.clientEmail})`);
101
102
  } else {
102
- console.log(` Auth: OAuth (canonry google connect --type ga4)`);
103
+ console.log(` Auth: OAuth (canonry google connect ${shellQuote(project)} --type ga4)`);
103
104
  }
104
105
  }
105
106
  async function gaDisconnect(project, format) {
@@ -1,15 +1,17 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-KQQERQJ2.js";
4
- import "./chunk-52J7GFCK.js";
3
+ } from "./chunk-RSB3X7UR.js";
4
+ import "./chunk-T6CABZ3N.js";
5
5
  import "./chunk-AOJU5LKX.js";
6
6
  import {
7
7
  isMachineFormat
8
- } from "./chunk-QRIKJT6Y.js";
8
+ } from "./chunk-Y7JEJNNS.js";
9
9
  import {
10
+ describeError,
10
11
  formatGbpMetricLabel,
11
12
  formatPercent,
12
13
  gbpLocalPostCreateSchema,
14
+ shellQuote,
13
15
  validationError
14
16
  } from "./chunk-FGEBFVHB.js";
15
17
 
@@ -155,7 +157,7 @@ async function gbpSync(project, opts) {
155
157
  console.log(JSON.stringify({ runId, status }, null, 2));
156
158
  return;
157
159
  }
158
- console.log(`GBP sync started (run ${runId}). Use \`canonry runs get ${runId}\` to check status, or pass --wait.`);
160
+ console.log(`GBP sync started (run ${runId}). Use \`canonry run show ${runId}\` to check status, or pass --wait.`);
159
161
  return;
160
162
  }
161
163
  const terminal = /* @__PURE__ */ new Set(["completed", "partial", "failed", "cancelled"]);
@@ -256,7 +258,7 @@ async function gbpAttributes(project, opts) {
256
258
  return;
257
259
  }
258
260
  if (response.attributes.length === 0) {
259
- console.log('No attributes data. Run "canonry gbp sync" to capture owner-set attributes.');
261
+ console.log(`No attributes data. Run "canonry gbp sync ${shellQuote(project)}" to capture owner-set attributes.`);
260
262
  return;
261
263
  }
262
264
  console.log(`${response.total} location(s) with owner-set attributes:`);
@@ -281,7 +283,7 @@ async function gbpPlaces(project, opts) {
281
283
  return;
282
284
  }
283
285
  if (response.places.length === 0) {
284
- console.log('No Places data \u2014 set a Places API key (places.apiKey / GOOGLE_PLACES_API_KEY) and run "canonry gbp sync" for lodging locations.');
286
+ console.log(`No Places data \u2014 set a Places API key (places.apiKey / GOOGLE_PLACES_API_KEY) and run "canonry gbp sync ${shellQuote(project)}" for lodging locations.`);
285
287
  return;
286
288
  }
287
289
  console.log(`${response.total} Places listing snapshot(s) \u2014 the amenities Google's public listing advertises:`);
@@ -302,7 +304,7 @@ async function gbpReviews(project, opts) {
302
304
  return;
303
305
  }
304
306
  if (response.locations.length === 0 && response.reviews.length === 0) {
305
- console.log('No reviews yet. Run "canonry gbp sync" first.');
307
+ console.log(`No reviews yet. Run "canonry gbp sync ${shellQuote(project)}" first.`);
306
308
  return;
307
309
  }
308
310
  const names = new Map(response.locations.map((loc) => [loc.locationName, loc.displayName]));
@@ -350,7 +352,7 @@ async function gbpSummary(project, opts) {
350
352
  console.log("Performance (totals, last-7d vs prior-7d over complete days):");
351
353
  const metrics = Object.keys(s.performance.totals).sort((a, b) => formatGbpMetricLabel(a).localeCompare(formatGbpMetricLabel(b)));
352
354
  if (metrics.length === 0) {
353
- console.log(" (no performance data \u2014 run `canonry gbp sync` first)");
355
+ console.log(` (no performance data \u2014 run \`canonry gbp sync ${shellQuote(project)}\` first)`);
354
356
  } else {
355
357
  for (const m of metrics) {
356
358
  console.log(` ${formatGbpMetricLabel(m).padEnd(28)} ${String(s.performance.totals[m]).padStart(8)} ${fmtDelta(s.performance.deltaPct[m] ?? null)}`);
@@ -380,9 +382,20 @@ async function gbpLocalPosts(project, action, opts) {
380
382
  } else if (action === "reviews") result = await client.readGbpReviewsLive(project, target());
381
383
  else if (action === "create") {
382
384
  if (!opts.request) throw validationError("An exact approved --request JSON file is required.");
383
- const raw = readFileSync(opts.request, "utf8");
385
+ let raw;
386
+ try {
387
+ raw = readFileSync(opts.request, "utf8");
388
+ } catch (error) {
389
+ throw validationError(`--request could not be read: ${describeError(error)}`);
390
+ }
384
391
  if (Buffer.byteLength(raw) > 16384) throw validationError("GBP request exceeds the limit.");
385
- const parsed = gbpLocalPostCreateSchema.safeParse(JSON.parse(raw));
392
+ let request;
393
+ try {
394
+ request = JSON.parse(raw);
395
+ } catch (error) {
396
+ throw validationError(`--request is not valid JSON: ${describeError(error)}`);
397
+ }
398
+ const parsed = gbpLocalPostCreateSchema.safeParse(request);
386
399
  if (!parsed.success) throw validationError("Invalid GBP package/attempt request.");
387
400
  result = await client.createGbpLocalPost(project, parsed.data);
388
401
  } else throw validationError("Unknown GBP Local Posts action.");
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-KQQERQJ2.js";
4
- import "./chunk-52J7GFCK.js";
3
+ } from "./chunk-RSB3X7UR.js";
4
+ import "./chunk-T6CABZ3N.js";
5
5
  import {
6
6
  emitJsonl
7
7
  } from "./chunk-Z7IUAJOF.js";
@@ -10,14 +10,15 @@ import {
10
10
  requireGscSitemapUrls,
11
11
  resolveDiscoveredGscSitemapUrls,
12
12
  submitGscSitemapBatches
13
- } from "./chunk-VEDGR4LZ.js";
13
+ } from "./chunk-BJWPYUKT.js";
14
14
  import "./chunk-AOJU5LKX.js";
15
15
  import {
16
16
  CliError,
17
17
  isMachineFormat
18
- } from "./chunk-QRIKJT6Y.js";
18
+ } from "./chunk-Y7JEJNNS.js";
19
19
  import {
20
- formatPercent
20
+ formatPercent,
21
+ shellQuote
21
22
  } from "./chunk-FGEBFVHB.js";
22
23
 
23
24
  // src/commands/google.ts
@@ -209,7 +210,7 @@ async function googlePerformanceDaily(project, opts) {
209
210
  return;
210
211
  }
211
212
  if (data.daily.length === 0) {
212
- console.log('No GSC data found in this window. Run "canonry google sync" first.');
213
+ console.log(`No GSC data found in this window. Run "canonry google sync ${shellQuote(project)}" first.`);
213
214
  return;
214
215
  }
215
216
  const { clicks, impressions, ctr, position, days } = data.totals;
@@ -312,7 +313,7 @@ async function googleTopPages(project, opts) {
312
313
  return;
313
314
  }
314
315
  if (data.rows.length === 0) {
315
- console.log('No GSC page data found in this window. Run "canonry google sync" first.');
316
+ console.log(`No GSC page data found in this window. Run "canonry google sync ${shellQuote(project)}" first.`);
316
317
  return;
317
318
  }
318
319
  console.log(`Top pages by clicks (${data.rows.length} page${data.rows.length === 1 ? "" : "s"}):
@@ -338,7 +339,7 @@ async function googleTopPages(project, opts) {
338
339
  console.log(" Google withholds rare queries and repeats an impression per page.");
339
340
  } else {
340
341
  console.log("Property total: not available for this window.");
341
- console.log(' Adding up the page rows would not give it. Run "canonry google sync" to fetch it.');
342
+ console.log(` Adding up the page rows would not give it. Run "canonry google sync ${shellQuote(project)}" to fetch it.`);
342
343
  }
343
344
  }
344
345
  async function googleQueryTotals(project, opts) {
@@ -365,7 +366,7 @@ async function googleQueryTotals(project, opts) {
365
366
  );
366
367
  return;
367
368
  }
368
- console.log('No GSC query data found in this window. Run "canonry google sync" first.');
369
+ console.log(`No GSC query data found in this window. Run "canonry google sync ${shellQuote(project)}" first.`);
369
370
  return;
370
371
  }
371
372
  const range = `${window.startDate ?? "earliest"} to ${window.endDate ?? "latest"}`;
@@ -395,10 +396,10 @@ async function googleQueryTotals(project, opts) {
395
396
  if (showSource) {
396
397
  console.log(" Rows marked page-summed or mixed use the legacy page table for some days. Their impressions");
397
398
  console.log(" over-count, because one search showing several of your pages was stored once per page.");
398
- console.log(` Run "canonry google sync" over the window to replace them with Google's per-query totals.`);
399
+ console.log(` Run "canonry google sync ${shellQuote(project)}" over the window to replace them with Google's per-query totals.`);
399
400
  }
400
401
  console.log(" These are the queries Google names. Google leaves rare queries out, so the rows do not add up");
401
- console.log(' to the property total. Use "canonry google performance-daily" for that.');
402
+ console.log(` to the property total. Use "canonry google performance-daily ${shellQuote(project)}" for that.`);
402
403
  }
403
404
  async function googlePerformance(project, opts) {
404
405
  const client = getClient();
@@ -438,7 +439,7 @@ async function googlePerformance(project, opts) {
438
439
  );
439
440
  return;
440
441
  }
441
- console.log('No GSC data found. Run "canonry google sync" first.');
442
+ console.log(`No GSC data found. Run "canonry google sync ${shellQuote(project)}" first.`);
442
443
  return;
443
444
  }
444
445
  console.log(`GSC performance data (${rows.length} of ${totalMatching.toLocaleString()} matching rows):