Repository navigation
Releases: mostafasudo/worktree-compose
Releases · mostafasudo/worktree-compose
Release list
worktree-compose 1.0.0
The first stable release: worktree stacks keep a stable identity, cleanup no longer touches what it doesn't own, every command runs without a shell, and Podman is supported.
Thanks to @DarellYuhu for monorepo env targeting (#10), to @KennyCandra for the original COMPOSE_PROJECT_NAME proposal (#3), to @kevmtt for reporting #7, and to @geniuskamo for reporting #9.
Upgrading from 0.2
- Node.js 20 or newer is required (was 18).
- Install globally and type
wtc. An unrelated npm package is namedwtc, sonpx wtcwithout a global install runs that package. Usenpm install -g worktree-compose, ornpx worktree-compose <command>for a one-off. Update MCP configs to{"command": "wtc", "args": ["mcp"]}(or{"command": "npx", "args": ["-y", "worktree-compose", "mcp"]}). - Indices are stable. On the first run, existing worktrees get the same positional indices 0.2 used, and a worktree whose 0.2 stack is running adopts that stack's index and project, so running stacks are picked up, not duplicated. After that an index never changes: removing a worktree no longer renumbers the ones after it, and a new worktree takes the lowest free index. Identities are stored in
.git/wtc/state.json. - Deleted worktrees become orphans. A worktree removed with
git worktree removeorrm -rfshows inwtc listas(removed), and its index stays reserved untilwtc prune(orwtc clean) tears its stack down. wtc stopkeeps containers. It runscompose stopinstead ofcompose down: containers and all volumes are kept,wtc startresumes them, andwtc listshows them asexited.restartis nowcompose stopfollowed bystartwith--remove-orphans.wtc cleankeeps worktrees that hold work. Worktrees with uncommitted changes (other than files wtc wrote), commits on a detached HEAD that nothing else reaches, unpushed submodule commits, or a lock are kept unless you pass--force; the main checkout and the current worktree are never removed. Kept worktrees' stacks are still torn down withdown -v(their volumes are deleted).wtc cleanonly removes stacks it owns. It no longer removes every container named*-wt-*; leftovers are swept only for stacks this checkout owns, one at a time. Same-named stacks of other checkouts are listed, never removed. Stale 0.2 leftovers whose worktree directory is gone:wtc clean --sweep(stacks that still have containers; leftover volumes with no container — e.g. after 0.2'swtc stop, which kept named volumes — are listed for you to remove withdocker volume rm).- Env keys are rewritten in place. A key that already exists in the env file (e.g.
POSTGRES_PORT) is rewritten where it is instead of being repeated in the wtc block, and the root env file now getsCOMPOSE_PROJECT_NAME.${VAR}placeholders in overrides are replaced everywhere in a value, not just the first time. wtc promoteis stricter. It aborts when the target branch committed changes to the same files since the worktree branched (promoting would revert them;--forceoverrides), and untracked files in the target now count as conflicts.- MCP
wtc_listoutput.content[0]is still a pure JSON array (the same aswtc list --json); rows gainrunning,total,url,orphan, andunavailable,statuscan beup,partial,exited,down, or?, orphan rows are included, and warnings come as separate content items. - MCP selectors.
indicesandwtc_promote'sindexaccept strings (branch, directory name, path,.) as well as numbers. - Exit codes.
stop,clean, andpruneexit 1 when a stack or removal fails; MCP tools returnisError: true. - Agent skill. Install it with
wtc skill --installinstead of symlinkingSKILL.md.
Added
- Stable worktree identity: each worktree's index and compose project are recorded at first sight in
.git/wtc/state.json(locked, atomic writes) and survive branch renames andgit worktree move(an id is kept in the worktree's git admin dir). 0.2 stacks are adopted by position or by the directory compose ran in (#9). - Orphan tracking:
(removed)rows inwtc list, reserved indices, andwtc prune [--dry-run]/ MCPwtc_pruneto tear orphaned stacks down. A worktree git still lists is never an orphan: a locked worktree whose directory is missing (an unmounted drive) keeps its index, record, and stack, shown as(locked, missing on disk). - Worktree selectors for
start,stop,restart,promote, and the MCP tools: index, branch, directory name, path, or.(the worktree you are in), with ambiguity errors. COMPOSE_PROJECT_NAMEwritten into each worktree's root env file, so plaindocker composein the worktree (with the default.env) reaches the same stack;${COMPOSE_PROJECT_NAME}interpolation inenvOverridesandworkspaceEnvOverrides(#2; original proposal by @KennyCandra in #3).- Podman support and compose engine detection:
docker compose→podman compose→docker-compose→podman-compose, preferring an engine whose daemon answers. Override with theWTC_COMPOSE_COMMANDenvironment variable or thecomposeCommandconfig key. OrbStack and Colima work through thedockerCLI; global flags such as--contextare honored by status checks and cleanup too (#1). - Monorepo env targeting:
envFile/--env,workspaces/--workspace, andworkspaceEnvOverrides; allocated ports exported into the compose process environment; existing env keys rewritten in place. By @DarellYuhu in #10. wtc doctor [--json]and MCPwtc_doctor: git, repository layout, compose file, config, engine and daemon, port isolation, isolation-breaking settings, collisions, missing worktrees, orphans, and allocated ports already in use.- Isolation warnings for
container_name, and for volumes and networks with a fixedname:orexternal: true. wtc list --json, withrunning/totalcounts andpartialandexitedstates.wtc start/wtc restart--no-build(MCPbuild: false).wtc clean --dry-run,--force,--keep-worktrees, and--sweep(MCPdryRun,force,keepWorktrees,sweep).wtc promote --force(MCPforce).wtc skill [--install] [--dir <path>];SKILL.mdnow ships in the package.wtc.schema.jsonfor.wtcrc.jsoneditor completion:"$schema": "https://unpkg.com/worktree-compose/wtc.schema.json".- MCP: tool annotations (read-only/destructive;
wtc_listandwtc_doctornever write anything), progress notifications, cancellation that stops the running compose command (a request cancelled while it waits its turn never runs), serialized stack-changing tools, andisErrorresults with compose's error output. - Support for bare repositories with worktrees, submodules, and
--separate-git-dircheckouts. The main checkout is remembered where git can't always name it (a bare repo's default-branch worktree mid-rebase, a--separate-git-dirrepo seen from a linked worktree); when it is unknown,start,restart, andcleanrefuse instead of guessing. - CI on Node.js 20, 22, and 24; releases are published from GitHub Actions with npm trusted publishing.
Changed
- Every command resolves the main checkout, even when run from a linked worktree (where agents and MCP servers usually run): the repo name, and therefore every project name, stays the same, and compose, config, and env files are always read from main.
wtc stoprunscompose stop(containers and volumes are kept);wtc restartrunscompose stop, then start withup -d --remove-orphans, and checks env options and selectors before stopping anything.wtc cleantears stacks down withdown -v --remove-orphans(anonymous volumes included), removes only worktrees without work of their own unless--force, sweeps only resources of stacks it owns, one at a time, and keeps the records (and indices) of worktrees that remain.wtc promotetakes a selector, reads changes with-zand--no-renames(a rename deletes the old path in the target), and checks every path before writing anything.- MCP tools use
registerTool;wtc_listreturns full rows; tool handlers never throw. - Port collision warnings consider the indices actually in use (live worktrees and orphans).
- Errors name the failing command and include the tail of its error output.
stop,clean, andpruneexit 1 when something failed; MCP tools returnisError: true.- Node.js 20 or newer is required (
commander14 needs it). - Docs use
wtc(global install) instead ofnpx wtc; the homepage is now https://www.worktree-compose.com.
Fixed
- Removing a worktree renumbered every worktree after it: their stacks were orphaned and
startcreated new stacks on new ports (#9). wtc clean's unanchored-wt-filter matched other repositories' containers, and one failed removal discarded a whole batch (#9).wtc cleanforce-removed worktrees with uncommitted work.- Running
wtcfrom a linked worktree used that worktree's directory name as the repo name and synced files from it. wtc mcpcould write log lines to stdout, corrupting the...