claude-utils 0.2.0

Cross-platform companion toolkit for Anthropic's Claude Code CLI
Documentation
// Example of how to integrate telemetry into the main application

use crate::telemetry::{track, EventType};

// In your main.rs or bin/claude-utils.rs, add these telemetry calls:

// 1. When the app starts:
async fn on_app_start() {
    track(EventType::AppStarted, None).await;
}

// 2. When watch mode is enabled:
async fn on_watch_mode_start() {
    track(EventType::WatchModeEnabled, None).await;
}

// 3. When an image is detected in clipboard:
async fn on_image_detected(width: u32, height: u32, format: &str) {
    track(
        EventType::ClipboardImageDetected,
        Some(serde_json::json!({
            "width": width,
            "height": height,
            "format": format,
        })),
    )
    .await;
}

// 4. When an image is staged:
async fn on_image_staged(file_size: u64) {
    track(
        EventType::ClipboardImageStaged,
        Some(serde_json::json!({
            "file_size": file_size,
        })),
    )
    .await;
}

// 5. When MCP tools are called:
async fn on_mcp_tool_called(tool_name: &str) {
    track(
        EventType::McpToolCalled,
        Some(serde_json::json!({
            "tool": tool_name,
        })),
    )
    .await;
}

// 6. On errors (without exposing sensitive info):
async fn on_error(error_type: &str) {
    use crate::telemetry::track_error;
    track_error(error_type).await;
}

// Example integration in your command handler:
/*
use claude_utils::telemetry;

#[tokio::main]
async fn main() -> Result<()> {
    // Initialize app
    let cli = Cli::parse();
    
    // Track app start
    telemetry::track(EventType::AppStarted, None).await;
    
    match cli.command {
        Commands::Start { watch, .. } => {
            if watch {
                telemetry::track(EventType::WatchModeEnabled, None).await;
            }
            // ... rest of your code
        }
        // ... other commands
    }
    
    Ok(())
}
*/