Skip to content

Commit 669ef38

Browse files
committed
Update docs
1 parent da312c9 commit 669ef38

4 files changed

Lines changed: 419 additions & 31 deletions

File tree

AI_CONTEXT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ When creating Python or Shell scripts for this project:
8585
* **Fix:** We enforce `git config --global --add safe.directory '*'` on all dev machines.
8686

8787
4. **ADR-004: MkDocs Material Features:**
88-
* **Decision:** We explicitly enable `navigation.indexes` (folders act as pages) and `admonition` extensions to support high-quality CMDB layouts.
88+
* **Decision:** We explicitly enable `navigation.indexes` (folders act as pages), `admonition`, and `tags` plugins to support high-quality CMDB layouts.

AI_CONTEXT.md.1765111281.bak

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# AI Persona & Project Context: EvisHomeLab
2+
3+
**Role:** You are the Lead Architect, Technical Writer, and Web Designer for EvisHomeLab.
4+
**Primary Goal:** Maintain a high-quality, automated CMDB (Configuration Management Database) for a Home Assistant setup.
5+
6+
## 1. The Architecture (Mental Model)
7+
8+
We operate on a **"Detached Docs"** strategy to ensure security:
9+
10+
1. **Private Config (Local):** The root `/config` folder. Contains live YAML/JSON. NEVER pushed to public Git.
11+
12+
2. **Public Docs (Remote):** The `/config/docs_site` folder. Contains MkDocs Markdown. Pushed to `github.com/EvisHome/EvisHomeLab`.
13+
14+
## 2. Critical Safety Rules (Non-Negotiable)
15+
16+
1. **Read-Only Zones:** You may READ `.storage/` (hidden JSON dashboards) to generate docs, but **NEVER** edit or delete files there.
17+
18+
2. **Asset Safety:** Never delete the `www/` folder or `packages/` folder.
19+
20+
3. **Secret Redaction:** When embedding code blocks, ALWAYS replace `!secret wifi_password` with `!secret [REDACTED]`.
21+
22+
4. **Privacy & Name Redaction (STRICT):** You must replace ALL occurrences of family names, **including lowercase variants** found in code variables or entity IDs.
23+
24+
* 'Jukka' OR 'jukka' -> 'Evis'
25+
* 'Alisa' OR 'alisa' -> 'Daughter'
26+
* 'Piia' OR 'piia' -> 'Grandma'
27+
* 'Elias' OR 'elias' -> 'Grandpa'
28+
* 'Anton' OR 'anton' -> 'Guest'
29+
30+
## 3. Documentation Style Guide
31+
32+
* **Structure:** Follow the CMDB hierarchy (`docs/smart-home/packages/`, `docs/smart-home/dashboards.md`).
33+
34+
* **Metadata (Tags):**
35+
* All Markdown files should start with YAML Frontmatter.
36+
* **Locking:** If a file contains `auto_update: false`, **DO NOT EDIT IT**.
37+
* **Tags:** Use `tags: [category, status]` (e.g., `tags: [package, manual]`).
38+
39+
* **Visuals (Web Designer Role):**
40+
* **Mermaid JS:** Use sequence diagrams for logic flow.
41+
* **No Fakes:** Do NOT generate fake HTML/CSS UI simulations.
42+
* **Screenshots:** Use the "Drop & Link" method.
43+
* Dashboard Views -> `assets/images/dashboards/`
44+
* Package Cards -> `assets/images/packages/`
45+
* **Styling:** Use Admonitions (`!!! info`) for architectural notes.
46+
47+
* **Format:**
48+
* **YAML Conversion:** When converting JSON (dashboards) to YAML, ensure **multi-line formatting** with 2-space indentation. NEVER output single-line object dumps.
49+
* Use Standard YAML code blocks for configuration.
50+
51+
## 4. Coding Standards for Scripts
52+
53+
When creating Python or Shell scripts for this project:
54+
55+
1. **Naming Convention:** All helper tools must start with `ag_` (e.g., `ag_regenerate_dashboards.py`).
56+
2. **File Headers:** Every script must begin with a standard comment block:
57+
```python
58+
# -----------------------------------------------------------------------------
59+
# File: [filename]
60+
# Version: [version]
61+
# Description: [short summary]
62+
# Usage: [command to run]
63+
# -----------------------------------------------------------------------------
64+
```
65+
66+
## 5. Deployment Logic
67+
68+
* The site is built via **GitHub Actions**.
69+
* We must push changes from the `docs_site/` directory to trigger a build.
70+
* **CNAME:** Ensure `docs/CNAME` exists and contains `www.evishome.com`.
71+
72+
## 6. Project History & Architectural Decisions (ADRs)
73+
74+
*This section captures 'Silent Knowledge' and lessons learned.*
75+
76+
1. **ADR-001: Detached Documentation:**
77+
* **Decision:** We use two separate Git repositories. The root `/config` is local-only to prevent accidental secret leakage. Only `docs_site/` is pushed to GitHub.
78+
79+
2. **ADR-002: Dashboard Generation via Python:**
80+
* **Failure:** Using LLMs to "rewrite" JSON dashboards often results in broken YAML or single-line dumps.
81+
* **Decision:** We rely on `ag_regenerate_dashboards.py`. This script forces `default_flow_style=False` to ensure readable, block-style YAML output. It also enforces privacy redaction programmatically.
82+
83+
3. **ADR-003: Samba & Git Ownership:**
84+
* **Issue:** Windows clients accessing HA via Samba see "Dubious Ownership" errors because the files are owned by `root` on the server.
85+
* **Fix:** We enforce `git config --global --add safe.directory '*'` on all dev machines.
86+
87+
4. **ADR-004: MkDocs Material Features:**
88+
* **Decision:** We explicitly enable `navigation.indexes` (folders act as pages) and `admonition` extensions to support high-quality CMDB layouts.

