Skip to content

Latest commit

 

History

History
86 lines (68 loc) · 2.25 KB

File metadata and controls

86 lines (68 loc) · 2.25 KB

Strata - Implementation Pass Summary

Project Overview

  • Name: Strata
  • Type: Single-crate Rust application (TUI + CLI)
  • Entry Point: src/main.rs
  • Edition: 2024

Dependencies Added

  • clap 4.4 (CLI argument parsing)
  • clap_complete 4.4 (shell completions)
  • serde/serde_json (JSON export)
  • directories 5.0 (XDG paths)
  • chrono 0.4 with serde (time handling)
  • itertools 0.12 (collection utilities)

Storage Format

Data Locations (XDG)

  • Data dir: ~/.local/share/strata/ (or ./ if unavailable)
    • categories.csv - category definitions with IDs
    • time_log.csv - session history
  • State dir: ~/.local/state/strata/ (or ./ if unavailable)
    • active_session.json - current active session
    • backups/ - rolling backups (last 10)

CSV Schema (migrated)

categories.csv (new schema with IDs):

id,name,description,color_index,karma_effect
1,Academia,,9,1
2,Oficina,,0,1

time_log.csv (new schema with category_id):

id,date,category_id,category_name,description,start_time,end_time,elapsed_seconds
1,2026-02-19,5,Hotel,,23:39:03,00:13:32,2069

P0: CategoryId Implementation

Changes Made

  1. Added CategoryId(u64) type - stable identity
  2. Added id field to Category struct
  3. Sand grid now stores Option<CategoryId> instead of Option<usize>
  4. Sessions store category_id: CategoryId instead of category name string
  5. Added migration: existing data auto-assigns IDs on load

Test

  • Added test_category_id_stability_on_reorder - verifies reordering categories doesn't change session associations

P0: CLI Commands

Commands Implemented

# Start a session
strata start "project-name" --desc "working on feature" --category NAME

# Stop current session
strata stop

# Today's report
strata report --today

# Export
strata export --format json
strata export --format ics
strata export --format json --out path/to/export.json

# Shell completions
strata completions bash
strata completions zsh
strata completions fish

P1: Data Integrity

Atomic Writes

  • Sessions and categories use atomic write (tmp + rename)
  • Rolling backups: keeps last 10 backups with timestamp

Baseline Checks

  • cargo fmt: PASS
  • cargo clippy: PASS (warnings only)
  • cargo test: PASS (2 tests)