Skip to Content
BackendCardNexus CLI (cdnx)

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:

  1. Build the CLI first: pnpm build --filter @repo/cli
  2. MongoDB is running locally
  3. 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:

FlagDescriptionDefault
--no-cacheSkip cache and re-download source datafalse
--match-productsMatch products during importfalse
--auto-applyAutomatically apply the import diff (dev only)true
-f, --forceSkip confirmation promptfalse

Examples:

pnpm cdnx import game mtg pnpm cdnx import game pokemon --no-cache pnpm cdnx import game lorcana --match-products

import prices [GAMESLUG]

Import price data for a specific game.

Supported Games: mtg, pokemon, lorcana, fab, sorcery, onepiece

Flags:

FlagDescriptionDefault
-d, --dateDate to import prices for (YYYY-MM-DD)Today
--end-dateEnd date for range import (YYYY-MM-DD)-
--skip-refreshSkip view refresh after importfalse
-f, --forceSkip confirmation promptfalse

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-15

Order Commands

Commands for managing orders in the marketplace.

order list

List orders with optional filters.

Flags:

FlagDescriptionDefault
-s, --statusFilter by status-
--sellerFilter by seller ID-
--buyerFilter by buyer ID-
-n, --limitNumber of orders to display20

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 10

order get <ORDERID>

Get and display detailed order information.

Arguments:

ArgumentDescriptionRequired
orderIdOrder ID (MongoDB ID or partial ID)Yes

Examples:

pnpm cdnx order get 507f1f77bcf86cd799439011 pnpm cdnx order get 439011 # partial ID match

order advance <ORDERID>

Advance an order to the next status in the order lifecycle.

Arguments:

ArgumentDescriptionRequired
orderIdOrder ID (MongoDB ID or partial ID)Yes

Flags:

FlagDescriptionDefault
-t, --trackingTracking number (required for shipping)-
-c, --carrierCarrier name (for non-tracked shipping)Other
--register-trackingRegister tracking with Ship24Prompted
--no-register-trackingSkip Ship24 tracking registration-
-f, --forceSkip confirmation promptfalse

Status Transitions:

  • pending_shipment -> shipped (requires tracking number)
  • shipped -> delivered
  • delivered -> 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-tracking

order refund <ORDERID>

Trigger a refund for an order.

Arguments:

ArgumentDescriptionRequired
orderIdOrder ID (MongoDB ID or partial ID)Yes

Flags:

FlagDescriptionDefault
-t, --typeRefund type (full or partial)Prompted
-a, --amountAmount to refund in cents (for partial refunds)Prompted
-r, --reasonReason for the refundbuyer_requested
-f, --forceSkip confirmation promptfalse

Examples:

pnpm cdnx order refund 507f1f77bcf86cd799439011 pnpm cdnx order refund 507f1f77bcf86cd799439011 --type partial --amount 500

Order Dispute Commands

Commands for managing order disputes.

order dispute

Display help for dispute subcommands.

pnpm cdnx order dispute --help

order dispute open <ORDERID>

Open a new dispute on an order. Order must be in shipped or delivered status.

Arguments:

ArgumentDescriptionRequired
orderIdOrder ID (MongoDB ID, partial ID, or order number)Yes

Flags:

FlagDescriptionDefault
-i, --issuesIssue categories (can specify multiple)Prompted
-r, --reasonAdditional description for the dispute-
-o, --outcomeProposed outcomePrompted
-f, --forceSkip confirmation promptfalse

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:

ArgumentDescriptionRequired
orderIdOrder ID (MongoDB ID, partial ID, or order number)Yes

Flags:

FlagDescriptionDefault
-f, --forceSkip confirmation promptfalse

Examples:

pnpm cdnx order dispute escalate 507f1f77bcf86cd799439011 pnpm cdnx order dispute escalate 439011 --force

Order Review Commands

Commands for managing order reviews.

order review status <ORDERID>

Display the review window status for an order.

Arguments:

ArgumentDescriptionRequired
orderIdOrder ID (MongoDB ID, partial ID, or order number)Yes

Examples:

pnpm cdnx order review status 507f1f77bcf86cd799439011 pnpm cdnx order review status OR-9F4K2D8M-1

order review buyer <ORDERID>

Submit a buyer review (impersonating the order’s buyer).

Arguments:

ArgumentDescriptionRequired
orderIdOrder ID (MongoDB ID, partial ID, or order number)Yes

Flags:

FlagDescriptionDefault
-a, --accuracyAccuracy rating (1-5)Prompted
-p, --packagingPackaging rating (1-5)Prompted
-c, --communicationCommunication rating (1-5)Prompted
-m, --commentReview comment (optional)-
-f, --forceSkip confirmation promptfalse

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!" -f

order review seller <ORDERID>

Submit a seller review (impersonating the order’s seller).

Arguments:

ArgumentDescriptionRequired
orderIdOrder ID (MongoDB ID, partial ID, or order number)Yes

Flags:

FlagDescriptionDefault
-r, --ratingRating (1-5)Prompted
-m, --commentReview comment (optional)-
-f, --forceSkip confirmation promptfalse

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!" -f

order review expire <ORDERID>

Force auto-complete of reviews by simulating the review deadline passing. Missing reviews will be auto-submitted with default ratings.

Arguments:

ArgumentDescriptionRequired
orderIdOrder ID (MongoDB ID, partial ID, or order number)Yes

Flags:

FlagDescriptionDefault
-f, --forceSkip confirmation promptfalse

Examples:

pnpm cdnx order review expire OR-9F4K2D8M-1 pnpm cdnx order review expire 439011 -f

Scenario 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:

FlagDescriptionDefault
-s, --sellersNumber of sellers to createPrompted
-p, --productsNumber of products per sellerPrompted
--cleanupClean up test data after completionfalse
-f, --forceSkip confirmation promptfalse

Examples:

pnpm cdnx scenarios checkout pnpm cdnx scenarios checkout --sellers 2 --products 3 pnpm cdnx scenarios checkout --cleanup

scenarios marketplace

Create marketplace test data with realistic orders, reviews, and ratings between predefined users.

Flags:

FlagDescriptionDefault
-c, --cleanupClean up existing marketplace data for selected users firstfalse
-f, --forceSkip confirmation promptsfalse

Examples:

pnpm cdnx scenarios marketplace pnpm cdnx scenarios marketplace --cleanup pnpm cdnx scenarios marketplace --force

This 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:

OptionDescription
-f, --forceSkip confirmation prompts (where applicable)
--helpShow 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
Last updated on