Metadata-Version: 2.3
Name: termcards
Version: 0.1.1
Summary: Context-aware cheatsheets that appear when you need them
Author: Fredrik Angelsen
Author-email: Fredrik Angelsen <fredrikangelsen@gmail.com>
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: rich>=14.1.0
Requires-Python: >=3.12
Description-Content-Type: text/markdown

# Termcards

Context-aware cheatsheets that appear when you need them.

## What it does

Termcards automatically detects your terminal environment and displays relevant keyboard shortcuts and code examples. No searching, no memorizing commands - just the right information at the right time.

```bash
$ termcards
Detected: tmux → micro → python

[Shows Python patterns, Micro shortcuts, and tmux commands in adaptive layout]
```

## Installation

```bash
uv tool install termcards
```

## Usage

```bash
# Auto-detect context and show relevant sheets
termcards

# Show specific sheet
termcards --sheet python

# Choose display mode (reference shortcuts or code examples)
termcards --mode code

# Live mode - continuously track active pane
termcards --live

# Analyze specific tmux pane
termcards --pane %26

# Focus on specific context when multiple detected
termcards --focus micro
```

## Features

- **Smart Detection**: Recognizes tmux, editors (Micro, Vim), languages (Python), and deployment tools (Fly.io)
- **Multiple Modes**: Reference mode for shortcuts/commands, Code mode for examples
- **Live Tracking**: Continuously updates display as you switch panes (--live)
- **Adaptive Layouts**: Automatically adjusts to terminal width
- **Rich Formatting**: Syntax highlighting and beautiful terminal UI
- **Zero Config**: Works immediately without setup

## How it works

Termcards uses a detection pipeline to identify nested contexts. When you're editing Python in Micro inside tmux, it shows all three relevant cheatsheets, prioritizing the innermost context.

### Supported Contexts

- **tmux** - Terminal multiplexer commands
- **Shell** - Shell-specific commands (bash, zsh, fish)
- **Micro** - Modern terminal editor shortcuts  
- **Python** - Code patterns and idioms (code mode in development)
- **Fly.io** - Deployment commands

## Adding Custom Sheets

Create YAML reference sheets or Python code examples:

```yaml
# src/termcards/sheets/reference/tool.yaml
name: tool
sections:
  - name: essential
    items:
      - key: "Ctrl-X"
        desc: "Do something"
```

```python
# src/termcards/sheets/code/language.py
# @section: patterns
# @title: Language Patterns
def example():
    pass
```

## Development

```bash
# Clone and install
git clone https://github.com/angelsen/termcards
cd termcards
uv run termcards

# Validate sheets
uv run termcards --check

# Run with debug info
uv run termcards --debug
```

## License

MIT