worktrunk-cleanup provides wt cleanup, a forge-independent Worktrunk
extension for removing clean worktrees whose changes are integrated into the
repository's default branch.
Install the extension:
go install github.com/stuft2/worktrunk-cleanup/cmd/wt-cleanup@latestEnsure your Go bin directory is on PATH. Worktrunk discovers the installed
wt-cleanup executable and exposes it as wt cleanup.
wt cleanup # fetch and preview integrated worktrees
wt cleanup --yes # remove matching worktrees and local branchesCleanup mirrors Worktrunk's safe removal controls:
wt cleanup --no-delete-branch # keep local branches
wt cleanup --reap # stop non-interactive worktree processes
wt cleanup --no-hooks # skip removal hooks
wt cleanup --format=json # emit machine-readable resultsThe command recognizes regular, rebased, and squash merges through Worktrunk's native integration checks. It skips primary, current, locked, detached, dirty, and unmerged worktrees.
go build ./cmd/wt-cleanupReleases are published automatically after the checks pass on main. Pull
request titles must follow Conventional Commits. feat changes create minor
releases, fix changes create patch releases, and breaking changes are marked
with ! or a BREAKING CHANGE footer. During initial development, breaking
changes also create minor releases.
Changes such as docs, test, and ci do not publish a release on their own.
Each release creates a semantic version tag and generated GitHub release notes.
Install a released version with go install and its Git tag, for example:
go install github.com/stuft2/worktrunk-cleanup/cmd/wt-cleanup@v0.1.0The extension is a single, standard-library-only Go command. It fetches the
default branch reported by wt list --format=json, asks Worktrunk which clean
worktrees are integrated, and delegates each confirmed removal to wt remove
so repository hooks and Worktrunk safety checks still apply.
External runtime dependencies are Git and Worktrunk. No forge CLI or API is required.
go test ./...
go vet ./...