MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / remove_codex_plugin_managed_skills

Function remove_codex_plugin_managed_skills

src/agents/codex.rs:870–891  ·  view source on GitHub ↗
(install_dir: &Path, skills_dir: &Path)

Source from the content-addressed store, hash-verified

868}
869
870fn remove_codex_plugin_managed_skills(install_dir: &Path, skills_dir: &Path) -> Result<()> {
871 sweep_retired_bundle_skill_dirs(skills_dir);
872 let managed: HashSet<PathBuf> = codex_plugin_managed_paths(install_dir)
873 .into_iter()
874 .filter(|path| path.starts_with(skills_dir))
875 .collect();
876 let mut files =
877 super::collect_regular_files(skills_dir).map_err(|e| TraceDecayError::Config {
878 message: format!("failed to list {}: {e}", skills_dir.display()),
879 })?;
880 files.sort_by_key(|path| std::cmp::Reverse(path.components().count()));
881 for file in files {
882 if managed.contains(&file) || codex_skill_file_is_legacy_tracedecay_managed(&file) {
883 std::fs::remove_file(&file).map_err(|e| TraceDecayError::Config {
884 message: format!("failed to remove {}: {e}", file.display()),
885 })?;
886 }
887 }
888 prune_empty_dirs(skills_dir).map_err(|e| TraceDecayError::Config {
889 message: format!("failed to prune empty Codex skill directories: {e}"),
890 })
891}
892
893fn codex_skill_file_is_legacy_tracedecay_managed(path: &Path) -> bool {
894 path.file_name()

Callers 1

Calls 8

collect_regular_filesFunction · 0.85
prune_empty_dirsFunction · 0.85
collectMethod · 0.80
countMethod · 0.80
containsMethod · 0.45

Tested by

no test coverage detected