7.7 KiB
7.7 KiB
Scripts Modularization - Implementation Checklist
Date: 2025-01-27 Total Scripts: 30 Status: Ready to Begin
✅ Phase 1: Script Migration (30 scripts)
Migration Scripts (6 scripts)
migrate-readme.sh→migration/migrate-readme.shmigrate-terraform.sh→migration/migrate-terraform.shmigrate-to-api-gateway.sh→migration/migrate-to-api-gateway.shmigrate-to-k8s.sh→migration/migrate-to-k8s.shmigrate-to-monitoring.sh→migration/migrate-to-monitoring.shmigrate-to-shared-packages.sh→migration/migrate-to-shared-packages.sh
Metrics Scripts (10 scripts)
collect-code-metrics.sh→metrics/collect/collect-code-metrics.shcollect-deployment-metrics.sh→metrics/collect/collect-deployment-metrics.shcollect-developer-metrics.sh→metrics/collect/collect-developer-metrics.shcollect-infrastructure-metrics.sh→metrics/collect/collect-infrastructure-metrics.shcollect-operational-metrics.sh→metrics/collect/collect-operational-metrics.shcollect-service-metrics.sh→metrics/collect/collect-service-metrics.shtrack-all-metrics.sh→metrics/track-all-metrics.shtrack-success-metrics.sh→metrics/track-success-metrics.shupdate-metrics.sh→metrics/update-metrics.shgenerate-metrics-report.sh→metrics/generate-metrics-report.sh
DBIS Scripts (4 scripts)
automate-dbis-migration.sh→dbis/automate-dbis-migration.shmigrate-all-dbis-projects.sh→dbis/migrate-all-dbis-projects.shmigrate-dbis-project.sh→dbis/migrate-dbis-project.shtest-dbis-migration.sh→dbis/test-dbis-migration.sh
Infrastructure Scripts (2 scripts)
setup-shared-infrastructure.sh→infrastructure/setup-shared-infrastructure.shsetup.sh→infrastructure/setup.sh
Utility Scripts (8 scripts)
analyze-costs.sh→utils/analyze-costs.shoptimize-builds.sh→utils/optimize-builds.shdeps-analyze.sh→utils/deps-analyze.shdeps-audit.sh→utils/deps-audit.shbuild-all.sh→utils/build-all.shtest-all.sh→utils/test-all.shverify-all.sh→utils/verify-all.shcleanup.sh→utils/cleanup.sh
Command to move all at once:
cd /home/intlc/projects/scripts
mv migrate-readme.sh migrate-terraform.sh migrate-to-*.sh migration/
mv collect-*.sh metrics/collect/
mv track-*.sh update-metrics.sh generate-metrics-report.sh metrics/
mv *dbis*.sh dbis/
mv setup*.sh infrastructure/
mv analyze-costs.sh optimize-builds.sh deps-*.sh build-all.sh test-all.sh verify-all.sh cleanup.sh utils/
✅ Phase 2: Update Scripts to Use Libraries (30 scripts)
For each script, add this at the top (after shebang):
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../lib/init.sh"
Migration Scripts (6)
migration/migrate-readme.shmigration/migrate-terraform.shmigration/migrate-to-api-gateway.shmigration/migrate-to-k8s.shmigration/migrate-to-monitoring.shmigration/migrate-to-shared-packages.sh
Metrics Scripts (10)
metrics/collect/collect-code-metrics.shmetrics/collect/collect-deployment-metrics.shmetrics/collect/collect-developer-metrics.shmetrics/collect/collect-infrastructure-metrics.shmetrics/collect/collect-operational-metrics.shmetrics/collect/collect-service-metrics.shmetrics/track-all-metrics.shmetrics/track-success-metrics.shmetrics/update-metrics.shmetrics/generate-metrics-report.sh
DBIS Scripts (4)
dbis/automate-dbis-migration.shdbis/migrate-all-dbis-projects.shdbis/migrate-dbis-project.shdbis/test-dbis-migration.sh
Infrastructure Scripts (2)
infrastructure/setup-shared-infrastructure.shinfrastructure/setup.sh
Utility Scripts (8)
utils/analyze-costs.shutils/optimize-builds.shutils/deps-analyze.shutils/deps-audit.shutils/build-all.shutils/test-all.shutils/verify-all.shutils/cleanup.sh
Replace patterns:
echo "..."→log_info "..."orlog_error "..."orlog_success "..."orlog_warn "..."command -v tool→require_command toolorcheck_command toolmkdir -p dir→ensure_dir dir- Add
validate_project_name "$1"where appropriate - Add
set_error_trapfor error handling
✅ Phase 3: Update References
Documentation Files
README.md(project root)QUICK_START_GUIDE.mdPROJECT_INDEX.mdINTEGRATION_TASKS_LIST.md- All files in
docs/directory
CI/CD Workflows
.github/workflows/ci-pilot-template.yml.github/workflows/publish-shared-packages.yml.github/workflows/infrastructure-deploy.yml.github/workflows/metrics-collection.yml
Search and Update
# Find all references
grep -r "scripts/migrate-to-k8s.sh" . --exclude-dir=node_modules
grep -r "scripts/collect-" . --exclude-dir=node_modules
grep -r "scripts/track-" . --exclude-dir=node_modules
grep -r "scripts/setup.sh" . --exclude-dir=node_modules
✅ Phase 4: Testing
Library Tests
- Test
lib/init.shloads correctly - Test each library function individually
- Test logging functions output correctly
- Test validation functions work
Script Tests
- Test each migration script with
--helpor no args - Test each metrics script
- Test each DBIS script
- Test each infrastructure script
- Test each utility script
Integration Tests
- Test scripts from project root
- Test scripts calling other scripts
- Test error handling
- Test input validation
Make Executable
find scripts -name "*.sh" -exec chmod +x {} \;
✅ Phase 5: Quality Assurance
Linting
find scripts -name "*.sh" -exec shellcheck {} \;
- Fix all shellcheck warnings
- Fix syntax errors
- Verify shebang lines
Consistency
- All scripts use libraries
- All scripts have help text
- All scripts validate inputs
- All scripts use logging functions
✅ Phase 6: Final Verification
- All 30 scripts moved
- All 30 scripts updated
- All scripts tested
- All documentation updated
- All references updated
- All scripts executable
- No linting errors
- No broken paths
📊 Progress Summary
Phase 1 (Migration): 0/30 (0%) Phase 2 (Updates): 0/30 (0%) Phase 3 (References): 0% Phase 4 (Testing): 0% Phase 5 (QA): 0% Phase 6 (Verification): 0%
Overall Progress: 0%
🚀 Quick Start
1. Move All Scripts
cd /home/intlc/projects/scripts
mv migrate-readme.sh migrate-terraform.sh migrate-to-*.sh migration/
mv collect-*.sh metrics/collect/
mv track-*.sh update-metrics.sh generate-metrics-report.sh metrics/
mv *dbis*.sh dbis/
mv setup*.sh infrastructure/
mv analyze-costs.sh optimize-builds.sh deps-*.sh build-all.sh test-all.sh verify-all.sh cleanup.sh utils/
2. Make All Executable
find scripts -name "*.sh" -exec chmod +x {} \;
3. Update First Script (Example)
# Edit migration/migrate-to-k8s.sh
# Add after shebang:
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../lib/init.sh"
# Replace echo with log_info, log_error, etc.
# Add validate_project_name "$1"
4. Test
./scripts/migration/migrate-to-k8s.sh test-project
Status: Ready to Begin Next Action: Start Phase 1 - Move Scripts