

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
12345678# CLI Workflows910## Click CLI Pattern1112mtg-utils uses Click for building command-line interfaces. This document outlines the patterns and best practices for creating and modifying CLI commands.1314---1516## Directory Structure1718```19mtg_utils/20└── commands/21 ├── __init__.py22 ├── check_missing_cards/23 │ ├── __init__.py24 │ ├── command.py # CLI command wrapper with Click decorators25 │ ├── logic.py # Business logic26 │ └── render.py # Console output27 └── update_card_library/28 ├── __init__.py29 ├── command.py30 ├── logic.py31 └── render.py32```3334---3536## Command Structure3738Each command follows a modular pattern:3940### 1. `command.py` - CLI Wrapper4142Contains the Click command definition with decorators and option parsing.4344```python45import click46from rich.console import Console47from mtg_utils.utils.console import console4849@click.command()50@click.option("--deck-file", "-f", help="Path to decklist file")51@click.option("--moxfield-id", "-m", help="Moxfield deck ID")52def check_missing_cards(deck_file: str | None, moxfield_id: str | None):53 """54 Check which cards are missing from your collection.55 """56 # Parse options and call logic57 pass58```5960### 2. `logic.py` - Business Logic6162Contains pure logic for processing and calculations.6364```python65from mtg_utils.utils.moxfield_api import get_binder_cards66from mtg_utils.utils.readers import read_deck_list6768def get_missing_cards(deck_file: str, binder_cards: list[str]) -> list[str]:69 """Get list of cards missing from binder collection."""70 deck_cards = read_deck_list(deck_file)71 return [card for card in deck_cards if card not in binder_cards]72```7374### 3. `render.py` - Console Output7576Contains Rich-based rendering for formatted output.7778```python79from rich.table import Table80from mtg_utils.utils.console import console8182def render_missing_cards(cards: list[str]) -> None:83 """Render missing cards table."""84 table = Table(title="Missing Cards")85 table.add_column("Card Name", style="cyan")86 for card in cards:87 table.add_row(card)88 console.print(table)89```9091---9293## Adding a New Command94951. Create a new directory under `mtg_utils/commands/`962. Create `__init__.py`, `command.py`, `logic.py`, and `render.py`973. Add the command to `mtg_utils/main.py` using `cli.add_command()`984. Write tests in `tests/test_commands/test_<command_name>.py`99100---101102## Environment Variables103104Use Click's `envvar` parameter for environment variable support:105106```python107@click.option(108 "--debug",109 envvar="DEBUG",110 default=False,111 type=bool,112 is_flag=True,113 help="Debug mode: set logging level to DEBUG",114)115```116117---118119## Error Handling120121Always use `console.print()` for error messages:122123```python124# ✅ GOOD125console.print(f"[bold red]Error:[/bold red] Deck file not found: {path}")126127# ❌ BAD128print(f"Error: Deck file not found: {path}")129130```
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| gasbasd/mtg-utils.clinerules/01-project-overview.md · 0 | Cline rules | setuptestlint-formatarch | 89/100 | 8 days ago | |
| gasbasd/mtg-utils.clinerules/02-coding-standards.md · 0 | Cline rules | lint-formatstyletypesdependencies+1 | 77/100 | 8 days ago | |
| gasbasd/mtg-utils.clinerules/03-testing-standards.md · 0 | Cline rules | testarchtypestesting-strategy+1 | 66/100 | 8 days ago | |
| gasbasd/mtg-utils.clinerules/04-security-practices.md · 0 | Cline rules | setupstylesecuritydo-not | 61/100 | 8 days ago | |
| gasbasd/mtg-utils.clinerules/06-version-control.md · 0 | Cline rules | testlint-formatstyletypes+4 | 62/100 | 8 days ago | |
| gasbasd/mtg-utils.clinerules/memory-bank.md · 0 | Cline rules | archperformancedocs | 58/100 | 8 days ago | |
| gasbasd/mtg-utils.github/copilot-instructions.md · 0 | Copilot instructions | setupbuildtestlint-format+3 | 89/100 | 8 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| enuno/unifi-mcp-server.clinerules · 226 | Cline rules | setuptestlint-formatstyle+10 | 96/100 | today | |
| u9401066/zotero-keeper.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 14 days ago | |
| u9401066/pubmed-search-mcp.clinerules/50-pubmed-project.md · 25 | Cline rules | testlint-formatstylearch+1 | 94/100 | 14 days ago | |
| u9401066/zotero-keepervscode-extension/resources/repo-assets/pubmed-search-mcp/.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 14 days ago | |
| ryok/python-boilerplate.clinerules/common-commands.md · 0 | Cline rules | setupbuildtestlint-format+3 | 90/100 | 13 days ago | |
| gasbasd/mtg-utils.clinerules/01-project-overview.md · 0 | Cline rules | setuptestlint-formatarch | 89/100 | 8 days ago | |
| u9401066/pubmed-search-mcp.clinerules/60-pubmed-python.md · 25 | Cline rules | setuptestlint-formatstyle+2 | 86/100 | 14 days ago | |
| u9401066/pubmed-search-mcp.clinerules/00-project.md · 25 | Cline rules | testlint-formatstylearch+1 | 86/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/gasbasd-mtg-utils-clinerules-05-cli-workflows)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.