#!/bin/bash # Build HV Unified from src/* into a single hv-unified.user.js # Usage: ./scripts/build.sh [--watch] # No dependencies — pure cat concatenation. set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" PROJECT_DIR="$(dirname "$SCRIPT_DIR")" SRC_DIR="$PROJECT_DIR/src" OUTPUT="$PROJECT_DIR/scripts/hv-unified.user.js" # Ordered list of source files FILES=( header.user.js config.js state.js utils.js page-detector.js battle-parser.js items.js knowledge-base.js strategy-engine.js action-executor.js hover-system.js keybindings.js ui-overlays.js settings-panel.js out-of-battle.js guidance.js progress-tracker.js abilities.js armory.js gear-scraper.js battle-logger.js re-timer.js settings-page.js public-api.js init.js ) echo "🛡️ Building HV Unified..." echo " Source: $SRC_DIR" echo " Output: $OUTPUT" echo "" # Clear output > "$OUTPUT" # Concatenate with clear separators for file in "${FILES[@]}"; do src_path="$SRC_DIR/$file" if [ ! -f "$src_path" ]; then echo " ⚠️ MISSING: $file (skipping)" continue fi echo " ├── $file" cat "$src_path" >> "$OUTPUT" echo "" >> "$OUTPUT" done # Count lines LINES=$(wc -l < "$OUTPUT") SIZE=$(du -h "$OUTPUT" | cut -f1) echo "" echo " ✅ Built: $LINES lines, $SIZE"