@tenphi/cookbook 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -72,9 +72,10 @@ With no documentation configuration, it uses README/docs conventions.
72
72
 
73
73
  ## Configure the site
74
74
 
75
- Read the [customization rules](./customization-rules.md) before changing the
76
- theme or adding custom components. These rules and their upstream references
77
- are also included in the installed Cookbook package.
75
+ Start with the complete [brand, logo, and font recipes](./recipes.md).
76
+ For deeper style changes or new components, read the
77
+ [customization rules](./customization-rules.md). These rules and upstream
78
+ references are also included in the installed Cookbook package.
78
79
 
79
80
  Create `docs.config.ts` next to `astro.config.ts`:
80
81
 
@@ -124,11 +125,13 @@ also declare their own roots for multi-package sites.
124
125
  ## Validate and publish
125
126
 
126
127
  ```sh
127
- npm run doctor
128
- npm run build
128
+ npm run validate
129
129
  npm run preview
130
130
  ```
131
131
 
132
132
  See [working examples](./examples.md), [authoring components](./authoring.mdx),
133
133
  the [AI agent workflow](./ai-agents.md), and [deployment](./deployment.md). Existing users should read the
134
- [prerelease migration guide](./migration.md).
134
+ [version-specific upgrade guide](./migration.md).
135
+
136
+ For a complete configuration to adapt, start with the [recipes](./recipes.md).
137
+ If validation fails, see [troubleshooting](./troubleshooting.md).
package/docs/index.md CHANGED
@@ -42,20 +42,31 @@ for GitHub Pages or any static host.
42
42
 
43
43
  ## Choose a path
44
44
 
