@ainyc/canonry 4.40.0 → 4.41.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.
package/assets/index.html CHANGED
@@ -12,8 +12,8 @@
12
12
  <link rel="icon" type="image/png" sizes="32x32" href="./favicon-32.png" />
13
13
  <link rel="apple-touch-icon" href="./apple-touch-icon.png" />
14
14
  <title>Canonry</title>
15
- <script type="module" crossorigin src="./assets/index-BXkHB0ox.js"></script>
16
- <link rel="stylesheet" crossorigin href="./assets/index-DkoFqd1J.css">
15
+ <script type="module" crossorigin src="./assets/index-JiyuncvN.js"></script>
16
+ <link rel="stylesheet" crossorigin href="./assets/index-Ca1Lty3H.css">
17
17
  </head>
18
18
  <body>
19
19
  <div id="root"></div>
@@ -8,7 +8,7 @@ import {
8
8
  categoryLabel,
9
9
  determineAnswerMentioned,
10
10
  normalizeProjectDomain
11
- } from "./chunk-XJVYVURK.js";
11
+ } from "./chunk-Q7XFJO2V.js";
12
12
 
13
13
  // src/intelligence-service.ts
14
14
  import { eq, desc, asc, and, or, inArray } from "drizzle-orm";
@@ -22,7 +22,7 @@ import {
22
22
  trafficConnectVercelRequestSchema,
23
23
  trafficConnectWordpressRequestSchema,
24
24
  trafficEventKindSchema
25
- } from "./chunk-XJVYVURK.js";
25
+ } from "./chunk-Q7XFJO2V.js";
26
26
 
27
27
  // src/config.ts
28
28
  import fs from "fs";
@@ -644,6 +644,10 @@ var ApiClient = class {
644
644
  const qs = params ? "?" + new URLSearchParams(params).toString() : "";
645
645
  return this.request("GET", `/projects/${encodeURIComponent(project)}/google/gsc/performance${qs}`);
646
646
  }
647
+ async gscPerformanceDaily(project, params) {
648
+ const qs = params ? "?" + new URLSearchParams(params).toString() : "";
649
+ return this.request("GET", `/projects/${encodeURIComponent(project)}/google/gsc/performance/daily${qs}`);
650
+ }
647
651
  async gscInspect(project, url) {
648
652
  return this.request("POST", `/projects/${encodeURIComponent(project)}/google/gsc/inspect`, { url });
649
653
  }
@@ -1174,6 +1178,12 @@ var gscPerformanceInputSchema = z2.object({
1174
1178
  limit: z2.number().int().positive().max(500).optional(),
1175
1179
  window: analyticsWindowSchema.optional()
1176
1180
  });
