agentlog 0.1.2

CLI flight recorder for AI coding agents - capture, store, and replay AI sessions
Documentation
use crate::core::file_watcher::FileWatcher;
use crate::core::{agentlog_path, db_path, ensure_initialized};
use anyhow::Result;
use colored::Colorize;

pub async fn execute() -> Result<()> {
    let project_root = ensure_initialized()?;
    let db_file = db_path(&project_root);
    let _agentlog_dir = agentlog_path(&project_root);

    println!("{}", "Starting AgentLog file watcher...".blue().bold());
    println!("Monitoring: {}", project_root.display());
    println!("Events will be logged to: {}", db_file.display());
    println!("\nPress Ctrl+C to stop\n");

    let watcher = FileWatcher::new(|event| {
        for path in event.paths {
            if let Some(path_str) = path.to_str() {
                if !path_str.contains(".agentlog") && !path_str.contains(".git") {
                    println!("Detected change: {}", path_str);
                }
            }
        }
    })?;

    let mut watcher = watcher;
    watcher.watch(&project_root)?;

    tokio::signal::ctrl_c().await?;

    println!("\n{}", "Watcher stopped.".yellow());
    Ok(())
}