@nuxtseo/cli 0.5.5 → 0.5.7

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/commands.js CHANGED
@@ -55,6 +55,7 @@ function present(runtime, globals, result, render) {
55
55
  export const ALL_PAGES_REQUEST_CAP = 50;
56
56
  async function collect(runtime, globals, options) {
57
57
  let position = options.start;
58
+ const seenKeys = new Set();
58
59
  for (let request = 1;; request++) {
59
60
  const response = await withSpinner(runtime, options.message, () => options.fetch(position));
60
61
  if (response._tag === 'Err')
@@ -62,6 +63,12 @@ async function collect(runtime, globals, options) {
62
63
  emit(runtime, globals, response.value, options.render);
63
64
  if (!options.all)
64
65
  return ok(undefined);
66
+ for (const key of options.rowKeys?.(response.value) ?? []) {
67
+ if (seenKeys.has(key)) {
68
+ return fail(EXIT_CODE.infrastructure, 'paging_unstable: Search Console pages repeated row keys. Export coverage is incomplete. Preserve these responses for investigation.', undefined, 'paging_unstable');
69
+ }
70
+ seenKeys.add(key);
71
+ }
65
72
  const next = options.next(response.value, position);
66
73
  if (next._tag === 'Done')
67
74
  return ok(undefined);
@@ -647,6 +654,24 @@ async function searchAnalytics(runtime, globals, args) {
647
654
  },
648
655
  }, { signal: runtime.requestSignal }),
649
656
  render: value => renderSearchAnalytics(value.data),
657
+ rowKeys: (value) => {
658
+ const data = value.data;
659
+ if (!('rows' in data) || view.value === 'analysis')
660
+ return [];
661
+ return data.rows.flatMap((row) => {
662
+ // Canonical URLs can repeat legitimately. Only Google's exact page
663
+ // dimension is unique; older responses can omit it.
664
+ if (view.value === 'pages')
665
+ return 'gscPage' in row && typeof row.gscPage === 'string' ? [row.gscPage] : [];
666
+ if ('keyword' in row && typeof row.keyword === 'string')
667
+ return [row.keyword];
668
+ if ('country' in row)
669
+ return [row.country];
670
+ if ('device' in row)
671
+ return [row.device];
672
+ return [];
673
+ });
674
+ },
650
675
  next: (value, position) => {
651
676
  const data = value.data;
652
677
  if (!('total' in data) || !('rows' in data))
@@ -789,7 +814,16 @@ async function competitorWrite(runtime, globals, action) {
789
814
  params: { siteId: resolved.value.siteId },
790
815
  body: { domain: action.domain },
791
816
  }, { signal: runtime.requestSignal }));
792
- return present(runtime, globals, response, value => `${value.data.competitor.id}\t${value.data.competitor.domain}\tAnalysis queued`);
817
+ // The add only queues the analysis. Name the read that shows it, so the
818
+ // caller is not left with "queued" and no way to see the result.
819
+ const overview = `\`nuxtseo research overview --site ${resolved.value.siteId}\``;
820
+ const result = present(runtime, globals, response, value => [
821
+ `${value.data.competitor.id}\t${value.data.competitor.domain}\tAnalysis queued`,
822
+ `Run ${overview} in a few minutes to read the analysis.`,
823
+ ].join('\n'));
824
+ if (result._tag === 'Ok' && globals.json)
825
+ writeDiagnostic(runtime, `Note: Analysis runs in the background. Read it with ${overview}. The competitor's collectedAt stays null until the analysis finishes.`);
826
+ return result;
793
827
  }
