﻿# SOLUTION: Repository Cleanup Plan
Date: 2025-01-15
Target Reduction: 139.44 MB (from 647.46 MB to ~508.02 MB)

## STEP 1: BACKUP (MDP Step 3)
$backupName = "BACKUP_BEFORE_CLEANUP_$(Get-Date -Format 'yyyyMMdd_HHmmss')"
mkdir $backupName
Copy-Item -Path "*" -Destination $backupName -Recurse -Exclude ".git", ".venv", "venv", $backupName, "AUDIT_EVIDENCE"

## STEP 2: COMMIT CURRENT STATE
git add -A
git commit -m "Pre-cleanup commit - saving current state before removing 139MB of redundant files"

## STEP 3: REMOVE DIRECTORIES (Using -WhatIf first for safety)
$targetsToRemove = @("audit", "audit_reports", "backups", "control_tower", "conversion_workspace", "deep_discovery", "discovery_audit", "evidence", "investigation_logs", "migrations_backup_", "performance_optimization", "QC_Evidence", "temp", "ui_rebuild", "ui_rebuild_v2", "ui_rebuild_v3", "ui_rebuild_v4", "ui_rebuild_v5", "ui_rebuild_v6")
foreach ($target in $targetsToRemove) { Remove-Item -Path $target -Recurse -Force -WhatIf }

## STEP 4: REMOVE APP BACKUPS
Remove-Item -Path "app\templates_backup_*" -Recurse -Force
Remove-Item -Path "app\*.backup" -Force

## STEP 5: REMOVE OUTDATED README
Remove-Item -Path "README_Developer_Onboarding.md" -Force

## STEP 6: VERIFY APP STILL WORKS
python -c "from app import create_app; app = create_app(); print('App OK')"
python run.py

## ITEMS EXPLICITLY KEPT
- AUDIT_EVIDENCE/ (37.07 MB - per user directive)
- 3.7 Evidence Archive/ (MDP documentation)
- migrations/ (active migrations)
- All working app code
- Current README.md

## ROLLBACK PROCEDURE
Copy-Item -Path "$backupName\*" -Destination . -Recurse -Force
OR: git reset --hard HEAD~1
