Converts MTGJSON's AllDeckFiles archive into Cockatrice .cod deck files.
Every preconstructed deck Wizards has ever published — Commander, Brawl, Theme, Intro, Archenemy, Planechase, … — downloaded once, converted to native Cockatrice format, organized by deck type.
- fnm — picks up
.nvmrcto install the right Node LTS. - pnpm — auto-managed by Corepack via the
packageManagerfield inpackage.json.
fnm use --install-if-missing
pnpm install
pnpm startThe first run downloads ~245 MB. Subsequent runs reuse the cached archive at output/AllDeckFiles.tar.gz and revalidate it with If-Modified-Since — only re-downloading when the upstream file has actually changed.
output/
├── AllDeckFiles.tar.gz # cached upstream archive (keep to skip re-downloads)
├── cod/<type>/<deck>.cod # Cockatrice deck files
├── json/<type>/<deck>.json # raw MTGJSON deck JSON
└── json-pretty/<type>/<deck>.json # MTGJSON deck JSON, 2-space indented
<type> is data.type from the MTGJSON deck (e.g. Commander Deck, Theme Deck, Archenemy Deck). The cod/, json/, and json-pretty/ subfolders are wiped on every run; the cached archive is not.
Beyond the obvious <deckname> and zone/card lists:
<format>— Cockatrice's lowercase format key whendata.typematches (Commander Deck→commander,Brawl Deck→brawl); empty otherwise. Cockatrice's format dropdown is built from MTGJSON legality keys, so other product types (Theme/Intro/Archenemy/…) intentionally don't get a format.<bannerCard>—displayCommander[0]if present (the alt-art printing meant for box display), else first commander, else first mainboard card.providerIdis the MTGJSON per-printinguuid.<comments>— type, set code, release date, source sets, color identity, commander name(s), card counts. Followed by aGenerated by Cockadecks…paragraph.<tags>—type:<type>,setCode:<code>,releaseDate:<YYYY-MM-DD>, onesourceSetCode:<set>per set referenced by cards, onecolor:<X>per color in the deck identity (B/G/R/U/W), onecommander:<name>per commander.<card>— emits every attribute Cockatrice's loader recognizes:setShortName,collectorNumber,uuid. Cards are aggregated byuuid(with aname|setCode|numberfallback), so distinct printings of the same card stay distinct.
See docs/cod.md for the full Cockatrice .cod format reference annotated against the latest Cockatrice master, and docs/deck.xsd for the upstream — slightly stale — XML schema.