claude_code_toolkit/
lib.rs

1//! # Claude Code Toolkit
2//!
3//! A comprehensive Rust toolkit for managing Claude Code credentials, session monitoring,
4//! and GitHub integration. This crate provides both a command-line interface and a library
5//! for programmatic access to Claude Code functionality.
6//!
7//! ## Features
8//!
9//! - **Credential Management**: Secure storage and synchronization of Claude Code credentials
10//! - **Session Monitoring**: Real-time tracking of Claude Code sessions with timer functionality
11//! - **GitHub Integration**: Seamless sync with GitHub repositories and organizations
12//! - **Daemon Mode**: Background service for automatic credential synchronization
13//! - **Cross-Platform**: Primary support for Linux, with WSL support for Windows users
14//! - **Systemd Integration**: Native systemd service support on Linux (optional feature)
15//! - **Desktop Notifications**: Optional desktop notification support
16//!
17//! ## Quick Start
18//!
19//! ### Command Line Usage
20//!
21//! ```bash
22//! # Install the daemon service
23//! claude-code-toolkit service install
24//!
25//! # Add a GitHub organization for sync
26//! claude-code-toolkit org add my-org
27//!
28//! # Add a specific repository
29//! claude-code-toolkit repo add owner/repo
30//!
31//! # Sync credentials to all configured targets
32//! claude-code-toolkit sync
33//!
34//! # Check status
35//! claude-code-toolkit status
36//! ```
37//!
38//! ### Library Usage
39//!
40//! ```rust,no_run
41//! use claude_code_toolkit::{
42//!     config::manager::ConfigurationManager,
43//!     sync::SyncService,
44//!     Result,
45//! };
46//!
47//! #[tokio::main]
48//! async fn main() -> Result<()> {
49//!     // Initialize configuration
50//!     let config_manager = ConfigurationManager::new()?;
51//!     
52//!     // Set up sync service
53//!     let mut sync_service = SyncService::new_with_config().await?;
54//!     
55//!     // Sync credentials
56//!     sync_service.sync_all().await?;
57//!     
58//!     Ok(())
59//! }
60//! ```
61//!
62//! ## Architecture
63//!
64//! The toolkit is organized into several key modules:
65//!
66//! - [`config`] - Configuration management and credential storage
67//! - [`daemon`] - Background service functionality
68//! - [`providers`] - Integration with external services (GitHub, etc.)
69//! - [`sync`] - Credential synchronization logic
70//! - [`cli`] - Command-line interface components
71//! - [`utils`] - Utility functions and helpers
72//!
73//! ## Configuration
74//!
75//! The toolkit uses YAML-based configuration files stored in platform-appropriate
76//! directories. Configuration includes:
77//!
78//! - GitHub API tokens and repository settings
79//! - Sync intervals and retry policies
80//! - Notification preferences
81//! - Daemon service settings
82//!
83//! ## Security
84//!
85//! - Credentials are stored securely using platform-specific secure storage
86//! - All API communications use HTTPS
87//! - Sensitive data is never logged or exposed in error messages
88//! - Configuration files have restrictive permissions
89//!
90//! ## Feature Flags
91//!
92//! - `systemd` (default): Enables systemd service integration on Linux
93//! - `notifications` (default): Enables desktop notification support
94//!
95//! ## Platform Support
96//!
97//! | Platform | CLI | Sync | Daemon | Notes |
98//! |----------|-----|------|--------|-------|
99//! | 🐧 Linux | ✅ | ✅ | ✅ | Complete systemd integration |
100//! | 🪟 Windows (WSL) | ✅ | ✅ | ✅ | Requires WSL with systemd enabled |
101//! | 🪟 Windows (Native) | ⚠️ | ❌ | ❌ | CLI only - credentials in system store |
102//! |  macOS | ⚠️ | ❌ | ❌ | CLI only - credentials in Keychain |
103//!
104//! **Feature Details**:
105//! - **✅ Full**: Complete functionality as designed
106//! - **⚠️ Partial**: CLI commands work, but credential reading fails
107//! - **❌ No**: Feature unavailable due to platform limitations
108//!
109//! **Support Breakdown**:
110//! - **CLI Full**: All commands including org/repo management, configuration
111//! - **CLI Partial**: Commands work but `status`, `sync`, `timer` fail (no credential access)
112//! - **Sync**: Requires file-based credential storage at `~/.claude/.credentials.json`
113//! - **Daemon**: Requires systemd for background service functionality
114//!
115//! **Important Notes**: 
116//! - This toolkit expects Claude Code credentials to be stored as **files**, not in system keychains
117//! - **Expected credential location**: `~/.claude/.credentials.json`
118//! - **Linux and WSL** store credentials as files at this location, making them compatible
119//! - **macOS and native Windows** store credentials in Keychain/Credential Manager respectively
120//! - On incompatible platforms, credential reading will fail and sync operations won't work
121
122pub mod cli;
123pub mod config;
124pub mod daemon;
125pub mod error;
126pub mod providers;
127pub mod sync;
128pub mod traits;
129pub mod types;
130pub mod utils;
131
132pub use error::{ ClaudeCodeError, Result };
133pub use traits::*;