CardNexus CLI (cdnx)
The CardNexus CLI is an internal command-line tool built on the oclif framework for managing CardNexus operations during development and testing.
Before using the CLI, ensure:
- Build the CLI first:
pnpm build --filter @repo/cli - MongoDB is running locally
- Environment variables are set in
apps/backend/.env.local
Installation & Usage
Run CLI commands using pnpm from the repository root:
pnpm cdnx <command> [options]Commands
Import Commands
Commands for importing game data and price data locally.
import game [GAMESLUG]
Import game data locally. If no game slug is provided, an interactive prompt will appear.
Supported Games: fab, lorcana, mtg, pokemon, sorcery, onepiece, rise, riftbound, drakerion, cyberpunk
Flags:
| Flag | Description | Default |
|---|---|---|
--no-cache | Skip cache and re-download source data | false |
--match-products | Match products during import | false |
--auto-apply | Automatically apply the import diff (dev only) | true |
-f, --force | Skip confirmation prompt | false |
Examples:
pnpm cdnx import game mtg
pnpm cdnx import game pokemon --no-cache
pnpm cdnx import game lorcana --match-productsimport prices [GAMESLUG]
Import price data for a specific game.
Supported Games: mtg, pokemon, lorcana, fab, sorcery, onepiece
Flags:
| Flag | Description | Default |
|---|---|---|
-d, --date | Date to import prices for (YYYY-MM-DD) | Today |
--end-date | End date for range import (YYYY-MM-DD) | - |
--skip-refresh | Skip view refresh after import | false |
-f, --force | Skip confirmation prompt | false |
Examples:
pnpm cdnx import prices mtg
pnpm cdnx import prices pokemon --date 2024-01-15
pnpm cdnx import prices lorcana --date 2024-01-01 --end-date 2024-01-15Order Commands
Commands for managing orders in the marketplace.
order list
List orders with optional filters.
Flags:
| Flag | Description | Default |
|---|---|---|
-s, --status | Filter by status | - |
--seller | Filter by seller ID | - |
--buyer | Filter by buyer ID | - |
-n, --limit | Number of orders to display | 20 |
Status Options: pending_shipment, shipped, delivered, completed, cancelled_buyer, cancelled_seller, dispute_open, dispute_escalated
Examples:
pnpm cdnx order list
pnpm cdnx order list --status shipped
pnpm cdnx order list --seller 507f1f77bcf86cd799439011 --limit 10order get <ORDERID>
Get and display detailed order information.
Arguments:
| Argument | Description | Required |
|---|---|---|
orderId | Order ID (MongoDB ID or partial ID) | Yes |
Examples:
pnpm cdnx order get 507f1f77bcf86cd799439011
pnpm cdnx order get 439011 # partial ID matchorder advance <ORDERID>
Advance an order to the next status in the order lifecycle.
Arguments:
| Argument | Description | Required |
|---|---|---|
orderId | Order ID (MongoDB ID or partial ID) | Yes |
Flags:
| Flag | Description | Default |
|---|---|---|
-t, --tracking | Tracking number (required for shipping) | - |
-c, --carrier | Carrier name (for non-tracked shipping) | Other |
--register-tracking | Register tracking with Ship24 | Prompted |
--no-register-tracking | Skip Ship24 tracking registration | - |
-f, --force | Skip confirmation prompt | false |
Status Transitions:
pending_shipment->shipped(requires tracking number)shipped->delivereddelivered->completed
Examples:
pnpm cdnx order advance 507f1f77bcf86cd799439011
pnpm cdnx order advance 507f1f77bcf86cd799439011 --tracking LA123456FR --no-register-tracking
pnpm cdnx order advance 507f1f77bcf86cd799439011 --tracking LA123456FR --register-trackingorder refund <ORDERID>
Trigger a refund for an order.
Arguments:
| Argument | Description | Required |
|---|---|---|
orderId | Order ID (MongoDB ID or partial ID) | Yes |
Flags:
| Flag | Description | Default |
|---|---|---|
-t, --type | Refund type (full or partial) | Prompted |
-a, --amount | Amount to refund in cents (for partial refunds) | Prompted |
-r, --reason | Reason for the refund | buyer_requested |
-f, --force | Skip confirmation prompt | false |
Examples:
pnpm cdnx order refund 507f1f77bcf86cd799439011
pnpm cdnx order refund 507f1f77bcf86cd799439011 --type partial --amount 500Order Dispute Commands
Commands for managing order disputes.
order dispute
Display help for dispute subcommands.
pnpm cdnx order dispute --helporder dispute open <ORDERID>
Open a new dispute on an order. Order must be in shipped or delivered status.
Arguments:
| Argument | Description | Required |
|---|---|---|
orderId | Order ID (MongoDB ID, partial ID, or order number) | Yes |
Flags:
| Flag | Description | Default |
|---|---|---|
-i, --issues | Issue categories (can specify multiple) | Prompted |
-r, --reason | Additional description for the dispute | - |
-o, --outcome | Proposed outcome | Prompted |
-f, --force | Skip confirmation prompt | false |
Issue Categories: missing_item, wrong_condition, counterfeit_resealed, wrong_product, damaged, not_received, other
Outcome Options: full_refund, partial_refund, no_refund, return_refund
Examples:
pnpm cdnx order dispute open 507f1f77bcf86cd799439011
pnpm cdnx order dispute open 439011 -i damaged -i wrong_condition --outcome full_refund
pnpm cdnx order dispute open OR-9F4K2D8M-1 -i not_received --reason "Never arrived"order dispute escalate <ORDERID>
Escalate a dispute to platform support. Order must be in dispute_open status.
Arguments:
| Argument | Description | Required |
|---|---|---|
orderId | Order ID (MongoDB ID, partial ID, or order number) | Yes |
Flags:
| Flag | Description | Default |
|---|---|---|
-f, --force | Skip confirmation prompt | false |
Examples:
pnpm cdnx order dispute escalate 507f1f77bcf86cd799439011
pnpm cdnx order dispute escalate 439011 --forceOrder Review Commands
Commands for managing order reviews.
order review status <ORDERID>
Display the review window status for an order.
Arguments:
| Argument | Description | Required |
|---|---|---|
orderId | Order ID (MongoDB ID, partial ID, or order number) | Yes |
Examples:
pnpm cdnx order review status 507f1f77bcf86cd799439011
pnpm cdnx order review status OR-9F4K2D8M-1order review buyer <ORDERID>
Submit a buyer review (impersonating the order’s buyer).
Arguments:
| Argument | Description | Required |
|---|---|---|
orderId | Order ID (MongoDB ID, partial ID, or order number) | Yes |
Flags:
| Flag | Description | Default |
|---|---|---|
-a, --accuracy | Accuracy rating (1-5) | Prompted |
-p, --packaging | Packaging rating (1-5) | Prompted |
-c, --communication | Communication rating (1-5) | Prompted |
-m, --comment | Review comment (optional) | - |
-f, --force | Skip confirmation prompt | false |
Examples:
pnpm cdnx order review buyer OR-9F4K2D8M-1
pnpm cdnx order review buyer 439011 -a 5 -p 4 -c 5
pnpm cdnx order review buyer 439011 -a 5 -p 5 -c 5 -m "Great seller!" -forder review seller <ORDERID>
Submit a seller review (impersonating the order’s seller).
Arguments:
| Argument | Description | Required |
|---|---|---|
orderId | Order ID (MongoDB ID, partial ID, or order number) | Yes |
Flags:
| Flag | Description | Default |
|---|---|---|
-r, --rating | Rating (1-5) | Prompted |
-m, --comment | Review comment (optional) | - |
-f, --force | Skip confirmation prompt | false |
Examples:
pnpm cdnx order review seller OR-9F4K2D8M-1
pnpm cdnx order review seller 439011 -r 5
pnpm cdnx order review seller 439011 -r 5 -m "Great buyer!" -forder review expire <ORDERID>
Force auto-complete of reviews by simulating the review deadline passing. Missing reviews will be auto-submitted with default ratings.
Arguments:
| Argument | Description | Required |
|---|---|---|
orderId | Order ID (MongoDB ID, partial ID, or order number) | Yes |
Flags:
| Flag | Description | Default |
|---|---|---|
-f, --force | Skip confirmation prompt | false |
Examples:
pnpm cdnx order review expire OR-9F4K2D8M-1
pnpm cdnx order review expire 439011 -fScenario Commands
Commands for running test scenarios.
scenarios checkout
Run a test checkout scenario that creates test users, inventory, cart items, and a checkout session.
Flags:
| Flag | Description | Default |
|---|---|---|
-s, --sellers | Number of sellers to create | Prompted |
-p, --products | Number of products per seller | Prompted |
--cleanup | Clean up test data after completion | false |
-f, --force | Skip confirmation prompt | false |
Examples:
pnpm cdnx scenarios checkout
pnpm cdnx scenarios checkout --sellers 2 --products 3
pnpm cdnx scenarios checkout --cleanupscenarios marketplace
Create marketplace test data with realistic orders, reviews, and ratings between predefined users.
Flags:
| Flag | Description | Default |
|---|---|---|
-c, --cleanup | Clean up existing marketplace data for selected users first | false |
-f, --force | Skip confirmation prompts | false |
Examples:
pnpm cdnx scenarios marketplace
pnpm cdnx scenarios marketplace --cleanup
pnpm cdnx scenarios marketplace --forceThis command creates:
- Orders in various states (pending, shipped, delivered, completed, cancelled, disputed, resolved)
- Transactions linked to orders
- Reviews for completed orders
- Rating statistics for users
Global Options
These options are available for all commands:
| Option | Description |
|---|---|
-f, --force | Skip confirmation prompts (where applicable) |
--help | Show help for a command |
Order ID Resolution
Many order commands support flexible order ID resolution:
- Full MongoDB ID:
507f1f77bcf86cd799439011 - Partial ID:
439011(matches suffix) - Order Number:
OR-9F4K2D8M-1