docs site: Plan 2 (structure and components)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+297
−1
docs/superpowers/plans/2026-11-06-docs-site-2-structure-and-components.md+296 −0docs/superpowers/plans/2026-11-06-docs-site-index.md+1 −1
CI failed — run details
Intent
Human
Ok, and make sure that the "X" in Search actually dismisses the search. Proceed and build!
diff --git a/docs/superpowers/plans/2026-11-06-docs-site-2-structure-and-components.md b/docs/superpowers/plans/2026-11-06-docs-site-2-structure-and-components.md| new file mode 100644 |
| index 000000000..5f1ddf60a |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-11-06-docs-site-2-structure-and-components.md |
| @@ -0,0 +1,296 @@ |
| +# Docs site Plan 2: structure and components |
| + |
| +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. |
| + |
| +**Goal:** Turn the live `/docs` into the shape Paul approved in the mockup: |
| +a hard-left nav with a fixed head and search, an "On this page" rail, a |
| +search dialog over a build-time index, diagram and step-through components |
| +that docs pages can use, and the nav regrouped into the spec's sections. |
| + |
| +**Architecture:** The platform repo keeps owning the corpus (`docs/site`) |
| +and its gates (`internal/docsite`): it gains two fence kinds, `diagram` and |
| +`stepper`, whose SVGs live in `docs/site/diagrams/`. The website renders |
| +them with a markdown-it fence rule, inlining each SVG so it takes the |
| +site's colours, and ports the mockup's layout, `nav.js`, `search.js` and |
| +`stepper.js` into the real docs templates. Everything works without |
| +JavaScript; scripts only enhance (spec D4). |
| + |
| +**Tech Stack:** Go (`internal/docsite` gates); Eleventy 3, markdown-it, |
| +Nunjucks; vanilla JavaScript, no dependencies; headless Chromium over CDP |
| +for browser checks (the mockup's `probe.mjs`). |
| + |
| +**Spec:** `docs/superpowers/specs/2026-11-06-docs-site-design.md`. |
| +**Mockup review:** `docs/superpowers/notes/2026-11-06-docs-mockup-review.md` |
| +(binding for layout). Index: `docs/superpowers/plans/2026-11-06-docs-site-index.md`. |
| + |
| +## Global Constraints |
| + |
| +- JavaScript only as progressive enhancement (D4): every page works, reads |
| + and navigates with scripting off. |
| +- The nav (mockup review): pinned hard-left on wide screens, full height, a |
| + fixed head (docs title and search) over a list that scrolls on its own; |
| + scrollbar gutter always reserved; the list keeps its scroll position |
| + between pages; section headings line up with the title. |
| +- Search (mockup review): a button-like box with an icon, the label and a |
| + `/` hint; click or `/` opens a dialog over the page without moving it; |
| + typing filters; Enter opens the first result; one Escape, a click outside |
| + or the one close button closes it; the field is `type="text" |
| + role="searchbox"` so the browser adds no clear button. Without |
| + JavaScript the box links to the page index on `/docs/`. |
| +- Copy: house voice, no em dashes, neutral examples. New user-facing |
| + strings go through a Luna pass against the house rules (D8), then are |
| + applied verbatim. Code, commands and SVG labels inside diagrams are |
| + strings too when a person reads them. |
| +- Docs follow the stable release (spec §4): the platform half of this plan |
| + goes live at the next release's step 10a sync. The website half ships |
| + when its PR merges and must render today's `nav.json` correctly. |
| +- Shared machine: any local server binds `127.0.0.1`; stop it after. |
| + Scratch under `$TMPDIR` or `~/.cache`. |
| +- Repos: platform = this worktree (branch `design-docs-site`); website = |
| + `/home/paulca/amadan.net/carlos/website`, branch `docs-site-2` in |
| + `.claude/worktrees/docs-site-2`. |
| + |
| +## Review Focus |
| + |
| +1. **A page with no `##` headings.** The "On this page" rail is absent, not |
| + an empty box. Pinned in Task 4. |
| +2. **A diagram fence naming an SVG that does not exist, or a stepper with |
| + one frame.** The platform gate fails naming the page and line; the |
| + website build fails too rather than rendering a broken figure. Pinned in |
| + Tasks 2 and 3. |
| +3. **An SVG with a `<script>` or an `on*=` attribute.** Refused by the |
| + platform gate, since the website inlines SVGs into the page. Pinned in |
| + Task 2. |
| +4. **Search with an empty index or no match.** The dialog says no page |
| + matches; Enter does nothing. Pinned in Task 5. |
| +5. **Narrow screens (390px).** Diagrams scroll sideways inside their own |
| + box at a readable size instead of shrinking; the nav collapses to one |
| + row; nothing scrolls the page sideways. Pinned in Tasks 3 and 4. |
| + |
| +--- |
| + |
| +### Task 1: The copy deck, with a Luna pass |
| + |
| +**Files:** |
| +- Create: `docs/superpowers/plans/2026-11-06-docs-site-2-copy.md` |
| + |
| +**Interfaces:** |
| +- Produces: approved rows `DS2-C01`.. that Tasks 4 to 6 apply verbatim. |
| + |
| +- [ ] **Step 1: Draft every new user-facing string as a row** (`| id | where | text | status |`, status `pending`): |
| + nav section titles (Tutorials, Guides, CLI reference, API reference) and |
| + the Changelog link; the search box label, its `/` hint's accessible |
| + name, the dialog's field label and placeholder, the close button's |
| + accessible name, the no-match line, the hint line; the "On this page" |
| + rail heading; the page index heading and its one-line intro; the `api` |
| + page (title, two short paragraphs: the public API is being designed, and |
| + until then the CLI does everything, linking `/docs/cli/`); the rewritten |
| + `docs/site/index.md` intro (it must stop saying the pages "are not a |
| + tutorial"); the nav blurbs for every page whose section changes. |
| +- [ ] **Step 2: Run the Luna pass.** `codex exec -m gpt-5.6-luna` with a |
| + brief carrying the house rules (plain, short sentences, no em dashes, |
| + lower-case after a full stop only where the house style does, neutral |
| + examples), answering a key/new/why table plus flags. Apply its changes |
| + unless they change a fact; check every rewrite against the sources. |
| +- [ ] **Step 3: Mark rows approved by delegation**, with a note naming the |
| + Luna pass and listing anything flagged for Paul. Commit: |
| + `git commit -m "docs site plan 2: copy deck (Luna pass)"`. |
| + |
| +--- |
| + |
| +### Task 2: Diagram and stepper fences in the platform gate |
| + |
| +**Files:** |
| +- Create: `internal/docsite/diagrams.go` |
| +- Create: `internal/docsite/diagrams_test.go` |
| +- Create: `internal/docsite/testdata/diagrams/` (fixture pages and SVGs) |
| +- `docs/site/diagrams/` holds the SVGs. It stays empty until Plan 4's |
| + first diagram; `CheckDiagrams` and the website sync treat a missing |
| + directory as empty. (Never put Markdown in it: it would become a page.) |
| +- Modify: `internal/docsite/fences_test.go` (`knownFenceLangs` gains |
| + `diagram` and `stepper`) |
| + |
| +**Interfaces:** |
| +- Produces, in Go: |
| + - `type Figure struct { File, Caption string }` |
| + - `type Diagram struct { Page string; Line int; Kind string /* "diagram" or "stepper" */; Title string; Frames []Figure }` |
| + - `func ParseDiagramFence(kind, body string) (Diagram, error)` |
| + - `func CheckDiagrams(site *Site, dir string) []string` (problems, each |
| + naming page and line) |
| +- Produces, for the website (Task 3), the fence formats: |
| + - ```` ```diagram ```` body: first line `file: <name>.svg`, the rest is |
| + the caption (one or more lines, non-empty). |
| + - ```` ```stepper ```` body: first line `title: <text>`, then two or |
| + more frames, each a line `frame: <name>.svg` followed by its caption |
| + lines (non-empty). |
| + - SVG names match `^[a-z0-9][a-z0-9-]*\.svg$` and resolve under |
| + `docs/site/diagrams/`. |
| + |
| +- [ ] **Step 1: Write the failing tests** in `diagrams_test.go`: |
| + `TestParseDiagramFence` (a diagram; a 3-frame stepper; refusals for a |
| + missing `file:`, an empty caption, a stepper with 1 frame, a bad name like |
| + `../x.svg` or `X.SVG`); `TestCheckDiagramsFindsMissingFiles`; |
| + `TestCheckDiagramsRefusesActiveSVG` (an SVG with `<script`, an |
| + `onload=`, or an `href="javascript:`, each refused naming the file); |
| + `TestCheckDiagramsOnTheRealCorpus` (no problems in `docs/site`). |
| +- [ ] **Step 2: Run and watch them fail.** |
| + `go test ./internal/docsite/ -run 'Diagram' -count=1` → FAIL, undefined |
| + `ParseDiagramFence`. |
| +- [ ] **Step 3: Implement** `ParseDiagramFence` and `CheckDiagrams`, reading |
| + fences from `Page.Fences` (already parsed). Add the two languages to |
| + `knownFenceLangs`. |
| +- [ ] **Step 4: Run** `go test ./internal/docsite/ -count=1` → PASS. |
| +- [ ] **Step 5: Commit** `docsite: diagram and stepper fences, gated`. |
| + |
| +--- |
| + |
| +### Task 3: Render diagrams and steppers on the website |
| + |
| +**Files** (website, `docs-site-2`): |
| +- Create: `hack/docs-markdown.mjs` (the configured markdown-it instance and |
| + the fence rule, imported by `eleventy.config.js` and by the test) |
| +- Create: `hack/test-docs-markdown.mjs` |
| +- Create: `src/docs-stepper.js` (from `mockups/docs-site/stepper.js`) |
| +- Modify: `eleventy.config.js` (use `hack/docs-markdown.mjs`; passthrough |
| + `src/docs-stepper.js`) |
| +- Modify: `hack/sync-docs.mjs` (copy `docs/site/diagrams/*.svg` to |
| + `src/docs/diagrams/`, and check them in `--check`) |
| +- Modify: `src/docs.css` (diagram and stepper styles from |
| + `mockups/docs-site/mockup.css`, including print, reduced motion, and the |
| + narrow-screen rule below) |
| +- Modify: `package.json` (`check` also runs `node hack/test-docs-markdown.mjs`) |
| + |
| +**Interfaces:** |
| +- Consumes: Task 2's fence formats. |
| +- Produces: `renderDocsMarkdown(src: string, opts: { diagramsDir: string }): string` |
| + and the HTML contract the mockup fixed: `<figure class="diagram">` with |
| + the inlined `<svg>` and a `<figcaption>`; `<section class="stepper |
| + diagram" aria-label="<title>"><ol class="frames"><li class="frame"> |
| + <figure>…<figcaption>…</figcaption></figure></li>…</ol></section>`. |
| + |
| +- [ ] **Step 1: Write the failing test** `hack/test-docs-markdown.mjs`: |
| + renders a fixture with one diagram and one 3-frame stepper from a temp |
| + diagrams dir and asserts the contract above (inlined `<svg`, never |
| + `<img`; 3 `li.frame`; captions present; `aria-label` equals the title); |
| + asserts a missing SVG throws naming the file; asserts an SVG holding |
| + `<script` throws. |
| +- [ ] **Step 2: Run** `node hack/test-docs-markdown.mjs` → FAIL (module missing). |
| +- [ ] **Step 3: Implement** the module and wire it into the config. The |
| + narrow-screen rule: below `30rem` a diagram's SVG keeps `min-width: |
| + 36rem` inside a container with `overflow-x: auto`, so it scrolls in its |
| + own box at a readable size. |
| +- [ ] **Step 4: Run** the test → PASS; `npm run check` → PASS. |
| +- [ ] **Step 5: Commit** `Docs: render diagram and stepper fences`. |
| + |
| +--- |
| + |
| +### Task 4: The docs layout from the mockup |
| + |
| +**Files** (website, `docs-site-2`): |
| +- Modify: `src/_includes/docs.njk` (nav head with title and search; the |
| + scrolling `nav-groups` list; the Changelog link; the "On this page" rail; |
| + script tags for `docs-nav.js`, `docs-search.js` and `docs-stepper.js`, |
| + all `defer`) |
| +- Modify: `src/docs.css` (port the mockup's hard-left nav, nav head, |
| + search box, scrollbar gutter, logo alignment, heading alignment and |
| + narrow-screen collapse) |
| +- Create: `src/docs-nav.js` (from `mockups/docs-site/nav.js`) |
| +- Create: `hack/probe-docs.mjs` (the mockup's `probe.mjs`, pointed at the |
| + built `_site` served on `127.0.0.1`) |
| +- Modify: `eleventy.config.js` (passthrough the new scripts) |
| + |
| +**Interfaces:** |
| +- Consumes: the copy rows for the nav head, Changelog link and rail heading. |
| +- Produces: the rail markup `<aside class="docs-toc" aria-label="On this page">` |
| + listing the page's `##` headings, shown at `min-width: 75rem`; the |
| + sidebar's per-page sub-list is removed (the rail replaces it). |
| + |
| +- [ ] **Step 1: Port the probe and run it against today's built site** → |
| + the layout checks FAIL (nav not flush left, search scrolls with the nav, |
| + no rail). |
| +- [ ] **Step 2: Implement** the template and CSS changes. |
| +- [ ] **Step 3: Add the rail checks**: a page with headings shows the rail |
| + at 1440 wide and lists them in order; a page with no `##` headings has no |
| + `.docs-toc` element at all; the rail is hidden below 75rem. |
| +- [ ] **Step 4: Run** `npm run check` and `node hack/probe-docs.mjs` → all |
| + PASS, with scripting on and off, reduced motion, print and 390px. |
| +- [ ] **Step 5: Commit** `Docs: hard-left nav, fixed search head, On this page rail`. |
| + |
| +--- |
| + |
| +### Task 5: Search over a build-time index |
| + |
| +**Files** (website, `docs-site-2`): |
| +- Create: `src/docs-search-index.njk` (permalink `/docs/search-index.json`: |
| + one entry per page with `title`, `section`, `url`, `headings` (`##` and |
| + `###` text with anchors) and `text` (the page's prose, markdown stripped, |
| + at most 2,000 characters)) |
| +- Create: `src/docs-search.js` (from `mockups/docs-site/search.js`, now |
| + fetching the index on first open and matching title, headings and text; |
| + a heading match links to `url#anchor`) |
| +- Modify: `src/docs-index.njk` (the page index: every page, A to Z, under |
| + the approved heading) |
| + |
| +**Interfaces:** |
| +- Consumes: the copy rows for search and the page index. |
| +- Produces: `/docs/search-index.json` (a JSON array as above). |
| + |
| +- [ ] **Step 1: Write the failing probe checks**: the index exists and |
| + lists every page in `docsnav.json`; typing a word that appears only in a |
| + page's body (pick one at test time from the index's `text`) returns that |
| + page; typing a heading returns `url#anchor`; no match shows the approved |
| + no-match line and Enter does nothing; the page does not move on open; |
| + the close button, Escape and a click outside each close it; with |
| + scripting off the box goes to `/docs/#` + the page index anchor and that |
| + list holds every page. |
| +- [ ] **Step 2: Run** → FAIL. |
| +- [ ] **Step 3: Implement.** Rank title matches above heading matches above |
| + text matches; show at most 10. |
| +- [ ] **Step 4: Run** `npm run check` and the probe → PASS. |
| +- [ ] **Step 5: Commit** `Docs: search over a build-time index`. |
| + |
| +--- |
| + |
| +### Task 6: Regroup the nav and add the API page (platform) |
| + |
| +**Files** (platform): |
| +- Modify: `docs/site/nav.json` |
| +- Create: `docs/site/api.md` |
| +- Modify: `docs/site/index.md` (the approved intro) |
| + |
| +**Interfaces:** |
| +- Consumes: the copy rows for section titles, blurbs, the API page and the |
| + index intro. |
| +- Produces: `nav.json` sections in this order: **Tutorials** (`rails`, |
| + `laravel-and-django`), **Guides** (`rootfs`, `pdfs`, `scan-callbacks`, |
| + `domains-buying`, `rate-limits`, `plans`), **CLI reference** (`cli`), |
| + **API reference** (`api`). Slugs do not change, so no page moves and no |
| + link breaks. Start here and Operating a deployment are added by Plans 4 |
| + and 5 with their first pages; an empty section is never shown. |
| + |
| +- [ ] **Step 1: Write the failing test** in `internal/docsite/nav_test.go`: |
| + `TestNavSectionsInSpecOrder` asserts every section title is one of the |
| + spec's (Start here, Tutorials, Guides, Operating a deployment, CLI |
| + reference, API reference), that they appear in that order (some may be |
| + missing), and that no section is empty. |
| +- [ ] **Step 2: Run** `go test ./internal/docsite/ -run TestNavSections -count=1` → FAIL. |
| +- [ ] **Step 3: Edit** `nav.json`, add `api.md`, rewrite the `index.md` intro. |
| +- [ ] **Step 4: Run** `go test ./internal/docsite/ -count=1` → PASS; then, |
| + in the website worktree, `node hack/sync-docs.mjs <this worktree>` and |
| + `npm run check` → PASS, and the probe → PASS against the regrouped nav. |
| + Revert the sync in the website worktree afterwards: the website takes |
| + the platform docs only at a release (step 10a). |
| +- [ ] **Step 5: Commit** `docs: regroup the nav into the docs site sections; API page`. |
| + |
| +--- |
| + |
| +### Task 7: Ship the website half |
| + |
| +- [ ] **Step 1:** Push `docs-site-2`, open the website PR, merge it with |
| + `gh pr merge --squash` (Paul's "proceed and build", 2026-11-06). |
| +- [ ] **Step 2:** Deploy from a clean export as the website's `AGENTS.md` |
| + "Deploying" section says, recording the previous version first. |
| +- [ ] **Step 3:** Check `X-Carlos-Version` on all three hosts, then run |
| + `node hack/probe-docs.mjs https://carlosframework.com` against the live |
| + site → PASS. |
| +- [ ] **Step 4:** Record the result in the ledger and stop any local server. |
diff --git a/docs/superpowers/plans/2026-11-06-docs-site-index.md b/docs/superpowers/plans/2026-11-06-docs-site-index.md| index 6e36c2bb3..2f019374f 100644 |
| --- a/docs/superpowers/plans/2026-11-06-docs-site-index.md |
| +++ b/docs/superpowers/plans/2026-11-06-docs-site-index.md |
| @@ -7,7 +7,7 @@ The spec is several projects in one: site foundations, the Start here |
| content, the tutorials (each with its own example app), the guides, and the |
| CLI reference. Each plan below produces something shippable on its own. |
| -Only Plan 1 is written in full. Paul reviews a clickable mockup at the end of |
| +Plans 1 and 2 are written in full (Plan 1 done 2026-11-06). Paul reviews a clickable mockup at the end of |
| its Task 1, and that review decides the layouts the later plans build. Each |
| later plan is written when the one before it lands, from the spec plus the |
| mockup review notes (`docs/superpowers/notes/2026-11-06-docs-mockup-review.md`, |