بنقرة واحدة
cleanup
Safely clean up the current worktree after verifying no unmerged work would be lost
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Safely clean up the current worktree after verifying no unmerged work would be lost
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
List and run agent tasks defined in _module/agent_tasks/ directories across the repo
Build the Meadow Electron app and launch it in test mode to verify it starts cleanly
Run the end-to-end test suite, automatically diagnose and fix failures
Finish a worktree development session - commit, merge to main, and clean up
Understand and extend the regenerable canonical scenario artifact in the e2e report viewer — used for iterating on the viewer's UI against stable, self-documenting data without running real tests
Merge a worktree branch into main - handle conflicts, run full checks, auto-fix issues
| name | cleanup |
| description | Safely clean up the current worktree after verifying no unmerged work would be lost |
Safely remove the current worktree and its branch, but only after verifying that no work would be lost.
Run all of these. If any check fails, tell the user why and stop.
git rev-parse --git-dir and confirm we are inside a worktree (the
git-dir path will contain /worktrees/). If not, stop.git status --porcelain. If there is any output, stop — there are
uncommitted changes.BRANCH=$(git branch --show-current)
WORKTREE_PATH=$(git rev-parse --show-toplevel)
MAIN_REPO=$(git rev-parse --path-format=absolute --git-common-dir | sed 's|/\.git$||')
There are exactly two safe conditions. Check them in order:
git diff main...HEAD --quiet
git rev-list main..HEAD --count # must be 0
If both pass, the branch has no unique work. It is safe to delete.
git rev-list main..HEAD --count # greater than 0 means there are commits
git branch --contains HEAD main # if main appears, all commits are merged
If there are commits but main contains HEAD, everything is already merged. It is safe to delete.
Tell the user:
This branch has commits that are not yet on main. Use
/mergeto merge first, or confirm you want to discard the work.
Do not delete anything. Stop here.
First, capture the worktree name for tmux cleanup:
WORKTREE_NAME=$(basename "$WORKTREE_PATH")
Kill any tmux sessions associated with this worktree:
# Kill the dev server session (format: meadow_dev_<worktree-name>)
tmux kill-session -t "meadow_dev_${WORKTREE_NAME}" 2>/dev/null || true
# Kill any other sessions containing the worktree name
tmux list-sessions -F '#{session_name}' 2>/dev/null | grep "$WORKTREE_NAME" | while read -r sess; do
tmux kill-session -t "$sess" 2>/dev/null || true
done
Navigate out of the worktree, then remove it and the branch:
cd "$MAIN_REPO"
git worktree remove --force "$WORKTREE_PATH"
git branch -D "$BRANCH"
git worktree prune
Print what was cleaned up: