mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-29 03:09:36 +00:00
- Add AGENTS.md documenting the card + integration + demo harness, and non-obvious cloud caveats (Python 3.13 backend venv for HA-harness tests, fresh-bundle copy before smoke, demo render nudge, known pixel-precision smoke). - Ignore .venv-backend/ (Python 3.13 venv provisioned by the update script). Co-authored-by: Matysh <Matysh@users.noreply.github.com>
2.8 KiB
2.8 KiB
AGENTS.md
House Plan is one HACS package with two parts plus a demo harness:
- Lovelace card (
src/, TypeScript + Lit) — the primary product, bundled todist/houseplan-card.js. - Storage integration (
custom_components/houseplan/, Python) — the Home Assistant backend. - Demo harness (
demo/) — a self-contained Playwright page (demo/srv/demo.html) that renders the card against a fakehass, used for screenshots and thesmoke_*.mjsend-to-end suite.
Standard commands live in package.json scripts, CONTRIBUTING.md, and docs/DEVELOPMENT.md. Read docs/ARCHITECTURE.md and docs/STATUS.md before non-trivial changes.
Cursor Cloud specific instructions
The startup update script already runs npm ci, provisions a Python 3.13 backend venv at .venv-backend, and installs Playwright Chromium. You do not need to reinstall dependencies.
- Frontend (from repo root):
npm run typecheck,npm test(node:test, ~270 tests),npm run build. After building, keep the integration copy in sync —cp dist/houseplan-card.js custom_components/houseplan/frontend/. CI enforcescmp dist/houseplan-card.js custom_components/houseplan/frontend/houseplan-card.jsbyte-for-byte. - Backend HA-harness tests need Python 3.13, not the system 3.12. Run them with the venv:
.venv-backend/bin/python -m pytest tests_backend/ -q(126 tests). Runningpython3 -m pytest tests_backendon the system 3.12 silently skips thetest_ha_*.pyharness tests (conftest.pyignores them whenhomeassistantis not importable) and runs only the ~83 pure tests. - Running the app / smoke suite: build a fresh bundle and copy it into the demo assets first —
npm run build && cp dist/houseplan-card.js demo/srv/assets/houseplan-card.js— then runnode demo/smoke_*.mjs. The committeddemo/srv/assets/houseplan-card.jsis a stale snapshot; testing it reports green about code that no longer exists. No real Home Assistant server is required:demo/srv/demo.htmlstubshass, registries andcallService. - Demo harness render quirk: the fake
hassindemo.htmlis set once, so opening the page directly in a browser renders the floor plan but device icons only appear after a re-render (an F5 refresh, or nudgingcard.hass = {...card.hass}). The smoke launcherdemo/serve.mjsalready does this nudge; a plain browser session does not. This is a harness limitation, not a card bug. - Known environment-sensitive smoke:
demo/smoke_opening_measure.mjsfails two sub-checks (place_dialog_x_magnetised,place_committed_x_center) under the pinned Chromium — a1e-6-tolerance magnet-snap on the opening-placement path. It reproduces against the pristine committed bundle, so treat it as pre-existing/pixel-precision, not a regression you introduced.