# GyanDoot Agent Development Guide ## Overview This guide documents conventions for developing and extending GyanDoot CLI/TUI tools. ## gyandoot-tui Conventions ### Module Structure - `src/lib.rs` — Re-exports all public API - `src/banner.rs` — ASCII art banner display (primary robot head + fallback box) - `src/setup.rs` — Interactive setup wizard for provider configuration - `src/terminal.rs` — Terminal helpers (spinner, confirm, text input, selection menu, status) - `src/tui.rs` — Ratatui-based TUI main loop with event handling ### Banner - Primary banner uses Kapil's approved robot head ASCII art with 4-bit ANSI colors - Fallback banner is a compact box used in pipe mode - `print_banner()` auto-detects pipe mode via `atty` - `banner_plain()` returns uncolored text for TUI display ### Setup Wizard - Flow: Banner → Provider Selection → Per-provider Config → Summary → Connection Test → Save - Uses crossterm for raw input (not dialoguer) - Provider auto-detect: localhost Ollama sets `merge_system=true`, `no_tools=true` - Config saved to `~/.config/gyandoot/config.toml` ### Terminal Helpers - `progress_spinner()` — Runs a closure with a spinner animation - `confirm_prompt()` — y/n question with optional default - `text_input()` — Raw-mode text input with backspace/enter/esc support - `selection_menu()` — Numbered menu returning index or None - `show_status()` — Colored status display (success/error/warning/info) ### TUI - Three modes: Normal, Input, Command - Keyboard shortcuts: `q`/Esc to quit, `i` for input mode, `:` or `/` for commands - Commands: `/help`, `/clear`, `/banner`, `/quit`, `/status` - Uses ratatui with crossterm backend - Enters/leaves alternate screen on start/exit ### CLI Integration - `gyandoot setup` — Runs the setup wizard (non-async, terminal I/O) - `gyandoot tui` — Launches the ratatui TUI interface