rekon 0.0.8

Reconstruct where your time and compute went: account for agentic work on two axes and review a daily ledger instead of keeping a timesheet.
//! Command-line surface.

use std::path::PathBuf;

use clap::{Parser, Subcommand, ValueEnum};
use jiff::civil::Date;

/// Reconstruct where your time and compute went.
#[derive(Debug, Parser)]
#[command(name = "rekon", version, about, long_about = None)]
pub struct Cli {
    /// Log filter, e.g. `info` or `rekon=debug`. RUST_LOG overrides it.
    #[arg(long, global = true, default_value = "warn", env = "REKON_LOG")]
    pub log: String,

    /// Path to the config file. Defaults to ~/.config/rekon/rekon.toml.
    #[arg(long, global = true, env = "REKON_CONFIG")]
    pub config: Option<PathBuf>,

    /// The command to run.
    #[command(subcommand)]
    pub command: Command,
}

/// Subcommands.
#[derive(Debug, Subcommand)]
pub enum Command {
    /// Write a starter config file.
    Init {
        /// Overwrite an existing config.
        #[arg(long)]
        force: bool,
    },
    /// Reconstruct a day into a draft ledger, store it, and print it.
    Reconstruct {
        /// The day to reconstruct (YYYY-MM-DD). Defaults to today.
        #[arg(long)]
        date: Option<Date>,
        /// Extra repositories to scan, overriding the config's git repos.
        #[arg(long = "repo", value_name = "PATH")]
        repos: Vec<PathBuf>,
        /// Rebuild even if the day is already approved, discarding the approval.
        #[arg(long)]
        force: bool,
        /// Run LLM-assisted attribution to refine groupings.
        #[arg(long)]
        llm: bool,
        /// Reconstruct and print without saving to the store.
        #[arg(long)]
        dry_run: bool,
    },
    /// Show a stored ledger, or open it in $EDITOR to correct and approve it.
    Review {
        /// The day to show (YYYY-MM-DD). Defaults to today.
        #[arg(long)]
        date: Option<Date>,
        /// Output format (ignored with --edit).
        #[arg(long, value_enum, default_value_t = Format::Text)]
        format: Format,
        /// Open the draft in $EDITOR to correct and approve it.
        #[arg(long)]
        edit: bool,
    },
    /// Mark a day's ledger approved.
    Approve {
        /// The day to approve (YYYY-MM-DD). Defaults to today.
        #[arg(long)]
        date: Option<Date>,
    },
    /// Print the resolved config and store locations.
    Config,
}

/// Output format for `review`.
#[derive(Debug, Clone, Copy, ValueEnum)]
pub enum Format {
    /// Human-readable table.
    Text,
    /// Machine-readable JSON.
    Json,
}