Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/ckrl/ha-gitopsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/ckrl/ha-gitops/testing)<a href="https://agentmods.dev/rules/ckrl/ha-gitops/testing"><img src="https://agentmods.dev/badge/rules/ckrl/ha-gitops/testing/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/ckrl/ha-gitops/testing"><img src="https://agentmods.dev/badge/rules/ckrl/ha-gitops/testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01113 |
| Opus 5.5 | $0.00000 | $0.00445 |
| Sonnet 5.5 | $0.00000 | $0.00223 |
| Haiku 4.5 | $0.00000 | $0.00111 |
Grade A, and why
testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 66 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Testing Rules
Стек
- pytest + pytest-asyncio (
asyncio_mode = "auto"вpyproject.toml). - pytest-homeassistant-custom-component — фикстуры
hass,enable_custom_integrations,mock_config_entry. - Покрытие —
pytest-cov. Цель MVP: ≥ 80% поgit_manager.py, ≥ 60% поsensor.py/button.py.
Структура
- Файлы:
tests/test_<module>.py(по одному на модульcustom_components/ha_gitops/). tests/conftest.py— общие фикстуры:hass(из HA testing), временные директории, реальный bare git remote.- Один тест — одна проверка. Имена:
test_<unit>_<condition>_<expected>(например,test_push_no_changes_returns_clean).
Фикстуры
tmp_path— для конфиг-директории HA.bare_remote— фикстура с реальнымgit init --bareво временном каталоге; URL —file://{path}. Это позволяет тестироватьpush/pull/fetchбез сети и без моков subprocess.git_manager— собранныйGitManagerсtmp_pathкак config_dir иbare_remoteкакrepo_url. SSH-ключ дляfile://remote не нужен.- Для тестов SSH-логики (env, аргументы) — мокать
asyncio.create_subprocess_execчерезmonkeypatch/AsyncMock.
Что тестировать обязательно
git_manager.py:
initializeсоздаёт.git/,.gitignoreс блоком# ha-gitops:, не дублирует блок при повторном запуске._get_yaml_files()исключаетsecrets.yaml,secrets_backup.yaml,*.secrets.yaml, файлы из подпапок (только корень).- Panic guard: вручную staged
secrets.yaml→pushделает reset, не пушит, возвращает ERROR. pushбез изменений и без unpushed коммитов → no-op,SyncStatus.CLEAN, нет пустого коммита.pushс unpushed коммитом, но без staged изменений → выполняется толькоgit push.pullff-only: успех при behind, отказ +DIVERGEDпри diverged ветках.get_statusвозвращает корректныйSyncStatusдля всех 7 вариантов (clean,modified,ahead,behind,diverged,error,unknown)._build_commit_message: 1 файл / 2-3 файла / 4+ файла — формат subject из спеки §8.3, body содержит timestamp иCo-authored-by._build_ssh_envсодержитGIT_SSH_COMMANDс правильным путём ключа,IdentitiesOnly=yes, не пробрасывает~/.ssh.- Author/email подставляются через
-c user.name=... -c user.email=..., не через global config (проверяется через argv мока). - SSH-ключ при генерации получает права
0o600(проверятьPath.stat().st_mode & 0o777).
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 66 lines · 0 tokens per session scan A 6ac7991ea18e
testing is a cursor rule published in the GitHub repository ckrl/ha-gitops (5 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,113 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other cursor rules, from other repositories
python-cursorrules-prompt-file-best-practices
Cursor rules for Python development with best practices integration.
pytest
This guide defines our team's definitive best practices for writing fast, reliable, and maintainable tests using pytest, ensuring consistency and high code quality across projects.
python-tests
Tests and coverage when changing src/, scripts/, or tests/.
python-general-coding-standards
A set of general standards for Python projects, including type hints, input checking, code style, security, web requests, background work, and tests. It also covers FastAPI-specific tasks such as CORS and authentication.
python
Python development guidelines — PEP 8, type hints, error handling, async patterns, packaging, and testing. Applied when working with Python code.
python-code-validator
Validate generated Python at every step, not once at the end.