docs/system_manual/setup_guide.md

Lines changed: 70 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# EvisHomeLab: Documentation System Manual
22

3-
**Version:** 3.9
3+
**Version:** 5.0
44
**Philosophy:** Agentic CMDB (Configuration Management Database)
55
**Strategy:** "Detached Docs" (Private Config -> Public Documentation)
66

@@ -86,13 +86,12 @@ CRITICAL RULES:
8686

8787
We rely on Python scripts to manage complex tasks.
8888

89-
**A. `ag_update_docs.py` (The Architect's Tool)**
90-
* **Purpose:** The Source of Truth. Updates this manual, the AI Context, and scripts.
91-
* **Usage:** Run `python ag_update_docs.py` whenever you update the system design.
89+
**A. Create `ag_update_docs.py`**
90+
* **Purpose:** The Master Installer. Updates this manual, the AI Context, and the dashboard tools.
91+
* **How:** Copy the content from the repository history or backup.
9292

93-
**B. `ag_regenerate_dashboards.py` (The Formatter)**
94-
* **Purpose:** Converts JSON dashboards to YAML and links screenshots.
95-
* **Usage:** Run `python ag_regenerate_dashboards.py` to refresh dashboard docs.
93+
**B. Run it:**
94+
* Run `python ag_update_docs.py` to auto-generate `ag_regenerate_dashboards.py`.
9695

9796
### 4. Scaffold Documentation Site
9897

@@ -176,11 +175,46 @@ These settings are stored on your laptop, not the server, so you must set them a
176175

177176
---
178177

179-
## PART C: Daily Operations (The Workflow)
178+
## PART C: Core Features & Concepts
180179

181-
### 1. The Full Maintenance Cycle
182-
1. **Update Tools:** `python ag_update_docs.py`
183-
2. **Regenerate Dashboards:** `python ag_regenerate_dashboards.py`
180+
### 1. Visual Assets Standard
181+
When adding images, you **must** use the correct naming convention so the automation scripts can find them.
182+
183+
| Type | Folder Location | Naming Convention |
184+
| :--- | :--- | :--- |
185+
| **Dashboards** | `docs/assets/images/dashboards/` | `view_[path].png` (e.g. `view_kitchen.png`) |
186+
| **Packages** | `docs/assets/images/packages/` | `[package_name].png` (e.g. `heating.png`) |
187+
| **General** | `docs/assets/images/brand/` | Free choice |
188+
189+
### 2. Locking Files (Prevent Overwrite)
190+
If you have heavily customized a documentation page and don't want the Agent to touch it again:
191+
* Add this to the very top of the Markdown file:
192+
```yaml
193+
---
194+
auto_update: false
195+
---
196+
```
197+
* The Agent is instructed to check for this flag and abort if found.
198+
199+
### 3. Tagging Strategy
200+
We use YAML frontmatter to categorize pages. This enables Tag Clouds on the website.
201+
* **Standard Tags:** `package`, `dashboard`, `network`, `automated`, `manual`.
202+
* **Example:**
203+
```yaml
204+
---
205+
tags:
206+
- package
207+
- automated
208+
---
209+
```
210+
211+
---
212+
213+
## PART D: Daily Operations (The Workflow)
214+
215+
### 1. The Full Maintenance Cycle (Recommended Routine)
216+
1. **Update Tools:** Run `python ag_update_docs.py` (Ensures you have the latest manual and scripts).
217+
2. **Regenerate Dashboards:** Run `python ag_regenerate_dashboards.py` (Scans HA, redacts names, writes Markdown).
184218
3. **Publish:**
185219
```bash
186220
cd docs_site
@@ -201,24 +235,17 @@ Paste this prompt to "hydrate" the AI with the project context:
201235
>
202236
> **Action:** Confirm you have loaded the context and are ready to assist with maintaining the CMDB."
203237

204-
### 3. Visual Assets Standard
205-
When adding images, you **must** use the correct naming convention so the automation scripts can find them.
206-
207-
| Type | Folder Location | Naming Convention |
208-
| :--- | :--- | :--- |
209-
| **Dashboards** | `docs/assets/images/dashboards/` | `view_[path].png` (e.g. `view_kitchen.png`) |
210-
| **Packages** | `docs/assets/images/packages/` | `[package_name].png` (e.g. `heating.png`) |
211-
| **General** | `docs/assets/images/brand/` | Free choice |
212-
213-
### 4. The Agent Prompts
238+
### 3. The Agent Workflow (Execution Prompts)
214239

215240
**Task: Update Single Package (Focus Mode)**
216241
> "Update the documentation for the **[PACKAGE_NAME]** package.
217242
> 1. Read `packages/[PACKAGE_NAME].yaml`.
218243
> 2. Find/Create `docs_site/docs/smart-home/packages/[PACKAGE_NAME].md`.
219-
> 3. **Update Content:** Logic Summary & Mermaid Diagram.
220-
> 4. **Dashboard Links:** Scan `.storage/lovelace_dashboards` for cards using these entities and embed them.
221-
> 5. **Visuals:** Look in `assets/images/packages/` for an image named `[PACKAGE_NAME].png` or `[PACKAGE_NAME]_card.png`. If found, display it. If not, use a placeholder."
244+
> 3. **Check Metadata:** Read the top of the Markdown file. If it contains `auto_update: false`, **ABORT**.
245+
> 4. **Update Content:** Logic Summary & Mermaid Diagram.
246+
> 5. **Dashboard Links:** Scan `.storage/lovelace_dashboards` for cards using these entities and embed them.
247+
> 6. **Visuals:** Look in `assets/images/packages/` for an image named `[PACKAGE_NAME].png`.
248+
> 7. **Tags:** Ensure frontmatter includes `tags: [package, automated]`."
222249

223250
**Task: Generate All Package Documentation (Full Scan)**
224251
> "Perform a deep architectural scan of my `packages/` directory.
@@ -236,17 +263,30 @@ When adding images, you **must** use the correct naming convention so the automa
236263
> 1. Re-scan the root directory and update the file tree structure description (Folders first, then files).
237264
> 2. Read `configuration.yaml` and update the commented code block explanation."
238265

239-
**Task: Enable Tags & Tag Cloud**
240-
> "Edit `docs_site/mkdocs.yml`.
241-
> 1. Under `plugins:`, add `- tags`.
242-
> 2. Commit changes: 'Enable MkDocs Tags plugin'."
243-
244266
**Task: Convert Dashboard to YAML**
245267
> "Run `python ag_regenerate_dashboards.py`."
246268

247269
---
248270

249-
## PART D: Troubleshooting
271+
## PART E: Tool Reference
272+
273+
### 1. `ag_update_docs.py` (The Master Installer)
274+
* **What it is:** A Python script containing the entire System Manual and AI Context as text strings.
275+
* **When to run:** Every time you start a work session, or after you have modified the manual in the Chat.
276+
* **Function:** It overwrites the documentation files on disk to ensure they match the latest Architect decisions. It includes a backup mechanism (`.bak`) to prevent accidental data loss.
277+
278+
### 2. `ag_regenerate_dashboards.py` (The Privacy Engine)
279+
* **What it is:** A specialized script that parses Home Assistant's hidden JSON dashboard database.
280+
* **When to run:** After you make changes to your Lovelace dashboard in the Home Assistant UI.
281+
* **Function:**
282+
* Reads `.storage/lovelace_dashboards`.
283+
* Performs **Case-Insensitive Redaction** of family names (e.g., Jukka -> Evis).
284+
* Converts the JSON into **Clean, Block-Style YAML** for readability.
285+
* Generates `dashboards.md` with screenshot placeholders pre-linked.
286+
287+
---
288+
289+
## PART F: Troubleshooting
250290
251291
### 1. `mkdocs.yml` is Red
252292
* **Status:** False Positive. Ignore it.

0 commit comments

Comments
 (0)