SuperClaude/scripts/cleanup.sh

101 lines
3.7 KiB
Bash
Raw Normal View History

Enhance project cleanup and update gitignore for PyPI publishing ## Enhanced .gitignore - Add PyPI publishing exclusions (*.whl, *.tar.gz, twine.log, .twine/) - Improve security exclusions (.pypirc for API tokens) - Add comprehensive development tool exclusions (.mypy_cache/, .ruff_cache/, etc.) - Expand build artifact exclusions (additional package formats) - Add IDE-specific exclusions for better development experience - Include publishing and release directory exclusions ## Version Consistency - Update VERSION file to proper PyPI format (4.0.0b1) - Maintain consistency across all version references ## Project Cleanup - Remove Python cache directories (__pycache__) - Remove egg-info directories (SuperClaude.egg-info) - Remove temporary setup completion files - Clean development artifacts for distribution readiness ## New Maintenance Tool - Add scripts/cleanup.sh: Comprehensive cleanup script for: - Python cache files and compiled bytecode - Build artifacts (dist/, build/, *.egg-info) - Test artifacts (.pytest_cache/, coverage files) - Development tool cache (.mypy_cache/, .ruff_cache/) - Temporary and backup files - PyPI publishing artifacts - OS-specific files (.DS_Store, Thumbs.db) ## Security Enhancements - Exclude .pypirc from version control (contains API tokens) - Ensure sensitive files are properly ignored - Remove temporary setup files from repository This ensures a clean, secure, and professionally organized repository ready for PyPI publication with comprehensive development tool support and proper artifact management. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-15 15:20:35 +02:00
#!/bin/bash
# SuperClaude Project Cleanup Script
# Removes build artifacts, cache files, and temporary files
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Get script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
echo -e "${BLUE}🧹 SuperClaude Project Cleanup${NC}"
echo -e "📁 Project root: $PROJECT_ROOT"
cd "$PROJECT_ROOT"
# Function to safely remove files/directories
safe_remove() {
local target="$1"
local description="$2"
if [ -e "$target" ]; then
rm -rf "$target"
echo -e "${GREEN}✅ Removed $description${NC}"
else
echo -e "${YELLOW} $description not found (already clean)${NC}"
fi
}
echo -e "\n${YELLOW}🗑️ Removing Python cache files...${NC}"
find . -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
find . -name "*.pyc" -type f -delete 2>/dev/null || true
find . -name "*.pyo" -type f -delete 2>/dev/null || true
find . -name "*.pyd" -type f -delete 2>/dev/null || true
echo -e "${GREEN}✅ Python cache files cleaned${NC}"
echo -e "\n${YELLOW}📦 Removing build artifacts...${NC}"
safe_remove "build/" "Build directory"
safe_remove "dist/" "Distribution directory"
safe_remove "*.egg-info" "Egg-info directories"
safe_remove ".eggs/" "Eggs directory"
safe_remove "wheels/" "Wheels directory"
safe_remove "pip-wheel-metadata/" "Pip wheel metadata"
echo -e "\n${YELLOW}🧪 Removing test artifacts...${NC}"
safe_remove ".pytest_cache/" "Pytest cache"
safe_remove ".tox/" "Tox directory"
safe_remove ".nox/" "Nox directory"
safe_remove "htmlcov/" "HTML coverage reports"
safe_remove ".coverage" "Coverage data file"
safe_remove "coverage.xml" "Coverage XML report"
safe_remove ".hypothesis/" "Hypothesis directory"
echo -e "\n${YELLOW}🔧 Removing development tool cache...${NC}"
safe_remove ".mypy_cache/" "MyPy cache"
safe_remove ".ruff_cache/" "Ruff cache"
safe_remove ".black/" "Black cache"
echo -e "\n${YELLOW}🗄️ Removing temporary files...${NC}"
find . -name "*.tmp" -type f -delete 2>/dev/null || true
find . -name "*.temp" -type f -delete 2>/dev/null || true
find . -name "*~" -type f -delete 2>/dev/null || true
find . -name "*.bak" -type f -delete 2>/dev/null || true
find . -name "*.backup" -type f -delete 2>/dev/null || true
echo -e "${GREEN}✅ Temporary files cleaned${NC}"
echo -e "\n${YELLOW}📋 Removing PyPI publishing artifacts...${NC}"
safe_remove "twine.log" "Twine log file"
safe_remove ".twine/" "Twine directory"
safe_remove "PYPI_SETUP_COMPLETE.md" "Setup completion file"
echo -e "\n${YELLOW}🧽 Removing OS-specific files...${NC}"
find . -name ".DS_Store" -type f -delete 2>/dev/null || true
find . -name "._*" -type f -delete 2>/dev/null || true
find . -name "Thumbs.db" -type f -delete 2>/dev/null || true
find . -name "Desktop.ini" -type f -delete 2>/dev/null || true
echo -e "${GREEN}✅ OS-specific files cleaned${NC}"
echo -e "\n${GREEN}🎉 Cleanup completed successfully!${NC}"
echo -e "${BLUE}📊 Project is clean and ready for development or publishing${NC}"
# Show summary
echo -e "\n${BLUE}📈 Summary:${NC}"
echo -e " • Python cache files: Removed"
echo -e " • Build artifacts: Cleaned"
echo -e " • Test artifacts: Removed"
echo -e " • Development tool cache: Cleared"
echo -e " • Temporary files: Deleted"
echo -e " • PyPI artifacts: Cleaned"
echo -e " • OS-specific files: Removed"
echo -e "\n${YELLOW}💡 Next steps:${NC}"
echo -e " • Run validation: ${BLUE}python3 scripts/validate_pypi_ready.py${NC}"
echo -e " • Test build: ${BLUE}./scripts/publish.sh build${NC}"
echo -e " • Check git status: ${BLUE}git status${NC}"