- Archive: 85 agent .txt files → docs/archive/agents/legacy_txt/ - Scripts: Move 110 shell scripts → scripts/ (keep deploy.sh in root) - Models: Move 18 .safetensors → ml/models/checkpoints/training_artifacts/ - Delete: 34 directories (~33GB freed) - target/, coverage_*, test artifacts - Build: Clean 14 build artifacts (.rlib, .o, .pid, binaries) - Tests: Move 14 .rs files → tests/standalone/ - SQL: Move 5 files → sql/ (keep init-db*.sql for Docker) - Wave 153: Archive to docs/archive/historical/wave153/ - Docs: Archive 9 markdown files to wave_d/reports/ and historical/ Total impact: ~34GB freed (both waves), root directory cleaned from 583 to ~40 essential files Directory count reduced from 65 to 31 (52% reduction) All historical data preserved in organized archive structure
53 lines
1.6 KiB
Bash
Executable File
53 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Aggressive unused variable prefixing script
|
|
|
|
set -e
|
|
|
|
echo "=== Phase 2: Bulk Unused Variable Prefixing ==="
|
|
echo "Collecting unused variable warnings..."
|
|
|
|
# Get all unused variable warnings
|
|
cargo check --workspace --tests 2>&1 | grep "unused variable:" > /tmp/unused_vars.txt || true
|
|
|
|
# Count total
|
|
total=$(wc -l < /tmp/unused_vars.txt)
|
|
echo "Found $total unused variable warnings"
|
|
|
|
fixed=0
|
|
|
|
# Process each warning
|
|
while IFS= read -r line; do
|
|
# Extract file path (between --> and :line_number)
|
|
file=$(echo "$line" | sed -n 's/.*--> \([^:]*\):.*/\1/p' | tr -d ' ')
|
|
|
|
# Extract variable name (between backticks)
|
|
var=$(echo "$line" | sed -n "s/.*variable: \`\([^']*\)'.*/\1/p")
|
|
|
|
if [ -n "$file" ] && [ -n "$var" ] && [ -f "$file" ]; then
|
|
# Skip if already prefixed
|
|
if [[ "$var" == _* ]]; then
|
|
continue
|
|
fi
|
|
|
|
echo "Fixing: $var in $file"
|
|
|
|
# Prefix in function parameters: foo: Type -> _foo: Type
|
|
sed -i "s/\b$var:/\_$var:/g" "$file"
|
|
|
|
# Prefix in let bindings: let foo = -> let _foo =
|
|
sed -i "s/let $var =/let _$var =/g" "$file"
|
|
|
|
# Prefix in mut bindings: mut foo = -> mut _foo =
|
|
sed -i "s/mut $var =/mut _$var =/g" "$file"
|
|
|
|
# Prefix in for loops: for foo in -> for _foo in
|
|
sed -i "s/for $var in/for _$var in/g" "$file"
|
|
|
|
((fixed++))
|
|
fi
|
|
done < /tmp/unused_vars.txt
|
|
|
|
echo "Fixed $fixed variables"
|
|
echo "Verifying changes..."
|
|
cargo check --workspace --tests 2>&1 | grep "^warning:" | wc -l
|