1181
+ var gscPerformanceDailyInputSchema = z2.object({
1182
+ project: projectNameSchema,
1183
+ startDate: z2.string().optional(),
1184
+ endDate: z2.string().optional(),
1185
+ window: analyticsWindowSchema.optional()
1186
+ });
1177
1187
  var gscInspectionsInputSchema = z2.object({
1178
1188
  project: projectNameSchema,
1179
1189
  url: z2.string().optional(),
@@ -1694,6 +1704,17 @@ var canonryMcpTools = [
1694
1704
  openApiOperations: ["GET /api/v1/projects/{name}/google/gsc/performance"],
1695
1705
  handler: (client, input) => client.gscPerformance(input.project, compactStringParams(input, ["startDate", "endDate", "query", "page", "limit", "window"]))
1696
1706
  }),
1707
+ defineTool({
1708
+ name: "canonry_gsc_performance_daily",
1709
+ title: "Get GSC daily performance summary",
1710
+ description: "Get GSC search performance aggregated by date with window totals (clicks, impressions, CTR). Use this for charts and headline metrics \u2014 never recompute by summing the paged canonry_gsc_performance rows, which only cover one page.",
1711
+ access: "read",
1712
+ tier: "gsc",
1713
+ inputSchema: gscPerformanceDailyInputSchema,
1714
+ annotations: readAnnotations(),
1715
+ openApiOperations: ["GET /api/v1/projects/{name}/google/gsc/performance/daily"],
1716
+ handler: (client, input) => client.gscPerformanceDaily(input.project, compactStringParams(input, ["startDate", "endDate", "window"]))
1717
+ }),
1697
1718
  defineTool({
1698
1719
  name: "canonry_gsc_inspections",
1699
1720
  title: "List GSC inspections",
@@ -5,7 +5,7 @@ import {
5
5
  loadConfig,
6
6
  loadConfigRaw,
7
7
  saveConfigPatch
8
- } from "./chunk-JS6KRBBZ.js";
8
+ } from "./chunk-JZ2VJW4U.js";
9
9
  import {
10
10
  DEFAULT_RUN_HISTORY_LIMIT,
11
11
  IntelligenceService,
@@ -78,7 +78,7 @@ import {
78
78
  schedules,
79
79
  trafficSources,
80
80
  usageCounters
81
- } from "./chunk-EWYUJ2DG.js";
81
+ } from "./chunk-3I6Y2PSQ.js";
82
82
  import {
83
83
  AGENT_MEMORY_VALUE_MAX_BYTES,
84
84
  AGENT_PROVIDER_IDS,
@@ -191,7 +191,7 @@ import {
191
191
  visibilityStateFromAnswerMentioned,
192
192
  windowCutoff,
193
193
  wordpressEnvSchema
194
- } from "./chunk-XJVYVURK.js";
194
+ } from "./chunk-Q7XFJO2V.js";
195
195
 
196
196
  // src/telemetry.ts
197
197
  import crypto from "crypto";
@@ -9214,6 +9214,22 @@ var routeCatalog = [
9214
9214
  404: { description: "Project not found." }
9215
9215
  }
9216
9216
  },
9217
+ {
9218
+ method: "get",
9219
+ path: "/api/v1/projects/{name}/google/gsc/performance/daily",
9220
+ summary: "Get GSC performance aggregated by day with window totals",
9221
+ tags: ["google"],
9222
+ parameters: [
9223
+ nameParameter,
9224
+ { name: "startDate", in: "query", description: "Filter by start date.", schema: stringSchema },
9225
+ { name: "endDate", in: "query", description: "Filter by end date.", schema: stringSchema },
9226
+ analyticsWindowParameter
9227
+ ],
9228
+ responses: {
9229
+ 200: { description: "Daily aggregate (date \u2192 clicks/impressions/ctr) plus window totals." },
9230
+ 404: { description: "Project not found." }
9231
+ }
9232
+ },
9217
9233
  {
9218
9234
  method: "post",
9219
9235
  path: "/api/v1/projects/{name}/google/gsc/inspect",
@@ -12744,6 +12760,37 @@ async function googleRoutes(app, opts) {
12744
12760
  position: parseFloat(r.position)
12745
12761
  }));
12746
12762
  });
