Files
ldr/CLAUDE.md
T
2025-08-19 13:54:14 -06:00

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/) for note.txt and archive.txt files
  • 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.rs is stateless and easily testable
  • XDG compliance: Uses xdg crate 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.txt for active items, archive.txt for completed)

Data Flow

  1. CLI parsing extracts subcommands and arguments
  2. XDG directories are resolved for data files
  3. Commands delegate to pure functions in content.rs for logic
  4. File I/O operations handle persistence
  5. 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