@vercel/geistdocs 1.2.3-canary.a12a9c6 → 1.2.3-canary.fd2c9a6

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 (126) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/config.d.ts +46 -1
  3. package/dist/config.d.ts.map +1 -1
  4. package/dist/footer.d.ts +8 -0
  5. package/dist/footer.d.ts.map +1 -0
  6. package/dist/footer.js +6 -0
  7. package/dist/home-layout.d.ts +11 -0
  8. package/dist/home-layout.d.ts.map +1 -0
  9. package/dist/home-layout.js +31 -0
  10. package/dist/internal/config-context.d.ts +10 -0
  11. package/dist/internal/config-context.d.ts.map +1 -0
  12. package/dist/internal/config-context.js +15 -0
  13. package/dist/internal/footer/github-button.d.ts +7 -0
  14. package/dist/internal/footer/github-button.d.ts.map +1 -0
  15. package/dist/internal/footer/github-button.js +10 -0
  16. package/dist/internal/footer/rss-button.d.ts +2 -0
  17. package/dist/internal/footer/rss-button.d.ts.map +1 -0
  18. package/dist/internal/footer/rss-button.js +4 -0
  19. package/dist/internal/navbar/desktop-menu.d.ts +10 -0
  20. package/dist/internal/navbar/desktop-menu.d.ts.map +1 -0
  21. package/dist/internal/navbar/desktop-menu.js +11 -0
  22. package/dist/internal/navbar/mobile-menu.d.ts +7 -0
  23. package/dist/internal/navbar/mobile-menu.d.ts.map +1 -0
  24. package/dist/internal/navbar/mobile-menu.js +40 -0
  25. package/dist/internal/navbar/navbar-logo.d.ts +16 -0
  26. package/dist/internal/navbar/navbar-logo.d.ts.map +1 -0
  27. package/dist/internal/navbar/navbar-logo.js +30 -0
  28. package/dist/internal/page-actions-client.d.ts.map +1 -1
  29. package/dist/internal/page-actions-client.js +12 -1
  30. package/dist/internal/page-visibility.d.ts +18 -0
  31. package/dist/internal/page-visibility.d.ts.map +1 -0
  32. package/dist/internal/page-visibility.js +24 -0
  33. package/dist/internal/provider-client.d.ts +1 -1
  34. package/dist/internal/provider-client.d.ts.map +1 -1
  35. package/dist/internal/provider-client.js +2 -1
  36. package/dist/internal/sidebar.js +1 -1
  37. package/dist/internal/ui/button.d.ts +1 -1
  38. package/dist/internal/ui/navigation-menu.d.ts +17 -0
  39. package/dist/internal/ui/navigation-menu.d.ts.map +1 -0
  40. package/dist/internal/ui/navigation-menu.js +38 -0
  41. package/dist/internal/ui/sonner.js +3 -3
  42. package/dist/mdx.d.ts +11 -0
  43. package/dist/mdx.d.ts.map +1 -1
  44. package/dist/mdx.js +8 -0
  45. package/dist/mobile-docs-bar.d.ts +7 -0
  46. package/dist/mobile-docs-bar.d.ts.map +1 -0
  47. package/dist/mobile-docs-bar.js +13 -0
  48. package/dist/navbar.d.ts +7 -0
  49. package/dist/navbar.d.ts.map +1 -0
  50. package/dist/navbar.js +10 -0
  51. package/dist/pages/docs.d.ts +2 -1
  52. package/dist/pages/docs.d.ts.map +1 -1
  53. package/dist/pages/docs.js +7 -2
  54. package/dist/proxy.d.ts +1 -1
  55. package/dist/proxy.d.ts.map +1 -1
  56. package/dist/proxy.js +28 -2
  57. package/dist/routes/agents.d.ts +21 -0
  58. package/dist/routes/agents.d.ts.map +1 -0
  59. package/dist/routes/agents.js +201 -0
  60. package/dist/routes/chat.d.ts.map +1 -1
  61. package/dist/routes/chat.js +12 -3
  62. package/dist/routes/llms.d.ts +6 -5
  63. package/dist/routes/llms.d.ts.map +1 -1
  64. package/dist/routes/llms.js +63 -12
  65. package/dist/routes/search.d.ts +6 -4
  66. package/dist/routes/search.d.ts.map +1 -1
  67. package/dist/routes/search.js +8 -1
  68. package/dist/routes/sitemap.d.ts +6 -3
  69. package/dist/routes/sitemap.d.ts.map +1 -1
  70. package/dist/routes/sitemap.js +10 -2
  71. package/dist/source.d.ts +8 -1
  72. package/dist/source.d.ts.map +1 -1
  73. package/dist/source.js +14 -1
  74. package/dist/versions.d.ts.map +1 -1
  75. package/dist/versions.js +34 -16
  76. package/package.json +23 -3
  77. package/template/AGENTS.md +69 -0
  78. package/template/app/[lang]/(home)/layout.tsx +4 -3
  79. package/template/app/[lang]/agents.md/route.ts +6 -0
  80. package/template/app/[lang]/docs/[[...slug]]/page.tsx +1 -1
  81. package/template/app/[lang]/layout.tsx +6 -6
  82. package/template/app/[lang]/llms.mdx/[[...slug]]/route.ts +1 -1
  83. package/template/app/[lang]/sitemap.md/route.ts +2 -2
  84. package/template/app/api/search/route.ts +2 -2
  85. package/template/content/docs/agent-readiness.mdx +103 -0
  86. package/template/content/docs/configuration.mdx +40 -1
  87. package/template/content/docs/index.mdx +1 -0
  88. package/template/content/docs/llms-txt.mdx +1 -0
  89. package/template/content/docs/md.mdx +2 -1
  90. package/template/content/docs/meta.json +1 -0
  91. package/template/content/docs/proxy.mdx +10 -1
  92. package/template/content/docs/theme-aware-image.mdx +1 -1
  93. package/template/geistdocs.tsx +26 -0
  94. package/template/lib/geistdocs/config.tsx +3 -0
  95. package/template/package.json +3 -3
  96. package/template/proxy.ts +0 -1
  97. package/template/source.config.ts +8 -0
  98. package/template/app/actions/feedback/emotions.ts +0 -18
  99. package/template/app/actions/feedback/index.ts +0 -45
  100. package/template/components/geistdocs/chat.tsx +0 -24
  101. package/template/components/geistdocs/desktop-menu.tsx +0 -52
  102. package/template/components/geistdocs/feedback.tsx +0 -139
  103. package/template/components/geistdocs/footer.tsx +0 -30
  104. package/template/components/geistdocs/github-button.tsx +0 -19
  105. package/template/components/geistdocs/home-layout.tsx +0 -46
  106. package/template/components/geistdocs/language-selector.tsx +0 -3
  107. package/template/components/geistdocs/mobile-docs-bar.tsx +0 -77
  108. package/template/components/geistdocs/mobile-menu.tsx +0 -150
  109. package/template/components/geistdocs/navbar-logo.tsx +0 -124
  110. package/template/components/geistdocs/navbar.tsx +0 -22
  111. package/template/components/geistdocs/rss-button.tsx +0 -10
  112. package/template/components/geistdocs/search.tsx +0 -17
  113. package/template/components/geistdocs/sidebar.tsx +0 -128
  114. package/template/components/geistdocs/theme-aware-image.tsx +0 -22
  115. package/template/components/geistdocs/theme-toggle.tsx +0 -3
  116. package/template/components/ui/card.tsx +0 -92
  117. package/template/components/ui/dialog.tsx +0 -143
  118. package/template/components/ui/input-group.tsx +0 -170
  119. package/template/components/ui/input.tsx +0 -21
  120. package/template/components/ui/navigation-menu.tsx +0 -192
  121. package/template/components/ui/popover.tsx +0 -48
  122. package/template/components/ui/separator.tsx +0 -28
  123. package/template/components/ui/sheet.tsx +0 -139
  124. package/template/components/ui/textarea.tsx +0 -18
  125. package/template/hooks/geistdocs/use-sidebar.ts +0 -13
  126. package/template/hooks/use-mobile.ts +0 -19
