pub trait Target: Send + Sync {
// Required methods
fn name(&self) -> &'static str;
fn global_path(&self) -> Result<PathBuf>;
fn project_path(&self, project_root: &Path) -> PathBuf;
fn sync(&self, path: &Path, canon: &Canon, opts: &SyncOptions) -> Result<()>;
// Provided methods
fn sync_global(&self, canon: &Canon, opts: &SyncOptions) -> Result<()> { ... }
fn sync_project(
&self,
project_root: &Path,
canon: &Canon,
opts: &SyncOptions,
) -> Result<()> { ... }
}Expand description
Trait for MCP configuration sync targets.
Each target (e.g., Antigravity, Claude) implements this trait to provide target-specific file paths and sync logic.
§Example
ⓘ
struct MyTarget;
impl Target for MyTarget {
fn name(&self) -> &'static str { "my-target" }
fn global_path(&self) -> Result<PathBuf> { Ok(home()?.join(".my-config.json")) }
fn project_path(&self, root: &Path) -> PathBuf { root.join(".my-config.json") }
fn sync(&self, path: &Path, canon: &Canon, opts: &SyncOptions) -> Result<()> {
// Implementation
Ok(())
}
}Required Methods§
Sourcefn global_path(&self) -> Result<PathBuf>
fn global_path(&self) -> Result<PathBuf>
Returns the path to the global (user-level) configuration file.
Sourcefn project_path(&self, project_root: &Path) -> PathBuf
fn project_path(&self, project_root: &Path) -> PathBuf
Returns the path to the project-level configuration file.
Provided Methods§
Sourcefn sync_global(&self, canon: &Canon, opts: &SyncOptions) -> Result<()>
fn sync_global(&self, canon: &Canon, opts: &SyncOptions) -> Result<()>
Syncs to the global configuration file.
Sourcefn sync_project(
&self,
project_root: &Path,
canon: &Canon,
opts: &SyncOptions,
) -> Result<()>
fn sync_project( &self, project_root: &Path, canon: &Canon, opts: &SyncOptions, ) -> Result<()>
Syncs to the project configuration file.