|
1 | | -# Echo Docs — from-scratch rebuild (Astro, "Terminal" design) |
| 1 | +# Echo Docs — rebuild on Astro Starlight ("Terminal" theme) |
2 | 2 |
|
3 | | -**Date:** 2026-06-14 |
4 | | -**Status:** Design — awaiting review |
5 | | -**Repo:** `labstack/echox` (the docs site lives in `website/`) |
| 3 | +**Date:** 2026-06-14 (rev. 2 — post-review) |
| 4 | +**Status:** Design — hardened after architecture + docs-platform review |
| 5 | +**Repo:** `labstack/echox` (docs site in `website/`), branch `docs-astro-rebuild` |
6 | 6 |
|
7 | 7 | ## 1. Goal |
8 | 8 |
|
9 | | -Replace the current Docusaurus docs site with a custom-built, professional docs |
10 | | -platform that matches the quality and feel of `docs.openclaw.ai`, branded for Echo. |
11 | | -The look kept reading as "default/amateur" because it used generic system-sans on a |
12 | | -cool palette; the new design commits to a **monospace, terminal-precise** aesthetic. |
| 9 | +Replace the current Docusaurus docs with a professional, `docs.openclaw.ai`-grade site |
| 10 | +branded for Echo. The previous attempts read as "default/amateur" because of generic |
| 11 | +system-sans on a cool palette; the new design commits to a **terminal-precise** aesthetic. |
13 | 12 |
|
14 | | -## 2. Locked decisions |
| 13 | +## 2. Locked decisions (rev. 2) |
15 | 14 |
|
16 | | -| Decision | Choice | Why | |
| 15 | +| Decision | Choice | Notes | |
17 | 16 | |---|---|---| |
18 | | -| Build approach | **Astro** (custom, no docs preset) | Total design control like a hand-build, but routing / MDX / i18n / fast builds / image+font optimization come free; stays free & self-hosted. | |
19 | | -| Design direction | **"Terminal"** | Chosen from 3 directions. Closest to OpenClaw, most "Go developer". | |
20 | | -| Body font | **Fragment Mono** (Google) | Exact font OpenClaw declares; the defining trait. | |
21 | | -| Heading font | **DM Sans** 700/800 | Heavy sans against mono body = OpenClaw's contrast. | |
22 | | -| Palette | Warm near-black `#0d0b0b`, warm grays, **Echo cyan `#00AFD1`→`#4AE1FF`** | Cyan pulled from the Echo logo; warm dark from OpenClaw. | |
23 | | -| Theme | **Dark-first**, light theme also shipped | Matches the chosen aesthetic; light is a polished secondary. | |
24 | | -| Content | **Rewritten fresh** | User chose a clean-slate content pass (new IA + new prose), not a Docusaurus auto-port. | |
25 | | -| Coverage goal | **Full** (all guide/cookbook/middleware/API topics) | Sequenced in phases (§8). | |
26 | | - |
27 | | -## 3. Must-have features |
28 | | - |
29 | | -1. **Versioning** — separate docs trees for **v4** and **v5** with a version switcher. |
30 | | -2. **i18n** — locale routing + language switcher (en first; zh-Hans/ja/es/fr scaffolded). |
31 | | -3. **Full-text search** — **Pagefind** (static, free, self-hosted; indexes the built site). |
32 | | -4. **Ask Echo (AI)** — ⌘K command palette with streamed answers + cited sources. UI ships |
33 | | - now; wired to a provider (**kapa.ai** OSS tier or self-hosted Inkeep) via a single |
34 | | - integration point — answers are stubbed until a key is supplied. |
35 | | - |
36 | | -## 4. Architecture (Astro) |
| 17 | +| Platform | **Astro Starlight** (base) + custom Terminal theme | *Changed from full-custom Astro after review.* Starlight gives sidebar, i18n+fallback, Pagefind search, prev/next, TOC, edit links, last-updated, per-page SEO/OG, sitemap, 404, theme toggle, mobile drawer, a11y baseline — we override the theme for the look. Far less to build/own. | |
| 18 | +| Design direction | **Terminal** | Locked via mockups (`refine-terminal.html`, `home.html`). | |
| 19 | +| Fonts | **DM Sans** for prose & headings · **Fragment Mono** for code + UI chrome (nav, sidebar, labels, ⌘K) | *Changed from mono-everywhere* for long-form readability; terminal feel kept in chrome/code. | |
| 20 | +| Palette | warm near-black `#0d0b0b`, warm grays, **Echo cyan** | Cyan from logo; **contrast-tuned** (see §6). | |
| 21 | +| Theme | dark-first + light | Starlight toggle; dark default. | |
| 22 | +| Content | rewritten fresh, **seeded by porting existing pages** | Avoid blank-page risk on 61 existing pages (review). | |
| 23 | +| Launch versioning | **v5 only**; v4 added later via `starlight-versions` | Defers Starlight's one weak area. | |
| 24 | +| Search + Ask Echo | **unified ⌘K** with Search (Pagefind) + Ask tabs | Override Starlight `Search` component. | |
| 25 | +| Deploy | **Cloudflare Pages** (+ `_redirects`) | Fast, Pagefind-friendly, native 301s. | |
| 26 | + |
| 27 | +## 3. What Starlight gives us vs. what we build |
| 28 | + |
| 29 | +- **Starlight (free):** content collections, sidebar config, prev/next, TOC, Pagefind ⌘K, |
| 30 | + i18n routing + en-fallback, per-page `<title>`/description/canonical/OG/Twitter, sitemap, |
| 31 | + `404`, edit-on-GitHub (`editLink`), `lastUpdated` from git, dark/light toggle + persistence, |
| 32 | + mobile drawer, keyboard-accessible nav. |
| 33 | +- **We build/own:** |
| 34 | + 1. **Terminal theme** — `src/styles/terminal.css` (Starlight CSS custom props + targeted |
| 35 | + overrides), Shiki theme JSON, font wiring (DM Sans prose / Fragment Mono chrome+code). |
| 36 | + 2. **Unified ⌘K** — override `components.Search` with `CommandPalette.tsx` (Pagefind tab + Ask tab). |
| 37 | + 3. **Ask Echo** — provider-pluggable island; stub stream now, `askProvider(query, locale)` hook |
| 38 | + for kapa.ai / Inkeep + key later. |
| 39 | + 4. **DocActions** — Copy page / Open in ChatGPT / Open in Claude (Edit + Last-updated already from Starlight). |
| 40 | + 5. **Homepage** — custom `index.astro` (Starlight `splash` template or standalone): split hero |
| 41 | + + code window + stats + feature grid. |
| 42 | + 6. **Redirect map, analytics, contrast/a11y tuning, cutover** (§6, §7). |
| 43 | + |
| 44 | +## 4. Architecture |
37 | 45 |
|
38 | 46 | ``` |
39 | | -website/ # Astro project (replaces Docusaurus) |
40 | | - astro.config.mjs # integrations: mdx, sitemap, pagefind; i18n routing |
| 47 | +website/ |
| 48 | + astro.config.mjs # starlight() integration: title, logo, social, editLink, |
| 49 | + # lastUpdated, sidebar, locales, components overrides, sitemap |
41 | 50 | src/ |
42 | | - content/ |
43 | | - config.ts # content collections schema (docs) |
44 | | - docs/<version>/<locale>/... # MDX content, e.g. docs/v5/en/core/routing.mdx |
45 | | - components/ |
46 | | - Nav.astro Sidebar.astro Toc.astro DocActions.astro |
47 | | - CodeBlock.astro Callout.astro Card.astro VersionSwitcher.astro |
48 | | - LocaleSwitcher.astro AskEcho.tsx Search.astro Hero.astro |
49 | | - layouts/ |
50 | | - Base.astro # <head>, fonts, theme bootstrap, nav, footer |
51 | | - DocLayout.astro # sidebar + content + toc + doc actions |
52 | | - pages/ |
53 | | - index.astro # homepage (hero + features) |
54 | | - [...slug].astro # docs routes from the content collection |
| 51 | + content/docs/ # MDX content (Starlight collection) |
| 52 | + index.mdx # homepage (splash) OR pages/index.astro |
| 53 | + <locale>/core/routing.mdx ... # en authored first |
| 54 | + components/ # Starlight component overrides |
| 55 | + Search.astro # mounts CommandPalette island (unified ⌘K) |
| 56 | + CommandPalette.tsx # island: Search (Pagefind JS API) + Ask Echo tabs |
| 57 | + DocActions.astro # copy / ChatGPT / Claude toolbar (in PageFrame or content) |
55 | 58 | styles/ |
56 | | - tokens.css # design tokens (the design system) |
57 | | - global.css |
58 | | - public/ # logo, favicon, og image |
| 59 | + terminal.css # the design system (tokens + overrides) |
| 60 | + shiki/echo-terminal.json # custom Shiki theme (warm bg, cyan keywords) |
| 61 | + public/ |
| 62 | + logo-*.svg og-*.png robots.txt _redirects # Cloudflare 301 map |
59 | 63 | ``` |
60 | 64 |
|
61 | | -**Design-for-isolation:** each component has one purpose and a clear prop interface — |
62 | | -`Sidebar` (nav tree in → highlighted list out), `Toc` (headings in → list out), |
63 | | -`AskEcho` (self-contained island), `CodeBlock` (lang + code in → highlighted out). The |
64 | | -content collection is the single source of truth; layouts compose components; pages are |
65 | | -thin. Versioning and i18n are expressed in the content path (`docs/<version>/<locale>/…`) |
66 | | -and resolved by `[...slug].astro`, so no component needs to know about them internally. |
67 | | - |
68 | | -## 5. Design system (`tokens.css`) |
69 | | - |
70 | | -- **Type:** `--font-body: "Fragment Mono", ui-monospace, …`; `--font-head: "DM Sans", …`; |
71 | | - base 13.5–14px, line-height 1.7; headings 700/800, tracking −0.02em. |
72 | | -- **Color (dark):** bg `#0d0b0b`, surface `#151210`, line `#221e1c`/`#2d2724`, |
73 | | - text `#aaa19d`, heading `#f4f1ef`, muted `#817a76`, accent `#00afd1`/`#4ae1ff`, |
74 | | - accent-soft `rgba(0,175,209,.12)`. |
75 | | -- **Color (light):** warm paper `#faf8f7`, ink `#1a1614`, accent darkened cyan for contrast. |
76 | | -- **Radius** 9–13px; hairline 1px borders; single soft cyan glow top-right; faint grain. |
77 | | -- **Code:** `#0a0908` bg, cyan keywords, warm strings, muted comments (Shiki theme tuned to match). |
78 | | - |
79 | | -## 6. Information architecture |
80 | | - |
81 | | -- **Top nav:** logo + `v5` version pill, primary links (Guide, Cookbook, Middleware, API), |
82 | | - prominent **Search ⌘K**, locale switcher, GitHub. |
83 | | -- **Sidebar:** sectioned (Getting Started / Core / Guides / …), mono uppercase captions, |
84 | | - cyan active pill with left bar. |
85 | | -- **Doc page:** breadcrumb → H1 → **DocActions** (Ask Echo / Copy / ChatGPT / Claude) → |
86 | | - content (MDX) → right-hand **On this page** TOC. Floating **Ask Echo ⌘K** launcher. |
87 | | -- **Homepage:** split hero (headline + CTAs + `go get` line beside a code terminal window), |
88 | | - stat strip, "Why Echo" feature grid, footer. Hero = **split-with-code** variant; feature |
89 | | - icons = **Phosphor** (consistency). (Both adjustable.) |
90 | | - |
91 | | -## 7. Feature design detail |
92 | | - |
93 | | -- **Versioning:** content keyed by version dir; default version = latest (v5). Version |
94 | | - switcher rewrites the path to the same page in the other version (fallback to that |
95 | | - version's index if the page doesn't exist). v4 is LTS until 2026-12-31. |
96 | | -- **i18n:** Astro i18n routing; locale dir under each version; `LocaleSwitcher` swaps the |
97 | | - locale segment; untranslated pages fall back to `en`. |
98 | | -- **Search:** Pagefind runs as a post-build step over `dist/`; `Search.astro` mounts the |
99 | | - Pagefind UI behind the ⌘K shortcut (separate from Ask Echo, or unified — see open Qs). |
100 | | -- **Ask Echo:** `AskEcho.tsx` island; ⌘K + floating launcher; streamed answer + sources. |
101 | | - Integration point: `askProvider(query) -> stream` — swap the stub for kapa.ai/Inkeep |
102 | | - with one function + an API key. Answers honor the active locale. |
103 | | - |
104 | | -## 8. Implementation phasing (within the full-coverage goal) |
105 | | - |
106 | | -- **Phase 1 — Platform + design system + slice.** Astro scaffold, `tokens.css`, Base/Doc |
107 | | - layouts, Nav/Sidebar/Toc/DocActions/CodeBlock/Callout/Card, homepage, and a |
108 | | - representative content slice (Quickstart, Routing w/ code, one nested page). Dark+light. |
109 | | - *This is the first implementation plan.* |
110 | | -- **Phase 2 — Content.** Author the full docs set fresh (Guide, Core, Cookbook, |
111 | | - Middleware, API) as MDX in the collection. |
112 | | -- **Phase 3 — Features.** Versioning (v4/v5), i18n locales, Pagefind search, Ask Echo |
113 | | - provider wiring, deploy pipeline (GitHub/Cloudflare Pages), redirects from old URLs. |
114 | | - |
115 | | -## 9. Out of scope (now) |
116 | | - |
117 | | -- Live AI backend account/keys (UI + integration point only). |
118 | | -- Full translations (locale scaffolding only; en authored). |
119 | | -- Marketing pages beyond the homepage. |
120 | | - |
121 | | -## 10. Risks / notes |
122 | | - |
123 | | -- **Content rewrite is the largest cost** — it's a writing effort independent of the |
124 | | - platform; Phase 2 may itself need decomposition by section. |
125 | | -- Old URL structure must be preserved via redirects (Docusaurus had `/guide`, `/cookbook`, |
126 | | - `/middleware` aliases) to avoid breaking inbound links and SEO. |
127 | | -- `onBrokenLinks`-style checking must be re-established in the Astro build. |
128 | | - |
129 | | -## 11. Open questions (with my recommended default) |
130 | | - |
131 | | -1. Search & Ask Echo — **recommend: one ⌘K** with tabs (Search | Ask Echo); single, |
132 | | - familiar entry point. Alt: two separate launchers. |
133 | | -2. Versioning at launch — **recommend: v5-only first**, add v4 in Phase 3 (don't block the |
134 | | - rebuild on porting v4 content). Alt: both from day one. |
135 | | -3. Deploy target — **recommend: Cloudflare Pages** (fast, Pagefind-friendly) with redirects |
136 | | - from the old paths. Alt: stay on GitHub Pages. |
137 | | - |
138 | | -Defaults above are assumed unless you say otherwise. |
| 65 | +**Isolation:** the theme is pure CSS over Starlight's documented custom properties → no fork |
| 66 | +of Starlight internals; only two component overrides (`Search`, optionally `Head`/`PageFrame` |
| 67 | +for DocActions). `CommandPalette.tsx` and `AskEcho` logic are self-contained islands. Content |
| 68 | +is the single source of truth; everything else is configuration + theme. |
| 69 | + |
| 70 | +## 5. Design system (`terminal.css`) |
| 71 | + |
| 72 | +- **Fonts:** `--sl-font: "DM Sans", ui-sans-serif, system-ui, sans-serif` (prose+headings); |
| 73 | + `--sl-font-mono: "Fragment Mono", ui-monospace, SFMono-Regular, Menlo, monospace` (code). |
| 74 | + Apply Fragment Mono to UI chrome (`.sidebar`, site nav, `.sl-markdown-content` inline UI, |
| 75 | + labels, ⌘K) via targeted selectors. **Self-host both fonts** (woff2, subset), `font-display:swap`, |
| 76 | + `preload` the prose font (FOUT fix). |
| 77 | +- **Color (dark):** bg `#0d0b0b`, surface `#151210`, line `#221e1c`/`#2d2724`, text `#aaa19d`, |
| 78 | + heading `#f4f1ef`, muted `#817a76`. Map to Starlight `--sl-color-*`. |
| 79 | +- **Accent (contrast-tuned):** use brighter cyan **`#33c9e6`** for small text/links on dark |
| 80 | + (≥ ~7:1) and reserve `#00afd1`→`#4ae1ff` for fills/large/decorative — fixes the ~5.9:1 issue. |
| 81 | +- Light theme: warm paper `#faf8f7`, ink `#1a1614`, darker cyan for AA. |
| 82 | +- Radius 9–13px; hairline borders; one soft cyan glow; faint grain (disabled under |
| 83 | + `prefers-reduced-motion`). |
| 84 | + |
| 85 | +## 6. Production / launch requirements (added per review) |
| 86 | + |
| 87 | +- **SEO:** rely on Starlight per-page title/description/canonical/OG; ensure every MDX has |
| 88 | + `title` + `description` frontmatter. Add **JSON-LD** (`TechArticle` + `BreadcrumbList`) and |
| 89 | + `public/robots.txt` → sitemap. Set **v5 as `rel=canonical`** version. |
| 90 | +- **Redirects (deliverable):** crawl the live site, produce an explicit **old→new 301 table** |
| 91 | + in `public/_redirects`. Cover the 3 alias families (`/guide`, `/cookbook`, `/middleware`), |
| 92 | + the one-off redirects, and any old slug with no 1:1 new home (resolve each). No silent drops. |
| 93 | +- **Analytics:** carry over **GA4 `G-H19TMZLQFN`** (anonymizeIP) via Starlight `head` inject; |
| 94 | + confirm whether to keep or replace. |
| 95 | +- **Broken-link gate:** CI step (`lychee`/`astro-broken-link-checker`) that **fails the build**, |
| 96 | + matching the old `onBrokenLinks: throw`. |
| 97 | +- **Accessibility:** WCAG-AA contrast audit of every token pair; `:focus-visible` rings; |
| 98 | + `prefers-reduced-motion` disables glow/grain; the ⌘K palette uses an accessible |
| 99 | + combobox pattern (focus trap, `aria-activedescendant`, SR announcements). |
| 100 | +- **Responsive:** Starlight handles sidebar/TOC drawers; we ensure the **homepage hero stacks** |
| 101 | + (terminal window below headline) on mobile. |
| 102 | +- **i18n realism:** keep non-en locales **behind a flag** until real translations exist; add |
| 103 | + `hreflang` + `x-default` when they ship; Ask Echo answers carry a `locale` param with an |
| 104 | + "answers in English" note where the provider lacks localization. |
| 105 | +- **CodeBlock features:** copy button, language label, filename, line-highlighting, and |
| 106 | + tabbed examples (Starlight Expressive-Code or our wrapper). |
| 107 | + |
| 108 | +## 7. Implementation phasing |
| 109 | + |
| 110 | +- **Phase 1 — Platform + theme + slice (first plan).** Starlight scaffold in `website/` |
| 111 | + (replacing Docusaurus), `terminal.css` design system + Shiki theme + self-hosted fonts, |
| 112 | + `Search`→`CommandPalette` override with Ask Echo island (stubbed), `DocActions`, custom |
| 113 | + **homepage**, contrast/a11y tokens, and a real **content slice** (Quickstart, Routing w/ code, |
| 114 | + one nested page). Final `/...` URL/Pagefind/i18n config in place. Dark+light. Shippable to a |
| 115 | + **preview** subdomain. |
| 116 | +- **Phase 2 — Content.** Author full v5/en docs (Guide, Core, Cookbook, Middleware, API), |
| 117 | + seeded by porting+editing existing pages. Site is launch-ready at completion. |
| 118 | +- **Phase 3 — Versioning + locales + cutover.** `starlight-versions` for v4, enable locales + |
| 119 | + translations, finalize `_redirects`, GA, JSON-LD, broken-link CI, **cutover runbook** |
| 120 | + (preview → verify redirects/SEO/search → domain swap on `echo.labstack.com` → keep old |
| 121 | + Docusaurus deployable ~2 weeks for rollback). |
| 122 | + |
| 123 | +## 8. Out of scope (now) |
| 124 | + |
| 125 | +Live AI provider keys (UI + hook only); real translations (scaffold only); marketing pages |
| 126 | +beyond the homepage; v4 content (Phase 3). |
| 127 | + |
| 128 | +## 9. Risks |
| 129 | + |
| 130 | +- **Content rewrite is the largest cost** (61 pages × locales) — Phase 2 may need its own |
| 131 | + decomposition; mitigate by porting existing prose rather than blank-page rewriting. |
| 132 | +- **Starlight theming ceiling:** the Terminal look must be achievable via custom props + |
| 133 | + light component overrides; if a surface resists theming, prefer a small component override |
| 134 | + over forking Starlight. (Low risk — the look was already achieved via CSS on Docusaurus.) |
| 135 | +- **`starlight-versions` maturity** for v4 in Phase 3 — re-evaluate at that point; v5-only |
| 136 | + launch de-risks it. |
0 commit comments