@tenphi/cookbook 0.15.0 → 0.17.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 (46) hide show
  1. package/README.md +25 -0
  2. package/dist/config.d.ts +2 -2
  3. package/dist/index.d.ts +2 -2
  4. package/docs/ai-agents.md +61 -0
  5. package/docs/architecture.md +91 -0
  6. package/docs/authoring.mdx +86 -0
  7. package/docs/cli.md +88 -0
  8. package/docs/configuration.md +587 -0
  9. package/docs/content-sources.md +178 -0
  10. package/docs/customization-rules.md +154 -0
  11. package/docs/deployment.md +95 -0
  12. package/docs/examples.md +101 -0
  13. package/docs/getting-started.md +134 -0
  14. package/docs/index.md +74 -0
  15. package/docs/migration.md +36 -0
  16. package/docs/starlight-comparison.md +124 -0
  17. package/docs/theme-and-components.md +745 -0
  18. package/docs/upstream/glaze/LICENSE +21 -0
  19. package/docs/upstream/glaze/README.md +156 -0
  20. package/docs/upstream/glaze/docs/api.md +2021 -0
  21. package/docs/upstream/glaze/docs/methodology.md +686 -0
  22. package/docs/upstream/glaze/docs/migration.md +351 -0
  23. package/docs/upstream/glaze/docs/okhst.md +207 -0
  24. package/docs/upstream/manifest.json +18 -0
  25. package/docs/upstream/tasty/LICENSE +21 -0
  26. package/docs/upstream/tasty/README.md +685 -0
  27. package/docs/upstream/tasty/docs/README.md +39 -0
  28. package/docs/upstream/tasty/docs/adoption.md +323 -0
  29. package/docs/upstream/tasty/docs/ai-agents.md +229 -0
  30. package/docs/upstream/tasty/docs/comparison.md +448 -0
  31. package/docs/upstream/tasty/docs/configuration.md +823 -0
  32. package/docs/upstream/tasty/docs/debug.md +335 -0
  33. package/docs/upstream/tasty/docs/design-system.md +455 -0
  34. package/docs/upstream/tasty/docs/dsl.md +1021 -0
  35. package/docs/upstream/tasty/docs/getting-started.md +238 -0
  36. package/docs/upstream/tasty/docs/injector.md +634 -0
  37. package/docs/upstream/tasty/docs/methodology.md +648 -0
  38. package/docs/upstream/tasty/docs/migration-v3.md +285 -0
  39. package/docs/upstream/tasty/docs/pipeline.md +749 -0
  40. package/docs/upstream/tasty/docs/plugins.md +353 -0
  41. package/docs/upstream/tasty/docs/react-api.md +681 -0
  42. package/docs/upstream/tasty/docs/runtime-benchmarks.md +351 -0
  43. package/docs/upstream/tasty/docs/ssr.md +610 -0
  44. package/docs/upstream/tasty/docs/styles.md +677 -0
  45. package/docs/upstream/tasty/docs/tasty-static.md +582 -0
  46. package/package.json +12 -7
