@ainyc/canonry 2.15.1 → 2.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  setGoogleAuthConfig,
18
18
  showFirstRunNotice,
19
19
  trackEvent
20
- } from "./chunk-KANIG6ES.js";
20
+ } from "./chunk-75EV36V6.js";
21
21
  import {
22
22
  CcReleaseSyncStatuses,
23
23
  CheckScopes,
@@ -45,7 +45,7 @@ import {
45
45
  saveConfig,
46
46
  saveConfigPatch,
47
47
  usageError
48
- } from "./chunk-OX24LLIH.js";
48
+ } from "./chunk-7DVIJC6L.js";
49
49
  import {
50
50
  apiKeys,
51
51
  competitors,
@@ -6326,6 +6326,84 @@ async function searchProject(project, opts) {
6326
6326
  }
6327
6327
  }
6328
6328
 
6329
+ // src/commands/citations.ts
6330
+ async function showCitationVisibility(project, opts) {
6331
+ const client = createApiClient();
6332
+ const data = await client.getCitationVisibility(project);
6333
+ if (opts.format === "json") {
6334
+ console.log(JSON.stringify(data, null, 2));
6335
+ return;
6336
+ }
6337
+ if (data.status === "no-data") {
6338
+ if (data.reason === "no-keywords") {
6339
+ console.log("No keywords configured. Add some with `canonry keyword add`.");
6340
+ } else {
6341
+ console.log("No citation data yet \u2014 run a sweep first (canonry run <project>).");
6342
+ }
6343
+ return;
6344
+ }
6345
+ printSummary(data);
6346
+ console.log("");
6347
+ printCoverage(data);
6348
+ if (data.competitorGaps.length > 0) {
6349
+ console.log("");
6350
+ printGaps2(data);
6351
+ }
6352
+ }
6353
+ function printSummary(data) {
6354
+ const { providersCiting, providersConfigured, totalKeywords, keywordsCited, keywordsFullyCovered, keywordsUncovered } = data.summary;
6355
+ console.log(`Citation visibility \u2014 cited by ${providersCiting}/${providersConfigured} engines`);
6356
+ if (data.summary.latestRunAt) {
6357
+ console.log(`Latest run: ${data.summary.latestRunAt}`);
6358
+ }
6359
+ console.log(`Keywords: ${totalKeywords}`);
6360
+ console.log(` cited (any): ${keywordsCited}`);
6361
+ console.log(` fully covered: ${keywordsFullyCovered}`);
6362
+ console.log(` uncovered: ${keywordsUncovered}`);
6363
+ }
6364
+ function printCoverage(data) {
6365
+ if (data.byKeyword.length === 0) {
6366
+ console.log("No keyword coverage rows.");
6367
+ return;
6368
+ }
6369
+ const providerSet = /* @__PURE__ */ new Set();
6370
+ for (const row of data.byKeyword) {
6371
+ for (const p of row.providers) providerSet.add(p.provider);
6372
+ }
6373
+ const providerColumns = Array.from(providerSet).sort();
6374
+ if (providerColumns.length === 0) {
6375
+ console.log("Per-keyword coverage:");
6376
+ for (const row of data.byKeyword) {
6377
+ console.log(` ${row.keyword.padEnd(35)} no snapshots`);
6378
+ }
6379
+ return;
6380
+ }
6381
+ const keywordWidth = Math.max(7, ...data.byKeyword.map((r) => r.keyword.length));
6382
+ const header = ["Keyword".padEnd(keywordWidth), ...providerColumns.map((p) => p.padEnd(10)), "Coverage"].join(" ");
6383
+ console.log("Per-keyword coverage:");
6384
+ console.log(header);
6385
+ console.log("\u2500".repeat(header.length));
6386
+ for (const row of data.byKeyword) {
6387
+ const cells = providerColumns.map((p) => {
6388
+ const provider = row.providers.find((x) => x.provider === p);
6389
+ if (!provider) return "\u2013".padEnd(10);
6390
+ return (provider.cited ? "\u2713" : "\u2717").padEnd(10);
6391
+ });
6392
+ const coverage = `${row.citedCount}/${row.totalProviders}`;
6393
+ console.log([row.keyword.padEnd(keywordWidth), ...cells, coverage].join(" "));
6394
+ }
6395
+ }
6396
+ function printGaps2(data) {
6397
+ console.log("Competitor gaps (not cited but a competitor is):");
6398
+ const keywordWidth = Math.max(7, ...data.competitorGaps.map((g) => g.keyword.length));
6399
+ const providerWidth = Math.max(8, ...data.competitorGaps.map((g) => g.provider.length));
6400
+ for (const gap of data.competitorGaps) {
6401
+ console.log(
6402
+ ` ${gap.keyword.padEnd(keywordWidth)} ${gap.provider.padEnd(providerWidth)} ${gap.citingCompetitors.join(", ")}`
6403
+ );
6404
+ }
6405
+ }
6406
+
6329
6407
  // src/cli-commands/intelligence.ts
6330
6408
  var INTELLIGENCE_CLI_COMMANDS = [
6331
6409
  {
@@ -6400,6 +6478,16 @@ var INTELLIGENCE_CLI_COMMANDS = [
6400
6478
  });
6401
6479
  await searchProject(project, { query, limit, format: input.format });
6402
6480
  }
6481
+ },
6482
+ {
6483
+ path: ["citations", "visibility"],
6484
+ usage: "canonry citations visibility <project> [--format json]",
6485
+ options: {},
6486
+ run: async (input) => {
6487
+ const usage = "canonry citations visibility <project> [--format json]";
6488
+ const project = requireProject(input, "citations visibility", usage);
6489
+ await showCitationVisibility(project, { format: input.format });
6490
+ }
6403
6491
  }
6404
6492
  ];
6405
6493
 
@@ -8957,6 +9045,15 @@ Usage: ${usage}`, {
8957
9045
  await agentTranscriptReset({ project, format: input.format });
8958
9046
  }
8959
9047
  },
9048
+ {
9049
+ path: ["agent", "clear"],
9050
+ usage: "canonry agent clear <project> [--format json]",
9051
+ options: {},
9052
+ run: async (input) => {
9053
+ const project = requireProject(input, "agent.clear", "canonry agent clear <project> [--format json]");
9054
+ await agentTranscriptReset({ project, format: input.format });
9055
+ }
9056
+ },
8960
9057
  {
8961
9058
  path: ["agent", "memory", "list"],
8962
9059
  usage: "canonry agent memory list <project> [--format json]",
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createServer
3
- } from "./chunk-KANIG6ES.js";
3
+ } from "./chunk-75EV36V6.js";
4
4
  import {
5
5
  loadConfig
6
- } from "./chunk-OX24LLIH.js";
6
+ } from "./chunk-7DVIJC6L.js";
7
7
  import "./chunk-NEDRCOOL.js";
8
8
  import "./chunk-MLKGABMK.js";
9
9
  export {