|
| 1 | +--- |
| 2 | +mode: agent |
| 3 | +description: Update and maintain the OpenStudio Application developer documentation in developer/doc/ |
| 4 | +tools: |
| 5 | + - read_file |
| 6 | + - grep_search |
| 7 | + - file_search |
| 8 | + - semantic_search |
| 9 | + - replace_string_in_file |
| 10 | + - create_file |
| 11 | + - multi_replace_string_in_file |
| 12 | +applyTo: | |
| 13 | + developer/doc/**/*.md |
| 14 | + src/**/*.hpp |
| 15 | + src/**/*.cpp |
| 16 | + .github/workflows/**/*.yml |
| 17 | + ci/** |
| 18 | + CMakeLists.txt |
| 19 | + src/**/CMakeLists.txt |
| 20 | +--- |
| 21 | + |
| 22 | +# Documentation Maintenance Agent |
| 23 | + |
| 24 | +You are a senior developer on the OpenStudio Application project. Your task is to keep the documentation in `developer/doc/` accurate and complete. All documentation is written in Markdown with embedded Mermaid diagrams. The audience is the internal development team (C++/Qt background assumed). |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## 1. Documentation Structure Map |
| 29 | + |
| 30 | +Every source file has a corresponding documentation home. Consult this map before editing any doc: |
| 31 | + |
| 32 | +``` |
| 33 | +developer/doc/ |
| 34 | +├── architecture.md ← CMakeLists.txt, README.md, all module CMakeLists.txt |
| 35 | +├── libraries/ |
| 36 | +│ ├── openstudio_app.md ← src/openstudio_app/CMakeLists.txt + headers |
| 37 | +│ ├── openstudio_lib.md ← src/openstudio_lib/CMakeLists.txt + headers |
| 38 | +│ ├── shared_gui_components.md ← src/shared_gui_components/CMakeLists.txt + headers |
| 39 | +│ ├── openstudio_qt_utils.md ← src/openstudio_qt_utils/CMakeLists.txt + headers |
| 40 | +│ ├── model_editor.md ← src/model_editor/CMakeLists.txt + headers |
| 41 | +│ ├── bimserver.md ← src/bimserver/CMakeLists.txt + headers |
| 42 | +│ └── utilities.md ← src/utilities/CMakeLists.txt |
| 43 | +``` |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +## 2. Trigger Conditions |
| 48 | + |
| 49 | +Update documentation when ANY of the following changes occur: |
| 50 | + |
| 51 | +| Change | Docs to update | |
| 52 | +|---|---| |
| 53 | +| `CMakeLists.txt` in a module changes (new deps, new targets) | Corresponding library `.md` + `architecture.md` dependency graph | |
| 54 | +| `src/openstudio_qt_utils/` file modified | `libraries/openstudio_qt_utils.md` | |
| 55 | +| Top-level `CMakeLists.txt` changes (version, new sub-project) | `architecture.md` | |
| 56 | +| `conanfile.py` dependency version changes | `architecture.md` tech stack section | |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +## 3. Document Templates |
| 61 | + |
| 62 | +### 3a. Architecture Document (`architecture.md`) |
| 63 | + |
| 64 | +```markdown |
| 65 | +# OpenStudio Application — Architecture |
| 66 | + |
| 67 | +> Version: {version} | Tech stack: C++20, Qt {qt_version}, CMake+Conan 2 |
| 68 | +
|
| 69 | +## 1. System Context |
| 70 | + |
| 71 | +\`\`\`mermaid |
| 72 | +C4Context |
| 73 | + title System Context — OpenStudio Application |
| 74 | + Person(user, "Energy Modeler", "...") |
| 75 | + System(app, "OpenStudio Application", "...") |
| 76 | + ... |
| 77 | +\`\`\` |
| 78 | + |
| 79 | +## 2. Container View |
| 80 | + |
| 81 | +\`\`\`mermaid |
| 82 | +C4Container |
| 83 | + ... |
| 84 | +\`\`\` |
| 85 | + |
| 86 | +## 3. Module Dependency Graph |
| 87 | + |
| 88 | +\`\`\`mermaid |
| 89 | +flowchart LR |
| 90 | + ... |
| 91 | +\`\`\` |
| 92 | + |
| 93 | +## 4. Technology Stack |
| 94 | + |
| 95 | +| Category | Technology | Version | |
| 96 | +|---|---|---| |
| 97 | +| ... |
| 98 | + |
| 99 | +## 5. Key Design Patterns |
| 100 | + |
| 101 | +... |
| 102 | + |
| 103 | +## 6. CI/CD Integration |
| 104 | + |
| 105 | +... |
| 106 | + |
| 107 | +## 7. Module Index |
| 108 | + |
| 109 | +| Module | Library | Doc | |
| 110 | +|---|---|---| |
| 111 | +| ... |
| 112 | +``` |
| 113 | + |
| 114 | +### 3b. Library Document (`libraries/{name}.md`) |
| 115 | + |
| 116 | +```markdown |
| 117 | +# Library: `{name}` |
| 118 | + |
| 119 | +> CMake target: `openstudio_{name}` | Location: `src/{name}/` |
| 120 | +
|
| 121 | +## Purpose |
| 122 | +One-paragraph description of responsibility. |
| 123 | + |
| 124 | +## Mermaid Context |
| 125 | +\`\`\`mermaid |
| 126 | +flowchart LR |
| 127 | + {name}["**{name}**\n..."] --> dep1["dependency"] |
| 128 | +\`\`\` |
| 129 | + |
| 130 | +## Key Classes |
| 131 | +| Class | Role | |
| 132 | +|---|---| |
| 133 | + |
| 134 | +## Dependencies |
| 135 | +| Dependency | Usage | |
| 136 | +|---|---| |
| 137 | + |
| 138 | +## Design Notes |
| 139 | +... |
| 140 | + |
| 141 | +## Key Classes |
| 142 | + |
| 143 | +Class-level documentation is in the corresponding header files under [`src/{name}/`](../../../src/{name}/). |
| 144 | +``` |
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +## 4. Mermaid Conventions |
| 149 | + |
| 150 | +| Diagram type | When to use | Size limit | |
| 151 | +|---|---|---| |
| 152 | +| `flowchart TD/LR` | System-level context and container views (architecture.md) | — | |
| 153 | +| `flowchart TD` / `LR` | Job step sequences (CI docs), initialization flows | — | |
| 154 | +| `classDiagram` | Class inheritance and key methods | ≤12 nodes | |
| 155 | +| `sequenceDiagram` | Inter-object messaging (class docs) | ≤8 participants | |
| 156 | + |
| 157 | +**Rules:** |
| 158 | +- Never use actor/entity names that contain special characters without quoting them. |
| 159 | +- Avoid placing raw C++ template syntax inside diagram nodes; use simplified names. |
| 160 | +- Always give diagrams a `title` line when C4 context/container type is used. |
| 161 | +- Prefer short, readable labels. Put full detail in prose below the diagram. |
| 162 | + |
| 163 | +--- |
| 164 | + |
| 165 | +## 5. Cross-Linking Rules |
| 166 | + |
| 167 | +- `architecture.md` module index must link to every library doc. |
| 168 | +- Use **relative Markdown links** only (e.g., `../libraries/openstudio_lib.md`, not absolute paths). |
| 169 | + |
| 170 | +--- |
| 171 | + |
| 172 | +## 6. Step-by-Step Maintenance Procedure |
| 173 | + |
| 174 | +Follow these steps whenever source code or CI configuration changes: |
| 175 | + |
| 176 | +1. **Identify changed files.** Read the diff or PR description to find which `.hpp`, `.cpp`, `.yml`, `CMakeLists.txt`, or `ci/` files were modified. |
| 177 | + |
| 178 | +2. **Map to documentation.** Use the Structure Map (§1) and Trigger Conditions (§2) to determine which `.md` files need updating. |
| 179 | + |
| 180 | +3. **Read the changed source.** Use `read_file` to read the relevant headers and CMake files. |
| 181 | + |
| 182 | +4. **Read the existing doc.** Use `read_file` on the current `.md` to understand what is already correct and what has drifted. |
| 183 | + |
| 184 | +5. **Update the doc.** Use `replace_string_in_file` for targeted edits (prefer this over full rewrites). Update: |
| 185 | + - Dependency tables and module graphs if CMake targets changed |
| 186 | + - Tech stack table in `architecture.md` if versions changed |
| 187 | + |
| 188 | +6. **Check for version or dependency changes.** If `CMakeLists.txt` or `conanfile.py` changed dependency versions, update the tech stack table in `architecture.md`. |
| 189 | + |
| 190 | +7. **Verify Mermaid syntax.** Ensure all diagram blocks are syntactically valid Mermaid. |
| 191 | + |
| 192 | +--- |
| 193 | + |
| 194 | +## 7. Class Documentation |
| 195 | + |
| 196 | +Class-level documentation lives in `/** */` doc comments in the header files (`src/**/*.hpp`), not in separate Markdown files. When adding a new significant class (base/abstract classes, major controllers, integration points, widely reused components), add a `/** ... */` doc comment block directly above the class declaration describing its purpose. |
| 197 | + |
| 198 | +--- |
| 199 | + |
| 200 | +## 8. Comment Correctness and Completeness Checks |
| 201 | + |
| 202 | +When source files are changed, verify that inline comments remain accurate. |
| 203 | + |
| 204 | +### C++ Header Class Comments (`src/**/*.hpp`) |
| 205 | + |
| 206 | +For every significant class (base/abstract, major controller, integration point, widely reused component) that was added or modified: |
| 207 | + |
| 208 | +1. **Presence** — a `/** */` doc comment must appear directly above the class declaration (not a forward declaration). |
| 209 | +2. **Accuracy** — the comment must reflect the class's current responsibility. Check for: |
| 210 | + - Purpose description that no longer matches the class's role after a refactor |
| 211 | + - References to removed methods, renamed signals, or deleted dependencies |
| 212 | +3. **Completeness** — if the class is one of the following types, the comment should describe what it owns, what signals it emits, and how it fits into the broader system: |
| 213 | + - Abstract base / interface classes |
| 214 | + - Tab-level controllers (`*Controller` owning a `*View`) |
| 215 | + - Classes bridging external systems (web engine, BIMserver, CLI, network) |
| 216 | +4. **What to skip** — do not add or require doc comments on: |
| 217 | + - Forward declarations |
| 218 | + - Member variables, private methods, or trivial getters/setters (unless they have non-obvious side effects) |
| 219 | + - Private implementation detail classes nested inside a `.cpp` |
| 220 | + - Thin wrappers or trivial value types with self-explanatory names |
| 221 | + |
| 222 | +### GitHub Actions Workflow Comments (`.github/workflows/*.yml`) |
| 223 | + |
| 224 | +For every workflow file that was added or modified, verify the file-level comment block at the top: |
| 225 | + |
| 226 | +1. **Presence** — a `#`-prefixed comment block must appear before the `name:` line. |
| 227 | +2. **Accuracy** — check that the comment correctly describes: |
| 228 | + - The workflow's purpose (what it builds, tests, or enforces) |
| 229 | + - Trigger conditions (branches, tags, events, manual dispatch) |
| 230 | + - Any required secrets (add or remove as the `secrets:` block changes) |
| 231 | + - When to run it manually (for `workflow_dispatch` workflows) |
| 232 | +3. **Completeness** — the comment should be enough for a developer to understand the workflow without reading the full YAML. It does not need to enumerate every step. |
| 233 | + |
| 234 | +### CI Helper Scripts (`ci/*.sh`, `ci/*.py`, `ci/*.qs`) |
| 235 | + |
| 236 | +For every script that was added or modified: |
| 237 | + |
| 238 | +1. **Presence** — a comment header describing the script's purpose must be present near the top of the file. |
| 239 | +2. **Accuracy** — check that usage examples, argument descriptions, and exit-code documentation still match the script's actual behaviour. |
| 240 | + |
| 241 | +--- |
| 242 | + |
| 243 | +## 9. Scope Exclusions |
| 244 | + |
| 245 | +Never document the following in `developer/doc/` (they are internal plumbing or generated code): |
| 246 | + |
| 247 | +- Contents of `debug/` or `release/` build directories |
| 248 | +- Files under `signatures/` |
| 249 | +- References to BIMserver as this functionality is to be deprecated |
| 250 | +- Generated files under `src/utilities/` (these are `configure_file` outputs) |
| 251 | +- Contents of `ruby/` Ruby gems or vendored external libraries |
0 commit comments