@ainyc/canonry 4.27.1 → 4.28.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/dist/cli.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  setTelemetrySource,
21
21
  showFirstRunNotice,
22
22
  trackEvent
23
- } from "./chunk-QNXGCQEM.js";
23
+ } from "./chunk-HONTKYY7.js";
24
24
  import {
25
25
  CliError,
26
26
  EXIT_SYSTEM_ERROR,
@@ -36,7 +36,7 @@ import {
36
36
  saveConfig,
37
37
  saveConfigPatch,
38
38
  usageError
39
- } from "./chunk-2FAEQ56I.js";
39
+ } from "./chunk-GB3QJURO.js";
40
40
  import {
41
41
  apiKeys,
42
42
  competitors,
@@ -49,7 +49,7 @@ import {
49
49
  queries,
50
50
  querySnapshots,
51
51
  runs
52
- } from "./chunk-NXXD6TX7.js";
52
+ } from "./chunk-UEV3HSRL.js";
53
53
  import {
54
54
  CcReleaseSyncStatuses,
55
55
  CheckScopes,
@@ -62,6 +62,7 @@ import {
62
62
  SkillsClients,
63
63
  TrafficEventKinds,
64
64
  determineAnswerMentioned,
65
+ discoveryBucketSchema,
65
66
  effectiveDomains,
66
67
  formatRunErrorOneLine,
67
68
  normalizeUrlPath,
@@ -69,7 +70,7 @@ import {
69
70
  providerQuotaPolicySchema,
70
71
  resolveProviderInput,
71
72
  skillsClientSchema
72
- } from "./chunk-HVW665A4.js";
73
+ } from "./chunk-RLLFB3M3.js";
73
74
 
74
75
  // src/cli.ts
75
76
  import { pathToFileURL } from "url";
@@ -621,7 +622,7 @@ function readStoredGroundingSources(rawResponse) {
621
622
  return result;
622
623
  }
623
624
  async function backfillInsightsCommand(project, opts) {
624
- const { IntelligenceService } = await import("./intelligence-service-Z6QIELKP.js");
625
+ const { IntelligenceService } = await import("./intelligence-service-O6KB6YAM.js");
625
626
  const config = loadConfig();
626
627
  const db = createClient(config.database);
627
628
  migrate(db);
@@ -2054,7 +2055,28 @@ async function discoverPromotePreview(project, sessionId, opts) {
2054
2055
  for (const c of preview.suggestedCompetitors) console.log(` - ${c.domain} (${c.hits} hits)`);
2055
2056
  }
2056
2057
  console.log(`
2057
- (PR 2 will add \`canonry discover promote\` to actually merge these into the project.)`);
2058
+ Run \`canonry discover promote ${project} ${sessionId}\` to merge cited + aspirational queries.`);
2059
+ console.log(" Add `--bucket wasted-surface` only when off-ICP competitor gaps should be tracked.");
2060
+ }
2061
+ async function discoverPromote(project, sessionId, opts) {
2062
+ const client = getClient4();
2063
+ const body = {};
2064
+ if (opts.buckets && opts.buckets.length > 0) body.buckets = opts.buckets;
2065
+ if (opts.includeCompetitors === false) body.includeCompetitors = false;
2066
+ const result = await client.promoteDiscovery(project, sessionId, body);
2067
+ if (opts.format === "json") {
2068
+ console.log(JSON.stringify(result, null, 2));
2069
+ return;
2070
+ }
2071
+ const { promoted, skipped } = result;
2072
+ console.log(`Promoted discovery session ${sessionId} into "${project}":`);
2073
+ console.log(` Queries: ${promoted.queries.length} added, ${skipped.queries.length} already tracked`);
2074
+ for (const q of promoted.queries) console.log(` + ${q}`);
2075
+ console.log(` Competitors: ${promoted.competitors.length} added, ${skipped.competitors.length} already tracked`);
2076
+ for (const c of promoted.competitors) console.log(` + ${c}`);
2077
+ if (promoted.queries.length === 0 && promoted.competitors.length === 0) {
2078
+ console.log(` Nothing new \u2014 the project's basket already covers this session.`);
2079
+ }
2058
2080
  }
