This file provides essential guidelines for agentic coding agents working on the FireCalendar event management system.
- Name: FireCalendar
- Stack: Rust (core library + CLI binary + TUI)
- Purpose: Calendar CLI with events, categories, recurrence, reminders, and TUI interface
# Build everything
cargo build
# Run all tests
cargo test
# Build and run CLI directly
cargo run -- <command>
# Run a single test
cargo test -- test_event_creationALWAYS run the following sequence after completing any coding task:
- Build:
cargo build- verify compilation succeeds - Test:
cargo test- run all tests to ensure nothing is broken - Install:
cargo install --path .- install/update the binary globally
This ensures the code compiles, tests pass, and the latest version is available system-wide.
firecalendar/
├── Cargo.toml # Project root
├── src/
│ ├── main.rs # CLI entry point with clap
│ ├── core/ # Core library (pub API for CLI + TUI + future GUIs)
│ │ ├── mod.rs # Re-exports
│ │ ├── error.rs # Error types
│ │ ├── event.rs # Event models and enums
│ │ └── store.rs # Storage operations
│ └── tui/ # TUI interface
│ ├── mod.rs # Exports
│ ├── app.rs # TUI application logic
│ └── ui.rs # TUI rendering with ratatui
- Follow Rust convention: std → external crates → internal crates
- Use
anyhow::Resultfor CLI code,crate::Resultfor core library - Re-export public types in
core/mod.rs - TUI dependencies:
ratatuifor rendering,crosstermfor terminal handling - Notification dependency:
notify-rustfor desktop notifications
- Structs: PascalCase (
Event,Category,EventStore) - Functions: snake_case (
add_event,list_events,mark_complete) - Constants: UPPER_SNAKE_CASE (rarely used)
- Error variants: PascalCase (
EventNotFound,StoreNotFound)
- Core library: use
thiserrorfor typed errors, returncrate::Result<T> - CLI: use
anyhow::Resultwith?operator - Never unwrap in core; use
?or.map_err() - Use
anyhow::bail!for CLI error messages
- Public API surface in
lib.rsmust be stable (GUI consumers depend on it) - All pub types must have
#[derive(Debug, Clone, Serialize, Deserialize)]where possible - Use
chrono::DateTime<Utc>for all timestamps - Use
uuid::Uuidfor all entity IDs - Storage path defaults to
~/.firecalendar/events.jsonviadirscrate
- Event: id, title, description, start_time, end_time, status, category_id, tags, recurrence, reminder_minutes, timezone, location, timestamps
- Category: id, name, description, color, timestamps
- EventStatus: Scheduled, InProgress, Completed, Cancelled
- Recurrence: None, Daily, Weekly, Monthly, Yearly, Custom
- EventFilter: Optional filters for listing events
- CalendarStats: Aggregate counts for dashboard
- JSON file storage via
serde_json - Atomic write operations (read → modify → write)
- Auto-create parent directories
- Version field in store for future migrations
- Timestamps for created_at and updated_at
- Use
clapwith derive macros - Subcommands for each operation (init, add, list, show, update, complete, start, cancel, delete, add-category, list-categories, today, week, stats, tui)
- Colorized output using
coloredcrate - Human-friendly error messages
- Support for CSV input (tags, etc.)
- Date/time format: RFC3339 (e.g., "2026-05-10T14:00:00Z")
- Use
ratatuifor terminal UI rendering - Use
crosstermfor terminal handling and event processing - Modes: CategoryList, EventDetail, AddEvent, AddCategory, CalendarView
- Key bindings: vim-style (j/k) + arrow keys + single-letter commands
- Real-time updates to store
- Color-coded status indicators
- Modern UI with sidebar showing statistics and categories
- Auto-dismissing messages (3 seconds)
- Auto-save on every modification
- Core library must have test coverage for CRUD operations
- Tests use temp directories or in-memory stores
- Test file naming:
tests.rsin core - CLI integration tests via shell script (not Rust tests)
- Change the public API of firecalendar core without updating README
- Use
unwrap()in core library code - Hardcode paths (use
dirscrate) - Break backward compatibility of store format
- Test TUI in non-TTY environments
- Follow existing patterns in the codebase
- Run
cargo testbefore committing - Create parent directories when needed (
create_dir_all) - Use
anyhow::bail!for CLI error messages - Keep store format backward compatible
- Add version field to store for migrations
- ALWAYS run the following sequence after completing tasks:
cargo build- verify compilationcargo test- run all testscargo install --path .- install/update the binary globally
The TUI is fully implemented and functional with the following features:
- Modes: CategoryList, EventDetail, AddEvent, AddCategory, CalendarView
- Navigation: Vim-style (j/k) + arrow keys
- Actions: Add events/categories, mark complete, delete, view details
- Filters: Filter by status
- Real-time updates: Changes immediately reflected in the UI
- Color-coded indicators: Status (blue/yellow/green/red)
- Auto-dismissing messages: Status messages auto-hide after 3 seconds
- Sidebar with real-time statistics and category overview
- Table-based layout for events and categories with proper headers
- Unicode box-drawing characters for polished borders (╭─╮, │, ├─┤, ╰─╯)
- Emoji indicators for visual clarity (📅, 🔵, 🟡, 🟢, ✗, etc.)
- Status icons: ○ (scheduled), ◐ (in progress), ● (completed), ⊘ (cancelled)
- Color-coded overdue warnings with ✗ indicator
- Header with mode-specific icons and filter indicators
- Sidebar showing event statistics and category list
- Footer with compact keyboard shortcuts and status messages
- Modern table design with proper column spacing
- Empty state messages for events/categories lists
- Inline help in add event/category forms
- Consistent color scheme (red accent matching other fire apps)
- Selected row highlighting with red accent background
- Message Auto-Dismiss: Status messages automatically clear after 3 seconds
- Auto-Save: Every modification in TUI automatically saves to storage
- Firefly Labs Context Integration:
- Storage path follows Firefly Labs pattern:
/firefly/config/firecalendar/events.json(production) with fallback to~/.firecalendar/events.json - Prioritizes production config over home directory
- Documented in CONTEXT.md alongside other Firefly Labs projects
- Storage path follows Firefly Labs pattern:
firecalendar init # Initialize event store
firecalendar add "Meeting" --start "2026-05-10T14:00:00Z" --end "2026-05-10T15:00:00Z"
firecalendar list # List all events
firecalendar show <uuid> # Show event details
firecalendar today # Show today's events
firecalendar week # Show this week's events
firecalendar stats # Show statistics
firecalendar tui # Open TUI interfacefirecalendar update <uuid> --title "New Title"
firecalendar complete <uuid> # Mark as completed
firecalendar start <uuid> # Mark as in progress
firecalendar cancel <uuid> # Cancel event
firecalendar delete <uuid> # Delete eventfirecalendar add-category "Work" --description "Work events"
firecalendar list-categories # List all categoriesfirecalendar add "Meeting" \
--description "Team sync" \
--start "2026-05-10T14:00:00Z" \
--end "2026-05-10T15:00:00Z" \
--category <uuid> \
--tags "important,work" \
--recurrence weekly \
--reminder 15 \
--timezone "America/Sao_Paulo" \
--location "Conference Room A"