@rankwrangler/cli 0.4.0 → 0.4.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
@@ -12,6 +12,8 @@ npm install -g @rankwrangler/cli
12
12
 
13
13
  ```bash
14
14
  export RR_LICENSE_KEY=rrk_...
15
+ rw --version
16
+ rw changelog
15
17
  rw config set storage-dir ~/.config/rankwrangler
16
18
  rw products get B0DV53VS61
17
19
  rw products history B0DV53VS61 --metrics bsr,price
@@ -22,6 +24,8 @@ rw products history B0DV53VS61 --metrics bsr,price
22
24
  active storage directory globally. After that, every CLI command reads and writes its non-secret
23
25
  config/data from that directory, while preserving existing config values when switching.
24
26
  `RR_STORAGE_DIR`, `RR_API_URL`, and `RR_MARKETPLACE_ID` override saved CLI config when set.
27
+ `rw --version` prints the installed CLI version. `rw changelog` prints the latest bundled release
28
+ notes shipped with the package.
25
29
 
26
30
  ## Development
27
31
 
@@ -46,6 +50,9 @@ bun run release:check-cli-pack
46
50
 
47
51
  Then publish:
48
52
 
53
+ Publish `packages/http-client` first. `packages/cli` now fails fast on `npm publish` until the
54
+ matching `@rankwrangler/http-client` version is already available on npm.
55
+
49
56
  ```bash
50
57
  cd packages/cli
51
58
  set -a
