Skip to content

Commit 32b00d1

Browse files
committed
documentation updates
1 parent 8cddd83 commit 32b00d1

18 files changed

Lines changed: 185 additions & 47 deletions

File tree

AGENTS.md

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,6 @@
22

33
Project instructions for AI coding agents (Claude Code, Cursor, Codex, etc.). All agents working in this repo should read this file. For deeper architecture and conventions, see [CLAUDE.md](./CLAUDE.md).
44

5-
## Running tests
5+
## Scoped Guidance
66

7-
This is a Yarn project — use `yarn`, not `npm`.
8-
9-
```bash
10-
yarn test # full suite
11-
yarn test:coverage # with NYC coverage
12-
yarn test:watch # watch mode
13-
```
14-
15-
### `yarn test` failing with `ERR_MODULE_NOT_FOUND` — read this first
16-
17-
If `yarn test` fails with an error like:
18-
19-
```
20-
Error: Cannot find package '@cards/...' imported from test/.../foo.spec.ts
21-
code: 'ERR_MODULE_NOT_FOUND'
22-
```
23-
24-
**It is not a module-resolution problem.** The path aliases (`@cards/*`, `@hass/*`, `@delegates/*`, …) are configured correctly in [tsconfig.json](./tsconfig.json) and registered at runtime via `tsconfig-paths/register` in [.mocharc.json](./.mocharc.json).
25-
26-
The real cause is a **TypeScript compilation error** somewhere in the imported file or its transitive imports. `ts-node` surfaces those as a misleading module-resolution error.
27-
28-
**To diagnose, always run:**
29-
30-
```bash
31-
npx tsc -p tsconfig.test.json --noEmit
32-
```
33-
34-
Fix the type errors it reports, then rerun `yarn test`. Do not investigate `tsconfig` paths, the test config, or stash changes to compare against `main` — that is wasted effort.
35-
36-
## Other conventions
37-
38-
- Prettier formatting: `yarn format`
39-
- Build: `yarn build` (Parcel)
40-
- See [CLAUDE.md](./CLAUDE.md) for architecture, directory layout, and TypeScript path aliases.
7+
Read the nearest `AGENTS.md` before changing files in a subdirectory. Scoped files exist under `test/`, `src/cards/`, `src/config/`, `src/delegates/`, `src/editor/`, `src/hass/`, `src/html/`, `src/localize/`, `src/theme/`, `src/translations/`, `src/types/`, and `src/util/`.

CLAUDE.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ This is a **Yarn project**. Use `yarn` commands instead of `npm` for consistency
1919

2020
### Testing
2121

22-
- `yarn test` - Run tests using Mocha with TypeScript
22+
- `yarn test` - Run unit tests using Mocha with TypeScript
2323
- `yarn test:coverage` - Run tests with NYC coverage reporting
2424
- `yarn test:watch` - Run tests in watch mode for development
25+
- `yarn test:e2e` - Run Playwright end-to-end tests against a live Home Assistant instance
26+
- `yarn test:e2e:auth` - Capture a Playwright storage state for authenticated e2e runs (requires `.env` with `PLAYWRIGHT_HA_ORIGIN` and `PLAYWRIGHT_HA_STORAGE_STATE`)
2527

2628
### Single Test Execution
2729

@@ -46,33 +48,45 @@ This is a **Home Assistant custom card** built with **LitElement/Lit** that disp
4648

4749
### Key Directory Structure
4850

49-
- **`src/cards/`**: Lit-based UI components (main card, editor, sub-components)
51+
- **`src/cards/`**: Lit-based UI components (main card, sub-components, badges, sliders)
52+
- **`src/config/`**: Configuration parsing, defaults, and schema helpers
5053
- **`src/delegates/`**: Business logic separated from UI (retrievers, checks, utilities)
51-
- **`src/theme/`**: Theming system, CSS generation, color management
54+
- **`src/editor/`**: Visual configuration editor and its row/sub-element editors
5255
- **`src/hass/`**: Home Assistant integration, types, and API wrappers
53-
- **`src/types/`**: TypeScript type definitions for config, sensors, etc.
5456
- **`src/html/`**: HTML template functions for UI rendering
57+
- **`src/localize/`**: Localization helpers consuming `src/translations/`
58+
- **`src/theme/`**: Theming system, CSS generation, color management
59+
- **`src/translations/`**: JSON translation bundles
60+
- **`src/types/`**: TypeScript type definitions for config, sensors, etc.
61+
- **`src/util/`**: Generic utility helpers shared across layers
5562

