feat(git-worktree): add worktree management command and skill - #4
Open
EtienneLescot wants to merge 4 commits into
Open
feat(git-worktree): add worktree management command and skill#4EtienneLescot wants to merge 4 commits into
EtienneLescot wants to merge 4 commits into
Conversation
New community plugin giving parallel ZCode sessions first-class git worktree handling: /git-worktree:worktree dispatches list, create, open, remove, and prune with dirty-state and branch-in-use guardrails. A bundled git-worktrees skill carries the same isolation rules into ad-hoc chat. Addresses zai-org/feedback#132 and #220.
EtienneLescot
requested review from
jacksonliuyn and
panda920
as code owners
September 1, 2026 08:55
Real-world testing showed a bare invocation could be interpreted as a create (the companion skill carries no default-subcommand rule). Make report-only the explicit contract for empty/ambiguous invocations in both the command and the skill, and bump to 0.1.1.
User testing showed the natural mental model: invoking /worktree at the start of a conversation means 'give me isolation'. A bare invocation now runs the create flow with safe defaults (auto-named branch off the default branch, sibling folder, idempotent when the workspace is already a linked worktree) and states plainly that the current conversation stays in its own workspace until the worktree is opened as its own project. list becomes explicit; remove/prune keep their confirmations. Bump to 0.1.2.
Command for the deterministic procedure, @-mention to apply the worktree discipline to a free-form request, and skill auto-trigger as the safety net. Bump to 0.1.3.
Author
|
A note for the maintainers / ZCode team Beyond the plugin itself: if a native worktree experience is on the roadmap (see feedback#132 and feedback#220), I'd be glad to help — with the UX insights that went into shaping this plugin, as a beta tester on Windows, and with code too if a native implementation is ever open to outside contributions. Things that survived contact with real usage and might transfer to a GUI design:
Happy to share more UX notes or test a native implementation whenever it exists. 🤝 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User problem
ZCode Desktop has no worktree notion in its UI, so users who want several conversations working one repository in parallel either collide in the same folder (each
git checkoutrewrites the shared files under the other session) or hand-roll git commands and hitfatal: '<branch>' is already used by worktree at …with no guidance. Tracked in feedback#132 and feedback#220; no existing plugin in the marketplace covers this.What the plugin provides
/git-worktree:worktreewith subcommands:list(default) — table of name / branch / uncommitted file count / path, main worktree markedcreate <name> [base]— sibling-directory worktree + branch; default baseorigin/HEAD→main/master→HEAD; warns before occupying a default branch (it would block every other session wanting it); offers.git/info/excludehandling for in-repo locationsopen <name>— resolves the worktree and prints the exact File → Open Folder pathremove <name>— never the main worktree; summarizes uncommitted changes and requires explicit confirmation before--force; Windows "directory held by another process" guidance; merged-onlygit branch -dafterwardsprune— shows stale entries first (--dry-run --verbose), prunes, then only reports orphan directoriesgit-worktrees— auto-triggers on worktree questions; encodes the three isolation rules (one branch per worktree, one conversation per worktree, keep the default branch free) and translates git's errors into next actions.How it was tested
python scripts/validate.py→OK: 17 plugin(s) validatedpython scripts/build_dist.py→ exit 0;git diff --check→ cleanworktree add -b, porcelain listing shape, clean/dirtystatus --porcelaincounts, dirty-remove refusal message,--forceremoval, merged-branchbranch -d,prune --dry-run --verbose, and reproduction of the exact'feat-x' is already used by worktree at …error the command interprets.Version and marketplace registration
git-worktreev0.1.0, registered inmarketplace.json(categorydeveloper-tools); manifest and marketplacename/version/description_i18nare identical, per validator requirements.README.md+README_CN.md.Dependencies, permissions, side effects
PATH; plain git invocations only, no shell-specific syntax (Windows-safe).worktree add/remove/list/prune,status,diff --stat,branch -d/-D) and directory creation/removal; every destructive step requires explicit user confirmation.Licensing
Original work, no third-party code or assets. Apache-2.0, same license as this repository.