Skip to main content

oxios_kernel/skill/
mod.rs

1//! Skill system: multi-format SKILL.md parsing with format detection,
2//! plus multi-registry marketplace sources (ClawHub, Skills.sh).
3
4pub mod clawhub;
5pub mod format;
6pub mod frontmatter;
7pub mod manager;
8pub mod prompt;
9pub mod requirements;
10pub mod skills_sh;
11pub mod types;
12
13pub use format::SkillFormat;
14pub use manager::SkillManager;
15pub use prompt::{compact_path, escape_xml};
16pub use requirements::check_requirements;
17pub use types::{
18    ConfigCheck, InstallKind, Requirements, RequirementsCheck, Skill, SkillConfig, SkillEntry,
19    SkillInstallSpec, SkillInvocationPolicy, SkillMeta, SkillMetadata, SkillRef, SkillSnapshot,
20    SkillSource, SkillState, SkillStatus,
21};
22
23/// Returns true if `rel` is a safe relative path: no parent/root/prefix
24/// components that could escape a target directory (Zip Slip / path traversal).
25///
26/// Used by skill installers (ClawHub zip extraction, skills.sh file writes)
27/// to reject archive entries whose names contain `..`, absolute paths, or
28/// Windows drive prefixes.
29pub(crate) fn is_safe_relative_path(rel: &str) -> bool {
30    let p = std::path::Path::new(rel);
31    !p.components().any(|c| {
32        matches!(
33            c,
34            std::path::Component::ParentDir
35                | std::path::Component::RootDir
36                | std::path::Component::Prefix(_)
37        )
38    })
39}