mirror of
https://github.com/openai/codex.git
synced 2026-11-14 21:40:39 +00:00
## Why Skill selection and disabled-path matching need to recognize equivalent Windows paths across case and separator differences while preserving literal spaces, `%`, and `#` in native filenames. ## What changed - Carry `PathUri` through skill metadata, discovery mappings, filesystem lookups, disabled-path sets, and invocation analytics. - Match linked skill mentions and TUI selections by parsed path identity. - Use `LegacyAppPathString` for app-server skill paths and regenerate schemas and SDK types, preserving native path strings on the wire. - Preserve native catalog display paths and ordering. Keep host filesystem probes and configuration writes restricted to host-compatible paths. ## Testing Add regression tests for Windows path identity and disabled-skill matching, literal filename characters, catalog resource reads, native path ordering, and foreign-path analytics normalization. GitOrigin-RevId: c212916dc9fef0e7616542726e107f0d6a313267
26 lines
852 B
Rust
26 lines
852 B
Rust
use std::collections::HashMap;
|
|
use std::collections::HashSet;
|
|
|
|
use codex_utils_path_uri::PathUri;
|
|
|
|
use crate::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<PathUri>,
|
|
) -> (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)
|
|
}
|