From ee6034e9f91b321c2d8b53cb9292908e2ffd4732 Mon Sep 17 00:00:00 2001 From: Moustachauve <2206577+Moustachauve@users.noreply.github.com> Date: Mon, 12 Oct 2026 00:23:59 -0400 Subject: [PATCH] Add AGENTS.md guidelines for AI coding assistants Provide project-level instructions for AI agents working on the Hilo Home Assistant custom integration, structured after Home Assistant Core's guidelines. The document specifies architectural constraints, version parity with python-hilo, Platinum-level snapshot testing standards, strict typing (forbidding Any in new code), and commit guidelines. --- AGENTS.md | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 AGENTS.md 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