Skip to content

Deck importer improvements - Commander detection heuristic / misc fixes#9923

Open
MostCromulent wants to merge 5 commits intoCard-Forge:masterfrom
MostCromulent:deck-importer-improvements
Open

Deck importer improvements - Commander detection heuristic / misc fixes#9923
MostCromulent wants to merge 5 commits intoCard-Forge:masterfrom
MostCromulent:deck-importer-improvements

Conversation

@MostCromulent
Copy link
Contributor

Summary

Several improvements to the deck importer:

  1. Commander detection heuristics: Two-tier heuristic for automatically detecting and assigning to Commander format.

    • Explicit headers (Commander, //Commander, CM:) - add Commander to allowed sections
    • Headerless heuristic (98-102 singleton cards + blank-line separator) - identify commander from cards after the last blank line (common Commander export format in plain text e.g. Moxfield), validated with DeckSection.Commander.validate(). The blank-line heuristic guards against false positives on other 100-card singleton formats (e.g. Canadian Highlander) by requiring the trailing card(s) to be valid commander candidates (legendary creatures, eligible planeswalkers).
    • When Commander is auto-detected, the options panel is expanded and the format dropdown is automatically enabled and set to Commander so the detection is visible and the user can choose to override it. When accepting a deck with a Commander section from a non-Commander editor, automatically switch to the Commander editor.
  2. Companion section: Map Companion header to Sideboard (Forge auto-detects companions at game start). Without this, companion cards fall into the preceding section (typically Commander), creating a bogus second commander.

  3. Card name regex: Added ? to support cards like Continue?

  4. Foil/etched markers: Strip Moxfield *F*/*E* suffixes so cards are recognized

  5. Deck name with space separator: Accept Name Turtle Power! format

Known limitations

  • Mobile: The shared controller correctly identifies commanders and builds the deck with a Commander section, but the mobile import dialog (FDeckImportDialog) does not have format selection UI or editor switching. Commander cards are silently dropped when importing into a Constructed editor on mobile. This is a pre-existing limitation, not a regression.

🤖 Generated with Claude Code

MostCromulent and others added 5 commits February 26, 2026 15:16
- Add ? to card name regex (fixes cards like Continue?)
- Strip Moxfield *F*/*E* foil/etched markers
- Recognize Companion section header (maps to Sideboard)
- Suppress ignorable sections (Maybeboard, Tokens, etc.)
- Accept space separator in deck name lines (Name Turtle Power!)
- Auto-detect Commander format from deck composition heuristic
  (98-102 singleton cards + blank-line commander separator)
- Auto-detect Commander from explicit section headers in input
- Auto-select Commander format in UI and switch editor on import

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
identifyCommanderFromBlankLineSeparator now returns whether it found a
valid commander. commanderAutoDetected is only set on successful match,
preventing Canadian Highlander and other 100-card singleton formats from
triggering Commander format auto-selection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Unrecognized section headers already become UNKNOWN_TEXT tokens which
are not imported. Token cards don't exist in the card database so they
fail recognition naturally. The added complexity isn't worth the minor
cosmetic benefit of suppressing warnings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tool4ever tool4ever added the Deck Editor Anything related to the mobile or desktop deck editors label Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Deck Editor Anything related to the mobile or desktop deck editors Deck Importer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants