@reorc/datahubmax-cli
v0.1.2
Published
DataHubMax CLI for API Key authenticated data queries
Readme
DataHubMax CLI
DataHubMax CLI is a command-line data tool for Agents and power users. It lets an Agent authenticate with a DataHubMax API Key, query structured market data, and return JSON that can be summarized into customer-facing answers.
The CLI does not perform natural-language planning by itself. A user can ask their own Agent a question in natural language; the Agent decides which datahubmax command to run, parses the JSON result, and writes the final answer.
Capabilities
- API Key login, status, logout, and doctor checks.
- Supported-market discovery.
- Keyword search across products, brands, categories, and ASIN candidates.
- Product detail, trends, search terms, and variants.
- Brand trends, products, and category distribution.
- Category trends, top products, and top brands.
- Current API Key usage lookup.
- Stable JSON responses and clear error codes for Agent parsing.
Ask An Agent To Install
Send this prompt to your Agent:
Install DataHubMax CLI for me.
Steps:
1. Install @reorc/datahubmax-cli globally from the public npm registry.
2. Run datahubmax --help to verify the binary is available.
3. Run datahubmax auth status --json.
4. If your runtime supports skills, install the packaged datahubmax Agent Skill. First detect the current OS and shell.
5. On macOS/Linux shell:
PACKAGE_DIR="$(npm root -g)/@reorc/datahubmax-cli"
mkdir -p ~/.codex/skills ~/.claude/skills
rm -rf ~/.codex/skills/datahubmax ~/.claude/skills/datahubmax
cp -R "$PACKAGE_DIR/skills/datahubmax" ~/.codex/skills/datahubmax 2>/dev/null || true
cp -R "$PACKAGE_DIR/skills/datahubmax" ~/.claude/skills/datahubmax 2>/dev/null || true
6. On Windows PowerShell, do not run the macOS/Linux commands above. Use:
$packageDir = Join-Path (npm root -g) '@reorc/datahubmax-cli'
$codexDir = Join-Path $env:USERPROFILE '.codex\skills\datahubmax'
$claudeDir = Join-Path $env:USERPROFILE '.claude\skills\datahubmax'
New-Item -ItemType Directory -Force (Split-Path $codexDir), (Split-Path $claudeDir) | Out-Null
Remove-Item -Recurse -Force $codexDir, $claudeDir -ErrorAction SilentlyContinue
Copy-Item -Recurse (Join-Path $packageDir 'skills\datahubmax') $codexDir
Copy-Item -Recurse (Join-Path $packageDir 'skills\datahubmax') $claudeDir
7. Read the skill's SKILL.md and references before answering DataHubMax questions.
8. If skills are not supported, read AGENT-PROMPT.md from the installed package as the fallback prompt.
9. Do not run auth login yet. Wait for me to provide the DataHubMax API Key in a separate message.
Do not print the full API Key in logs or final responses.After installation succeeds, send the DataHubMax API Key separately:
Use this DataHubMax API Key to login: <DATAHUBMAX_API_KEY>
Run:
datahubmax auth login --api-key <DATAHUBMAX_API_KEY>
datahubmax doctor --json
datahubmax markets --json
Do not print the full API Key in logs or final responses.Manual Install
Requirements:
- Node.js 18 or newer
- npm
- A DataHubMax API Key
Install:
npm install -g @reorc/datahubmax-cli
datahubmax --helpInstall a pinned version:
npm install -g @reorc/[email protected]Upgrade:
npm update -g @reorc/datahubmax-cliAuth
Login with a DataHubMax API Key:
datahubmax auth login --api-key dhm_xxxIf --base-url is not provided on first login, the CLI defaults to:
https://datahubmax.kamay.aiUse --base-url <url> or DATAHUBMAX_BASE_URL for a test, local, or private environment:
datahubmax auth login --api-key dhm_xxx --base-url https://datahubmax.kamay.ai
DATAHUBMAX_BASE_URL=http://127.0.0.1:3000 datahubmax auth login --api-key dhm_xxxauth login validates the API Key with DataHubMax before saving it locally. Invalid, disabled, unbound, or disabled-user keys fail immediately and do not overwrite the existing local config.
Check local auth status:
datahubmax auth status --json
datahubmax doctor --jsonLogout removes the saved API Key from local config:
datahubmax auth logoutauth logout only removes the API Key saved in ~/.datahubmax/config.json. It does not unset DATAHUBMAX_API_KEY. If auth status --json still reports configured: true after logout, check whether authSource is env.
Auth precedence for API Keys:
--api-keyDATAHUBMAX_API_KEY~/.datahubmax/config.json
The CLI never prints full API Keys in status or doctor output.
Agent Skill And Companion Prompt
The package includes a formal Agent Skill at skills/datahubmax/SKILL.md. Use it with Claude Code, Codex, or another skill-aware Agent to decide when to call datahubmax, which command to run, and how to answer from JSON.
The package also includes AGENT-PROMPT.md as a copyable fallback instruction for Agents that cannot install a skill directory.
Quickstart
List supported markets:
datahubmax markets --jsonRun queries:
datahubmax search "anker charger" --market US --json
datahubmax product get B09XXXXXXX --market US --json
datahubmax product trends B09XXXXXXX --market US --json
datahubmax product search-terms B09XXXXXXX --market US --json
datahubmax product variants B09XXXXXXX --market US --json
datahubmax brand trends "Anker" --market US --json
datahubmax brand products "Anker" --market US --json
datahubmax brand categories "Anker" --market US --json
datahubmax category trends "Electronics" --market US --json
datahubmax category products "Electronics" --market US --json
datahubmax category brands "Electronics" --market US --jsonRead current key usage:
datahubmax usage --days 14 --jsonJSON Contract
All commands return JSON.
Successful responses use:
{ "success": true, "data": {} }Query responses include data.market, data.result, and may include data.empty: true when the request completed but returned no matching rows.
Errors use:
{ "success": false, "error": { "code": "...", "message": "..." } }Do not infer missing data. If empty: true, result: null, an empty array, NOT_FOUND, or INVALID_ASIN is returned, the Agent should explain that no usable data was found and ask for a better keyword, market, ASIN, brand, or category.
Raw Requests
The raw request escape hatch is read-only and limited to DataHubMax API paths:
datahubmax request get /api/datahubmax/markets --jsonRequests outside /api/datahubmax/* are rejected by the CLI.
Supported Markets
The CLI uses the fixed DataHubMax market set:
US, CA, MX, BR, DE, GB, FR, ES, IT, JPTroubleshooting
INVALID_API_KEY: the API Key does not exist or was typed incorrectly.
API_KEY_DISABLED: the API Key was disabled by an admin.
API_KEY_USER_REQUIRED: the API Key is not bound to an active user.
API_KEY_USER_DISABLED: the user bound to this API Key is disabled.
SCOPE_REQUIRED: the API Key does not have the required scope, for example query:read or usage:read.
INVALID_ASIN: the ASIN is missing or is not a 10-character alphanumeric value.
NOT_FOUND: the requested product, brand, or category data was not found.
LOGIN_FAILED: the base URL is unreachable or did not return a valid DataHubMax API response.
Uninstall
npm uninstall -g @reorc/datahubmax-cli
rm -rf ~/.datahubmaxOnly remove ~/.datahubmax if you want to delete the saved API Key and base URL.
