Skip to main content

EcosystemAdapter

Trait EcosystemAdapter 

Source
pub trait EcosystemAdapter: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn detect(&self, worktree_path: &Path) -> bool;
    fn setup(
        &self,
        worktree_path: &Path,
        source_worktree: &Path,
    ) -> Result<(), WorktreeError>;
    fn teardown(&self, worktree_path: &Path) -> Result<(), WorktreeError>;

    // Provided method
    fn branch_name(&self, input: &str) -> String { ... }
}
Expand description

Trait for language/framework-specific setup in new worktrees.

Required Methods§

Source

fn name(&self) -> &str

Name used in state.json and log messages.

Source

fn detect(&self, worktree_path: &Path) -> bool

Return true if this adapter should run for the given worktree path. Called during auto-detection. Inspect package.json, Cargo.toml, etc.

Source

fn setup( &self, worktree_path: &Path, source_worktree: &Path, ) -> Result<(), WorktreeError>

Set up the environment in the new worktree.

source_worktree is the main worktree path (for copying files from).

Source

fn teardown(&self, worktree_path: &Path) -> Result<(), WorktreeError>

Clean up adapter-managed resources when the worktree is deleted.

Provided Methods§

Source

fn branch_name(&self, input: &str) -> String

Optionally transform the branch name before use. Default: identity (no transformation). The core library NEVER calls this internally. Only adapters that opt in use it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§