Files
proxmox/scripts/identify-duplicates.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- 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>
2026-02-12 15:46:57 -08:00

103 lines
2.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Identify duplicate and similar scripts
# Usage: ./scripts/identify-duplicates.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
OUTPUT_FILE="${PROJECT_ROOT}/docs/00-meta/DUPLICATE_SCRIPTS_ANALYSIS.md"
log_header "Identifying Duplicate Scripts"
# Find scripts with same basename (exact duplicates)
log_info "Finding scripts with duplicate basenames..."
DUPLICATE_NAMES=$(find "$PROJECT_ROOT/scripts" -name "*.sh" -type f ! -path "*/node_modules/*" ! -path "*/.git/*" ! -path "*/archive/*" -exec basename {} \; | sort | uniq -d)
if [ -n "$DUPLICATE_NAMES" ]; then
log_warn "Found scripts with duplicate names:"
echo "$DUPLICATE_NAMES" | while read -r name; do
echo " - $name"
find "$PROJECT_ROOT/scripts" -name "$name" ! -path "*/archive/*" | sed 's/^/ /'
done
else
log_success "No duplicate basenames found"
fi
# Find similar scripts by pattern
log_info "Finding similar scripts by pattern..."
cat > "$OUTPUT_FILE" <<EOF
# Duplicate Scripts Analysis
**Date:** $(date +%Y-%m-%d)
**Purpose:** Identify duplicate and similar scripts for consolidation
---
## 1. Exact Duplicate Names
EOF
if [ -n "$DUPLICATE_NAMES" ]; then
echo "$DUPLICATE_NAMES" | while read -r name; do
echo "### $name" >> "$OUTPUT_FILE"
find "$PROJECT_ROOT/scripts" -name "$name" ! -path "*/archive/*" | while read -r file; do
size=$(wc -l < "$file" 2>/dev/null || echo 0)
echo "- \`$file\` ($size lines)" >> "$OUTPUT_FILE"
done
echo "" >> "$OUTPUT_FILE"
done
else
echo "None found." >> "$OUTPUT_FILE"
fi
cat >> "$OUTPUT_FILE" <<EOF
---
## 2. Similar Functionality Groups
### Deployment Scripts
EOF
# Group deployment scripts
find "$PROJECT_ROOT/scripts" -name "deploy-*.sh" -type f ! -path "*/archive/*" | while read -r script; do
lines=$(wc -l < "$script" 2>/dev/null || echo 0)
echo "- \`$script\` ($lines lines)" >> "$OUTPUT_FILE"
done
cat >> "$OUTPUT_FILE" <<EOF
### Setup Scripts
EOF
find "$PROJECT_ROOT/scripts" -name "setup-*.sh" -type f ! -path "*/archive/*" | while read -r script; do
lines=$(wc -l < "$script" 2>/dev/null || echo 0)
echo "- \`$script\` ($lines lines)" >> "$OUTPUT_FILE"
done
cat >> "$OUTPUT_FILE" <<EOF
### Configuration Scripts
EOF
find "$PROJECT_ROOT/scripts" -name "configure-*.sh" -o -name "config-*.sh" -type f ! -path "*/archive/*" | while read -r script; do
lines=$(wc -l < "$script" 2>/dev/null || echo 0)
echo "- \`$script\` ($lines lines)" >> "$OUTPUT_FILE"
done
cat >> "$OUTPUT_FILE" <<EOF
### Fix Scripts
EOF
find "$PROJECT_ROOT/scripts" -name "fix-*.sh" -type f ! -path "*/archive/*" | head -20 | while read -r script; do
lines=$(wc -l < "$script" 2>/dev/null || echo 0)
echo "- \`$script\` ($lines lines)" >> "$OUTPUT_FILE"
done
log_success "Analysis complete: $OUTPUT_FILE"