vtcode_core/prompts/
context.rs

1use std::path::PathBuf;
2
3/// Context information for prompt generation
4#[derive(Debug, Clone)]
5pub struct PromptContext {
6    /// Current workspace path
7    pub workspace: Option<PathBuf>,
8    /// Detected programming languages
9    pub languages: Vec<String>,
10    /// Project type (if detected)
11    pub project_type: Option<String>,
12    /// Available tools
13    pub available_tools: Vec<String>,
14    /// User preferences
15    pub user_preferences: Option<UserPreferences>,
16}
17
18impl Default for PromptContext {
19    fn default() -> Self {
20        Self {
21            workspace: None,
22            languages: Vec::new(),
23            project_type: None,
24            available_tools: Vec::new(),
25            user_preferences: None,
26        }
27    }
28}
29
30/// User preferences for prompt customization
31#[derive(Debug, Clone)]
32pub struct UserPreferences {
33    /// Preferred programming languages
34    pub preferred_languages: Vec<String>,
35    /// Coding style preferences
36    pub coding_style: Option<String>,
37    /// Framework preferences
38    pub preferred_frameworks: Vec<String>,
39}
40
41impl PromptContext {
42    /// Create context from workspace
43    pub fn from_workspace(workspace: PathBuf) -> Self {
44        Self {
45            workspace: Some(workspace),
46            ..Default::default()
47        }
48    }
49
50    /// Add detected language
51    pub fn add_language(&mut self, language: String) {
52        if !self.languages.contains(&language) {
53            self.languages.push(language);
54        }
55    }
56
57    /// Set project type
58    pub fn set_project_type(&mut self, project_type: String) {
59        self.project_type = Some(project_type);
60    }
61
62    /// Add available tool
63    pub fn add_tool(&mut self, tool: String) {
64        if !self.available_tools.contains(&tool) {
65            self.available_tools.push(tool);
66        }
67    }
68}