approve
Approve the current PRD and begin parallel story execution. Analyzes dependencies, creates execution batches, launches background Task agents for each story,…
Complete a worktree task. Verifies all phases are complete, commits code changes (excluding planning files), merges to target branch, and removes worktree. Can be run from any directory. Usage: /plan-cascade:complete [target-branch]
> /plugin marketplace add Taoidle/plan-cascade > /plugin install plan-cascade@plan-cascade
How it fires
How this command gets triggered: by you, by Claude, or both.
/completeContext preview
What this command does when you run it.
Complete a worktree task. Verifies all phases are complete, commits code changes (excluding planning files), merges to target branch, and removes worktree. Can be run from any directory. Usage: /plan-cascade:complete [target-branch]
description: "Complete a worktree task. Verifies all phases are complete, commits code changes (excluding planning files), merges to target branch, and removes worktree. Can be run from any directory. Usage: /plan-cascade:complete [target-branch]"
You are now completing a worktree task. This will: 1. Verify all phases are complete 2. **CRITICAL: Commit code changes (planning files excluded)** 3. Delete planning files from the worktree 4. Navigate to the root directory 5. Merge the task branch to target branch 6. Remove the worktree 7. Delete the task branch
This command works with both new and legacy path storage modes:
The command auto-detects which mode is active based on `.planning-config.json` contents.
Check if we're in a worktree or the root directory:
if [ -f ".planning-config.json" ]; then
# We're in a worktree directory
echo "Currently in worktree directory: $(pwd)"
IN_WORKTREE=true
else
# We're not in a worktree, check if there are any worktrees
IN_WORKTREE=false
# Check for worktrees
WORKTREES=$(git worktree list 2>/dev/null | grep -v "\bare$" | wc -l)
if [ "$WORKTREES" -eq 0 ]; then
echo "ERROR: No worktrees found."
echo "This command requires an existing worktree."
echo ""
echo "Create one first with:"
echo " /plan-cascade:worktree <task-name> <branch>"
exit 1
fi
echo "Not in a worktree directory. Found $WORKTREES worktree(s):"
echo ""
git worktree list
echo ""
# Find all worktrees with .planning-config.json (check both new and legacy locations)
echo "Scanning for planning worktrees..."
WORKTREE_LIST=()
# Get worktree base directory from PathResolver
WORKTREE_BASE=$(uv run python -c "from plan_cascade.state.path_resolver import PathResolver; from pathlib import Path; print(PathResolver(Path.cwd()).get_worktree_dir())" 2>/dev/null || echo ".worktree")
while IFS= read -r line; do
worktree_path=$(echo "$line" | awk '{print $1}')
worktree_branch=$(echo "$line" | awk '{print $2}')
# Check if this is a planning worktree
if [ -f "$worktree_path/.planning-config.json" ]; then
# Exclude hybrid mode worktrees (those use /plan-cascade:hybrid-complete)
mode=$(jq -r '.mode // empty' "$worktree_path/.planning-config.json" 2>/dev/null)
if [ "$mode" != "hybrid" ]; then
task_name=$(jq -r '.task_name // empty' "$worktree_path/.planning-config.json" 2>/dev/null)
WORKTREE_LIST+=("$worktree_path|$task_name|$worktree_branch")
fi
fi
done < <(git worktree list 2>/dev/null | grep -v "\bare$")
if [ ${#WORKTREE_LIST[@]} -eq 0 ]; then
echo "ERROR: No planning worktrees found."
echo "Found worktrees but none are in planning mode."
echo ""
echo "Note: Hybrid mode worktrees should use /plan-cascade:hybrid-complete"
exit 1
fi
echo "Found ${#WORKTREE_LIST[@]} planning worktree(s):"
echo ""
# Display options
for i in "${!WORKTREE_LIST[@]}"; do
IFS='|' read -r path name branch <<< "${WORKTREE_LIST[$i]}"
echo " [$((i+1))] $name"
echo " Path: $path"
echo " Branch: $branch"
echo ""
done
# Ask user to select
echo "Which worktree would you like to complete?"
read -p "Enter number (or 0 to cancel): " selection
if [ "$selection" = "0" ]; then
echo "Cancelled."
exit 0
fi
if [ "$selection" -lt 1 ] || [ "$selection" -gt ${#WORKTREE_LIST[@]} ]; then
echo "Invalid selection."
exit 1
fi
# Get the selected worktree
selected="${WORKTREE_LIST[$((selection-1))]}"
IFS='|' read -r WORKTREE_PATH TASK_NAME TASK_BRANCH <<< "$selected"
echo ""
echo "Selected: $TASK_NAME"
echo "Navigating to worktree: $WORKTREE_PATH"
# Change to worktree directory
cd "$WORKTREE_PATH" || {
echo "ERROR: Failed to navigate to worktree: $WORKTREE_PATH"
exit 1
}
echo "✓ Now in worktree: $(pwd)"
IN_WORKTREE=true
fiRead the planning configuration from `.planning-config.json`:
config=$(cat .planning-config.json) MODE=$(echo "$config" | jq -r '.mode // empty') TASK_NAME=$(echo "$config" | jq -r '.task_name') TASK_BRANCH=$(echo "$config" | jq -r '.task_branch') TARGET_BRANCH=$(echo "$config" | jq -r '.target_branch') WORKTREE_DIR=$(echo "$config" | jq -r '.worktree_dir') ROOT_DIR=$(echo "$config" | jq -r '.root_dir') ORIGINAL_BRANCH=$(echo "$config" | jq -r '.original_branch')
If user provided a target branch argument, use that instead:
OVERRIDE_TARGET="{{args|first arg or empty}}"
TARGET_FINAL="${OVERRIDE_TARGET:-$TARGET_BRANCH}"Check if all phases in task_plan.md are complete:
SCRIPT_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/planning-with-files}/scripts"
if [ -f "$SCRIPT_DIR/check-complete.sh" ]; then
bash "$SCRIPT_DIR/check-complete.sh"
fiIf the check fails (exit code 1), ask the user:
WARNING: Not all phases are marked complete [Show the output from check-complete.sh] Continue anyway? [y/N]:
Wait for user confirmation before proceeding.
**IMPORTANT**: Planning files are NOT included in the commit. We check only actual code changes.
# Define planning files to exclude from commit
PLANNING_FILES=(
"task_plan.md"AI-Powered Cascading Development Framework Transform complex projects into parallel executable tasks with intelligent decomposition and multi-provider execution Why Plan Cascade? • Product Editions • Quick Start • Architecture
Repo: Taoidle/plan-cascade
Approve the current PRD and begin parallel story execution. Analyzes dependencies, creates execution batches, launches background Task agents for each story,…
AI auto strategy executor. Analyzes task and automatically selects and executes the best strategy: direct execution, hybrid-auto PRD generation,…
Check and update .gitignore to exclude Plan Cascade temporary files. Ensures planning files won't be accidentally committed to version control.
Show execution status dashboard. Usage: /plan-cascade:dashboard [--verbose|-v] [--json]
Generate a technical design document. Auto-detects level: project-level from mega-plan.json, or feature-level from prd.json. Provides architectural context for…
Import an external design document (Markdown, JSON, or HTML from Confluence/Notion) and convert it to design_doc.json format for Plan Cascade integration.