@@ -0,0 +1,103 @@
1
+ ---
2
+ title: Agent readiness
3
+ description: Expose a concise agents.md file that helps AI agents discover and use your docs site
4
+ type: guide
5
+ summary: Generate /agents.md from Geistdocs config so agents can find docs, Markdown surfaces, API specs, and MCP endpoints.
6
+ related:
7
+ - /docs/llms-txt
8
+ - /docs/md
9
+ - /docs/proxy
10
+ ---
11
+
12
+ Geistdocs can generate `/agents.md`, a concise Markdown file that tells AI agents what your product is, where your docs live, and which machine-readable integration surfaces are available.
13
+
14
+ <CopyPrompt text="Review this Geistdocs site's /agents.md file. Check whether it lists the product description, documentation links, llms.txt, sitemap.md, OpenAPI specs, and MCP servers accurately.">
15
+ Review this Geistdocs site's `/agents.md` file. Check whether it lists the product description, documentation links, `llms.txt`, `sitemap.md`, OpenAPI specs, and MCP servers accurately.
16
+ </CopyPrompt>
17
+
18
+ ## What it provides
19
+
20
+ The generated `/agents.md` file gives agents a stable starting point before they crawl the rest of your documentation.
21
+
22
+ It can include:
23
+
24
+ - Product name, description, category, audience, and use cases
25
+ - Human-readable docs entry points
26
+ - `/llms.txt` for full documentation context
27
+ - `/sitemap.md` for semantic navigation
28
+ - Page-level Markdown guidance for `.md` and `.mdx` URLs
29
+ - OpenAPI, authentication, scopes, rate limit, and error docs when configured
30
+ - MCP manifests and server URLs when configured
31
+ - Additional links and agent instructions
32
+
33
+ ## Add the route
34
+
35
+ Generated projects include a thin App Router adapter:
36
+
37
+ ```ts title="app/[lang]/agents.md/route.ts"
38
+ import { createAgentsRoute } from "@vercel/geistdocs/routes/agents";
39
+ import { config } from "@/lib/geistdocs/config";
40
+
41
+ export const { GET, generateStaticParams, revalidate } = createAgentsRoute({
42
+ config,
43
+ });
44
+ ```
45
+
46
+ Because the route is under `[lang]`, the Geistdocs proxy can serve `/agents.md` through the default language route.
47
+
48
+ ## Configure agent metadata
49
+
50
+ Add agent-readiness metadata in `geistdocs.tsx`, then pass it through `defineConfig` in `lib/geistdocs/config.tsx`.
51
+
52
+ ```tsx title="geistdocs.tsx"
53
+ import type { GeistdocsAgentReadinessConfig } from "@vercel/geistdocs/config";
54
+
55
+ export const agent = {
56
+ product: {
57
+ name: "My Product",
58
+ description: "My Product helps teams build and deploy applications.",
59
+ category: "Developer tools",
60
+ audience: ["Frontend developers", "Platform teams"],
61
+ useCases: ["Deploy applications", "Manage domains", "Inspect logs"],
62
+ },
63
+ api: {
64
+ openApiUrl: "https://api.example.com/openapi.json",
65
+ authDocsUrl: "/docs/authentication",
66
+ scopesDocsUrl: "/docs/scopes",
67
+ rateLimitsUrl: "/docs/rate-limits",
68
+ errorsUrl: "/docs/errors",
69
+ },
70
+ mcp: {
71
+ manifestUrl: "/.well-known/mcp.json",
72
+ servers: [
73
+ {
74
+ name: "My Product MCP",
75
+ url: "https://example.com/api/mcp",
76
+ description: "Use product tools through MCP.",
77
+ },
78
+ ],
79
+ },
80
+ links: [
81
+ {
82
+ label: "Support",
83
+ href: "https://example.com/support",
84
+ description: "Get help from the product team.",
85
+ },
86
+ ],
87
+ } satisfies GeistdocsAgentReadinessConfig;
88
+ ```
89
+
90
+ ```tsx title="lib/geistdocs/config.tsx"
91
+ import { agent } from "@/geistdocs";
92
+
93
+ export const config = defineConfig({
94
+ // ...
95
+ agent,
96
+ });
97
+ ```
98
+
99
+ ## Keep it honest
100
+
101
+ Only list OpenAPI specs, authentication flows, or MCP servers that actually exist. Geistdocs makes product capabilities discoverable, but it does not create APIs or MCP tools for you.
102
+
103
+ Use `/agents.md` with [llms.txt](/docs/llms-txt), [.md extension](/docs/md), and [Proxy and markdown routes](/docs/proxy) to give agents a complete discovery path.
@@ -22,12 +22,13 @@ Configure Geistdocs through user-owned files in the generated project. Runtime f
22
22
 