@@ -0,0 +1,187 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## v0.4.1 - 2026-03-09
6
+
7
+ ### Added
8
+
9
+ - Add CLI `rw --version` and `rw changelog` commands, including bundled release notes in the
10
+ published npm package.
11
+
12
+ ### Changed
13
+
14
+ - Rotate API key generation by email so creating a new key for the same email replaces older
15
+ active keys.
16
+ - Remove the remaining PostHog integration from the server runtime, config, and related docs.
17
+
18
+ ### Fixed
19
+
20
+ - Make CLI publish fail fast until the matching `@rankwrangler/http-client` version is already on
21
+ npm, reducing release-order mistakes.
22
+
23
+ ## v0.4.0 - 2026-03-09
24
+
25
+ ### Added
26
+
27
+ - Add `RR_STORAGE_DIR` and document CLI env vars in `.env.example` so local CLI testing can use
28
+ env-based configuration end to end.
29
+
30
+ ### Changed
31
+
32
+ - Make CLI environment variables override saved config for storage-dir, API origin, and
33
+ marketplace values.
34
+
35
+ ### Fixed
36
+
37
+ - Fix the built CLI package to run under Node after the CLI module split and strengthen release
38
+ pack validation around the built artifact.
39
+
40
+ ## v0.3.0 - 2026-03-09
41
+
42
+ ### Added
43
+
44
+ - Add BA Top Search Terms ingestion, trend views, keyword search, and job execution visibility
45
+ across the dashboard.
46
+ - Add product facet classification, facet metrics, and facet badges to improve dashboard filtering
47
+ and product detail context.
48
+ - Add persistent CLI storage-directory support so local CLI config/data can move to a custom path.
49
+ - Add `RR_STORAGE_DIR` so CLI storage location can be controlled by environment as well as saved
50
+ config.
51
+
52
+ ### Changed
53
+
54
+ - Redesign the search terms dashboard UI with richer toolbar controls, stat sparklines, clearer
55
+ metric timing, and stronger layout polish.
56
+ - Improve top search terms scheduling, batching, report polling, and status performance so refresh
57
+ throughput and visibility stay stable as datasets grow.
58
+ - Centralize adaptive SP-API limiter tuning and expose limiter stats for better operational control.
59
+ - Breaking: require `RR_LICENSE_KEY` for CLI auth and stop storing API keys in CLI config.
60
+
61
+ ### Fixed
62
+
63
+ - Fix weekly top search terms windows to align to Sunday-Saturday boundaries and correct
64
+ reclassification batch payload handling.
65
+ - Tighten merch keyword filtering and category-slot parsing to reduce seasonal/accessory noise
66
+ without dropping valid terms.
67
+ - Fix Node runtime imports in the built CLI package and strengthen release pack validation after
68
+ the CLI module split.
69
+ - Fix facet metrics timestamp anchoring, SQL casting, and drawer badge data flow in dashboard
70
+ surfaces.
71
+
72
+ ## v0.2.3 - 2026-03-01
73
+
74
+ ### Added
75
+
76
+ - Add CLI `products history` agent output for BSR and price metric series.
77
+ - Add dashboard logs page and event log pipeline with Keepa queue/poll visibility.
78
+ - Add tiered Keepa scheduling with improved enqueue metrics and status reporting.
79
+ - Add shared history chart usage across website and extension surfaces.
80
+ - Add extension UI preview workflow updates with safer placeholder license key handling.
81
+
82
+ ### Changed
83
+
84
+ - Handle SP-API no-payload catalog responses as product deletions in sync flows.
85
+ - Refine event logging behavior, server documentation, and Keepa policy labeling.
86
+
87
+ ### Fixed
88
+
89
+ - Fix product drawer chart skeleton height and sponsored carousel stats placement.
90
+ - Fix Caddy build wiring to include the history-chart workspace dependency.
91
+ - Improve dashboard log view layout behavior and readability.
92
+
93
+ ## v0.2.2 - 2026-02-24
94
+
95
+ ### Added
96
+
97
+ - Add dashboard-style BSR chart styling to the extension product view.
98
+ - Add Keepa stale sync tests and documentation coverage.
99
+
100
+ ### Changed
101
+
102
+ - Add bottom border to the appearance settings section for stronger visual separation.
103
+ - Clarify agent guidance for work-in-progress rewrite expectations.
104
+
105
+ ### Fixed
106
+
107
+ - Clarify history chart date labeling behavior.
108
+
109
+ ## v0.2.1 - 2026-02-22
110
+
111
+ ### Added
112
+
113
+ - Add fuzzy dashboard product search and stronger filter-driven sidebar workflows.
114
+ - Add extension BSR history graph flow, including history sheet deep-linking from BSR badges.
115
+ - Add admin job runtime observability, queue log browsing, and per-source drilldown stats.
116
+ - Add Keepa sync loading states and richer history date-range controls.
117
+
118
+ ### Changed
119
+
120
+ - Move product ingest processing to an event-driven queue flow and align Keepa refresh to one-shot
121
+ enqueue jobs.
122
+ - Rename ingest queue labeling to the SP-API sync queue across admin surfaces.
123
+ - Refine BSR/history chart interactions, sparse-range handling, and loading/empty-state behavior.
124
+ - Improve extension build prebuild dependency handling and dashboard/admin UI polish.
125
+ - Clarify docs for Keepa automatic vs manual behavior.
126
+
127
+ ## v0.2.0 - 2026-02-20
128
+
129
+ ### Added
130
+
131
+ - Add Keepa history import flow and dashboard history UI.
132
+ - Add Keepa refresh queue processing and Keepa status metrics in the dashboard.
133
+ - Add admin job runtime observability endpoints and dashboard visibility.
134
+ - Add extension BSR history modal with on-demand history loading flow.
135
+ - Add public + app product history query/load procedures for Keepa-backed BSR history.
136
+ - Add public API usage consumption to history query/load endpoints to enforce API key limits.
137
+
138
+ ### Changed
139
+
140
+ - Align Keepa refresh behavior to a one-shot enqueue model.
141
+ - Redesign dashboard sidebar header/layout, Keepa history panel, filters, and settings modal UX.
142
+ - Standardize external naming to `API key` across public API routes, CLI commands, extension UI
143
+ copy, and related docs.
144
+ - Rename CLI auth commands from `license status|validate` to `api-key status|validate`.
145
+ - Rename public API auth namespace from `api.public.license.*` to `api.public.apiKey.*` and app
146
+ namespace from `api.app.license.*` to `api.app.apiKey.*`.
147
+ - Switch CLI environment fallback from `RR_LICENSE_KEY` to `RR_API_KEY`.
148
+
149
+ ### Fixed
150
+
151
+ - Fix Keepa fetch worker job payload handling.
152
+
153
+ ## v0.1.3 - 2026-02-17
154
+
155
+ ### Changed
156
+
157
+ - Set `@rankwrangler/cli` to expose both `rw` (primary) and `rankwrangler` binaries.
158
+ - Tighten CLI help output into a concise man-style format and remove principles text from runtime
159
+ help.
160
+ - Remove legacy CLI command and flag aliases by default (`get-product-info`,
161
+ `get-product-info-batch`, `products get-batch`, `--licenseKey`, `--url`, `--marketplaceId`,
162
+ `--asins`).
163
+ - Add explicit CLI policy guidance that legacy aliases/compatibility shims require explicit user
164
+ direction.
165
+
166
+ ## v0.1.2 - 2026-02-17
167
+
168
+ ### Changed
169
+
170
+ - Update extension's pinned HTTP client tarball dependency to
171
+ `rankwrangler-http-client-0.1.2.tgz`.
172
+ - Update release docs to require synchronized versions between `CHANGELOG.md` releases and npm
173
+ packages.
174
+
175
+ ## v0.1.0 - 2026-02-16
176
+
177
+ ### Added
178
+
179
+ - Add public batch product endpoint (`api.public.getProductInfoBatch`) to support multi-ASIN workflows.
180
+ - Add CLI multi-ASIN product lookup (`products get <asin...>`) with default marketplace config and per-command override (`--marketplace` / `-m`).
181
+ - Add public license usage endpoints used by CLI/public HTTP clients for status and consume flows.
182
+
183
+ ### Changed
184
+
185
+ - Rename and standardize the typed npm client package to `@merchbase/rankwrangler-http-client`.
186
+ - Set initial HTTP client package release to `0.1.0` in `packages/http-client/package.json`.
187
+ - Document npm publish and versioning policy for the typed HTTP client in `docs/http-client-spec.md`.
@@ -0,0 +1,2 @@
1
+ export declare const printCliVersion: () => void;
2
+ export declare const printBundledChangelog: () => void;
@@ -0,0 +1,31 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { fileURLToPath } from 'node:url';
3
+ const PACKAGE_JSON_PATH = fileURLToPath(new URL('../package.json', import.meta.url));
4
+ const CHANGELOG_PATH = fileURLToPath(new URL('./CHANGELOG.md', import.meta.url));
5
+ const RELEASE_HEADING_PATTERN = /^## v\d+\.\d+\.\d+ - \d{4}-\d{2}-\d{2}$/gm;
6
+ export const printCliVersion = () => {
7
+ const metadata = readPackageMetadata();
8
+ console.log(metadata.version);
9
+ };
10
+ export const printBundledChangelog = () => {
11
+ const changelog = readBundledChangelog();
12
+ const latestEntry = extractLatestReleaseEntry(changelog);
13
+ console.log(latestEntry);
14
+ };
15
+ const readPackageMetadata = () => {
16
+ return JSON.parse(readFileSync(PACKAGE_JSON_PATH, 'utf8'));
17
+ };
18
+ const readBundledChangelog = () => {
19
+ return readFileSync(CHANGELOG_PATH, 'utf8').trim();
20
+ };
21
+ const extractLatestReleaseEntry = (changelog) => {
22
+ const matches = Array.from(changelog.matchAll(RELEASE_HEADING_PATTERN));
23
+ if (matches.length === 0) {
24
+ throw new Error('Bundled changelog is missing a release entry');
25
+ }
26
+ const latestMatch = matches[0];
27
+ const nextMatch = matches[1];
28
+ const start = latestMatch.index ?? 0;
29
+ const end = nextMatch?.index ?? changelog.length;
30
+ return changelog.slice(start, end).trim();
31
+ };
@@ -11,6 +11,7 @@ export type CliOptionValues = {
11
11
  days?: string;
12
12
  limit?: string;
13
13
  help?: boolean;
14
+ version?: boolean;
14
15
  };
