<CONTEXT>
Deletes a branch locally and remotely with confirmation prompt and optional force cleanup.
/plugin marketplace add fractary/claude-plugins/plugin install fractary-repo@fractary<CRITICAL_RULES> YOU MUST:
git branch --show-current--location both (local AND remote) unless user specifies otherwiseYOU MUST NOT:
THIS COMMAND IS ONLY A ROUTER. </CRITICAL_RULES>
<WORKFLOW> 1. **Detect current branch if needed** - If no branch_name argument provided, run `git branch --show-current` to get current branch - If current branch is main/master, warn user and require explicit branch nameParse user input
Show confirmation and ask user to proceed
šļø Branch Delete Confirmation
āāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Branch: {branch_name}
Location: {location} (local and remote / local only / remote only)
Force: {yes/no}
Proceed with deletion? (yes/no)
Build structured request
Invoke agent
Return response
<ARGUMENT_SYNTAX>
This command follows the space-separated argument syntax (consistent with work/repo plugin family):
--flag value (NOT --flag=value)--location both ā
--force ā
(NOT --force true)# Deletes current branch from both local and remote (with confirmation)
ā
/repo:branch-delete
Always use quotes for multi-word values:
ā
/repo:branch-delete "feature/old branch name"
ā /repo:branch-delete feature/old branch name
Single-word values don't require quotes:
ā
/repo:branch-delete feature/123-old-feature
ā
/repo:branch-delete --location local
ā
/repo:branch-delete feature/abandoned --force
</ARGUMENT_SYNTAX>
<ARGUMENT_PARSING>
Optional Arguments:
branch_name (string): Full branch name to delete. If omitted, defaults to current branch (detected via git branch --show-current). Use quotes if contains spaces.--location (enum): Where to delete the branch. Must be one of: local, remote, both (default: both)--force (boolean flag): Force delete unmerged branch. No value needed, just include the flag--worktree-cleanup (boolean flag): Automatically clean up worktree for deleted branch. No value needed, just include the flag. If not provided and worktree exists, user will be promptedDefault Behavior:
Maps to: delete-branch
Example:
/repo:branch-delete
ā Detects current branch, shows confirmation, then invokes agent with {"operation": "delete-branch", "parameters": {"branch_name": "<current-branch>", "location": "both"}}
/repo:branch-delete feature/123-add-csv-export
ā Invoke agent with {"operation": "delete-branch", "parameters": {"branch_name": "feature/123-add-csv-export", "location": "both"}}
/repo:branch-delete --location local
ā Detects current branch, deletes local only
</ARGUMENT_PARSING>
<EXAMPLES> ## Usage Examples# Delete current branch (local + remote) - will prompt for confirmation
/repo:branch-delete
# Delete specific branch (local + remote) - will prompt for confirmation
/repo:branch-delete feature/123-add-csv-export
# Delete current branch, local only
/repo:branch-delete --location local
# Delete specific branch, remote only
/repo:branch-delete feature/old-feature --location remote
# Force delete unmerged branch
/repo:branch-delete feature/abandoned --force
# Delete with worktree cleanup
/repo:branch-delete feature/123 --worktree-cleanup
</EXAMPLES>
<AGENT_INVOCATION>
CRITICAL: After parsing arguments, you MUST actually invoke the Task tool. Do NOT just describe what should be done.
How to invoke: Use the Task tool with these parameters:
Example Task tool invocation:
Task(
subagent_type="fractary-repo:repo-manager",
description="Delete branch feature/123-add-csv-export",
prompt='{
"operation": "delete-branch",
"parameters": {
"branch_name": "feature/123-add-csv-export",
"location": "both",
"force": true,
"worktree_cleanup": false
}
}'
)
DO NOT:
<ERROR_HANDLING> Common errors to handle:
Cannot delete main/master branch:
ā ļø Cannot delete protected branch: main
You are currently on the main branch. Please switch to a different branch first,
or specify an explicit branch name to delete.
Cannot detect current branch (detached HEAD):
ā ļø Cannot detect current branch (detached HEAD state)
Please specify a branch name explicitly:
/repo:branch-delete <branch_name>
User cancels confirmation:
ā Branch deletion cancelled.
Branch not found:
Error: Branch not found: feature/nonexistent
List branches: /repo:branch-list
Unmerged branch (without --force):
Error: Branch has unmerged changes: feature/123-wip
Use --force to delete anyway, or merge the changes first
</ERROR_HANDLING>
<NOTES> ## Safety Considerations--force carefully - it will delete branches with unmerged changes--location local if you only want to delete the local copyThis command works with:
Platform is configured via /repo:init and stored in .fractary/plugins/repo/config.json.
Related commands:
/repo:branch-create - Create branches/repo:branch-list - List branches/repo:cleanup - Clean up multiple stale branches/repo:init - Configure repo plugin
</NOTES>