@gscdump/cli 0.27.2 → 0.28.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.
Files changed (2) hide show
  1. package/dist/index.mjs +22 -3
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -32,7 +32,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
32
32
  import { z } from "zod";
33
33
  import { defaultReportRegistry, dryRunReport, formatReport, runReport } from "@gscdump/analysis/report";
34
34
  import { resolveWindow } from "@gscdump/engine/period";
35
- import { inferLegacyTier } from "@gscdump/engine";
35
+ import { collectSpans, inferLegacyTier } from "@gscdump/engine";
36
36
  import { DEFAULT_ROLLUPS, rebuildRollups } from "@gscdump/engine/rollups";
37
37
  import { filesystemStats } from "@gscdump/engine/filesystem";
38
38
  var __defProp = Object.defineProperty;
@@ -135,7 +135,7 @@ function loadEnvFromCwd() {
135
135
  }
136
136
  return applied;
137
137
  }
138
- var version = "0.27.2";
138
+ var version = "0.28.1";
139
139
  const ALL_SEARCH_TYPES$1 = Object.values(SearchTypes);
140
140
  const VERSION = version;
141
141
  function noSubcommandSelected(parent, subNames) {
@@ -4760,6 +4760,11 @@ const queryCommand = defineCommand({
4760
4760
  type: "boolean",
4761
4761
  default: false,
4762
4762
  description: "Print the request body / planned local SQL and exit without executing"
4763
+ },
4764
+ "profile": {
4765
+ type: "boolean",
4766
+ default: false,
4767
+ description: "Print a query timing breakdown (manifest list / file fetch / SQL run) to stderr (local mode only)"
4763
4768
  }
4764
4769
  },
4765
4770
  async run({ args }) {
@@ -4859,15 +4864,18 @@ const queryCommand = defineCommand({
4859
4864
  return;
4860
4865
  }
4861
4866
  await assertRangeCovered(store, siteUrl, table, startDate, endDate);
4867
+ const probe = Boolean(args.profile) ? collectSpans() : void 0;
4862
4868
  const result = await store.engine.query({
4863
4869
  userId: store.userId,
4864
4870
  siteId: store.siteIdFor(siteUrl),
4865
4871
  table,
4866
- ...searchType !== void 0 ? { searchType } : {}
4872
+ ...searchType !== void 0 ? { searchType } : {},
4873
+ ...probe ? { profiler: probe.profiler } : {}
4867
4874
  }, state).catch((e) => {
4868
4875
  logger.error(`Query failed: ${e.message}`);
4869
4876
  process.exit(1);
4870
4877
  });
4878
+ if (probe) logProfile(probe.spans);
4871
4879
  await writeOutput({
4872
4880
  output: {
4873
4881
  siteUrl,
@@ -5040,6 +5048,17 @@ async function runRawSqlMode(opts) {
5040
5048
  if (!opts.quiet) logger.info(`Written to ${opts.output}`);
5041
5049
  } else console.log(payload);
5042
5050
  }
5051
+ function logProfile(spans) {
5052
+ if (spans.length === 0) {
5053
+ logger.warn("No profiling spans recorded (the executor may not be instrumented).");
5054
+ return;
5055
+ }
5056
+ const fmtMeta = (m) => m ? Object.entries(m).map(([k, v]) => `${k}=${v}`).join(" ") : "";
5057
+ const row = (name, ms, meta) => ` ${name.padEnd(18)} ${`${ms}ms`.padStart(8)} ${fmtMeta(meta)}`.trimEnd();
5058
+ const lines = spans.map((s) => row(s.name, s.ms, s.meta));
5059
+ const total = spans.filter((s) => s.name === "manifest.list" || s.name === "executor.execute").reduce((n, s) => n + s.ms, 0);
5060
+ logger.info(`Query timing breakdown:\n${lines.join("\n")}\n${row("total", total)}`);
5061
+ }
5043
5062
  async function writeOutput(opts) {
5044
5063
  const content = opts.format === "csv" ? exportToCSV(opts.output) : JSON.stringify(opts.output, null, 2);
5045
5064
  if (opts.path && opts.path !== "-") {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gscdump/cli",
3
3
  "type": "module",
4
- "version": "0.27.2",
4
+ "version": "0.28.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/analysis": "0.27.2",
47
- "@gscdump/engine": "0.27.2",
48
- "gscdump": "0.27.2",
49
- "@gscdump/engine-gsc-api": "0.27.2"
46
+ "@gscdump/analysis": "0.28.1",
47
+ "@gscdump/engine-gsc-api": "0.28.1",
48
+ "gscdump": "0.28.1",
49
+ "@gscdump/engine": "0.28.1"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@duckdb/node-api": "1.5.1-r.2",