@tenphi/cookbook 0.13.0 → 0.16.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.
Files changed (51) hide show
  1. package/README.md +22 -1
  2. package/dist/cli.js +103 -61
  3. package/dist/cli.js.map +1 -1
  4. package/dist/components.d.ts +3 -2
  5. package/dist/components.js +2 -2
  6. package/dist/config.d.ts +3 -0
  7. package/dist/config.js +3 -0
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.js +2 -2
  10. package/docs/architecture.md +91 -0
  11. package/docs/authoring.mdx +86 -0
  12. package/docs/cli.md +88 -0
  13. package/docs/configuration.md +518 -0
  14. package/docs/content-sources.md +150 -0
  15. package/docs/customization-rules.md +153 -0
  16. package/docs/deployment.md +78 -0
  17. package/docs/examples.md +95 -0
  18. package/docs/getting-started.md +124 -0
  19. package/docs/index.md +74 -0
  20. package/docs/migration.md +36 -0
  21. package/docs/starlight-comparison.md +124 -0
  22. package/docs/theme-and-components.md +668 -0
  23. package/docs/upstream/glaze/LICENSE +21 -0
  24. package/docs/upstream/glaze/README.md +156 -0
  25. package/docs/upstream/glaze/docs/api.md +2021 -0
  26. package/docs/upstream/glaze/docs/methodology.md +686 -0
  27. package/docs/upstream/glaze/docs/migration.md +351 -0
  28. package/docs/upstream/glaze/docs/okhst.md +207 -0
  29. package/docs/upstream/manifest.json +18 -0
  30. package/docs/upstream/tasty/LICENSE +21 -0
  31. package/docs/upstream/tasty/README.md +685 -0
  32. package/docs/upstream/tasty/docs/README.md +39 -0
  33. package/docs/upstream/tasty/docs/adoption.md +323 -0
  34. package/docs/upstream/tasty/docs/ai-agents.md +229 -0
  35. package/docs/upstream/tasty/docs/comparison.md +448 -0
  36. package/docs/upstream/tasty/docs/configuration.md +823 -0
  37. package/docs/upstream/tasty/docs/debug.md +335 -0
  38. package/docs/upstream/tasty/docs/design-system.md +455 -0
  39. package/docs/upstream/tasty/docs/dsl.md +1021 -0
  40. package/docs/upstream/tasty/docs/getting-started.md +238 -0
  41. package/docs/upstream/tasty/docs/injector.md +634 -0
  42. package/docs/upstream/tasty/docs/methodology.md +648 -0
  43. package/docs/upstream/tasty/docs/migration-v3.md +285 -0
  44. package/docs/upstream/tasty/docs/pipeline.md +749 -0
  45. package/docs/upstream/tasty/docs/plugins.md +353 -0
  46. package/docs/upstream/tasty/docs/react-api.md +681 -0
  47. package/docs/upstream/tasty/docs/runtime-benchmarks.md +351 -0
  48. package/docs/upstream/tasty/docs/ssr.md +610 -0
  49. package/docs/upstream/tasty/docs/styles.md +677 -0
  50. package/docs/upstream/tasty/docs/tasty-static.md +582 -0
  51. package/package.json +17 -9
