@vite-hub/docs 0.3.1 → 0.4.1

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 (42) hide show
  1. package/README.md +15 -13
  2. package/dist/{agent-copy-BJp_Yf5d.js → agent-copy-xPaWye_g.js} +1 -1
  3. package/dist/assistant-pages-BN7hNsSZ.js +37 -0
  4. package/dist/{assistant-shared-Dll_F_yy.d.ts → assistant-shared-CWIKRtBv.d.ts} +3 -2
  5. package/dist/{assistant-shared-CdtXowot.js → assistant-shared-WzButktj.js} +23 -7
  6. package/dist/assistant-worker.d.ts +1 -1
  7. package/dist/assistant-worker.js +1 -1
  8. package/dist/assistant.d.ts +1 -1
  9. package/dist/assistant.js +1 -1
  10. package/dist/{content-9CINWiRf.js → content-CPZGnn3S.js} +3 -33
  11. package/dist/{draft-DUBx--r9.js → draft-BjWmaiLn.js} +1 -1
  12. package/dist/error-diagnostics-B_ZOy7kF.js +93 -0
  13. package/dist/files-UY4h1_36.js +38 -0
  14. package/dist/index.d.ts +2 -2
  15. package/dist/index.js +1 -1
  16. package/dist/link-checker-redirects.js +1 -1
  17. package/dist/{manifest-Dzp5-_AJ.d.ts → manifest-CMoxcwPm.d.ts} +8 -2
  18. package/dist/{manifest-D66AEF8F.js → manifest-ZdxLrcvt.js} +47 -33
  19. package/dist/{markdown-Cn9-4oVG.js → markdown-DUWnEMPp.js} +1 -1
  20. package/dist/navigation.d.ts +1 -2
  21. package/dist/navigation.js +1 -2
  22. package/dist/{nuxt-B5LrERKc.d.ts → nuxt-CAGpKl_-.d.ts} +5 -4
  23. package/dist/nuxt.d.ts +1 -1
  24. package/dist/nuxt.js +465 -82
  25. package/dist/{page-BbmSfZO8.js → page-GPt09oex.js} +2 -1
  26. package/dist/primitive-rail.d.ts +1 -1
  27. package/dist/primitive-rail.js +7 -2
  28. package/dist/{raw-C03EUJKw.js → raw-BChwipz_.js} +6 -0
  29. package/dist/{redirects-BrbWFSzW.js → redirects-CmR1yu5A.js} +18 -6
  30. package/dist/runtime/app/components/content/McpClient.vue +170 -0
  31. package/dist/runtime/app/components/content/McpInstall.vue +238 -0
  32. package/dist/runtime/server/llms.js +1 -1
  33. package/dist/runtime/server/markdown.js +1 -1
  34. package/dist/runtime/server/mcp.js +1 -1
  35. package/dist/runtime/server/page.js +3 -3
  36. package/dist/runtime/server/raw.js +1 -1
  37. package/dist/runtime/server/search.js +2 -2
  38. package/dist/runtime/server/sitemap.js +1 -1
  39. package/dist/server.d.ts +1 -1
  40. package/dist/server.js +4 -4
  41. package/package.json +11 -11
  42. package/dist/error-diagnostics-BoOsP6Y4.js +0 -53
@@ -71,6 +71,7 @@ function replacesDocsPage(routes, mount) {
71
71
  const prefix = mount === "/" ? "" : mount;
72
72
  return routePaths(routes).some((path) => /^(.*?)\/:\w+\(\.\*\)\*?$/.exec(path)?.[1] === prefix);
73
73
  }
