mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-29 21:03:40 +00:00
Major restructuring of the scripts/ directory with consistent output
formatting, improved organization, and stricter error handling.
Breaking Changes:
- Updated development environment to Home Assistant 2025.7+
- Removed Python 3.12 compatibility (HA 2025.7+ requires Python 3.13)
- Updated all HA core requirements from 2025.7 requirement files
- Added new dependencies: python-multipart, uv (for faster package management)
- Updated GitHub Actions workflows to use Python 3.13
Changes:
- Created centralized output library (scripts/.lib/output.sh)
- Unified color codes and Unicode symbols
- Consistent formatting functions (log_header, log_success, log_error, etc.)
- Support for embedded formatting codes (${BOLD}, ${GREEN}, etc.)
- Reorganized into logical subdirectories:
- scripts/setup/ - Setup and maintenance scripts
- bootstrap: Install/update dependencies (used in CI/CD)
- setup: Full DevContainer setup (pyright, copilot, HACS)
- reset: Reset config/ directory to fresh state (NEW)
- sync-hacs: Sync HACS integrations
- scripts/release/ - Release management scripts
- prepare: Version bump and tagging
- suggest-version: Semantic version suggestion
- generate-notes: Release notes generation
- check-if-released: Check release status
- hassfest: Local integration validation
- Updated all scripts with:
- set -euo pipefail for stricter error handling
- Consistent SCRIPT_DIR pattern for reliable sourcing
- Professional output with colors and emojis
- Unified styling across all 17 scripts
- Removed redundant scripts:
- scripts/update (was just wrapper around bootstrap)
- scripts/json_schemas/ (moved to schemas/json/)
- Enhanced clean script:
- Improved artifact cleanup
- Better handling of accidental package installations
- Hints for reset and deep clean options
- New reset script features:
- Standard mode: Keep configuration.yaml
- Full mode (--full): Reset configuration.yaml from git
- Automatic re-setup after reset
- Updated documentation:
- AGENTS.md: Updated script references and workflow guidance
- docs/development/: Updated all references to new script structure
Impact: Development environment now requires Python 3.13 and Home Assistant
2025.7+. Developers get consistent, professional script output with better
error handling and logical organization. Single source of truth for styling
makes future updates trivial.
76 lines
2.2 KiB
Bash
Executable file
76 lines
2.2 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# script/sync-hacs: Sync HACS-installed integrations to custom_components/
|
|
#
|
|
# Creates symlinks from workspace custom_components/ to integrations installed
|
|
# by HACS in config/custom_components/. Keeps development workspace in sync with
|
|
# test Home Assistant instance.
|
|
#
|
|
# Usage:
|
|
# ./scripts/setup/sync-hacs
|
|
#
|
|
# Examples:
|
|
# ./scripts/setup/sync-hacs
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
cd "$SCRIPT_DIR/../.."
|
|
|
|
# shellcheck source=scripts/.lib/output.sh
|
|
source "$SCRIPT_DIR/../.lib/output.sh"
|
|
|
|
log_header "Syncing HACS-installed integrations"
|
|
|
|
# Check if config/custom_components exists
|
|
if [[ ! -d $SCRIPT_DIR/../../config/custom_components ]]; then
|
|
log_info "No config/custom_components directory found"
|
|
exit 0
|
|
fi
|
|
|
|
# Clean up broken symlinks (where target no longer exists)
|
|
cleaned=0
|
|
if [[ -d $SCRIPT_DIR/../../custom_components ]]; then
|
|
for link in $SCRIPT_DIR/../../custom_components/*; do
|
|
# Skip if not a symlink
|
|
if [[ ! -L $link ]]; then
|
|
continue
|
|
fi
|
|
|
|
# Check if symlink target exists
|
|
if [[ ! -e $link ]]; then
|
|
component=$(basename "$link")
|
|
rm "$link"
|
|
log_step "Removed broken link: $component"
|
|
cleaned=$((cleaned + 1))
|
|
fi
|
|
done
|
|
fi
|
|
|
|
# Create symlinks for all integrations in config/custom_components/
|
|
# except those that already exist in custom_components/
|
|
synced=0
|
|
for dir in $SCRIPT_DIR/../../config/custom_components/*/; do
|
|
component=$(basename "$dir")
|
|
target="$SCRIPT_DIR/../../custom_components/$component"
|
|
|
|
# Skip if already exists and is not a symlink (don't touch tibber_prices)
|
|
if [[ -e $target && ! -L $target ]]; then
|
|
continue
|
|
fi
|
|
|
|
# Create or update symlink
|
|
ln -sf "$SCRIPT_DIR/../../config/custom_components/$component" "$target"
|
|
log_result 0 "Linked: $component"
|
|
synced=$((synced + 1))
|
|
done
|
|
|
|
if [[ $synced -eq 0 && $cleaned -eq 0 ]]; then
|
|
log_info "No changes needed"
|
|
elif [[ $synced -gt 0 && $cleaned -eq 0 ]]; then
|
|
log_success "Synced $synced integration(s)"
|
|
elif [[ $synced -eq 0 && $cleaned -gt 0 ]]; then
|
|
log_success "Cleaned up $cleaned broken link(s)"
|
|
else
|
|
log_success "Synced $synced integration(s), cleaned up $cleaned broken link(s)"
|
|
fi
|