794
828
  const response = await withSpinner(runtime, 'Removing competitor', () => resolved.value.api.client.research.removeCompetitor({
795
829
  params: { siteId: resolved.value.siteId, competitorId: action.competitorId },
@@ -1023,7 +1057,19 @@ async function sitemapsAction(runtime, globals, action, rawUrl) {
1023
1057
  params: { siteId: resolved.value.siteId },
1024
1058
  body: { action, sitemapUrl: sitemapUrl.value },
1025
1059
  }, { signal: runtime.requestSignal }));
1026
- return present(runtime, globals, response, value => renderSitemapAction(value.data));
1060
+ if (action === 'delete')
1061
+ return present(runtime, globals, response, value => renderSitemapAction(value.data));
1062
+ // Success means Search Console accepted the submit, not that Google read the
1063
+ // file. Name the read that shows the download, so the caller does not take
1064
+ // the submit for a fetch.
1065
+ const list = `\`nuxtseo sitemaps list --site ${resolved.value.siteId}\``;
1066
+ const result = present(runtime, globals, response, value => [
1067
+ renderSitemapAction(value.data),
1068
+ `Google downloads it later. Run ${list} to see when.`,
1069
+ ].join('\n'));
1070
+ if (result._tag === 'Ok' && globals.json)
1071
+ writeDiagnostic(runtime, `Note: Search Console accepted the sitemap. Google downloads it later. Run ${list} and read lastDownloaded and isPending.`);
1072
+ return result;
1027
1073
  }
1028
1074
  async function analyticsQuery(runtime, globals, args) {
1029
1075
  const view = parseChoice(args.view, { name: 'view', choices: ANALYTICS_VIEWS });
@@ -12,7 +12,7 @@ export declare const EXIT_CODE: {
12
12
  readonly interrupted: 130;
13
13
  };
14
14
  export type ExitCode = typeof EXIT_CODE[keyof typeof EXIT_CODE];
15
- export type LocalFailureCode = 'authentication_required' | 'authorization_required' | 'confirmation_required' | 'conflict' | 'contract_violation' | 'infrastructure_failure' | 'interrupted' | 'invalid_cli_input' | 'not_found' | 'paging_cap_reached' | 'pull_incomplete' | 'request_timeout' | 'retryable_failure' | 'site_ambiguous' | 'site_empty' | 'site_not_accessible' | 'state_error' | 'token_input_required' | 'transport_failure' | 'unexpected';
15
+ export type LocalFailureCode = 'authentication_required' | 'authorization_required' | 'confirmation_required' | 'conflict' | 'contract_violation' | 'infrastructure_failure' | 'interrupted' | 'invalid_cli_input' | 'not_found' | 'paging_cap_reached' | 'paging_unstable' | 'pull_incomplete' | 'request_timeout' | 'retryable_failure' | 'site_ambiguous' | 'site_empty' | 'site_not_accessible' | 'state_error' | 'token_input_required' | 'transport_failure' | 'unexpected';
16
16
  export type CliFailureCode = LocalFailureCode | Extract<SdkFailure, {
17
17
  _tag: 'ApiFailure';
18
18
  }>['code'];
package/dist/render.js CHANGED
@@ -469,6 +469,16 @@ export function renderIndexingDiagnostics(data) {
469
469
  data.hasMore ? `More URLs available after offset ${data.offset + data.limit}.` : '',
470
470
  ].filter(Boolean).join('\n');
471
471
  }
