1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//! # Utility Functions and Helpers
//!
//! This module provides various utility functions and helpers used throughout VT Code,
//! including configuration management, path utilities, and common operations.
//!
//! ## Modules Overview
//!
//! ### Configuration Management (`dot_config`)
//! - **User Preferences**: Theme settings, UI preferences, cache configuration
//! - **Provider Configuration**: LLM provider settings and API keys
//! - **Dotfile Management**: `.vtcode` directory and configuration files
//!
//! ### ANSI and Colors (`ansi`, `colors`)
//! - **Terminal Colors**: ANSI color codes and styling
//! - **Color Management**: Theme support and color schemes
//! - **Cross-platform**: Works on different terminal types
//!
//! ### Git Integration (`vtcodegitignore`)
//! - **Gitignore Management**: Automatic `.vtcodegitignore` creation
//! - **Pattern Matching**: File exclusion patterns
//! - **Workspace Safety**: Prevents accidental file operations
//!
//! ### Path Utilities (`path`)
//! - **Path Normalization**: Resolve `.` and `..` components
//! - **Shared Utilities**: Common path operations
//!
//! ## Basic Usage Examples
//!
//! ### Configuration Management
//! ```rust,ignore
//! use vtcode_core::utils::dot_config::{load_user_config, save_user_config, UserPreferences};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Load user configuration
//! let config = load_user_config().await?;
//!
//! // Modify preferences
//! let mut prefs = config.preferences;
//! prefs.theme = "dark".to_string();
//!
//! // Save changes
//! save_user_config(&prefs).await?;
//!
//! Ok(())
//! }
//! ```
//!
//! ### ANSI Colors
//! ```rust,ignore
//! use vtcode_core::utils::ansi::{colorize, Color};
//!
//! let message = "Hello, World!";
//! let colored = colorize(message, Color::Green);
//! println!("{}", colored); // Prints green text
//!
//! // Or use styling functions
//! let bold_text = vtcode_core::utils::ansi::bold("Important message");
//! let red_error = colorize("Error occurred", Color::Red);
//! ```
//!
//! ### Git Integration
//! ```rust,ignore
//! use vtcode_core::utils::vtcodegitignore::initialize_vtcode_gitignore;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let workspace = std::env::current_dir()?;
//!
//! // Initialize .vtcodegitignore
//! initialize_vtcode_gitignore(&workspace).await?;
//!
//! println!("Git integration initialized");
//! Ok(())
//! }
//! ```
pub use CachedStyleParser;
pub use ;
pub use *;