@vite-hub/docs 0.3.1 → 0.5.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.
- package/README.md +179 -19
- package/dist/{agent-copy-BJp_Yf5d.js → agent-copy-xPaWye_g.js} +1 -1
- package/dist/assistant-pages-CqNlHsx-.js +37 -0
- package/dist/{assistant-shared-Dll_F_yy.d.ts → assistant-shared-CWIKRtBv.d.ts} +3 -2
- package/dist/{assistant-shared-CdtXowot.js → assistant-shared-DhiLHKSl.js} +23 -7
- package/dist/assistant-worker.d.ts +1 -1
- package/dist/assistant-worker.js +1 -1
- package/dist/assistant.d.ts +1 -1
- package/dist/assistant.js +1 -1
- package/dist/{content-9CINWiRf.js → content-BQVlMshL.js} +57 -47
- package/dist/{draft-DUBx--r9.js → draft-CSsTYSeb.js} +2 -2
- package/dist/error-diagnostics-CmgtG9xa.js +157 -0
- package/dist/files-UY4h1_36.js +38 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.js +4 -4
- package/dist/link-checker-redirects.js +1 -1
- package/dist/{manifest-Dzp5-_AJ.d.ts → manifest-Drbdw1us.d.ts} +9 -3
- package/dist/{manifest-D66AEF8F.js → manifest-DvECmwX-.js} +101 -51
- package/dist/{markdown-Cn9-4oVG.js → markdown-1M1FbjCw.js} +1 -1
- package/dist/{page-Dx2JD3y1.d.ts → markdown-BiKrT08O.d.ts} +2 -25
- package/dist/navigation.d.ts +10 -5
- package/dist/navigation.js +23 -10
- package/dist/{nuxt-B5LrERKc.d.ts → nuxt-8O2OB_hI.d.ts} +84 -7
- package/dist/nuxt.d.ts +2 -2
- package/dist/nuxt.js +1699 -105
- package/dist/{page-BbmSfZO8.js → page-Bb0TfRKi.js} +21 -4
- package/dist/page-BryUCmYf.d.ts +26 -0
- package/dist/primitive-rail.d.ts +2 -5
- package/dist/primitive-rail.js +8 -6
- package/dist/{raw-C03EUJKw.js → raw-BChwipz_.js} +6 -0
- package/dist/redirects-BJj58IsY.js +87 -0
- package/dist/runnable.d.ts +37 -0
- package/dist/runnable.js +105 -0
- package/dist/runtime/app/components/DocsAsideLeftBody.vue +2 -8
- package/dist/runtime/app/components/DocsLearn.vue +215 -0
- package/dist/runtime/app/components/DocsLearnCodePre.vue +98 -0
- package/dist/runtime/app/components/DocsLearnFile.vue +21 -0
- package/dist/runtime/app/components/DocsPage.vue +11 -5
- package/dist/runtime/app/components/DocsPlayground.vue +117 -0
- package/dist/runtime/app/components/content/Example.vue +18 -49
- package/dist/runtime/app/components/content/McpClient.vue +170 -0
- package/dist/runtime/app/components/content/McpInstall.vue +238 -0
- package/dist/runtime/app/components/content/PageList.vue +1 -5
- package/dist/runtime/app/layouts/docs.vue +36 -8
- package/dist/runtime/app/middleware/docs-layout.ts +2 -2
- package/dist/runtime/app/utils/docs-learn.ts +31 -0
- package/dist/runtime/app/utils/docs-playground.ts +3 -0
- package/dist/runtime/server/llms.js +1 -1
- package/dist/runtime/server/markdown.d.ts +0 -5
- package/dist/runtime/server/markdown.js +10 -1
- package/dist/runtime/server/mcp.js +1 -1
- package/dist/runtime/server/page.d.ts +1 -1
- package/dist/runtime/server/page.js +3 -3
- package/dist/runtime/server/raw.js +2 -9
- package/dist/runtime/server/search.d.ts +1 -1
- package/dist/runtime/server/search.js +3 -2
- package/dist/runtime/server/sitemap.js +1 -1
- package/dist/{schema-DwpXW0VZ.js → schema-DcWZ3Q3M.js} +97 -5
- package/dist/server.d.ts +3 -2
- package/dist/server.js +4 -4
- package/dist/snapshot-worker.mjs +40 -0
- package/dist/steps-DBlkJwtD.d.ts +105 -0
- package/dist/steps-DF-11dJn.js +32 -0
- package/dist/{types-BhG6vGfG.d.ts → types-CHU_fy9l.d.ts} +69 -4
- package/package.json +18 -11
- package/dist/error-diagnostics-BoOsP6Y4.js +0 -53
- package/dist/redirects-BrbWFSzW.js +0 -62
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @vite-hub/docs
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@vite-hub/docs)
|
|
4
|
+
[](https://github.com/vite-hub/vitehub/blob/main/LICENSE)
|
|
5
|
+
[](https://vitehub.dev/docs/docs-site)
|
|
6
6
|
|
|
7
7
|
`@vite-hub/docs` turns a folder of Markdown files into a documentation site. It is a Nuxt module. It gives you the docs shell, four page layouts, search, a Markdown copy of each page for agents, llms.txt, an MCP server, and an optional docs assistant. [vitehub.dev](https://vitehub.dev) runs on it.
|
|
8
8
|
|
|
@@ -26,6 +26,8 @@ export default defineNuxtConfig({
|
|
|
26
26
|
|
|
27
27
|
The module installs Nuxt UI, `@vite-hub/ui`, `nuxt-agent-discovery`, and `nuxt-link-checker` for you, so a new site does not add them to `modules`. An app that already lists `@nuxt/ui` keeps it before the docs module, as in [Add docs to an existing app](#add-docs-to-an-existing-app). Content serves the agent files: `/raw/<page>.md`, `llms.txt`, `llms-full.txt`, `sitemap.md`, `sitemap.xml`, and the MCP server. Set `site.url` to the public origin: llms.txt, canonical links, and the raw Markdown links use it.
|
|
28
28
|
|
|
29
|
+
The module turns off Nuxt's idle prefetch of lazy chunks in the whole app, such as the editor and the comark blocks. A page loads the chunks that it renders. A link loads its page and payload when the reader points at it or focuses it, unless the app sets `experimental.defaults.nuxtLink.prefetchOn`.
|
|
30
|
+
|
|
29
31
|
The shell uses Lucide, Simple Icons, and VS Code Icons. Install `@iconify-json/lucide`, `@iconify-json/simple-icons`, and `@iconify-json/vscode-icons` to serve them from your app. Without them, `@nuxt/icon` gets them from the Iconify API.
|
|
30
32
|
|
|
31
33
|
Apps that use `vite-hub` add `vite-hub/docs/nuxt` to `modules` in place of `@vite-hub/docs/nuxt`, and import the root and the assistant from `vite-hub/docs` and `vite-hub/docs/assistant`.
|
|
@@ -71,7 +73,7 @@ content/
|
|
|
71
73
|
|
|
72
74
|
A page's URL is its path in the folder. With a `content/docs/` folder, the docs are at `/docs`. Without one, the docs are the whole site: `content/index.md` is `/`, and each folder in `content/` is a section. `content/docs/index.md` is the page at `/docs`. Without it, `/docs` is not found, and the Docs links open the first section. Each folder under `content/docs/` is a section: one entry in the rail and its own sidebar. A site with three sections or fewer, or with no section icons, has no rail: the sidebar lists every section with its pages. Pages outside `content/docs/`, such as `about.md`, render as plain articles under the site header. `dir` changes the content folder, and `base` sets the URL prefix of the sections when the default does not fit.
|
|
73
75
|
|
|
74
|
-
The module reads the folder at build time. In development it watches the folder
|
|
76
|
+
The module reads the folder at build time. In development it watches the folder. A body edit, a new or removed page, a title, or an order shows on the next page load without a restart, and the server code reloads once. The app restarts when adding or removing `content/docs/` changes the inferred base, or when a new page changes a route that the module adds at startup: the first page outside `/docs`, a page outside `/docs`, or any new page of an app with an `app.baseURL`, whose Markdown routes list each page. It also restarts for a new page when Nitro does not run in Vite (`experimental.nitroViteEnvironment: false`).
|
|
75
77
|
|
|
76
78
|
### Multiple sources and Markdown components
|
|
77
79
|
|
|
@@ -79,7 +81,26 @@ Read pages from more than one place with `sources`. It replaces `dir`. Each entr
|
|
|
79
81
|
|
|
80
82
|
The module reads the `.md` and `.navigation.yml` files of every source through ViteHub Content when it builds. In development the server reads folders through Nitro server assets, and the module watches them. The build copies the pages of any other Source into `.nuxt/docs/sources/docs-<index>/` and serves that copy, so a `github()` Source shows its branch as it was at build time. A production build packs the Markdown and rewritten agent copies into one gzip module to stay below Cloudflare’s module limit. A `glob()` Source lists dot files only when its `include` names them, such as `**/.navigation.yml`, and reads only below the app root.
|
|
81
83
|
|
|
82
|
-
`sources` configures the site pages, search,
|
|
84
|
+
`sources` configures the site pages, search, Markdown resources, and the pages that the docs assistant reads.
|
|
85
|
+
|
|
86
|
+
A page that the build generates, such as a list of the skills in a repository, is a `files()` Source. Its loader runs when the build reads the pages, so nothing writes the page into the content folder first:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
import { readdir } from "node:fs/promises"
|
|
90
|
+
import { files } from "vite-hub/source"
|
|
91
|
+
|
|
92
|
+
async function skillCatalog() {
|
|
93
|
+
const skills = await readdir("../skills")
|
|
94
|
+
return ["---", "title: All skills", "---", ...skills.map(name => `- \`${name}\``)].join("\n")
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export default defineNuxtConfig({
|
|
98
|
+
docs: {
|
|
99
|
+
base: "/",
|
|
100
|
+
sources: ["content", { source: files({ "catalog.md": skillCatalog }), mount: "/skills" }],
|
|
101
|
+
},
|
|
102
|
+
})
|
|
103
|
+
```
|
|
83
104
|
|
|
84
105
|
```ts
|
|
85
106
|
import { github, glob } from "vite-hub/source"
|
|
@@ -115,12 +136,14 @@ The `components` module exports a default map of Comark tags to Vue components.
|
|
|
115
136
|
| `credits` | None | Inline Markdown at the end of the page, such as `Icons from [Lucide](https://lucide.dev).` |
|
|
116
137
|
| `keywords` | None | Words that find the page in search besides its own text: a list, or one string with commas. They rank below the page title and with headings. |
|
|
117
138
|
| `icon` | `i-lucide-file-text` | Sidebar icon, as an Iconify name. |
|
|
118
|
-
| `layout` | `article` | `article`, `tutorial`, `landing`, or `
|
|
119
|
-
| `sidebar` | `true` | `false` hides the left navigation on this page. `collapsed` starts it as a narrow column that the reader opens. |
|
|
120
|
-
| `toc` | `true`, `false` on `landing` | `false` hides the "On this page" outline. |
|
|
139
|
+
| `layout` | `article` | `article`, `tutorial`, `landing`, `home`, `playground`, or `learn`. See [Workspace pages](#workspace-pages). |
|
|
140
|
+
| `sidebar` | `true`, `collapsed` on `playground` and `learn` | `false` hides the left navigation on this page. `collapsed` starts it as a narrow column that the reader opens. |
|
|
141
|
+
| `toc` | `true`, `false` on `landing`, `home`, `playground`, and `learn` | `false` hides the "On this page" outline. |
|
|
121
142
|
| `codePanel` | `false` | Tutorials only. Shows the files of the current step beside the prose. |
|
|
122
143
|
| `tutorial` | None | Tutorials only. `project` or `quickstart`, for your own tutorial catalog. |
|
|
123
144
|
| `navigation` | Listed | `false` keeps the page out of the sidebar. Or `{ title, order, group, kind, panel }`. See [Panels](#panels). |
|
|
145
|
+
| `examples`, `tabs`, `render`, `connect`, `port` | None | `layout: playground` only. See [Workspace pages](#workspace-pages). |
|
|
146
|
+
| `fixture`, `guide`, `lesson`, `preview`, `port` | None | `layout: learn` only. See [Workspace pages](#workspace-pages). |
|
|
124
147
|
| `seo` | None | `{ title, description, image, index }` for search results and shares when they must differ from the page. `image` is a path in `public/` or a URL, or `false` for no share image. `index: false` asks search engines not to index the page. See [Pages that search engines skip](#pages-that-search-engines-skip). |
|
|
125
148
|
|
|
126
149
|
Dotted keys work too, such as `navigation.order: 2`. A wrong field stops the build with `DOCS_CONTENT_INVALID`. In development, the terminal shows the error and the site keeps the last valid pages until you fix the file.
|
|
@@ -163,9 +186,10 @@ navigation.panel: true
|
|
|
163
186
|
- `article` is prose with the outline on the right.
|
|
164
187
|
- `tutorial` numbers each `::tutorial-step` block. With `codePanel: true`, a sticky panel on wide screens shows the file tree and the file that the reader is on. Code blocks named `commands/...` or `output/...`, and shell blocks, stay in the prose.
|
|
165
188
|
- `landing` is a wide Overview page without the outline. A section Overview ends with the catalog of every section.
|
|
189
|
+
- `playground` and `learn` fill the page with a code workspace. See [Workspace pages](#workspace-pages).
|
|
166
190
|
- `home` is a product home page under the site header, with no title, actions, sidebar, or outline. Your `components/content/` blocks, such as a `::product-hero`, take the full width. The Markdown between them, such as a heading, a list, or a code group, gets the prose styles and the width of a docs page. The page keeps its search entry, Markdown copy, and share image.
|
|
167
191
|
|
|
168
|
-
The left navigation (the section rail and the page sidebar) and the right outline show on every docs page. Turn them off for one page with `sidebar: false` or `toc: false`. A page that needs the width, such as a playground, sets `sidebar: collapsed`: wide screens show a narrow column with the logo, a button that opens the navigation, search, and the site links, or the rail on a site that has one. An app page in the docs layout sets it with `definePageMeta({ layout: "docs", sidebar: "collapsed" })`. A code panel tutorial starts collapsed too.
|
|
192
|
+
The left navigation (the section rail and the page sidebar) and the right outline show on every docs page. Turn them off for one page with `sidebar: false` or `toc: false`. A page that needs the width, such as a playground, sets `sidebar: collapsed`: wide screens show a narrow column with the logo, a button that opens the navigation, search, and the site links, or the rail on a site that has one. An app page in the docs layout sets it with `definePageMeta({ layout: "docs", sidebar: "collapsed" })`. That page fills the viewport under the header and the window does not scroll: the root element of the page is exactly as tall as the viewport, so `height: 100%` inside it fills the screen, and content that is taller scrolls inside the page. A code panel tutorial starts collapsed too.
|
|
169
193
|
|
|
170
194
|
````md
|
|
171
195
|
---
|
|
@@ -183,6 +207,140 @@ console.log("hello")
|
|
|
183
207
|
::
|
|
184
208
|
````
|
|
185
209
|
|
|
210
|
+
### Workspace pages
|
|
211
|
+
|
|
212
|
+
Two layouts fill the page with a code workspace: an editor, a file tree, a preview, and a terminal. The frontmatter of the page sets the workspace, so you add no app page and no config. On a phone or in a browser without WebContainer support, the page shows its own text instead.
|
|
213
|
+
|
|
214
|
+
`layout: playground` opens the apps of `examples`. Each example is a folder of the app, relative to the app root. Without `render`, the examples run in a WebContainer: it runs `npm install`, then `npm run dev`, and the preview shows the server on `port`.
|
|
215
|
+
|
|
216
|
+
```md [content/docs/try/playground.md]
|
|
217
|
+
---
|
|
218
|
+
title: Playground
|
|
219
|
+
layout: playground
|
|
220
|
+
examples:
|
|
221
|
+
- { id: hello, label: Hello, group: Servers, dir: examples/hello, open: message.txt }
|
|
222
|
+
- { id: clock, label: Clock, group: Servers, dir: examples/clock, open: server.mjs }
|
|
223
|
+
tabs:
|
|
224
|
+
- { value: messages, label: Messages }
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
The text of the page shows when the workspace cannot run.
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
| Field | Default | Use |
|
|
231
|
+
| --- | --- | --- |
|
|
232
|
+
| `examples` | Required | `{ id, label, group, description, dir, open, preview, readonly }`, in menu order. `id` is the `?example=` value. `group` is the heading in the examples menu. `open` is the file that the editor opens first. `preview` is the path that the preview opens. `readonly` lists text files of `dir` that the reader cannot edit. With more than one example and no `?example=`, the page opens on a start screen. |
|
|
233
|
+
| `tabs` | None | `{ value, label }`: more output tabs. The tab `messages` renders `app/components/playground/PlaygroundTabMessages.vue`, which reads the workspace with `useWorkspace()` from `@vite-hub/ui/workspace`. A missing component fails the build with `DOCS_WORKSPACE_TAB_MISSING`. |
|
|
234
|
+
| `render` | None | A module relative to the app root, such as `app/playground/render.ts`. The page runs its default export on the files 200 ms after each edit, and shows the HTML in an Output tab. No WebContainer starts, so the page works on every device. |
|
|
235
|
+
| `connect` | None | Accounts that the reader can connect in a Connect tab: `anthropic`, `github`, `netlify`, `openai`, or `vercel`. Each one takes a token in the tab. Any other name, such as `cloudflare`, which needs a relay, fails the build with `DOCS_CONTENT_INVALID`. A token stays in the browser tab, and the app gets it as an environment variable of the dev server, such as `GITHUB_TOKEN`. Not with `render`. |
|
|
236
|
+
| `port` | `3000` | The port of the dev server. Not with `render`. |
|
|
237
|
+
|
|
238
|
+
```ts [app/playground/render.ts]
|
|
239
|
+
import type { DocsRenderFunction } from "@vite-hub/docs/runnable"
|
|
240
|
+
|
|
241
|
+
const render: DocsRenderFunction = (files) => {
|
|
242
|
+
const html = files["index.html"]
|
|
243
|
+
if (html === undefined) return { html: "", issues: [{ message: "Create index.html." }] }
|
|
244
|
+
return { html }
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export default render
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
#### Read-only files, binary files, and issues
|
|
251
|
+
|
|
252
|
+
`readonly` marks files of an example that the reader can read but not edit, such as a model that a build trained. The editor refuses typing in them and shows "Read-only". `useWorkspace().setFile` in a tab component can still change them. A path that is not a text file of `dir` fails the build with `DOCS_WORKSPACE_READONLY_MISSING`.
|
|
253
|
+
|
|
254
|
+
```md [content/docs/try/models.md]
|
|
255
|
+
---
|
|
256
|
+
title: Models
|
|
257
|
+
layout: playground
|
|
258
|
+
render: app/playground/render.ts
|
|
259
|
+
examples:
|
|
260
|
+
- { id: recipes, label: Recipes, dir: examples/recipes, open: input.txt, readonly: [recipes.model.ts] }
|
|
261
|
+
---
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
A file of `dir` that is not valid UTF-8, such as `weights.bin`, is a binary asset. It needs no frontmatter. The tree and the editor never show it. The page module carries it as base64 and turns it back into bytes when it loads. A `render` function reads it from `example.assets`, and a WebContainer example mounts it next to the files. An issue with `file` shows `file:line`, and a click opens that file.
|
|
265
|
+
|
|
266
|
+
```ts [app/playground/render.ts]
|
|
267
|
+
import type { DocsRenderFunction } from "@vite-hub/docs/runnable"
|
|
268
|
+
|
|
269
|
+
const render: DocsRenderFunction = (files, { example }) => {
|
|
270
|
+
const weights = example.assets?.["weights.bin"]
|
|
271
|
+
if (!weights) return { html: "", issues: [{ message: "Train the model first.", file: "recipes.model.ts", line: 1 }] }
|
|
272
|
+
return { html: `<p>${files["input.txt"] ?? ""}: ${weights.byteLength} bytes of weights</p>` }
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export default render
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
`layout: learn` and `#build/playground-templates.mjs` read the text files of a fixture only.
|
|
279
|
+
|
|
280
|
+
`layout: learn` is a lesson. Its `::tutorial-step` blocks become the steps of the workspace, and the guide shows the text of the current step. `fixture` is a folder in the `runnable.fixtures` folder (`fixtures` by default) with the app after the last step, as for [runnable lessons](#runnable-lessons-and-examples). Each step loads the files of the fixture that its code blocks name. A file name in inline code, such as `` `greeting.mjs` ``, opens the file. A file code block gets "Show in editor", and a `curl` block gets "Run in workspace". `?step=2` opens step 2, and Solve writes the files of the step.
|
|
281
|
+
|
|
282
|
+
````md [content/docs/try/first-server.md]
|
|
283
|
+
---
|
|
284
|
+
title: Your first server
|
|
285
|
+
layout: learn
|
|
286
|
+
fixture: first-server
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
::tutorial-step{title="Write a greeting"}
|
|
290
|
+
## Write a greeting
|
|
291
|
+
|
|
292
|
+
```js [greeting.mjs]
|
|
293
|
+
export default () => "Hello."
|
|
294
|
+
```
|
|
295
|
+
::
|
|
296
|
+
````
|
|
297
|
+
|
|
298
|
+
| Field | Default | Use |
|
|
299
|
+
| --- | --- | --- |
|
|
300
|
+
| `fixture` | Required | The folder of the app after the last step. |
|
|
301
|
+
| `guide` | `side` | `side` puts the step text in a column beside the code, `top` puts it over the code. |
|
|
302
|
+
| `lesson` | This page | The URL of another docs page whose `::tutorial-step` blocks are the steps, such as a get started guide, so the prose has one source. The page then has a canonical link to that page. |
|
|
303
|
+
| `preview` | `/` | The path that the preview opens. |
|
|
304
|
+
| `port` | `3000` | The port of the dev server. |
|
|
305
|
+
|
|
306
|
+
A WebContainer runs only in a cross-origin isolated page. The module lists every `learn` page and every `playground` page without `render`, and passes them to `vite-hub/nuxt` as `webContainer.routes`, in either module order. The app needs `vite-hub/nuxt` and `@vite-hub/web-container`; without them, the build fails with `DOCS_WORKSPACE_VITEHUB_MISSING`. A `render` page stays a plain page. A missing `dir`, `fixture`, or `render` file fails the build with `DOCS_WORKSPACE_DIR_MISSING` or `DOCS_WORKSPACE_RENDER_MISSING`, and a `readonly` path that is not a text file of its `dir` with `DOCS_WORKSPACE_READONLY_MISSING`. Each workspace page gets an id from its path, such as `learn-first-agent` for `/learn/first-agent`, and the id names its snapshots, its examples, and its zip. Two pages with one id, such as `/docs/a/b` and `/docs/a-b`, fail the build with `DOCS_WORKSPACE_ID_COLLISION`, and so does a page id that matches a `slug` in `runnable.lessons` or an `id` in `runnable.examples`.
|
|
307
|
+
|
|
308
|
+
The frontmatter is the one source of truth for workspace pages. `runnable.lessons` and `runnable.examples` stay for app pages that read `#build/runnable-tutorials.mjs` and `#build/playground-templates.mjs`, such as a custom `/learn/[slug]` page. Both use one snapshot build: an example with the dependencies of a lesson mounts the snapshot of that lesson, and `nuxt build` writes the snapshots of workspace pages as it does for `runnable`. A `layout: tutorial` page with `codePanel` works as before.
|
|
309
|
+
|
|
310
|
+
### Runnable lessons and examples
|
|
311
|
+
|
|
312
|
+
`runnable` runs lessons and starting apps in the reader's browser, in a WebContainer. Each one is an app in the fixtures folder. The page stays the lesson text, and the fixture is the app after the last step: every file code block of a `::tutorial-step` must equal the fixture file.
|
|
313
|
+
|
|
314
|
+
```ts [nuxt.config.ts]
|
|
315
|
+
export default defineNuxtConfig({
|
|
316
|
+
modules: ["@vite-hub/docs/nuxt"],
|
|
317
|
+
docs: {
|
|
318
|
+
runnable: {
|
|
319
|
+
lessons: [{ slug: "first-route", page: "/docs/first-route", fixture: "first-route" }],
|
|
320
|
+
examples: [{ id: "kv", label: "KV", description: "Store and read a value.", fixture: "kv", open: "server/api/kv.post.ts", preview: "/api/kv" }],
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
})
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
| Option | Default | Description |
|
|
327
|
+
| --- | --- | --- |
|
|
328
|
+
| `fixtures` | `fixtures` | The folder of the apps, relative to the app root. |
|
|
329
|
+
| `lessons` | `[]` | `{ slug, page, fixture }`. `slug` names the lesson and its snapshot. `page` is the URL of a docs page with `::tutorial-step` blocks, from `dir` or from `sources`. |
|
|
330
|
+
| `examples` | `[]` | `{ id, label, description, fixture, open, preview }`, in menu order. `open` is the file that the editor opens first, and `preview` is the path that the preview opens. |
|
|
331
|
+
| `start` | None | The URL of a docs page whose code blocks give a file before the step that writes it, such as an Installation page. Without it, that file does not exist before its step. |
|
|
332
|
+
| `pnpmWorkspace` | None | The folder of `pnpm-workspace.yaml`, relative to the app root. Set it when fixtures use `catalog:` or `workspace:` specifiers: the build rewrites them to npm versions, and packs the workspace packages that a fixture uses into its snapshot. The packages are the folders that its `packages` patterns match, as pnpm finds them. |
|
|
333
|
+
|
|
334
|
+
The build writes three modules that app pages import, and does not add pages:
|
|
335
|
+
|
|
336
|
+
- `#build/runnable-tutorials.mjs` exports `runnableTutorials`: the files before step 1 and the files of each step.
|
|
337
|
+
- `#build/playground-templates.mjs` exports `playgroundTemplates`: the files of each example.
|
|
338
|
+
- `#build/learn-facts.mjs` exports `learnFacts`: the step count and reading time of each `layout: tutorial` and `layout: learn` page, by URL.
|
|
339
|
+
|
|
340
|
+
Their types and the browser helpers, such as `tutorialStepFiles()`, come from `@vite-hub/docs/runnable`.
|
|
341
|
+
|
|
342
|
+
`nuxt build` also writes a `node_modules` snapshot of each fixture to `/_tutorials/snapshots/<slug>.<hash>.<part>.bin` under the app base, so the workspace skips `npm install`. The snapshot holds the `dependencies` of the fixture, so the package that its `dev` script runs, such as `vite`, must be in `dependencies`. An example with the dependencies of a lesson uses the snapshot of that lesson. The npm lockfile `<fixture>.package-lock.json` beside each fixture pins the install. The build writes it when it is missing or no longer matches the dependencies: commit it. `nuxi prepare` never builds snapshots. `nuxt dev` reuses the last ones while the dependencies match, and builds them with `TUTORIAL_SNAPSHOTS=1`. `TUTORIAL_SNAPSHOTS=0` skips them in a build, and the workspace runs `npm install`. An app page that boots a WebContainer needs cross-origin isolation: list its routes in `vitehub.webContainer.routes`. Workspace pages get theirs from the module.
|
|
343
|
+
|
|
186
344
|
## Customize
|
|
187
345
|
|
|
188
346
|
Most changes are options in `nuxt.config.ts`:
|
|
@@ -190,7 +348,7 @@ Most changes are options in `nuxt.config.ts`:
|
|
|
190
348
|
| Option | Default | Use |
|
|
191
349
|
| --- | --- | --- |
|
|
192
350
|
| `dir` | `content` | Folder of Markdown pages. |
|
|
193
|
-
| `base` | `/docs`, or `/` without a `docs/` folder | URL prefix whose folders are sections. |
|
|
351
|
+
| `base` | `/docs`, or `/` without a `docs/` folder in `dir` | URL prefix whose folders are sections. With `sources`, the default is always `/docs`. If all pages are outside the default base, setup warns with `DOCS_BASE_EMPTY`. Set `base: '/docs'` to keep them standalone without the warning. |
|
|
194
352
|
| `site` | `{ name: "Docs" }` | `name`, `url` (canonical origin), `description`, `logo`, `badge` (`{ label, tooltip }`). A `logo` path is a one-color SVG that the theme fills with the text color. `{ light, dark }` shows a colored logo as it is, with `dark` in dark mode. |
|
|
195
353
|
| `categories` | `[]` | Order of section categories in the rail and the catalog. |
|
|
196
354
|
| `railExclude` | `[]` | Categories that the catalog lists but the rail leaves out. |
|
|
@@ -204,8 +362,8 @@ Most changes are options in `nuxt.config.ts`:
|
|
|
204
362
|
| `sitemap` | `[]` | More paths for `/sitemap.xml`. Every docs page is listed already. |
|
|
205
363
|
| `mcp` | On | `{ name, guide }`, or `false` to turn off the MCP server. |
|
|
206
364
|
| `llms` | None | `{ details, sections }`. Text under the description of `/llms.txt`, and sections of links before the page sections. |
|
|
207
|
-
| `linkChecker` | On | `false` turns off `nuxt-link-checker
|
|
208
|
-
| `seoAudit` | `"warn"` | The search check of prerendered pages. `"warn"`
|
|
365
|
+
| `linkChecker` | On | `false` turns off the link checks. The build first runs `vitehub content check` on the Markdown of every page, also the pages it does not prerender, and stops with `DOCS_LINKS_BROKEN` on a link to a missing page, named by file and line. Then `nuxt-link-checker` fails the build on detected link errors in prerendered pages, such as links in the navigation and app pages. Fragments on other pages are checked against the final built HTML. Remote URLs are not fetched. A link to an exact `redirect` route rule passes, and the build checks that the rule leads to a docs page instead. Set the app's own `linkChecker` options to change it. |
|
|
366
|
+
| `seoAudit` | `"warn"` | The search check of prerendered pages. `"warn"` reports one hint for each kind of problem, such as `DOCS_SEO_TITLE_INVALID`, in the build output and in `.vitehub/hints.json`. `"error"` or `true` stops the build with `DOCS_SEO_FAILED`, and `false` turns it off. The audit checks the rendered title and description, including duplicates across indexed pages. When the rendered title or description has the same problem in `vitehub content check`, the audit includes the frontmatter file and line. It also checks sitemap URLs, `h1` and heading order, word count, inbound links, Open Graph tags, HTML over 2 MB, and links to redirects or `/mcp`. A page without a share image (`seo.image: false`, or `ogImage: false`) needs no `og:image`, and a site without `site.url` needs no `og:url`. |
|
|
209
367
|
| `ogImage` | On | Share images. `{ component }` renders the app's own template from `components/OgImage/`, or `false` turns them off. See [Search and share](#search-and-share). |
|
|
210
368
|
| `assistant` | `false` | `true`, or `{ agent }`. See [Docs assistant](#docs-assistant). |
|
|
211
369
|
| `comments` | On with `vite-hub/nuxt` | `false` turns Comments off, or `{ database, dialect, overlay }`. See [Comments](#comments). |
|
|
@@ -229,7 +387,7 @@ The shell is a set of Nuxt components. Create a component with the same name in
|
|
|
229
387
|
| `DocsCatalogFooter` | The catalog at the end of an Overview. |
|
|
230
388
|
| `DocsCodePanel`, `DocsCodePre` | The tutorial code panel and code blocks. |
|
|
231
389
|
|
|
232
|
-
Markdown blocks are components in `components/content/`. The package has `::tutorial-step`, `::product-features` with `:::product-feature-item`, `::example` and `::examples`, `::correct` and `::incorrect`, `::code-tree`, `::page-list`, and `::agent-only`. Add your own in `app/components/content/`, for example `ProductHero.vue` for `::product-hero`. An app `app.vue`, `error.vue`, `layouts/docs.vue`, or `layouts/default.vue` also replaces the package one. In an app with its own `app.vue`, the plain articles outside the sections use the `docs-article` layout, so the app's `default` layout stays on its own pages. A catch-all page replaces the docs page only at the docs prefix: `pages/[...slug].vue` for docs at `/`, and `pages/docs/[...slug].vue` for docs at `/docs`. One at another prefix, such as `pages/blog/[...slug].vue`, does not.
|
|
390
|
+
Markdown blocks are components in `components/content/`. The package has `::tutorial-step`, `::product-features` with `:::product-feature-item`, `::example` and `::examples`, `::correct` and `::incorrect`, `::code-tree`, `::page-list`, `::mcp-install` with `:::mcp-client`, and `::agent-only`. Add your own in `app/components/content/`, for example `ProductHero.vue` for `::product-hero`. An app `app.vue`, `error.vue`, `layouts/docs.vue`, or `layouts/default.vue` also replaces the package one. In an app with its own `app.vue`, the plain articles outside the sections use the `docs-article` layout, so the app's `default` layout stays on its own pages. A catch-all page replaces the docs page only at the docs prefix: `pages/[...slug].vue` for docs at `/`, and `pages/docs/[...slug].vue` for docs at `/docs`. One at another prefix, such as `pages/blog/[...slug].vue`, does not.
|
|
233
391
|
|
|
234
392
|
A replacement docs layout or sidebar keeps the site header. Render `<DocsSidebars panel head />` to supply the sidebar controls and hide the desktop header. A replacement `DocsSidebars` can opt in with `data-docs-sidebar-head` on its root after it supplies the brand, badge tooltip, search, and `<DocsAsideFooter />`. The header owns one `DocsHeaderActions` instance and moves it into the mounted footer on wide screens.
|
|
235
393
|
|
|
@@ -265,6 +423,8 @@ With `name`, the preview is a Vue file in `app/examples/`, and Code shows its so
|
|
|
265
423
|
|
|
266
424
|
`::page-list` lists the pages of the page's section under their sidebar groups, with their icons and descriptions, for an Overview. On a panel Overview it lists the pages of the panel. `section` lists another section, `group="Runtime errors"` lists one group, and `exclude="Start"` leaves groups out. `compact` shows one line for each page, without icons: use it for long lists, such as one page per error code, because a Markdown table of a thousand rows is more HTML than crawlers read. Put a plain Markdown list or table inside it: the site doesn't show it, and agents read it in the Markdown copy.
|
|
267
425
|
|
|
426
|
+
`::mcp-install` connects a reader's agent to the site's MCP server at `/mcp`. Its Client tab shows each `:::mcp-client{label icon method}` as a logo, and the steps of the client that the reader picks. The pick is kept for the next visit. Write the steps as a numbered list. `install="cursor"` or `install="vscode"` adds a one-click install button, and `note` adds a footer line. The Prompt, MCP URL, and Command tabs come from the `mcp` option, so they always name the real server. Agents get every client's steps under its name in the Markdown copy.
|
|
427
|
+
|
|
268
428
|
### Comark plugins
|
|
269
429
|
|
|
270
430
|
The server parses each page with Comark, and the browser renders the nodes with [comark-ui](https://comark-ui.onmax.me)'s blocks: GitHub callouts (`> [!NOTE]`, and `::note`, `::tip`, `::warning`, `::caution`, `::important`), tabs and code groups, steps, code with a copy bar, zoomable images, charts, diagrams, file trees, cards, and the rest. comark-ui's typeset is off, since the design styles the prose. Chips are off too: they turn every web link into a chip and fetch its favicon. Annotated screenshots, diffs, quizzes, and comments have no Vue components, so the server draws them as HTML in a `comark-html` node, with the block's tag in `block`.
|
|
@@ -353,7 +513,7 @@ The module sets the `comments` option of `vite-hub/nuxt`, which turns on the Dat
|
|
|
353
513
|
- `@` suggests the users of ViteHub Auth when the app has Auth, else the people who wrote in the threads.
|
|
354
514
|
- The Console's Comments section lists the threads.
|
|
355
515
|
|
|
356
|
-
Turn it off with `docs: { comments: false }`. An object goes to the `comments` option of `vite-hub/nuxt`, such as `{ database: "docs" }` or `{ overlay: false }`. A site without `vite-hub/nuxt` has no Comments; `comments: true` there fails the build with `DOCS_COMMENTS_VITEHUB_MISSING`.
|
|
516
|
+
Turn it off with `docs: { comments: false }`. The `comments` option of `vite-hub/nuxt` wins: when it turns Comments on, setup warns with `DOCS_COMMENTS_OFF_IGNORED`. An object goes to the `comments` option of `vite-hub/nuxt`, such as `{ database: "docs" }` or `{ overlay: false }`. A site without `vite-hub/nuxt` has no Comments; `comments: true` there fails the build with `DOCS_COMMENTS_VITEHUB_MISSING`.
|
|
357
517
|
|
|
358
518
|
## Docs assistant
|
|
359
519
|
|
|
@@ -376,7 +536,7 @@ export default defineNuxtConfig({
|
|
|
376
536
|
|
|
377
537
|
```ts
|
|
378
538
|
// server/agents/docs.ts
|
|
379
|
-
// server/agents/docs/agent.ts. `workspace: {}` says that this Agent owns the pages Workspace of the preset
|
|
539
|
+
// server/agents/docs/agent.ts. `workspace: {}` says that this Agent owns the pages Workspace of the preset.
|
|
380
540
|
import { docsAssistant } from "@vite-hub/docs/assistant"
|
|
381
541
|
import { defineAgent } from "vite-hub/agent"
|
|
382
542
|
|
|
@@ -405,9 +565,9 @@ The Agent and the Connection are app files on purpose. ViteHub discovers Agents
|
|
|
405
565
|
|
|
406
566
|
Set `VITEHUB_CONNECTIONS_KEY` to 32 random bytes in `.env`, start the app, and sign in once with `pnpm vitehub connections connect chatgpt --url http://localhost:3000`. Every page then shows an **Ask** button. `⌘I` (`Ctrl+I` on Windows and Linux) opens and closes the panel, and `Esc` closes it. On wide screens the panel is a column beside the page that you resize from its left edge. On narrow screens it is a sheet. `useDocsAssistant().toggle()` opens the panel from your own control.
|
|
407
567
|
|
|
408
|
-
The preset reads
|
|
568
|
+
The preset reads the site's pages from a read-only Workspace, answers in the `web` Chat Channel at `/_vitehub/agents/docs/chat`, and gets the path of the open page. It allows 30 questions per hour for the whole site, 2 answers at a time, and 8 waiting. Change any part with `defineAgent({ extends: docsAssistant, ... })`, for example `driver: { instructions }`, `driver: { gateway: openai(), model }` for an API key, or `docsRateLimit({ limit, identity })`. Set `docs: { assistant: { agent: "support" } }` to use an Agent with another name.
|
|
409
569
|
|
|
410
|
-
The
|
|
570
|
+
The Workspace has every page of the site in its `pages` folder, at its URL path: `/docs/guide/setup` is `pages/docs/guide/setup.md`. It reads the same pages as the site, from `docs.dir` or `docs.sources`, for each question. In development a new page shows at once, and a Worker reads the pages that the docs build packed. The assistant reads the source Markdown, so frontmatter adapters change only the site metadata. To read other files, override the Source: `workspace: { sources: { pages: glob({ cwd, include: ["**/*.md"], keyCache: false }) } }` with `glob` from `@vite-hub/workspace`.
|
|
411
571
|
|
|
412
572
|
Limits:
|
|
413
573
|
|
|
@@ -429,7 +589,7 @@ import cms from "vite-hub/cms"
|
|
|
429
589
|
import { docsCollection } from "@vite-hub/docs"
|
|
430
590
|
|
|
431
591
|
export default defineContent({
|
|
432
|
-
extends: [cms, { repo: "owner/name", publish: "pr",
|
|
592
|
+
extends: [cms, { repo: "owner/name", publish: "pr", roles: true }],
|
|
433
593
|
collections: { docs: docsCollection() },
|
|
434
594
|
})
|
|
435
595
|
```
|
|
@@ -441,7 +601,7 @@ export default defineContent({
|
|
|
441
601
|
| Code | When | Fix |
|
|
442
602
|
| --- | --- | --- |
|
|
443
603
|
| `DOCS_CONTENT_INVALID` | A page frontmatter or a `.navigation.yml` file does not match the schema. The message names the file and the field. | Fix the field. The schema is `docsPageSchema` and `docsSectionSchema` from `@vite-hub/docs`. |
|
|
444
|
-
| `DOCS_REDIRECTS_BROKEN` | A production build with the link checker on finds a redirect route rule into the docs that no page answers, or one that hides a docs page. | Point the rule to a page, or remove it. |
|
|
604
|
+
| `DOCS_REDIRECTS_BROKEN` | A production build with the link checker on finds a redirect route rule into the docs that no page or server route answers, or one that hides a docs page. | Point the rule to a page, or remove it. |
|
|
445
605
|
| `DOCS_ASSISTANT_AGENTS_MISSING` | `assistant` is on, and `vite-hub/nuxt` with `agent: true` is missing. | Add `vite-hub/nuxt` with `agent: true` and `connections: true`, or turn `assistant` off. |
|
|
446
606
|
|
|
447
607
|
## Inspect
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { docsManifestPages, docsRawSectionLinks } from "./navigation.js";
|
|
2
|
-
import { t as toRawMarkdown } from "./raw-
|
|
2
|
+
import { t as toRawMarkdown } from "./raw-BChwipz_.js";
|
|
3
3
|
//#region src/agent-copy.ts
|
|
4
4
|
/**
|
|
5
5
|
* The copy of a page that agents read at `/raw/<page>.md`: the source as plain Markdown with absolute links, then the
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { docsManifestPages } from "./navigation.js";
|
|
2
|
+
import { t as docsErrorDiagnostics } from "./error-diagnostics-CmgtG9xa.js";
|
|
3
|
+
import { n as readDocsFile, t as hasDocsFile } from "./files-UY4h1_36.js";
|
|
4
|
+
import manifest from "#docs/manifest";
|
|
5
|
+
//#region src/runtime/assistant-pages.ts
|
|
6
|
+
/**
|
|
7
|
+
* The Workspace path of a page: its URL path as a Markdown file, and `index.md` for a folder page. The assistant's rules
|
|
8
|
+
* turn a path back into the URL, so `docs/guide/setup.md` is `/docs/guide/setup`, whatever the source and mount of the page.
|
|
9
|
+
*/
|
|
10
|
+
function docsAssistantPagePath(page) {
|
|
11
|
+
if (page.path === "/") return "index.md";
|
|
12
|
+
const path = page.path.replace(/^\/+/, "");
|
|
13
|
+
return /(?:^|\/)index\.md$/.test(page.file) ? `${path}/index.md` : `${path}.md`;
|
|
14
|
+
}
|
|
15
|
+
let pageIndex;
|
|
16
|
+
function docsAssistantPages() {
|
|
17
|
+
const snapshot = manifest;
|
|
18
|
+
if (!pageIndex || pageIndex.manifest !== snapshot) pageIndex = {
|
|
19
|
+
manifest: snapshot,
|
|
20
|
+
pages: new Map(docsManifestPages(snapshot).map((page) => [docsAssistantPagePath(page), page]))
|
|
21
|
+
};
|
|
22
|
+
return pageIndex.pages;
|
|
23
|
+
}
|
|
24
|
+
function listDocsAssistantPagePaths() {
|
|
25
|
+
const paths = [];
|
|
26
|
+
for (const [path, page] of docsAssistantPages()) if (hasDocsFile(page.source ?? "docs", page.file)) paths.push(path);
|
|
27
|
+
return paths;
|
|
28
|
+
}
|
|
29
|
+
/** The source Markdown of a page at its Workspace path, from the same files that the docs Content reads. */
|
|
30
|
+
async function readDocsAssistantPage(path) {
|
|
31
|
+
const page = docsAssistantPages().get(path);
|
|
32
|
+
const text = page ? await readDocsFile(page.source ?? "docs", page.file) : null;
|
|
33
|
+
if (text === null) throw docsErrorDiagnostics.DOCS_ASSISTANT_PAGE_MISSING({ path });
|
|
34
|
+
return text;
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { listDocsAssistantPagePaths, readDocsAssistantPage };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RateLimitIdentity } from "@vite-hub/agent/capabilities";
|
|
2
2
|
import { AgentCapabilityDefinition, WorkspaceAgentDefinition } from "@vite-hub/agent";
|
|
3
|
-
import {
|
|
3
|
+
import { RateLimitPolicy } from "@vite-hub/rate-limit";
|
|
4
|
+
import "@vite-hub/workspace";
|
|
4
5
|
//#region src/assistant-shared.d.ts
|
|
5
6
|
/** Invocation context key that holds the path of the page the reader has open. */
|
|
6
7
|
declare const docsPageContextKey = "docsPage";
|
|
@@ -10,7 +11,7 @@ interface DocsRateLimitOptions {
|
|
|
10
11
|
/** Questions per window. Defaults to 30. */
|
|
11
12
|
limit?: number;
|
|
12
13
|
/** Defaults to `1h`. */
|
|
13
|
-
window?:
|
|
14
|
+
window?: RateLimitPolicy["window"];
|
|
14
15
|
/**
|
|
15
16
|
* Who shares one budget. Defaults to the whole site, because anonymous readers have no stable identity. Use `"ip"`
|
|
16
17
|
* with `trustedIpHeaders` behind a proxy that sets them, or a function of the Invocation context.
|
|
@@ -4,7 +4,7 @@ import { defineAgent } from "@vite-hub/agent";
|
|
|
4
4
|
import { webChat } from "@vite-hub/agent/channels";
|
|
5
5
|
import { createRateLimiter } from "@vite-hub/rate-limit";
|
|
6
6
|
import { memoryRateLimitDriver } from "@vite-hub/rate-limit/drivers/memory";
|
|
7
|
-
import {
|
|
7
|
+
import { custom } from "@vite-hub/workspace";
|
|
8
8
|
//#region src/assistant-shared.ts
|
|
9
9
|
/** Invocation context key that holds the path of the page the reader has open. */
|
|
10
10
|
const docsPageContextKey = "docsPage";
|
|
@@ -54,10 +54,30 @@ function docsRateLimit(options = {}) {
|
|
|
54
54
|
}
|
|
55
55
|
/** The model of the Worker build. A model ID from the ChatGPT plan catalog: `vitehub connections models chatgpt`. */
|
|
56
56
|
const docsAssistantModel = "gpt-6.1-sol";
|
|
57
|
+
/**
|
|
58
|
+
* The pages Source: every page of the docs site, read from the same manifest and files as the site's Content. It covers
|
|
59
|
+
* `docs.dir` and `docs.sources`, and lays each page out at its URL path, as the docs rules expect. The Workspace reads it
|
|
60
|
+
* for each Invocation (`lazy`, no cache), so a page that development adds shows at once, and a Worker reads the pages
|
|
61
|
+
* that the docs build packed, with no second copy. It loads the docs server modules on the first read, so the Agent
|
|
62
|
+
* needs the `@vite-hub/docs` Nuxt module.
|
|
63
|
+
*/
|
|
64
|
+
function docsPagesSource() {
|
|
65
|
+
return custom({
|
|
66
|
+
name: "docs-pages",
|
|
67
|
+
materialize: "lazy",
|
|
68
|
+
cache: false,
|
|
69
|
+
getKeys: async () => (await import("./assistant-pages-CqNlHsx-.js")).listDocsAssistantPagePaths(),
|
|
70
|
+
getItem: async (key) => ({
|
|
71
|
+
key,
|
|
72
|
+
content: await (await import("./assistant-pages-CqNlHsx-.js")).readDocsAssistantPage(key),
|
|
73
|
+
mediaType: "text/markdown"
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
}
|
|
57
77
|
/** The docs rules, the developer's instructions in their place, and the reader's page. */
|
|
58
78
|
const docsInstructions = { template: [docsRules, currentPageInstructions] };
|
|
59
79
|
/**
|
|
60
|
-
* The parts of the docs assistant that do not depend on the host: a read-only Workspace with the pages
|
|
80
|
+
* The parts of the docs assistant that do not depend on the host: a read-only Workspace with the pages of the docs site,
|
|
61
81
|
* the `web` Chat Channel with the reader's current page, a site-wide rate limit, and Driver capacity.
|
|
62
82
|
*/
|
|
63
83
|
function defineDocsAssistant(driver, capabilities = []) {
|
|
@@ -67,11 +87,7 @@ function defineDocsAssistant(driver, capabilities = []) {
|
|
|
67
87
|
workspace: {
|
|
68
88
|
mode: "read",
|
|
69
89
|
sourceRootDir: process.cwd(),
|
|
70
|
-
sources: { pages:
|
|
71
|
-
cwd: "content",
|
|
72
|
-
include: ["**/*.md"],
|
|
73
|
-
keyCache: false
|
|
74
|
-
}) }
|
|
90
|
+
sources: { pages: docsPagesSource() }
|
|
75
91
|
},
|
|
76
92
|
channels: { web: webChat({ route: { admission: { context: ({ body }) => {
|
|
77
93
|
const appBase = docsPageFromBody({ page: Reflect.get(body, "appBase") });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as docsRateLimit, n as docsPageContextKey, r as docsPageFromBody, t as DocsRateLimitOptions } from "./assistant-shared-
|
|
1
|
+
import { i as docsRateLimit, n as docsPageContextKey, r as docsPageFromBody, t as DocsRateLimitOptions } from "./assistant-shared-CWIKRtBv.js";
|
|
2
2
|
import { WorkspaceAgentDefinition } from "@vite-hub/agent";
|
|
3
3
|
//#region src/assistant-worker.d.ts
|
|
4
4
|
/**
|
package/dist/assistant-worker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as docsPageFromBody, i as docsPageContextKey, n as docsAssistantModel, o as docsRateLimit, r as docsInstructions, t as defineDocsAssistant } from "./assistant-shared-
|
|
1
|
+
import { a as docsPageFromBody, i as docsPageContextKey, n as docsAssistantModel, o as docsRateLimit, r as docsInstructions, t as defineDocsAssistant } from "./assistant-shared-DhiLHKSl.js";
|
|
2
2
|
import { workspaceShell } from "@vite-hub/agent/capabilities";
|
|
3
3
|
import { chatgpt } from "@vite-hub/gateways";
|
|
4
4
|
//#region src/assistant-worker.ts
|
package/dist/assistant.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as docsRateLimit, n as docsPageContextKey, r as docsPageFromBody, t as DocsRateLimitOptions } from "./assistant-shared-
|
|
1
|
+
import { i as docsRateLimit, n as docsPageContextKey, r as docsPageFromBody, t as DocsRateLimitOptions } from "./assistant-shared-CWIKRtBv.js";
|
|
2
2
|
import { WorkspaceAgentDefinition } from "@vite-hub/agent";
|
|
3
3
|
//#region src/assistant.d.ts
|
|
4
4
|
/**
|
package/dist/assistant.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as docsPageFromBody, i as docsPageContextKey, o as docsRateLimit, r as docsInstructions, t as defineDocsAssistant } from "./assistant-shared-
|
|
1
|
+
import { a as docsPageFromBody, i as docsPageContextKey, o as docsRateLimit, r as docsInstructions, t as defineDocsAssistant } from "./assistant-shared-DhiLHKSl.js";
|
|
2
2
|
import { chatgpt } from "@vite-hub/gateways";
|
|
3
3
|
import { codexDriver } from "@vite-hub/agent";
|
|
4
4
|
//#region src/assistant.ts
|