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
4 changes: 2 additions & 2 deletions context/stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ scripts/ version-sync script, run by `pnpm sync-version`; `release-
skills/ the usage skill, `skills/worktree/SKILL.md`; hand-written, shipped inside the npm package (package.json `files`) and installable with `npx skills add`. Nothing on npm discovers it since TanStack Intent went (`skills add` reads GitHub); it stays in `files` so an `npm i -g` install has a copy matching its own version on disk
docs/ Astro 7 + Starlight docs site, React 19 islands, Base UI; own package.json, `astro.config.mjs`
docs/src/content/docs/ Starlight pages (29 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/` (12 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; the header's right group ends with the settings gear (`components/SettingsControl.astro`, wired by `lib/settings-control.ts`: a native `[popover]` holding the "Dark theme" switch, whose rule is `lib/theme.ts`; it shows at every width, below 50rem as the only chip of the right group that does, and the mobile menu has no copy); sound is `lib/sound/` (GMT's engine, cut down: `settings.ts` is the reader's choice in the `dox:sound` key shared with GMT and northguild.dev, `cue.ts` is loaded on every page by `components/Head.astro`, and the engine is a chunk only its dynamic `import()` reaches, once a reader has unmuted, and on the landing alone it imports `lib/sound/leaves.ts`, the leaves' voices, driven by the last landing and the sampled landing places `hero/flight.ts` computes, only while sound is on, from the particles' own timings; no press makes a sound but the chat's Send and "Try again"); `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/ 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; the header's right group ends with the settings gear (`components/SettingsControl.astro`, wired by `lib/settings-control.ts`: a native `[popover]` holding the "Dark theme" switch, whose rule is `lib/theme.ts`; it shows at every width, below 50rem as the only chip of the right group that does, and the mobile menu has no copy); sound is `lib/sound/` (GMT's engine, cut down: `settings.ts` is the reader's choice in the `dox:sound` key shared with GMT and northguild.dev, `cue.ts` is loaded on every page by `components/Head.astro`, and the engine is a chunk only its dynamic `import()` reaches, once a reader has unmuted, and on the landing alone it imports `lib/sound/leaves.ts`, the leaves' voices, driven by the last landing and the sampled landing places `hero/flight.ts` computes, only while sound is on, from the particles' own timings; no press makes a sound but the chat's Send and "Try again"); `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); the share cards are made in the build: `pages/og/[...route].ts` writes `dist/og/site.png` and one PNG per page, `lib/og-cards.ts` decides the cards and their alt text, `lib/og-art.ts` draws one with CanvasKit (`lib/og-canvaskit.ts` loads it) over the committed `assets/og-art.png` in the Michroma TTF of `assets/og-fonts/`, `components/Head.astro` writes each page's share tags, and `lib/og-image-version.ts` is the integration that appends `?v=<hash>` to them after the build
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/` 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/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`, `build-og-art.mjs` (draws the share cards' art into `docs/src/assets/og-art.png` by hand, never in the build), `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; plus a local-only `[env.evals]`, never deployed, for the live evals)
docs/evals/ Dox chat evals (plan #355): `cases.ts` is the case set (pure data, loaded under Node type stripping: erasable syntax, `.ts` imports) and `cases.test.ts` checks it against the corpus; `metrics.ts` scores retrieval (pure), `offline.test.ts` runs every case through `validateChatRequest` and `prepareTurn` in `pnpm docs:test` and compares the scores with `baseline.json` (rewritten by `pnpm --filter docs evals:baseline`), `read-stream.ts` and `graders.ts` read and grade a live answer, `budget.ts` and `report.ts` hold the live layer's spending limits and its committed report, `run-live.ts` is the live runner (`pnpm --filter docs evals:live`; it spends real Neurons and refuses under `CI`), and `README.md` is the runbook
context/ planning-workflow artifacts (this directory)
Expand Down
12 changes: 10 additions & 2 deletions context/verify.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ hidden or a named image; the 404's heading a git error line (`fatal: ...`); and
from the vendored tokens and fails if any reaches a used rule, a used custom property, the HTML or a script in the build (the vendored definitions, rules for
classes no page uses and values `theme.css` overrides are not findings). The contrast of every themed pair is separate: `node docs/scripts/theme-contrast.mjs`
prints it, and its test in `pnpm docs:test` fails under 4.5:1 (text) or 3:1 (controls, rings).
Plan §9 Q3 added, on every page: an `og:image` that is an absolute URL under `https://northguild.dev/worktree/` and a file in the build, 1200×630 by the
file's own header, with `og:image:type`, `:width` and `:height` saying what the file is; a `twitter:image` that is the same URL; and alt text for both. On
Plan §9 Q3 added the share image, and #286 (2026-11-29) replaced the single JPEG with a PNG card per page. On every page, the 404 and `/dox/`: an `og:image` that is exactly
`https://northguild.dev/worktree/og/<key>.png?v=<12 lowercase hex>`, where the hash is the first 12 hex characters of the built file's SHA-256, and the file is a PNG by
its own header (a JPEG fails), 1200×630 and at most 307,200 bytes (WhatsApp skips a preview over 300 KB), with `og:image:type` `image/png` and `og:image:width` and `:height`
saying 1200 and 630; a `twitter:image` equal to the `og:image`; exactly one `og:locale`, `en_US`; and `og:image:alt` and `twitter:image:alt` both present and neither the
page's title. The card is the page's own (its path, `commands/branch` for `commands/branch/`), except the landing, the 404 and `/dox/`, which name `site` (`site.png`). On
every page and the 404, a `<link rel="icon">`, with every icon link (`icon`, `shortcut icon`, `apple-touch-icon`) naming a regular file in the build; and a
`<title>` that is its `og:title` and `og:site_name` joined by GMT's ` · ` (2026-11-04, replacing ` | `), or its `og:title` alone where that names the site. The script's own test,
`docs/scripts/audit-dist.test.mjs`, runs under `pnpm docs:test` (the docs Vitest config takes any `*.test.mjs`).
Expand Down Expand Up @@ -193,6 +196,11 @@ test that genuinely has to be skipped is a conversation, not an edit to this pat
refuses to run when `CI` is set. They need `wrangler login` and the network. `evals:live --help` and a run with no Worker at
`--base` spend nothing. A run with `--write-baseline` rewrites `docs/evals/live-<brainId>.json`. Never run them to verify anything;
the runbook is `docs/evals/README.md`. `wrangler deploy --dry-run --env evals` is safe and credential-free.
- **`node --disable-warning=MODULE_TYPELESS_PACKAGE_JSON docs/scripts/build-og-art.mjs`** — generation, not verification. It *writes*
the committed `docs/src/assets/og-art.png` (the share cards' art), exits 1 without writing when the text's contrast is under 4.5:1 or
the PNG is over 307,200 bytes, and is run by hand when the art should change, never by the build. Commit the PNG with the change;
`build-og-art.test.mjs` in `pnpm docs:test` fails when the committed file's pixels differ from what the script draws now
(pixels, not bytes: the PNG's deflate differs by CPU, so a file drawn on macOS is a byte longer on CI's Linux).
- **`pnpm changeset:add`** — not a gate: interactive (it prompts for a bump level and a description) and it
writes a `.changeset/*.md` file. Run it when a change owes a release note, per [`release.md`](release.md).
- **`pnpm changeset:status`** — not a gate: it compares against `origin/main`, so it needs that ref and a
Expand Down
17 changes: 17 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,23 @@ make quiet sounds tied to their flight (see [The leaves' sounds](#the-leaves-sou
query, the absence of any `opacity: 0` rule on a header item, and which parts may fade (never the wordmark, GitHub or
Discord, or the search dialog's buttons).

## Share cards

Each page's link preview is a 1200×630 PNG card, made by the build: the route `src/pages/og/[...route].ts` writes `dist/og/site.png`
(the landing, the 404 and `/dox/`) and one `dist/og/<page>.png` per page, each drawing its text over a committed piece of art: a page card its page title, the site card "worktree" and the line "A git worktree for every branch." The
build needs nothing from you; `pnpm docs:audit-dist` holds the cards and their tags.

The art itself (the dark ground, the hero's branch graph and the panel behind the text, no words) is drawn by hand, not by the build:

```bash
node --disable-warning=MODULE_TYPELESS_PACKAGE_JSON docs/scripts/build-og-art.mjs
```

Run it when the art should change: the hero's graph changes (`src/hero/targets.ts`, `geometry.ts`) or you want a different look. The colours are hard-coded in
`COLORS` in the script, so after a theme token moves, edit `COLORS` first (the test's "the colours" case fails until you do). It writes `src/assets/og-art.png` and prints the text's contrast against the art; under 4.5:1, or over 307,200 bytes, it fails and writes nothing. **Commit the
PNG with the change.** `scripts/build-og-art.test.mjs` (in `pnpm docs:test`) redraws the art and fails when the committed file's pixels differ (pixels, not bytes: the PNG's deflate differs by CPU),
so a change to the graph without the redrawn PNG does not pass. The text is Michroma (`src/assets/og-fonts/`, SIL OFL, licence beside it).

## Scripts reference

All commands are run from the repo root with `pnpm --filter docs run <command>`,
Expand Down
24 changes: 3 additions & 21 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ import sitemap from "@astrojs/sitemap";
import starlight from "@astrojs/starlight";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "astro/config";
import { versionOgImages } from "./src/lib/og-image-version.ts";
import { sitemapLastmod } from "./src/lib/sitemap-lastmod.ts";

// What the share preview shows, for readers who cannot see it (og:image:alt, twitter:image:alt).
const PREVIEW_ALT =
"The worktree docs landing: “A git worktree for every branch” beside a git graph drawn in green leaves.";

// `astro build` writes here; the sitemap reads each page's footer date back from it (D1).
const DIST = fileURLToPath(new URL("./dist/", import.meta.url));

Expand All @@ -21,6 +18,8 @@ export default defineConfig({
trailingSlash: "always",
build: { format: "directory" },
integrations: [
// Before starlight(): hooks run in list order, so everything after reads the pages with the `?v=` hashes (plan #286 D5).
versionOgImages(),
starlight({
title: "@northguild/worktree",
// The delimiter in `<title>`: `<page> · @northguild/worktree`, the middle dot GMT's pages use (`Core Rules · GMT`; the
Expand Down Expand Up @@ -147,23 +146,6 @@ export default defineConfig({
href: "/worktree/apple-touch-icon.png",
},
},
// The share preview (plan §9 Q3; the user, 2026-11-04: the landing with one of the hero's shapes): the landing in
// the dark theme with the hero formed as the git graph. A screenshot of `astro preview` at 1440×756 (DPR 2), the CLI
// version hidden so it does not age with a release, scaled to 1200×630. Retake it when the landing changes.
...[
["og:image", "https://northguild.dev/worktree/og-image.jpg"],
["og:image:type", "image/jpeg"],
["og:image:width", "1200"],
["og:image:height", "630"],
["og:image:alt", PREVIEW_ALT],
].map(([property, content]) => ({
tag: "meta",
attrs: { property, content },
})),
...[
["twitter:image", "https://northguild.dev/worktree/og-image.jpg"],
["twitter:image:alt", PREVIEW_ALT],
].map(([name, content]) => ({ tag: "meta", attrs: { name, content } })),
],
// Frame colours come from the --sl-* variables (the default), so the code blocks follow the theme picker.
expressiveCode: {
Expand Down
2 changes: 2 additions & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@
"@testing-library/react": "^16.3.3",
"@types/react": "^19.3.0",
"@types/react-dom": "^19.3.0",
"canvaskit-wasm": "0.42.0",
"concurrently": "^10.0.6",
"jsdom": "^26.1.0",
"playwright": "^1.65.0",
"sharp": "0.35.5",
"tsup": "^9.0.0",
"typescript": "^5.9.3",
"vitest": "^4.1.12",
Expand Down
Binary file removed docs/public/og-image.jpg
Binary file not shown.
Loading