@gscdump/cli 0.26.10 → 0.27.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/index.mjs +19 -11
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { err, ok, unwrapResult } from "gscdump/result";
|
|
|
10
10
|
import { decodeSiteId, normalizeSiteUrl } from "gscdump/tenant";
|
|
11
11
|
import os from "node:os";
|
|
12
12
|
import { cancel, confirm, isCancel, multiselect, select, text } from "@clack/prompts";
|
|
13
|
-
import { addSite, batchInspectUrls, batchRequestIndexing, createAuth,
|
|
13
|
+
import { addSite, batchInspectUrls, batchRequestIndexing, createAuth, deleteSite, discoverSitemap, fetchSitemap, fetchSitemapUrls, fetchSitesWithSitemaps, formatErrorForCli, getIndexingMetadata, getVerificationToken, getVerifiedSite, googleSearchConsole, listVerifiedSites, requestIndexing, runSequentialBatch, siteUrlToVerificationSite, unverifySite, verificationMethodsFor, verifySite } from "gscdump/api";
|
|
14
14
|
import { createServer } from "node:http";
|
|
15
15
|
import { JWT, OAuth2Client } from "google-auth-library";
|
|
16
16
|
import { ofetch } from "ofetch";
|
|
@@ -26,6 +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 { createEmptyTypesStore, createIndexingMetadataStore, createInspectionStore, createSitemapStore } from "@gscdump/engine/entities";
|
|
29
|
+
import { daysAgo, getDateRange, progressBar } from "gscdump";
|
|
29
30
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
30
31
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
31
32
|
import { z } from "zod";
|
|
@@ -49,6 +50,7 @@ var config_exports = /* @__PURE__ */ __exportAll({
|
|
|
49
50
|
getConfigDir: () => getConfigDir,
|
|
50
51
|
getConfigPath: () => getConfigPath,
|
|
51
52
|
loadConfig: () => loadConfig,
|
|
53
|
+
loadResolvedConfig: () => loadResolvedConfig,
|
|
52
54
|
resolveDataDir: () => resolveDataDir,
|
|
53
55
|
saveConfig: () => saveConfig,
|
|
54
56
|
setConfigDir: () => setConfigDir
|
|
@@ -74,6 +76,13 @@ function expandTilde(p) {
|
|
|
74
76
|
async function loadConfig() {
|
|
75
77
|
return fs.readFile(path.join(configDir, "config.json"), "utf-8").then((data) => JSON.parse(data)).catch(() => ({}));
|
|
76
78
|
}
|
|
79
|
+
async function loadResolvedConfig() {
|
|
80
|
+
const config = await loadConfig();
|
|
81
|
+
return {
|
|
82
|
+
config,
|
|
83
|
+
dataDir: resolveDataDir(config)
|
|
84
|
+
};
|
|
85
|
+
}
|
|
77
86
|
async function saveConfig(config) {
|
|
78
87
|
await fs.mkdir(configDir, {
|
|
79
88
|
recursive: true,
|
|
@@ -126,7 +135,7 @@ function loadEnvFromCwd() {
|
|
|
126
135
|
}
|
|
127
136
|
return applied;
|
|
128
137
|
}
|
|
129
|
-
var version = "0.
|
|
138
|
+
var version = "0.27.0";
|
|
130
139
|
const ALL_SEARCH_TYPES$1 = Object.values(SearchTypes);
|
|
131
140
|
const VERSION = version;
|
|
132
141
|
function noSubcommandSelected(parent, subNames) {
|
|
@@ -768,14 +777,14 @@ function createLocalStore(opts) {
|
|
|
768
777
|
var context_exports = /* @__PURE__ */ __exportAll({ createCommandContext: () => createCommandContext });
|
|
769
778
|
async function createCommandContext(opts = {}) {
|
|
770
779
|
const { needsAuth = false, needsStore = false, interactive = false, byok, fetchOptions } = opts;
|
|
771
|
-
const config = await
|
|
780
|
+
const { config, dataDir } = await loadResolvedConfig();
|
|
772
781
|
const auth = needsAuth ? await resolveAuth({
|
|
773
782
|
interactive,
|
|
774
783
|
config,
|
|
775
784
|
byok
|
|
776
785
|
}) : null;
|
|
777
786
|
const client = auth ? googleSearchConsole(auth, { fetchOptions }) : null;
|
|
778
|
-
const store = needsStore ? createLocalStore({ dataDir
|
|
787
|
+
const store = needsStore ? createLocalStore({ dataDir }) : null;
|
|
779
788
|
const loadSites = async () => {
|
|
780
789
|
if (!client) throw new Error("loadSites requires needsAuth: true");
|
|
781
790
|
return (await client.sites().catch((e) => {
|
|
@@ -929,8 +938,7 @@ async function resolveAnalysisSource(args) {
|
|
|
929
938
|
const isLive = !!args.live;
|
|
930
939
|
const format = args.json ? "json" : args.format ? String(args.format) : "table";
|
|
931
940
|
if (!isLive) {
|
|
932
|
-
const config = await
|
|
933
|
-
const dataDir = resolveDataDir(config);
|
|
941
|
+
const { config, dataDir } = await loadResolvedConfig();
|
|
934
942
|
const store = createLocalStore({ dataDir });
|
|
935
943
|
const siteHint = args.site ? String(args.site) : config.defaultSite;
|
|
936
944
|
const localSites = await listLocalSites(dataDir, store.userId);
|
|
@@ -2434,7 +2442,7 @@ async function checkTimeSkew() {
|
|
|
2434
2442
|
}];
|
|
2435
2443
|
}
|
|
2436
2444
|
async function checkDataDir() {
|
|
2437
|
-
const dataDir =
|
|
2445
|
+
const { dataDir } = await loadResolvedConfig();
|
|
2438
2446
|
const display = displayPath(dataDir);
|
|
2439
2447
|
const stat = await fs.stat(dataDir).catch(() => null);
|
|
2440
2448
|
if (!stat) return [{
|
|
@@ -2459,7 +2467,7 @@ async function checkDataDir() {
|
|
|
2459
2467
|
}];
|
|
2460
2468
|
}
|
|
2461
2469
|
async function checkStoreWatermarks() {
|
|
2462
|
-
const dataDir =
|
|
2470
|
+
const { dataDir } = await loadResolvedConfig();
|
|
2463
2471
|
if (!(await fs.stat(dataDir).catch(() => null))?.isDirectory()) return [{
|
|
2464
2472
|
name: "store.watermarks",
|
|
2465
2473
|
status: "pass",
|
|
@@ -6857,7 +6865,7 @@ const syncCommand = defineCommand({
|
|
|
6857
6865
|
async run({ args }) {
|
|
6858
6866
|
const { json, quiet } = applyOutputMode(args);
|
|
6859
6867
|
if (args.status) {
|
|
6860
|
-
await printSyncStatus(await
|
|
6868
|
+
await printSyncStatus(await loadResolvedConfig(), args.site ? String(args.site) : void 0, json);
|
|
6861
6869
|
return;
|
|
6862
6870
|
}
|
|
6863
6871
|
const ctx = await createCommandContext({
|
|
@@ -7069,8 +7077,8 @@ function isKnownTable(name) {
|
|
|
7069
7077
|
function isKnownSearchType(name) {
|
|
7070
7078
|
return ALL_SEARCH_TYPES.includes(name);
|
|
7071
7079
|
}
|
|
7072
|
-
async function printSyncStatus(
|
|
7073
|
-
const store = createLocalStore({ dataDir:
|
|
7080
|
+
async function printSyncStatus(resolved, siteFilter, asJson) {
|
|
7081
|
+
const store = createLocalStore({ dataDir: resolved.dataDir });
|
|
7074
7082
|
const siteId = siteFilter ? store.siteIdFor(siteFilter) : void 0;
|
|
7075
7083
|
const watermarks = await store.engine.getWatermarks({
|
|
7076
7084
|
userId: store.userId,
|
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.27.0",
|
|
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/engine-gsc-api": "0.
|
|
48
|
-
"
|
|
49
|
-
"gscdump": "0.
|
|
46
|
+
"@gscdump/engine": "0.27.0",
|
|
47
|
+
"@gscdump/engine-gsc-api": "0.27.0",
|
|
48
|
+
"gscdump": "0.27.0",
|
|
49
|
+
"@gscdump/analysis": "0.27.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@duckdb/node-api": "1.5.1-r.2",
|