MTG EDH Deck Manager

Command-line toolkit for managing Magic: The Gathering Commander (EDH) decks using the Scryfall API.

Installation

git clone <repo-url>
cd Decks

# Install git hook for auto-updating docs
cp scripts/pre-commit .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

No dependencies required - pure Python 3 standard library.

Usage

Hydrate a Collection

Fetch card data from Scryfall for a decklist:

python hydrate.py hydrate collection/decklist.txt -o collection_hydrated/ -c card_cache.json

Create a New Deck

python hydrate.py new my_deck

Analyze Decks

Find upgrade options from your collection:

python scripts/analyze_decks.py --collection collection_hydrated/deck.json --deck-dir decks/

Find Synergies

Search for cards by keywords, colors, and type:

# Find landfall cards in Simic colors
python scripts/find_synergies.py --collection collection_hydrated/deck.json --colors U G --keywords landfall

# Find Bird creatures in Bant colors
python scripts/find_synergies.py --collection collection_hydrated/deck.json --colors U G W --creature-type Bird

# Find instants with CMC 2 or less
python scripts/find_synergies.py --collection collection_hydrated/deck.json --type instant --cmc-max 2

Generate Reports

python scripts/deck_report.py --collection collection_hydrated/deck.json --decks-dir decks/ --output report.md

Decks

Deck Colors Commander Archetype
Choco UGW Choco, Seeker of Paradise Bird Tribal Landfall
Hazel BG Hazel of the Rootbloom Golgari Aristocrats
Palamecia UR The Emperor of Palamecia // The Lord Master of Hell Izzet Self-Mill Storm
Yshtola UBW Y'shtola, Night's Blessed Esper Stax Drain

Workflow

Quick Reference

  1. Import - Place text decklists in collection/
  2. Hydrate - Run hydrate.py to fetch Scryfall data → collection_hydrated/
  3. Explore - Find synergies and commanders in your collection
  4. Define - Create deck JSON files in decks/
  5. Analyze - Run analyze_decks.py to find upgrade options
  6. Report - Use deck_report.py for markdown summaries

Runbook: Build a Deck From Your Collection

Step 1: Import Your Collection

Create a text file in collection/ with your cards (one per line):

1 Sol Ring (CMA) 1
3 Birds of Paradise (M12) 165
1 Eternal Witness (EMA) 183

Format: <count> <Card Name> (<Set Code>) <Collector Number>

The set code and collector number are optional but help with accuracy.

Step 2: Hydrate Your Collection

Fetch card data from Scryfall:

python hydrate.py hydrate collection/my_cards.txt -o collection_hydrated/ -c card_cache.json

This creates:

  • collection_hydrated/deck.json - All cards with full data
  • collection_hydrated/creatures.json - Creatures only
  • collection_hydrated/instants.json, sorceries.json, etc.

Step 3: Explore Your Collection

View color distribution:

python -c "
import json
from collections import Counter
cards = json.load(open('collection_hydrated/deck.json'))
colors = Counter(c for card in cards for c in card.get('color_identity', []))
for c, n in colors.most_common(): print(f'{c}: {n}')
"

Find creature types you own:

python scripts/find_synergies.py --collection collection_hydrated/deck.json --creature-type Elf
python scripts/find_synergies.py --collection collection_hydrated/deck.json --creature-type Elemental

Find cards by keyword/mechanic:

# Find all landfall cards
python scripts/find_synergies.py --collection collection_hydrated/deck.json --keywords landfall

# Find lifegain synergies
python scripts/find_synergies.py --collection collection_hydrated/deck.json --keywords "gain life"

# Find -1/-1 counter cards
python scripts/find_synergies.py --collection collection_hydrated/deck.json --keywords "-1/-1 counter"

Find cards by color identity:

# Simic (UG) cards
python scripts/find_synergies.py --collection collection_hydrated/deck.json --colors U G

# Esper (WUB) instants
python scripts/find_synergies.py --collection collection_hydrated/deck.json --colors W U B --type instant

Step 4: Choose a Commander

Based on your collection strengths, pick a commander that matches:

  • Your most abundant colors
  • Creature types you have many of
  • Mechanics with good support in your collection

Step 5: Create the Deck File

Create decks/<deck_name>.json:

{
  "name": "My Deck Name",
  "commander": "Commander Name",
  "colors": ["U", "G"],
  "archetype": "Simic Value",
  "cards": {
    "Sol Ring": 1,
    "Birds of Paradise": 1,
    "Eternal Witness": 1
  }
}

Step 6: Analyze for Upgrades

Find cards in your collection that fit your deck:

python scripts/analyze_decks.py --collection collection_hydrated/deck.json --deck-dir decks/

This compares your deck against your collection and suggests:

  • Cards matching your commander's color identity
  • Cards with synergistic mechanics
  • Cards not yet in the deck

Step 7: Generate a Report

python scripts/deck_report.py --collection collection_hydrated/deck.json --decks-dir decks/ --output report.md

Example: Building a Deck From Scratch

# 1. Add your collection
echo "1 Ashling, Rekindled // Ashling, Rimebound (ECL) 124" >> collection/my_cards.txt

# 2. Hydrate
python hydrate.py hydrate collection/my_cards.txt -o collection_hydrated/ -c card_cache.json

# 3. Find red instants/sorceries (spellslinger support)
python scripts/find_synergies.py --collection collection_hydrated/deck.json --colors R --type instant
python scripts/find_synergies.py --collection collection_hydrated/deck.json --colors R --type sorcery

# 4. Create deck file
cat > decks/ashling.json << 'EOF'
{
  "name": "Ashling Spellslinger",
  "commander": "Ashling, Rekindled // Ashling, Rimebound",
  "colors": ["R"],
  "archetype": "Mono-Red Spellslinger",
  "cards": {}
}
EOF

# 5. Analyze and find synergies
python scripts/analyze_decks.py --collection collection_hydrated/deck.json --deck-dir decks/

Collection Stats

  • Total cards: 1209
  • Unique cards: 866
  • By type:
    • Artifacts: 84
    • Creatures: 390
    • Enchantments: 63
    • Instants: 124
    • Lands: 97
    • Planeswalkers: 2
    • Sorceries: 105

This file is auto-generated. Edit docs/templates/README.template.md instead.

Description
No description provided
Readme 1.1 MiB
Languages
Python 99.7%
Shell 0.3%