Skip to content
Development
Command

/mega-complete

Complete the mega-plan by cleaning up planning files. All features should already be merged via mega-approve. Usage: /plan-cascade:mega-complete

From plugin
plan-cascade
14030 skills30 commands
Install
> /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.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/mega-complete

Context preview

What this command does when you run it.

Complete the mega-plan by cleaning up planning files. All features should already be merged via mega-approve. Usage: /plan-cascade:mega-complete

Command definition

mega-complete.md
description: "Complete the mega-plan by cleaning up planning files. All features should already be merged via mega-approve. Usage: /plan-cascade:mega-complete"

Complete Mega Plan

Complete the mega-plan by cleaning up remaining planning files.

**Note**: In the new batch-by-batch execution model, code merging happens automatically when each batch completes (via `mega-approve`). This command only performs final cleanup.

Path Storage Modes

This command works with both new and legacy path storage modes:

New Mode (Default)

Cleanup removes files from user data directory:

  • `~/.plan-cascade/<project-id>/mega-plan.json`
  • `~/.plan-cascade/<project-id>/.state/.mega-status.json`
  • `~/.plan-cascade/<project-id>/.worktree/` (remaining worktrees)
  • `<project-root>/mega-findings.md` (user-visible file in project root)

Legacy Mode

Cleanup removes files from project root:

  • `<project-root>/mega-plan.json`
  • `<project-root>/.mega-status.json`
  • `<project-root>/.worktree/`
  • `<project-root>/mega-findings.md`

The command auto-detects which mode is active.

Step 1: Verify Mega Plan Exists

# Get mega-plan path from PathResolver
MEGA_PLAN_PATH=$(uv run python -c "from plan_cascade.state.path_resolver import PathResolver; from pathlib import Path; print(PathResolver(Path.cwd()).get_mega_plan_path())" 2>/dev/null || echo "mega-plan.json")

if [ ! -f "$MEGA_PLAN_PATH" ]; then
    echo "No mega-plan.json found at: $MEGA_PLAN_PATH"
    echo "Nothing to complete."
    exit 0
fi

Step 2: Check Completion Status

Read `.mega-status.json` and `mega-plan.json` to verify: 1. All batches have been completed 2. All features have been merged

If any batches are still pending:

============================================================
CANNOT COMPLETE - BATCHES PENDING
============================================================

The following batches have not been completed:

  Batch 2:
    [ ] feature-003: Shopping Cart
    [ ] feature-004: Order Processing

Complete remaining batches first:
  /plan-cascade:mega-approve

Then run this command again.
============================================================

Exit without changes.

Step 3: Verify Current Branch

# Check we're on the target branch
TARGET_BRANCH=$(read from mega-plan.json)
CURRENT_BRANCH=$(git branch --show-current)

if [ "$CURRENT_BRANCH" != "$TARGET_BRANCH" ]; then
    echo "Warning: Not on target branch ($TARGET_BRANCH)"
    echo "Currently on: $CURRENT_BRANCH"
fi

Step 4: Show Completion Summary

============================================================
MEGA PLAN COMPLETION
============================================================

All features have been merged!

Target Branch: <target_branch>

Completed Features:
  Batch 1:
    [X] feature-001: User Authentication
    [X] feature-002: Product Catalog

  Batch 2:
    [X] feature-003: Shopping Cart
    [X] feature-004: Order Processing

Total: 4 features merged

Remaining cleanup:
  - Remove mega-plan.json
  - Remove mega-findings.md
  - Remove .mega-status.json
  - Prune any remaining worktrees

============================================================

Step 5: Confirm Cleanup

Use AskUserQuestion:

**Proceed with cleanup?**

Options: 1. **Yes, cleanup** - Remove planning files 2. **Keep files** - Keep planning files for reference 3. **Cancel** - Do nothing

Step 6: Cleanup Planning Files

If user selected "Yes, cleanup":

6.1: Remove Planning Files

# Get file paths from PathResolver (handles new vs legacy mode)
MEGA_PLAN_PATH=$(uv run python -c "from plan_cascade.state.path_resolver import PathResolver; from pathlib import Path; print(PathResolver(Path.cwd()).get_mega_plan_path())" 2>/dev/null || echo "mega-plan.json")
MEGA_STATUS_PATH=$(uv run python -c "from plan_cascade.state.path_resolver import PathResolver; from pathlib import Path; print(PathResolver(Path.cwd()).get_mega_status_path())" 2>/dev/null || echo ".mega-status.json")
MEGA_FINDINGS_PATH=$(uv run python -c "from plan_cascade.state.path_resolver import PathResolver; from pathlib import Path; print(PathResolver(Path.cwd()).get_mega_findings_path())" 2>/dev/null || echo "mega-findings.md")
USER_STATE_DIR=$(uv run python -c "from plan_cascade.state.path_resolver import PathResolver; from pathlib import Path; print(PathResolver(Path.cwd()).get_state_dir())" 2>/dev/null || echo "")

# Remove mega-plan core files
rm -f "$MEGA_PLAN_PATH"
rm -f "$MEGA_FINDINGS_PATH"
rm -f "$MEGA_STATUS_PATH"

echo "[OK] Removed mega-plan.json from: $MEGA_PLAN_PATH"
echo "[OK] Removed mega-findings.md from: $MEGA_FINDINGS_PATH"
echo "[OK] Removed .mega-status.json from: $MEGA_STATUS_PATH"

# Remove additional planning files from project root
echo "Cleaning up additional planning files..."

# Design and spec files
rm -f design_doc.json spec.json spec.md
echo "[OK] Removed design_doc.json, spec.json, spec.md"

# Context recovery files
rm -f .mega-execution-context.md .hybrid-execution-context.md
echo "[OK] Removed context recovery files"

# Status and state files in project root
rm -f .agent-status.json .iteration-state.json .retry-state.json
echo "[OK] Removed status files"

# Agent outputs directory
rm -rf .agent-outputs
echo "[OK] Removed .agent-outputs/"

# Locks directory
rm -rf .locks
echo "[OK] Removed .locks/"

# State directory in project root (legacy mode)
rm -rf .state
echo "[OK] Removed .state/"

# Clean up state files from user data directory (new mode)
if [ -n "$USER_STATE_DIR" ] && [ -d "$USER_STATE_DIR" ]; then
    echo "Cleaning up state files from user data directory..."
    rm -f "$USER_STATE_DIR/.iteration-state.json" 2>/dev/null || true
    rm -f "$USER_STATE_DIR/.agent-status.json" 2>/dev/null || true
    rm -f "$USER_STATE_DIR/.retry-state.json" 2>/dev/null || true
    rm -f "$USER_STATE_DIR/spec-interview.json" 2>/dev/null || true
    # Remove .state directory if empty
    rmdir "$USER_STATE_DIR" 2>/dev/null || true
    echo "[OK] S
Read more
Ships withplan-cascade

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

Get the whole plugin
Stats
141
Stars
12
Forks
Quiet
Maintenance
Rust
Language
MIT
License
6mo ago
Last commit
8mo ago
Created

Repo: Taoidle/plan-cascade

Other commands on plan-cascade.