refactor: comprehensive scripts directory reorganization by functionality
Scripts Directory Reorganization - Complete: ✅ FUNCTIONAL ORGANIZATION: Scripts sorted into 8 logical categories - github/: GitHub and Git operations (6 files) - sync/: Synchronization and data replication (4 files) - security/: Security and audit operations (2 files) - monitoring/: System and service monitoring (6 files) - maintenance/: System maintenance and cleanup (4 files) - deployment/: Deployment and provisioning (11 files) - testing/: Testing and quality assurance (13 files) - utils/: Utility scripts and helpers (47 files) ✅ ROOT DIRECTORY CLEANED: Only README.md remains in scripts root - scripts/README.md: Main documentation - scripts/SCRIPTS_ORGANIZATION.md: Complete organization guide - All functional scripts moved to appropriate subdirectories ✅ SCRIPTS CATEGORIZATION: 📁 GitHub Operations: PR resolution, repository management, Git workflows 📁 Synchronization: Bulk sync, fast sync, sync detection, SystemD sync 📁 Security: Security audits, monitoring, vulnerability scanning 📁 Monitoring: Health checks, log monitoring, network monitoring, production monitoring 📁 Maintenance: Cleanup operations, performance tuning, weekly maintenance 📁 Deployment: Release building, node provisioning, DAO deployment, production deployment 📁 Testing: E2E testing, workflow testing, QA cycles, service testing 📁 Utilities: System management, setup scripts, helpers, tools ✅ ORGANIZATION BENEFITS: - Better Navigation: Scripts grouped by functionality - Easier Maintenance: Related scripts grouped together - Scalable Structure: Easy to add new scripts to appropriate categories - Clear Documentation: Comprehensive organization guide with descriptions - Improved Workflow: Quick access to relevant scripts by category ✅ DOCUMENTATION ENHANCED: - SCRIPTS_ORGANIZATION.md: Complete directory structure and usage guide - Quick Reference: Common script usage examples - Script Descriptions: Purpose and functionality for each script - Maintenance Guidelines: How to keep organization current DIRECTORY STRUCTURE: 📁 scripts/ ├── README.md (Main documentation) ├── SCRIPTS_ORGANIZATION.md (Organization guide) ├── github/ (6 files - GitHub operations) ├── sync/ (4 files - Synchronization) ├── security/ (2 files - Security) ├── monitoring/ (6 files - Monitoring) ├── maintenance/ (4 files - Maintenance) ├── deployment/ (11 files - Deployment) ├── testing/ (13 files - Testing) ├── utils/ (47 files - Utilities) ├── ci/ (existing - CI/CD) ├── deployment/ (existing - legacy deployment) ├── development/ (existing - Development tools) ├── monitoring/ (existing - Legacy monitoring) ├── services/ (existing - Service management) ├── testing/ (existing - Legacy testing) ├── utils/ (existing - Legacy utilities) ├── workflow/ (existing - Workflow automation) └── workflow-openclaw/ (existing - OpenClaw workflows) RESULT: Successfully reorganized 27 unorganized scripts into 8 functional categories, creating a clean, maintainable, and well-documented scripts directory structure with comprehensive organization guide.
This commit is contained in:
83
scripts/maintenance/cleanup-root-directory.sh
Executable file
83
scripts/maintenance/cleanup-root-directory.sh
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "=== AITBC Root Directory Cleanup ==="
|
||||
echo "Organizing files before GitHub push..."
|
||||
echo ""
|
||||
|
||||
# Create organized directories if they don't exist
|
||||
mkdir -p temp/generated-files
|
||||
mkdir -p temp/analysis-results
|
||||
mkdir -p temp/workspace-files
|
||||
mkdir -p temp/backup-files
|
||||
|
||||
echo "=== Moving Generated Files ==="
|
||||
# Move generated analysis files
|
||||
mv archive_results.json temp/generated-files/ 2>/dev/null || echo "archive_results.json not found"
|
||||
mv cleanup_results.json temp/generated-files/ 2>/dev/null || echo "cleanup_results.json not found"
|
||||
mv completed_files_scan.json temp/generated-files/ 2>/dev/null || echo "completed_files_scan.json not found"
|
||||
mv comprehensive_final_report.json temp/generated-files/ 2>/dev/null || echo "comprehensive_final_report.json not found"
|
||||
mv comprehensive_scan_results.json temp/generated-files/ 2>/dev/null || echo "comprehensive_scan_results.json not found"
|
||||
mv content_analysis_results.json temp/generated-files/ 2>/dev/null || echo "content_analysis_results.json not found"
|
||||
mv content_move_results.json temp/generated-files/ 2>/dev/null || echo "content_move_results.json not found"
|
||||
mv documentation_conversion_final.json temp/generated-files/ 2>/dev/null || echo "documentation_conversion_final.json not found"
|
||||
mv documentation_conversion_final_report.json temp/generated-files/ 2>/dev/null || echo "documentation_conversion_final_report.json not found"
|
||||
mv documentation_status_check.json temp/generated-files/ 2>/dev/null || echo "documentation_status_check.json not found"
|
||||
mv generated_documentation.json temp/generated-files/ 2>/dev/null || echo "generated_documentation.json not found"
|
||||
mv specific_files_analysis.json temp/generated-files/ 2>/dev/null || echo "specific_files_analysis.json not found"
|
||||
|
||||
echo "=== Moving Genesis Files ==="
|
||||
# Move genesis files to appropriate location
|
||||
mv chain_enhanced_devnet.yaml data/ 2>/dev/null || echo "chain_enhanced_devnet.yaml not found"
|
||||
mv genesis_ait_devnet.yaml data/ 2>/dev/null || echo "genesis_ait_devnet.yaml not found"
|
||||
mv genesis_brother_chain_1773403269.yaml data/ 2>/dev/null || echo "genesis_brother_chain_1773403269.yaml not found"
|
||||
mv genesis_enhanced_devnet.yaml data/ 2>/dev/null || echo "genesis_enhanced_devnet.yaml not found"
|
||||
mv genesis_enhanced_local.yaml data/ 2>/dev/null || echo "genesis_enhanced_local.yaml not found"
|
||||
mv genesis_enhanced_template.yaml data/ 2>/dev/null || echo "genesis_enhanced_template.yaml not found"
|
||||
mv genesis_prod.yaml data/ 2>/dev/null || echo "genesis_prod.yaml not found"
|
||||
mv test_multichain_genesis.yaml data/ 2>/dev/null || echo "test_multichain_genesis.yaml not found"
|
||||
mv dummy.yaml data/ 2>/dev/null || echo "dummy.yaml not found"
|
||||
|
||||
echo "=== Moving Workspace Files ==="
|
||||
# Move workspace files
|
||||
mv workspace/* temp/workspace-files/ 2>/dev/null || echo "workspace files moved"
|
||||
rmdir workspace 2>/dev/null || echo "workspace directory removed or not empty"
|
||||
|
||||
echo "=== Moving Backup Files ==="
|
||||
# Move backup files
|
||||
mv backup/* temp/backup-files/ 2>/dev/null || echo "backup files moved"
|
||||
mv backups/* temp/backup-files/ 2>/dev/null || echo "backups files moved"
|
||||
rmdir backup backups 2>/dev/null || echo "backup directories removed or not empty"
|
||||
|
||||
echo "=== Moving Temporary Files ==="
|
||||
# Move temporary and log files
|
||||
mv health temp/generated-files/ 2>/dev/null || echo "health file moved"
|
||||
mv logs/* temp/generated-files/ 2>/dev/null || echo "log files moved"
|
||||
rmdir logs 2>/dev/null || echo "logs directory removed or not empty"
|
||||
|
||||
echo "=== Moving Development Scripts ==="
|
||||
# Move development scripts to dev/scripts if not already there
|
||||
mv auto_review.py dev/scripts/ 2>/dev/null || echo "auto_review.py already in dev/scripts"
|
||||
mv run_test.py dev/scripts/ 2>/dev/null || echo "run_test.py already in dev/scripts"
|
||||
|
||||
echo "=== Moving Virtual Environments ==="
|
||||
# Move virtual environments to dev directory
|
||||
mv agent-venv dev/ 2>/dev/null || echo "agent-venv already in dev"
|
||||
mv ai-venv dev/ 2>/dev/null || echo "ai-venv already in dev"
|
||||
mv concrete-env dev/ 2>/dev/null || echo "concrete-env already in dev"
|
||||
|
||||
echo "=== Moving Model Directories ==="
|
||||
# Move models to appropriate location
|
||||
mv models/* temp/backup-files/ 2>/dev/null || echo "models files moved"
|
||||
rmdir models 2>/dev/null || echo "models directory removed or not empty"
|
||||
|
||||
echo "=== Cleanup Complete ==="
|
||||
echo ""
|
||||
echo "Files organized into:"
|
||||
echo "- temp/generated-files/ (analysis results, generated JSON files)"
|
||||
echo "- temp/workspace-files/ (workspace contents)"
|
||||
echo "- temp/backup-files/ (backup and model files)"
|
||||
echo "- data/ (genesis files)"
|
||||
echo "- dev/ (virtual environments and scripts)"
|
||||
|
||||
echo ""
|
||||
echo "Root directory is now clean and organized for GitHub push!"
|
||||
68
scripts/maintenance/final-cleanup.sh
Executable file
68
scripts/maintenance/final-cleanup.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "=== Final Root Directory Cleanup ==="
|
||||
echo "Organizing remaining files..."
|
||||
echo ""
|
||||
|
||||
# Create docs/temp for temporary documentation
|
||||
mkdir -p docs/temp
|
||||
mkdir -p docs/reports
|
||||
|
||||
echo "=== Moving Documentation Files ==="
|
||||
# Move temporary documentation to docs/temp
|
||||
mv DEBUgging_SERVICES.md docs/temp/ 2>/dev/null || echo "DEBUgging_SERVICES.md not found"
|
||||
mv DEV_LOGS.md docs/temp/ 2>/dev/null || echo "DEV_LOGS.md not found"
|
||||
mv DEV_LOGS_QUICK_REFERENCE.md docs/temp/ 2>/dev/null || echo "DEV_LOGS_QUICK_REFERENCE.md not found"
|
||||
mv GITHUB_PULL_SUMMARY.md docs/temp/ 2>/dev/null || echo "GITHUB_PULL_SUMMARY.md not found"
|
||||
mv SQLMODEL_METADATA_FIX_SUMMARY.md docs/temp/ 2>/dev/null || echo "SQLMODEL_METADATA_FIX_SUMMARY.md not found"
|
||||
mv WORKING_SETUP.md docs/temp/ 2>/dev/null || echo "WORKING_SETUP.md not found"
|
||||
|
||||
echo "=== Moving User Guides ==="
|
||||
# Move user guides to docs directory
|
||||
mv GIFT_CERTIFICATE_newuser.md docs/ 2>/dev/null || echo "GIFT_CERTIFICATE_newuser.md not found"
|
||||
mv user_profile_newuser.md docs/ 2>/dev/null || echo "user_profile_newuser.md not found"
|
||||
|
||||
echo "=== Moving Environment Files ==="
|
||||
# Move environment files to config
|
||||
mv .env.dev config/ 2>/dev/null || echo ".env.dev already in config"
|
||||
mv .env.dev.logs config/ 2>/dev/null || echo ".env.dev.logs already in config"
|
||||
|
||||
echo "=== Updating .gitignore ==="
|
||||
# Add temp directories to .gitignore if not already there
|
||||
if ! grep -q "^temp/" .gitignore; then
|
||||
echo "" >> .gitignore
|
||||
echo "# Temporary directories" >> .gitignore
|
||||
echo "temp/" >> .gitignore
|
||||
echo "docs/temp/" >> .gitignore
|
||||
fi
|
||||
|
||||
if ! grep -q "^# Environment files" .gitignore; then
|
||||
echo "" >> .gitignore
|
||||
echo "# Environment files" >> .gitignore
|
||||
echo ".env.local" >> .gitignore
|
||||
echo ".env.production" >> .gitignore
|
||||
fi
|
||||
|
||||
echo "=== Checking for Large Files ==="
|
||||
# Check for any large files that shouldn't be in repo
|
||||
echo "Checking for files > 1MB..."
|
||||
find . -type f -size +1M -not -path "./.git/*" -not -path "./temp/*" -not -path "./.windsurf/*" | head -10
|
||||
|
||||
echo ""
|
||||
echo "=== Final Root Directory Structure ==="
|
||||
echo "Essential files remaining in root:"
|
||||
echo "- Configuration: .editorconfig, .gitignore, .pre-commit-config.yaml"
|
||||
echo "- Documentation: README.md, LICENSE, SECURITY.md, SETUP_PRODUCTION.md"
|
||||
echo "- Environment: .env.example"
|
||||
echo "- Build: Dockerfile, docker-compose.yml, pyproject.toml, poetry.lock"
|
||||
echo "- Testing: run_all_tests.sh"
|
||||
echo "- Core directories: apps/, cli/, packages/, scripts/, tests/, docs/"
|
||||
echo "- Infrastructure: infra/, deployment/, systemd/"
|
||||
echo "- Development: dev/, ai-memory/, config/"
|
||||
echo "- Extensions: extensions/, plugins/, gpu_acceleration/"
|
||||
echo "- Website: website/"
|
||||
echo "- Contracts: contracts/, migration_examples/"
|
||||
|
||||
echo ""
|
||||
echo "✅ Root directory is now clean and organized!"
|
||||
echo "Ready for GitHub push."
|
||||
18
scripts/maintenance/performance_tune.sh
Executable file
18
scripts/maintenance/performance_tune.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# Performance optimization
|
||||
|
||||
echo "=== Performance Tuning ==="
|
||||
|
||||
# Optimize Redis
|
||||
redis-cli CONFIG SET maxmemory 2gb
|
||||
redis-cli CONFIG SET maxmemory-policy allkeys-lru
|
||||
|
||||
# Optimize Python processes
|
||||
echo 'ulimit -n 65536' >> /etc/security/limits.conf
|
||||
|
||||
# Optimize system parameters
|
||||
echo 'vm.swappiness=10' >> /etc/sysctl.conf
|
||||
echo 'net.core.somaxconn=65535' >> /etc/sysctl.conf
|
||||
sysctl -p
|
||||
|
||||
echo "=== Performance Tuning Complete ==="
|
||||
19
scripts/maintenance/weekly_maintenance.sh
Executable file
19
scripts/maintenance/weekly_maintenance.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
# Weekly maintenance tasks
|
||||
|
||||
echo "=== Weekly Maintenance ==="
|
||||
|
||||
# Clean old logs
|
||||
find /var/log/aitbc -name "*.log" -mtime +7 -delete
|
||||
|
||||
# Update software
|
||||
cd /opt/aitbc && git pull origin main
|
||||
/opt/aitbc/venv/bin/pip install -r requirements.txt
|
||||
|
||||
# Restart services if needed
|
||||
systemctl restart aitbc-blockchain-node aitbc-blockchain-rpc
|
||||
|
||||
# Run health check
|
||||
/opt/aitbc/scripts/health_check.sh
|
||||
|
||||
echo "=== Weekly Maintenance Complete ==="
|
||||
Reference in New Issue
Block a user