Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions context/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ stable version has been published.
an npm credential. The called workflow builds the release commit, the one `v<version>` tags. It is skipped when
`publish` is. It can also be run by hand (`workflow_dispatch`), from `main` only: `site` carries
`if: github.ref == 'refs/heads/main'` (#243), so a run from any other ref skips both jobs and deploys nothing. Two jobs. `site` tests, builds `docs/dist`, audits it (`pnpm docs:audit-dist`), copies it to
`docs/.deploy/worktree/` and runs `wrangler deploy` with `docs/wrangler.jsonc` (a Worker with static assets and no
script, on the Route `northguild.dev/worktree*`), then runs `docs/scripts/deploy-smoke.mjs` against the live URL,
retrying for route propagation. `legacy-pages` runs only after `site` is green and publishes the generated
`docs/.deploy/worktree/` (with `docs/deploy/_headers` at `docs/.deploy/_headers`: a year's `immutable` caching for `_astro/*`, `noindex` for `*.txt`) and runs `wrangler deploy` with `docs/wrangler.jsonc` (a Worker with static assets and no
script, on the Route `northguild.dev/worktree*`), then runs `docs/scripts/deploy-smoke.mjs` against the live URL
(routes, and the three header rows), retrying for route propagation. `legacy-pages` runs only after `site` is green and publishes the generated
`docs/legacy/` bundle to GitHub Pages: `schema/v1.json` plus a redirect stub per old route. The old Pages site is
that bundle and nothing else. **Seen green in this shape once, from a push**: run 41910362381 on `main`
(2026-11-04, c0cc821), `site` and `legacy-pages` both `success`. **Never yet run from `publish.yml`**: the
Expand Down
2 changes: 1 addition & 1 deletion context/stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ docs/ Astro 7 + Starlight docs site, React 19 islands, Base UI;
docs/src/content/docs/ Starlight pages (28 pages: `index.mdx` is the landing at `/worktree/`, `getting-started.mdx` is Getting Started at `/worktree/getting-started/`, plus `commands/` (9 command pages and an index), `guides/` (11 guides and an index), `configuration`, `project-configuration`, `faq` and `changelog`)
docs/src/ chat client, site metadata, styles; the chat is the page `/dox` (`pages/dox.astro`, one React island, `chat/components/DoxPage.tsx`), reached by plain links only: the header's "Chat with Dox" crystal (`components/Header.astro`, repeated in the mobile menu by `components/MobileMenuFooter.astro`) and the landing's "Ask Dox" (`components/Hero.astro`); `components/DoxMark.astro` draws the crystal, and no page but `/dox` loads chat code; `components/Hero.astro` puts the landing's copy beside `HeroLeaves.astro` (the leaf-particle hero: a still SVG, a canvas and a small loader script; the effect itself, in `hero/` with OGL, is a chunk only the loader's dynamic `import()` reaches, so the landing alone ships hero script; its CSS is in the shared stylesheet)
docs/src/styles/northguild/ the NorthGuild theme, vendored unedited from `northguild/northguild.dev` `packages/theme/` (each file's header names the commit); `docs/src/styles/theme.css` is this site's own `--gmt-*` → `--sl-*` mapping. To refresh, see `docs/README.md` (Theme)
docs/wrangler.jsonc the docs site's Worker config (assets from `docs/.deploy`, the build staged under `worktree/` by `stage:deploy`); `docs/scripts/` holds `audit-dist.mjs`, `theme-contrast.mjs` (measures the theme's contrast pairs), `build-legacy-pages.mjs` (writes the gitignored `docs/legacy/`) and `deploy-smoke.mjs`
docs/wrangler.jsonc the docs site's Worker config (assets from `docs/.deploy`, the build staged under `worktree/` and `docs/deploy/_headers` at its root by `stage:deploy`); `docs/scripts/` holds `audit-dist.mjs`, `theme-contrast.mjs` (measures the theme's contrast pairs), `build-legacy-pages.mjs` (writes the gitignored `docs/legacy/`), `deploy-smoke.mjs` and `web-vitals.mjs` (measures Core Web Vitals by hand, not a gate)
docs/worker/ Cloudflare Worker for the docs chat, on TanStack AI: `POST /api/chat` serves the current client, `GET /api/brains` the usage counts, `POST /` the frozen legacy protocol (its own `wrangler.toml`, which binds `[ai]`, remote in dev, for the Workers AI brains, and the `DOX_USAGE` KV namespace for the usage ledger)
context/ planning-workflow artifacts (this directory)
context7.json what Context7 (context7.com) may index from this repo: the user docs, the usage skill and the README — see Documentation below
Expand Down
13 changes: 12 additions & 1 deletion context/verify.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ twice on a page; across the site, a sitemap and an `llms.txt` (llmstxt.org forma
URLs, a `404.html` (with the site's search, a link to Getting Started at `/worktree/getting-started/`, and no canonical link or JSON-LD), a landing at the root (a heading, a "Get started" link to `/worktree/getting-started/`, one "Ask Dox" link to `/worktree/dox/` and no "Ask Dox" button, no second action and no section below the hero; the root alone may carry the site default description), and no `shuding/nextra` string. The date rule is only meaningful on
full git history (CI uses `fetch-depth: 0`): on a shallow clone Starlight and the oracle both read the same truncated log. A page whose source file has no commit yet (a new or just-renamed one) fails the date rule with "no git history", so run the audit after committing it. It prints every failed rule, one line each, and
exits 1 on any. To run it by hand: `pnpm docs:build && pnpm docs:audit-dist`, or point it at another build with
`node docs/scripts/audit-dist.mjs <dir>`. It also checks accessible names on every page and the 404 (each button named, a name beside visible text containing it, each `<select>` labelled, the search button) and that the built CSS gives `[role=tab]` a minimum height of at least 44px; the search *input* is made in the browser and is checked there.
`node docs/scripts/audit-dist.mjs <dir>`. It also checks accessible names on every page and the 404 (each button named, a name beside visible text containing it, each `<select>` labelled, the search button) and that the built CSS gives `[role=tab]` a minimum height of at least 44px; the search *input* is made in the browser and is checked there. Every file under `dist/_astro/` must carry a hash of five or more characters in its name (`name.hash.ext`), because `docs/deploy/_headers` serves that folder `immutable` for a year; the failure names the file.
#287 Phase 3 (2026-11-08) added: in `llms.txt` the changelog alone sits under `## Optional` and the other 27 pages under `## Documentation`; on each of the 28 pages exactly one `<link rel="describedby" type="text/plain" href="https://northguild.dev/worktree/llms.txt">` whose target is a file in the build, and none on `404.html`.
#287 Phase 4 (2026-11-08) added: every built `index.html` and `404.html` must be at most 1,048,576 bytes on disk (Apple TN3156 limits a link preview's main resource to "1 MB", read as 1 MiB); the failure names the page and its size in bytes.
Phase 13 added: on every page and the 404, the header's two NorthGuild links (`https://northguild.dev/` reading "NorthGuild", `/worktree/` reading
"worktree"), each named by its own visible text, and the GitHub and Discord links (new tab, `rel=noopener`, "(opens in a new tab)" in the name); every `<svg>`
hidden or a named image; the 404's heading a git error line (`fatal: ...`); and no cyan: it reads the `--gmt-cyan*` variables and their literal colours
Expand All @@ -131,6 +133,7 @@ Added 2026-11-06 for #266, on every page and the 404: each `starlight-theme-sele
and the theme provider's script (the override, not Starlight's, reading the `starlight-theme` key) inline in `<head>`; `theme-contrast.mjs` also measures the toggle's icon beside the GitHub and Discord icons.
Added 2026-11-06 for #266, on every page and the 404: in the built `<header>` the theme toggle (the header's own, not the mobile menu's) comes before the GitHub link, which comes before the Discord link.
Added 2026-11-06 for #266, the landing header's entrance: in the built `<header>`, the entrance marker (`data-landing-entrance`) is on the landing's alone (not any other page's, nor the 404's), and the landing's header holds the internal-arrival script inline (no `src`, reading `document.referrer` and setting `data-entrance-off`); in the built CSS (stylesheets and `<style>`) the `header-entrance-*` keyframes exist, and they and every rule that names one in an `animation` sit under `@media (prefers-reduced-motion: no-preference)` alone; and no rule outside a keyframe gives a header item `opacity: 0`, and no header element carries `style="opacity: 0"`. Every rule that animates an entrance keyframe is scoped to `[data-landing-entrance]` and gated by `:not([data-entrance-off])`; none uses a `forwards` or `both` fill; the keyframes animate only `opacity`, `transform` and `color`; and the fade never targets the wordmark (`.wordmark`), the whole title (`.title-wrapper`), GitHub or Discord (`header-chip`), and on search only the open button (`site-search > button[data-open-modal]`), not the dialog's buttons. `theme-contrast.mjs` also measures the colour pass's start colour, `--gmt-ice-dim`, on the header glass (3:1).
Added 2026-11-08 for #287: the sitemap's `<lastmod>` on each page but the landing equals the datetime of that page's built footer `<time>` and is a W3C Datetime, and the landing's entry has none (a missing, an extra or a differing `lastmod` fails).
Added 2026-11-08 for #309 (phases 1 and 4), the Dox page and the links to it. `/dox/` is not one of the 28 pages and gets rules of its own: `dox/index.html` is built; it is `noindex`; it is in neither the sitemap nor `llms.txt`; it has the inline script that sets `data-dox-shell`, exactly one `astro-island`, the `<title>` `Dox · @northguild/worktree`, the site header, named controls and hidden or named graphics, no footer, and no id twice; and no other page or the 404 loads Dox code (the island's chunk, however referenced, or the stylesheet that carries the hive: "Dox code on `/dox/` alone"). The chat is a page and its entry points are plain links, so the launcher, the bubble and the shortcut have no rules: on every page and the 404 the `<header>` has one link to `/worktree/dox/` named "Chat with Dox", before the theme toggle and GitHub (first in the right group), carrying `aria-current="page"` on `/dox/` and on no other page; every page with a sidebar (the 28 but the landing) has a mobile menu (`mobile-preferences`, matched as a class token), and the menu has the same link, named alike, before the social icons; and the landing has one "Ask Dox" link to `/worktree/dox/` and no "Ask Dox" button. `theme-contrast.mjs` measures its icon like the theme toggle's, on the header glass and (the mobile menu's copy) on the page background the phone menu sits on, and the current-page bar and the landing's "Ask Dox" text and border.
Added 2026-11-04 for #235 and run from the repo root of a worktree that day, exiting 0. CI runs `pnpm docs:build` then
`pnpm docs:audit-dist` after `pnpm build`, and `docs-deploy.yml` runs the same pair before it deploys anything.
Expand Down Expand Up @@ -186,8 +189,16 @@ test that genuinely has to be skipped is a conversation, not an edit to this pat
- **`pnpm changeset:prepare-release`** — not a gate: it mutates the tree (bumps `package.json`, writes
`CHANGELOG.md`, deletes the consumed notes) and is run once, by a maintainer, to make a release pull
request. Never run it to verify anything.
- **`pnpm --filter docs web-vitals`** — not a gate: a measuring script (`docs/scripts/web-vitals.mjs`). It runs Lighthouse
through `npx`, drives Playwright Chromium and calls PageSpeed Insights, so it needs the network, a served build
(`--origin http://127.0.0.1:<port>`, pages under `/worktree/`) and Chromium installed by hand
(`pnpm --filter docs exec playwright install chromium`; the `playwright` package does not download it). It prints LCP, CLS,
TBT and INP and writes nothing; no CI job runs it. `PSI_API_KEY` (optional, for `--live`) is read from the environment.
- **`pnpm --filter docs deploy:smoke`** — requests the live `https://northguild.dev/worktree/` and retries up to 6
times, 10 s apart (about a minute), so it needs the network and a deployed site; `docs-deploy.yml` runs it after the deploy.
Besides the routes it asserts three headers by exact value: `Cache-Control: public, max-age=31536000, immutable` on a
hashed asset (one it picks from `docs/dist/_astro/`, so build first), `X-Robots-Tag: noindex` on `llms.txt`, and on a page
no `X-Robots-Tag` and no `immutable` `Cache-Control`. `SMOKE_ORIGIN=http://127.0.0.1:<port>` points it at `docs/.deploy` served by `wrangler dev --local`.
- **`pnpm --filter docs stage:deploy`** and **`pnpm --filter docs build:legacy`** — produce the gitignored
`docs/.deploy/` and `docs/legacy/` for the deploy jobs; neither verifies anything.
- **`pnpm --filter docs worker:deploy`** and any `wrangler deploy` without `--dry-run` (the chat Worker's and the site's) — need `CLOUDFLARE_API_TOKEN` and
Expand Down
42 changes: 38 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ If gmt adopts the same accent it moves into `@northguild/theme`, and these overr
### The header, the sidebar and the page details