23
23
  | File | Purpose |
24
24
  | --- | --- |
25
- | `geistdocs.tsx` | Site-level settings, including logo, nav, GitHub repo, AI prompt, translations, and feature flags. |
25
+ | `geistdocs.tsx` | Site-level settings, including logo, nav, GitHub repo, AI prompt, agent-readiness metadata, translations, and feature flags. |
26
26
  | `lib/geistdocs/config.tsx` | Converts `geistdocs.tsx` exports into the package config using `defineConfig`. |
27
27
  | `lib/geistdocs/source.ts` | Connects Fumadocs content collections to the package source adapter. |
28
28
  | `components/geistdocs/mdx-components.tsx` | Adds or overrides MDX components. |
29
29
  | `components/geistdocs/docs-layout.tsx` | Customizes the package-backed docs layout, including optional sidebar content. |
30
30
  | `app/[lang]/docs/[[...slug]]/page.tsx` | Configures the package docs page renderer. |
31
+ | `app/[lang]/agents.md/route.ts` | Configures the agent-readiness entry point. |
31
32
  | `app/[lang]/llms.txt/route.ts` | Configures the all-docs Markdown endpoint. |
32
33
  | `app/[lang]/llms.mdx/[[...slug]]/route.ts` | Configures single-page Markdown responses. |
