The CLI (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/invvd/mtg-cheaper-deck/llms.txt
Use this file to discover all available pages before exploring further.
main.py) runs a complete deck analysis in a single pass and prints the results — either as a color-coded terminal table or as machine-readable JSON — then exits. There is no interactive prompt and no state between runs. Use it when you want a quick overview of where savings are possible, when you are scripting against multiple decks in a loop, or when you need to pipe the output into another tool.
Command syntax
Arguments and flags
The Moxfield deck URL (e.g.
https://moxfield.com/decks/YOUR-DECK-ID) or the raw deck ID string. This is a positional argument — no flag prefix is needed.Maximum number of cheaper suggestions to show per card. Defaults to
5. Pass a smaller value (e.g. --top-n 1) to get only the single best alternative for each card, which makes the table easier to scan and keeps JSON output compact.When present, the full report is serialized with
json.dumps() and written to stdout instead of the rich terminal table. No color codes or progress text are emitted — only the JSON object. Useful for piping into other programs.Table output
Without--json, the tool prints a rich table with one row per suggestion. The columns are:
| Column | Content |
|---|---|
| Carta original | Name of the card in the deck (bold). |
| Precio | Current price of the original card in USD. |
| Sugerencia | Name of the cheaper candidate card (bold). |
| Precio | Price of the candidate in USD. |
| Ahorro | Percentage savings vs. the original, color-coded: green ≥ 50 %, yellow ≥ 20 %, white < 20 %. |
| Puntaje | Similarity score, color-coded: green ≥ 3.0, yellow ≥ 1.5, white < 1.5. |
| Razón | Human-readable explanation of why the candidate was matched (shared keywords, overlapping oracle text terms, CMC delta, or fallback to type/color/popularity). |
JSON output
With--json, the tool prints the object returned by build_report(). The structure is:
| Key | Type | Description |
|---|---|---|
deck_name | string | Deck name as returned by the Moxfield API. |
format | string | Format key, e.g. "commander", "modern". |
total_cards | integer | Total number of card entries in the deck (including the commander). |
matched | integer | Number of cards successfully matched in the local database. |
unmatched | array of strings | Card names that could not be found in the local database. |
no_price | array of strings | Matched cards with no known USD price (excluded from suggestion logic). |
no_suggestions | array of strings | Matched cards with a price but no cheaper alternative found in the candidate pool. |
suggestions | array of objects | One object per (original card, candidate) pair, sorted by original card price descending. See row fields below. |
best_savings_pct_avg | float or null | Average of the single best savings percentage per card across all cards that had suggestions. null if no suggestions were found. |
suggestions contains:
| Field | Type | Description |
|---|---|---|
carta_original | string | Name of the original deck card. |
precio_original | float | Price of the original card in USD (rounded to 2 decimal places). |
sugerencia | string | Name of the suggested replacement. |
precio_sugerido | float | Price of the suggested card in USD. |
ahorro_pct | float | Percentage saved vs. the original (rounded to 1 decimal place). |
razon | string | Plain-text reason string explaining the match. |
score | float | Similarity score (rounded to 2 decimal places). |
Score formula
The similarity score is computed as:Exit codes
| Code | Meaning |
|---|---|
0 | Analysis completed successfully (table or JSON printed to stdout). |
1 | The Moxfield API request failed (network error, private deck, invalid ID). The error message is printed to the console. |
Pipeline example
Pretty-print the JSON report using Python’s built-injson.tool module:
jq: