USE WHEN: creating deck variants, organizing deck files, working with .mtg file format, reorganizing analyzed files by function, creating CURRENT files, understanding folder structure. COVERS: timestamped variant folders, .mtg format rules, analyzed file format, functional categories, deck analysis sections, creating new variants, legacy file handling.
ALWAYS use .mtg files for any file containing Magic card names (decks, considerations, cuts, recommendations).
1 Card Name per line (enables mtg-code extension syntax highlighting and hover cards)# for comments, ## for section headers.md or .txt for card listsEach deck variant lives in its own timestamped folder with exactly 3 standardized files:
decks/commander/<deck-name>/<YYYYMMDD-HHMM-variant>/
<YYYYMMDD-HHMM-variant>.mtg # Main working deck file
<YYYYMMDD-HHMM-variant>.moxfield.mtg # Moxfield export (via npm run export)
<YYYYMMDD-HHMM-variant>.analyzed.mtg # Analysis summary (via npm run dev)
🚨 4-LEVEL FOLDER STRUCTURE: All scripts MUST support both:
decks/<format>/<deck-name>/<variant>/<file>.mtg (4 levels)decks/<format>/<deck-name>/<file>.mtg (3 levels)cache/decks/<format>/<deck-name>/<variant>/<file>-cache.jsonWhen running analysis tools, use the FULL path including variant folder:
npm run analyze decks/commander/blood-rites/20251202-1051-optimized/20251202-1051-optimized.mtgnpm run analyze decks/commander/blood-rites/20251202-1051-optimized.mtgdecks/<format>/<deck-name>/CURRENT - Text file containing the active variant namenpm run current <deck-name> - See which variant is currently built20251207-0742-indulgent-aristocrat# Generate timestamped folder name
npm run timestamp -- -d "optimized"
# Output: 20251202-1430-optimized
# Create folder and deck file
mkdir -p decks/commander/<deck-name>/20251202-1430-optimized
# Generate analyzed and moxfield files
npm run dev decks/commander/<deck-name>/20251202-1430-optimized/20251202-1430-optimized.mtg
npm run export decks/commander/<deck-name>/20251202-1430-optimized/20251202-1430-optimized.mtg
The analyzed file includes:
npm run count, update category totals in headers to matchAfter generating .analyzed.mtg, reorganize cards by function:
Standard Categories:
IMPORTANT: Cards can appear in multiple categories (e.g., Village Rites = Draw + Sacrifice Outlet)
How to reorganize:
.analyzed.mtg after generationAfter reorganizing, add comprehensive analysis:
npm run bracket <deck-file>)npm run price-cards)Card listing format (enables mtg-code hover):
1 Necropotence
Provides massive card advantage at minimal life cost
moxfield.txt - Original imported decklistorganized.txt - Deck organized by card function20251201-2054-updated-list.mtg)For updating decks from Moxfield:
https://www.moxfield.com/decks/DebJHvH3Uku9JZqBOpBvOghttps://www.moxfield.com/decks/gmj06aiKMEaNLgGOD1ooUgnpm run import https://www.moxfield.com/decks/<id> <deck-name> --force