74
+ /** Every route path of the app, with the paths of child routes joined to their parents. */
74
75
  function routePaths(routes, parent = "") {
75
76
  return routes.flatMap((route) => {
76
77
  const path = route.path.startsWith("/") ? route.path : `${parent.replace(/\/+$/, "")}/${route.path}`;
@@ -78,4 +79,4 @@ function routePaths(routes, parent = "") {
78
79
  });
79
80
  }
80
81
  //#endregion
81
- export { replacesDocsPage as a, docsPageResponse as i, docsPageOf as n, docsPagePath as r, docsMount as t };
82
+ export { replacesDocsPage as a, docsPageResponse as i, docsPageOf as n, routePaths as o, docsPagePath as r, docsMount as t };
@@ -1,7 +1,7 @@
1
1
  import { Component, PropType, SlotsType, VNode } from "vue";
2
2
  //#region ../icons/dist/index.d.ts
3
3
  /** Name of an icon in the ViteHub set, such as `kv` for `i-vitehub-kv`. */
4
- type ViteHubIconName = "agent" | "auth" | "blob" | "browser" | "bundle" | "cache" | "channels" | "cms" | "codemods" | "comments" | "compare" | "connections" | "content" | "database" | "decisions" | "development" | "device" | "docs" | "email" | "env" | "forge" | "forms" | "gateways" | "guides" | "hosts" | "i18n" | "kv" | "logs" | "mcp" | "queue" | "rate-limit" | "realtime" | "reference" | "sandbox" | "schedule" | "shell" | "skills" | "source" | "start" | "sync" | "ui" | "usage" | "web-container" | "webhooks" | "workflow" | "workspace";
4
+ type ViteHubIconName = "agent" | "auth" | "blob" | "browser" | "bundle" | "cache" | "channels" | "choices" | "cli" | "cms" | "codemods" | "comments" | "compare" | "connections" | "console" | "content" | "database" | "development" | "device" | "docs" | "email" | "env" | "forge" | "forms" | "gateways" | "guides" | "hosts" | "i18n" | "kv" | "logs" | "markdown-template" | "mcp" | "presets" | "queue" | "rate-limit" | "realtime" | "reference" | "runtime" | "sandbox" | "schedule" | "shell" | "skills" | "source" | "start" | "sync" | "ui" | "usage" | "web-container" | "webhooks" | "workflow" | "workspace";
5
5
  //#endregion
6
6
  //#region src/components/primitive-icon.d.ts
7
7
  /** Name of an icon in the `@vite-hub/icons` set: one for each Server Primitive, Console area, and docs area. */
@@ -4,7 +4,7 @@ const icons = {
4
4
  "prefix": "vitehub",
5
5
  "info": {
6
6
  "name": "ViteHub",
7
- "total": 46,
7
+ "total": 51,
8
8
  "author": {
9
9
  "name": "ViteHub",
10
10
  "url": "https://github.com/vite-hub/vitehub/tree/main/packages/icons"
@@ -26,14 +26,16 @@ const icons = {
26
26
  "bundle": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"m21 7.5-9-4.5-9 4.5v9l9 4.5 9-4.5zM3 7.5l9 4.5 9-4.5M12 12v9\"/><g data-motion=\"\"><path d=\"m7 5.5 9 4.5\"/></g></g>" },
27
27
  "cache": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><g data-motion=\"\"><path d=\"M13 7.5 9 12.5h3.5l-1 4 4-5H12z\"/></g></g>" },
28
28
  "channels": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3 16.5V6a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2H6.5z\"/><g data-motion=\"\"><path d=\"M18 8h1a2 2 0 0 1 2 2v10.5L17.5 17H11a2 2 0 0 1-2-2v-.5\"/></g></g>" },
29
+ "choices": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M12 21v-9\"/><path d=\"M12 12 3 3M3 7.5V3h4.5M12 12l9-9\"/><g data-motion=\"\"><path d=\"M21 7.5V3h-4.5\"/></g></g>" },
30
+ "cli": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"m4 6.5 6 5.5-6 5.5\"/><g data-motion=\"\"><path d=\"M12.5 18H20\"/></g></g>" },
29
31
  "cms": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M19 10.5V5a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5\"/><path d=\"M9 7.5h6M9 11.5h3\"/><g data-motion=\"\"><path d=\"M17.5 13.5l2.5 2.5-5 5h-2.5v-2.5z\"/></g></g>" },
30
32
  "codemods": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"m7.5 7-4.5 5 4.5 5\"/><g data-motion=\"\"><path d=\"M11 12h10m-3.5-3.5L21 12l-3.5 3.5\"/></g></g>" },
31
33
  "comments": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M12 20H4v-8a8 8 0 1 1 8 8z\"/><g data-motion=\"\"><path d=\"M8.5 10.5h7M8.5 14h4.5\"/></g></g>" },
32
34
  "compare": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M4 8h16M16 4l4 4-4 4\"/><g data-motion=\"\"><path d=\"M20 16H4M8 12l-4 4 4 4\"/></g></g>" },
33
35
  "connections": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M12 16.5V21\"/><g data-motion=\"\"><path d=\"M9 3v4M15 3v4M6.5 7h11v4a5.5 5.5 0 0 1-11 0z\"/></g></g>" },
36
+ "console": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"4.5\" width=\"18\" height=\"15\" rx=\"2\"/><path d=\"M8.5 4.5v15\"/><g data-motion=\"\"><path d=\"M11.5 9H17M11.5 12h4M11.5 15H16\"/></g></g>" },
34
37
  "content": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"5\" y=\"3\" width=\"14\" height=\"18\" rx=\"2\"/><path d=\"M9 7.5h6\"/><g data-motion=\"\"><path d=\"M9 11.5h6M9 15.5h4\"/></g></g>" },
35
38
  "database": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M4 6v12c0 1.66 3.58 3 8 3s8-1.34 8-3V6\"/><path d=\"M4 12c0 1.66 3.58 3 8 3s8-1.34 8-3\"/><g data-motion=\"\"><path d=\"M4 6c0-1.66 3.58-3 8-3s8 1.34 8 3-3.58 3-8 3-8-1.34-8-3z\"/></g></g>" },
36
- "decisions": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M12 21v-9\"/><path d=\"M12 12 3 3M3 7.5V3h4.5M12 12l9-9\"/><g data-motion=\"\"><path d=\"M21 7.5V3h-4.5\"/></g></g>" },
37
39
  "development": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"m8 7-5 5 5 5M16 7l5 5-5 5\"/><g data-motion=\"\"><path d=\"m13.5 5-3 14\"/></g></g>" },
38
40
  "device": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"6.5\" y=\"3\" width=\"11\" height=\"18\" rx=\"2.5\"/><path d=\"M10.5 18h3\"/><g data-motion=\"\"><path d=\"M9.5 7.5h5M9.5 10.5h5M9.5 13.5h3\"/></g></g>" },
39
41
  "docs": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M12 6.5C10.5 5 8 4.5 3 4.5v14c5 0 7.5.5 9 2\"/><g data-motion=\"\"><path d=\"M12 6.5c1.5-1.5 4-2 9-2v14c-5 0-7.5.5-9 2V6.5\"/></g></g>" },
