mirror of
https://github.com/openai/codex.git
synced 2026-11-08 20:40:33 +00:00
25 lines
872 B
Rust
25 lines
872 B
Rust
use std::collections::HashMap;
|
|
use std::collections::HashSet;
|
|
|
|
use super::SkillMetadata;
|
|
use codex_utils_absolute_path::AbsolutePathBuf;
|
|
|
|
/// Counts how often each skill name appears (exact and ASCII-lowercase), excluding disabled paths.
|
|
pub fn build_skill_name_counts(
|
|
skills: &[SkillMetadata],
|
|
disabled_paths: &HashSet<AbsolutePathBuf>,
|
|
) -> (HashMap<String, usize>, HashMap<String, usize>) {
|
|
let mut exact_counts: HashMap<String, usize> = HashMap::new();
|
|
let mut lower_counts: HashMap<String, usize> = HashMap::new();
|
|
for skill in skills {
|
|
if disabled_paths.contains(&skill.path_to_skills_md) {
|
|
continue;
|
|
}
|
|
*exact_counts.entry(skill.name.clone()).or_insert(0) += 1;
|
|
*lower_counts
|
|
.entry(skill.name.to_ascii_lowercase())
|
|
.or_insert(0) += 1;
|
|
}
|
|
(exact_counts, lower_counts)
|
|
}
|