Files
proxmox/docs/archive/00-meta-pruned/SCRIPTS_AUDIT_MASTER.md
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

123 lines
4.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Scripts Audit Master
**Last Updated:** 2026-02-02
**Purpose:** Consolidate hardcoded IP status, deduplication, pruning, and modularization
**Completed 2026-02-02:** VMID→IP lib created, 6 scripts pruned to archive, besu scripts refactored to use vmid-ip-maps.
---
## 1. Hardcoded IP Status
| Metric | Status |
|--------|--------|
| **Active scripts** | 455 |
| **IP centralization** | ✅ Complete (config/ip-addresses.conf) |
| **Bare IPs remaining** | ~1 (in comments or edge cases) |
| **Archive** | Excluded from IP fix (1,400+ refs) |
**Tools:**
- `scripts/repair-corrupted-ip-replacements.sh` Fix corrupt `${IP_SERVICE_XX:-...}N` patterns
- `scripts/fix-remaining-hardcoded-ips.sh` Replace bare IPs with `${VAR:-ip}` (excludes archive)
- `config/ip-addresses.conf` Central IP definitions
**Source IP config in scripts:**
```bash
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
# Or: source "$(dirname "${BASH_SOURCE[0]}")/../lib/ip-config.sh"
```
---
## 2. Deduplication
| Category | Count | Opportunity |
|----------|-------|-------------|
| Check/Verify | 131 | Unified `verify.sh [service]` |
| Deploy/Setup | 79 | Unified `deploy.sh [component]` |
| Config | 43 | Unified `configure.sh [component]` |
| Migrate | 24 | Consolidate migration helpers |
| List/Show | 16 | Unified `list.sh [type]` |
| Fix | 6 | Already minimal |
**Similar scripts (consolidation candidates):**
- `create-chain138-containers.sh` vs `create-all-chain138-containers-direct.sh` vs `create-alltra-nodes.sh` vs `create-remaining-nodes-fixed.sh`
- `besu/collect-*.sh` (collect-all-node-enodes, collect-missing-enodes) overlap in VMID→IP maps
- `nginx-proxy-manager/migrate-*.sh` migrate-to-npmplus vs migrate-configs-to-npmplus
**See:** [SCRIPT_REDUCTION_POTENTIAL.md](SCRIPT_REDUCTION_POTENTIAL.md)
---
## 3. Pruning
| Category | Count | Action |
|----------|-------|--------|
| Small (< 10 lines) | 2 | Review; merge or archive |
| Deprecated naming | 7 | Review test/backup scripts |
| Archive | 436 | Already excluded from IP fix |
**Prune candidates:**
- `scripts/monitoring/npmplus-backup-cron.sh` (8 lines)
- `scripts/approve-builds.sh` (9 lines)
- Test scripts: `test-suite.sh`, `test-all-explorer-links.sh`, `test-bridge-with-fresh-nonce.sh`, `test-npm-create-proxy-api.sh`
**See:** [SCRIPT_PRUNING_ANALYSIS.md](SCRIPT_PRUNING_ANALYSIS.md)
**Tool:** `scripts/prune-scripts-execute.sh [--execute]` (dry-run by default)
---
## 4. Modularization
**Existing shared modules:**
| Module | Path | Purpose |
|--------|------|---------|
| ip-config | scripts/lib/ip-config.sh | Load config/ip-addresses.conf |
| load-ip-config | scripts/load-ip-config.sh | Same, from project root |
| logging | scripts/lib/logging.sh | log_info, log_warn, etc. |
| error-handling | scripts/lib/error-handling.sh | Error handling helpers |
| ssh-helpers | scripts/lib/ssh-helpers.sh | SSH helpers |
| proxmox-api | scripts/lib/proxmox-api.sh | Proxmox API |
| transaction-logger | scripts/lib/transaction-logger.sh | Transaction logging |
| config-utils | scripts/utils/config-utils.sh | Config utilities |
| container-utils | scripts/utils/container-utils.sh | Container helpers |
| network-utils | scripts/utils/network-utils.sh | Network helpers |
| proxmox-utils | scripts/utils/proxmox-utils.sh | Proxmox helpers |
| service-utils | scripts/utils/service-utils.sh | Service helpers |
**Modularization (done):**
1. **VMID→IP mapping** `scripts/lib/vmid-ip-maps.sh` besu/collect-all-node-enodes.sh, besu/reconcile-and-update-node-lists.sh refactored.
2. **RPC URL** `RPC_URL="${RPC_URL_138:-http://${RPC_ALLTRA_1:-192.168.11.250}:8545}"` repeated; use `source` from config.
3. **Proxmox host iteration** `for host in ml110 r630-01 r630-02` pattern; extract to `scripts/lib/proxmox-hosts.sh`.
---
## 5. Action Summary
| Priority | Action | Tool/Ref |
|----------|--------|----------|
| P1 | Run IP fix/repair | `repair-corrupted-ip-replacements.sh` then `fix-remaining-hardcoded-ips.sh` |
| P2 | Review prune candidates | SCRIPT_PRUNING_ANALYSIS.md |
| P3 | VMID→IP shared lib | ✅ `scripts/lib/vmid-ip-maps.sh` |
| P4 | Consolidate verify scripts | Create `verify.sh [service]` framework |
| P5 | Consolidate create-* scripts | Merge create-chain138, create-alltra, create-remaining |
---
## 6. Quick Commands
```bash
# Fix any remaining IP issues
cd /home/intlc/projects/proxmox
bash scripts/repair-corrupted-ip-replacements.sh
bash scripts/fix-remaining-hardcoded-ips.sh
# Analyze for pruning (dry-run)
bash scripts/analyze-scripts-for-pruning.sh
# Analyze reduction potential
bash scripts/analyze-reduction-potential.sh
```