Guidance for coding agents working with this Rust TUI Webex client.
cargo build- Build the projectcargo run- Run the applicationcargo test- Run tests with rstest frameworkcargo check- Fast compile check (preferred for development)cargo clippy- Run lintercargo fmt- Format the codecargo doc --no-deps- Generate documentation
Always run cargo check, test, fmt and clippy before committing.
- Rust toolchain: 1.88 (specified in
rust-toolchain.toml) - Uses Nix flakes for environment management (
flake.nix,flake.lock)
- Modules: Use
mod.rspattern, declare submodules withpub(crate) mod - Imports: Group std/external crates, then local crate imports with
use crate:: - Types: Use explicit types for public APIs, prefer
pub(crate)overpub - Naming: snake_case for functions/variables, PascalCase for types/enums
- Error handling: Use
color_eyre::Result<T>for fallible functions - Documentation: Use
//!for module docs,///for item docs - Async: Multi-threaded tokio design with message passing via channels
- Testing: Use
rstestframework with#[cfg(test)]mod tests blocks - Threading: Separate concerns: App (UI), Teams (API), Input (events)
- Cache pattern: In-memory state management with typed IDs (RoomId, MessageId)
This is a terminal-based Webex Teams client built with Rust, using the ratatui library for the TUI and tokio for async runtime.
Multi-threaded async design with message passing between components:
Main Thread (App) ←→ Teams Thread ←→ Webex Event Stream Thread
↑ ↓
Input Handler Webex API Client
- Entry point handling CLI arguments and initialization
- Manages authentication flow via OAuth2
- Spawns and coordinates all threads
- High/low priority message queues between App and Teams threads
App: Main UI state controller, handles user input and UI logicAppState: Central state management (rooms, messages, UI state)- Cache system (
cache/): In-memory storage for rooms, messages, persons - Actions: Key binding to action mapping system
- Message Editor: Text composition and editing functionality
Teams: Handles all Webex API interactionsapp_handler: Processes commands from App threadwebex_handler: Processes events from Webex streamauth: OAuth2 authentication flowclient: Webex API client wrapper
Tui: Terminal setup, event handling, drawing coordination- UI Modules: Specialized rendering for rooms, messages, logs, help
- Uses crossterm for terminal control and ratatui for widgets
EventHandler: Async input event processing- Key mapping: Translates terminal events to application actions
- Main/App Thread: UI rendering and user input processing
- Teams Thread: All Webex API calls and business logic
- Event Stream Thread: Dedicated Webex real-time event listening
- Input Thread: Terminal input event capture
Communication via tokio channels with priority queues (high/low priority from App to Teams).
- ratatui: TUI framework with crossterm backend
- webex: Webex API client (git dependency from sgrimee/webex-rust)
- tokio: Async runtime with unbounded channels
- oauth2: Authentication flow
- tui-textarea: Rich text editing widget
- tui-logger: Integrated logging display
- Client credentials stored in
$HOME/.config/webex-tui/client.yml - OAuth2 integration setup required for Webex API access
- Debug logging controlled via CLI flags and modules
- Uses
rstestframework for unit tests - Integration tests should consume real external resources (following user's global CLAUDE.md)
- Never include 'Generated with' or 'Co authored by' OpenCode in commit messages or pull requests