Skip to main content

run_sync

Function run_sync 

Source
pub fn run_sync(
    base_dir: Option<&Path>,
    worktrees: bool,
    format: OutputFormat,
) -> Result<String>
Expand description

Syncs Claude skills and returns the report as a formatted string.

Non-interactive wrapper around the sync subcommand suitable for MCP callers. Source defaults to base_dir (or the current working directory when base_dir is None); target defaults to the source repository. When worktrees is true, every worktree belonging to the target repository is synced in addition to the target itself.

The operation mutates the filesystem: creates symlinks inside .claude/skills/ and upserts a managed block inside .git/info/exclude. Always performed as a real (not dry) run — dry-run mode is a CLI convenience, not useful through MCP.

base_dir exists so callers can pass an explicit directory instead of mutating the process-wide cwd. Production MCP callers pass None.