472
+ function renderResearchCompetitor(row) {
473
+ // A competitor without a collection time is still queued; its zero counts
474
+ // mean nothing yet.
475
+ if (row.collectedAt === null)
476
+ return `${row.domain} analysis pending`;
477
+ // Quick wins come from shared keywords. With none shared, "0 quick wins"
478
+ // says nothing about positions, so name the reason.
479
+ const overlap = row.sharedKeywords.length ? '' : ' no shared keywords';
480
+ return `${row.domain} ${row.metrics.organicTraffic ?? 'unknown'} traffic ${row.quickWins.length} quick wins${overlap}`;
481
+ }
472
482
  export function renderResearchOverview(data) {
473
483
  const subject = data.subject
474
484
  ? fields([
@@ -480,7 +490,7 @@ export function renderResearchOverview(data) {
480
490
  : 'No stored Site research.';
481
491
  const competitors = data.competitors.length === 0
482
492
  ? 'No stored competitors.'
483
- : data.competitors.map(row => `${row.domain} ${row.metrics.organicTraffic ?? 'unknown'} traffic ${row.quickWins.length} quick wins`).join('\n');
493
+ : data.competitors.map(renderResearchCompetitor).join('\n');
484
494
  return [subject, `Competitors: ${data.summary.competitorCount}`, competitors].join('\n');
485
495
  }
486
496
  export function renderKeywordResearch(data) {
package/dist/skill.js CHANGED
@@ -32,6 +32,15 @@ const AGENT_DIRECTORIES = {
32
32
  claude: '.claude',
33
33
  codex: '.codex',
34
34
  };
35
+ /**
36
+ * The notice names the agent. The check reads every agent's install, so a
37
+ * line without the name reads as the caller's own skill when another agent's
38
+ * copy is the stale one.
39
+ */
40
+ const AGENT_NAMES = {
41
+ claude: 'Claude Code',
42
+ codex: 'Codex',
43
+ };
35
44
  /**
36
45
  * The skill shipped inside this package. A global install puts it outside the
37
46
  * project, so the documented `cp -R node_modules/...` path does not exist for
@@ -210,7 +219,8 @@ export function skillNoticeFor(installed, current, agent) {
210
219
  return installed.version === current ? null : { agent, installed: installed.version, current };
211
220
  }
212
221
  export function skillNoticeLine(notice) {
213
- const installed = notice.installed === null ? 'skill version unknown' : `skill ${notice.installed} installed`;
222
+ const agent = AGENT_NAMES[notice.agent];
223
+ const installed = notice.installed === null ? `${agent} skill version unknown` : `${agent} skill ${notice.installed} installed`;
214
224
  if (notice.installed !== null) {
215
225
  const installedParts = /^(\d+)\.(\d+)\.(\d+)$/.exec(notice.installed);
216
226
  const currentParts = /^(\d+)\.(\d+)\.(\d+)$/.exec(notice.current);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxtseo/cli",
3
3
  "type": "module",
4
- "version": "0.5.5",
4
+ "version": "0.5.7",
5
5
  "description": "Command line interface for the Nuxt SEO public API.",
6
6
  "license": "MIT",
7
7
  "homepage": "https://nuxtseo.com/pro",
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@clack/prompts": "^1.8.0",
36
- "@nuxtseo/protocol": "^0.5.5",
37
- "@nuxtseo/sdk": "^0.5.5",
36
+ "@nuxtseo/protocol": "^0.5.7",
37
+ "@nuxtseo/sdk": "^0.5.7",
38
38
  "citty": "^0.2.2",
39
39
  "pathe": "^2.0.3"
40
40
  },
@@ -44,9 +44,11 @@ Read the matching file before you act on its subject:
44
44
  2. **Skill version.** Run `nuxtseo --version --json`. Compare the CLI version
45
45
  with this file's frontmatter version. If the CLI is older, update the CLI
46
46
  first. If the skill is older, run `nuxtseo skill install --agent claude` and
47
- re-read this file. An older skill hides commands. If
48
- `NUXTSEO_NO_UPDATE_CHECK` is set, the line never appears; compare this
49
- file's frontmatter `version` with the binary instead.
47
+ re-read this file. An older skill hides commands. The stderr line names
48
+ the agent whose copy differs, such as `Codex skill 0.5.3 installed`.
49
+ Refresh only that agent. If `NUXTSEO_NO_UPDATE_CHECK` is set, the line
50
+ never appears; compare this file's frontmatter `version` with the binary
51
+ instead.
50
52
 
51
53
  3. **Token.** Run `nuxtseo whoami --json`. It returns the Team, role, scopes,
52
54
  and token expiry. Exit `3` means no working token. Ask the user to run
@@ -199,7 +199,7 @@ The monitored Page then follows its own recurring schedule.
199
199
  | `search cohorts` | Not-indexed rate per route family. Returns `analysed: false` when the not-indexed list is a sample (`reason: sampled-index-state`). `--limit 1..50` (default 12), `--min-pages 1..500` (default 5). Paused Sites exit `4` or `5`. Removed Sites return `not_found` with exit `8` |
200
200
  | `sitemaps list` | Search Console sitemap snapshot: errors, warnings, URL counts, sync status |
201
201
  | `sitemaps urls` | Sitemap URL membership. `--generation-id`, `--feedpath`, `--cursor`, `--limit 1..1000` |
202
- | `sitemaps submit <sitemap-url>` | Mutation. Submits one sitemap through the Site's stored Search Console credential |
202
+ | `sitemaps submit <sitemap-url>` | Mutation. Submits one sitemap through the Site's stored Search Console credential. Success means Search Console accepted it, not that Google downloaded it. Read `lastDownloaded` and `isPending` in `sitemaps list` |
203
203
  | `sitemaps delete <sitemap-url>` | Mutation. Removes one sitemap through the Site's stored Search Console credential |
204
204
 
205
205
  Analysis presets for `search analytics analysis` are `striking-distance`,
@@ -258,9 +258,9 @@ research boundary in SKILL.md first.
258
258
 
259
259
  | Command | What it returns, and its flags |
260
260
  | --- | --- |
261
- | `research overview` | Stored Site and competitor research: metrics, history, gaps, quick wins. Takes no flags. Returns `data.competitors` and `data.summary` |
261
+ | `research overview` | Stored Site and competitor research: metrics, history, gaps, quick wins. Takes no flags. Returns `data.competitors` and `data.summary`. A competitor with `collectedAt: null` is still queued, so its empty lists mean nothing yet. Quick wins come from `sharedKeywords`; when that list is empty, zero quick wins says nothing about positions |
262
262
  | `research competitors list` | Tracked competitor domains and ids for this Site. Suggested competitors stay excluded. Reads start no provider work. |
263
- | `research competitors add <domain>` | Mutation, requires `research:write` and `--yes`. Accepts a public domain or URL. Queues analysis within existing Site and Team limits. Returns `data.competitor.id` and `data.status: queued`. |
263
+ | `research competitors add <domain>` | Mutation, requires `research:write` and `--yes`. Accepts a public domain or URL. Queues analysis within existing Site and Team limits. Returns `data.competitor.id` and `data.status: queued`. The analysis runs in the background; read it with `research overview` |
264
264
  | `research competitors remove <competitor-id>` | Mutation, requires `research:write` and `--yes`. Use an id from the list. Removes that Site's competitor without provider work. |
265
265
  | `research keywords <topic>` | Live keyword ideas, with volume, difficulty, intent, and cost data. The seed must be 1 to 3 words. The server refuses a longer seed. The refusal arrives as exit `0` with an empty `data.keywords`, so read `data.message` first. Comma-separate several short seeds instead. Special characters are stripped before the lookup. If a seed is under 2 characters after stripping, the server refuses it the same way. The server applies default filters and echoes them in `data.filters`: `--min-volume` (default 10), `--max-volume` (default 10000), `--min-difficulty 0..100` (default 0), `--max-difficulty 0..100` (default 60). So a default run hides keywords over difficulty 60 or under 10 searches. Also `--limit 1..100` (default 20), `--intent`, `--location-code` (default 2840), `--no-related` to drop related keywords, and `--verbose` for full evidence. If `--max-volume` is under `--min-volume`, the run exits `2`. The same holds for `--max-difficulty` under `--min-difficulty` |
266
266
  | `research serp <keyword>` | A live SERP snapshot: results, features, fetch time. `--depth 1..20` (default 10) sets how many organic results return. `--location-code` (default 2840). The keyword must be 2 to 200 characters. `data.cached` reports cache use |
@@ -89,6 +89,14 @@ The `--all` loop stops after 50 requests. If pages remain, the CLI exits `9`
89
89
  and stderr names the argument that resumes the read, for example `--offset 50`.
90
90
  Treat exit `9` as a stop, never as the end of the data.
91
91
 
92
+ Search Console breakdown exports stop with exit `7` and `paging_unstable`
93
+ when an exact row key repeats. The CLI preserves the offending response.
94
+ The export is incomplete. Preserve the responses and report the ordering issue.
95
+ Do not resume from a later page, because overlapping pages can also omit rows.
96
+ Canonical page URLs can repeat. The check uses `gscPage`, Google's exact page string.
97
+ Older page responses can omit `gscPage`, so those rows have no overlap check.
98
+ Analysis shortlists have no unique row contract and are excluded from this check.
99
+
92
100
  Pass the reported `offset` or opaque `cursor` for another page. Never edit or
93
101
  infer a cursor. Keep server order for actions. Never re-rank merged results.
94
102