45
- Create a documentation project from a published npm package:
45
+ | I want to… | Start here | Then read |
46
+ | ------------------------------------ | --------------------------------------- | --------------------------------------------------------------------- |
47
+ | Start a site | [Getting started](./getting-started.md) | [Validate and deploy](./deployment.md) |
48
+ | Have an agent set it up | [AI agent workflow](./ai-agents.md) | [Customization rules](./customization-rules.md) |
49
+ | Bring existing Markdown or an API | [Content sources](./content-sources.md) | [Working examples](./examples.md) |
50
+ | Write pages and interactive examples | [Authoring](./authoring.mdx) | [Mobile contents and hero images](./authoring.mdx#on-page-navigation) |
51
+ | Change brand, fonts, or logo | [Configuration recipes](./recipes.md) | [Theme reference](./theme-and-components.md) |
52
+ | Add a Starlight plugin | [Plugin compatibility](./plugins.md) | [Architecture](./architecture.md) |
53
+ | Publish for people and agents | [Deployment](./deployment.md) | [Publishing metadata](./publishing.md) |
54
+ | Update or fix an existing site | [Upgrade Cookbook](./migration.md) | [Troubleshooting](./troubleshooting.md) |
55
+
56
+ The **Guide** follows these tasks. **Reference** contains the complete
57
+ [configuration](./configuration.md), [theme and component anatomy](./theme-and-components.md),
58
+ [publishing controls](./publishing.md), and [CLI](./cli.md).
59
+
60
+ To start immediately:
46
61
 
47
62
  ```sh
48
- npm create @tenphi/cookbook@latest my-package-docs -- --package your-package
63
+ npm create @tenphi/cookbook@latest my-docs -- --yes
64
+ cd my-docs
65
+ npm run dev
49
66
  ```
50
67
 
51
- Or add the complete integration to an Astro project:
52
-
53
- ```sh
54
- npx astro add @tenphi/cookbook
55
- ```
56
-
57
- Continue with [Getting started](./getting-started.md), then learn how
58
- [content sources](./content-sources.md) become routes.
68
+ Existing Astro projects can use `npx astro add @tenphi/cookbook`. See
69
+ [Getting started](./getting-started.md) for repository and npm package sources.
59
70
 
60
71
  ## See the product, not a mock-up
61
72
 
package/docs/migration.md CHANGED
@@ -1,11 +1,104 @@
1
1
  ---
2
- title: Prerelease migration
3
- description: Upgrade to the shared configuration, source identity, and typed customization APIs.
2
+ title: Upgrade Cookbook
3
+ description: Version-specific changes, runtime upgrades, and documentation-source updates.
4
4
  sidebar:
5
5
  order: 9
6
6
  ---
7
7
 
8
- This prerelease intentionally tightens several contracts.
8
+ ## Upgrade the site runtime
9
+
10
+ Check your current `@tenphi/cookbook`, Astro, and Node versions first. Read the
11
+ [release notes](https://github.com/tenphi/cookbook/releases), then update the
12
+ runtime dependency using the package manager that owns your lockfile:
13
+
14
+ ```sh
15
+ npm install @tenphi/cookbook@latest
16
+ npx @tenphi/cookbook doctor
17
+ npm run build
18
+ npx @tenphi/cookbook check-build
19
+ npm run preview
20
+ ```
21
+
22
+ For pnpm use `pnpm add`; for Yarn use `yarn add`. Commit the package manifest and
23
+ package-manager lockfile together. Keep Astro inside Cookbook's declared peer
24
+ range. Review the preview with your custom styles, plugins, fonts, languages,
25
+ and versions before deploying. After deployment, run `cookbook check-build
26
+ --url https://docs.example.com/` against that exact build output.
27
+
28
+ The creator starts new projects; rerunning it over an existing project is not
29
+ an upgrade path. Generated sites include `.agents/skills/upgrade-cookbook/`
30
+ for an agent-assisted upgrade. See [quality checks](./quality-checks.md) for
31
+ validation coverage and [troubleshooting](./troubleshooting.md) for failures.
32
+
33
+ ### Runtime updates versus documentation updates
34
+
35
+ `cookbook update` updates **imported npm documentation**, according to the
36
+ specifiers in `content.sources`. It writes `cookbook.lock.json`; it does not
37
+ upgrade the site's Cookbook runtime or package-manager dependencies. Commit the
38
+ documentation lock separately when intentionally updating imported content.
39
+ Local Markdown needs no lock update.
40
+
41
+ ## 0.17.x to 0.18
42
+
43
+ These changes are included in the next minor release:
44
+
45
+ - **Google fonts:** family-name shorthand loads preset weights and italics and
46
+ self-hosts the files. The initial build requires network access. Preserve the
47
+ Astro font cache for offline rebuilds, use local files for checked-in assets,
48
+ or select `theme.fontLoading.google: "remote"` for CDN delivery. See
49
+ [fonts](./theme-and-components.md#change-font-families).
50
+ - **Colors:** body tone 0 and heading tone 4 remain the reading defaults.
51
+ The default logo uses fixed Glaze colors (`logo-surface` and `logo-mark`), so
52
+ its book stays light in dark mode. Customize these independently of accents.
53
+ Additional semantic-pair checks may reject custom colors that previously
54
+ passed. Follow the named pair and mode in the diagnostic; see
55
+ [contrast troubleshooting](./troubleshooting.md#contrast-failures).
56
+ - **Header controls:** round controls use `$header-control-radius`, independently
57
+ of `$radius`. Set the new token to your preferred radius to keep your previous
58
+ header shape.
59
+ - **Drafts:** production builds retain draft pages at direct URLs and mark them
60
+ `noindex`. They are omitted from generated navigation, search, sitemaps, and
61
+ agent indexes. A draft is public to anyone with the URL; use host access
62
+ controls for private previews.
63
+ - **Plugins:** custom metadata is available to route middleware and through
64
+ Cookbook's content API. Plugins that need Astro's synthetic content files or
65
+ inject their own CSS require adaptation. See the tested
66
+ [plugin matrix](./plugins.md#verified-compatibility).
67
+ - **Styles:** rendered inline styles are rejected. Move custom styling to Tasty
68
+ and registered theme style trees. Keep these components server-rendered;
69
+ browser scripts and `client:*` islands cannot import Cookbook styling, Tasty,
70
+ or Glaze. Attach interaction scripts to the static markup. Isolated,
71
+ sandboxed `Preview` content is the
72
+ documented exception. The new surface inventory is in the
73
+ [theme reference](./theme-and-components.md).
74
+ - **Page text:** the footer offers copy/download Markdown by default. Set
75
+ `site.seo.copyPage: false` to disable the controls and generated page files.
76
+ Configure static host headers if raw Markdown must be excluded from indexing;
77
+ see [deployment](./deployment.md).
78
+ - **Validation:** existing projects can add
79
+ `"validate": "cookbook doctor && astro build && cookbook check-build"`
80
+ to their scripts. `doctor` is explicitly a preflight; successful MDX compilation
81
+ and deployment require the later checks.
82
+
83
+ Review locale navigation and canonical metadata after upgrading. Locale/version
84
+ links now target actual pages and available fallbacks instead of invented URLs.
85
+ A version switcher changes the selected route; configure navigation groups
86
+ explicitly when you want to curate which version trees are shown.
87
+
88
+ ## 0.16 to 0.17
89
+
90
+ Use Node.js **22.19 or newer**. Cookbook 0.17 adopted Starlight 0.42.4 and added
91
+ Google/local font configuration, Glaze palette declarations, OpenAPI sources,
92
+ version navigation, plugin forwarding, agent instructions, and static discovery
93
+ files. These features are opt-in except for generated discovery metadata.
94
+ Version 0.17.1 restored strong body/heading colors with absolute Glaze tones.
95
+ If you added temporary contrast workarounds in 0.17.0, compare them with those
96
+ defaults before carrying them forward.
97
+
98
+ ## Upgrading from before 0.14
99
+
100
+ The shared-configuration and source-identity changes shipped in **0.14.0**.
101
+ Apply these steps if your project still uses the earlier contracts:
9
102
 
10
103
  - Move generated inline documentation configuration to `docs.config.ts` and use
11
104
  `cookbook()` in Astro. Existing explicit `cookbook({ config })` remains valid,
@@ -32,5 +125,5 @@ This prerelease intentionally tightens several contracts.
32
125
  - `Tabs` now expects `Tab` children with accessible labels. It provides keyboard
33
126
  navigation and panels; use an ordinary custom component for a grouping layout.
34
127
 
35
- See [authoring](./authoring.mdx) for the new components and [working
36
- examples](./examples.md) for complete configuration patterns.
128
+ See [authoring](./authoring.mdx) for component usage and
129
+ [working examples](./examples.md) for repository configuration patterns.
@@ -0,0 +1,120 @@
1
+ ---
2
+ title: Starlight plugins
3
+ ---
4
+
5
+ Cookbook accepts Starlight content and behavior plugins in `astro.config.mjs`:
6
+
7
+ ```js cookbook-verify=github-alerts
8
+ import cookbook from "@tenphi/cookbook";
9
+ import githubAlerts from "starlight-github-alerts";
10
+ import { unified } from "@astrojs/markdown-remark";
11
+
12
+ export default {
13
+ markdown: { processor: unified() },
14
+ integrations: [cookbook({ plugins: [githubAlerts()] })],
15
+ };
16
+ ```
17
+
18
+ Install `starlight-github-alerts` and `@astrojs/markdown-remark` in your project. Cookbook supplies the Starlight runtime; respect
19
+ plugins' peer dependency ranges when upgrading. See [configuration](./configuration.md)
20
+ for Astro Markdown hooks and [customization](./theme-and-components.md) for styling.
21
+
22
+ ## Verified compatibility
23
+
24
+ The consumer check `pnpm check:plugins` tests these versions with the repository's
25
+ pinned Astro and Starlight versions. Compatibility with other versions is not implied.
26
+
27
+ | Integration | Tested version | Contract |
28
+ | ------------------------------------------------------------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
29
+ | `starlight-github-alerts` | 0.4.0 | With `unified()`, Markdown and MDX alert syntax uses Cookbook's Tasty `StarlightAside` adapter. |
30
+ | `starlight-links-validator` | 0.26.0 | Incompatible with mounted sources: error reporting assumes physical `src/content/docs` files. Cookbook rejects it with a diagnostic. |
31
+ | Route middleware and `i18n:setup` | Starlight 0.42.4 | Custom metadata, body, file path, and translations survive in real consumer builds with locales and a base path. |
32
+ | Plugins requiring `astro:content`'s `docs` collection | — | Cookbook's renderer uses its own graph. Adapt to the content API below; no native collection is populated automatically. |
33
+ | Plugins supplying CSS, styled Astro components, or Expressive Code | — | Require an adapter built with Tasty. The build rejects incompatible output. |
34
+
35
+ GitHub Alerts 0.4.0 assumes an older Sätteri plugin structure and silently skips
36
+ alerts with Starlight 0.42.4's default processor. Cookbook rejects that combination
37
+ with a configuration hint. Use `unified()` as above, or Starlight's native
38
+ `:::note` / `:::tip` directives with the default processor.
39
+
40
+ GitHub alerts inherit the semantic blue, green, yellow, and red surfaces. Customize
41
+ `theme.styles.StarlightAside` with `Note`, `Tip`, `Caution`, `Danger`, `Title`, `Icon`,
42
+ and `FirstContent`. Styles merge into the full owned tree; the plugin's stylesheet
43
+ is unnecessary. All supported appearance modes use the Glaze palette.
44
+
45
+ Cookbook validates graph links itself. `starlight-links-validator` 0.26.0 loads,
46
+ but fails while reporting broken links because it tries to read synthesized
47
+ `src/content/docs` paths. Its middleware also cannot add previously absent links
48
+ to its validation store. Use Cookbook's doctor and built-output checks for mounted
49
+ sources. Plugins that depend on native collection IDs or mutate routing after
50
+ graph creation need a Cookbook-specific adapter.
51
+
52
+ ## Custom metadata and schemas
53
+
54
+ Unknown source frontmatter is preserved as `entry.metadata` by default, and is
55
+ available to route middleware as `locals.starlightRoute.entry.data`. Cookbook's
56
+ validated built-in fields take precedence. Set `content.frontmatter: "reject"`
57
+ only if your site does not use custom metadata.
58
+
59
+ Optionally validate custom fields or supply defaults with a Zod-compatible schema:
60
+
61
+ ```js
62
+ import cookbook from "@tenphi/cookbook";
63
+ import { z } from "astro/zod";
64
+
65
+ export default {
66
+ integrations: [
67
+ cookbook({
68
+ frontmatterSchema: z.object({
69
+ owner: z.string().default("docs-team"),
70
+ }),
71
+ }),
72
+ ],
73
+ };
74
+ ```
75
+
76
+ The schema receives **custom metadata only** and may use `parse` or `parseAsync`.
77
+ Returned fields merge with preserved metadata. Values must be JSON-compatible;
78
+ errors identify the source file. Reserved fields such as `title`, `slug`, `draft`,
79
+ and `aliases` belong in source frontmatter and cannot be set by this schema.
80
+ A schema cannot change routing or discovery after the graph is built.
81
+
82
+ Route middleware also receives the transformed Markdown source in `entry.body`
83
+ and the actual source location in `entry.filePath`. Presentation changes made by
84
+ middleware do not update the graph, sitemap, or agent text. Put shared publishing
85
+ metadata in source configuration so every output agrees.
86
+
87
+ ## Query Cookbook content
88
+
89
+ Use this build-time API in Astro components and route middleware:
90
+
91
+ ```js
92
+ import {
93
+ getCookbookCollection,
94
+ getCookbookEntry,
95
+ } from "@tenphi/cookbook/content";
96
+
97
+ const pages = getCookbookCollection();
98
+ const allPages = getCookbookCollection({ includeDrafts: true });
99
+ const page = getCookbookEntry("/guide");
100
+ ```
101
+
102
+ The renderer package exposes the same functions at `@tenphi/starlight/content`.
103
+ Routes include locale/version prefixes but exclude Astro's deployment `base`.
104
+ Collection queries omit drafts by default; exact lookups can retrieve a draft.
105
+ Results are independent snapshots, including `metadata`, `frontmatter`, `body`,
106
+ `transformedBody`, source information, headings, and links. Mutating a result does
107
+ not change generated pages. Do not import this API into client-side code: it is
108
+ backed by the site's build-time content graph.
109
+
110
+ ## Diagnose incompatible plugins
111
+
112
+ - **Plugin adds `customCss`:** disable its stylesheet option and provide a Tasty
113
+ adapter, or choose a content-only plugin. The configuration error names the plugin.
114
+ - **Inline styles or external stylesheet in built output:** replace that visual
115
+ component with owned markup styled through `tasty()` and registered
116
+ `theme.styles` anatomy. See [customization rules](./customization-rules.md).
117
+ - **Empty `getCollection("docs")`:** use the Cookbook content API above. Cookbook
118
+ does not create a second, potentially conflicting Starlight content collection.
119
+ - **Missing custom field:** keep `content.frontmatter` at its default `"preserve"`,
120
+ validate its shape, and read it after the Cookbook route bridge has run.
@@ -0,0 +1,153 @@
1
+ ---
2
+ title: Publishing metadata
3
+ description: Configure titles, social previews, canonical URLs, indexing, and agent-readable pages.
4
+ ---
5
+
6
+ Set `site.url` (or Astro's `site`) to your public origin. Astro's `base` is applied
7
+ to page URLs, local social images, sitemaps, and Markdown downloads automatically.
8
+ Conflicting Cookbook and Astro origins fail configuration validation.
9
+
10
+ ## Titles and social previews
11
+
12
+ ```ts
13
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
14
+
15
+ export default defineDocsConfig({
16
+ site: {
17
+ title: "Acme",
18
+ url: "https://docs.example.com",
19
+ seo: {
20
+ titleTemplate: "{title} | {site}",
21
+ image: {
22
+ src: "/social.png", // public/social.png; deployment base is added
23
+ alt: "Acme developer documentation",
24
+ width: 1200,
25
+ height: 630,
26
+ },
27
+ breadcrumbs: true,
28
+ },
29
+ },
30
+ });
31
+ ```
32
+
33
+ Without a template, Cookbook renders `Page | Site`, or just `Site` when both names
34
+ match. Templates require `{title}` and may use `{site}`. A page's `seo.title` is a
35
+ complete document title, overriding the template; its visible heading is unchanged.
36
+
37
+ Social images accept an absolute HTTP(S) URL or a root-relative public asset path.
38
+ Provide meaningful `alt` text. Dimensions are optional but must be provided together.
39
+ A page inherits the site image, can replace it, or can set `image: false`. Pages
40
+ without an image use a `summary` card; an image enables `summary_large_image`.
41
+
42
+ ```yaml
43
+ ---
44
+ title: Authentication
45
+ seo:
46
+ title: Authentication reference — Acme
47
+ image:
48
+ src: /authentication.png
49
+ alt: Acme authentication flow
50
+ width: 1200
51
+ height: 630
52
+ ---
53
+ ```
54
+
55
+ Cookbook owns document titles, canonical links, robots directives, and the social
56
+ fields described above. Configure these through `seo` instead of duplicating them
57
+ in `head`. Other custom head tags remain supported.
58
+
59
+ ## Indexing and previews
60
+
61
+ `site.seo.index: false` adds `noindex, follow` to documentation pages and omits them
62
+ from sitemaps, language alternatives, and `llms.txt`. Navigation and direct links
63
+ continue to work. A page cannot override a site or version's `index: false`.
64
+
65
+ Choose preview policy explicitly in configuration:
66
+
67
+ ```ts
68
+ site: {
69
+ url: "https://docs.example.com",
70
+ seo: { index: process.env.DOCS_PREVIEW !== "1" },
71
+ }
72
+ ```
73
+
74
+ Build previews with `DOCS_PREVIEW=1`. Keep the production canonical origin while
75
+ serving the preview from another host. `noindex` is a crawler instruction, not
76
+ access control. Crawlers must be allowed to fetch the HTML to see it; do not rely
77
+ on a robots.txt disallow rule to communicate noindex. See Google's
78
+ [noindex guidance](https://developers.google.com/search/docs/crawling-indexing/block-indexing).
79
+
80
+ A page can opt out using `seo: { index: false }`. A draft is always noindex and also
81
+ omitted from navigation, pagination, search, sitemaps, and agent discovery. Drafts
82
+ remain available at their ordinary production URL and do not get Markdown copies.
83
+
84
+ ## Versions, locales, and canonical URLs
85
+
86
+ Every published version is indexed by default. Opt older versions out explicitly:
87
+
88
+ ```ts
89
+ site: {
90
+ versions: [
91
+ { label: "Current", routeBase: "/" },
92
+ { label: "v1", routeBase: "/v1", index: false },
93
+ ],
94
+ }
95
+ ```
96
+
97
+ Locale prefixes precede version roots: `/fr/v1/guide`. Version matching uses the
98
+ most specific configured root after the locale prefix. Only actual, indexable,
99
+ self-canonical translations are advertised in `hreflang` and the sitemap.
100
+
101
+ For duplicate content, set a page's `seo.canonical` to the preferred **absolute
102
+ HTTP(S) URL without a fragment**. The duplicate keeps its normal route and is
103
+ omitted from sitemap and agent indexes; canonicalization alone does not add
104
+ noindex. Distinct versions keep self-canonical URLs unless you explicitly identify
105
+ them as duplicates. See Google's
106
+ [canonical guidance](https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls).
107
+
108
+ ## Breadcrumb structured data
109
+
110
+ `site.seo.breadcrumbs: true` emits a `BreadcrumbList` when at least two actual
111
+ ancestor pages exist. Intermediate folders without pages are skipped. To describe
112
+ a different navigation journey, supply at least two `{name, url}` items in a page's
113
+ `seo.breadcrumbs`. URLs must be absolute HTTP(S); the final URL must match that
114
+ page's canonical. Set `seo.breadcrumbs: false` on a page to disable it.
115
+
116
+ Structured data helps machines understand the page hierarchy. It does not guarantee
117
+ any search appearance; validate the deployed output using Google's
118
+ [breadcrumb documentation](https://developers.google.com/search/docs/appearance/structured-data/breadcrumb).
119
+
120
+ ## Page text for readers and agents
121
+
122
+ Published pages include **Copy page** and **Download Markdown** controls. The head also
123
+ advertises a `rel="alternate" type="text/markdown"` URL. Downloads contain clean
124
+ Markdown with canonical URL, source path, language, and version metadata. Code
125
+ fences and rewritten links are preserved. Executable MDX, expressions, raw HTML,
126
+ and isolated previews are omitted; generated interactive component output may
127
+ only be available in the HTML. Read the HTML when that content matters.
128
+
129
+ The version comes from the matching documentation version, then `site.version`.
130
+ Copying requires browser clipboard access; the Markdown link remains available if
131
+ permission is unavailable or JavaScript is disabled. Set `site.seo.copyPage: false`
132
+ to disable page text and both controls. Customize the controls with
133
+ `theme.styles.PageActions`: `Control`, `Hover`, `Focus`, `Pending`, and `Status`.
134
+
135
+ `llms.txt` links to discoverable canonical pages and their Markdown representations.
136
+ `_cookbook/publishing.json` records non-draft page URLs and publishing policy for
137
+ validation tools. Existing `public/llms.txt` and root `public/robots.txt` take
138
+ precedence; maintain their policy yourself.
139
+
140
+ For static hosts, apply `X-Robots-Tag: noindex` to `/_cookbook/pages/*` (with your
141
+ base prefix) to keep alternate Markdown copies out of web search. For example,
142
+ Netlify/Cloudflare Pages projects can add this to `public/_headers`:
143
+
144
+ ```text
145
+ /_cookbook/pages/*
146
+ X-Robots-Tag: noindex
147
+ ```
148
+
149
+ The static HTML's noindex does not automatically apply to a separate Markdown URL.
150
+ Preview deployments should apply a site-wide noindex response header when the
151
+ host supports it. On hosts without custom headers, disable `copyPage` for previews
152
+ and private review content. Agent files are a reading convenience, not a claim of
153
+ better AI answers or higher search rankings.
@@ -0,0 +1,71 @@
1
+ ---
2
+ title: Quality checks
3
+ description: Validate a site, understand the consumer test matrix, and measure output budgets.
4
+ ---
5
+
6
+ ## For your documentation site
7
+
8
+ Run `npm run validate` in a generated project: it checks the configuration and
9
+ local files, builds the site, and validates the output. After deploying, run
10
+ `npx @tenphi/cookbook check-build --url https://docs.example.com/` against the
11
+ same build. See [CLI validation](./cli.md#check-the-built-site-and-deployment)
12
+ for coverage and preview-host behavior.
13
+
14
+ Also review keyboard navigation, mobile layouts, and all four light/dark and
15
+ normal/high-contrast combinations after changing styles. Automated accessibility
16
+ checks supplement this review; they do not establish complete accessibility.
17
+
18
+ ## Cookbook's verification suite
19
+
20
+ Repository contributors can run these checks after `pnpm build`:
21
+
22
+ | Command | Coverage |
23
+ | ---------------------------- | -------------------------------------------------------------------------------------------- |
24
+ | `pnpm test` | Configuration, graph, rendering helpers, diagnostics, and interaction logic |
25
+ | `pnpm check:locales` | Real locale/fallback/navigation consumers |
26
+ | `pnpm check:publishing-site` | Combined base paths, locales, versions, drafts, SEO, and agent Markdown |
27
+ | `pnpm check:theming` | Consumer components, colors, units, recipes, presets, overrides, and logos |
28
+ | `pnpm check:fonts` | Real Google variable/italic fonts, local fonts, and offline cache rebuild |
29
+ | `pnpm check:plugins` | Tested plugin contracts and actionable incompatibility failures |
30
+ | `pnpm check:recipes` | Extract, type-check, build, and validate documented configurations verbatim |
31
+ | `pnpm check:authoring` | Custom highlighting, code groups, mobile contents, hero images, and OpenAPI |
32
+ | `pnpm check:browser` | Chromium keyboard/focus, search, copy actions, appearance, mobile navigation, and axe checks |
33
+ | `pnpm check:install` | Clean installation and build from packed artifacts, including lint/type exports |
34
+ | `pnpm check:benchmark` | A generated 500-page corpus with 10,000 headings and code samples |
35
+
36
+ Install the browser once with `pnpm exec playwright install chromium`.
37
+ CI covers npm, pnpm, and Yarn installations, Node 22/24/26, and Linux, macOS,
38
+ and Windows in representative combinations. Yarn uses its `node-modules` linker;
39
+ Plug'n'Play is not covered. The weekly upstream canary installs the newest Astro
40
+ version allowed by Cookbook's peer range and actually builds the packed consumer.
41
+ Google Fonts checks run in that network-enabled canary. Published documentation
42
+ is checked after deployment against its uploaded build artifact.
43
+
44
+ The lint consumer uses TypeScript 6 for the typescript-eslint parser and the
45
+ workspace TypeScript compiler for public API checks; typescript-eslint currently
46
+ rejects the TypeScript 7 API. Runtime compilation and lint parsing are separate.
47
+
48
+ ## Performance budgets and corpus measurements
49
+
50
+ The reference build enforces separate limits for initial page JavaScript,
51
+ lazy search assets, font files, images, and extracted Tasty CSS. A default guide
52
+ currently loads about 12 KB of first-party JavaScript initially; search is lazy.
53
+ The checked reference output contains about 73 KB of fonts and 35 KB of images.
54
+ `node scripts/check-reference-budgets.mjs` prints measured bytes and limits.
55
+ These are uncompressed first-party build sizes, excluding external analytics.
56
+
57
+ A local macOS / Node 22.22 run processed 500 pages with 10,000 headings in about
58
+ 1.1 seconds and built that site in 33.5 seconds. A 1,000-page / 20,000-heading
59
+ graph took about 2.8 seconds, with roughly 499 MiB RSS after three runs. These are
60
+ observations on one machine, not throughput guarantees. The full-build corpus
61
+ uses explicit minimal navigation so the measurement is not dominated by repeating
62
+ hundreds of sidebar links in every page.
63
+
64
+ ```sh
65
+ COOKBOOK_BENCH_PAGES=1000 COOKBOOK_BENCH_BUILD=1 pnpm check:benchmark
66
+ COOKBOOK_TEST_MANAGER=pnpm pnpm check:install
67
+ COOKBOOK_TEST_UPSTREAM=1 pnpm check:install
68
+ ```
69
+
70
+ Investigate regressions before changing a budget. CI retains browser traces on
71
+ failure, and the benchmark reports graph timings, memory, and optional build time.
@@ -0,0 +1,116 @@
1
+ ---
2
+ title: Configuration recipes
3
+ description: Complete, build-checked configurations for common documentation tasks.
4
+ ---
5
+
6
+ These are complete `docs.config.ts` files. Start with a generated Cookbook
7
+ project, keep its `astro.config` integration, and replace the documentation
8
+ configuration with one recipe. Add the files listed above each example.
9
+ [Working examples](./examples.md) covers repository and npm source layouts;
10
+ [configuration](./configuration.md) and the [theme reference](./theme-and-components.md)
11
+ cover every option.
12
+
13
+ The repository's `pnpm check:recipes` extracts the marked examples below and in
14
+ Working examples verbatim, type-checks them, builds actual consumer sites, and
15
+ checks their output. Fixtures supply the documented content and local assets.
16
+ Network-dependent Google font coverage runs separately in `check:fonts`.
17
+
18
+ ## Brand, logo, and round header controls
19
+
20
+ Put your artwork at `public/logo.svg`. Logo files use their intrinsic aspect
21
+ ratio; the site title provides its label when the artwork is decorative.
22
+
23
+ ```ts cookbook-verify=branding
24
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
25
+
26
+ export default defineDocsConfig({
27
+ site: {
28
+ title: "Acme docs",
29
+ logo: { src: "./public/logo.svg", decorative: true },
30
+ },
31
+ theme: {
32
+ brand: { from: "#d97706" },
33
+ tokens: { "$header-control-radius": "999px", $radius: "8px" },
34
+ styles: { SearchResults: { Input: { radius: "12px" } } },
35
+ },
36
+ });
37
+ ```
38
+
39
+ The header token also covers the mobile sidebar close control. Copy buttons and
40
+ page navigation keep the base radius. Built-in element overrides merge into the
41
+ complete defaults. See the [named style anatomy](./theme-and-components.md).
42
+
43
+ ## Local variable font
44
+
45
+ Place a licensed variable WOFF2 font at `public/fonts/acme.woff2`. This example
46
+ uses its normal style; add an italic file when available.
47
+
48
+ ```ts cookbook-verify=local-font
49
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
50
+
51
+ export default defineDocsConfig({
52
+ site: { title: "Acme docs" },
53
+ theme: {
54
+ brand: { from: "#315efb" },
55
+ fonts: {
56
+ body: {
57
+ family: "Acme Sans",
58
+ files: [{ src: "/fonts/acme.woff2", weight: "100 800" }],
59
+ },
60
+ },
61
+ presets: { heading: { fontWeight: 650 } },
62
+ },
63
+ });
64
+ ```
65
+
66
+ For Google Fonts use `fonts: { body: "Inter", heading: "Newsreader" }` instead.
67
+ Cookbook downloads and self-hosts the required weights and italics at build time.
68
+ See [fonts](./theme-and-components.md#change-font-families) for caching,
69
+ explicit ranges, styles, and remote delivery.
70
+
71
+ ## English and French
72
+
73
+ Create `docs/index.md`, `docs/guide.md`, `docs/fr/index.md`, and
74
+ `docs/fr/guide.md`. Routes are `/`, `/guide`, `/fr`, and `/fr/guide`.
75
+
76
+ ```ts cookbook-verify=locales
77
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
78
+
79
+ export default defineDocsConfig({
80
+ site: { title: "Acme docs", url: "https://docs.example.com" },
81
+ content: { sources: [{ glob: "docs/**/*.md", base: "docs" }] },
82
+ locales: {
83
+ root: { label: "English", lang: "en" },
84
+ fr: { label: "Français" },
85
+ },
86
+ defaultLocale: "root",
87
+ navigation: ["/", "/guide"],
88
+ translations: { fr: { appearance: "Présentation" } },
89
+ });
90
+ ```
91
+
92
+ Navigation adapts to real translations. Missing translations use a real fallback
93
+ in the language picker; they do not generate phantom routes or alternate links.
94
+
95
+ ## Preview publishing
96
+
97
+ Set the preview's own URL and Astro `base` if hosted in a subdirectory. Serve
98
+ private previews behind host authentication.
99
+
100
+ ```ts cookbook-verify=preview
101
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
102
+
103
+ export default defineDocsConfig({
104
+ site: {
105
+ title: "Acme preview",
106
+ url: "https://preview.example.com",
107
+ seo: { index: false, copyPage: false },
108
+ },
109
+ tableOfContents: { mobile: true },
110
+ });
111
+ ```
112
+
113
+ Build, run `cookbook check-build`, deploy that output, then run
114
+ `cookbook check-build --url https://preview.example.com/`. See
115
+ [deployment](./deployment.md) for production metadata, host headers, and sitemap
116
+ checks, and [troubleshooting](./troubleshooting.md) when a check fails.