Skip to content

Commit 2439d43

Browse files
committed
docs: standardize and validate repository documentation
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 27dc9d2f-ee94-48f1-bf06-8f3d10414fc9
1 parent 24d2224 commit 2439d43

57 files changed

Lines changed: 4412 additions & 1014 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitattributes‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
.github/workflows/*.lock.yml linguist-generated=true merge=ours
1+
.github/workflows/*.lock.yml linguist-generated=true merge=ours
2+
*.md text eol=lf
3+
*.excalidraw text eol=lf
4+
docs/diagrams/*.svg text eol=lf

‎.github/workflows/ci.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ jobs:
116116
throw "GitVersion SemVer '$actual' did not match tag '$expected'."
117117
}
118118
119+
- name: Validate documentation
120+
shell: pwsh
121+
run: ./scripts/validate-docs.ps1
122+
119123
- name: Restore dependencies
120124
run: dotnet restore
121125

@@ -527,7 +531,7 @@ jobs:
527531

528532
build-msix:
529533
needs: [test, e2etests]
530-
if: false # Paused for alpha.4; ship Inno setup and portable ZIP artifacts only.
534+
if: false # MSIX distribution is paused; ship Inno setup and portable ZIP artifacts only.
531535
runs-on: ${{ matrix.rid == 'win-arm64' && 'windows-11-arm' || 'windows-latest' }}
532536
continue-on-error: true
533537
strategy:

‎DEVELOPMENT.md‎

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ A comprehensive guide for building, running, and contributing to the OpenClaw Wi
88
- [Project Structure](#project-structure)
99
- [Building](#building)
1010
- [Architecture Overview](#architecture-overview)
11+
- [Documentation and Diagrams](#documentation-and-diagrams)
1112
- [Testing](#testing)
1213
- [CI/CD](#cicd)
1314
- [Contributing](#contributing)
@@ -257,7 +258,7 @@ src/OpenClawTray.FunctionalUI/ Component · RenderContext · FunctionalHostCon
257258
- One `OpenClawChatDataProvider` instance lives on `App` (`App.ChatProvider`),
258259
created in `InitializeGatewayClient` and disposed inside
259260
`UnsubscribeGatewayEvents`. Both the Hub Chat tab and the tray ChatWindow
260-
consume the same provider — opening either surface shows identical state.
261+
consume the same provider - opening either surface shows identical state.
261262
- Each XAML host (`ChatPage`, `ChatWindow`) mounts its own `FunctionalHostControl`
262263
with `ContentTarget` pointing at a `<Border x:Name="ChatHost"/>`. The
263264
surrounding chrome (NavigationView, popup header) stays XAML.
@@ -463,6 +464,38 @@ In DEBUG builds, logs are also written to Visual Studio Output window via `Syste
463464
**Security:**
464465
Sensitive data (authentication tokens) are never logged.
465466

467+
## Documentation and Diagrams
468+
469+
Maintained architecture, data-flow, and sequence diagrams use a paired source
470+
and rendered artifact:
471+
472+
```text
473+
docs/diagrams/<name>.excalidraw
474+
docs/diagrams/<name>.svg
475+
```
476+
477+
Embed the SVG in Markdown so GitHub renders it, and place an adjacent link to
478+
the `.excalidraw` source so contributors can edit it. Keep labels synchronized
479+
between both files. Every text element in the Excalidraw JSON must have explicit
480+
`width` and `height` and use black text; container boxes remain transparent.
481+
482+
Do not add new Mermaid or maintained ASCII-art architecture diagrams. Small
483+
state notations, directory trees, wire examples, and command-output snippets
484+
may remain as fenced text when their value is the literal text rather than a
485+
visual layout. Historical design documents may retain clearly labeled inline
486+
sketches, but they must link to the current canonical diagram when one exists.
487+
488+
Run documentation validation directly with:
489+
490+
```powershell
491+
.\scripts\validate-docs.ps1
492+
```
493+
494+
`.\build.ps1` runs the same validator before compiling. It checks maintained
495+
Markdown links and anchors, rejects Mermaid and em dashes, verifies every
496+
Excalidraw/SVG pair, requires SVG accessibility metadata, and confirms rendered
497+
labels match the editable source.
498+
466499
## Testing
467500

468501
Required agent validation lives in [AGENTS.md](AGENTS.md). For changes touching
@@ -611,8 +644,13 @@ The CI builds multiple configurations:
611644

612645
**Test Job:**
613646
- Runs on `windows-latest`
614-
- Builds Shared library, Tray app (WinUI), Tests (Shared + Tray)
615-
- Runs unit tests: `dotnet test tests/OpenClaw.Shared.Tests` and `dotnet test tests/OpenClaw.Tray.Tests`
647+
- Builds the Shared library, Tray app, and eight test projects: Shared, Tray,
648+
Connection, WinNode CLI, Tray Integration, FunctionalUI, SetupEngine, and
649+
Tray UI
650+
- Runs unit, integration, native UI, and accessibility tests across those
651+
projects; see [docs/TEST_COVERAGE.md](docs/TEST_COVERAGE.md)
652+
- Verifies the WinUI DevBuild identity marker after native UI and accessibility
653+
tests
616654
- Uses GitVersion for semantic versioning
617655

618656
**Build Job (Tray):**
@@ -850,12 +888,12 @@ Direct `dotnet build` without the script will fail with "WindowsAppSDKSelfContai
850888

851889
### Architecture
852890

853-
- **FunctionalUI**: `src/OpenClawTray.FunctionalUI/` — Minimal declarative WinUI helper layer used by onboarding
854-
- **Pages**: `src/OpenClaw.Tray.WinUI/Onboarding/Pages/` — Functional UI components for each wizard screen
855-
- **Services**: `src/OpenClaw.Tray.WinUI/Onboarding/Services/` — State management, setup code decoder, permission checker, health check, input validation
856-
- **Widgets**: `src/OpenClaw.Tray.WinUI/Onboarding/Widgets/` — Shared UI components (cards, step indicators, feature rows)
857-
- **Window**: `src/OpenClaw.Tray.WinUI/Onboarding/OnboardingWindow.cs` — Host window with WebView2 overlay for chat
858-
- **Helpers**: `src/OpenClaw.Tray.WinUI/Helpers/GatewayChatHelper.cs` — Shared WebView2 chat URL builder
891+
- **FunctionalUI**: `src/OpenClawTray.FunctionalUI/` - Minimal declarative WinUI helper layer used by onboarding
892+
- **Pages**: `src/OpenClaw.Tray.WinUI/Onboarding/Pages/` - Functional UI components for each wizard screen
893+
- **Services**: `src/OpenClaw.Tray.WinUI/Onboarding/Services/` - State management, setup code decoder, permission checker, health check, input validation
894+
- **Widgets**: `src/OpenClaw.Tray.WinUI/Onboarding/Widgets/` - Shared UI components (cards, step indicators, feature rows)
895+
- **Window**: `src/OpenClaw.Tray.WinUI/Onboarding/OnboardingWindow.cs` - Host window with WebView2 overlay for chat
896+
- **Helpers**: `src/OpenClaw.Tray.WinUI/Helpers/GatewayChatHelper.cs` - Shared WebView2 chat URL builder
859897

860898
---
861899

‎README.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,13 @@ Use your gateway's supported configuration tools when OpenClaw Companion cannot
8585
}
8686
```
8787

88-
Commands such as `system.run`, `system.run.prepare`, `system.which`, `screen.record`, `camera.snap`, `camera.clip`, `stt.transcribe`, and `tts.speak` require deliberate opt-in. Reapprove and reconnect the node after changing the effective command set.
88+
Canonical paired Windows nodes already receive the desktop `system.*` defaults,
89+
including `system.run`, `system.run.prepare`, and `system.which`. Windows still
90+
applies the local **Run system tools** switch, V2 exec approvals, and sandbox
91+
policy. Commands outside the Windows gateway defaults, including
92+
`screen.record`, `camera.snap`, `camera.clip`, `stt.transcribe`, and
93+
`tts.speak`, require deliberate gateway opt-in. Reapprove and reconnect the
94+
node after changing the effective command set.
8995

9096
</details>
9197

@@ -211,6 +217,7 @@ These commands restore and build the test projects when needed. Use `--no-restor
211217
| Topic | Document |
212218
|---|---|
213219
| Architecture ownership | [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) |
220+
| Audio model asset integrity | [docs/AUDIO_MODEL_ASSETS.md](docs/AUDIO_MODEL_ASSETS.md) |
214221
| Connection and pairing | [docs/CONNECTION_ARCHITECTURE.md](docs/CONNECTION_ARCHITECTURE.md) |
215222
| Gateway, node, and exec flow FAQ | [docs/OPENCLAW_GATEWAY_NODE_EXEC_FAQ.md](docs/OPENCLAW_GATEWAY_NODE_EXEC_FAQ.md) |
216223
| Onboarding wizard | [docs/ONBOARDING_WIZARD.md](docs/ONBOARDING_WIZARD.md) |

‎build.ps1‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,12 @@ if ($issues.Count -eq 0) {
311311
}
312312
}
313313

314+
Write-Header "Validating Documentation"
315+
& (Join-Path $repoRoot "scripts\validate-docs.ps1") -RepoRoot $repoRoot
316+
if ($LASTEXITCODE -ne 0) {
317+
exit $LASTEXITCODE
318+
}
319+
314320
if ($CheckOnly) {
315321
Write-Host "`nRun without -CheckOnly to build.`n"
316322
exit 0

‎docs/A2UI_NATIVE_WINUI.md‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Native WinUI A2UI Canvas — Design Spec
1+
# Native WinUI A2UI Canvas - Design Spec
22

33
> **Status:** Implemented; historical design rationale
44
> **Audience:** Contributors maintaining the native A2UI renderer for the Windows node
@@ -18,7 +18,7 @@ That worked, but it had costs:
1818
- **Theming drift.** WinUI windows around the canvas use Mica/Fluent; the canvas uses Lit components styled with CSS. Achieving consistent visuals requires duplicate theme work.
1919
- **Hardening.** Surface area for arbitrary script execution remains larger than necessary for what is fundamentally a declarative UI tree.
2020

21-
The implemented native WinUI renderer renders A2UI surfaces directly into XAML — no WebView, no HTTP host, no JS bridge. The node is self-contained: it can render A2UI whether it's connected to a gateway, an MCP client, or both.
21+
The implemented native WinUI renderer renders A2UI surfaces directly into XAML - no WebView, no HTTP host, no JS bridge. The node is self-contained: it can render A2UI whether it's connected to a gateway, an MCP client, or both.
2222

2323
## 2. Goals & non-goals
2424

@@ -33,7 +33,7 @@ The implemented native WinUI renderer renders A2UI surfaces directly into XAML
3333
### Non-goals (initial release)
3434

3535
- No A2UI v0.9 features (bidirectional messaging, prompt-first generation, modular schemas).
36-
- No HTML/JS/CSS escape hatch from inside an A2UI surface (the v0.8 catalog has no such primitive — keep it that way).
36+
- No HTML/JS/CSS escape hatch from inside an A2UI surface (the v0.8 catalog has no such primitive - keep it that way).
3737
- No replacement for `canvas.present` / `canvas.navigate` / `canvas.eval`. Those continue to use WebView2 for general web content. Only A2UI rendering moves.
3838
- No custom (non-catalog) component types in v1. Catalog-strict.
3939

@@ -74,10 +74,10 @@ Two canvas modes share the surface:
7474

7575
| Mode | Trigger | Window |
7676
|---|---|---|
77-
| Web (`canvas.present` / `canvas.navigate` / `canvas.eval`) | URL or HTML payload | `CanvasWindow` (WebView2) — unchanged |
78-
| A2UI native | First `canvas.a2ui.push` since reset | `A2UICanvasWindow` (XAML) — new |
77+
| Web (`canvas.present` / `canvas.navigate` / `canvas.eval`) | URL or HTML payload | `CanvasWindow` (WebView2) - unchanged |
78+
| A2UI native | First `canvas.a2ui.push` since reset | `A2UICanvasWindow` (XAML) - new |
7979

80-
A user-visible toggle is *not* required — the choice is implicit in which MCP command the agent calls. The two windows must not compete for focus; if both want to be visible, the most-recently-targeted wins (last-write-wins, with a small fade between).
80+
A user-visible toggle is *not* required - the choice is implicit in which MCP command the agent calls. The two windows must not compete for focus; if both want to be visible, the most-recently-targeted wins (last-write-wins, with a small fade between).
8181

8282
### 3.3 Component pipeline
8383

@@ -145,7 +145,7 @@ Action payload shape (v0.8):
145145
| `List` | `ItemsRepeater` + `ItemsRepeaterScrollHost` | Virtualization on by default |
146146
| `Card` | `Border` with `Microsoft.UI.Xaml.Media.MicaBackdrop`-aware brush + corner radius + drop shadow | |
147147
| `Tabs` | `TabView` (controls) | Lightweight chrome to match Lit version |
148-
| `Modal` | `ContentDialog` (or full-window overlay `Grid` w/ `AcrylicBrush`) | Track Lit's full-screen overlay style — `dialog::backdrop` analog is `AcrylicBrush` over the parent |
148+
| `Modal` | `ContentDialog` (or full-window overlay `Grid` w/ `AcrylicBrush`) | Track Lit's full-screen overlay style - `dialog::backdrop` analog is `AcrylicBrush` over the parent |
149149
| **Display** | | |
150150
| `Text` | `TextBlock` | Map A2UI `style` (h1/h2/body/caption/etc.) to Fluent type ramp |
151151
| `Image` | `Image` w/ `BitmapImage` source; HTTP fetch via `HttpClient` with allowlist | Reject `file:`, `javascript:`, `data:` (except small `image/png|jpeg|webp`) |
@@ -161,7 +161,7 @@ Action payload shape (v0.8):
161161
| `ChoicePicker` | `ComboBox` (single) / `ListView` w/ `SelectionMode=Multiple` (multi) | |
162162
| `Slider` | `Slider` | |
163163

164-
Each mapping lives in a single `IComponentRenderer` implementation under `OpenClaw.Tray.WinUI/A2UI/Renderers/`. The set is closed at compile time (catalog-strict) — no runtime registration in v1.
164+
Each mapping lives in a single `IComponentRenderer` implementation under `OpenClaw.Tray.WinUI/A2UI/Renderers/`. The set is closed at compile time (catalog-strict) - no runtime registration in v1.
165165

166166
## 6. Data model & binding
167167

@@ -175,8 +175,8 @@ A2UI surfaces carry a JSON data model. Components reference paths into that mode
175175

176176
Bindings are **one-way for display** components, **two-way for interactive** components. Implement via:
177177

178-
- `DataModelObservable` — wraps a `JsonObject` and exposes `INotifyPropertyChanged` per registered path.
179-
- `A2UIBinding` markup extension (or code-behind helpers) — produces `Binding` objects that target a path observer.
178+
- `DataModelObservable` - wraps a `JsonObject` and exposes `INotifyPropertyChanged` per registered path.
179+
- `A2UIBinding` markup extension (or code-behind helpers) - produces `Binding` objects that target a path observer.
180180

181181
Why not raw `Microsoft.UI.Xaml.Data.Binding` paths? JSON paths can include array indices and slashes, which XAML binding paths don't model cleanly. A small adapter is simpler and faster than fighting the binding engine.
182182

@@ -218,7 +218,7 @@ Default to `XamlControlsResources` + Fluent theme colors. The `createSurface.the
218218
- `typography`: optional font family override; respect Windows accessibility text scaling first.
219219
- `radius`, `spacing`: passed through to renderers via `RenderContext`.
220220

221-
Theme application is local to the surface's visual tree — switching themes between surfaces does not flash the chrome.
221+
Theme application is local to the surface's visual tree - switching themes between surfaces does not flash the chrome.
222222

223223
## 9. Lifecycle & hosting
224224

@@ -256,13 +256,13 @@ Mirror what `CanvasCapability` already logs:
256256

257257
- `a2ui.push` (count, jsonl byte length, surface IDs touched, render time ms)
258258
- `a2ui.action` (surface ID, action name, queue latency)
259-
- `a2ui.unknown_component` (type name) — to drive catalog upgrades
260-
- `a2ui.media_blocked` (URL scheme/host) — to tune the allowlist
259+
- `a2ui.unknown_component` (type name) - to drive catalog upgrades
260+
- `a2ui.media_blocked` (URL scheme/host) - to tune the allowlist
261261

262262
## 12. Testing
263263

264264
- **Unit:** schema validation, JSON pointer apply, action serialization, component-to-XAML mapping per type.
265-
- **Visual regression:** golden images per component using WinAppDriver or a snapshot harness — gate on hash + tolerance.
265+
- **Visual regression:** golden images per component using WinAppDriver or a snapshot harness - gate on hash + tolerance.
266266
- **Spec conformance:** drive the renderer with the official v0.8 conformance fixtures from `vendor/a2ui/specification/0.8/eval/` (reused from the openclaw monorepo) and assert action outputs match expected.
267267
- **Stress:** 10k component surface, 1k updateComponents/sec → renderer must not block the UI thread > 16 ms p95.
268268
- **Parity:** record the JSONL stream of an existing Lit-rendered openclaw surface, replay through the WinUI renderer, diff screenshots.
@@ -273,22 +273,22 @@ This table is historical. Phases 0-3 are now implemented by the native renderer
273273

274274
| Phase | Scope | Exit criteria |
275275
|---|---|---|
276-
| **0 — Spike** | `Text`, `Column`, `Button` only; one surface; no data model | Single button click round-trips to agent |
277-
| **1 — Catalog parity** | All v0.8 standard catalog types; data model + bindings; modal/tabs | Full conformance fixtures pass |
278-
| **2 — Polish** | Theming, transitions, focus management, accessibility (Narrator), keyboard nav | A11y audit clean; UX review against Lit version |
279-
| **3 — Native default** | Native window default for A2UI rendering | Native path covers the v0.8 surface without the WebView2 host |
280-
| **4 — v0.9 migration** | Bidirectional messages, modular schemas, prompt-first | Tracks Google A2UI v0.9 release |
276+
| **0 - Spike** | `Text`, `Column`, `Button` only; one surface; no data model | Single button click round-trips to agent |
277+
| **1 - Catalog parity** | All v0.8 standard catalog types; data model + bindings; modal/tabs | Full conformance fixtures pass |
278+
| **2 - Polish** | Theming, transitions, focus management, accessibility (Narrator), keyboard nav | A11y audit clean; UX review against Lit version |
279+
| **3 - Native default** | Native window default for A2UI rendering | Native path covers the v0.8 surface without the WebView2 host |
280+
| **4 - v0.9 migration** | Bidirectional messages, modular schemas, prompt-first | Tracks Google A2UI v0.9 release |
281281

282282
## 14. Open questions
283283

284-
> Resolved 2026-04-27 — see decisions below; previous wording preserved for context.
284+
> Resolved 2026-04-27 - see decisions below; previous wording preserved for context.
285285
286286
1. **Window count.** One A2UI window with tabs for multiple surfaces, or one window per surface? Lit version uses one host with multiple stacked surfaces.
287287
**Decision:** stay with the Lit-compatible single-window-with-tabs layout. Multiple windows is out of scope for v1.
288288
2. **Component overrides.** Should we expose a hook for downstream apps to swap in custom renderers?
289-
**Decision:** stay catalog-strict for v1. No extension seam yet — easy to add later if a real customer asks.
289+
**Decision:** stay catalog-strict for v1. No extension seam yet - easy to add later if a real customer asks.
290290
3. **Theme negotiation.** Should the agent be told "I'm a native WinUI client, prefer Fluent tokens" via `clientCapabilities`?
291-
**Decision:** yes — advertise Fluent token preference in `clientCapabilities`. (Tracking task: wire this into the capability summary returned by `canvas.caps`.)
291+
**Decision:** yes - advertise Fluent token preference in `clientCapabilities`. (Tracking task: wire this into the capability summary returned by `canvas.caps`.)
292292
4. **Animation budget.** Define a small transition set (fade, slide) and apply automatically, or stay still?
293293
**Decision:** stay still until the agent asks. No automatic transitions in v1.
294294
5. **Image caching.** Per-surface, per-process, or persistent?

0 commit comments

Comments
 (0)