diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..0756c882 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,65 @@ +# Coding Assistant Instructions: Hilo Home Assistant Custom Integration + +This repository contains the Hilo custom component (`custom_components/hilo`) for Home Assistant, an integration connecting Hilo smart home energy devices and services. + +## Git Commit Guidelines + +- **First line**: Short, specific imperative sentence (e.g. "Add snapshot tests for switch platform"). No emojis in titles. +- **Commit description**: Focus on the **WHY** (problem, context, and architectural rationale). Do not merely recite the diff. Keep it concise, factual, and proportional. +- **Do NOT amend, squash, or rebase commits that have already been pushed to the PR branch after the PR is opened**: Reviewers need to follow the commit history and see what changed since their last review. + +## Development Commands + +- In the devcontainer, the sibling library `python-hilo` is mounted at `/workspaces/python-hilo`. +- Run `scripts/setup` to configure the environment and install dependencies. If a local `python-hilo` clone is present, it will be installed in editable development mode (`uv pip install -e /workspaces/python-hilo`). +- Use `scripts/develop` to launch a local Home Assistant test instance with `--skip-pip-packages python-hilo`. +- Run tests: `uv run pytest` or `uv run pytest tests/test_.py`. +- Update Syrupy snapshots: `uv run pytest tests/test_.py --snapshot-update`. +- Check linting and formatting: `uv run ruff check .` and `uv run ruff format --check .`. + +## Python Syntax Notes + +- Maintain compatibility with Home Assistant Core versions released up to 1 year back: **Python 3.13 is the minimum supported version** (CI tests both Python 3.13 and 3.14). +- Do not use Python 3.14-exclusive syntax (such as unparenthesized `except TypeA, TypeB:` or PEP 649 unquoted forward annotations without `from __future__ import annotations`) that would break on Python 3.13. +- When shims are required for backwards compatibility across Home Assistant versions, annotate them with: + `# TODO: Remove once support for Home Assistant