@gscdump/cli 0.37.2 → 0.37.4
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/bin/gscdump.mjs +3 -0
- package/dist/_chunks/analysis-local.mjs +88 -0
- package/dist/_chunks/analyze.mjs +332 -0
- package/dist/_chunks/auth.mjs +476 -0
- package/dist/_chunks/auth2.mjs +293 -0
- package/dist/_chunks/config.mjs +93 -0
- package/dist/_chunks/config2.mjs +232 -0
- package/dist/_chunks/context.mjs +69 -0
- package/dist/_chunks/doctor.mjs +400 -0
- package/dist/_chunks/dump.mjs +193 -0
- package/dist/_chunks/entities.mjs +414 -0
- package/dist/_chunks/env-file.mjs +53 -0
- package/dist/_chunks/environment.mjs +30 -0
- package/dist/_chunks/error-handler.mjs +86 -0
- package/dist/_chunks/indexing.mjs +314 -0
- package/dist/_chunks/init.mjs +190 -0
- package/dist/_chunks/inspect.mjs +203 -0
- package/dist/_chunks/mcp.mjs +867 -0
- package/dist/_chunks/native-duckdb.mjs +46 -0
- package/dist/_chunks/profile.mjs +290 -0
- package/dist/_chunks/query.mjs +537 -0
- package/dist/_chunks/report.mjs +243 -0
- package/dist/_chunks/sitemaps.mjs +274 -0
- package/dist/_chunks/sites.mjs +500 -0
- package/dist/_chunks/store.mjs +652 -0
- package/dist/_chunks/sync.mjs +489 -0
- package/dist/_chunks/utils.mjs +191 -0
- package/dist/cli.d.mts +28 -0
- package/dist/cli.mjs +104 -0
- package/package.json +15 -7
- package/dist/index.d.mts +0 -1
- package/dist/index.mjs +0 -7330
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { createCliRuntime, runWithCliRuntime } from "./_chunks/config.mjs";
|
|
2
|
+
import { resolveCliEnvironment } from "./_chunks/environment.mjs";
|
|
3
|
+
import { VERSION, configureColor, showSplash, withConfiguredOutput } from "./_chunks/utils.mjs";
|
|
4
|
+
import { applyProfileFromCli } from "./_chunks/profile.mjs";
|
|
5
|
+
import { loadEnvFromCwd } from "./_chunks/env-file.mjs";
|
|
6
|
+
import process from "node:process";
|
|
7
|
+
import { defineCommand, runMain } from "citty";
|
|
8
|
+
function shouldShowSplash(rawArgs) {
|
|
9
|
+
if (!process.stdout.isTTY) return false;
|
|
10
|
+
if (rawArgs.includes("mcp")) return false;
|
|
11
|
+
for (const flag of [
|
|
12
|
+
"--json",
|
|
13
|
+
"--quiet",
|
|
14
|
+
"-q",
|
|
15
|
+
"--version",
|
|
16
|
+
"-v",
|
|
17
|
+
"--help",
|
|
18
|
+
"-h"
|
|
19
|
+
]) if (rawArgs.includes(flag)) return false;
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
function prepareCliArgs(input) {
|
|
23
|
+
const rawArgs = [...input];
|
|
24
|
+
const env = resolveCliEnvironment();
|
|
25
|
+
configureColor({
|
|
26
|
+
noColor: rawArgs.includes("--no-color") || env.noColor,
|
|
27
|
+
forceColor: env.forceColor,
|
|
28
|
+
stderrIsTTY: Boolean(process.stderr.isTTY)
|
|
29
|
+
});
|
|
30
|
+
const profile = pluckArgValue(rawArgs, "--profile");
|
|
31
|
+
applyProfileFromCli({
|
|
32
|
+
configDir: pluckArgValue(rawArgs, "--config-dir") ?? env.configDir ?? null,
|
|
33
|
+
profile,
|
|
34
|
+
envProfile: env.profile
|
|
35
|
+
});
|
|
36
|
+
if (rawArgs.includes("-v") && !rawArgs.includes("--version")) {
|
|
37
|
+
const i = rawArgs.indexOf("-v");
|
|
38
|
+
rawArgs[i] = "--version";
|
|
39
|
+
}
|
|
40
|
+
return rawArgs;
|
|
41
|
+
}
|
|
42
|
+
function pluckArgValue(argv, flag) {
|
|
43
|
+
for (let i = 0; i < argv.length; i++) {
|
|
44
|
+
const a = argv[i];
|
|
45
|
+
if (a === flag && i + 1 < argv.length) {
|
|
46
|
+
const v = argv[i + 1];
|
|
47
|
+
argv.splice(i, 2);
|
|
48
|
+
return v;
|
|
49
|
+
}
|
|
50
|
+
if (a.startsWith(`${flag}=`)) {
|
|
51
|
+
const v = a.slice(flag.length + 1);
|
|
52
|
+
argv.splice(i, 1);
|
|
53
|
+
return v;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const main = defineCommand({
|
|
59
|
+
meta: {
|
|
60
|
+
name: "gscdump",
|
|
61
|
+
version: VERSION,
|
|
62
|
+
description: "Google Search Console Data Extractor"
|
|
63
|
+
},
|
|
64
|
+
subCommands: {
|
|
65
|
+
init: () => import("./_chunks/init.mjs").then((m) => m.initCommand),
|
|
66
|
+
dump: () => import("./_chunks/dump.mjs").then((m) => m.dumpCommand),
|
|
67
|
+
query: () => import("./_chunks/query.mjs").then((m) => m.queryCommand),
|
|
68
|
+
sites: () => import("./_chunks/sites.mjs").then((m) => m.sitesCommand),
|
|
69
|
+
sitemaps: () => import("./_chunks/sitemaps.mjs").then((m) => m.sitemapsCommand),
|
|
70
|
+
sync: () => import("./_chunks/sync.mjs").then((m) => m.syncCommand),
|
|
71
|
+
store: () => import("./_chunks/store.mjs").then((m) => m.storeCommand),
|
|
72
|
+
inspect: () => import("./_chunks/inspect.mjs").then((m) => m.inspectCommand),
|
|
73
|
+
indexing: () => import("./_chunks/indexing.mjs").then((m) => m.indexingCommand),
|
|
74
|
+
entities: () => import("./_chunks/entities.mjs").then((m) => m.entitiesCommand),
|
|
75
|
+
analyze: () => import("./_chunks/analyze.mjs").then((m) => m.analyzeCommand),
|
|
76
|
+
report: () => import("./_chunks/report.mjs").then((m) => m.reportCommand),
|
|
77
|
+
auth: () => import("./_chunks/auth2.mjs").then((m) => m.authCommand),
|
|
78
|
+
login: () => import("./_chunks/auth2.mjs").then((m) => m.loginCommand),
|
|
79
|
+
logout: () => import("./_chunks/auth2.mjs").then((m) => m.logoutCommand),
|
|
80
|
+
status: () => import("./_chunks/auth2.mjs").then((m) => m.statusCommand),
|
|
81
|
+
config: () => import("./_chunks/config2.mjs").then((m) => m.configCommand),
|
|
82
|
+
profile: () => import("./_chunks/profile.mjs").then((n) => n.profile_exports).then((m) => m.profileCommand),
|
|
83
|
+
doctor: () => import("./_chunks/doctor.mjs").then((m) => m.doctorCommand),
|
|
84
|
+
mcp: () => import("./_chunks/mcp.mjs").then((m) => m.mcpCommand)
|
|
85
|
+
},
|
|
86
|
+
setup({ rawArgs }) {
|
|
87
|
+
if (shouldShowSplash(rawArgs)) showSplash();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
async function runCli(opts = {}) {
|
|
91
|
+
const input = opts.rawArgs ?? process.argv.slice(2);
|
|
92
|
+
const runtime = opts.runtime ?? createCliRuntime({
|
|
93
|
+
environment: opts.environment,
|
|
94
|
+
rawArgs: input
|
|
95
|
+
});
|
|
96
|
+
runtime.rawArgs = [...input];
|
|
97
|
+
await runWithCliRuntime(runtime, async () => {
|
|
98
|
+
if (opts.loadEnv !== false) loadEnvFromCwd();
|
|
99
|
+
const rawArgs = prepareCliArgs(input);
|
|
100
|
+
runtime.rawArgs = [...rawArgs];
|
|
101
|
+
await withConfiguredOutput(() => runMain(main, { rawArgs }));
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
export { createCliRuntime, main, runCli };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gscdump/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.37.
|
|
4
|
+
"version": "0.37.4",
|
|
5
5
|
"description": "CLI for Google Search Console - dump, query, and run MCP server",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -28,14 +28,23 @@
|
|
|
28
28
|
"search-analytics",
|
|
29
29
|
"data-export"
|
|
30
30
|
],
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/cli.d.mts",
|
|
34
|
+
"import": "./dist/cli.mjs",
|
|
35
|
+
"default": "./dist/cli.mjs"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
31
38
|
"bin": {
|
|
32
|
-
"gscdump": "./
|
|
39
|
+
"gscdump": "./bin/gscdump.mjs"
|
|
33
40
|
},
|
|
34
41
|
"files": [
|
|
42
|
+
"bin",
|
|
35
43
|
"dist"
|
|
36
44
|
],
|
|
37
45
|
"dependencies": {
|
|
38
46
|
"@clack/prompts": "^1.7.0",
|
|
47
|
+
"@duckdb/node-api": "1.5.1-r.2",
|
|
39
48
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
40
49
|
"citty": "^0.2.2",
|
|
41
50
|
"consola": "^3.4.2",
|
|
@@ -43,13 +52,12 @@
|
|
|
43
52
|
"ofetch": "^1.5.1",
|
|
44
53
|
"open": "^11.0.0",
|
|
45
54
|
"zod": "^4.4.3",
|
|
46
|
-
"@gscdump/analysis": "0.37.
|
|
47
|
-
"@gscdump/engine
|
|
48
|
-
"gscdump": "0.37.
|
|
49
|
-
"
|
|
55
|
+
"@gscdump/analysis": "0.37.4",
|
|
56
|
+
"@gscdump/engine": "0.37.4",
|
|
57
|
+
"@gscdump/engine-gsc-api": "0.37.4",
|
|
58
|
+
"gscdump": "0.37.4"
|
|
50
59
|
},
|
|
51
60
|
"devDependencies": {
|
|
52
|
-
"@duckdb/node-api": "1.5.1-r.2",
|
|
53
61
|
"vitest": "^4.1.9"
|
|
54
62
|
},
|
|
55
63
|
"scripts": {
|
package/dist/index.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|