Remove a major version
Removes a major version and all its minor versions and tasks after validation and confirmation.
/plugin marketplace add cowwoc/claude-code-dog/plugin install dog@claude-code-dog[major]Remove an entire major version from the project. This is a significant operation that removes all minor versions and tasks within the major. Validates that no incomplete work exists and confirms with the user.
</objective> <process> <step name="verify">Verify planning structure exists:
[ ! -d .claude/dog ] && echo "ERROR: No planning structure found." && exit 1
[ ! -d .claude/dog/major ] && echo "ERROR: No major versions exist." && exit 1
</step>
<step name="select_version">
Determine major version to remove:
If $ARGUMENTS provided:
If $ARGUMENTS empty:
List all major versions:
# Find all major versions with statistics
for d in .claude/dog/major/*/; do
MAJOR=$(basename "$d")
MINOR_COUNT=$(find "$d/minor" -maxdepth 1 -type d -name "[0-9]*" 2>/dev/null | wc -l)
TASK_COUNT=$(find "$d" -name "STATE.md" -path "*/task/*/STATE.md" 2>/dev/null | wc -l)
STATUS=$(grep "Status:" "$d/STATE.md" 2>/dev/null | sed 's/.*: //' || echo "unknown")
echo "Major $MAJOR: $MINOR_COUNT minor versions, $TASK_COUNT tasks ($STATUS)"
done
Use AskUserQuestion:
If "Cancel" -> exit command.
</step> <step name="validate">Validate major version can be removed:
MAJOR_PATH=".claude/dog/major/$MAJOR"
# Check version exists
[ ! -d "$MAJOR_PATH" ] && echo "ERROR: Major version does not exist" && exit 1
Check for incomplete work:
# Find any tasks that are not completed
INCOMPLETE=$(find "$MAJOR_PATH" -name "STATE.md" -path "*/task/*/STATE.md" \
-exec grep -l "Status: pending\|Status: in-progress" {} \; 2>/dev/null)
If incomplete tasks exist:
ERROR: Cannot remove major version with incomplete work.
Incomplete tasks found:
{list of incomplete tasks}
Options:
1. Complete all tasks first
2. Remove individual minor versions with /dog:remove-minor-version
3. Force removal (see below)
Use AskUserQuestion:
If "Cancel" -> exit command.
</step> <step name="check_dependencies">Check if later major versions depend on this:
# Check if any later major versions reference this one
LATER_MAJORS=$(find .claude/dog/major -name "STATE.md" -path ".claude/dog/major/[$(($MAJOR+1))-9]*/STATE.md" \
-exec grep -l "Dependencies:.*$MAJOR" {} \; 2>/dev/null)
If dependents found:
Use AskUserQuestion:
Gather removal statistics:
MINOR_COUNT=$(find "$MAJOR_PATH/minor" -maxdepth 1 -type d -name "[0-9]*" 2>/dev/null | wc -l)
TASK_COUNT=$(find "$MAJOR_PATH" -name "STATE.md" -path "*/task/*/STATE.md" 2>/dev/null | wc -l)
</step>
<step name="confirm">
Final confirmation (extra serious for major version):
Use AskUserQuestion:
If "No, cancel" -> exit command.
</step> <step name="remove">Remove major version directory:
rm -rf "$MAJOR_PATH"
</step>
<step name="update_roadmap">
Update ROADMAP.md:
Remove the entire section for this major version.
</step> <step name="commit">Commit removal:
git add -A ".claude/dog/"
git commit -m "$(cat <<'EOF'
docs: remove major version {major}
Major version removed by user request.
Removed {minor_count} minor versions and {task_count} tasks.
EOF
)"
</step>
<step name="done">
Present completion:
Major version removed:
- Version: Major {major}
- Minor versions removed: {minor_count}
- Tasks removed: {task_count}
---
Use `/dog:status` to see current state.
**Note:** You can recover this via git if needed:
```bash
git revert HEAD # Undo the removal commit
</step>
</process>
<success_criteria>
- [ ] Major version identified
- [ ] Incomplete work handled (blocked or force-removed)
- [ ] Dependencies checked and warned
- [ ] Statistics gathered for user awareness
- [ ] User confirmation obtained (with extra warning)
- [ ] Major version directory removed
- [ ] ROADMAP.md updated
- [ ] Removal committed to git
- [ ] Recovery instructions provided
</success_criteria>