12763
+ app.get("/projects/:name/google/gsc/performance/daily", async (request) => {
12764
+ const project = resolveProject(app.db, request.params.name);
12765
+ const { startDate, endDate } = request.query;
12766
+ const cutoffDate = !startDate ? windowCutoff(parseWindow(request.query.window))?.slice(0, 10) ?? null : null;
12767
+ const conditions = [eq18(gscSearchData.projectId, project.id)];
12768
+ if (startDate) conditions.push(sql7`${gscSearchData.date} >= ${startDate}`);
12769
+ else if (cutoffDate) conditions.push(sql7`${gscSearchData.date} >= ${cutoffDate}`);
12770
+ if (endDate) conditions.push(sql7`${gscSearchData.date} <= ${endDate}`);
12771
+ const rows = app.db.select({
12772
+ date: gscSearchData.date,
12773
+ clicks: sql7`COALESCE(SUM(${gscSearchData.clicks}), 0)`,
12774
+ impressions: sql7`COALESCE(SUM(${gscSearchData.impressions}), 0)`
12775
+ }).from(gscSearchData).where(and9(...conditions)).groupBy(gscSearchData.date).orderBy(gscSearchData.date).all();
12776
+ const daily = rows.map((r) => ({
12777
+ date: r.date,
12778
+ clicks: r.clicks,
12779
+ impressions: r.impressions,
12780
+ ctr: r.impressions > 0 ? r.clicks / r.impressions : 0
12781
+ }));
12782
+ const totalClicks = daily.reduce((sum, d) => sum + d.clicks, 0);
12783
+ const totalImpressions = daily.reduce((sum, d) => sum + d.impressions, 0);
12784
+ return {
12785
+ totals: {
12786
+ clicks: totalClicks,
12787
+ impressions: totalImpressions,
12788
+ ctr: totalImpressions > 0 ? totalClicks / totalImpressions : 0,
12789
+ days: daily.length
12790
+ },
12791
+ daily
12792
+ };
12793
+ });
12747
12794
  app.post("/projects/:name/google/gsc/inspect", async (request) => {
12748
12795
  const { clientId: googleClientId, clientSecret: googleClientSecret } = getAuthConfig();
12749
12796
  if (!googleClientId || !googleClientSecret) {
@@ -26224,7 +26271,7 @@ function readStoredGroundingSources(rawResponse) {
26224
26271
  return result;
26225
26272
  }
26226
26273
  async function backfillInsightsCommand(project, opts) {
26227
- const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-ZZP3TVZZ.js");
26274
+ const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-FFCEIEOU.js");
26228
26275
  const config = loadConfig();
26229
26276
  const db = createClient(config.database);
26230
26277
  migrate(db);
@@ -695,6 +695,21 @@ var gscSearchDataDtoSchema = z6.object({
695
695
  ctr: z6.number(),
696
696
  position: z6.number()
697
697
  });
698
+ var gscPerformanceDailyPointSchema = z6.object({
699
+ date: z6.string(),
700
+ clicks: z6.number(),
701
+ impressions: z6.number(),
702
+ ctr: z6.number()
703
+ });
704
+ var gscPerformanceDailyDtoSchema = z6.object({
705
+ totals: z6.object({
706
+ clicks: z6.number(),
707
+ impressions: z6.number(),
708
+ ctr: z6.number(),
709
+ days: z6.number()
710
+ }),
711
+ daily: z6.array(gscPerformanceDailyPointSchema)
712
+ });
698
713
  var gscUrlInspectionDtoSchema = z6.object({
699
714
  id: z6.string(),
700
715
  url: z6.string(),
package/dist/cli.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  setTelemetrySource,
22
22
  showFirstRunNotice,
23
23
  trackEvent
24
- } from "./chunk-H6COOYA6.js";
24
+ } from "./chunk-PQ2IKBT5.js";
25
25
  import {
26
26
  CliError,
27
27
  EXIT_SYSTEM_ERROR,
@@ -37,14 +37,14 @@ import {
37
37
  saveConfig,
38
38
  saveConfigPatch,
39
39
  usageError
40
- } from "./chunk-JS6KRBBZ.js";
40
+ } from "./chunk-JZ2VJW4U.js";
41
41
  import {
42
42
  apiKeys,
43
43
  createClient,
44
44
  migrate,
45
45
  projects,
46
46
  queries
47
- } from "./chunk-EWYUJ2DG.js";
47
+ } from "./chunk-3I6Y2PSQ.js";
48
48
  import {
49
49
  CcReleaseSyncStatuses,
50
50
  CheckScopes,
@@ -63,7 +63,7 @@ import {
63
63
  providerQuotaPolicySchema,
64
64
  resolveProviderInput,
65
65
  skillsClientSchema
66
- } from "./chunk-XJVYVURK.js";
66
+ } from "./chunk-Q7XFJO2V.js";
67
67
 
68
68
  // src/cli.ts
69
69
  import { pathToFileURL } from "url";
@@ -3726,6 +3726,36 @@ async function googleSync(project, opts) {
3726
3726
  console.log("GSC sync completed successfully.");
3727
3727
  }
3728
3728
  }
3729
+ async function googlePerformanceDaily(project, opts) {
3730
+ const client = getClient8();
3731
+ const params = {};
3732
+ if (opts.window) params.window = opts.window;
3733
+ if (opts.startDate) params.startDate = opts.startDate;
3734
+ if (opts.endDate) params.endDate = opts.endDate;
3735
+ const data = await client.gscPerformanceDaily(project, Object.keys(params).length > 0 ? params : void 0);
3736
+ if (opts.format === "json") {
3737
+ console.log(JSON.stringify(data, null, 2));
3738
+ return;
3739
+ }
3740
+ if (data.daily.length === 0) {
3741
+ console.log('No GSC data found in this window. Run "canonry google sync" first.');
3742
+ return;
3743
+ }
3744
+ const { clicks, impressions, ctr, days } = data.totals;
3745
+ console.log(`GSC daily summary (${days} day${days === 1 ? "" : "s"}):
3746
+ `);
3747
+ console.log(` Clicks: ${clicks.toLocaleString()}`);
3748
+ console.log(` Impressions: ${impressions.toLocaleString()}`);
3749
+ console.log(` CTR: ${(ctr * 100).toFixed(2)}%`);
3750
+ console.log();
3751
+ console.log(` ${"DATE".padEnd(12)}${"CLICKS".padStart(10)}${"IMPR".padStart(12)}${"CTR".padStart(10)}`);
3752
+ console.log(` ${"\u2500".repeat(12)}${"\u2500".repeat(10)}${"\u2500".repeat(12)}${"\u2500".repeat(10)}`);
3753
+ for (const row of data.daily) {
3754
+ console.log(
3755
+ ` ${row.date.padEnd(12)}${row.clicks.toLocaleString().padStart(10)}${row.impressions.toLocaleString().padStart(12)}${(row.ctr * 100).toFixed(2).padStart(9)}%`
3756
+ );
3757
+ }
3758
+ }
3729
3759
  async function googlePerformance(project, opts) {
3730
3760
  const client = getClient8();
3731
3761
  const params = {};
@@ -4260,6 +4290,24 @@ var GOOGLE_CLI_COMMANDS = [
4260
4290
  });
4261
4291
  }
4262
4292
  },