- **Header.** `src/components/Header.astro` overrides Starlight's `Header` (copied from Starlight 0.42.8, with the right group from GMT's `apps/dox`, commit `b15b3899`):
the right group is the theme button, the language select, then GitHub and Discord, as three controls of one size in one row with one gap and no divider,
the right group is the "Chat with Dox" crystal (see *Opening it*), the theme button, the language select, then GitHub and Discord, as four controls of one size in one row with one gap and no divider,
and `scripts/audit-dist.mjs` fails a page whose header orders them otherwise. The three direct children of `.header` (title, search, right group) keep their order, because `theme.css` selects them by position.
The components it renders (`SiteTitle`, `SocialIcons`, `ThemeSelect`) are overridden too, and so is `ThemeProvider`, which Starlight's `Page.astro` loads in the head. `src/components/ThemeSelect.astro` and `ThemeProvider.astro` make the theme
control a two-state button (ported from GMT's `apps/dox`, commit `b15b3899`; Starlight also renders the select in the mobile
Expand Down Expand Up @@ -469,8 +469,9 @@ or use the root-level aliases where noted.
| `worker:deploy` | Test → build → `wrangler deploy` |
| `audit-dist` | Assert the SEO requirements over `dist/` (run after `build`; root alias `pnpm docs:audit-dist`) |
| `build:legacy` | Write `legacy/` (gitignored): the bundle for the old GitHub Pages site |
| `stage:deploy` | Copy `dist/` to `.deploy/worktree/` (gitignored), the directory `wrangler.jsonc` serves |
| `deploy:smoke` | Check the live routes on `https://northguild.dev/worktree/` (`SMOKE_ORIGIN` overrides the origin) |
| `stage:deploy` | Copy `dist/` to `.deploy/worktree/` and `deploy/_headers` to `.deploy/_headers` (gitignored), the directory `wrangler.jsonc` serves |
| `web-vitals` | Measure LCP, CLS, TBT and INP on three pages: Lighthouse (pinned, mobile and desktop, median of three) and Playwright Chromium at 4x CPU throttling against `--origin` (a served build under `/worktree/`), PageSpeed Insights and CrUX field data for `--live`. By hand, not a gate; `PSI_API_KEY` is read from the environment. Needs Chromium: `pnpm --filter docs exec playwright install chromium` |
| `deploy:smoke` | Check the live routes on `https://northguild.dev/worktree/` and three response headers (a hashed asset's `Cache-Control`, `llms.txt`'s `X-Robots-Tag`, and a page carrying neither `noindex` nor `immutable`); `SMOKE_ORIGIN` overrides the origin |

---

Expand Down Expand Up @@ -516,7 +517,12 @@ commit, so a docs change merged after the release waits for the next one. Two jo
- **`site`** builds `docs/dist`, audits it, copies it to `docs/.deploy/worktree/` and runs `wrangler deploy` with
`docs/wrangler.jsonc`: a Worker with static assets and no script, on the Route `northguild.dev/worktree*`.
The copy exists because a Route does not strip its path, while `astro build` writes `dist/` without the
`/worktree` base. It then runs `deploy:smoke` against the live URL, retrying for route propagation.
`/worktree` base. The same step copies `docs/deploy/_headers` to `docs/.deploy/_headers`, the root of the
assets directory, which is where Cloudflare reads it: files under `/worktree/_astro/` (all hashed, which the
audit checks) are served `Cache-Control: public, max-age=31536000, immutable`, and `/worktree/*.txt` carries
`X-Robots-Tag: noindex`. Edit that file in `docs/deploy/`, not in `docs/public/`, where it would land at
`.deploy/worktree/_headers` and never be read. It then runs `deploy:smoke` against the live URL, retrying for
route propagation; the smoke run asserts those headers too.
- **`legacy-pages`** runs after `site` and publishes `docs/legacy/` (from `build:legacy`) to GitHub Pages: the
schema file at `https://northguild.github.io/worktree/schema/v1.json` plus a redirect stub per old route.

Expand Down Expand Up @@ -544,3 +550,31 @@ deploys with the next stable release.

For manual deployment steps, including first-time Cloudflare setup, see
[docs/worker/README.md](worker/README.md).

---

## Search engines

Nothing in the build submits the site to a search engine. The owner does these once, by hand, after a release
that carries the sitemap and header changes has deployed (a docs-only merge does not deploy the
site; see [Deployment](#deployment)).

1. **Submit the sitemap** to both engines, as `https://northguild.dev/worktree/sitemap-index.xml`:
- Google Search Console, for the `https://northguild.dev/` property: *Sitemaps* → *Add a new sitemap*.
- Bing Webmaster Tools, for the same site: *Sitemaps* → *Submit sitemap*.
2. **Read each engine's Pages report** (*Pages* under *Indexing* in Search Console; Bing's index report for the
site), a few days after the submission, not the same day.
3. **A healthy result** is 28 pages discovered and 28 indexed, one for each `<loc>` in `sitemap-0.xml`, with no
*Duplicate* or *Alternate page* entry for a `/worktree/` URL. Twenty-seven of the 28 carry a `<lastmod>`;
the landing page is the one that does not, on purpose. A page that is discovered but not indexed is
Google's call and needs no change here. A duplicate or alternate entry does: it means two URLs are
competing for one page, so check the page's canonical link first.
4. **Spot-check the headers** on the live site once the release has deployed: `curl -sI` on a file under
`/worktree/_astro/` should show `Cache-Control: public, max-age=31536000, immutable`, and on
`/worktree/llms.txt` an `X-Robots-Tag: noindex`. `deploy:smoke` asserts the same in the release's deploy
job.

The `Sitemap:` line that points crawlers at `/worktree/sitemap-index.xml` also has to be in the
`robots.txt` served from the `northguild.dev` root, because crawlers read that file only from a host's root.
That file lives in the `northguild.dev` repository, **outside this one**; the copy in `docs/public/robots.txt`
is not served from the root and is not authoritative.
Loading
Loading