15
16
  export declare const requireMarketplaceId: (values: CliOptionValues, config: CliConfig) => string;
16
17
  export declare const requireAsins: (commandArgs: string[], values: CliOptionValues, fail: CliFail) => string[];
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { parseArgs } from 'node:util';
3
3
  import { createRankWranglerClient, DEFAULT_API_BASE_URL } from '@rankwrangler/http-client';
4
+ import { printBundledChangelog, printCliVersion } from './cli-metadata.js';
4
5
  import { clearConfig, loadCliContext, loadCliPathsOrDefault, saveConfig, switchStorageDir, } from './cli-config.js';
5
6
  import { normalizeBaseUrl, parseIntegerOption, requireAsins, requireMarketplaceId, requireSingleAsin, resolveApiKey, resolveBaseUrl, resolveHistoryMetrics, resolveHistoryWindow, } from './cli-options.js';
6
7
  import { fail, printSuccess, resolveError } from './cli-output.js';
@@ -19,6 +20,7 @@ const { positionals, values } = parseArgs({
19
20
  args: process.argv.slice(2),
20
21
  options: {
21
22
  help: { type: 'boolean', short: 'h' },
23
+ version: { type: 'boolean' },
22
24
  baseUrl: { type: 'string' },
23
25
  marketplace: { type: 'string', short: 'm' },
24
26
  asin: { type: 'string', multiple: true },
@@ -32,10 +34,21 @@ const { positionals, values } = parseArgs({
32
34
  });
33
35
  const main = async () => {
34
36
  const optionValues = values;
37
+ if (optionValues.version) {
38
+ printCliVersion();
39
+ return;
40
+ }
35
41
  if (values.help || positionals.length === 0) {
36
42
  printUsage(await loadCliPathsOrDefault());
37
43
  process.exit(values.help ? 0 : 1);
38
44
  }
45
+ const metaCommand = resolveMetaCommand(positionals);
46
+ if (metaCommand) {
47
+ if (metaCommand.name === 'changelog') {
48
+ printBundledChangelog();
49
+ return;
50
+ }
51
+ }
39
52
  const command = resolveCommandOrFail(positionals);
40
53
  if (!isSupportedCommand(command)) {
41
54
  fail('UNKNOWN_COMMAND', 'Unknown command', {
@@ -162,6 +175,12 @@ const buildConfigResponse = (paths, config) => {
162
175
  config,
163
176
  };
164
177
  };
178
+ const resolveMetaCommand = (inputPositionals) => {
179
+ if (inputPositionals.length === 1 && inputPositionals[0] === 'changelog') {
180
+ return { name: 'changelog' };
181
+ }
182
+ return null;
183
+ };
165
184
  const resolveCommand = (inputPositionals) => {
166
185
  const [first, second, ...rest] = inputPositionals;
167
186
  if (!first || !second) {
package/dist/usage.js CHANGED
@@ -5,10 +5,15 @@ export const printUsage = (paths) => {
5
5
  ' rw, rankwrangler - RankWrangler command line interface',
6
6
  '',
7
7
  'SYNOPSIS',
8
+ ' rw --version',
9
+ ' rankwrangler --version',
10
+ ' rw changelog',
11
+ ' rankwrangler changelog',
8
12
  ' rw <resource> <verb> [args...] [options]',
9
13
  ' rankwrangler <resource> <verb> [args...] [options]',
10
14
  '',
11
15
  'COMMANDS',
16
+ ' changelog',
12
17
  ' products get <ASIN...>',
13
18
  ' products history <ASIN>',
14
19
  ' license status',
@@ -21,6 +26,7 @@ export const printUsage = (paths) => {
21
26
  '',
22
27
  'OPTIONS',
23
28
  ' -h, --help Show this help message',
29
+ ' --version Print the CLI version',
24
30
  ' --baseUrl <origin> Override API origin',
25
31
  ` -m, --marketplace <id> Override marketplace (default: ${DEFAULT_MARKETPLACE_ID})`,
26
32
  ' --asin <ASIN> Add ASIN (repeatable)',
@@ -46,6 +52,8 @@ export const printUsage = (paths) => {
46
52
  'EXAMPLES',
47
53
  ' RR_LICENSE_KEY=rrk_... rw products get B0DV53VS61',
48
54
  ' RR_STORAGE_DIR=~/.config/rankwrangler rw config show',
55
+ ' rw --version',
56
+ ' rw changelog',
49
57
  ' rw config set storage-dir ~/.config/rankwrangler',
50
58
  ' rw products history B0DV53VS61 --metrics bsr,price',
51
59
  ' rw products history B0DV53VS61 --startAt 2025-01-01 --endAt 2025-12-31',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rankwrangler/cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Official RankWrangler command line interface",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,14 +14,16 @@
14
14
  "README.md"
15
15
  ],
16
16
  "scripts": {
17
- "build": "tsc -p tsconfig.json && node scripts/fix-dist-imports.mjs",
18
- "test:e2e": "bun test test/index.e2e.test.ts"
17
+ "build": "tsc -p tsconfig.json && node scripts/fix-dist-imports.mjs && node scripts/sync-changelog.mjs",
18
+ "prepack": "node scripts/sync-changelog.mjs",
19
+ "test:e2e": "bun test test/index.e2e.test.ts",
20
+ "prepublishOnly": "node ../../scripts/release/ensure-cli-http-client-published.mjs"
19
21
  },
20
22
  "publishConfig": {
21
23
  "access": "public"
22
24
  },
23
25
  "dependencies": {
24
- "@rankwrangler/http-client": "^0.4.0"
26
+ "@rankwrangler/http-client": "^0.4.1"
25
27
  },
26
28
  "devDependencies": {
27
29
  "@types/node": "^24.3.0",