WorktreeInitializer 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global WorktreeInitializer --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local WorktreeInitializer --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=WorktreeInitializer&version=1.0.0
                    
nuke :add-package WorktreeInitializer --version 1.0.0
                    

WorktreeInitializer

Tests NuGet Version NuGet Downloads License: MIT

A tool for copying gitignored files from a source repository to a new worktree. Works as both a CLI tool and an MCP (Model Context Protocol) server for AI agents.

When you create a git worktree, gitignored files like .env files, launchSettings.json with secrets, node_modules/, build outputs, and other local configuration are not included. This tool copies all of them over in one command.

Installation

dotnet tool install --global WorktreeInitializer

After installation, the wi command will be available globally.

To update to the latest version:

dotnet tool update --global WorktreeInitializer

To uninstall:

dotnet tool uninstall --global WorktreeInitializer

To register it as an MCP tool in Claude Code:

claude mcp add worktree-init -- wi --mcp

For Cursor or other MCP clients, add this to your MCP configuration:

{
  "mcpServers": {
    "worktree-init": {
      "command": "wi",
      "args": ["--mcp"]
    }
  }
}

Usage

wi init <source-path> <destination-path>    # Copy gitignored files from source to destination
wi help                                      # Show help information

Examples

# Copy gitignored files from your main repo to a new worktree
wi init C:\code\myproject C:\code\myproject-worktree

# Works with paths containing spaces (just quote them)
wi init "/home/user/my project" "/home/user/my project-wt"

# Unix paths work the same way
wi init ~/code/myproject ~/code/myproject-worktree

Behavior

Discovers ignored files using git

Runs git ls-files --others --ignored --exclude-standard in the source directory. This handles all .gitignore complexity: nested .gitignore files, global gitignore, .git/info/exclude, negation patterns, and every other gitignore feature.

Preserves directory structure

Files are copied to the same relative path in the destination. If src/bin/Debug/app.dll is ignored in the source, it will be copied to src/bin/Debug/app.dll in the destination.

Creates directories as needed

If the destination directory structure doesn't exist yet, it is created automatically during the copy.

Overwrites existing files

If a file already exists in the destination, it is overwritten. This makes it safe to re-run wi init if the source files have changed.

Partial failures are reported

If some files fail to copy (e.g. locked by another process), the rest are still copied. The output lists which files failed and why.

Requires git in PATH

Since the tool uses git ls-files to discover ignored files, git must be installed and available in PATH. If you're using git worktrees, you already have git installed.

As MCP Server

wi --mcp

When running as an MCP server, the following tools are available:

  • wi_init(sourcePath, destinationPath) - Copy all gitignored files from source to destination
  • wi_help() - Get help

Development

git clone <repository-url>
cd worktree-initializer
dotnet build WorktreeInitializer.slnx
dotnet test WorktreeInitializer.slnx

To run as MCP server during development:

dotnet run --project WorktreeInitializer.Cli/WorktreeInitializer.Cli.csproj -- --mcp

To package:

dotnet pack WorktreeInitializer.Cli/WorktreeInitializer.Cli.csproj --configuration Release

License

MIT License

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.2.0 90 3/2/2026
1.1.0 83 2/27/2026
1.0.0 84 2/27/2026