Skip to content

Commit e2aa196

Browse files
authored
Merge pull request #30 from graphras-com/fix/agents-md-cov-typo
Fix coverage target typo in AGENTS.md
2 parents 26c9345 + e537f19 commit e2aa196

1 file changed

Lines changed: 98 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,56 @@
44

55
HaClient — async Python client for Home Assistant (REST + WebSocket). Single package at `src/haclient/`, built with Hatchling, sole runtime dep is `aiohttp`.
66

7+
## Core Mission
8+
9+
Provide a consistent, intuitive, and Pythonic abstraction over the Home Assistant API.
10+
11+
Do not mirror the API. Improve it.
12+
13+
### Non-Negotiable Rules
14+
15+
* Consistency over fidelity
16+
Do not replicate inconsistent API patterns.
17+
* Explicit intent over generic services
18+
Avoid exposing raw service calls like turn_on when intent-specific methods are clearer.
19+
* Graceful compatibility handling
20+
Detect feature support and degrade safely. Never break user code due to missing capabilities.
21+
* Pythonic design
22+
Interfaces must feel like Python objects, not HTTP wrappers.
23+
24+
### Abstraction Rules
25+
26+
* Map entities to structured Python objects.
27+
* Normalize domain inconsistencies.
28+
* Split overloaded API actions into clear methods.
29+
30+
Example:
31+
32+
* ❌ light.turn_on(brightness=50)
33+
* ✅ light.set_brightness(50)
34+
35+
### Design Priorities
36+
37+
1. Core domains must be clean and stable (Light, Lock, Media Player, Sensor, etc.)
38+
2. Extend coverage without introducing inconsistency
39+
3. Support advanced/edge domains only after core stability
40+
41+
### Anti-Goals
42+
43+
* Do not expose raw API complexity unless necessary
44+
* Do not enforce strict API parity
45+
* Do not design around Home Assistant internals—design around user expectations
46+
47+
### Implementation Standard
48+
49+
Every feature must answer:
50+
51+
* Is this intuitive without Home Assistant knowledge?
52+
* Is this consistent with other domains?
53+
* Does this degrade safely if unsupported?
54+
55+
If not, redesign it.
56+
757
## Setup
858

959
```bash
@@ -26,7 +76,7 @@ You MUST follow this sequence for every task. Do not write any code before step
2676
2. **Do the work.**
2777
3. **Run the full test suite** — every test must pass before you commit:
2878
```
29-
python -m pytest tests/ --cov=deckui --cov-report=term-missing --cov-fail-under=95
79+
python -m pytest tests/ --cov=haclient --cov-report=term-missing --cov-fail-under=95
3080
```
3181
4. **Commit** — only after all tests pass.
3282
5. **Push and create a PR**:
@@ -37,6 +87,53 @@ You MUST follow this sequence for every task. Do not write any code before step
3787

3888
**Never commit directly to `main`.** No exceptions.
3989

90+
## Docstring convention
91+
92+
All AI agents modifying this repository must write NumPy-style docstrings for all relevant Python code.
93+
94+
Use NumPy-style docstrings for:
95+
96+
- Public modules
97+
- Public classes
98+
- Public methods
99+
- Public functions
100+
- Non-obvious private helpers
101+
- Complex test fixtures or utilities
102+
103+
Docstrings must describe:
104+
105+
- Purpose and behavior
106+
- Parameters
107+
- Return values
108+
- Raised exceptions, where relevant
109+
- Side effects, where relevant
110+
- Examples, when useful
111+
112+
Use this format:
113+
114+
```python
115+
def example_function(name: str, retries: int = 3) -> bool:
116+
"""Validate a named operation.
117+
118+
Parameters
119+
----------
120+
name : str
121+
Name of the operation to validate.
122+
retries : int, default=3
123+
Number of retry attempts before failing.
124+
125+
Returns
126+
-------
127+
bool
128+
True if the operation is valid, otherwise False.
129+
130+
Raises
131+
------
132+
ValueError
133+
If ``name`` is empty.
134+
"""
135+
```
136+
40137
## Commands
41138

42139
```bash

0 commit comments

Comments
 (0)