Update
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"version": 1,
|
||||
"hooks": {
|
||||
"afterShellExecution": [
|
||||
{
|
||||
"command": "powershell -ExecutionPolicy Bypass -File .cursor/hooks/scripts/after-build-validate.ps1"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
$input = [Console]::In.ReadToEnd()
|
||||
$context = $input | ConvertFrom-Json
|
||||
|
||||
$command = $context.command
|
||||
if (-not $command) { exit 0 }
|
||||
|
||||
$buildPatterns = @('dotnet build', 'dotnet run', 'dotnet publish')
|
||||
$isBuildCommand = $false
|
||||
|
||||
foreach ($pattern in $buildPatterns) {
|
||||
if ($command -match [regex]::Escape($pattern)) {
|
||||
$isBuildCommand = $true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $isBuildCommand) { exit 0 }
|
||||
|
||||
$response = @{
|
||||
message = "[Live Validation] Build command detected. Run live environment validation using the homeassistant MCP tools: 1) check_api to verify HA is reachable, 2) RunSmokeTest for a full health check, 3) ValidateEntities for the critical entities of the changed service."
|
||||
} | ConvertTo-Json -Compress
|
||||
|
||||
Write-Output $response
|
||||
exit 0
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"5994a9f8-5bd6-407e-b7e1-88c9a7360592\\5994a9f8-5bd6-407e-b7e1-88c9a7360592.jsonl": "2026-04-14T08:01:31.8660776Z",
|
||||
"6e38db72-7218-41a2-80da-8091c601738c\\6e38db72-7218-41a2-80da-8091c601738c.jsonl": "2026-04-14T10:19:17.9717677Z",
|
||||
"84ed688d-ec2b-42ff-b324-7d8a1b0b1e53\\84ed688d-ec2b-42ff-b324-7d8a1b0b1e53.jsonl": "2026-04-17T19:55:06.7428782Z",
|
||||
"84ed688d-ec2b-42ff-b324-7d8a1b0b1e53\\subagents\\d19fc0d0-4036-49fe-b85c-28f06fb3ed96.jsonl": "2026-04-17T19:55:20.0402239Z",
|
||||
"947d0c4b-410b-4ca2-b813-2b9abb0b171d\\947d0c4b-410b-4ca2-b813-2b9abb0b171d.jsonl": "2026-04-14T08:23:40.4290937Z",
|
||||
"a9ef1795-de24-4fe6-937d-1ff01dc8091d\\a9ef1795-de24-4fe6-937d-1ff01dc8091d.jsonl": "2026-04-14T08:48:55.5467377Z"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"version": 1,
|
||||
"lastRunAtMs": 1776455702656,
|
||||
"turnsSinceLastRun": 8,
|
||||
"lastTranscriptMtimeMs": 1776455701006.4348,
|
||||
"lastProcessedGenerationId": "13996b20-c9b1-41f3-bafc-5738130c07ac",
|
||||
"trialStartedAtMs": null
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
description: Auto-enable caveman (ultra-compressed) replies every chat unless user opts out
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Caveman default (every chat)
|
||||
|
||||
Treat **caveman full** as active for all assistant prose unless user says `stop caveman` or `normal mode`. User may switch with `/caveman lite|full|ultra` (same semantics as caveman skill).
|
||||
|
||||
## Style
|
||||
|
||||
- Drop filler, hedging, pleasantries; fragments OK; technical terms exact; code fences unchanged.
|
||||
- **lite**: tight professional prose, keep articles.
|
||||
- **full** (default): drop most articles; short synonyms; terse lines.
|
||||
- **ultra**: abbrev where clear (e.g. req/res/config), arrows for flow (→), minimal words.
|
||||
|
||||
## Exceptions
|
||||
|
||||
Use normal clarity (not caveman) for: irreversible or destructive ops, security warnings, multi-step instructions where terseness risks misread, or when user explicitly asks for fuller explanation. Resume caveman after that block.
|
||||
|
||||
## Code / commits
|
||||
|
||||
Implementation code, tests, and commit messages: normal quality bar (readable names, complete sentences in commits if repo expects it). Caveman applies mainly to **explanatory chat text**, not to lowering code standards.
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
description: Require live environment validation after modifying monitor services
|
||||
globs:
|
||||
- "BoilerMonitor.Manager/**/*.cs"
|
||||
- "BoilerMonitor.Models/**/*.cs"
|
||||
- "LightMonitor.Manager/**/*.cs"
|
||||
- "LightMonitor.Models/**/*.cs"
|
||||
- "NordPool.Manager/**/*.cs"
|
||||
- "NordPool.Models/**/*.cs"
|
||||
- "PowerMonitor.Manager/**/*.cs"
|
||||
- "PowerMonitor.Models/**/*.cs"
|
||||
- "ShowerMonitor.Manager/**/*.cs"
|
||||
- "ShowerMonitor.Models/**/*.cs"
|
||||
- "HomeAssistant.McpServer/**/*.cs"
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Live Validation Required
|
||||
|
||||
After modifying any Monitor service, Manager, or Models code, the agent MUST validate the change works in the live Home Assistant environment before considering the task complete.
|
||||
|
||||
## Mandatory Steps
|
||||
|
||||
1. **Build** — run `dotnet build` on the affected project to confirm compilation.
|
||||
2. **Smoke test** — use the `RunSmokeTest` MCP tool (from the `homeassistant` MCP server) with domains relevant to the changed service.
|
||||
3. **Entity check** — use `ValidateEntities` to confirm critical entities for the changed service are not `unavailable` or `unknown`.
|
||||
|
||||
## Domain Mapping
|
||||
|
||||
| Service Changed | MCP Domains to Check |
|
||||
|---|---|
|
||||
| BoilerMonitor | `switch,sensor,binary_sensor` |
|
||||
| LightMonitor | `light,person,sun` |
|
||||
| NordPool | `sensor` |
|
||||
| PowerMonitor | `sensor` |
|
||||
| ShowerMonitor | `sensor,switch` |
|
||||
|
||||
## When to Skip
|
||||
|
||||
- If the Home Assistant instance is offline (check via `check_api` first)
|
||||
- If changes are purely to unit tests, documentation, or non-runtime code
|
||||
- If the user explicitly says to skip validation
|
||||
|
||||
## On Failure
|
||||
|
||||
Report the specific entities that failed validation and their current states. Do not silently proceed.
|
||||
@@ -0,0 +1,96 @@
|
||||
# Live Environment Validation
|
||||
|
||||
Validate that code changes work correctly against the live Home Assistant instance using MCP tools.
|
||||
|
||||
## Triggers
|
||||
|
||||
Use when:
|
||||
- The user says "validate", "check live", "smoke test", "verify live environment"
|
||||
- After deploying or restarting the app daemon
|
||||
- After modifying any Monitor/Manager service and wanting to confirm it works
|
||||
- When the live-validation rule fires (after editing monitor service files)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- The Home Assistant instance must be running and reachable
|
||||
- The `homeassistant` MCP server must be connected in Cursor
|
||||
|
||||
## Validation Workflow
|
||||
|
||||
### Step 1: Build Verification
|
||||
|
||||
Run `dotnet build` for the solution or affected project to confirm compilation succeeds.
|
||||
|
||||
```
|
||||
dotnet build HomeAssistantSDK.sln --no-restore
|
||||
```
|
||||
|
||||
If the build fails, stop and fix compilation errors before proceeding.
|
||||
|
||||
### Step 2: API Health Check
|
||||
|
||||
Use the `homeassistant` MCP tool `check_api` to verify the HA instance is reachable.
|
||||
|
||||
If the API is unreachable, report the failure and stop — no further validation is possible.
|
||||
|
||||
### Step 3: Smoke Test
|
||||
|
||||
Use the `homeassistant` MCP tool `RunSmokeTest` to run a full environment check:
|
||||
- Pass the relevant domains based on what was changed
|
||||
- Check the `overall` field for PASS/FAIL
|
||||
- Review any unhealthy entities
|
||||
|
||||
Domain mapping for changed services:
|
||||
- **BoilerMonitor** → `switch,sensor,binary_sensor,number,text`
|
||||
- **LightMonitor** → `light,person,sun`
|
||||
- **NordPool** → `sensor`
|
||||
- **PowerMonitor** → `sensor`
|
||||
- **ShowerMonitor** → `sensor,switch`
|
||||
|
||||
### Step 4: Entity-Specific Validation
|
||||
|
||||
Based on which service was changed, validate its critical entities using the `ValidateEntities` MCP tool:
|
||||
|
||||
**BoilerMonitor entities:**
|
||||
- `sensor.boilermonitor_status`
|
||||
- `sensor.boilermonitor_water_ready`
|
||||
- `sensor.boilermonitor_estimated_temperature`
|
||||
- `sensor.boilermonitor_heating_percentage`
|
||||
|
||||
**LightMonitor entities:**
|
||||
- `light.sonoff_1002214d40`
|
||||
- `sun.sun`
|
||||
- `person.marius`, `person.erika`
|
||||
|
||||
**NordPool entities:**
|
||||
- `sensor.nordpool_current_price`
|
||||
|
||||
**PowerMonitor entities:**
|
||||
- Power sensor entities configured in the system
|
||||
|
||||
### Step 5: Behavioral Validation (Optional)
|
||||
|
||||
For deeper validation, use the `get_logbook` MCP tool filtered to the relevant entity with a 30-minute window to confirm the service is producing expected state changes.
|
||||
|
||||
Use `get_entity_history` for trend validation — verify values are within expected ranges.
|
||||
|
||||
### Step 6: Report
|
||||
|
||||
Summarize results:
|
||||
1. Build status (pass/fail)
|
||||
2. API health (reachable/unreachable)
|
||||
3. Smoke test result (PASS/FAIL with details)
|
||||
4. Entity validation results (list any failures)
|
||||
5. Logbook activity summary (if performed)
|
||||
|
||||
If everything passes, confirm with a brief "Live validation passed" message.
|
||||
If anything fails, list specific failures with entity IDs and current states.
|
||||
|
||||
## Browser Validation (HistoryReplay UI)
|
||||
|
||||
If the `HomeAssistant.HistoryReplay` Blazor app is running, use the `cursor-ide-browser` MCP to:
|
||||
1. Navigate to the dashboard URL
|
||||
2. Take a screenshot to verify charts render correctly
|
||||
3. Check console for JavaScript errors
|
||||
|
||||
This is optional and only applies when HistoryReplay changes are involved.
|
||||
Reference in New Issue
Block a user