@gscdump/cli 4.0.0 → 4.0.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/README.md CHANGED
@@ -195,6 +195,8 @@ Dates must use `YYYY-MM-DD`, and `--start` cannot follow `--end`.
195
195
  Live queries expand a path to the Site's origin. For a domain property, a path matches that path on any host.
196
196
  Filtered dimensions choose the Store table too: `-d query --page /a` reads `page_queries`.
197
197
  If no Store table holds every dimension and filter, the query fails and names `--live`.
198
+ If the matching table exists but has no synced rows, an authenticated query can answer live instead.
199
+ Check `meta.source` before describing a result as saved Store data.
198
200
 
199
201
  ```bash
200
202
  # Export query rows with a CSV header.
package/dist/package.mjs CHANGED
@@ -1,2 +1,2 @@
1
- var version = "4.0.0";
1
+ var version = "4.0.1";
2
2
  export { version };
package/dist/route.mjs CHANGED
@@ -79,11 +79,13 @@ function decideRoute(req, state) {
79
79
  const connected = auth !== "none";
80
80
  const syncCommand = syncCommandFor(req.site ?? req.siteHint, coverage);
81
81
  const tables = [...new Set(coverage.flatMap((need) => need.kind === "window" ? [need.table] : need.tables))];
82
+ const searchTypes = [...new Set(coverage.flatMap((need) => need.searchType && need.searchType !== "web" ? [need.searchType] : []))];
82
83
  const notConnected = {
83
84
  kind: "prompt",
84
85
  reason: {
85
86
  kind: "not-connected",
86
- tables
87
+ tables,
88
+ ...searchTypes.length > 0 ? { searchTypes } : {}
87
89
  },
88
90
  nextCommand: CONNECT_COMMAND
89
91
  };
@@ -162,7 +164,11 @@ function routeMessage(route, req, auth) {
162
164
  }
163
165
  const next = route.nextCommand;
164
166
  switch (route.reason.kind) {
165
- case "not-connected": return `${route.reason.tables.length > 0 ? `The Store has no ${route.reason.tables.join(", ")} data for ${site}, and Google is not connected.` : `\`${req.label}\` needs Search Console, and Google is not connected.`} Run \`${next}\` to connect Google and sync the Site, or \`${LOGIN_COMMAND}\` to query Search Console directly.`;
167
+ case "not-connected": {
168
+ const types = route.reason.searchTypes ?? [];
169
+ const slice = types.length > 0 ? `${types.join(", ")} ` : "";
170
+ return `${route.reason.tables.length > 0 ? `The Store has no ${slice}${route.reason.tables.join(", ")} data for ${site}, and Google is not connected.` : `\`${req.label}\` needs Search Console, and Google is not connected.`} Run \`${next}\` to connect Google and sync the Site, or \`${LOGIN_COMMAND}\` to query Search Console directly.`;
171
+ }
166
172
  case "no-data": return `The Store has no ${route.reason.tables.join(", ")} data for ${site}. \`${req.label}\` reads synced data only. Run \`${next}\` first.`;
167
173
  case "live-only": return `\`${req.label}\` runs against the live Search Console API only. Run \`${next}\`.`;
168
174
  case "store-only": return `\`${req.label}\` reads synced data only. Remove --live. If the Store has no data for ${site}, run \`${next}\` first.`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gscdump/cli",
3
3
  "type": "module",
4
- "version": "4.0.0",
4
+ "version": "4.0.1",
5
5
  "description": "CLI for Google Search Console and Bing with hosted or local authentication, data exports, and an MCP server",
6
6
  "author": {
7
7
  "name": "Harlan Wilton",
@@ -44,16 +44,16 @@
44
44
  "dependencies": {
45
45
  "@clack/prompts": "^1.8.1",
46
46
  "@duckdb/node-api": "1.5.5-r.5",
47
- "@gscdump/analysis": "^4.0.0",
48
- "@gscdump/contracts": "^4.0.0",
49
- "@gscdump/engine": "^4.0.0",
50
- "@gscdump/engine-gsc-api": "^4.0.0",
51
- "@gscdump/sdk": "^4.0.0",
47
+ "@gscdump/analysis": "^4.0.1",
48
+ "@gscdump/contracts": "^4.0.1",
49
+ "@gscdump/engine": "^4.0.1",
50
+ "@gscdump/engine-gsc-api": "^4.0.1",
51
+ "@gscdump/sdk": "^4.0.1",
52
52
  "@modelcontextprotocol/sdk": "^1.30.1",
53
53
  "citty": "^0.2.2",
54
54
  "consola": "^3.4.2",
55
55
  "google-auth-library": "^11.1.0",
56
- "gscdump": "^4.0.0",
56
+ "gscdump": "^4.0.1",
57
57
  "ofetch": "^1.5.1",
58
58
  "open": "^11.0.4",
59
59
  "proper-lockfile": "^4.1.2",
@@ -20,8 +20,10 @@ Example: `gscdump query --site=SITE --start=DATE --end=DATE -d page -f json`.
20
20
  2. Keep the requested Site, dates, dimensions, and task scope. A request for pages does not need query dimensions.
21
21
  3. Before local queries, check coverage with `gscdump store stats --site SITE --json`.
22
22
  Use `gscdump sync --site SITE --status --json` when you need coverage, gaps, or sync-state details.
23
+ On a fresh Store, `store stats` exits 1 and says it has no data. Continue with the bounded sync.
23
24
  4. Read the table dimensions and watermarks. Sync only missing tables and the requested dates, once per task.
24
25
  5. Use `sync --json`. Read its completion result before deciding what to do next. Never repeat a successful sync.
26
+ 6. If the user asks for saved rows, check `meta.source: "local"` in the query result. A successful query can answer live when its table has no synced data.
25
27
 
26
28
  If the task only asks about deletion, explain the scope and ask for consent.
27
29
  You may read Store metadata with `store stats` and `sync --status`.
@@ -268,6 +270,7 @@ gscdump sync --site example.com --json
268
270
  - `--dry-run` prints the planned dates and the fewest calls without calling Google.
269
271
  - `--all-sites` syncs every verified Site, one after another.
270
272
  - Use the user's date range. If the user names a range, pass `--start` and `--end`, not `--full`.
273
+ - If the user excludes rollups, pass `--no-rollups` on the sync command.
271
274
  - Empty Store metadata is expected before the first sync. It does not prove zero traffic.
272
275
 
273
276
  ## Query rows
@@ -278,6 +281,8 @@ gscdump query --site example.com --dimensions page,query \
278
281
  ```
279
282
 
280
283
  - Dimension names are singular: `page`, `query`, `date`, `country`, `device`.
284
+ - A page breakdown uses `--tables pages` for sync and `-d page` for query.
285
+ `-d page,query` needs `page_queries`; syncing only `pages` does not fill that table.
281
286
  - Filters: `--query`, `--page`, `--country`, `--device`,
282
287
  `--search-appearance`. Prefixes: bare equals, `~` contains, `!~` not
283
288
  contains, `re:` regex, `!re:` not regex, `!` not equals.