Skip to main content

ai_agent/utils/
github_repo_path_mapping.rs

1use std::collections::HashMap;
2use std::sync::Mutex;
3
4static REPO_MAPPING: std::sync::LazyLock<Mutex<HashMap<String, String>>> =
5    std::sync::LazyLock::new(|| Mutex::new(HashMap::new()));
6
7pub fn map_github_repo_to_local_path(repo: &str) -> Option<String> {
8    REPO_MAPPING.lock().unwrap().get(repo).cloned()
9}
10
11pub fn set_github_repo_mapping(repo: &str, local_path: &str) {
12    REPO_MAPPING
13        .lock()
14        .unwrap()
15        .insert(repo.to_string(), local_path.to_string());
16}
17
18pub fn clear_mappings() {
19    REPO_MAPPING.lock().unwrap().clear();
20}