mirror of
https://github.com/openai/codex.git
synced 2026-04-30 03:12:20 +03:00
## Summary - move skill loading and management into codex-core-skills - leave codex-core with the thin integration layer and shared wiring ## Testing - CI --------- Co-authored-by: Codex <noreply@openai.com>
25 lines
840 B
Rust
25 lines
840 B
Rust
use std::collections::HashMap;
|
|
use std::collections::HashSet;
|
|
use std::path::PathBuf;
|
|
|
|
use super::SkillMetadata;
|
|
|
|
/// 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<PathBuf>,
|
|
) -> (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)
|
|
}
|