thulp_skill_files/lib.rs
1//! # thulp-skill-files
2//!
3//! SKILL.md file parsing and loading for the Thulp execution context platform.
4//!
5//! This crate provides functionality for:
6//! - Parsing SKILL.md files with YAML frontmatter
7//! - Preprocessing skill content (arguments, commands, variables)
8//! - Loading skills from directories with scope-based priority
9//!
10//! ## Quick Start
11//!
12//! ```rust,ignore
13//! use thulp_skill_files::{SkillFile, SkillLoader, SkillLoaderConfig, SkillPreprocessor};
14//! use std::collections::HashMap;
15//!
16//! // Parse a single skill file
17//! let skill = SkillFile::parse("path/to/SKILL.md")?;
18//! println!("Skill: {}", skill.effective_name());
19//!
20//! // Load all skills from configured directories
21//! let config = SkillLoaderConfig::default();
22//! let loader = SkillLoader::new(config);
23//! let skills = loader.load_all()?;
24//!
25//! // Preprocess skill content
26//! let pp = SkillPreprocessor::new();
27//! let context = HashMap::new();
28//! let processed = pp.preprocess(&skill.content, "my args", &context)?;
29//! ```
30//!
31//! ## SKILL.md Format
32//!
33//! Skills are defined in SKILL.md files with optional YAML frontmatter:
34//!
35//! ```markdown
36//! ---
37//! name: my-skill
38//! description: Does something useful
39//! allowed-tools:
40//! - Read
41//! - Write
42//! ---
43//! # Instructions
44//!
45//! When invoked with $ARGUMENTS, do the following...
46//! ```
47//!
48//! ## Frontmatter Options
49//!
50//! | Field | Type | Description |
51//! |-------|------|-------------|
52//! | `name` | string | Display name (defaults to directory name) |
53//! | `description` | string | What the skill does |
54//! | `argument-hint` | string | Hint for expected arguments |
55//! | `disable-model-invocation` | bool | Prevent automatic invocation |
56//! | `user-invocable` | bool | Allow user to invoke (default: true) |
57//! | `allowed-tools` | list | Restrict tools the skill can use |
58//! | `context` | inline/fork | Execution context |
59//! | `requires-approval` | bool | Require user approval |
60//!
61//! ## Scope Priority
62//!
63//! Skills are loaded with priority: Enterprise > Personal > Project.
64//! Plugin skills are namespaced and don't conflict.
65
66pub mod error;
67pub mod frontmatter;
68pub mod loader;
69pub mod parser;
70pub mod preprocessor;
71
72// Re-export main types
73pub use error::{Result, SkillFileError};
74pub use frontmatter::{PriceModel, SkillContext, SkillFrontmatter, SkillHooks};
75pub use loader::{LoadedSkill, SkillLoader, SkillLoaderConfig, SkillScope};
76pub use parser::{SkillFile, SupportingFile, SupportingFileType};
77pub use preprocessor::SkillPreprocessor;