70 lines
1.7 KiB
Markdown
70 lines
1.7 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
## Project Overview
|
|
|
|
This is a Rust terminal user interface (TUI) application built with Ratatui.
|
|
It will evolve to become a tui mail client
|
|
|
|
## Build and Run Commands
|
|
|
|
```bash
|
|
# Build the project
|
|
cargo build
|
|
|
|
# Run the application
|
|
cargo run
|
|
|
|
# Build optimized release version
|
|
cargo build --release
|
|
|
|
# Check code without building
|
|
cargo check
|
|
|
|
# Format code
|
|
cargo fmt
|
|
|
|
# Run clippy linter
|
|
cargo clippy
|
|
```
|
|
|
|
## Test Mail Server
|
|
|
|
A Docker-based IMAP mail server is available for testing:
|
|
|
|
```bash
|
|
# Start the mail server
|
|
docker-compose up -d
|
|
|
|
# Create a test user
|
|
docker exec -it mailserver setup email add test@example.com password123
|
|
|
|
# Stop the mail server
|
|
docker-compose down
|
|
```
|
|
|
|
Connection details: localhost:143 (IMAP) or localhost:993 (IMAPS). See `MAIL_SERVER_SETUP.md` for detailed usage.
|
|
|
|
## Architecture
|
|
|
|
This is a single-file application (`src/main.rs`) following the standard terminal application lifecycle:
|
|
|
|
1. **Terminal Setup**: Enable raw mode and enter alternate screen
|
|
2. **Event Loop**:
|
|
- Render UI using Ratatui's declarative widget system
|
|
- Poll for keyboard events (200ms timeout)
|
|
- Exit on 'q' or Escape key
|
|
3. **Cleanup**: Disable raw mode, leave alternate screen, restore cursor
|
|
|
|
## Key Dependencies
|
|
|
|
- **ratatui (0.29)**: TUI framework providing widgets, layouts, and rendering
|
|
- **crossterm (0.28)**: Cross-platform terminal manipulation (raw mode, events, alternate screen)
|
|
|
|
## Development Notes
|
|
|
|
- Uses Rust edition 2024
|
|
- The application uses a constraint-based layout system to center content
|
|
- Terminal is set to raw mode to capture individual key presses
|
|
- The alternate screen prevents terminal history pollution
|