| name | setup-worktrees |
| description | Prepares the current project for use with claude-squad (cs) git worktrees on Windows. Ensures cs.exe is installed and on PATH, then scans the project for untracked files (env/secrets/local config) that new worktrees would be missing and writes/updates a .worktreeinclude manifest. Triggers on: "set up worktrees", "setup worktrees", "/setup-worktrees", "install claude-squad", "prep this repo for cs".
|
Setup Worktrees
Two independent steps. Do both, in order.
Step 1: Ensure cs.exe is installed
-
Check whether cs is already available:
Get-Command cs -ErrorAction SilentlyContinue
If found, run cs version to confirm it works and skip to Step 2.
-
If not found, download the prebuilt Windows binary (built from
smtg-ai/claude-squad PR #248, which adds Windows support) from this
repo's release:
New-Item -ItemType Directory -Force -Path "$HOME\.local\bin" | Out-Null
Invoke-WebRequest -Uri "https://github.com/rylero/RyansPersonalSkills/releases/download/cs-windows-pr248/cs.exe" -OutFile "$HOME\.local\bin\cs.exe"
-
Ensure $HOME\.local\bin is on the user PATH:
$env:Path -split ';' | Select-String -SimpleMatch "$HOME\.local\bin"
If nothing matches, add it permanently and tell the user to restart their
terminal before cs will resolve:
[Environment]::SetEnvironmentVariable("Path", "$([Environment]::GetEnvironmentVariable('Path','User'));$HOME\.local\bin", "User")
-
Verify: cs version. If the download fails (offline, asset missing),
tell the user and offer the source-build fallback:
git clone https://github.com/smtg-ai/claude-squad.git
cd claude-squad
git fetch origin pull/248/head:pr-248
git checkout pr-248
go build -o cs.exe .
cp cs.exe ~/.local/bin/cs.exe
Step 2: Generate/update .worktreeinclude
.worktreeinclude is a gitignore-syntax manifest, one pattern per line with
# comments, listing files the project needs at runtime that
git worktree add won't bring into a new worktree (because they're untracked).
-
Confirm this is a git repo:
git rev-parse --is-inside-work-tree
If this fails, tell the user this step only applies inside a git repo and stop.
-
List untracked and ignored files to find candidates:
git status --ignored=matching --porcelain
Also read .gitignore for context on what's intentionally excluded.
-
Classify candidates using judgment:
- Include — local config/secrets the app needs to run but that aren't
committed:
.env, .env.local, .env.*.local, appsettings.*.Development.json,
*.local.json, credential files, local SQLite DBs, local certs/keys, etc.
- Exclude — build artifacts, dependency directories, caches:
node_modules/, dist/, build/, .venv/, bin/, obj/, target/,
.next/, __pycache__/, etc. These are regenerable and shouldn't be
copied between worktrees.
-
Present the proposed list of patterns to the user and let them confirm or
edit it before writing anything.
-
Write .worktreeinclude at the project root:
- If the file doesn't exist, create it with the confirmed patterns, each
preceded by a
# comment explaining why it's needed.
- If it already exists, merge: keep all existing lines as-is, append new
confirmed patterns (with comments) that aren't already present, dedupe
exact matches.
Example:
# Local environment variables, not committed
.env
.env.local
# Per-developer database, needed for app to start
local.db