2.2 KiB
2.2 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Development Commands
- Build project:
cargo build - Build release:
cargo build --release - Run locally:
cargo run -- <subcommand> <args>(e.g.,cargo run -- add "test item") - Run tests:
cargo test - Check code:
cargo check - Format code:
cargo fmt - Lint code:
cargo clippy - Install from source:
cargo build --release && cp target/release/ldr ~/.local/bin/
Project Architecture
LDR is a Rust CLI productivity application implementing the "append-and-review" note system. The architecture follows a clean separation of concerns:
Core Structure
- main.rs: Entry point with CLI definition using
clap. Handles XDG-compliant data directory setup (~/.local/share/ldr/) fornote.txtandarchive.txtfiles - commands.rs: Command implementations with terminal I/O, file operations, and colored output using
termion - content.rs: Pure functions for content manipulation without side effects - handles all core logic for text processing
- input.rs: Raw keyboard input handling for interactive review mode, processes ANSI escape sequences for arrow keys
Key Design Patterns
- Separation of pure functions: Core logic in
content.rsis stateless and easily testable - XDG compliance: Uses
xdgcrate for proper data directory handling - Terminal UI: Interactive review mode with keyboard navigation and colored output
- File-based storage: Simple text files for persistence (
note.txtfor active items,archive.txtfor completed)
Data Flow
- CLI parsing extracts subcommands and arguments
- XDG directories are resolved for data files
- Commands delegate to pure functions in
content.rsfor logic - File I/O operations handle persistence
- Terminal output provides user feedback with colors
Interactive Review Mode
The scan command provides a sophisticated interactive interface:
- Arrow key navigation with undo functionality
- Real-time state management for prioritize/archive/skip actions
- Full-screen terminal interface with progress tracking
- History system supporting multi-level undo operations