Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
89 lines
2.5 KiB
Bash
Executable File
89 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Analyze small scripts (< 50 lines) for merging into utility modules
|
|
# Usage: ./scripts/analyze-small-scripts.sh
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
source "$SCRIPT_DIR/lib/logging.sh" 2>/dev/null || true
|
|
|
|
MAX_LINES=50
|
|
|
|
log_header "Analyzing Small Scripts (< $MAX_LINES lines)"
|
|
|
|
# Find all small scripts
|
|
SMALL_SCRIPTS=$(find "$PROJECT_ROOT/scripts" -name "*.sh" -type f ! -path "*/archive/*" ! -path "*/lib/*" ! -path "*/node_modules/*" ! -path "*/.git/*" -exec sh -c 'lines=$(wc -l < "$1"); [ "$lines" -lt '"$MAX_LINES"' ] && echo "$1"' _ {} \;)
|
|
|
|
# Categorize by functionality
|
|
CONTAINER_SCRIPTS=()
|
|
NETWORK_SCRIPTS=()
|
|
SERVICE_SCRIPTS=()
|
|
CONFIG_SCRIPTS=()
|
|
PROXMOX_SCRIPTS=()
|
|
OTHER_SCRIPTS=()
|
|
|
|
categorize_script() {
|
|
local script="$1"
|
|
local basename_script=$(basename "$script")
|
|
|
|
case "$basename_script" in
|
|
*container*|*ct*|*vmid*)
|
|
CONTAINER_SCRIPTS+=("$script")
|
|
;;
|
|
*network*|*ip*|*dns*|*tunnel*)
|
|
NETWORK_SCRIPTS+=("$script")
|
|
;;
|
|
*service*|*systemd*|*postgres*|*redis*|*nginx*)
|
|
SERVICE_SCRIPTS+=("$script")
|
|
;;
|
|
*config*|*configure*)
|
|
CONFIG_SCRIPTS+=("$script")
|
|
;;
|
|
*proxmox*|*pve*|*qm*|*pct*)
|
|
PROXMOX_SCRIPTS+=("$script")
|
|
;;
|
|
*)
|
|
OTHER_SCRIPTS+=("$script")
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# Process all small scripts
|
|
TOTAL=0
|
|
while IFS= read -r script; do
|
|
if [ -n "$script" ]; then
|
|
categorize_script "$script"
|
|
TOTAL=$((TOTAL + 1))
|
|
fi
|
|
done <<< "$SMALL_SCRIPTS"
|
|
|
|
# Report findings
|
|
log_info "Total small scripts found: $TOTAL"
|
|
echo ""
|
|
log_info "Categorized by functionality:"
|
|
echo " Container scripts: ${#CONTAINER_SCRIPTS[@]}"
|
|
echo " Network scripts: ${#NETWORK_SCRIPTS[@]}"
|
|
echo " Service scripts: ${#SERVICE_SCRIPTS[@]}"
|
|
echo " Config scripts: ${#CONFIG_SCRIPTS[@]}"
|
|
echo " Proxmox scripts: ${#PROXMOX_SCRIPTS[@]}"
|
|
echo " Other scripts: ${#OTHER_SCRIPTS[@]}"
|
|
echo ""
|
|
|
|
# Show examples
|
|
if [ ${#CONTAINER_SCRIPTS[@]} -gt 0 ]; then
|
|
log_info "Container script examples:"
|
|
printf '%s\n' "${CONTAINER_SCRIPTS[@]}" | head -5 | while read -r s; do
|
|
echo " - $(basename "$s")"
|
|
done
|
|
fi
|
|
|
|
if [ ${#NETWORK_SCRIPTS[@]} -gt 0 ]; then
|
|
log_info "Network script examples:"
|
|
printf '%s\n' "${NETWORK_SCRIPTS[@]}" | head -5 | while read -r s; do
|
|
echo " - $(basename "$s")"
|
|
done
|
|
fi
|
|
|
|
log_success "Analysis complete!"
|