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.
npx agentmods add rules/ckrl/ha-gitops/testinggit clone --depth 1 https://github.com/ckrl/ha-gitopsWhat 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 | $0.00000 | $0.01113 |
| Opus 5 | $0.00000 | $0.00557 |
| Sonnet 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 yesterday.
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.
- yesterday First seen · 66 lines · 0 tokens per session scan A 6ac7991ea18e
testing is a cursor rule published in the GitHub repository ckrl/ha-gitops (4 stars, last pushed 3mo 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
repository
Follow AGENTS.md and CONTRIBUTING.md before working in this repository.
cursorrules
Follow AGENTS.md and CONTRIBUTING.md before working in this repository.
backend-python
Cursor rule "backend-python" from coeusyk/inference-x, covering backend python rules, stack assumptions, code style, fastapi conventions and schema conventions.
api-tester
Expert API testing specialist focused on comprehensive API validation, performance testing, and quality assurance across all systems and third-party integrations.
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.