Skip to main content

PlatformAdapter

Trait PlatformAdapter 

Source
pub trait PlatformAdapter:
    Send
    + Sync
    + Debug {
    // Required methods
    fn name(&self) -> &str;
    fn supports(&self, entity_type: &str) -> bool;
    fn target_dir(
        &self,
        entity_type: &str,
        scope: Scope,
        repo_root: &Path,
    ) -> PathBuf;
    fn dir_mode(&self, entity_type: &str) -> Option<DirInstallMode>;
    fn deploy_entry(
        &self,
        entry: &Entry,
        source: &Path,
        scope: Scope,
        repo_root: &Path,
        opts: &InstallOptions,
    ) -> DeployResult;
    fn installed_path(
        &self,
        entry: &Entry,
        scope: Scope,
        repo_root: &Path,
    ) -> PathBuf;
    fn installed_dir_files(
        &self,
        entry: &Entry,
        scope: Scope,
        repo_root: &Path,
    ) -> HashMap<String, PathBuf>;
}
Expand description

Contract for deploying skill/agent files to a specific AI tool’s directory.

Each AI tool (Claude Code, Gemini CLI, Codex, etc.) has its own convention for where skills and agents live on disk. A PlatformAdapter encapsulates that knowledge.

The trait is object-safe so adapters can be stored in a heterogeneous registry.

Required Methods§

Source

fn name(&self) -> &str

The adapter identifier (e.g. "claude-code", "gemini-cli").

Source

fn supports(&self, entity_type: &str) -> bool

Whether this platform supports the given entity type (e.g. "skill", "agent").

Source

fn target_dir( &self, entity_type: &str, scope: Scope, repo_root: &Path, ) -> PathBuf

Resolve the absolute target directory for an entity type + scope.

Source

fn dir_mode(&self, entity_type: &str) -> Option<DirInstallMode>

The install mode for directory entries of this entity type.

Source

fn deploy_entry( &self, entry: &Entry, source: &Path, scope: Scope, repo_root: &Path, opts: &InstallOptions, ) -> DeployResult

Deploy a single entry from source to its platform-specific location.

Returns {patch_key: installed_path} for every file that was placed. Returns an empty map for dry-run or when deployment is skipped.

Source

fn installed_path( &self, entry: &Entry, scope: Scope, repo_root: &Path, ) -> PathBuf

The installed path for a single-file entry.

Source

fn installed_dir_files( &self, entry: &Entry, scope: Scope, repo_root: &Path, ) -> HashMap<String, PathBuf>

Map of {relative_path: absolute_path} for all installed files of a directory entry.

Implementors§