5663
### TypeScript Path Aliases
5764

5865
The project uses path aliases defined in `tsconfig.json`:
5966

6067
- `@cards/*``./src/cards/*`
68+
- `@config/*``./src/config/*`
6169
- `@delegates/*``./src/delegates/*`
62-
- `@theme/*``./src/theme/*`
70+
- `@editor/*``./src/editor/*`
6371
- `@hass/*``./src/hass/*`
64-
- `@type/*``./src/types/*`
65-
- `@config/*``./src/config/*`
6672
- `@html/*``./src/html/*`
73+
- `@localize/*``./src/localize/*`
74+
- `@theme/*``./src/theme/*`
75+
- `@type/*``./src/types/*`
6776
- `@util/*``./src/util/*`
77+
- `@test/*``./test/*`
78+
- `@/*``./src/*`
6879

6980
### Component Registration
7081

71-
The card registers multiple custom elements:
82+
The card registers multiple custom elements (see `src/index.ts`):
7283

7384
- `room-summary-card` - Main card component
7485
- `room-summary-card-editor` - Visual configuration editor
75-
- `sensor-collection`, `entity-collection`, `room-state-icon` - Sub-components
86+
- `sensor-collection`, `entity-collection`, `entity-slider`, `room-state-icon`, `room-badge` - Sub-components
87+
- `room-summary-entity-detail-editor`, `room-summary-entities-row-editor`, `room-summary-states-row-editor`, `room-summary-thresholds-row-editor`, `room-summary-badge-row-editor`, `room-summary-sub-element-editor` - Editor row/sub-element components
88+
89+
Additional `@customElement`-decorated components are registered inline under `src/cards/components/` (e.g. `area-statistics`, `problem-entity-row`, `problem-entity-list`, `problem-dialog`, `horizontal-slider`, `room-sensor-label`, `room-entity-label`, `room-badge-label`).
7690

7791
### Data Flow Pattern
7892

@@ -91,11 +105,12 @@ The card registers multiple custom elements:
91105

92106
### Testing Setup
93107

94-
- **Framework**: Mocha + Chai + Sinon
108+
- **Framework**: Mocha + Chai + Sinon for unit tests
95109
- **TypeScript**: Tests use separate `tsconfig.test.json`
96-
- **DOM Testing**: Uses JSDOM for component testing
110+
- **DOM Testing**: Uses JSDOM (+ `@open-wc/testing`, `@testing-library/dom`) for component testing
97111
- **Coverage**: NYC with Istanbul for coverage reporting
98112
- **Setup**: `mocha.setup.ts` provides test environment configuration
113+
- **End-to-end**: Playwright tests run against a live Home Assistant instance via `yarn test:e2e`; auth state is captured with `yarn test:e2e:auth`
99114

