@ainyc/canonry 1.33.0 → 1.35.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/assets/{index-B5Cg2H9M.css → index-B9SBdBOm.css} +1 -1
- package/assets/assets/index-DyipkdOb.js +281 -0
- package/assets/index.html +2 -2
- package/dist/{chunk-WRNSBFNQ.js → chunk-ETP5IOHC.js} +712 -609
- package/dist/cli.js +56 -19
- package/dist/index.js +1 -1
- package/package.json +5 -5
- package/assets/assets/index-BiIPqZJb.js +0 -246
package/dist/cli.js
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
setGoogleAuthConfig,
|
|
27
27
|
showFirstRunNotice,
|
|
28
28
|
trackEvent
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-ETP5IOHC.js";
|
|
30
30
|
|
|
31
31
|
// src/cli.ts
|
|
32
32
|
import { pathToFileURL } from "url";
|
|
@@ -667,6 +667,9 @@ var ApiClient = class {
|
|
|
667
667
|
async gaCoverage(project) {
|
|
668
668
|
return this.request("GET", `/projects/${encodeURIComponent(project)}/ga/coverage`);
|
|
669
669
|
}
|
|
670
|
+
async gaAiReferralHistory(project) {
|
|
671
|
+
return this.request("GET", `/projects/${encodeURIComponent(project)}/ga/ai-referral-history`);
|
|
672
|
+
}
|
|
670
673
|
async wordpressConnect(project, body) {
|
|
671
674
|
return this.request("POST", `/projects/${encodeURIComponent(project)}/wordpress/connect`, body);
|
|
672
675
|
}
|
|
@@ -1386,14 +1389,6 @@ async function gaConnect(project, opts) {
|
|
|
1386
1389
|
details: { project }
|
|
1387
1390
|
});
|
|
1388
1391
|
}
|
|
1389
|
-
if (!opts.keyFile && !opts.keyJson) {
|
|
1390
|
-
throw new CliError({
|
|
1391
|
-
code: "GA_KEY_REQUIRED",
|
|
1392
|
-
message: "Service account key is required (pass --key-file or --key-json)",
|
|
1393
|
-
displayMessage: "Error: --key-file or --key-json is required",
|
|
1394
|
-
details: { project }
|
|
1395
|
-
});
|
|
1396
|
-
}
|
|
1397
1392
|
const body = {
|
|
1398
1393
|
propertyId: opts.propertyId
|
|
1399
1394
|
};
|
|
@@ -1422,8 +1417,12 @@ async function gaConnect(project, opts) {
|
|
|
1422
1417
|
return;
|
|
1423
1418
|
}
|
|
1424
1419
|
console.log(`GA4 connected for project "${project}".`);
|
|
1425
|
-
console.log(` Property ID:
|
|
1426
|
-
|
|
1420
|
+
console.log(` Property ID: ${result.propertyId}`);
|
|
1421
|
+
if (result.authMethod === "service-account" && result.clientEmail) {
|
|
1422
|
+
console.log(` Auth: service account (${result.clientEmail})`);
|
|
1423
|
+
} else {
|
|
1424
|
+
console.log(` Auth: OAuth (canonry google connect --type ga4)`);
|
|
1425
|
+
}
|
|
1427
1426
|
}
|
|
1428
1427
|
async function gaDisconnect(project, format) {
|
|
1429
1428
|
const client = getClient3();
|
|
@@ -1443,15 +1442,22 @@ async function gaStatus(project, format) {
|
|
|
1443
1442
|
}
|
|
1444
1443
|
if (!result.connected) {
|
|
1445
1444
|
console.log(`No GA4 connection for project "${project}".`);
|
|
1446
|
-
console.log(
|
|
1445
|
+
console.log("Options:");
|
|
1446
|
+
console.log(" With service account: canonry ga connect <project> --property-id <id> --key-file <path>");
|
|
1447
|
+
console.log(" With OAuth: canonry google connect <project> --type ga4");
|
|
1448
|
+
console.log(" canonry ga connect <project> --property-id <id>");
|
|
1447
1449
|
return;
|
|
1448
1450
|
}
|
|
1449
1451
|
console.log(`GA4 for "${project}":
|
|
1450
1452
|
`);
|
|
1451
|
-
console.log(` Property ID:
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1453
|
+
console.log(` Property ID: ${result.propertyId}`);
|
|
1454
|
+
if (result.authMethod === "service-account") {
|
|
1455
|
+
console.log(` Auth: service account (${result.clientEmail})`);
|
|
1456
|
+
} else {
|
|
1457
|
+
console.log(` Auth: OAuth`);
|
|
1458
|
+
}
|
|
1459
|
+
console.log(` Last Synced: ${result.lastSyncedAt ?? "(never)"}`);
|
|
1460
|
+
console.log(` Connected: ${result.createdAt ?? "unknown"}`);
|
|
1455
1461
|
}
|
|
1456
1462
|
async function gaSync(project, opts) {
|
|
1457
1463
|
const client = getClient3();
|
|
@@ -1513,6 +1519,29 @@ async function gaTraffic(project, opts) {
|
|
|
1513
1519
|
Last synced: ${result.lastSyncedAt}`);
|
|
1514
1520
|
}
|
|
1515
1521
|
}
|
|
1522
|
+
async function gaAiReferralHistory(project, format) {
|
|
1523
|
+
const client = getClient3();
|
|
1524
|
+
const result = await client.gaAiReferralHistory(project);
|
|
1525
|
+
if (format === "json") {
|
|
1526
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1527
|
+
return;
|
|
1528
|
+
}
|
|
1529
|
+
if (result.length === 0) {
|
|
1530
|
+
console.log('No AI referral history. Run "canonry ga sync <project>" first.');
|
|
1531
|
+
return;
|
|
1532
|
+
}
|
|
1533
|
+
const dateWidth = 12;
|
|
1534
|
+
const sourceWidth = Math.min(30, Math.max(10, ...result.map((r) => r.source.length)));
|
|
1535
|
+
console.log(`GA4 AI Referral History for "${project}":
|
|
1536
|
+
`);
|
|
1537
|
+
console.log(` ${"DATE".padEnd(dateWidth)} ${"SOURCE".padEnd(sourceWidth)} ${"SESSIONS".padEnd(10)}${"USERS".padEnd(8)}`);
|
|
1538
|
+
console.log(` ${"\u2500".repeat(dateWidth)} ${"\u2500".repeat(sourceWidth)} ${"\u2500".repeat(10)}${"\u2500".repeat(8)}`);
|
|
1539
|
+
for (const row of result) {
|
|
1540
|
+
console.log(
|
|
1541
|
+
` ${row.date.padEnd(dateWidth)} ${row.source.padEnd(sourceWidth)} ${String(row.sessions).padEnd(10)}${String(row.users).padEnd(8)}`
|
|
1542
|
+
);
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1516
1545
|
async function gaCoverage(project, format) {
|
|
1517
1546
|
const client = getClient3();
|
|
1518
1547
|
const result = await client.gaCoverage(project);
|
|
@@ -1617,14 +1646,22 @@ var GA_CLI_COMMANDS = [
|
|
|
1617
1646
|
await gaCoverage(project, input.format);
|
|
1618
1647
|
}
|
|
1619
1648
|
},
|
|
1649
|
+
{
|
|
1650
|
+
path: ["ga", "ai-referral-history"],
|
|
1651
|
+
usage: "canonry ga ai-referral-history <project> [--format json]",
|
|
1652
|
+
run: async (input) => {
|
|
1653
|
+
const project = requireProject(input, "ga.ai-referral-history", "canonry ga ai-referral-history <project> [--format json]");
|
|
1654
|
+
await gaAiReferralHistory(project, input.format);
|
|
1655
|
+
}
|
|
1656
|
+
},
|
|
1620
1657
|
{
|
|
1621
1658
|
path: ["ga"],
|
|
1622
|
-
usage: "canonry ga <connect|disconnect|status|sync|traffic|coverage> <project> [args]",
|
|
1659
|
+
usage: "canonry ga <connect|disconnect|status|sync|traffic|coverage|ai-referral-history> <project> [args]",
|
|
1623
1660
|
run: async (input) => {
|
|
1624
1661
|
unknownSubcommand(input.positionals[0], {
|
|
1625
1662
|
command: "ga",
|
|
1626
|
-
usage: "canonry ga <connect|disconnect|status|sync|traffic|coverage> <project> [args]",
|
|
1627
|
-
available: ["connect", "disconnect", "status", "sync", "traffic", "coverage"]
|
|
1663
|
+
usage: "canonry ga <connect|disconnect|status|sync|traffic|coverage|ai-referral-history> <project> [args]",
|
|
1664
|
+
available: ["connect", "disconnect", "status", "sync", "traffic", "coverage", "ai-referral-history"]
|
|
1628
1665
|
});
|
|
1629
1666
|
}
|
|
1630
1667
|
}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ainyc/canonry",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.35.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The ultimate open-source AEO monitoring tool - track how answer engines cite your domain",
|
|
6
6
|
"license": "FSL-1.1-ALv2",
|
|
@@ -55,18 +55,18 @@
|
|
|
55
55
|
"tsup": "^8.5.1",
|
|
56
56
|
"tsx": "^4.19.0",
|
|
57
57
|
"@ainyc/canonry-api-routes": "0.0.0",
|
|
58
|
-
"@ainyc/canonry-contracts": "0.0.0",
|
|
59
58
|
"@ainyc/canonry-config": "0.0.0",
|
|
60
59
|
"@ainyc/canonry-integration-bing": "0.0.0",
|
|
60
|
+
"@ainyc/canonry-db": "0.0.0",
|
|
61
|
+
"@ainyc/canonry-contracts": "0.0.0",
|
|
61
62
|
"@ainyc/canonry-integration-google": "0.0.0",
|
|
62
63
|
"@ainyc/canonry-integration-wordpress": "0.0.0",
|
|
63
64
|
"@ainyc/canonry-provider-cdp": "0.0.0",
|
|
64
65
|
"@ainyc/canonry-provider-claude": "0.0.0",
|
|
65
|
-
"@ainyc/canonry-db": "0.0.0",
|
|
66
|
-
"@ainyc/canonry-provider-gemini": "0.0.0",
|
|
67
66
|
"@ainyc/canonry-provider-local": "0.0.0",
|
|
67
|
+
"@ainyc/canonry-provider-openai": "0.0.0",
|
|
68
68
|
"@ainyc/canonry-provider-perplexity": "0.0.0",
|
|
69
|
-
"@ainyc/canonry-provider-
|
|
69
|
+
"@ainyc/canonry-provider-gemini": "0.0.0"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
72
|
"build": "tsup && tsx build-web.ts",
|