$ show adanowitz/HASSL
HASSL is a compiler for the Home Assistant Simple Scripting Language (DSL) that transforms .hassl files into Home Assistant automation packages. The system parses HASSL syntax using Lark, resolves imports and packages, performs semantic analysis to build an intermediate representation, and generates YAML output including helpers, scripts, sync automations, rule automations, and schedule sensors. Key features include loop-safe context tracking, per-rule enable gates, template-based code reuse, and comprehensive schedule support with window syntax and holiday integration. The architecture is modular with distinct phases: parsing, transformation, analysis, and code generation, each handled in separate modules. The CLI orchestrates the process, handles dependency loading of imported files, and writes output to a directory structure suitable for Home Assistant's packages folder.
The LLM identified 2 files worth highlighting for reuse:
Provides generic YAML deep-merge functionality with safe loading and dumping. Used to incrementally update Home Assistant package files without overwriting existing configurations. Isolated, dependency-free, and demonstrates non-obvious skill in handling YAML merging edge cases while preserving helper sections.
Performs semantic analysis on the HASSL AST, resolving aliases, handling complex import forms (glob, list, qualified), instantiating templates with defaulted parameters, and building an intermediate representation. Demonstrates advanced skill in managing package visibility, schedule collection (legacy and window-based), and holiday set integration. While coupled to HASSL concepts, the import resolution and template instantiation algorithms are reusable patterns for module systems.