2059
2081
  function printSessionDetail(session) {
2060
2082
  console.log(`Discovery session: ${session.id}`);
@@ -2122,6 +2144,37 @@ Usage: ${usage}`, {
2122
2144
  }
2123
2145
  return parsed;
2124
2146
  }
2147
+ function parseBucketsOption(values, usage) {
2148
+ const raw = getStringArray(values, "bucket");
2149
+ if (!raw || raw.length === 0) return void 0;
2150
+ const expanded = raw.flatMap((v) => v.split(",")).map((v) => v.trim()).filter(Boolean);
2151
+ if (expanded.length === 0) {
2152
+ throw usageError(
2153
+ `Error: --bucket must include at least one value (valid: cited, aspirational, wasted-surface)
2154
+ Usage: ${usage}`,
2155
+ {
2156
+ message: "--bucket must include at least one value",
2157
+ details: { command: "discover.promote", usage, option: "bucket", value: raw }
2158
+ }
2159
+ );
2160
+ }
2161
+ const buckets = [];
2162
+ for (const value of expanded) {
2163
+ const parsed = discoveryBucketSchema.safeParse(value);
2164
+ if (!parsed.success) {
2165
+ throw usageError(
2166
+ `Error: invalid --bucket value "${value}" (valid: cited, aspirational, wasted-surface)
2167
+ Usage: ${usage}`,
2168
+ {
2169
+ message: `invalid --bucket value "${value}"`,
2170
+ details: { command: "discover.promote", usage, option: "bucket", value }
2171
+ }
2172
+ );
2173
+ }
2174
+ buckets.push(parsed.data);
2175
+ }
2176
+ return buckets;
2177
+ }
2125
2178
  var DISCOVER_CLI_COMMANDS = [
2126
2179
  {
2127
2180
  path: ["discover", "run"],
@@ -2237,6 +2290,28 @@ var DISCOVER_CLI_COMMANDS = [
2237
2290
  await discoverShow(project, sessionId, { format: input.format });
2238
2291
  }
2239
2292
  },
2293
+ {
2294
+ path: ["discover", "promote"],
2295
+ usage: "canonry discover promote <project> <session-id> [--bucket cited,aspirational,wasted-surface] [--no-competitors] [--format json]",
2296
+ options: {
2297
+ bucket: multiStringOption(),
2298
+ "no-competitors": { type: "boolean", default: false }
2299
+ },
2300
+ run: async (input) => {
2301
+ const usage = "canonry discover promote <project> <session-id> [--bucket cited,aspirational,wasted-surface] [--no-competitors] [--format json]";
2302
+ const project = requireProject(input, "discover.promote", usage);
2303
+ const sessionId = requirePositional(input, 1, {
2304
+ command: "discover.promote",
2305
+ usage,
2306
+ message: "session ID is required"
2307
+ });
2308
+ await discoverPromote(project, sessionId, {
2309
+ buckets: parseBucketsOption(input.values, usage),
2310
+ includeCompetitors: !getBoolean(input.values, "no-competitors"),
2311
+ format: input.format
2312
+ });
2313
+ }
2314
+ },
2240
2315
  {
2241
2316
  path: ["discover", "promote", "preview"],
2242
2317
  usage: "canonry discover promote preview <project> <session-id> [--format json]",
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  createServer
3
- } from "./chunk-QNXGCQEM.js";
3
+ } from "./chunk-HONTKYY7.js";
4
4
  import {
5
5
  loadConfig
6
- } from "./chunk-2FAEQ56I.js";
7
- import "./chunk-NXXD6TX7.js";
8
- import "./chunk-HVW665A4.js";
6
+ } from "./chunk-GB3QJURO.js";
7
+ import "./chunk-UEV3HSRL.js";
8
+ import "./chunk-RLLFB3M3.js";
9
9
  export {
10
10
  createServer,
11
11
  loadConfig
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  IntelligenceService
3
- } from "./chunk-NXXD6TX7.js";
4
- import "./chunk-HVW665A4.js";
3
+ } from "./chunk-UEV3HSRL.js";
4
+ import "./chunk-RLLFB3M3.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-2FAEQ56I.js";
6
- import "./chunk-HVW665A4.js";
5
+ } from "./chunk-GB3QJURO.js";
6
+ import "./chunk-RLLFB3M3.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.27.1",
3
+ "version": "4.28.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",
@@ -61,21 +61,21 @@
61
61
  "tsx": "^4.19.0",
62
62
  "@ainyc/canonry-api-routes": "0.0.0",
63
63
  "@ainyc/canonry-config": "0.0.0",
64
- "@ainyc/canonry-contracts": "0.0.0",
65
64
  "@ainyc/canonry-db": "0.0.0",
66
65
  "@ainyc/canonry-integration-bing": "0.0.0",
67
- "@ainyc/canonry-integration-cloud-run": "0.0.0",
68
- "@ainyc/canonry-integration-google": "0.0.0",
66
+ "@ainyc/canonry-contracts": "0.0.0",
69
67
  "@ainyc/canonry-intelligence": "0.0.0",
68
+ "@ainyc/canonry-integration-cloud-run": "0.0.0",
70
69
  "@ainyc/canonry-integration-commoncrawl": "0.0.0",
70
+ "@ainyc/canonry-integration-google": "0.0.0",
71
71
  "@ainyc/canonry-integration-traffic": "0.0.0",
72
- "@ainyc/canonry-provider-cdp": "0.0.0",
73
72
  "@ainyc/canonry-integration-wordpress": "0.0.0",
73
+ "@ainyc/canonry-provider-cdp": "0.0.0",
74
+ "@ainyc/canonry-provider-gemini": "0.0.0",
74
75
  "@ainyc/canonry-provider-claude": "0.0.0",
75
- "@ainyc/canonry-provider-local": "0.0.0",
76
76
  "@ainyc/canonry-provider-openai": "0.0.0",
77
77
  "@ainyc/canonry-provider-perplexity": "0.0.0",
78
- "@ainyc/canonry-provider-gemini": "0.0.0"
78
+ "@ainyc/canonry-provider-local": "0.0.0"
79
79
  },
80
80
  "scripts": {
81
81
  "build": "tsx scripts/copy-agent-assets.ts && tsup && tsx build-web.ts",