/workspaces:delete <workspace-name>from workspaces
Deletes a workspace directory and its git worktrees, checking for uncommitted changes or unpushed commits before removal.
Ships in workspaces. Installing the plugin adds it to Claude Code.
workspaces:delete
/workspaces:delete <workspace-name>
The workspaces:delete command removes a workspace directory and its associated git worktrees. Before deletion, it checks the status of all repositories in the workspace to detect uncommitted changes or unpushed commits, prompting the user for confirmation when issues are found.
This command helps clean up task workspaces created by /workspaces:create while ensuring no work is accidentally lost.
- [ ] Step 1: Identify workspace and check configuration
- [ ] Step 2: Execute deletion
Get available workspaces (includes configuration check):
${CLAUDE_PLUGIN_ROOT}/commands/delete/list.sh
If the output contains STATUS: NOT_CONFIGURED:
Use AskUserQuestion to ask the user for:
/home/user/git-repos or ~/work/repos)/home/user/workspaces or ~/dev/workspaces)Run list again with the user's paths:
${CLAUDE_PLUGIN_ROOT}/commands/delete/list.sh --repos-root <REPOS_PATH> --workspaces-root <WORKSPACES_PATH>
Verify the output shows CONFIGURATION SAVED before proceeding to Step 2
Read configured paths: From the output, note the === CONFIG === section values:
REPOS_ROOT — use this path when doing any direct git operations on reposWORKSPACES_ROOT — use this path when referencing workspace locationsMatch user's input against the workspace list:
Use the workspace NAME (not full path) from Step 1.
Example: If the workspace is at /home/user/workspaces/feature-azure-template-field, use feature-azure-template-field (not the full path).
Execute the deletion script:
${CLAUDE_PLUGIN_ROOT}/commands/delete/execute.sh {WORKSPACE_NAME}
The script will:
Case A: Exit code 0 (success)
The workspace was clean and has been deleted successfully. Report completion to user.
Case B: Exit code 2 (user input required)
The workspace has uncommitted changes or unpushed commits. The status has already been displayed to the user.
Use AskUserQuestion with these options:
Then execute based on user's choice:
If user chose "Keep branches":
${CLAUDE_PLUGIN_ROOT}/commands/delete/execute.sh {WORKSPACE_NAME} --keep-branches
If user chose "Delete branches":
${CLAUDE_PLUGIN_ROOT}/commands/delete/execute.sh {WORKSPACE_NAME} --delete-branches
If user chose "Abort":
Case C: Exit code 1 (error)
An error occurred (e.g., workspace not found, configuration issue). Report the error to the user.
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub openshift-eng/ai-helpers --plugin workspaces2 commands in this plugin
Other plugins' commands for the same job