33
34
  | `proxy.ts` | Configures markdown negotiation, AI-agent rewrites, request tracking, and custom request hooks. |
@@ -43,6 +44,8 @@ export const Logo = () => <span>My Docs</span>;
43
44
  export const github = {
44
45
  owner: "my-org",
45
46
  repo: "my-repo",
47
+ branch: "main",
48
+ editPath: "content/docs/{path}",
46
49
  };
47
50
 
48
51
  export const nav = [
@@ -60,6 +63,13 @@ export const suggestions = [
60
63
  "How do I deploy?",
61
64
  ];
62
65
 
66
+ export const agent = {
67
+ product: {
68
+ name: "My Product",
69
+ description: "My Product helps teams build and deploy applications.",
70
+ },
71
+ };
72
+
63
73
  export const translations = {
64
74
  en: { displayName: "English" },
65
75
  };
@@ -75,6 +85,7 @@ export const siteId: string | undefined = undefined;
75
85
  ```tsx title="lib/geistdocs/config.tsx"
76
86
  import { defineConfig } from "@vercel/geistdocs/config";
77
87
  import {
88
+ agent,
78
89
  basePath,
79
90
  github,
80
91
  Logo,
@@ -88,6 +99,7 @@ import {
88
99
 
89
100
  export const config = defineConfig({
90
101
  title,
102
+ agent,
91
103
  defaultLanguage: "en",
92
104
  logo: <Logo />,
93
105
  github,
@@ -148,6 +160,33 @@ export const config = defineConfig({
148
160
  });
149
161
  ```
150
162
 
163
+ `github.editPath` controls the file path used by the "Edit this page on GitHub" action. Use `{path}` where the page path should be inserted. For monorepos, include the app directory, such as `apps/docs/content/docs/{path}`.
164
+
165
+ ## Page visibility
166
+
167
+ Use frontmatter to control whether a page appears in package-owned machine-readable surfaces:
168
+
169
+ ```mdx title="content/docs/internal-note.mdx"
170
+ ---
171
+ title: Internal note
172
+ description: Hidden from public indexes
173
+ internal: true
174
+ ---
175
+ ```
176
+
177
+ `internal: true` excludes a page from `llms.txt`, `sitemap.md`, search, and chat. `noindex: true` adds `robots: noindex` metadata and excludes the page from `sitemap.md`. Use `excludeFrom` for per-surface control:
178
+
179
+ ```mdx
180
+ ---
181
+ title: Draft guide
182
+ excludeFrom:
183
+ - chat
184
+ - search
185
+ ---
186
+ ```
187
+
188
+ Optional `tags`, `keywords`, and `canonical` frontmatter are also recognized by the package runtime.
189
+
151
190
  ## User-owned adapters
152
191
 
153
192
  Adapter files are safe to edit. Package updates do not overwrite them.
@@ -74,6 +74,7 @@ Advanced projects can use package APIs for versioned docs, multiple content sour
74
74
  - Local content in `content/docs`
75
75
  - Search and Ask AI
76
76
  - Page actions, including feedback, copy page, open in chat, and edit on GitHub
77
+ - Agent-readiness metadata with `/agents.md`
77
78
  - Raw Markdown routes for AI tools
78
79
  - `llms.txt`
79
80
  - Versioned docs and multiple content sources
@@ -4,6 +4,7 @@ description: A single file containing all your documentation in plain text for A
4
4
  type: conceptual
5
5
  summary: A single endpoint that returns all documentation as plain Markdown text following the llms.txt standard.
6
6
  related:
7
+ - /docs/agent-readiness
7
8
  - /docs/md
8
9
  - /docs/ask-ai
9
10
  - /docs/proxy
@@ -4,6 +4,7 @@ description: Access documentation pages as raw Markdown by appending .md or .mdx
4
4
  type: conceptual
5
5
  summary: Access any documentation page as raw Markdown by appending .md or .mdx to the URL for AI tool consumption.
6
6
  related:
7
+ - /docs/agent-readiness
7
8
  - /docs/llms-txt
8
9
  - /docs/proxy
9
10
  ---
@@ -64,7 +65,7 @@ import { geistdocsSource } from "@/lib/geistdocs/source";
64
65
 
65
66
  export const { GET, generateStaticParams, revalidate } =
66
67
  createDocsMarkdownRoute({
67
- source: geistdocsSource,
68
+ sources: [geistdocsSource],
68
69
  });
69
70
  ```
70
71
 
@@ -17,6 +17,7 @@
17
17
  "...",
18
18
  "---AI---",
19
19
  "open-in-chat",
20
+ "agent-readiness",
20
21
  "llms-txt",
21
22
  "ask-ai"
22
23
  ]
@@ -84,7 +84,16 @@ const proxy = createProxy({
84
84
 
85
85
  ## Markdown route mappings
86
86
 
87
- `markdownRoutes` maps public page URLs to the App Router handlers that return Markdown. The package still serves `/llms.txt` and individual page Markdown through route helpers; the proxy uses these mappings for `.md`, `.mdx`, `Accept: text/markdown`, and AI-agent requests.
87
+ Define `content` sections in `lib/geistdocs/config.tsx` to infer standard Markdown route mappings from each section route. The package still serves `/llms.txt` and individual page Markdown through route helpers; the proxy uses these mappings for `.md`, `.mdx`, `Accept: text/markdown`, and AI-agent requests.
88
+
89
+ ```tsx title="lib/geistdocs/config.tsx"
90
+ export const config = defineConfig({
91
+ // ...
92
+ content: [{ id: "docs", label: "Docs", dir: "content/docs", route: "/docs" }],
93
+ });
94
+ ```
95
+
96
+ Use `markdownRoutes` when you need to override the inferred mappings:
88
97
 
89
98
  ```ts title="proxy.ts"
90
99
  const proxy = createProxy({
@@ -22,7 +22,7 @@ The `ThemeAwareImage` component renders different images depending on whether th
22
22
  Import the component and pass a `src` object with `light` and `dark` variants:
23
23
 
24
24
  ```tsx
25
- import { ThemeAwareImage } from "@/components/geistdocs/theme-aware-image";
25
+ import { ThemeAwareImage } from "@vercel/geistdocs/components/theme-aware-image";
26
26
 
27
27
  <ThemeAwareImage
28
28
  src={{
@@ -1,3 +1,5 @@
1
+ import type { GeistdocsAgentReadinessConfig } from "@vercel/geistdocs/config";
2
+
1
3
  export const Logo = () => (
2
4
  <span className="font-semibold text-gray-1000 text-lg leading-none tracking-[-3%]">
3
5
  Geistdocs
@@ -5,6 +7,8 @@ export const Logo = () => (
5
7
  );
6
8
 
7
9
  export const github = {
10
+ branch: "main",
11
+ editPath: "content/docs/{path}",
8
12
  owner: "vercel",
9
13
  repo: "geistdocs",
10
14
  };
@@ -32,6 +36,28 @@ export const title = "Geistdocs Documentation";
32
36
  export const prompt =
33
37
  "You are a helpful assistant specializing in answering questions about Geistdocs, a modern documentation template built with Next.js and Fumadocs.";
34
38
 
39
+ export const agent = {
40
+ product: {
41
+ name: "Geistdocs",
42
+ description:
43
+ "Geistdocs is a package-backed documentation system for creating Next.js and Fumadocs sites with shared Vercel documentation patterns.",
44
+ category: "Documentation",
45
+ audience: ["Documentation authors", "Developer experience teams"],
46
+ useCases: [
47
+ "Create package-backed documentation sites",
48
+ "Expose docs as AI-readable Markdown",
49
+ "Share Vercel docs UI and runtime behavior across projects",
50
+ ],
51
+ },
52
+ links: [
53
+ {
54
+ label: "Geistdocs source",
55
+ href: `https://github.com/${github.owner}/${github.repo}`,
56
+ description: "Source repository for the Geistdocs package and template",
57
+ },
58
+ ],
59
+ } satisfies GeistdocsAgentReadinessConfig;
60
+
35
61
  export const translations = {
36
62
  en: {
37
63
  displayName: "English",
@@ -1,5 +1,6 @@
1
1
  import { defineConfig } from "@vercel/geistdocs/config";
2
2
  import {
3
+ agent,
3
4
  basePath,
4
5
  github,
5
6
  Logo,
@@ -13,6 +14,7 @@ import {
13
14
 
14
15
  export const config = defineConfig({
15
16
  title,
17
+ agent,
16
18
  defaultLanguage: "en",
17
19
  logo: <Logo />,
18
20
  github,
@@ -20,6 +22,7 @@ export const config = defineConfig({
20
22
  basePath,
21
23
  siteId,
22
24
  translations,
25
+ content: [{ id: "docs", label: "Docs", dir: "content/docs", route: "/docs" }],
23
26
  ai: {
24
27
  prompt,
25
28
  suggestions,
@@ -14,7 +14,7 @@
14
14
  "@ai-sdk/react": "^2.0.115",
15
15
  "@icons-pack/react-simple-icons": "^13.8.0",
16
16
  "@orama/tokenizers": "^3.1.16",
17
- "@vercel/geistdocs": "1.2.3-canary.a12a9c6",
17
+ "@vercel/geistdocs": "1.2.3-canary.fd2c9a6",
18
18
  "@streamdown/cjk": "^1.0.1",
19
19
  "@streamdown/code": "^1.0.1",
20
20
  "@vercel/agent-readability": "^0.2.1",
@@ -35,13 +35,13 @@
35
35
  "mermaid": "^11.12.2",
36
36
  "motion": "^12.23.25",
37
37
  "nanoid": "^5.1.6",
38
- "next": "16.0.10",
38
+ "next": "16.2.6",
39
39
  "next-themes": "^0.4.6",
40
40
  "radix-ui": "latest",
41
41
  "react": "^19.2.3",
42
42
  "react-dom": "^19.2.3",
43
43
  "react-player": "^3.4.0",
44
- "shiki": "^3.22.0",
44
+ "shiki": "3.19.0",
45
45
  "sonner": "^2.0.7",
46
46
  "streamdown": "^2.1.0",
47
47
  "tailwind-merge": "^3.4.0",
package/template/proxy.ts CHANGED
@@ -5,7 +5,6 @@ import { trackMdRequest } from "@/lib/geistdocs/md-tracking";
5
5
  const proxy = createProxy({
6
6
  config: geistdocsConfig,
7
7
  trackMarkdownRequest: trackMdRequest,
8
- markdownRoutes: [{ from: "/docs/*path", to: "/[lang]/llms.mdx/*path" }],
9
8
  before: () => null,
10
9
  });
11
10
 
@@ -157,6 +157,14 @@ export const docs = defineDocs({
157
157
  )
158
158
  .optional(),
159
159
  summary: z.string().optional(),
160
+ internal: z.boolean().optional(),
161
+ noindex: z.boolean().optional(),
162
+ tags: z.array(z.string()).optional(),
163
+ keywords: z.array(z.string()).optional(),
164
+ canonical: z.string().optional(),
165
+ excludeFrom: z
166
+ .array(z.enum(["chat", "llms", "search", "sitemap"]))
167
+ .optional(),
160
168
  }),
161
169
  postprocess: {
162
170
  includeProcessedMarkdown: true,
@@ -1,18 +0,0 @@
1
- export const emotions = [
2
- {
3
- name: "cry",
4
- emoji: "😭",
5
- },
6
- {
7
- name: "sad",
8
- emoji: "😕",
9
- },
10
- {
11
- name: "happy",
12
- emoji: "🙂",
13
- },
14
- {
15
- name: "amazed",
16
- emoji: "🤩",
17
- },
18
- ];
@@ -1,45 +0,0 @@
1
- "use server";
2
-
3
- import { headers } from "next/headers";
4
- import type { Feedback } from "@/components/geistdocs/feedback";
5
- import { siteId } from "@/geistdocs";
6
- import { emotions } from "./emotions";
7
-
8
- const protocol = process.env.NODE_ENV === "production" ? "https" : "http";
9
- const baseUrl = `${protocol}://${process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL}`;
10
-
11
- export const sendFeedback = async (
12
- url: string,
13
- feedback: Feedback
14
- ): Promise<{ success: boolean }> => {
15
- const emoji = emotions.find((e) => e.name === feedback.emotion)?.emoji;
16
- const endpoint = new URL("/feedback", "https://geistdocs.com/feedback");
17
- const headersList = await headers();
18
-
19
- const response = await fetch(endpoint, {
20
- method: "POST",
21
- headers: {
22
- "Content-Type": "application/json",
23
- },
24
- body: JSON.stringify({
25
- note: feedback.message,
26
- url: new URL(url, baseUrl).toString(),
27
- emotion: emoji,
28
- ua: headersList.get("user-agent") ?? undefined,
29
- ip: headersList.get("x-real-ip") || headersList.get("x-forwarded-for"),
30
- label: siteId,
31
- }),
32
- });
33
-
34
- if (!response.ok) {
35
- const error = await response.json();
36
-
37
- console.error(error);
38
-
39
- return { success: false };
40
- }
41
-
42
- return {
43
- success: true,
44
- };
45
- };
@@ -1,24 +0,0 @@
1
- import { AskAIButton } from "@vercel/geistdocs/controls";
2
-
3
- interface ChatProps {
4
- basePath: string | undefined;
5
- suggestions: string[];
6
- }
7
-
8
- export const Chat = ({
9
- basePath: _basePath,
10
- suggestions: _suggestions,
11
- }: ChatProps) => (
12
- <>
13
- <AskAIButton
14
- className="hidden shrink-0 shadow-none md:flex"
15
- size="sm"
16
- variant="outline"
17
- />
18
- <AskAIButton
19
- className="shadow-none md:hidden"
20
- size="sm"
21
- variant="outline"
22
- />
23
- </>
24
- );
@@ -1,52 +0,0 @@
1
- "use client";
2
-
3
- import { IconArrowUpRightSmall } from "@vercel/geistdocs/assets/icons/icon-arrow-up-right-small";
4
- import DynamicLink from "fumadocs-core/dynamic-link";
5
- import {
6
- NavigationMenu,
7
- NavigationMenuItem,
8
- NavigationMenuLink,
9
- NavigationMenuList,
10
- } from "@/components/ui/navigation-menu";
11
- import { useIsMobile } from "@/hooks/use-mobile";
12
- import { cn } from "@/lib/utils";
13
-
14
- interface DesktopMenuProps {
15
- className?: string;
16
- items: { label: string; href: string }[];
17
- }
18
-
19
- export const DesktopMenu = ({ items, className }: DesktopMenuProps) => {
20
- const isMobile = useIsMobile();
21
-
22
- return (
23
- <NavigationMenu viewport={isMobile}>
24
- <NavigationMenuList className={cn("h-14 gap-4", className)}>
25
- {items.map((item) => (
26
- <NavigationMenuItem key={item.href}>
27
- <NavigationMenuLink
28
- asChild
29
- className="flex items-center text-gray-900 text-sm transition-colors duration-100 hover:text-gray-1000"
30
- >
31
- {item.href.startsWith("http") ? (
32
- <a
33
- className="flex flex-row items-center gap-1"
34
- href={item.href}
35
- rel="noopener"
36
- target="_blank"
37
- >
38
- {item.label}
39
- <IconArrowUpRightSmall aria-hidden="true" size={12} />
40
- </a>
41
- ) : (
42
- <DynamicLink href={`/[lang]${item.href}`}>
43
- {item.label}
44
- </DynamicLink>
45
- )}
46
- </NavigationMenuLink>
47
- </NavigationMenuItem>
48
- ))}
49
- </NavigationMenuList>
50
- </NavigationMenu>
51
- );
52
- };
@@ -1,139 +0,0 @@
1
- "use client";
2
-
3
- import { SiMarkdown } from "@icons-pack/react-simple-icons";
4
- import { ThumbsUpIcon } from "lucide-react";
5
- import { usePathname } from "next/navigation";
6
- import {
7
- type FormEventHandler,
8
- useEffect,
9
- useState,
10
- useTransition,
11
- } from "react";
12
- import { sendFeedback } from "@/app/actions/feedback";
13
- import { emotions } from "@/app/actions/feedback/emotions";
14
- import { cn } from "@/lib/utils";
15
- import { Button } from "../ui/button";
16
- import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
17
- import { Textarea } from "../ui/textarea";
18
-
19
- type Emotion = (typeof emotions)[number]["name"];
20
-
21
- export interface Feedback {
22
- emotion: Emotion;
23
- message: string;
24
- url?: string;
25
- }
26
-
27
- export const Feedback = () => {
28
- const url = usePathname();
29
- const [submitted, setSubmitted] = useState(false);
30
- const [emotion, setEmotion] = useState<Emotion | null>(null);
31
- const [message, setMessage] = useState("");
32
- const [isPending, startTransition] = useTransition();
33
-
34
- useEffect(() => {
35
- const item = localStorage.getItem(`docs-feedback-${url}`);
36
-
37
- if (!item) {
38
- return;
39
- }
40
-
41
- setSubmitted(true);
42
- }, [url]);
43
-
44
- const submit: FormEventHandler<HTMLFormElement> = (e) => {
45
- e.preventDefault();
46
-
47
- if (!emotion) {
48
- return;
49
- }
50
-
51
- startTransition(() => {
52
- const feedback: Feedback = {
53
- emotion,
54
- message,
55
- };
56
-
57
- sendFeedback(url, feedback).then(() => {
58
- setSubmitted(true);
59
- setMessage("");
60
- setEmotion(null);
61
- });
62
- });
63
-
64
- e?.preventDefault();
65
- };
66
-
67
- return (
68
- <Popover>
69
- <PopoverTrigger asChild>
70
- <button
71
- className="flex items-center gap-1.5 text-gray-800 text-sm transition-colors hover:text-gray-1000"
72
- type="button"
73
- >
74
- <ThumbsUpIcon className="size-3.5" />
75
- <span>Give feedback</span>
76
- </button>
77
- </PopoverTrigger>
78
- <PopoverContent className="overflow-hidden p-0">
79
- <div className="overflow-visible">
80
- {submitted ? (
81
- <div className="flex flex-col items-center gap-3 rounded-xl bg-background-200 px-3 py-6 text-center text-sm">
82
- <p>Thank you for your feedback!</p>
83
- </div>
84
- ) : (
85
- <form className="flex flex-col" onSubmit={submit}>
86
- <div className="p-2">
87
- <Textarea
88
- autoFocus
89
- className="max-h-48 min-h-24 shadow-none"
90
- onChange={(e) => setMessage(e.target.value)}
91
- onKeyDown={(e) => {
92
- if (!e.shiftKey && e.key === "Enter") {
93
- e.currentTarget.form?.requestSubmit();
94
- }
95
- }}
96
- placeholder="Leave your feedback..."
97
- required
98
- value={message}
99
- />
100
- </div>
101
- <div className="flex items-center justify-end gap-1 px-2 text-gray-800">
102
- <SiMarkdown className="inline size-3" />
103
- <p className="text-xs"> supported</p>
104
- </div>
105
- <div className="mt-2 flex items-center justify-between border-t bg-background-200 p-2">
106
- <div className="flex items-center gap-px">
107
- {emotions.map((e) => (
108
- <Button
109
- className={cn(
110
- "text-gray-800 hover:text-gray-1000",
111
- emotion === e.name ? "bg-gray-100 text-gray-1000" : ""
112
- )}
113
- key={e.name}
114
- onClick={() => setEmotion(e.name)}
115
- size="sm"
116
- type="button"
117
- variant="ghost"
118
- >
119
- {e.emoji}
120
- <span className="sr-only">{e.name}</span>
121
- </Button>
122
- ))}
123
- </div>
124
- <Button
125
- disabled={isPending || !emotion || !message}
126
- size="sm"
127
- type="submit"
128
- variant="default"
129
- >
130
- Send
131
- </Button>
132
- </div>
133
- </form>
134
- )}
135
- </div>
136
- </PopoverContent>
137
- </Popover>
138
- );
139
- };