100115
### Build System
101116

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ This project is protected under the MIT License. For more details, refer to the
7777
- Inspired by Home Assistant's chip design
7878
- Button-Card and Auto-Entities were a huge inspo
7979
- Thanks to all contributors!
80+
- Maintained by [Patrick Masters](https://github.com/warmfire540) / [Curious Cat Consulting](https://curiouscat.consulting/projects/ha-room-summary-card?utm_source=github-room-summary-card&utm_medium=readme&utm_campaign=oss-presence&utm_content=maintained-by)
8081

8182
[![contributors](https://contrib.rocks/image?repo=homeassistant-extras/room-summary-card)](https://github.com/homeassistant-extras/room-summary-card/graphs/contributors)
8283

docs/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,3 +378,8 @@ This project is protected under the MIT License. For more details, refer to the
378378
## Build & Code Quality
379379

380380
Check out **[Build Documentation](BUILD.md)**!
381+
---
382+
383+
<p align="center">
384+
<em>Built and maintained by <a href="https://curiouscat.consulting/projects/ha-room-summary-card?utm_source=github-room-summary-card&utm_medium=docs-site&utm_campaign=oss-presence&utm_content=footer">Curious Cat Consulting</a></em>
385+
</p>

mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,6 @@ extra:
5858
link: https://github.com/homeassistant-extras/room-summary-card
5959
- icon: fontawesome/brands/discord
6060
link: https://discord.gg/NpH4Pt8Jmr
61+
- icon: fontawesome/solid/globe
62+
link: https://curiouscat.consulting/projects/ha-room-summary-card?utm_source=github-room-summary-card&utm_medium=docs-site&utm_campaign=oss-presence&utm_content=nav-link
63+
name: Maintained by Curious Cat Consulting

package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
{
22
"name": "room-summary-card",
33
"version": "0.68.0",
4-
"author": "Patrick Masters",
4+
"author": {
5+
"name": "Patrick Masters",
6+
"url": "https://curiouscat.consulting/projects/ha-room-summary-card?utm_source=github-room-summary-card&utm_medium=package-metadata&utm_campaign=oss-presence&utm_content=author-url"
7+
},
58
"license": "ISC",
69
"description": "Custom card Home Assistant which can show a summary of room entities.",
10+
"homepage": "https://homeassistant-extras.github.io/room-summary-card/",
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/homeassistant-extras/room-summary-card.git"
14+
},
15+
"bugs": {
16+
"url": "https://github.com/homeassistant-extras/room-summary-card/issues"
17+
},
718
"source": "src/index.ts",
819
"module": "dist/room-summary-card.js",
920
"targets": {

src/cards/AGENTS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# AGENTS.md - Cards
2+
3+
This folder contains Lit-based card UI, editors, mixins, and card-specific components.
4+
5+
- Keep rendering logic declarative and close to the component that owns the UI state.
6+
- Use delegates, helpers, or common utilities for business logic that can be tested without DOM rendering.
7+
- Preserve Home Assistant custom element registration patterns used by the repo.
8+
- Keep editor components focused on config editing and emitting config change events.
9+
- Prefer existing local component, mixin, and style patterns before adding new abstractions.

src/config/AGENTS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# AGENTS.md - Config
2+
3+
This folder contains feature flags, config schemas, defaults, and config-related helpers.
4+
5+
- Preserve backwards compatibility for shipped dashboard config unless the user explicitly asks for a breaking change.
6+
- Keep config defaults and validation behavior close together when possible.
7+
- Update editor schemas and tests when adding or changing user-facing config options.
8+
- Avoid silently changing persisted config shape without a migration or cleanup path.

src/delegates/AGENTS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# AGENTS.md - Delegates
2+
3+
This folder contains business logic, retrievers, action handlers, subscriptions, and data-processing helpers.
4+
5+
- Keep delegate code independent from Lit rendering whenever practical.
6+
- Prefer pure functions for transforms, filtering, sorting, and state calculations.
7+
- Keep Home Assistant API access behind existing retriever/subscription patterns.
8+
- Add or update focused unit tests when changing behavior here.
9+
- Do not move UI concerns into delegates; return data that cards can render.

src/editor/AGENTS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# AGENTS.md - Editor
2+
3+
This folder contains shared editor schemas, config cleanup, and editor support utilities.
4+
5+
- Keep editor helpers aligned with the card config types and defaults.
6+
- Emit Home Assistant config change events using the repo's existing helper pattern.
7+
- Keep schema changes backwards compatible with existing dashboard YAML/UI config where practical.
8+
- Test config cleanup and schema utilities when behavior changes.

0 commit comments

Comments
 (0)