@@ -47,11 +49,14 @@ const icons = {
47
49
  "i18n": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3.5 6h9M8 3.5V6\"/><path d=\"M5 9.5l5 5M4 15l5-5 2-4\"/><g data-motion=\"\"><path d=\"M12.5 21l4-9 4 9M14 18h5\"/></g></g>" },
48
50
  "kv": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M9 5v14M3 12h18\"/><g data-motion=\"\"><path d=\"M12.5 8.5h5M12.5 15.5h3.5\"/></g></g>" },
49
51
  "logs": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M4 6h2M4 12h2M4 18h2\"/><g data-motion=\"\"><path d=\"M9.5 6H20M9.5 12h7.5M9.5 18H19\"/></g></g>" },
52
+ "markdown-template": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M6.5 15.5v-7l2.5 3 2.5-3v7\"/><g data-motion=\"\"><path d=\"M16.5 8.5v7M14.5 13.5l2 2 2-2\"/></g></g>" },
50
53
  "mcp": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><path d=\"M12 15.5v1.5\"/><g data-motion=\"\"><path d=\"M9.5 8.5v3.5M14.5 8.5v3.5\"/></g></g>" },
54
+ "presets": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M17 3H5a2 2 0 0 0-2 2v12\"/><g data-motion=\"\"><rect x=\"7\" y=\"7\" width=\"14\" height=\"14\" rx=\"2\"/><path d=\"M12 12.5v2M16 12.5v2\"/></g></g>" },
51
55
  "queue": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M16.5 12H21M18 9l3 3-3 3\"/><g data-motion=\"\"><rect x=\"3\" y=\"7\" width=\"5\" height=\"10\" rx=\"1.5\"/><rect x=\"9.5\" y=\"7\" width=\"5\" height=\"10\" rx=\"1.5\"/></g></g>" },
52
56
  "rate-limit": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3 16a9 9 0 0 1 18 0M6 20h12\"/><path d=\"M12 16h.01\"/><g data-motion=\"\"><path d=\"m12 16 4-5\"/></g></g>" },
53
57
  "realtime": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><circle cx=\"12\" cy=\"12\" r=\"1.5\"/><path d=\"M8.5 8.5a5 5 0 0 0 0 7M15.5 8.5a5 5 0 0 1 0 7\"/><g data-motion=\"\"><path d=\"M5.5 5.5a9.2 9.2 0 0 0 0 13M18.5 5.5a9.2 9.2 0 0 1 0 13\"/></g></g>" },
54
58
  "reference": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M8 3.5H7a2 2 0 0 0-2 2V10a2 2 0 0 1-2 2 2 2 0 0 1 2 2v4.5a2 2 0 0 0 2 2h1\"/><g data-motion=\"\"><path d=\"M16 3.5h1a2 2 0 0 1 2 2V10a2 2 0 0 0 2 2 2 2 0 0 0-2 2v4.5a2 2 0 0 1-2 2h-1\"/></g></g>" },
59
+ "runtime": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"2\"/><path d=\"M9.5 3v3M14.5 3v3M9.5 18v3M14.5 18v3M3 9.5h3M3 14.5h3M18 9.5h3M18 14.5h3\"/><g data-motion=\"\"><rect x=\"9.5\" y=\"9.5\" width=\"5\" height=\"5\" rx=\"1\"/></g></g>" },
55
60
  "sandbox": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3 8V5a2 2 0 0 1 2-2h3M16 3h3a2 2 0 0 1 2 2v3M21 16v3a2 2 0 0 1-2 2h-3M8 21H5a2 2 0 0 1-2-2v-3\"/><g data-motion=\"\"><rect x=\"8\" y=\"8\" width=\"8\" height=\"8\" rx=\"1.5\"/></g></g>" },
56
61
  "schedule": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"16\" rx=\"2\"/><path d=\"M3 10h18M8 3v4M16 3v4\"/><g data-motion=\"\"><rect x=\"7\" y=\"13.5\" width=\"3.5\" height=\"3.5\" rx=\"1\"/></g></g>" },
57
62
  "shell": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><path d=\"m7 9.5 3 2.5-3 2.5\"/><g data-motion=\"\"><path d=\"M12.5 15h4.5\"/></g></g>" },
