Skip to main content

agents_skills/
lib.rs

1//! `agents-skills` as a library: the high-level [`Manager`] facade over a private
2//! domain layer.
3//!
4//! The library is pure data — it never prints to stdout/stderr and never calls
5//! `process::exit`. The CLI binary (see `src/main.rs` + `src/commands`) is responsible
6//! for rendering outcomes and deciding exit codes.
7//!
8//! # Quick tour
9//!
10//! ```
11//! use agents_skills::{ListRequest, Manager};
12//!
13//! // Point the manager at a scratch environment (hermetic, no real home access).
14//! let manager = Manager::builder()
15//!     .home("/tmp/home")
16//!     .config("/tmp/config")
17//!     .cwd("/tmp/project")
18//!     .build();
19//!
20//! // Install every skill from a source (see [`Manager::add`] for a local example).
21//! // List what's installed.
22//! let skills = manager.list(&ListRequest::default())?;
23//!
24//! # Ok::<(), agents_skills::Error>(())
25//! ```
26//!
27//! # Layering
28//!
29//! The crate root exposes only the high-level [`Manager`] facade, its request/outcome
30//! types, the few data types the outcomes carry ([`Env`], [`Source`], [`Skill`]), and
31//! the unified [`error`] types. All domain logic (source parsing, agent directories,
32//! SKILL.md discovery, install, agent links, lock) lives in the private `core` module —
33//! an implementation detail that may change without a breaking release.
34
35#![warn(missing_docs)]
36#![warn(rustdoc::broken_intra_doc_links)]
37
38mod core;
39pub mod error;
40pub mod manager;
41
42// High-level facade.
43pub use manager::{
44    AddOutcome, AddRequest, AgentLinkResult, AgentOutcome, AgentRequest, AgentStatus, BackupStatus,
45    DisableOutcome, DisableRequest, EnableOutcome, EnableRequest, InstallFailure, InstallSuccess,
46    ListRequest, ListedSkill, Manager, ManagerBuilder, RemoveOutcome, RemoveRequest, Scope,
47    UpdateOutcome, UpdateRequest,
48};
49
50// Data types carried by the facade's outcomes (implementation lives in the private core).
51pub use core::agents::Env;
52pub use core::discover::Skill;
53pub use core::link::LinkOutcome;
54pub use core::source::{Source, SourceType};
55
56// Errors.
57pub use error::{Error, Result, SkillsError};
58
59/// Every known agent identifier, in table order (useful for rendering choices).
60pub fn agent_names() -> Vec<&'static str> {
61    core::agents::AGENTS
62        .iter()
63        .map(|a| a.name.as_str())
64        .collect()
65}