@gscdump/cli 0.30.0 → 0.31.1
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/index.mjs +36 -3
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { defineCommand, runMain } from "citty";
|
|
|
4
4
|
import { defaultAnalyzerRegistry } from "@gscdump/analysis/registry";
|
|
5
5
|
import fs, { readFile, readdir, rm } from "node:fs/promises";
|
|
6
6
|
import path, { join } from "node:path";
|
|
7
|
-
import { AnalyzerCapabilityError, createEngineQuerySource, runAnalyzerFromSource } from "@gscdump/analysis";
|
|
7
|
+
import { AnalyzerCapabilityError, INTENT_CLASSIFIER_VERSION, NORMALIZER_VERSION, classifyQueryIntent, createEngineQuerySource, encodeIntent, normalizeQuery, runAnalyzerFromSource } from "@gscdump/analysis";
|
|
8
8
|
import { createGscApiQuerySource } from "@gscdump/engine-gsc-api";
|
|
9
9
|
import { err, ok, unwrapResult } from "gscdump/result";
|
|
10
10
|
import { decodeSiteId, normalizeSiteUrl } from "gscdump/tenant";
|
|
@@ -26,7 +26,7 @@ import { isEngineError } from "@gscdump/engine/errors";
|
|
|
26
26
|
import { DuckDBInstance } from "@duckdb/node-api";
|
|
27
27
|
import { sqlEscape } from "@gscdump/engine/sql";
|
|
28
28
|
import { dateReplaceClause } from "@gscdump/engine/sql-fragments";
|
|
29
|
-
import { createEmptyTypesStore, createIndexingMetadataStore, createInspectionStore, createSitemapStore } from "@gscdump/engine/entities";
|
|
29
|
+
import { buildQueryDimRecords, createEmptyTypesStore, createIndexingMetadataStore, createInspectionStore, createQueryDimStore, createSitemapStore } from "@gscdump/engine/entities";
|
|
30
30
|
import { daysAgo, getDateRange, progressBar } from "gscdump";
|
|
31
31
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
32
32
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -136,7 +136,7 @@ function loadEnvFromCwd() {
|
|
|
136
136
|
}
|
|
137
137
|
return applied;
|
|
138
138
|
}
|
|
139
|
-
var version = "0.
|
|
139
|
+
var version = "0.31.1";
|
|
140
140
|
const ALL_SEARCH_TYPES$1 = Object.values(SearchTypes);
|
|
141
141
|
const VERSION = version;
|
|
142
142
|
function noSubcommandSelected(parent, subNames) {
|
|
@@ -6347,6 +6347,35 @@ const gcCommand = defineCommand({
|
|
|
6347
6347
|
logger.success(`gc: deleted ${result.deleted} orphan file(s)`);
|
|
6348
6348
|
}
|
|
6349
6349
|
});
|
|
6350
|
+
async function buildSiteQueryDim(store, siteId) {
|
|
6351
|
+
const ctx = {
|
|
6352
|
+
userId: store.userId,
|
|
6353
|
+
siteId
|
|
6354
|
+
};
|
|
6355
|
+
const entries = await store.engine.listLive({
|
|
6356
|
+
userId: ctx.userId,
|
|
6357
|
+
siteId,
|
|
6358
|
+
table: "queries"
|
|
6359
|
+
});
|
|
6360
|
+
if (entries.length === 0) return 0;
|
|
6361
|
+
const { rows } = await store.engine.runSQL({
|
|
6362
|
+
ctx,
|
|
6363
|
+
table: "queries",
|
|
6364
|
+
fileSets: { FILES: {
|
|
6365
|
+
table: "queries",
|
|
6366
|
+
partitions: entries.map((e) => e.partition)
|
|
6367
|
+
} },
|
|
6368
|
+
sql: `SELECT DISTINCT query FROM read_parquet({{FILES}}, union_by_name = true) WHERE query IS NOT NULL`
|
|
6369
|
+
});
|
|
6370
|
+
const records = buildQueryDimRecords(rows.map((r) => String(r.query)), {
|
|
6371
|
+
normalizeQuery,
|
|
6372
|
+
normalizerVersion: NORMALIZER_VERSION,
|
|
6373
|
+
classifyIntentCode: (q) => encodeIntent(classifyQueryIntent(q)),
|
|
6374
|
+
intentVersion: INTENT_CLASSIFIER_VERSION
|
|
6375
|
+
});
|
|
6376
|
+
await createQueryDimStore({ dataSource: store.dataSource }).write(ctx, records, Date.now());
|
|
6377
|
+
return records.length;
|
|
6378
|
+
}
|
|
6350
6379
|
const rollupsCommand = defineCommand({
|
|
6351
6380
|
meta: {
|
|
6352
6381
|
name: "rollups",
|
|
@@ -6395,6 +6424,10 @@ const rollupsCommand = defineCommand({
|
|
|
6395
6424
|
const summary = [];
|
|
6396
6425
|
let totalBytes = 0;
|
|
6397
6426
|
for (const siteId of allSiteIds) {
|
|
6427
|
+
if (args["with-canonical"]) {
|
|
6428
|
+
const dimRows = await buildSiteQueryDim(store, siteId);
|
|
6429
|
+
if (!json) logger.info(`Built query dimension for [${siteId}] (${dimRows} distinct queries, normalizer v${NORMALIZER_VERSION})`);
|
|
6430
|
+
}
|
|
6398
6431
|
logger.info(`Rebuilding rollups for [${siteId}] (${defs.length} rollups)`);
|
|
6399
6432
|
const results = await rebuildRollups({
|
|
6400
6433
|
engine: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gscdump/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.31.1",
|
|
5
5
|
"description": "CLI for Google Search Console - dump, query, and run MCP server",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"ofetch": "^1.5.1",
|
|
44
44
|
"open": "^11.0.0",
|
|
45
45
|
"zod": "^4.4.3",
|
|
46
|
-
"@gscdump/
|
|
47
|
-
"gscdump": "0.
|
|
48
|
-
"@gscdump/engine-gsc-api": "0.
|
|
49
|
-
"
|
|
46
|
+
"@gscdump/analysis": "0.31.1",
|
|
47
|
+
"@gscdump/engine": "0.31.1",
|
|
48
|
+
"@gscdump/engine-gsc-api": "0.31.1",
|
|
49
|
+
"gscdump": "0.31.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@duckdb/node-api": "1.5.1-r.2",
|