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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
//! # Utility Functions and Helpers
//!
//! This module provides various utility functions and helpers used throughout VT Code,
//! including configuration management, safety 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
//!
//! ### Safety Utilities (`safety`)
//! - **Path Validation**: Workspace boundary checking
//! - **Command Sanitization**: Safe command execution
//! - **Input Validation**: User input sanitization
//!
//! ### ANSI and Colors (`ansi`, `colors`, `ratatui_styles`)
//! - **Terminal Colors**: ANSI color codes and styling
//! - **Color Management**: Theme support and color schemes
//! - **Cross-platform**: Works on different terminal types
//! - **TUI Integration**: Convert anstyle to ratatui styles seamlessly via anstyle-crossterm
//!
//! ### 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,no_run
//! 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(())
//! }
//! ```
//!
//! ### Path Safety
//! ```rust,no_run
//! use vtcode_core::utils::safety::validate_workspace_path;
//! use std::path::PathBuf;
//!
//! let workspace = PathBuf::from("/home/user/project");
//! let file_path = PathBuf::from("src/main.rs");
//!
//! // Validate path is within workspace
//! match validate_workspace_path(&workspace, &file_path) {
//! Ok(valid_path) => println!("Safe path: {}", valid_path.display()),
//! Err(e) => eprintln!("Unsafe path: {}", e),
//! }
//! ```
//!
//! ### ANSI Colors
//! ```rust,no_run
//! 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,no_run
//! 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 *;
pub use CachedStyleParser;
pub use *;
pub use ;
pub use *;