4293
+ {
4294
+ path: ["google", "performance-daily"],
4295
+ usage: "canonry google performance-daily <project> [--window 7d|30d|90d|all] [--start <YYYY-MM-DD>] [--end <YYYY-MM-DD>] [--format json]",
4296
+ options: {
4297
+ window: stringOption(),
4298
+ start: stringOption(),
4299
+ end: stringOption()
4300
+ },
4301
+ run: async (input) => {
4302
+ const project = requireProject(input, "google.performance-daily", "canonry google performance-daily <project> [--window 7d|30d|90d|all] [--start <YYYY-MM-DD>] [--end <YYYY-MM-DD>] [--format json]");
4303
+ await googlePerformanceDaily(project, {
4304
+ window: getString(input.values, "window"),
4305
+ startDate: getString(input.values, "start"),
4306
+ endDate: getString(input.values, "end"),
4307
+ format: input.format
4308
+ });
4309
+ }
4310
+ },
4263
4311
  {
4264
4312
  path: ["google", "inspect"],
4265
4313
  usage: "canonry google inspect <project> <url> [--format json]",
@@ -4389,12 +4437,12 @@ var GOOGLE_CLI_COMMANDS = [
4389
4437
  },
4390
4438
  {
4391
4439
  path: ["google"],
4392
- usage: "canonry google <connect|disconnect|status|properties|set-property|set-sitemap|list-sitemaps|discover-sitemaps|sync|performance|inspect|inspect-sitemap|coverage|coverage-history|inspections|deindexed|request-indexing|refresh> <project> [args]",
4440
+ usage: "canonry google <connect|disconnect|status|properties|set-property|set-sitemap|list-sitemaps|discover-sitemaps|sync|performance|performance-daily|inspect|inspect-sitemap|coverage|coverage-history|inspections|deindexed|request-indexing|refresh> <project> [args]",
4393
4441
  run: async (input) => {
4394
4442
  unknownSubcommand(input.positionals[0], {
4395
4443
  command: "google",
4396
- usage: "canonry google <connect|disconnect|status|properties|set-property|set-sitemap|list-sitemaps|discover-sitemaps|sync|performance|inspect|inspect-sitemap|coverage|coverage-history|inspections|deindexed|request-indexing|refresh> <project> [args]",
4397
- available: ["connect", "disconnect", "status", "properties", "set-property", "set-sitemap", "list-sitemaps", "discover-sitemaps", "sync", "performance", "inspect", "inspect-sitemap", "coverage", "coverage-history", "inspections", "deindexed", "request-indexing", "refresh"]
4444
+ usage: "canonry google <connect|disconnect|status|properties|set-property|set-sitemap|list-sitemaps|discover-sitemaps|sync|performance|performance-daily|inspect|inspect-sitemap|coverage|coverage-history|inspections|deindexed|request-indexing|refresh> <project> [args]",
4445
+ available: ["connect", "disconnect", "status", "properties", "set-property", "set-sitemap", "list-sitemaps", "discover-sitemaps", "sync", "performance", "performance-daily", "inspect", "inspect-sitemap", "coverage", "coverage-history", "inspections", "deindexed", "request-indexing", "refresh"]
4398
4446
  });
4399
4447
  }
4400
4448
  }
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  createServer
3
- } from "./chunk-H6COOYA6.js";
3
+ } from "./chunk-PQ2IKBT5.js";
4
4
  import {
5
5
  loadConfig
6
- } from "./chunk-JS6KRBBZ.js";
7
- import "./chunk-EWYUJ2DG.js";
8
- import "./chunk-XJVYVURK.js";
6
+ } from "./chunk-JZ2VJW4U.js";
7
+ import "./chunk-3I6Y2PSQ.js";
8
+ import "./chunk-Q7XFJO2V.js";
9
9
  export {
10
10
  createServer,
11
11
  loadConfig
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  IntelligenceService
3
- } from "./chunk-EWYUJ2DG.js";
4
- import "./chunk-XJVYVURK.js";
3
+ } from "./chunk-3I6Y2PSQ.js";
4
+ import "./chunk-Q7XFJO2V.js";
5
5
  export {
6
6
  IntelligenceService
7
7
  };