@@ -0,0 +1,178 @@
1
+ ---
2
+ title: Content sources
3
+ description: Collect local files, OpenAPI specs, and locked npm package documentation into one route graph.
4
+ sidebar:
5
+ order: 3
6
+ ---
7
+
8
+ Cookbook first collects every source and assigns each one a canonical route.
9
+ Only then does it rewrite links and assets. That two-phase graph lets pages
10
+ link across directories and source declarations without depending on discovery
11
+ order.
12
+
13
+ ## Convention mode
14
+
15
+ When `content.sources` is omitted, Cookbook includes these sources when they
16
+ exist:
17
+
18
+ ```ts
19
+ [
20
+ { file: "README.md", route: "/" },
21
+ { glob: "docs/**/*.{md,mdx}", base: "docs" },
22
+ ];
23
+ ```
24
+
25
+ Files or directories beginning with `_` are excluded from glob discovery.
26
+ Explicit `content.sources` replace these conventions.
27
+
28
+ ## Local files
29
+
30
+ Use a file declaration for a single document with an optional explicit route
31
+ or inferred metadata:
32
+
33
+ ```ts
34
+ {
35
+ file: "README.md",
36
+ route: "/",
37
+ title: "Product documentation",
38
+ description: "Learn how to use the product."
39
+ }
40
+ ```
41
+
42
+ Use a glob for a documentation tree:
43
+
44
+ ```ts
45
+ {
46
+ glob: ["docs/**/*.md", "docs/**/*.mdx"],
47
+ base: "docs",
48
+ routeBase: "/",
49
+ exclude: ["docs/internal/**"]
50
+ }
51
+ ```
52
+
53
+ `base` is removed from generated routes. `routeBase` is then prepended. A
54
+ directory `README.md` or `index.md` maps to the directory route; other pages
55
+ use extensionless routes.
56
+
57
+ | Source path | `base` | `routeBase` | Route |
58
+ | -------------------- | ------ | ------------ | ---------------------------- |
59
+ | `README.md` | — | — | `/` when explicitly assigned |
60
+ | `docs/setup.md` | `docs` | — | `/setup` |
61
+ | `docs/api/index.md` | `docs` | — | `/api` |
62
+ | `docs/api/client.md` | `docs` | `/reference` | `/reference/api/client` |
63
+
64
+ Source paths are resolved from the configured project root. Paths outside that
65
+ root are rejected unless `content.allowOutsideRoot` is explicitly enabled.
66
+ Prefer an explicit source `root` when documenting another package; file and
67
+ glob paths, links, and assets are confined to that declared source root.
68
+
69
+ ## Source identities and repeated mounts
70
+
71
+ Every source can have an `id` containing letters, digits, underscores, and
72
+ hyphens. Without one, Cookbook uses `source-1`, `source-2`, and so on. Explicit
73
+ IDs are stable when declarations are reordered and must be unique.
74
+
75
+ ```ts
76
+ content: {
77
+ sources: [
78
+ { id: "v1", root: "versions/v1", glob: "**/*.md", routeBase: "/v1" },
79
+ { id: "v2", root: "versions/v2", glob: "**/*.md", routeBase: "/v2" },
80
+ ];
81
+ }
82
+ ```
83
+
84
+ The same files may appear in several mounts. Relative links prefer the current
85
+ source; an unambiguous page in another source can also resolve by file path.
86
+ Use `source:v2/guide.md` to select another mount explicitly. The path is relative
87
+ to that source's root, before `base` is removed from routes. Queries and heading
88
+ fragments are preserved.
89
+
90
+ A frontmatter `slug` is relative to `routeBase`, including when it begins with
91
+ `/`. For example, `slug: intro` under `/v2` creates `/v2/intro`. File sources also
92
+ accept `routeBase`, which prefixes their explicit `route`. Empty `sources: []`
93
+ means no sources; omit the property to enable conventions.
94
+
95
+ ## OpenAPI references
96
+
97
+ Add a local OpenAPI 3.x JSON or YAML document to generate a searchable overview
98
+ and one page per operation:
99
+
100
+ ```ts
101
+ content: {
102
+ sources: [
103
+ { file: "README.md", route: "/" },
104
+ { openapi: "api/openapi.yaml", routeBase: "/api" },
105
+ ],
106
+ }
107
+ ```
108
+
109
+ The overview appears at `/api`. An operation with `operationId: getWidget`
110
+ appears at `/api/get-widget`. Without an operation ID, Cookbook derives a route
111
+ from its method and path. Operation IDs must create distinct routes. The pages
112
+ include parameters, request bodies, responses, examples, and the document's
113
+ schemas. Source links point back to the spec file. Use a navigation item such
114
+ as `{ label: "API", link: "/api", items: [{ label: "Operations", autogenerate: { directory: "/api" } }] }`
115
+ to show the operations in the sidebar.
116
+
117
+ The source must stay within its declared `root` unless
118
+ `content.allowOutsideRoot` is enabled. External `$ref` values require bundling
119
+ into one local document before the build. Cookbook checks the spec size against
120
+ `build.maxAssetBytes` and reports invalid or duplicate operation routes.
121
+ Generated pages are static references; they do not make requests to the API.
122
+
123
+ ## npm package sources
124
+
125
+ Package sources read documentation from the actual npm artifact:
126
+
127
+ ```ts
128
+ {
129
+ package: "@scope/package@latest",
130
+ include: ["README.md", "docs/**/*.md"],
131
+ exclude: ["docs/internal/**"],
132
+ index: "README.md",
133
+ routeBase: "/"
134
+ }
135
+ ```
136
+
137
+ Run `cookbook update` to create or reconcile the lock after editing sources.
138
+ A production build uses the exact requested specifier, version, and integrity stored in
139
+ `cookbook.lock.json`. The package creator writes this lock automatically.
140
+ Artifacts are integrity-checked, extracted with file-count and size limits,
141
+ and cached by integrity.
142
+
143
+ Package Markdown is untrusted by default. Raw HTML is sanitized to safe
144
+ elements, HTML-capable frontmatter is stripped, custom `head` entries are discarded,
145
+ unsafe URL protocols are rejected, and MDX cannot execute. Set `trust: "mdx"`
146
+ only after reviewing the exact locked artifact; doing so allows its build-time
147
+ code to run. Trusted MDX is compiled by Starlight, including relative component
148
+ imports from the source file's directory. Package-provided indexes, include
149
+ patterns, exclude patterns, and every discovered file are confined to the
150
+ extracted artifact root.
151
+
152
+ ## Links and assets
153
+
154
+ Write ordinary repository-relative Markdown:
155
+
156
+ ```md
157
+ [Install](./getting-started.md)
158
+ ![Architecture](./assets/architecture.svg)
159
+ ```
160
+
161
+ Known document links are rewritten to public routes. Query strings and heading
162
+ fragments are preserved, and fragments are checked against the target page's
163
+ GitHub-style heading IDs. Inline and reference-style links and images are
164
+ supported. Local images and downloadable files are validated, content-hashed,
165
+ and copied into the static build.
166
+
167
+ Absolute web links, `mailto:`, `tel:`, and hash-only links remain unchanged by
168
+ default. Set `content.localizeRepositoryLinks: true` to rewrite absolute links
169
+ back into the collected documentation when they match `site.repository` or the
170
+ current package's `repository` manifest field. GitHub/GitLab `blob`, `tree`, and
171
+ `raw` URLs plus Bitbucket `src` URLs are recognized; query strings and fragments
172
+ are preserved. Links without a matching collected page remain external.
173
+
174
+ Missing relative links are errors in strict mode; missing assets and paths
175
+ escaping an allowed source root are always errors.
176
+
177
+ Run the [doctor command](./cli.md#validate-with-doctor) before committing a
178
+ large content move.
@@ -0,0 +1,154 @@
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
+ | Font loading and family roles | `theme.fonts` |
27
+ | Typography | `theme.presets` |
28
+ | Responsive conditions | `theme.states` |
29
+ | Existing component appearance | Partial Tasty objects in `theme.styles.<Name>` |
30
+ | Custom component appearance | `defineComponent()` and `theme.customStyles.<Name>` |
31
+ | Markup or behavior | `components.overrides` with an owned Astro component |
32
+
33
+ Prefer configuration changes when the markup and behavior already fit. Supply
34
+ only the properties you want to change: Cookbook merges partial overrides into
35
+ its complete base styles using Tasty's `mergeStyles`. Do not copy the entire
36
+ default style tree or rebuild it in user configuration. Built-in names belong
37
+ in `theme.styles`; custom names belong in `theme.customStyles`.
38
+
39
+ ```ts
40
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
41
+
42
+ export default defineDocsConfig({
43
+ theme: {
44
+ styles: {
45
+ StarlightHeader: { SiteTitle: { preset: "h4 / strong" } },
46
+ },
47
+ },
48
+ });
49
+ ```
50
+
51
+ ## Write styles through Cookbook
52
+
53
+ Import `defineComponent`, `tasty`, `useGlobalStyles`, `resolveComponentStyles`,
54
+ and `mergeStyles` from `@tenphi/cookbook/styling` as needed. Cookbook supplies
55
+ the configured runtime and extracts static CSS; installing another Tasty
56
+ integration or calling upstream `configure()` is unnecessary. Shared settings
57
+ belong in `docs.config.ts`.
58
+
59
+ * Express styles with Tasty. Do not add CSS files, CSS modules, Astro `<style>`
60
+ blocks, inline `style` attributes, or imported Starlight styles to customize
61
+ the documentation interface. The isolated content of `Preview` is a separate
62
+ demonstration surface.
63
+ * Model descendants and pseudo-elements as named sub-elements inside the
64
+ owning style object. Keep their selectors and base styles together instead
65
+ of spreading component anatomy across unrelated global rules.
66
+ * Use semantic color tokens such as `#text`, `#surface`, and `#accent-text`
67
+ in component styles. Configure Glaze color declarations through `theme.brand`
68
+ and the supported `theme.palette` roles so Glaze can resolve every scheme and
69
+ contrast mode. Do not hard-code component colors or invent palette keys.
70
+ * Apply semantic typography with `preset`, for example `"small"` or
71
+ `"h2 / strong"`. Do not reconstruct presets from individual font tokens or
72
+ wire modifier internals such as `$bold-font-weight` yourself.
73
+ * Use `defineComponent(name, options)` for customizable component roots.
74
+ For global style trees, pass `resolveComponentStyles(name, baseStyles)` to
75
+ `useGlobalStyles()`. Both read partial overrides from `theme.customStyles`.
76
+ Document each custom component's name and complete named sub-element list.
77
+ * When replacing a component, own its markup and behavior. Keep keyboard
78
+ access, focus, semantics, responsive behavior, and appearance modes intact.
79
+
80
+ The [custom component examples](./theme-and-components.md#authoring-custom-components)
81
+ show both a component root and a global style tree using these APIs.
82
+
83
+ ## Read the underlying references
84
+
85
+ Cookbook's rules govern its integration and supported customization surfaces.
86
+ Use the upstream references for syntax and color behavior. Upstream examples
87
+ may configure standalone applications or other frameworks; keep Cookbook's
88
+ imports, configuration, and rendering setup when adapting them.
89
+
90
+ * [Tasty style rules for AI agents](./upstream/tasty/docs/ai-agents.md): concise
91
+ rules for values, state maps, tokens, selectors, and sub-elements.
92
+ * [Tasty style DSL](./upstream/tasty/docs/dsl.md) and
93
+ [style properties](./upstream/tasty/docs/styles.md): syntax and property reference.
94
+ * [Tasty methodology](./upstream/tasty/docs/methodology.md) and
95
+ [configuration](./upstream/tasty/docs/configuration.md): component design and shared settings.
96
+ * [Glaze methodology](./upstream/glaze/docs/methodology.md): semantic palettes
97
+ and contrast relationships.
98
+ * [Glaze API](./upstream/glaze/docs/api.md): color inputs, schemes, and contrast solving.
99
+
100
+ ## Documentation in the installed package
101
+
102
+ The public `@tenphi/cookbook` package includes this guide and the rest of the
103
+ Cookbook documentation in `docs/`. Its `docs/upstream/` directory contains
104
+ generated Tasty and Glaze documentation snapshots, their READMEs, and licenses.
105
+ `docs/upstream/manifest.json` records the source package versions and release
106
+ references. These match the dependencies used to build that Cookbook release;
107
+ consumer dependency overrides can change the installed runtime independently.
108
+
109
+ In the packaged copies, links to available upstream reference pages point to
110
+ these local snapshots. The Markdown references work offline. Links to source
111
+ code and artwork absent from the npm packages point to their upstream release
112
+ and still need internet access. The published website keeps its online links.
113
+
114
+ Start at `node_modules/@tenphi/cookbook/docs/customization-rules.md`. When the
115
+ package manager uses a different layout, resolve the exported documentation
116
+ path from the consuming project:
117
+
118
+ ```sh
119
+ node --input-type=module -e "console.log(import.meta.resolve('@tenphi/cookbook/docs/customization-rules.md'))"
120
+ ```
121
+
122
+ Read the resolved file as Markdown; documentation exports are file references,
123
+ not JavaScript modules. The snapshots are generated during Cookbook's build
124
+ and packaging, with no network fetch or consumer installation hook.
125
+
126
+ ## Guide coding agents explicitly
127
+
128
+ Having documentation installed does not ensure an agent reads it. Add a short
129
+ instruction to your project's existing agent guidance, adjusting the path for
130
+ the app that depends on Cookbook:
131
+
132
+ ```md
133
+ Before customizing this Cookbook site, read
134
+ node_modules/@tenphi/cookbook/docs/customization-rules.md and follow its linked
135
+ Tasty and Glaze references. Inspect docs.config.ts and tasty.config.ts first.
136
+ Use Cookbook's public styling APIs, semantic palette tokens, typography
137
+ presets, and partial component overrides. Run the project's style lint,
138
+ cookbook doctor, and build commands after changes.
139
+ ```
140
+
141
+ ## Check the result
142
+
143
+ Adopt the [Cookbook Tasty lint configuration](./theme-and-components.md#linting-custom-styles)
144
+ and extend its built-in vocabulary in `tasty.config.ts`:
145
+
146
+ ```ts
147
+ export default { extends: "@tenphi/cookbook" };
148
+ ```
149
+
150
+ Run the configured style linter, `cookbook doctor`, and the site build. The
151
+ linter checks supported Tasty rules; it does not enforce every architectural
152
+ rule above or inspect arbitrary CSS. Review custom components at mobile and
153
+ desktop sizes, with keyboard navigation, in light and dark schemes, and with
154
+ normal and high contrast.
@@ -0,0 +1,95 @@
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
+ The Cookbook repository deploys its own documentation only after a package
69
+ release. The release workflow creates a version tag and then starts the Pages
70
+ workflow from that tag, so the public reference matches the published code.
71
+
72
+ ## Other static hosts
73
+
74
+ The creator supports `--deploy netlify`, `--deploy cloudflare-pages`, and
75
+ `--deploy vercel`. It writes a `DEPLOYMENT.md` with host settings; Netlify also
76
+ gets `netlify.toml`. You can also use the host's ordinary static-site settings:
77
+
78
+ - build command: `npm run build`
79
+ - publish directory: `dist`
80
+ - Node.js: 22.19 or newer
81
+
82
+ If the host serves the site below a path rather than at an origin root, set
83
+ Astro's `base`; Cookbook derives it automatically.
84
+
85
+ ## Discovery and agent access
86
+
87
+ Set `site.url` to the public HTTPS origin before building. This enables canonical
88
+ page URLs and the sitemap. The build also emits `llms.txt` with links to
89
+ published documentation pages. At an origin root, it emits `robots.txt` pointing
90
+ to the sitemap. Host these files with the rest of `dist/`; custom files in
91
+ `public/` take precedence. For path-hosted sites, manage the origin's
92
+ `robots.txt` in the hosting configuration.
93
+
94
+ Check the deployed HTML, `sitemap-index.xml`, and `llms.txt` through their public
95
+ URLs. See [AI agents](./ai-agents.md) for the setup and reading workflow.
@@ -0,0 +1,101 @@
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: {
83
+ brand: { from: "#315efb" },
84
+ tokens: { $radius: "8px" },
85
+ },
86
+ markdown: { rawHtml: "sanitize" },
87
+ });
88
+
89
+ export default mergeDocsConfig(company, {
90
+ site: { title: "Product docs" },
91
+ theme: { tokens: { "$content-width": "52rem" } },
92
+ });
93
+ ```
94
+
95
+ Each `theme.brand` or `theme.palette` color replaces the corresponding color in
96
+ the preset. Supply the complete Glaze declaration for a color you override.
97
+
98
+ Objects merge recursively, arrays replace, and inputs are not mutated. Tasty
99
+ styles preserve their default values when adding conditional overrides. A preset
100
+ can live in a shared workspace package. Component overrides remain partial Tasty
101
+ objects and merge into Cookbook's complete base styles inside the renderer.
@@ -0,0 +1,134 @@
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.19 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. It also writes `AGENTS.md` with instructions for coding
20
+ agents. Edit `README.md` to change the home page. Add
21
+ `docs/guide.md` to create `/guide`. New and edited pages appear in the development
22
+ server without a restart.
23
+
24
+ ## Document an existing repository
25
+
26
+ Run this from your repository root:
27
+
28
+ ```sh
29
+ npm create @tenphi/cookbook@latest docs-site -- --source . --yes
30
+ cd docs-site
31
+ npm run dev
32
+ ```
33
+
34
+ The generated `docs.config.ts` points back to your repository. Your root README
35
+ becomes the home page and `docs/**/*.{md,mdx}` supplies the other pages. Cookbook
36
+ reads those files without copying or rewriting them.
37
+
38
+ Use `--no-install` to generate files before installing dependencies. The creator
39
+ refuses to overwrite a non-empty destination in non-interactive mode.
40
+
41
+ ## Document a published npm package
42
+
43
+ ```sh
44
+ npm create @tenphi/cookbook@latest my-package-docs -- \
45
+ --package @scope/package@latest --yes
46
+ cd my-package-docs
47
+ npm run dev
48
+ ```
49
+
50
+ The creator discovers documentation inside the actual published artifact and
51
+ writes its exact version and integrity to `cookbook.lock.json`. Commit this file.
52
+ The documented package is not installed and its lifecycle scripts do not run.
53
+ Run `npm run update` when you want to resolve the requested tag or range again.
54
+
55
+ ## Add to an existing Astro project
56
+
57
+ ```sh
58
+ npx astro add @tenphi/cookbook
59
+ ```
60
+
61
+ Your Astro configuration needs one integration:
62
+
63
+ ```ts
64
+ import { defineConfig } from "astro/config";
65
+ import cookbook from "@tenphi/cookbook";
66
+
67
+ export default defineConfig({ integrations: [cookbook()] });
68
+ ```
69
+
70
+ Cookbook includes Starlight and discovers `docs.config.ts` automatically.
71
+ With no documentation configuration, it uses README/docs conventions.
72
+
73
+ ## Configure the site
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.
78
+
79
+ Create `docs.config.ts` next to `astro.config.ts`:
80
+
81
+ ```ts
82
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
83
+
84
+ export default defineDocsConfig({
85
+ site: {
86
+ title: "Example Project",
87
+ description: "Documentation for Example Project",
88
+ repository: "https://github.com/example/project",
89
+ },
90
+ theme: {
91
+ brand: { from: "#2f5bff" },
92
+ fonts: { body: "Inter", heading: "Newsreader" },
93
+ },
94
+ });
95
+ ```
96
+
97
+ Change `theme.fonts` to use [Google Fonts by name or your own font files](./theme-and-components.md#change-font-families).
98
+ Use `theme.presets` for typography details, `theme.styles` for built-in elements,
99
+ and `defineComponent()` with `theme.customStyles` to add a new element. The
100
+ [theme guide](./theme-and-components.md) includes examples and the complete
101
+ list of customizable sub-elements.
102
+
103
+ The integration and CLI load the same configuration. Supported filenames are
104
+ `docs.config.ts`, `.mts`, `.js`, and `.mjs`, in that order. An explicit integration
105
+ `config` object takes precedence; `configFile: false` disables discovery.
106
+ Use `cookbook({ configFile: "./config/manual.ts" })` and
107
+ `cookbook doctor --config ./config/manual.ts` for a nonstandard location.
108
+
109
+ ## Monorepo roots
110
+
111
+ An app in `apps/docs/` can use repository content with:
112
+
113
+ ```ts
114
+ import { defineDocsConfig } from "@tenphi/cookbook/config";
115
+
116
+ export default defineDocsConfig({ root: "../.." });
117
+ ```
118
+
119
+ `root` is relative to the documentation configuration file. It controls content,
120
+ local assets, and `cookbook.lock.json`. Run `npm run doctor` from the app directory;
121
+ it resolves the same repository root as the integration. Individual sources can
122
+ also declare their own roots for multi-package sites.
123
+
124
+ ## Validate and publish
125
+
126
+ ```sh
127
+ npm run doctor
128
+ npm run build
129
+ npm run preview
130
+ ```
131
+
132
+ See [working examples](./examples.md), [authoring components](./authoring.mdx),
133
+ the [AI agent workflow](./ai-agents.md), and [deployment](./deployment.md). Existing users should read the
134
+ [prerelease migration guide](./migration.md).