# plugin-bootstrap > Bootstrap the Home Assistant plugin environment. Use AUTOMATICALLY when invoking any /ha-* command or when needing to run validation scripts. Sets up the plugin path resolver for script execution. - Author: owine - Repository: owine/claude-homeassistant-plugins - Version: 20260124164934 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/owine/claude-homeassistant-plugins - Web: https://mule.run/skillshub/@@owine/claude-homeassistant-plugins~plugin-bootstrap:20260124164934 --- --- name: plugin-bootstrap description: Bootstrap the Home Assistant plugin environment. Use AUTOMATICALLY when invoking any /ha-* command or when needing to run validation scripts. Sets up the plugin path resolver for script execution. --- # Plugin Environment Bootstrap This skill ensures the Home Assistant plugin scripts are accessible by creating a local resolver script. ## When This Activates - Before running any `/ha-*` command - When validation scripts are needed - When the user asks to validate YAML or find duplicates ## Bootstrap Process **Step 1: Check if resolver exists** ```bash test -f .claude/ha-plugin-root.sh && echo "EXISTS" || echo "MISSING" ``` **Step 2: If MISSING, create the resolver** Create the directory and resolver script: ```bash mkdir -p .claude ``` Then create `.claude/ha-plugin-root.sh` with this content: ```bash #!/bin/bash # Home Assistant Plugin Root Resolver # Resolves the installed plugin path for script execution PLUGIN_NAME="homeassistant-config" # Method 1: Check CLAUDE_PLUGIN_ROOT (works in hooks/MCP) if [ -n "${CLAUDE_PLUGIN_ROOT}" ] && [ -d "${CLAUDE_PLUGIN_ROOT}" ]; then echo "${CLAUDE_PLUGIN_ROOT%/}" exit 0 fi # Method 2: Look up from installed_plugins.json (try multiple locations) # Docker/container environments may have different HOME paths for PLUGINS_JSON in \ "${HOME}/.claude/plugins/installed_plugins.json" \ "/data/home/.claude/plugins/installed_plugins.json" \ "/root/.claude/plugins/installed_plugins.json"; do if [ -f "$PLUGINS_JSON" ]; then PLUGIN_ROOT=$(jq -r --arg name "$PLUGIN_NAME" ' .plugins | to_entries[] | select(.key | contains($name)) | .value[0].installPath ' "$PLUGINS_JSON" 2>/dev/null | head -1) if [ -n "$PLUGIN_ROOT" ] && [ "$PLUGIN_ROOT" != "null" ] && [ -d "$PLUGIN_ROOT" ]; then echo "$PLUGIN_ROOT" exit 0 fi fi done # Method 3: Search common locations for base in "${HOME}/.claude/plugins" "/data/home/.claude/plugins" "/root/.claude/plugins"; do for dir in \ "${base}/"*"${PLUGIN_NAME}"* \ "${base}/cache/"*"/${PLUGIN_NAME}"/*; do if [ -d "$dir" ] && [ -f "$dir/.claude-plugin/plugin.json" ]; then echo "$dir" exit 0 fi done done # Method 4: Check if we're in the plugin repo itself (development mode) SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" if [ -f "$SCRIPT_DIR/../homeassistant-config/.claude-plugin/plugin.json" ]; then echo "$SCRIPT_DIR/../homeassistant-config" exit 0 fi echo "ERROR: Could not locate $PLUGIN_NAME plugin" >&2 exit 1 ``` Make it executable: ```bash chmod +x .claude/ha-plugin-root.sh ``` **Step 3: Verify it works** ```bash .claude/ha-plugin-root.sh ``` This should output the path to the installed plugin. ## Using the Resolver Once bootstrapped, scripts can be invoked as: ```bash # Get plugin root PLUGIN_ROOT="$(.claude/ha-plugin-root.sh)" # Run validation scripts python3 "$PLUGIN_ROOT/skills/homeassistant-config/scripts/validate_yaml.py" /path/to/file.yaml python3 "$PLUGIN_ROOT/skills/homeassistant-config/scripts/check_config.py" /path/to/config python3 "$PLUGIN_ROOT/skills/homeassistant-config/scripts/find_duplicates.py" /path/to/config python3 "$PLUGIN_ROOT/skills/homeassistant-config/scripts/lovelace_validator.py" /path/to/dashboard.yaml ``` ## Troubleshooting If the resolver fails: 1. **Check jq is installed**: `which jq` - install with `brew install jq` if missing 2. **Verify plugin installation**: `cat ~/.claude/plugins/installed_plugins.json | jq .` 3. **Manual path**: Find the plugin with `find ~/.claude/plugins -name "plugin.json" -exec grep -l homeassistant {} \;`