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§
Sourcefn supports(&self, entity_type: &str) -> bool
fn supports(&self, entity_type: &str) -> bool
Whether this platform supports the given entity type (e.g. "skill", "agent").
Sourcefn target_dir(
&self,
entity_type: &str,
scope: Scope,
repo_root: &Path,
) -> PathBuf
fn target_dir( &self, entity_type: &str, scope: Scope, repo_root: &Path, ) -> PathBuf
Resolve the absolute target directory for an entity type + scope.
Sourcefn dir_mode(&self, entity_type: &str) -> Option<DirInstallMode>
fn dir_mode(&self, entity_type: &str) -> Option<DirInstallMode>
The install mode for directory entries of this entity type.
Sourcefn deploy_entry(
&self,
entry: &Entry,
source: &Path,
scope: Scope,
repo_root: &Path,
opts: &InstallOptions,
) -> DeployResult
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.