package/dist/mcp.js CHANGED
@@ -2,8 +2,8 @@ import {
2
2
  CliError,
3
3
  canonryMcpTools,
4
4
  createApiClient
5
- } from "./chunk-JS6KRBBZ.js";
6
- import "./chunk-XJVYVURK.js";
5
+ } from "./chunk-JZ2VJW4U.js";
6
+ import "./chunk-Q7XFJO2V.js";
7
7
 
8
8
  // src/mcp/cli.ts
9
9
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ainyc/canonry",
3
- "version": "4.40.0",
3
+ "version": "4.41.0",
4
4
  "type": "module",
5
5
  "description": "Agent-first open-source AEO operating platform - track how answer engines cite your domain",
6
6
  "license": "FSL-1.1-ALv2",
@@ -60,16 +60,16 @@
60
60
  "@types/node-cron": "^3.0.11",
61
61
  "tsup": "^8.5.1",
62
62
  "tsx": "^4.19.0",
63
- "@ainyc/canonry-api-routes": "0.0.0",
64
- "@ainyc/canonry-contracts": "0.0.0",
65
63
  "@ainyc/canonry-config": "0.0.0",
64
+ "@ainyc/canonry-contracts": "0.0.0",
65
+ "@ainyc/canonry-api-routes": "0.0.0",
66
66
  "@ainyc/canonry-db": "0.0.0",
67
- "@ainyc/canonry-integration-bing": "0.0.0",
68
67
  "@ainyc/canonry-intelligence": "0.0.0",
68
+ "@ainyc/canonry-integration-bing": "0.0.0",
69
69
  "@ainyc/canonry-integration-cloud-run": "0.0.0",
70
- "@ainyc/canonry-integration-commoncrawl": "0.0.0",
71
70
  "@ainyc/canonry-integration-google": "0.0.0",
72
71
  "@ainyc/canonry-integration-traffic": "0.0.0",
72
+ "@ainyc/canonry-integration-commoncrawl": "0.0.0",
73
73
  "@ainyc/canonry-integration-wordpress": "0.0.0",
74
74
  "@ainyc/canonry-provider-cdp": "0.0.0",
75
75
  "@ainyc/canonry-provider-gemini": "0.0.0",