@@ -0,0 +1,153 @@
1
+ ---
2
+ title: Customization rules
3
+ description: The customization contract for Cookbook consumers and coding agents, with local Tasty and Glaze references.
4
+ sidebar:
5
+ order: 5
6
+ ---
7
+ Read this guide before changing a Cookbook site's appearance. It applies to
8
+ consumer projects and custom components. Cookbook's repository `AGENTS.md`
9
+ also covers engine maintenance; consumers do not need to edit its component
10
+ registries or internal helpers.
11
+
12
+ ## Read the configuration first
13
+
14
+ Inspect `docs.config.ts`, `tasty.config.ts`, and the components you are changing.
15
+ Reuse the site's existing semantic colors, tokens, presets, responsive states,
16
+ and named sub-elements. Do not invent configuration names. Consult the complete
17
+ [component anatomy reference](./theme-and-components.md#style-customization)
18
+ before overriding a built-in component.
19
+
20
+ ## Choose the customization surface
21
+
22
+ | Change | Supported surface |
23
+ | ----------------------------- | ------------------------------------------------------ |
24
+ | Brand and semantic colors | `theme.brand` and the supported `theme.palette` inputs |
25
+ | Shared dimensions and spacing | `theme.tokens` |
26
+ | Typography | `theme.presets` |
27
+ | Responsive conditions | `theme.states` |
28
+ | Existing component appearance | Partial Tasty objects in `theme.styles.<Name>` |
29
+ | Custom component appearance | `defineComponent()` and `theme.customStyles.<Name>` |
30
+ | Markup or behavior | `components.overrides` with an owned Astro component |
31
+
32
+ Prefer configuration changes when the markup and behavior already fit. Supply
33
+ only the properties you want to change: Cookbook merges partial overrides into
34
+ its complete base styles using Tasty's `mergeStyles`. Do not copy the entire
35
+ default style tree or rebuild it in user configuration. Built-in names belong
36
+ in `theme.styles`; custom names belong in `theme.customStyles`.
37
+
38
+ ```ts
39
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
40
+
41
+ export default defineDocsConfig({
42
+ theme: {
43
+ styles: {
44
+ StarlightHeader: { SiteTitle: { preset: "h4 / strong" } },
45
+ },
46
+ },
47
+ });
48
+ ```
49
+
50
+ ## Write styles through Cookbook
51
+
52
+ Import `defineComponent`, `tasty`, `useGlobalStyles`, `resolveComponentStyles`,
53
+ and `mergeStyles` from `@tenphi/cookbook/styling` as needed. Cookbook supplies
54
+ the configured runtime and extracts static CSS; installing another Tasty
55
+ integration or calling upstream `configure()` is unnecessary. Shared settings
56
+ belong in `docs.config.ts`.
57
+
58
+ * Express styles with Tasty. Do not add CSS files, CSS modules, Astro `<style>`
59
+ blocks, inline `style` attributes, or imported Starlight styles to customize
60
+ the documentation interface. The isolated content of `Preview` is a separate
61
+ demonstration surface.
62
+ * Model descendants and pseudo-elements as named sub-elements inside the
63
+ owning style object. Keep their selectors and base styles together instead
64
+ of spreading component anatomy across unrelated global rules.
65
+ * Use semantic color tokens such as `#text`, `#surface`, and `#accent-text`
66
+ in component styles. Configure color seeds through `theme.brand` and the
67
+ supported `theme.palette` roles so Glaze can resolve every scheme and
68
+ contrast mode. Do not hard-code component colors or invent palette keys.
69
+ * Apply semantic typography with `preset`, for example `"small"` or
70
+ `"h2 / strong"`. Do not reconstruct presets from individual font tokens or
71
+ wire modifier internals such as `$bold-font-weight` yourself.
72
+ * Use `defineComponent(name, options)` for customizable component roots.
73
+ For global style trees, pass `resolveComponentStyles(name, baseStyles)` to
74
+ `useGlobalStyles()`. Both read partial overrides from `theme.customStyles`.
75
+ Document each custom component's name and complete named sub-element list.
76
+ * When replacing a component, own its markup and behavior. Keep keyboard
77
+ access, focus, semantics, responsive behavior, and appearance modes intact.
78
+
79
+ The [custom component examples](./theme-and-components.md#authoring-custom-components)
80
+ show both a component root and a global style tree using these APIs.
81
+
82
+ ## Read the underlying references
83
+
84
+ Cookbook's rules govern its integration and supported customization surfaces.
85
+ Use the upstream references for syntax and color behavior. Upstream examples
86
+ may configure standalone applications or other frameworks; keep Cookbook's
87
+ imports, configuration, and rendering setup when adapting them.
88
+
89
+ * [Tasty style rules for AI agents](./upstream/tasty/docs/ai-agents.md): concise
90
+ rules for values, state maps, tokens, selectors, and sub-elements.
91
+ * [Tasty style DSL](./upstream/tasty/docs/dsl.md) and
92
+ [style properties](./upstream/tasty/docs/styles.md): syntax and property reference.
93
+ * [Tasty methodology](./upstream/tasty/docs/methodology.md) and
94
+ [configuration](./upstream/tasty/docs/configuration.md): component design and shared settings.
95
+ * [Glaze methodology](./upstream/glaze/docs/methodology.md): semantic palettes
96
+ and contrast relationships.
97
+ * [Glaze API](./upstream/glaze/docs/api.md): color inputs, schemes, and contrast solving.
98
+
99
+ ## Documentation in the installed package
100
+
101
+ The public `@tenphi/cookbook` package includes this guide and the rest of the
102
+ Cookbook documentation in `docs/`. Its `docs/upstream/` directory contains
103
+ generated Tasty and Glaze documentation snapshots, their READMEs, and licenses.
104
+ `docs/upstream/manifest.json` records the source package versions and release
105
+ references. These match the dependencies used to build that Cookbook release;
106
+ consumer dependency overrides can change the installed runtime independently.
107
+
108
+ In the packaged copies, links to available upstream reference pages point to
109
+ these local snapshots. The Markdown references work offline. Links to source
110
+ code and artwork absent from the npm packages point to their upstream release
111
+ and still need internet access. The published website keeps its online links.
112
+
113
+ Start at `node_modules/@tenphi/cookbook/docs/customization-rules.md`. When the
114
+ package manager uses a different layout, resolve the exported documentation
115
+ path from the consuming project:
116
+
117
+ ```sh
118
+ node --input-type=module -e "console.log(import.meta.resolve('@tenphi/cookbook/docs/customization-rules.md'))"
119
+ ```
120
+
121
+ Read the resolved file as Markdown; documentation exports are file references,
122
+ not JavaScript modules. The snapshots are generated during Cookbook's build
123
+ and packaging, with no network fetch or consumer installation hook.
124
+
125
+ ## Guide coding agents explicitly
126
+
127
+ Having documentation installed does not ensure an agent reads it. Add a short
128
+ instruction to your project's existing agent guidance, adjusting the path for
129
+ the app that depends on Cookbook:
130
+
131
+ ```md
132
+ Before customizing this Cookbook site, read
133
+ node_modules/@tenphi/cookbook/docs/customization-rules.md and follow its linked
134
+ Tasty and Glaze references. Inspect docs.config.ts and tasty.config.ts first.
135
+ Use Cookbook's public styling APIs, semantic palette tokens, typography
136
+ presets, and partial component overrides. Run the project's style lint,
137
+ cookbook doctor, and build commands after changes.
138
+ ```
139
+
140
+ ## Check the result
141
+
142
+ Adopt the [Cookbook Tasty lint configuration](./theme-and-components.md#linting-custom-styles)
143
+ and extend its built-in vocabulary in `tasty.config.ts`:
144
+
145
+ ```ts
146
+ export default { extends: "@tenphi/cookbook" };
147
+ ```
148
+
149
+ Run the configured style linter, `cookbook doctor`, and the site build. The
150
+ linter checks supported Tasty rules; it does not enforce every architectural
151
+ rule above or inspect arbitrary CSS. Review custom components at mobile and
152
+ desktop sizes, with keyboard navigation, in light and dark schemes, and with
153
+ normal and high contrast.
@@ -0,0 +1,78 @@
1
+ ---
2
+ title: Deployment
3
+ description: Build static output for GitHub Pages and other static hosts.
4
+ sidebar:
5
+ order: 7
6
+ ---
7
+
8
+ Cookbook always produces a static Astro build. The output in `dist/` can be
9
+ served by GitHub Pages, Cloudflare Pages, Netlify, Vercel static hosting, or a
10
+ plain file server.
11
+
12
+ ## Build locally
13
+
14
+ ```sh
15
+ npm run build
16
+ npm run preview
17
+ ```
18
+
19
+ Run [`cookbook doctor`](./cli.md#validate-with-doctor) in CI before building
20
+ when you want a focused content diagnostic step.
21
+
22
+ ## GitHub Pages
23
+
24
+ Give the deployment workflow read access to the repository plus permission to
25
+ write Pages and request an identity token:
26
+
27
+ ```yaml
28
+ permissions:
29
+ contents: read
30
+ pages: write
31
+ id-token: write
32
+ ```
33
+
34
+ Build the site, upload `dist/` with the official Pages artifact action, and
35
+ deploy it with the official Pages deploy action. Use GitHub's `github-pages`
36
+ environment so the deployment URL and protection rules remain visible in the
37
+ repository.
38
+
39
+ For an organization or user site, keep Astro's `base: "/"`. For a project site
40
+ served at `https://owner.github.io/repository/`, set Astro's
41
+ `base: "/repository/"`; Cookbook derives the same base for its graph and
42
+ assets.
43
+
44
+ ## Custom domains
45
+
46
+ Set Cookbook's canonical site metadata to the HTTPS origin. The integration
47
+ forwards it to Astro:
48
+
49
+ ```ts
50
+ export default defineConfig({
51
+ integrations: [
52
+ cookbook({
53
+ config: {
54
+ site: { url: "https://docs.example.com" },
55
+ },
56
+ }),
57
+ ],
58
+ });
59
+ ```
60
+
61
+ Configure the custom domain in the repository's Pages settings and point DNS
62
+ at the GitHub Pages host. For a custom Actions workflow, GitHub stores the
63
+ domain in the Pages settings; a `CNAME` file in the artifact is ignored and is
64
+ not required.
65
+
66
+ This site is deployed by the repository's Pages workflow to
67
+ `cookbook.tenphi.me` with HTTPS enforcement enabled.
68
+
69
+ ## Other static hosts
70
+
71
+ Use the host's ordinary static-site settings:
72
+
73
+ - build command: `npm run build`
74
+ - publish directory: `dist`
75
+ - Node.js: 22.14 or newer
76
+
77
+ If the host serves the site below a path rather than at an origin root, set
78
+ Astro's `base`; Cookbook derives it automatically.
@@ -0,0 +1,95 @@
1
+ ---
2
+ title: Working examples
3
+ description: Complete configuration patterns for repositories, monorepos, npm content, and shared themes.
4
+ sidebar:
5
+ order: 3
6
+ ---
7
+
8
+ Each example uses the same Astro integration:
9
+
10
+ ```ts
11
+ import { defineConfig } from "astro/config";
12
+ import cookbook from "@tenphi/cookbook";
13
+
14
+ export default defineConfig({ integrations: [cookbook()] });
15
+ ```
16
+
17
+ ## Local repository
18
+
19
+ Put this in `docs.config.ts` at the repository root. README/docs discovery is
20
+ automatic; add `content.sources` only when you need different routes or files.
21
+
22
+ ```ts
23
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
24
+
25
+ export default defineDocsConfig({ site: { title: "My library" } });
26
+ ```
27
+
28
+ Run `cookbook doctor`, then `astro dev` or `astro build`.
29
+
30
+ ## Monorepo with two packages
31
+
32
+ For an app in `apps/docs/`, resolve content from the repository, then give each
33
+ source an ID, a root, and a route mount:
34
+
35
+ ```ts
36
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
37
+
38
+ export default defineDocsConfig({
39
+ root: "../..",
40
+ site: { title: "SDK documentation" },
41
+ content: {
42
+ sources: [
43
+ { id: "api", root: "packages/api", glob: "**/*.md", routeBase: "/api" },
44
+ { id: "ui", root: "packages/ui", glob: "**/*.md", routeBase: "/ui" },
45
+ ],
46
+ },
47
+ });
48
+ ```
49
+
50
+ Use `source:ui/README.md` for an explicit link to the UI package. Ordinary relative
51
+ links stay in their own source mount when the same file appears in several
52
+ versions. A relative frontmatter slug is appended to that source's `routeBase`.
53
+
54
+ ## Locked npm documentation
55
+
56
+ ```ts
57
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
58
+
59
+ export default defineDocsConfig({
60
+ site: { title: "Published API" },
61
+ content: {
62
+ sources: [{ id: "api", package: "@scope/package@^2", routeBase: "/api" }],
63
+ },
64
+ });
65
+ ```
66
+
67
+ Run `cookbook update` once, commit `cookbook.lock.json`, then run `cookbook doctor`
68
+ and `astro build`. When changing `^2` to `^3`, run update again. A stale lock fails
69
+ with instructions instead of rendering the old version.
70
+
71
+ A package source can specify `registry` for an alternative registry. The default
72
+ is the npm public registry. Keep credentials out of committed configuration.
73
+
74
+ ## Share configuration and themes
75
+
76
+ A preset is an ordinary exported `DocsConfig` object:
77
+
78
+ ```ts
79
+ import { defineDocsConfig, mergeDocsConfig } from "@tenphi/cookbook/config";
80
+
81
+ const company = defineDocsConfig({
82
+ theme: { brand: "#315efb", tokens: { $radius: "8px" } },
83
+ markdown: { rawHtml: "sanitize" },
84
+ });
85
+
86
+ export default mergeDocsConfig(company, {
87
+ site: { title: "Product docs" },
88
+ theme: { tokens: { "$content-width": "52rem" } },
89
+ });
90
+ ```
91
+
92
+ Objects merge recursively, arrays replace, and inputs are not mutated. Tasty
93
+ styles preserve their default values when adding conditional overrides. A preset
94
+ can live in a shared workspace package. Component overrides remain partial Tasty
95
+ objects and merge into Cookbook's complete base styles inside the renderer.
@@ -0,0 +1,124 @@
1
+ ---
2
+ title: Getting started
3
+ description: Start a documentation site, document an existing repository, or use a published npm package.
4
+ sidebar:
5
+ order: 2
6
+ ---
7
+
8
+ Cookbook requires Node.js 22.14 or newer.
9
+
10
+ ## Create your first site
11
+
12
+ ```sh
13
+ npm create @tenphi/cookbook@latest my-docs -- --yes
14
+ cd my-docs
15
+ npm run dev
16
+ ```
17
+
18
+ The creator writes a README, Astro configuration, and `docs.config.ts`, then
19
+ installs dependencies. Edit `README.md` to change the home page. Add
20
+ `docs/guide.md` to create `/guide`. New and edited pages appear in the development
21
+ server without a restart.
22
+
23
+ ## Document an existing repository
24
+
25
+ Run this from your repository root:
26
+
27
+ ```sh
28
+ npm create @tenphi/cookbook@latest docs-site -- --source . --yes
29
+ cd docs-site
30
+ npm run dev
31
+ ```
32
+
33
+ The generated `docs.config.ts` points back to your repository. Your root README
34
+ becomes the home page and `docs/**/*.{md,mdx}` supplies the other pages. Cookbook
35
+ reads those files without copying or rewriting them.
36
+
37
+ Use `--no-install` to generate files before installing dependencies. The creator
38
+ refuses to overwrite a non-empty destination in non-interactive mode.
39
+
40
+ ## Document a published npm package
41
+
42
+ ```sh
43
+ npm create @tenphi/cookbook@latest my-package-docs -- \
44
+ --package @scope/package@latest --yes
45
+ cd my-package-docs
46
+ npm run dev
47
+ ```
48
+
49
+ The creator discovers documentation inside the actual published artifact and
50
+ writes its exact version and integrity to `cookbook.lock.json`. Commit this file.
51
+ The documented package is not installed and its lifecycle scripts do not run.
52
+ Run `npm run update` when you want to resolve the requested tag or range again.
53
+
54
+ ## Add to an existing Astro project
55
+
56
+ ```sh
57
+ npx astro add @tenphi/cookbook
58
+ ```
59
+
60
+ Your Astro configuration needs one integration:
61
+
62
+ ```ts
63
+ import { defineConfig } from "astro/config";
64
+ import cookbook from "@tenphi/cookbook";
65
+
66
+ export default defineConfig({ integrations: [cookbook()] });
67
+ ```
68
+
69
+ Cookbook includes Starlight and discovers `docs.config.ts` automatically.
70
+ With no documentation configuration, it uses README/docs conventions.
71
+
72
+ ## Configure the site
73
+
74
+ Read the [customization rules](./customization-rules.md) before changing the
75
+ theme or adding custom components. These rules and their upstream references
76
+ are also included in the installed Cookbook package.
77
+
78
+ Create `docs.config.ts` next to `astro.config.ts`:
79
+
80
+ ```ts
81
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
82
+
83
+ export default defineDocsConfig({
84
+ site: {
85
+ title: "Example Project",
86
+ description: "Documentation for Example Project",
87
+ repository: "https://github.com/example/project",
88
+ },
89
+ theme: { brand: "#2f5bff" },
90
+ });
91
+ ```
92
+
93
+ The integration and CLI load the same configuration. Supported filenames are
94
+ `docs.config.ts`, `.mts`, `.js`, and `.mjs`, in that order. An explicit integration
95
+ `config` object takes precedence; `configFile: false` disables discovery.
96
+ Use `cookbook({ configFile: "./config/manual.ts" })` and
97
+ `cookbook doctor --config ./config/manual.ts` for a nonstandard location.
98
+
99
+ ## Monorepo roots
100
+
101
+ An app in `apps/docs/` can use repository content with:
102
+
103
+ ```ts
104
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
105
+
106
+ export default defineDocsConfig({ root: "../.." });
107
+ ```
108
+
109
+ `root` is relative to the documentation configuration file. It controls content,
110
+ local assets, and `cookbook.lock.json`. Run `npm run doctor` from the app directory;
111
+ it resolves the same repository root as the integration. Individual sources can
112
+ also declare their own roots for multi-package sites.
113
+
114
+ ## Validate and publish
115
+
116
+ ```sh
117
+ npm run doctor
118
+ npm run build
119
+ npm run preview
120
+ ```
121
+
122
+ See [working examples](./examples.md), [authoring components](./authoring.mdx),
123
+ and [deployment](./deployment.md). Existing users should read the
124
+ [prerelease migration guide](./migration.md).
package/docs/index.md ADDED
@@ -0,0 +1,74 @@
1
+ ---
2
+ title: Cookbook
3
+ description: Build a polished static documentation site from the Markdown your project already owns.
4
+ template: splash
5
+ hero:
6
+ title: Documentation that stays with the code.
7
+ tagline: Turn repository Markdown or a locked npm package into a polished, searchable Astro site—without creating a second source of truth.
8
+ image:
9
+ html: '<svg xmlns="http://www.w3.org/2000/svg" width="240" height="240" viewBox="0 0 64 64" aria-hidden="true"><rect width="64" height="64" rx="14" fill="currentColor"/><path fill="#fff" d="M14.8 16c6.7.2 12.3 2 16.7 5.4v28.4c-4.4-3.1-10-4.7-16.6-4.9a3 3 0 0 1-2.9-3V19a3 3 0 0 1 2.8-3Z"/><path fill="#fff" d="M49.2 16c-6.7.2-12.3 2-16.7 5.4v28.4c4.4-3.1 10-4.7 16.6-4.9a3 3 0 0 0 2.9-3V19a3 3 0 0 0-2.8-3Z"/></svg>'
10
+ actions:
11
+ - text: Get started
12
+ link: /getting-started/
13
+ variant: primary
14
+ - text: See how it compares
15
+ link: /starlight-comparison/
16
+ variant: secondary
17
+ sidebar:
18
+ order: 1
19
+ ---
20
+ ## Keep documentation close to its source
21
+
22
+ Cookbook combines [Astro](https://astro.build) and
23
+ [Starlight](https://starlight.astro.build) with repository-aware content,
24
+ strict validation, local Pagefind search, and a theme powered by
25
+ [Tasty](./upstream/tasty/README.md) and [Glaze](./upstream/glaze/README.md).
26
+
27
+ ### Repository-native
28
+
29
+ Keep `README.md`, `docs/`, and local assets where they already live. Cookbook
30
+ transforms sources in memory and never rewrites them.
31
+
32
+ ### Package-first
33
+
34
+ Build a reproducible site from the files actually published to npm—without
35
+ cloning the package repository or running its lifecycle scripts.
36
+
37
+ ### Strict and static
38
+
39
+ Broken links, missing assets, duplicate routes, invalid navigation, and unsafe
40
+ paths fail with source locations. The result is prerendered HTML and CSS ready
41
+ for GitHub Pages or any static host.
42
+
43
+ ## Choose a path
44
+
45
+ Create a documentation project from a published npm package:
46
+
47
+ ```sh
48
+ npm create @tenphi/cookbook@latest my-package-docs -- --package your-package
49
+ ```
50
+
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.
59
+
60
+ ## See the product, not a mock-up
61
+
62
+ The pages you are reading live in this repository's root `docs/` directory.
63
+ The small Astro app under `apps/reference` points the integration at the
64
+ repository root, validates this content through the same graph-backed route
65
+ pipeline used by consumer sites, builds the site, and publishes the result to
66
+ GitHub Pages. There is no copied documentation tree.
67
+
68
+ This homepage also uses Cookbook's public `template: splash` and `hero`
69
+ frontmatter. The heading permalinks, code-copy controls, edit links, and Git
70
+ timestamps throughout the guide are the same capabilities available to every
71
+ Cookbook site.
72
+
73
+ See [Architecture](./architecture.md) for the package boundaries behind the
74
+ site.
@@ -0,0 +1,36 @@
1
+ ---
2
+ title: Prerelease migration
3
+ description: Upgrade to the shared configuration, source identity, and typed customization APIs.
4
+ sidebar:
5
+ order: 9
6
+ ---
7
+
8
+ This prerelease intentionally tightens several contracts.
9
+
10
+ - Move generated inline documentation configuration to `docs.config.ts` and use
11
+ `cookbook()` in Astro. Existing explicit `cookbook({ config })` remains valid,
12
+ but CLI commands read the shared configuration file.
13
+ - For nested Astro apps, put `root: "../.."` in `docs.config.ts`; paths resolve
14
+ relative to that file. Individual sources may now specify `root` and `id`.
15
+ - Run `cookbook update` after changing a requested npm specifier. A lock for
16
+ another range or tag is no longer accepted by package name alone.
17
+ - `rawHtml: "sanitize"` preserves safe HTML and removes executable markup and
18
+ presentational attributes. Use `"strip"` for the former removal behavior;
19
+ removal now emits a diagnostic. `"reject"` still fails validation.
20
+ - Unrecognized page frontmatter is kept in graph entry `metadata`. Use
21
+ `content.frontmatter: "reject"` for the former strict behavior. Cookbook's
22
+ recognized fields retain their validation.
23
+ - `slug` is now relative to the source mount, including when it starts with `/`.
24
+ Use a separate source mount for an unrelated public route.
25
+ - Repeated files in separate source declarations create separate entries.
26
+ Give mounts stable IDs and use `source:<id>/<source-path>` for explicit links.
27
+ `entryBySource(path)` returns `undefined` for an ambiguous path; pass a source
28
+ ID as its second argument. Graph entry IDs include the source ID.
29
+ - Unknown names in `theme.styles` are errors. Register user-authored component
30
+ styles in `theme.customStyles`. Built-in component names and sub-elements
31
+ provide strict editor checking; style objects still contain only overrides.
32
+ - `Tabs` now expects `Tab` children with accessible labels. It provides keyboard
33
+ navigation and panels; use an ordinary custom component for a grouping layout.
34
+
35
+ See [authoring](./authoring.mdx) for the new components and [working
36
+ examples](./examples.md) for complete configuration patterns.
@@ -0,0 +1,124 @@
1
+ ---
2
+ title: Cookbook and Starlight
3
+ description: Understand which Starlight authoring conventions Cookbook preserves and where its repository and theme model differs.
4
+ sidebar:
5
+ order: 5
6
+ ---
7
+ Cookbook uses [Astro Starlight](https://starlight.astro.build/) as its
8
+ documentation shell. It keeps familiar page-authoring conventions while adding
9
+ repository and npm content sources, stricter validation, and a Tasty/Glaze
10
+ theme model.
11
+
12
+ ## Cookbook or Starlight?
13
+
14
+ Start with the place where the documentation must live. Starlight is a strong
15
+ choice when an Astro site owns its content. Cookbook is designed for projects
16
+ where the repository Markdown—or the documentation actually published in an
17
+ npm package—must remain the source of truth.
18
+
19
+ | Concern | Starlight | Cookbook |
20
+ | ----------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
21
+ | Starting point | Add Starlight to an Astro project and author its documentation content collection. | Add one integration to an Astro project, or generate a complete site directly from a published npm package. |
22
+ | Content ownership | The documentation site conventionally owns its Markdown under `src/content/docs/`. | Reads `README.md`, repository `docs/` trees, files outside the Astro app, and selected files from npm artifacts without copying or rewriting them. |
23
+ | Reproducible releases | Follows the dependencies and content committed with the site. | Can lock an npm package to its exact resolved version and integrity, then rebuild from the files users actually receive. |
24
+ | Build guarantees | Provides Starlight's content schema and Astro build pipeline. | Adds strict checks for duplicate routes, broken links, missing assets, unsafe paths, and invalid navigation with source-aware diagnostics. |
25
+ | Design system | Supports CSS variables, custom CSS, and component overrides. | Exposes the full [Tasty styling DSL](./upstream/tasty/docs/dsl.md) through configuration, with Glaze-generated semantic colors and named style trees for Cookbook and shell surfaces. |
26
+ | Familiar authoring | Defines the Starlight page, navigation, i18n, and frontmatter conventions. | Preserves those conventions—including splash pages, locales, edit links, and last-updated metadata—while resolving them against each original source. |
27
+ | Structural escape hatch | Replaces Starlight components when markup or behavior must change. | Supports Astro component overrides for structural changes; visual changes normally stay in typed `theme` configuration. |
28
+
29
+ Choose Starlight when the documentation site is the natural home for the
30
+ content and its CSS-oriented customization model fits the project. Choose
31
+ Cookbook when documentation must stay beside the code, match a published
32
+ package, fail strictly when references drift, or expose a reusable design
33
+ system entirely through configuration.
34
+
35
+ ## Customize with Tasty's DSL
36
+
37
+ Cookbook customization is not limited to replacing token values. Every entry
38
+ under `theme.styles` is a partial Tasty style object that Cookbook merges into
39
+ the component's base style tree. That gives configuration access to the same
40
+ responsive values, state maps, calculations, semantic tokens, typography
41
+ presets, and named sub-elements used by Cookbook itself:
42
+
43
+ ```ts
44
+ export default defineDocsConfig({
45
+ theme: {
46
+ states: {
47
+ "@touch": "@media(pointer: coarse)",
48
+ },
49
+ styles: {
50
+ MarkdownCodeBlock: {
51
+ Pre: {
52
+ padding: {
53
+ "": "2x 4x",
54
+ "@mobile": "1.5x 3x",
55
+ },
56
+ radius: "$card-radius",
57
+ },
58
+ CopyButton: {
59
+ inlineSize: {
60
+ "": "2rem",
61
+ "@touch": "2.5rem",
62
+ },
63
+ scale: {
64
+ "": "1",
65
+ ":active": "0.94",
66
+ },
67
+ },
68
+ },
69
+ },
70
+ },
71
+ });
72
+ ```
73
+
74
+ The user supplies only overrides; the merge happens inside Cookbook. See
75
+ [Theme and components](./theme-and-components.md#style-customization) for the
76
+ complete component and sub-element inventory, and the
77
+ [Tasty documentation](./upstream/tasty/docs/README.md) for the DSL's properties and
78
+ conditional syntax. Structural Astro overrides remain available when a change
79
+ requires different markup or behavior rather than styling.
80
+
81
+ ## Configure the shared capabilities
82
+
83
+ ```ts
84
+ export default defineDocsConfig({
85
+ editLink: {
86
+ baseUrl: "https://github.com/example/project/edit/main/",
87
+ },
88
+ lastUpdated: true,
89
+ locales: {
90
+ root: { label: "English", lang: "en" },
91
+ fr: { label: "Français", lang: "fr" },
92
+ },
93
+ defaultLocale: "root",
94
+ });
95
+ ```
96
+
97
+ The keys deliberately match Starlight so an existing Starlight author does not
98
+ need to relearn page metadata or i18n. Cookbook resolves edit and Git metadata
99
+ before handing each page to Starlight because its source may live in a root
100
+ `docs/` directory, outside the Astro app, or inside a locked npm artifact.
101
+
102
+ ## Create a splash page
103
+
104
+ ```yaml
105
+ ---
106
+ title: Example
107
+ template: splash
108
+ hero:
109
+ title: Build something clear.
110
+ tagline: A short explanation of the value your project provides.
111
+ actions:
112
+ - text: Get started
113
+ link: /getting-started/
114
+ variant: primary
115
+ - text: View API
116
+ link: /reference/
117
+ variant: secondary
118
+ ---
119
+ ```
120
+
121
+ Use `template: doc` (the default) for conventional reference pages. See
122
+ Starlight's [page guide](https://starlight.astro.build/guides/pages/) for the
123
+ authoring model Cookbook builds on, then use [Theme and
124
+ components](./theme-and-components.md) for Cookbook-specific styling.