@@ -671,6 +671,8 @@ const presentationDirectives = /* @__PURE__ */ new Set([
671
671
  "example",
672
672
  "examples",
673
673
  "incorrect",
674
+ "mcp-client",
675
+ "mcp-install",
674
676
  "page-list",
675
677
  "important",
676
678
  "note",
@@ -717,6 +719,10 @@ function directiveLabel(name, attributes) {
717
719
  "warning",
718
720
  "important"
719
721
  ].includes(name)) return `> **${name[0].toUpperCase()}${name.slice(1)}**`;
722
+ if (name === "mcp-client") {
723
+ const label = attributes?.match(/\blabel=(?:"([^"]+)"|'([^']+)')/)?.slice(1).find(Boolean);
724
+ return label ? `### ${label}` : "";
725
+ }
720
726
  if (name === "tabs-item") {
721
727
  const label = attributes?.match(/\blabel=(?:"([^"]+)"|'([^']+)')/)?.slice(1).find(Boolean);
722
728
  return label ? `### ${label}` : "";
@@ -1,5 +1,6 @@
1
1
  import { docsManifestPages, docsRawPath, docsSectionForPath, isDocsPath, normalizeDocsPath } from "./navigation.js";
2
- import { t as docsErrorDiagnostics } from "./error-diagnostics-BoOsP6Y4.js";
2
+ import { t as docsErrorDiagnostics } from "./error-diagnostics-B_ZOy7kF.js";
3
+ import { addRoute, createRouter, findRoute } from "rou3";
3
4
  //#region src/redirects.ts
4
5
  /**
5
6
  * The redirect route rules from an exact app path. Keep external targets so a chain can end at another site.
@@ -20,12 +21,23 @@ function docsPaths(manifest) {
20
21
  return new Set(docsManifestPages(manifest).flatMap((page) => [page.path, docsRawPath(page.path)]));
21
22
  }
22
23
  /**
24
+ * The server routes that answer a browser navigation, a `GET`. A catch-all at the root, such as the page renderer or
25
+ * `server/routes/[...slug].ts`, answers every path, and the docs' own handlers below `docsRuntime` serve the docs
26
+ * pages, so they are left out.
27
+ */
28
+ function docsServerRoutes(routes, docsRuntime) {
29
+ return routes.filter(({ route, method, handler }) => (!method || method.toUpperCase() === "GET") && !/^\/(?:\*\*(?::\w+)?|:\w+\(\.\*\))$/.test(route) && !handler.startsWith(docsRuntime));
30
+ }
31
+ /**
23
32
  * Redirects that break a link. A redirect from a docs page hides the page, as nobody can open it. A redirect into a
24
- * section, the docs base, or `/raw/` must open a docs page or its Markdown copy, or another redirect. Other targets
25
- * belong to the app, so they are not checked here. Each problem is one sentence that names the fix.
33
+ * section, the docs base, or `/raw/` must open a docs page or its Markdown copy, another redirect, or one of
34
+ * `serverRoutes`, from `docsServerRoutes()`. Other targets belong to the app, so they are not checked here. Each
35
+ * problem is one sentence that names the fix.
26
36
  */
27
- function docsRedirectProblems(manifest, redirects) {
37
+ function docsRedirectProblems(manifest, redirects, serverRoutes = []) {
28
38
  const pages = docsPaths(manifest);
39
+ const routes = createRouter();
40
+ for (const { route, method } of serverRoutes) addRoute(routes, method, route, true);
29
41
  const next = new Map(redirects.map((redirect) => [normalizeDocsPath(redirect.from), redirect.to]));
30
42
  const problems = [];
31
43
  for (const { from, to } of redirects) {
@@ -45,7 +57,7 @@ function docsRedirectProblems(manifest, redirects) {
45
57
  problems.push(`The redirect from ${from} comes back to ${target} and never reaches a page. Point one of its route rules to a page.`);
46
58
  continue;
47
59
  }
48
- if ((target.startsWith("/raw/") || docsSectionForPath(manifest, target) !== null || manifest.base !== "/" && isDocsPath(target, manifest.base)) && !pages.has(target)) problems.push(`The redirect from ${from} goes to ${end}, which is not a docs page. Point it to a page, or remove the route rule.`);
60
+ if ((target.startsWith("/raw/") || docsSectionForPath(manifest, target) !== null || manifest.base !== "/" && isDocsPath(target, manifest.base)) && !pages.has(target) && !findRoute(routes, "GET", end.replace(/[?#].*$/, ""))) problems.push(`The redirect from ${from} goes to ${end}, which is not a docs page. Point it to a page, or remove the route rule.`);
49
61
  }
50
62
  return problems;
51
63
  }
@@ -59,4 +71,4 @@ function docsRedirectError(problems) {
59
71
  return Object.assign(docsErrorDiagnostics.DOCS_REDIRECTS_BROKEN({ problems }), { problems });
60
72
  }
61
73
  //#endregion
62
- export { docsRedirectProblems as n, docsRedirects as r, docsRedirectError as t };
74
+ export { docsServerRoutes as i, docsRedirectProblems as n, docsRedirects as r, docsRedirectError as t };
@@ -0,0 +1,170 @@
1
+ <script setup lang="ts">
2
+ // `:::mcp-client{label icon method}` inside `::mcp-install`: the setup of one client. Its Markdown is the steps,
3
+ // usually a numbered list, which shows as numbered circles. `install` adds the client's one-click install link,
4
+ // and `note` adds a footer line.
5
+ import { docsMcpInstallLinks } from "#docs/navigation"
6
+
7
+ const props = defineProps<{
8
+ label: string
9
+ icon?: string
10
+ /** How the server gets into this client, such as "Terminal" or "Settings". */
11
+ method?: string
12
+ /** A client with a one-click install link from the site's MCP config. */
13
+ install?: "cursor" | "vscode"
14
+ note?: string
15
+ }>()
16
+
17
+ const { mcp, site } = useDocsConfig()
18
+ const installUrl = computed(() => props.install && mcp ? docsMcpInstallLinks(mcp)[props.install] : undefined)
19
+ </script>
20
+
21
+ <template>
22
+ <article class="vh-mcp-guide" :aria-label="`${label} setup`">
23
+ <header class="vh-mcp-guide-header">
24
+ <span class="vh-mcp-guide-logo"><UIcon :name="icon ?? 'i-lucide-plug'" aria-hidden="true" /></span>
25
+ <div class="vh-mcp-guide-title">
26
+ <h3>Add the {{ site.name }} MCP to {{ label }}</h3>
27
+ <p v-if="method">{{ method }}</p>
28
+ </div>
29
+ <UButton
30
+ v-if="installUrl"
31
+ :to="installUrl"
32
+ external
33
+ size="sm"
34
+ variant="outline"
35
+ color="neutral"
36
+ trailing-icon="i-lucide-arrow-up-right"
37
+ :label="`Add to ${label}`"
38
+ />
39
+ </header>
40
+ <div class="vh-mcp-guide-body">
41
+ <slot />
42
+ </div>
43
+ <footer v-if="note" class="vh-mcp-guide-note">{{ note }}</footer>
44
+ </article>
45
+ </template>
46
+
47
+ <style scoped>
48
+ .vh-mcp-guide {
49
+ overflow: hidden;
50
+ border: 1px solid var(--ui-border);
51
+ border-radius: calc(var(--ui-radius) * 3);
52
+ background: var(--ui-bg);
53
+ }
54
+
55
+ .vh-mcp-guide-header {
56
+ display: flex;
57
+ flex-wrap: wrap;
58
+ align-items: center;
59
+ gap: 0.75rem;
60
+ padding: 0.75rem 1rem;
61
+ border-bottom: 1px solid var(--ui-border);
62
+ }
63
+
64
+ .vh-mcp-guide-logo {
65
+ display: flex;
66
+ flex-shrink: 0;
67
+ align-items: center;
68
+ justify-content: center;
69
+ width: 2.25rem;
70
+ height: 2.25rem;
71
+ border: 1px solid var(--ui-border);
72
+ border-radius: calc(var(--ui-radius) * 2);
73
+ font-size: 1.25rem;
74
+ }
75
+
76
+ .vh-mcp-guide-title {
77
+ flex: 1 1 10rem;
78
+ min-width: 0;
79
+ }
80
+
81
+ .vh-mcp-guide-title h3 {
82
+ margin: 0;
83
+ font-size: 0.875rem;
84
+ font-weight: 500;
85
+ line-height: 1.25rem;
86
+ color: var(--ui-text-highlighted);
87
+ }
88
+
89
+ .vh-mcp-guide-title p {
90
+ margin: 0;
91
+ font-size: 0.75rem;
92
+ line-height: 1rem;
93
+ color: var(--ui-text-muted);
94
+ }
95
+
96
+ .vh-mcp-guide-body {
97
+ padding: 1rem;
98
+ font-size: 0.875rem;
99
+ line-height: 1.375rem;
100
+ color: var(--ui-text-muted);
101
+ }
102
+
103
+ .vh-mcp-guide-body :deep(> :first-child) {
104
+ margin-top: 0;
105
+ }
106
+
107
+ .vh-mcp-guide-body :deep(> :last-child) {
108
+ margin-bottom: 0;
109
+ }
110
+
111
+ .vh-mcp-guide-body :deep(p) {
112
+ margin-block: 0.5rem;
113
+ }
114
+
115
+ .vh-mcp-guide-body :deep(code:not(pre code)) {
116
+ color: var(--ui-text-highlighted);
117
+ }
118
+
119
+ /* Numbered steps: each item gets its number in a circle, like a setup guide. */
120
+ .vh-mcp-guide-body :deep(ol) {
121
+ display: grid;
122
+ gap: 0.875rem;
123
+ margin: 0;
124
+ padding: 0;
125
+ list-style: none;
126
+ counter-reset: vh-mcp-step;
127
+ }
128
+
129
+ .vh-mcp-guide-body :deep(ol > li) {
130
+ position: relative;
131
+ min-width: 0;
132
+ margin: 0;
133
+ padding-left: 2.25rem;
134
+ counter-increment: vh-mcp-step;
135
+ }
136
+
137
+ .vh-mcp-guide-body :deep(ol > li)::before {
138
+ content: counter(vh-mcp-step);
139
+ position: absolute;
140
+ top: -0.0625rem;
141
+ left: 0;
142
+ display: flex;
143
+ align-items: center;
144
+ justify-content: center;
145
+ width: 1.5rem;
146
+ height: 1.5rem;
147
+ border: 1px solid var(--ui-border);
148
+ border-radius: 999px;
149
+ font-size: 0.75rem;
150
+ font-variant-numeric: tabular-nums;
151
+ color: var(--ui-text-toned);
152
+ }
153
+
154
+ .vh-mcp-guide-body :deep(ol > li > p:first-child) {
155
+ margin-top: 0;
156
+ }
157
+
158
+ .vh-mcp-guide-body :deep(li .code-block-wrapper) {
159
+ margin-block: 0.5rem 0;
160
+ }
161
+
162
+ .vh-mcp-guide-note {
163
+ padding: 0.75rem 1rem;
164
+ border-top: 1px solid var(--ui-border);
165
+ background: var(--ui-bg-muted);
166
+ font-size: 0.75rem;
167
+ line-height: 1.25rem;
168
+ color: var(--ui-text-muted);
169
+ }
170
+ </style>
@@ -0,0 +1,238 @@
1
+ <script setup lang="ts">
2
+ // `::mcp-install` connects a reader's agent to the docs MCP server. The Client tab lists one `:::mcp-client` per
3
+ // client as a row of logos, and shows the steps of the client the reader picks. The Prompt, MCP URL, and Command tabs
4
+ // come from the site's `mcp` config, so they always name the real server. Raw Markdown keeps every client's steps.
5
+ import { CopyButton } from "@vite-hub/ui"
6
+ import type { VNode } from "vue"
7
+
8
+ const slots = defineSlots<{ default?: () => VNode[] }>()
9
+ const { mcp, site } = useDocsConfig()
10
+
11
+ const tabs = [
12
+ { value: "client", label: "Client", slot: "client" },
13
+ { value: "prompt", label: "Prompt", slot: "prompt" },
14
+ { value: "url", label: "MCP URL", slot: "url" },
15
+ { value: "command", label: "Command", slot: "command" },
16
+ ]
17
+ const tab = ref("client")
18
+
19
+ // Comark wraps children in fragments. A client is any node with a `label` prop.
20
+ function clientNodes(nodes: VNode[]): VNode[] {
21
+ return nodes.flatMap(node => typeof node.type === "symbol" && Array.isArray(node.children)
22
+ ? clientNodes(node.children as VNode[])
23
+ : typeof node.props?.label === "string" ? [node] : [])
24
+ }
25
+ const clients = computed(() => clientNodes(slots.default?.() ?? []).map(node => ({
26
+ node,
27
+ label: String(node.props!.label),
28
+ icon: typeof node.props?.icon === "string" ? node.props.icon : "i-lucide-plug",
29
+ })))
30
+
31
+ const storageKey = "vh-mcp-client"
32
+ const selected = ref("")
33
+ const current = computed(() => clients.value.find(client => client.label === selected.value)?.label ?? clients.value[0]?.label)
34
+ function choose(label: string) {
35
+ selected.value = label
36
+ try { localStorage.setItem(storageKey, label) }
37
+ catch { /* Private mode: the choice lasts for this page. */ }
38
+ }
39
+ onMounted(() => {
40
+ try { selected.value = localStorage.getItem(storageKey) ?? "" }
41
+ catch { /* Storage is off: keep the first client. */ }
42
+ })
43
+
44
+ const prompt = computed(() => mcp
45
+ ? `Add the ${site.name} MCP server to this agent. Name it ${mcp.name} and use Streamable HTTP at ${mcp.url}. Then list its tools to confirm it works.`
46
+ : "")
47
+ const command = computed(() => mcp ? `npx add-mcp ${mcp.url} --name ${mcp.name}` : "")
48
+ </script>
49
+
50
+ <template>
51
+ <div v-if="mcp" class="vh-mcp not-prose">
52
+ <UTabs v-model="tab" :items="tabs" class="vh-mcp-tabs" aria-label="Setup method">
53
+ <template #client>
54
+ <div class="vh-mcp-clients" role="group" aria-label="Choose your client">
55
+ <button
56
+ v-for="client in clients"
57
+ :key="client.label"
58
+ type="button"
59
+ class="vh-mcp-client"
60
+ :aria-pressed="current === client.label"
61
+ @click="choose(client.label)"
62
+ >
63
+ <span class="vh-mcp-client-logo"><UIcon :name="client.icon" aria-hidden="true" /></span>
64
+ <span class="vh-mcp-client-name">{{ client.label }}</span>
65
+ </button>
66
+ </div>
67
+ <div v-for="client in clients" v-show="current === client.label" :key="client.label">
68
+ <component :is="client.node" />
69
+ </div>
70
+ </template>
71
+
72
+ <template #prompt>
73
+ <p class="vh-mcp-hint">Send this to your agent. It adds the server for you.</p>
74
+ <p class="vh-mcp-prompt">{{ prompt }}</p>
75
+ <CopyButton :value="prompt" label="Copy prompt" variant="solid" size="sm" />
76
+ </template>
77
+
78
+ <template #url>
79
+ <p class="vh-mcp-hint">Add a Streamable HTTP MCP server named <code>{{ mcp.name }}</code> with this URL.</p>
80
+ <div class="vh-mcp-field">
81
+ <code>{{ mcp.url }}</code>
82
+ <CopyButton :value="mcp.url" label="Copy" size="sm" variant="outline" />
83
+ </div>
84
+ </template>
85
+
86
+ <template #command>
87
+ <p class="vh-mcp-hint">Run this in your project, then pick the agents to add the server to. Add <code>-g</code> to add it for every project.</p>
88
+ <DocsCodePre :code="command" language="bash" filename="Terminal">{{ command }}</DocsCodePre>
89
+ </template>
90
+ </UTabs>
91
+ </div>
92
+ </template>
93
+
94
+ <style scoped>
95
+ .vh-mcp {
96
+ margin-block: 1.25rem 1.75rem;
97
+ container-type: inline-size;
98
+ }
99
+
100
+ .vh-mcp-tabs {
101
+ margin-bottom: 1rem;
102
+ }
103
+
104
+ .vh-mcp-clients {
105
+ display: flex;
106
+ flex-wrap: wrap;
107
+ gap: 0.375rem;
108
+ margin-bottom: 0.875rem;
109
+ }
110
+
111
+ /* Narrow: a row of chips. Wide: a grid of logo tiles, like a launcher. */
112
+ .vh-mcp-client {
113
+ display: flex;
114
+ align-items: center;
115
+ gap: 0.5rem;
116
+ min-height: 2.75rem;
117
+ padding: 0.25rem 0.75rem 0.25rem 0.25rem;
118
+ border: 1px solid var(--ui-border);
119
+ border-radius: calc(var(--ui-radius) * 2);
120
+ font-size: 0.8125rem;
121
+ line-height: 1rem;
122
+ color: var(--ui-text-muted);
123
+ cursor: pointer;
124
+ transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
125
+ }
126
+
127
+ .vh-mcp-client-logo {
128
+ display: flex;
129
+ flex-shrink: 0;
130
+ align-items: center;
131
+ justify-content: center;
132
+ width: 1.75rem;
133
+ height: 1.75rem;
134
+ border: 1px solid var(--ui-border);
135
+ border-radius: calc(var(--ui-radius) * 1.5);
136
+ background: var(--ui-bg);
137
+ font-size: 1rem;
138
+ }
139
+
140
+ .vh-mcp-client-name {
141
+ overflow: hidden;
142
+ text-overflow: ellipsis;
143
+ white-space: nowrap;
144
+ }
145
+
146
+ @media (hover: hover) {
147
+ .vh-mcp-client:hover {
148
+ background: var(--ui-bg-elevated);
149
+ color: var(--ui-text-highlighted);
150
+ }
151
+ }
152
+
153
+ .vh-mcp-client[aria-pressed="true"] {
154
+ border-color: var(--ui-border-accented);
155
+ background: var(--ui-bg-elevated);
156
+ color: var(--ui-text-highlighted);
157
+ }
158
+
159
+ @container (min-width: 34rem) {
160
+ .vh-mcp-clients {
161
+ display: grid;
162
+ grid-template-columns: repeat(auto-fit, minmax(4.75rem, 1fr));
163
+ }
164
+
165
+ .vh-mcp-client {
166
+ flex-direction: column;
167
+ gap: 0.375rem;
168
+ padding: 0.625rem 0.25rem 0.5rem;
169
+ font-size: 0.75rem;
170
+ }
171
+
172
+ .vh-mcp-client:not([aria-pressed="true"]) {
173
+ border-color: transparent;
174
+ }
175
+
176
+ .vh-mcp-client-logo {
177
+ width: 2rem;
178
+ height: 2rem;
179
+ font-size: 1.125rem;
180
+ }
181
+
182
+ .vh-mcp-client-name {
183
+ width: 100%;
184
+ text-align: center;
185
+ }
186
+ }
187
+
188
+ .vh-mcp-hint {
189
+ margin-bottom: 0.75rem;
190
+ font-size: 0.8125rem;
191
+ line-height: 1.25rem;
192
+ color: var(--ui-text-muted);
193
+ }
194
+
195
+ .vh-mcp-hint code,
196
+ .vh-mcp-field code {
197
+ font-family: var(--font-mono, ui-monospace, monospace);
198
+ font-size: 0.8125rem;
199
+ color: var(--ui-text-highlighted);
200
+ }
201
+
202
+ .vh-mcp-prompt {
203
+ margin-bottom: 0.75rem;
204
+ padding: 1rem;
205
+ border: 1px solid var(--ui-border);
206
+ border-radius: calc(var(--ui-radius) * 2);
207
+ background: var(--ui-bg-elevated);
208
+ font-size: 0.875rem;
209
+ line-height: 1.5rem;
210
+ overflow-wrap: anywhere;
211
+ user-select: text;
212
+ }
213
+
214
+ .vh-mcp-field {
215
+ display: flex;
216
+ align-items: center;
217
+ gap: 0.5rem;
218
+ min-width: 0;
219
+ padding: 0.375rem 0.375rem 0.375rem 1rem;
220
+ border: 1px solid var(--ui-border);
221
+ border-radius: calc(var(--ui-radius) * 2);
222
+ }
223
+
224
+ .vh-mcp-field code {
225
+ flex: 1;
226
+ min-width: 0;
227
+ overflow: hidden;
228
+ text-overflow: ellipsis;
229
+ white-space: nowrap;
230
+ }
231
+
232
+ @media (prefers-reduced-motion: reduce) {
233
+ .vh-mcp-tab,
234
+ .vh-mcp-client {
235
+ transition: none;
236
+ }
237
+ }
238
+ </style>
@@ -1,4 +1,4 @@
1
- import { n as docsContent } from "../../content-9CINWiRf.js";
1
+ import { n as docsContent } from "../../content-CPZGnn3S.js";
2
2
  import { defineContentLlmsHandler } from "@vite-hub/content";
3
3
  //#region src/runtime/server/llms.ts
4
4
  /** `/llms.txt`, `/llms-full.txt`, and `/sitemap.md`, from Content. The build prerenders them. */
@@ -6,6 +6,6 @@ import { serverFetch } from "nitro";
6
6
  * Content converts the HTML that Nitro renders for the same request. nuxt-agent-discovery answers the docs pages first.
7
7
  * Content loads on the first request that asks for Markdown or gets an HTML page.
8
8
  */
9
- const handler = defineContentMarkdownHandler(() => import("../../content-9CINWiRf.js").then((n) => n.t).then((module) => module.docsContent()), { render: (request) => serverFetch(request) });
9
+ const handler = defineContentMarkdownHandler(() => import("../../content-CPZGnn3S.js").then((n) => n.t).then((module) => module.docsContent()), { render: (request) => serverFetch(request) });
10
10
  //#endregion
11
11
  export { handler as default };
@@ -1,4 +1,4 @@
1
- import { n as docsContent } from "../../content-9CINWiRf.js";
1
+ import { n as docsContent } from "../../content-CPZGnn3S.js";
2
2
  import { defineContentMcpHandler } from "@vite-hub/content";
3
3
  //#region src/runtime/server/mcp.ts
4
4
  /** The docs MCP server at `/mcp`, with the `list-pages` and `get-page` tools of Content. */
@@ -1,6 +1,6 @@
1
- import { a as parseDocsDocument, r as readDocsPage } from "../../content-9CINWiRf.js";
1
+ import { a as parseDocsDocument, r as readDocsPage } from "../../content-CPZGnn3S.js";
2
2
  import { findDocsPage } from "../../navigation.js";
3
- import { i as docsPageResponse } from "../../page-BbmSfZO8.js";
3
+ import { i as docsPageResponse } from "../../page-GPt09oex.js";
4
4
  import manifest from "#docs/manifest";
5
5
  import { HTTPError, defineHandler, getRouterParam } from "nitro/h3";
6
6
  import { content } from "#docs/content";
@@ -9,7 +9,7 @@ import { content } from "#docs/content";
9
9
  const handler = defineHandler(async (event) => {
10
10
  const path = `/${(getRouterParam(event, "_") ?? "").replace(/\.json$/, "")}`;
11
11
  if (content && (content.preview.active() || content.preview.frame())) {
12
- const { docsDraftResponse } = await import("../../draft-DUBx--r9.js");
12
+ const { docsDraftResponse } = await import("../../draft-BjWmaiLn.js");
13
13
  const draft = await docsDraftResponse(content, manifest, path, parseDocsDocument);
14
14
  if (draft) {
15
15
  event.res.headers.set("cache-control", "private, no-store");
@@ -1,4 +1,4 @@
1
- import { i as readDocsRawCopy } from "../../content-9CINWiRf.js";
1
+ import { i as readDocsRawCopy } from "../../content-CPZGnn3S.js";
2
2
  import { HTTPError, defineHandler } from "nitro/h3";
3
3
  //#region src/runtime/server/raw.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
- import { r as readDocsPage } from "../../content-9CINWiRf.js";
1
+ import { r as readDocsPage } from "../../content-CPZGnn3S.js";
2
2
  import { docsIndexedPages, docsManifestPages, docsUnindexedSearchSections } from "../../navigation.js";
3
- import { a as docsSearchSections } from "../../markdown-Cn9-4oVG.js";
3
+ import { a as docsSearchSections } from "../../markdown-DUWnEMPp.js";
4
4
  import manifest from "#docs/manifest";
5
5
  import { defineHandler } from "nitro/h3";
6
6
  //#region src/runtime/server/search.ts
@@ -1,4 +1,4 @@
1
- import { n as docsContent } from "../../content-9CINWiRf.js";
1
+ import { n as docsContent } from "../../content-CPZGnn3S.js";
2
2
  import { docsCanonicalUrl } from "../../navigation.js";
3
3
  import { useRuntimeConfig } from "nitro/runtime-config";
4
4
  import { defineHandler } from "nitro/h3";
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as DocsParserOptions, c as docsSearchSections, i as DocsDocument, n as DocsPageResponse, o as createDocsParser, r as docsPageResponse, s as docsMarkdown, t as DocsPageLink } from "./page-Dx2JD3y1.js";
2
- import { a as createDocsContent, c as checkDocsLinks, i as DocsSourceInput, n as DocsManifestOptions, o as createDocsManifest, r as DocsSource, s as DocsLinkCheckOptions, t as DocsContentSource } from "./manifest-Dzp5-_AJ.js";
2
+ import { a as createDocsContent, c as checkDocsLinks, i as DocsSourceInput, n as DocsManifestOptions, o as createDocsManifest, r as DocsSource, s as DocsLinkCheckOptions, t as DocsContentSource } from "./manifest-CMoxcwPm.js";
3
3
  //#region src/raw.d.ts
4
4
  type RawMarkdownOptions = {
5
5
  /** Origin that site-relative links point to, such as `https://vitehub.dev`. Empty keeps them relative. */
package/dist/server.js CHANGED
@@ -1,5 +1,5 @@
1
- import { i as docsPageResponse } from "./page-BbmSfZO8.js";
2
- import { c as checkDocsLinks, n as createDocsManifest, t as createDocsContent } from "./manifest-D66AEF8F.js";
3
- import { t as toRawMarkdown } from "./raw-C03EUJKw.js";
4
- import { a as docsSearchSections, i as docsMarkdown, t as createDocsParser } from "./markdown-Cn9-4oVG.js";
1
+ import { i as docsPageResponse } from "./page-GPt09oex.js";
2
+ import { l as checkDocsLinks, n as createDocsContent, r as createDocsManifest } from "./manifest-ZdxLrcvt.js";
3
+ import { t as toRawMarkdown } from "./raw-BChwipz_.js";
4
+ import { a as docsSearchSections, i as docsMarkdown, t as createDocsParser } from "./markdown-DUWnEMPp.js";
5
5
  export { checkDocsLinks, createDocsContent, createDocsManifest, createDocsParser, docsMarkdown, docsPageResponse, docsSearchSections, toRawMarkdown };