@vercel/geistdocs 1.2.2 → 1.2.3-canary.1d733b2

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 (384) hide show
  1. package/dist/assets/icons/icon-arrow-up-right-small.d.ts +8 -0
  2. package/dist/assets/icons/icon-arrow-up-right-small.d.ts.map +1 -0
  3. package/dist/assets/icons/icon-arrow-up-right-small.js +4 -0
  4. package/dist/assets/icons/icon-arrow-up-right.d.ts +5 -0
  5. package/dist/assets/icons/icon-arrow-up-right.d.ts.map +1 -0
  6. package/dist/assets/icons/icon-arrow-up-right.js +4 -0
  7. package/dist/assets/icons/icon-check.d.ts +5 -0
  8. package/dist/assets/icons/icon-check.d.ts.map +1 -0
  9. package/dist/assets/icons/icon-check.js +4 -0
  10. package/dist/assets/icons/icon-chevron-down-small.d.ts +8 -0
  11. package/dist/assets/icons/icon-chevron-down-small.d.ts.map +1 -0
  12. package/dist/assets/icons/icon-chevron-down-small.js +7 -0
  13. package/dist/assets/icons/icon-chevron-right.d.ts +5 -0
  14. package/dist/assets/icons/icon-chevron-right.d.ts.map +1 -0
  15. package/dist/assets/icons/icon-chevron-right.js +4 -0
  16. package/dist/assets/icons/icon-copy.d.ts +5 -0
  17. package/dist/assets/icons/icon-copy.d.ts.map +1 -0
  18. package/dist/assets/icons/icon-copy.js +4 -0
  19. package/dist/assets/icons/icon-file-text.d.ts +5 -0
  20. package/dist/assets/icons/icon-file-text.d.ts.map +1 -0
  21. package/dist/assets/icons/icon-file-text.js +4 -0
  22. package/dist/assets/icons/icon-menu-alt.d.ts +5 -0
  23. package/dist/assets/icons/icon-menu-alt.d.ts.map +1 -0
  24. package/dist/assets/icons/icon-menu-alt.js +4 -0
  25. package/dist/assets/icons/icon-slash-forward.d.ts +8 -0
  26. package/dist/assets/icons/icon-slash-forward.d.ts.map +1 -0
  27. package/dist/assets/icons/icon-slash-forward.js +4 -0
  28. package/dist/assets/icons/index.d.ts +10 -0
  29. package/dist/assets/icons/index.d.ts.map +1 -0
  30. package/dist/assets/icons/index.js +10 -0
  31. package/dist/assets/logos/index.d.ts +15 -0
  32. package/dist/assets/logos/index.d.ts.map +1 -0
  33. package/dist/assets/logos/index.js +15 -0
  34. package/dist/assets/logos/logo-ai-elements.d.ts +8 -0
  35. package/dist/assets/logos/logo-ai-elements.d.ts.map +1 -0
  36. package/dist/assets/logos/logo-ai-elements.js +8 -0
  37. package/dist/assets/logos/logo-ai-sdk.d.ts +8 -0
  38. package/dist/assets/logos/logo-ai-sdk.d.ts.map +1 -0
  39. package/dist/assets/logos/logo-ai-sdk.js +8 -0
  40. package/dist/assets/logos/logo-chat-sdk.d.ts +8 -0
  41. package/dist/assets/logos/logo-chat-sdk.d.ts.map +1 -0
  42. package/dist/assets/logos/logo-chat-sdk.js +8 -0
  43. package/dist/assets/logos/logo-flags-sdk.d.ts +8 -0
  44. package/dist/assets/logos/logo-flags-sdk.d.ts.map +1 -0
  45. package/dist/assets/logos/logo-flags-sdk.js +8 -0
  46. package/dist/assets/logos/logo-icon-vercel.d.ts +9 -0
  47. package/dist/assets/logos/logo-icon-vercel.d.ts.map +1 -0
  48. package/dist/assets/logos/logo-icon-vercel.js +8 -0
  49. package/dist/assets/logos/logo-nextjs.d.ts +8 -0
  50. package/dist/assets/logos/logo-nextjs.d.ts.map +1 -0
  51. package/dist/assets/logos/logo-nextjs.js +7 -0
  52. package/dist/assets/logos/logo-streamdown.d.ts +8 -0
  53. package/dist/assets/logos/logo-streamdown.d.ts.map +1 -0
  54. package/dist/assets/logos/logo-streamdown.js +8 -0
  55. package/dist/assets/logos/logo-svelte-kit.d.ts +8 -0
  56. package/dist/assets/logos/logo-svelte-kit.d.ts.map +1 -0
  57. package/dist/assets/logos/logo-svelte-kit.js +7 -0
  58. package/dist/assets/logos/logo-vercel-oss.d.ts +8 -0
  59. package/dist/assets/logos/logo-vercel-oss.d.ts.map +1 -0
  60. package/dist/assets/logos/logo-vercel-oss.js +7 -0
  61. package/dist/assets/logos/logo-workflow-sdk.d.ts +8 -0
  62. package/dist/assets/logos/logo-workflow-sdk.d.ts.map +1 -0
  63. package/dist/assets/logos/logo-workflow-sdk.js +8 -0
  64. package/dist/cli/index.js +3 -0
  65. package/dist/components/callout.d.ts +12 -0
  66. package/dist/components/callout.d.ts.map +1 -0
  67. package/dist/components/callout.js +7 -0
  68. package/dist/components/code-block-tabs.d.ts +7 -0
  69. package/dist/components/code-block-tabs.d.ts.map +1 -0
  70. package/dist/components/code-block-tabs.js +7 -0
  71. package/dist/components/code-block.d.ts +14 -0
  72. package/dist/components/code-block.d.ts.map +1 -0
  73. package/dist/components/code-block.js +45 -0
  74. package/dist/components/copy-prompt.d.ts +11 -0
  75. package/dist/components/copy-prompt.d.ts.map +1 -0
  76. package/dist/components/copy-prompt.js +58 -0
  77. package/dist/components/mermaid.d.ts +4 -0
  78. package/dist/components/mermaid.d.ts.map +1 -0
  79. package/dist/components/mermaid.js +44 -0
  80. package/dist/components/theme-aware-image.d.ts +12 -0
  81. package/dist/components/theme-aware-image.d.ts.map +1 -0
  82. package/dist/components/theme-aware-image.js +8 -0
  83. package/dist/components/video.d.ts +6 -0
  84. package/dist/components/video.d.ts.map +1 -0
  85. package/dist/components/video.js +3 -0
  86. package/dist/config.d.ts +117 -0
  87. package/dist/config.d.ts.map +1 -0
  88. package/dist/config.js +1 -0
  89. package/dist/controls.d.ts +15 -0
  90. package/dist/controls.d.ts.map +1 -0
  91. package/dist/controls.js +52 -0
  92. package/dist/footer.d.ts +8 -0
  93. package/dist/footer.d.ts.map +1 -0
  94. package/dist/footer.js +6 -0
  95. package/dist/home-layout.d.ts +11 -0
  96. package/dist/home-layout.d.ts.map +1 -0
  97. package/dist/home-layout.js +31 -0
  98. package/dist/internal/chat/context.d.ts +19 -0
  99. package/dist/internal/chat/context.d.ts.map +1 -0
  100. package/dist/internal/chat/context.js +36 -0
  101. package/dist/internal/chat/conversation.d.ts +10 -0
  102. package/dist/internal/chat/conversation.d.ts.map +1 -0
  103. package/dist/internal/chat/conversation.js +16 -0
  104. package/dist/internal/chat/copy-chat.d.ts +5 -0
  105. package/dist/internal/chat/copy-chat.d.ts.map +1 -0
  106. package/dist/internal/chat/copy-chat.js +35 -0
  107. package/dist/internal/chat/db.d.ts +13 -0
  108. package/dist/internal/chat/db.d.ts.map +1 -0
  109. package/dist/internal/chat/db.js +19 -0
  110. package/dist/internal/chat/message-metadata.d.ts +8 -0
  111. package/dist/internal/chat/message-metadata.d.ts.map +1 -0
  112. package/dist/internal/chat/message-metadata.js +29 -0
  113. package/dist/internal/chat/message.d.ts +11 -0
  114. package/dist/internal/chat/message.d.ts.map +1 -0
  115. package/dist/internal/chat/message.js +11 -0
  116. package/dist/internal/chat/prompt-input.d.ts +13 -0
  117. package/dist/internal/chat/prompt-input.d.ts.map +1 -0
  118. package/dist/internal/chat/prompt-input.js +39 -0
  119. package/dist/internal/chat/shell.d.ts +2 -0
  120. package/dist/internal/chat/shell.d.ts.map +1 -0
  121. package/dist/internal/chat/shell.js +194 -0
  122. package/dist/internal/chat/shimmer.d.ts +11 -0
  123. package/dist/internal/chat/shimmer.d.ts.map +1 -0
  124. package/dist/internal/chat/shimmer.js +18 -0
  125. package/dist/internal/chat/sources.d.ts +13 -0
  126. package/dist/internal/chat/sources.d.ts.map +1 -0
  127. package/dist/internal/chat/sources.js +9 -0
  128. package/dist/internal/chat/suggestion.d.ts +11 -0
  129. package/dist/internal/chat/suggestion.d.ts.map +1 -0
  130. package/dist/internal/chat/suggestion.js +12 -0
  131. package/dist/internal/cn.d.ts +3 -0
  132. package/dist/internal/cn.d.ts.map +1 -0
  133. package/dist/internal/cn.js +3 -0
  134. package/dist/internal/config-context.d.ts +10 -0
  135. package/dist/internal/config-context.d.ts.map +1 -0
  136. package/dist/internal/config-context.js +15 -0
  137. package/dist/internal/feedback-action.d.ts +14 -0
  138. package/dist/internal/feedback-action.d.ts.map +1 -0
  139. package/dist/internal/feedback-action.js +34 -0
  140. package/dist/internal/footer/github-button.d.ts +7 -0
  141. package/dist/internal/footer/github-button.d.ts.map +1 -0
  142. package/dist/internal/footer/github-button.js +10 -0
  143. package/dist/internal/footer/rss-button.d.ts +2 -0
  144. package/dist/internal/footer/rss-button.d.ts.map +1 -0
  145. package/dist/internal/footer/rss-button.js +4 -0
  146. package/dist/internal/i18n.d.ts +6 -0
  147. package/dist/internal/i18n.d.ts.map +1 -0
  148. package/dist/internal/i18n.js +18 -0
  149. package/dist/internal/languages.d.ts +7 -0
  150. package/dist/internal/languages.d.ts.map +1 -0
  151. package/dist/internal/languages.js +18 -0
  152. package/dist/internal/localized-link.d.ts +8 -0
  153. package/dist/internal/localized-link.d.ts.map +1 -0
  154. package/dist/internal/localized-link.js +13 -0
  155. package/dist/internal/navbar/desktop-menu.d.ts +10 -0
  156. package/dist/internal/navbar/desktop-menu.d.ts.map +1 -0
  157. package/dist/internal/navbar/desktop-menu.js +11 -0
  158. package/dist/internal/navbar/mobile-menu.d.ts +7 -0
  159. package/dist/internal/navbar/mobile-menu.d.ts.map +1 -0
  160. package/dist/internal/navbar/mobile-menu.js +44 -0
  161. package/dist/internal/navbar/navbar-logo.d.ts +16 -0
  162. package/dist/internal/navbar/navbar-logo.d.ts.map +1 -0
  163. package/dist/internal/navbar/navbar-logo.js +30 -0
  164. package/dist/internal/not-implemented.d.ts +2 -0
  165. package/dist/internal/not-implemented.d.ts.map +1 -0
  166. package/dist/internal/not-implemented.js +4 -0
  167. package/dist/internal/page-actions-client.d.ts +13 -0
  168. package/dist/internal/page-actions-client.d.ts.map +1 -0
  169. package/dist/internal/page-actions-client.js +171 -0
  170. package/dist/internal/page-actions.d.ts +18 -0
  171. package/dist/internal/page-actions.d.ts.map +1 -0
  172. package/dist/internal/page-actions.js +4 -0
  173. package/dist/internal/page-visibility.d.ts +18 -0
  174. package/dist/internal/page-visibility.d.ts.map +1 -0
  175. package/dist/internal/page-visibility.js +24 -0
  176. package/dist/internal/provider-client.d.ts +9 -0
  177. package/dist/internal/provider-client.d.ts.map +1 -0
  178. package/dist/internal/provider-client.js +24 -0
  179. package/dist/internal/search.d.ts +5 -0
  180. package/dist/internal/search.d.ts.map +1 -0
  181. package/dist/internal/search.js +14 -0
  182. package/dist/internal/sidebar.d.ts +9 -0
  183. package/dist/internal/sidebar.d.ts.map +1 -0
  184. package/dist/internal/sidebar.js +38 -0
  185. package/dist/internal/table-of-contents.d.ts +9 -0
  186. package/dist/internal/table-of-contents.d.ts.map +1 -0
  187. package/dist/internal/table-of-contents.js +5 -0
  188. package/dist/internal/ui/button-group.d.ts +13 -0
  189. package/dist/internal/ui/button-group.d.ts.map +1 -0
  190. package/dist/internal/ui/button-group.js +26 -0
  191. package/dist/internal/ui/button.d.ts +12 -0
  192. package/dist/internal/ui/button.d.ts.map +1 -0
  193. package/dist/internal/ui/button.js +33 -0
  194. package/dist/internal/ui/card.d.ts +6 -0
  195. package/dist/internal/ui/card.d.ts.map +1 -0
  196. package/dist/internal/ui/card.js +14 -0
  197. package/dist/internal/ui/collapsible.d.ts +6 -0
  198. package/dist/internal/ui/collapsible.d.ts.map +1 -0
  199. package/dist/internal/ui/collapsible.js +12 -0
  200. package/dist/internal/ui/drawer.d.ts +6 -0
  201. package/dist/internal/ui/drawer.d.ts.map +1 -0
  202. package/dist/internal/ui/drawer.js +13 -0
  203. package/dist/internal/ui/dropdown-menu.d.ts +22 -0
  204. package/dist/internal/ui/dropdown-menu.d.ts.map +1 -0
  205. package/dist/internal/ui/dropdown-menu.js +41 -0
  206. package/dist/internal/ui/input-group.d.ts +15 -0
  207. package/dist/internal/ui/input-group.d.ts.map +1 -0
  208. package/dist/internal/ui/input-group.js +44 -0
  209. package/dist/internal/ui/input.d.ts +3 -0
  210. package/dist/internal/ui/input.d.ts.map +1 -0
  211. package/dist/internal/ui/input.js +5 -0
  212. package/dist/internal/ui/kbd.d.ts +4 -0
  213. package/dist/internal/ui/kbd.d.ts.map +1 -0
  214. package/dist/internal/ui/kbd.js +8 -0
  215. package/dist/internal/ui/navigation-menu.d.ts +17 -0
  216. package/dist/internal/ui/navigation-menu.d.ts.map +1 -0
  217. package/dist/internal/ui/navigation-menu.js +38 -0
  218. package/dist/internal/ui/popover.d.ts +6 -0
  219. package/dist/internal/ui/popover.d.ts.map +1 -0
  220. package/dist/internal/ui/popover.js +13 -0
  221. package/dist/internal/ui/scroll-area.d.ts +5 -0
  222. package/dist/internal/ui/scroll-area.d.ts.map +1 -0
  223. package/dist/internal/ui/scroll-area.js +12 -0
  224. package/dist/internal/ui/separator.d.ts +4 -0
  225. package/dist/internal/ui/separator.d.ts.map +1 -0
  226. package/dist/internal/ui/separator.js +7 -0
  227. package/dist/internal/ui/sheet.d.ts +10 -0
  228. package/dist/internal/ui/sheet.d.ts.map +1 -0
  229. package/dist/internal/ui/sheet.js +24 -0
  230. package/dist/internal/ui/sonner.d.ts +3 -0
  231. package/dist/internal/ui/sonner.d.ts.map +1 -0
  232. package/dist/internal/ui/sonner.js +20 -0
  233. package/dist/internal/ui/spinner.d.ts +3 -0
  234. package/dist/internal/ui/spinner.d.ts.map +1 -0
  235. package/dist/internal/ui/spinner.js +6 -0
  236. package/dist/internal/ui/textarea.d.ts +3 -0
  237. package/dist/internal/ui/textarea.d.ts.map +1 -0
  238. package/dist/internal/ui/textarea.js +5 -0
  239. package/dist/internal/ui/tooltip.d.ts +7 -0
  240. package/dist/internal/ui/tooltip.d.ts.map +1 -0
  241. package/dist/internal/ui/tooltip.js +16 -0
  242. package/dist/internal/use-mobile.d.ts +2 -0
  243. package/dist/internal/use-mobile.d.ts.map +1 -0
  244. package/dist/internal/use-mobile.js +16 -0
  245. package/dist/layout.d.ts +14 -0
  246. package/dist/layout.d.ts.map +1 -0
  247. package/dist/layout.js +31 -0
  248. package/dist/mdx.d.ts +67 -0
  249. package/dist/mdx.d.ts.map +1 -0
  250. package/dist/mdx.js +35 -0
  251. package/dist/mobile-docs-bar.d.ts +7 -0
  252. package/dist/mobile-docs-bar.d.ts.map +1 -0
  253. package/dist/mobile-docs-bar.js +13 -0
  254. package/dist/navbar.d.ts +7 -0
  255. package/dist/navbar.d.ts.map +1 -0
  256. package/dist/navbar.js +10 -0
  257. package/dist/pages/docs.d.ts +83 -0
  258. package/dist/pages/docs.d.ts.map +1 -0
  259. package/dist/pages/docs.js +98 -0
  260. package/dist/proxy.d.ts +37 -0
  261. package/dist/proxy.d.ts.map +1 -0
  262. package/dist/proxy.js +189 -0
  263. package/dist/routes/agents.d.ts +21 -0
  264. package/dist/routes/agents.d.ts.map +1 -0
  265. package/dist/routes/agents.js +201 -0
  266. package/dist/routes/chat.d.ts +14 -0
  267. package/dist/routes/chat.d.ts.map +1 -0
  268. package/dist/routes/chat.js +251 -0
  269. package/dist/routes/llms.d.ts +52 -0
  270. package/dist/routes/llms.d.ts.map +1 -0
  271. package/dist/routes/llms.js +110 -0
  272. package/dist/routes/search.d.ts +13 -0
  273. package/dist/routes/search.d.ts.map +1 -0
  274. package/dist/routes/search.js +81 -0
  275. package/dist/routes/sitemap.d.ts +47 -0
  276. package/dist/routes/sitemap.d.ts.map +1 -0
  277. package/dist/routes/sitemap.js +176 -0
  278. package/dist/shiki-theme.d.ts +20 -0
  279. package/dist/shiki-theme.d.ts.map +1 -0
  280. package/dist/shiki-theme.js +110 -0
  281. package/dist/sidebar.d.ts +11 -0
  282. package/dist/sidebar.d.ts.map +1 -0
  283. package/dist/sidebar.js +16 -0
  284. package/dist/source-config.d.ts +68 -0
  285. package/dist/source-config.d.ts.map +1 -0
  286. package/dist/source-config.js +161 -0
  287. package/dist/source.d.ts +181 -0
  288. package/dist/source.d.ts.map +1 -0
  289. package/dist/source.js +142 -0
  290. package/dist/versions.d.ts +45 -0
  291. package/dist/versions.d.ts.map +1 -0
  292. package/dist/versions.js +79 -0
  293. package/package.json +186 -9
  294. package/source-config.js +174 -0
  295. package/styles.css +556 -0
  296. package/template/AGENTS.md +82 -0
  297. package/template/_gitignore +29 -0
  298. package/template/app/[lang]/(home)/components/centered-section.tsx +24 -0
  299. package/template/app/[lang]/(home)/components/cta.tsx +19 -0
  300. package/template/app/[lang]/(home)/components/hero.tsx +27 -0
  301. package/template/app/[lang]/(home)/components/one-two-section.tsx +23 -0
  302. package/template/app/[lang]/(home)/components/templates.tsx +48 -0
  303. package/template/app/[lang]/(home)/components/text-grid-section.tsx +20 -0
  304. package/template/app/[lang]/(home)/layout.tsx +15 -0
  305. package/template/app/[lang]/(home)/page.tsx +126 -0
  306. package/template/app/[lang]/agents.md/route.ts +6 -0
  307. package/template/app/[lang]/docs/[[...slug]]/page.tsx +22 -0
  308. package/template/app/[lang]/docs/layout.tsx +14 -0
  309. package/template/app/[lang]/layout.tsx +29 -0
  310. package/template/app/[lang]/llms.mdx/[[...slug]]/route.ts +7 -0
  311. package/template/app/[lang]/llms.txt/route.ts +6 -0
  312. package/template/app/[lang]/og/[...slug]/background.png +0 -0
  313. package/template/app/[lang]/og/[...slug]/geist-sans-regular.ttf +0 -0
  314. package/template/app/[lang]/og/[...slug]/geist-sans-semibold.ttf +0 -0
  315. package/template/app/[lang]/og/[...slug]/route.tsx +95 -0
  316. package/template/app/[lang]/rss.xml/route.ts +52 -0
  317. package/template/app/[lang]/sitemap.md/route.ts +9 -0
  318. package/template/app/api/chat/route.ts +8 -0
  319. package/template/app/api/search/route.ts +5 -0
  320. package/template/app/favicon.ico +0 -0
  321. package/template/app/global.css +2 -0
  322. package/template/app/robots.ts +14 -0
  323. package/template/app/sitemap.ts +36 -0
  324. package/template/app/styles/geistdocs.css +595 -0
  325. package/template/components/geistdocs/docs-layout.tsx +20 -0
  326. package/template/components/geistdocs/mdx-components.tsx +5 -0
  327. package/template/components/geistdocs/provider.tsx +31 -0
  328. package/template/components/ui/badge.tsx +46 -0
  329. package/template/components/ui/button.tsx +60 -0
  330. package/template/components/ui/command-prompt.tsx +488 -0
  331. package/template/components.json +22 -0
  332. package/template/content/docs/agent-readiness.mdx +103 -0
  333. package/template/content/docs/ask-ai.cn.mdx +85 -0
  334. package/template/content/docs/ask-ai.mdx +89 -0
  335. package/template/content/docs/configuration.cn.mdx +155 -0
  336. package/template/content/docs/configuration.mdx +275 -0
  337. package/template/content/docs/deployment.cn.mdx +34 -0
  338. package/template/content/docs/deployment.mdx +40 -0
  339. package/template/content/docs/edit-on-github.cn.mdx +47 -0
  340. package/template/content/docs/edit-on-github.mdx +51 -0
  341. package/template/content/docs/env.cn.mdx +25 -0
  342. package/template/content/docs/env.mdx +29 -0
  343. package/template/content/docs/feedback.cn.mdx +85 -0
  344. package/template/content/docs/feedback.mdx +89 -0
  345. package/template/content/docs/getting-started.cn.mdx +86 -0
  346. package/template/content/docs/getting-started.mdx +108 -0
  347. package/template/content/docs/index.cn.mdx +57 -0
  348. package/template/content/docs/index.mdx +95 -0
  349. package/template/content/docs/internationalization.cn.mdx +111 -0
  350. package/template/content/docs/internationalization.mdx +122 -0
  351. package/template/content/docs/llms-txt.cn.mdx +72 -0
  352. package/template/content/docs/llms-txt.mdx +86 -0
  353. package/template/content/docs/md.cn.mdx +65 -0
  354. package/template/content/docs/md.mdx +82 -0
  355. package/template/content/docs/meta.json +25 -0
  356. package/template/content/docs/migration.mdx +321 -0
  357. package/template/content/docs/open-in-chat.cn.mdx +78 -0
  358. package/template/content/docs/open-in-chat.mdx +80 -0
  359. package/template/content/docs/provider.cn.mdx +70 -0
  360. package/template/content/docs/provider.mdx +74 -0
  361. package/template/content/docs/proxy.cn.mdx +96 -0
  362. package/template/content/docs/proxy.mdx +178 -0
  363. package/template/content/docs/rss.cn.mdx +104 -0
  364. package/template/content/docs/rss.mdx +108 -0
  365. package/template/content/docs/syntax.cn.mdx +416 -0
  366. package/template/content/docs/syntax.mdx +411 -0
  367. package/template/content/docs/theme-aware-image.mdx +57 -0
  368. package/template/content/docs/versioned-docs.cn.mdx +117 -0
  369. package/template/content/docs/versioned-docs.mdx +228 -0
  370. package/template/geistdocs.tsx +77 -0
  371. package/template/lib/geistdocs/config.tsx +30 -0
  372. package/template/lib/geistdocs/fonts.ts +18 -0
  373. package/template/lib/geistdocs/i18n.ts +13 -0
  374. package/template/lib/geistdocs/md-tracking.ts +56 -0
  375. package/template/lib/geistdocs/source.ts +12 -0
  376. package/template/lib/utils.ts +6 -0
  377. package/template/next.config.ts +22 -0
  378. package/template/package.json +63 -0
  379. package/template/postcss.config.mjs +5 -0
  380. package/template/proxy.ts +17 -0
  381. package/template/source.config.ts +23 -0
  382. package/template/tsconfig.json +37 -0
  383. package/dist/index.js +0 -2
  384. /package/dist/{index.d.ts → cli/index.d.ts} +0 -0
@@ -0,0 +1,228 @@
1
+ ---
2
+ title: Versioned docs
3
+ description: Configure multiple documentation versions with package-backed source helpers
4
+ type: guide
5
+ summary: Use createVersionedSources to configure stable, pre-release, or host-based documentation versions.
6
+ prerequisites:
7
+ - /docs/configuration
8
+ related:
9
+ - /docs/proxy
10
+ - /docs/llms-txt
11
+ ---
12
+
13
+ Versioned docs let you serve multiple documentation sets from one Geistdocs project. Use them for stable and pre-release docs, previous major versions, or host-based version switching.
14
+
15
+ <CopyPrompt text="Help me add versioned docs to this Geistdocs site. Inspect source.config.ts, lib/geistdocs/source.ts, app route files, and the docs layout, then propose a versioned source setup using createVersionedSources.">
16
+ Help me add versioned docs to this Geistdocs site. Inspect `source.config.ts`, `lib/geistdocs/source.ts`, app route files, and the docs layout, then propose a versioned source setup using `createVersionedSources`.
17
+ </CopyPrompt>
18
+
19
+ ## Configure source collections
20
+
21
+ Create one Fumadocs collection for each version in `source.config.ts`:
22
+
23
+ ```ts title="source.config.ts"
24
+ import {
25
+ defineGeistdocsSourceConfig,
26
+ geistdocsFrontmatterSchema,
27
+ } from "@vercel/geistdocs/source-config";
28
+ import { defineDocs } from "fumadocs-mdx/config";
29
+
30
+ export const v4docs = defineDocs({
31
+ dir: "content/docs/v4",
32
+ docs: {
33
+ schema: geistdocsFrontmatterSchema,
34
+ postprocess: {
35
+ includeProcessedMarkdown: true,
36
+ },
37
+ },
38
+ });
39
+
40
+ export const v5docs = defineDocs({
41
+ dir: "content/docs/v5",
42
+ docs: {
43
+ schema: geistdocsFrontmatterSchema,
44
+ postprocess: {
45
+ includeProcessedMarkdown: true,
46
+ },
47
+ },
48
+ });
49
+
50
+ export default defineGeistdocsSourceConfig();
51
+ ```
52
+
53
+ ## Create versioned sources
54
+
55
+ Use `createVersionedSources` in `lib/geistdocs/source.ts`:
56
+
57
+ ```ts title="lib/geistdocs/source.ts"
58
+ import { createVersionedSources } from "@vercel/geistdocs/source";
59
+ import { v4docs, v5docs } from "@/.source/server";
60
+ import { config } from "./config";
61
+
62
+ export const versions = createVersionedSources({
63
+ config,
64
+ current: "v4",
65
+ versions: [
66
+ {
67
+ id: "v4",
68
+ label: "v4",
69
+ docs: v4docs,
70
+ baseUrl: "/docs",
71
+ },
72
+ {
73
+ id: "v5",
74
+ label: "v5 pre-release",
75
+ docs: v5docs,
76
+ baseUrl: "/docs",
77
+ routePrefix: "/v5",
78
+ },
79
+ ],
80
+ });
81
+
82
+ export const geistdocsSource = versions.current;
83
+ export const source = geistdocsSource.source;
84
+ ```
85
+
86
+ The returned object includes:
87
+
88
+ | Property | Type | Description |
89
+ | --- | --- | --- |
90
+ | `current` | `GeistdocsSourceBundle` | The source matching the `current` version ID. |
91
+ | `byId` | `Record<string, GeistdocsSourceBundle>` | A map of version IDs to source bundles. |
92
+ | `all` | `Array` | Version metadata and source bundles for rendering UI. |
93
+ | `currentVersion` | `string` | The active version ID. |
94
+
95
+ ## Render versioned pages
96
+
97
+ Use the current version for `/docs` and a specific version for version-prefixed routes:
98
+
99
+ ```tsx title="app/[lang]/docs/[[...slug]]/page.tsx"
100
+ import { createDocsPage } from "@vercel/geistdocs/pages/docs";
101
+ import { config } from "@/lib/geistdocs/config";
102
+ import { versions } from "@/lib/geistdocs/source";
103
+
104
+ const docsPage = createDocsPage({
105
+ config,
106
+ source: versions.current,
107
+ });
108
+
109
+ export default docsPage.Page;
110
+ export const generateStaticParams = docsPage.generateStaticParams;
111
+ export const generateMetadata = docsPage.generateMetadata;
112
+ ```
113
+
114
+ ```tsx title="app/[lang]/v5/docs/[[...slug]]/page.tsx"
115
+ import { createDocsPage } from "@vercel/geistdocs/pages/docs";
116
+ import { config } from "@/lib/geistdocs/config";
117
+ import { versions } from "@/lib/geistdocs/source";
118
+
119
+ const docsPage = createDocsPage({
120
+ config,
121
+ source: versions.byId.v5,
122
+ getPageUrl: ({ page }) => `/v5${page.url}`,
123
+ metadata: ({ metadata }) => ({
124
+ ...metadata,
125
+ robots: {
126
+ index: false,
127
+ follow: true,
128
+ },
129
+ }),
130
+ });
131
+
132
+ export default docsPage.Page;
133
+ export const generateStaticParams = docsPage.generateStaticParams;
134
+ export const generateMetadata = docsPage.generateMetadata;
135
+ ```
136
+
137
+ Use `getPageUrl` when the route path differs from the source `baseUrl`. This keeps page actions and markdown links pointed at the public URL.
138
+
139
+ ## Add a version selector
140
+
141
+ Use `GeistdocsVersionSelect` when readers need to move between versions:
142
+
143
+ ```tsx title="components/geistdocs/docs-layout.tsx"
144
+ import { GeistdocsDocsLayout } from "@vercel/geistdocs/layout";
145
+ import { GeistdocsVersionSelect } from "@vercel/geistdocs/versions";
146
+ import { config } from "@/lib/geistdocs/config";
147
+
148
+ export const DocsLayout = ({ tree, children }: DocsLayoutProps) => (
149
+ <GeistdocsDocsLayout
150
+ config={config}
151
+ sidebarTop={
152
+ <GeistdocsVersionSelect
153
+ current="v4"
154
+ versions={[
155
+ { id: "v4", label: "v4" },
156
+ { id: "v5", label: "v5 pre-release", routePrefix: "/v5" },
157
+ ]}
158
+ />
159
+ }
160
+ tree={tree}
161
+ >
162
+ {children}
163
+ </GeistdocsDocsLayout>
164
+ );
165
+ ```
166
+
167
+ Each version can define an `icon` to override the default current/previous version icons:
168
+
169
+ ```tsx
170
+ <GeistdocsVersionSelect
171
+ current="v6"
172
+ versions={[
173
+ { id: "v6", label: "v6 latest", icon: <span>6</span> },
174
+ { id: "v5", label: "v5", icon: <span>5</span>, routePrefix: "/v5" },
175
+ ]}
176
+ />
177
+ ```
178
+
179
+ Use `GeistdocsRouteSelect` for framework, product, or route switchers that should not use version-specific labels:
180
+
181
+ ```tsx
182
+ import { LogoNextjs, LogoSvelteKit } from "@vercel/geistdocs/assets/logos";
183
+ import { GeistdocsRouteSelect } from "@vercel/geistdocs/versions";
184
+
185
+ <GeistdocsRouteSelect
186
+ ariaLabel="Select framework"
187
+ current="nextjs"
188
+ items={[
189
+ {
190
+ id: "nextjs",
191
+ label: "Next.js",
192
+ description: "React framework",
193
+ icon: <LogoNextjs height={18} />,
194
+ href: "/:path*",
195
+ },
196
+ {
197
+ id: "sveltekit",
198
+ label: "SvelteKit",
199
+ description: "Svelte framework",
200
+ icon: <LogoSvelteKit height={18} />,
201
+ routePrefix: "/sveltekit",
202
+ href: "/sveltekit/:path*",
203
+ },
204
+ ]}
205
+ />
206
+ ```
207
+
208
+ For host-based versions, use `href` instead of `routePrefix`:
209
+
210
+ ```tsx
211
+ <GeistdocsVersionSelect
212
+ current="v6"
213
+ versions={[
214
+ { id: "v6", label: "v6 latest" },
215
+ { id: "v5", label: "v5", href: "https://v5.example.com/:path*" },
216
+ { id: "v4", label: "v4", href: "https://v4.example.com/:path*" },
217
+ ]}
218
+ />
219
+ ```
220
+
221
+ ## Configure markdown routes
222
+
223
+ Each public route family needs a matching markdown route in `proxy.ts`. Read [Proxy and markdown routes](/docs/proxy) for the proxy configuration.
224
+
225
+ ## Next steps
226
+
227
+ - Read [Proxy and markdown routes](/docs/proxy) to connect versioned pages to `.md`, `.mdx`, and AI-agent rewrites.
228
+ - Read [llms.txt](/docs/llms-txt) to configure all-docs markdown output for multiple sources.
@@ -0,0 +1,77 @@
1
+ import type { GeistdocsAgentReadinessConfig } from "@vercel/geistdocs/config";
2
+
3
+ export const Logo = () => (
4
+ <span className="font-semibold text-gray-1000 text-lg leading-none tracking-[-3%]">
5
+ Geistdocs
6
+ </span>
7
+ );
8
+
9
+ export const github = {
10
+ branch: "main",
11
+ editPath: "content/docs/{path}",
12
+ owner: "vercel",
13
+ repo: "geistdocs",
14
+ };
15
+
16
+ export const nav = [
17
+ {
18
+ label: "Docs",
19
+ href: "/docs",
20
+ },
21
+ {
22
+ label: "Source",
23
+ href: `https://github.com/${github.owner}/${github.repo}/`,
24
+ },
25
+ ];
26
+
27
+ export const suggestions = [
28
+ "What is Geistdocs?",
29
+ "What can I make with Geistdocs?",
30
+ "What syntax does Geistdocs support?",
31
+ "How do I deploy my Geistdocs site?",
32
+ ];
33
+
34
+ export const title = "Geistdocs Documentation";
35
+
36
+ export const prompt =
37
+ "You are a helpful assistant specializing in answering questions about Geistdocs, a modern documentation template built with Next.js and Fumadocs.";
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
+
61
+ export const translations = {
62
+ en: {
63
+ displayName: "English",
64
+ },
65
+ cn: {
66
+ displayName: "Chinese",
67
+ search: "搜尋文檔",
68
+ },
69
+ };
70
+
71
+ export const basePath: string | undefined = undefined;
72
+
73
+ /**
74
+ * Unique identifier for this site, used in markdown request tracking analytics.
75
+ * Each site using geistdocs should set this to a unique value (e.g. "ai-sdk-docs", "next-docs").
76
+ */
77
+ export const siteId: string | undefined = undefined;
@@ -0,0 +1,30 @@
1
+ import { defineConfig } from "@vercel/geistdocs/config";
2
+ import {
3
+ agent,
4
+ basePath,
5
+ github,
6
+ Logo,
7
+ nav,
8
+ prompt,
9
+ siteId,
10
+ suggestions,
11
+ title,
12
+ translations,
13
+ } from "@/geistdocs";
14
+
15
+ export const config = defineConfig({
16
+ title,
17
+ agent,
18
+ defaultLanguage: "en",
19
+ logo: <Logo />,
20
+ github,
21
+ nav,
22
+ basePath,
23
+ siteId,
24
+ translations,
25
+ content: [{ id: "docs", label: "Docs", dir: "content/docs", route: "/docs" }],
26
+ ai: {
27
+ prompt,
28
+ suggestions,
29
+ },
30
+ });
@@ -0,0 +1,18 @@
1
+ import {
2
+ Geist_Mono as createMono,
3
+ Geist as createSans,
4
+ } from "next/font/google";
5
+
6
+ export const sans = createSans({
7
+ variable: "--font-sans",
8
+ subsets: ["latin"],
9
+ weight: "variable",
10
+ display: "swap",
11
+ });
12
+
13
+ export const mono = createMono({
14
+ variable: "--font-mono",
15
+ subsets: ["latin"],
16
+ weight: "variable",
17
+ display: "swap",
18
+ });
@@ -0,0 +1,13 @@
1
+ import { defineI18n } from "fumadocs-core/i18n";
2
+ import { defineI18nUI } from "fumadocs-ui/i18n";
3
+ import { translations } from "@/geistdocs";
4
+
5
+ export const i18n = defineI18n({
6
+ defaultLanguage: "en",
7
+ languages: Object.keys(translations),
8
+ hideLocale: "default-locale",
9
+ });
10
+
11
+ export const { provider: i18nProvider } = defineI18nUI(i18n, {
12
+ translations,
13
+ });
@@ -0,0 +1,56 @@
1
+ import type { DetectionMethod } from "@vercel/agent-readability";
2
+ import { siteId } from "@/geistdocs";
3
+
4
+ const PLATFORM_URL = "https://geistdocs.com/md-tracking";
5
+
6
+ interface TrackMdRequestParams {
7
+ acceptHeader: string | null;
8
+ /** Detection method used to identify the agent (only for agent-rewrite requests) */
9
+ detectionMethod?: DetectionMethod | null;
10
+ path: string;
11
+ referer: string | null;
12
+ /** How the markdown was requested: 'md-url' for direct .md URLs, 'header-negotiated' for Accept header, 'agent-rewrite' for detected AI agents */
13
+ requestType?: "md-url" | "header-negotiated" | "agent-rewrite";
14
+ userAgent: string | null;
15
+ }
16
+
17
+ /**
18
+ * Track a markdown page request via the geistdocs platform.
19
+ * Fire-and-forget: errors are logged but don't affect the response.
20
+ */
21
+ export async function trackMdRequest({
22
+ path,
23
+ userAgent,
24
+ referer,
25
+ acceptHeader,
26
+ requestType,
27
+ detectionMethod,
28
+ }: TrackMdRequestParams): Promise<void> {
29
+ try {
30
+ const response = await fetch(PLATFORM_URL, {
31
+ method: "POST",
32
+ headers: {
33
+ "Content-Type": "application/json",
34
+ },
35
+ body: JSON.stringify({
36
+ path,
37
+ siteId: siteId ?? "geistdocs-unknown",
38
+ userAgent,
39
+ referer,
40
+ acceptHeader,
41
+ requestType,
42
+ detectionMethod,
43
+ }),
44
+ });
45
+
46
+ if (!response.ok) {
47
+ console.error(
48
+ "MD tracking failed:",
49
+ response.status,
50
+ await response.text()
51
+ );
52
+ }
53
+ } catch (error) {
54
+ console.error("MD tracking error:", error);
55
+ }
56
+ }
@@ -0,0 +1,12 @@
1
+ import { createSource } from "@vercel/geistdocs/source";
2
+ import { docs } from "@/.source/server";
3
+ import { config } from "./config";
4
+
5
+ export const geistdocsSource = createSource({
6
+ docs,
7
+ config,
8
+ });
9
+
10
+ export const source = geistdocsSource.source;
11
+ export const getPageImage = geistdocsSource.getPageImage;
12
+ export const getLLMText = geistdocsSource.getPageMarkdown;
@@ -0,0 +1,6 @@
1
+ import { clsx, type ClassValue } from "clsx"
2
+ import { twMerge } from "tailwind-merge"
3
+
4
+ export function cn(...inputs: ClassValue[]) {
5
+ return twMerge(clsx(inputs))
6
+ }
@@ -0,0 +1,22 @@
1
+ import { createMDX } from "fumadocs-mdx/next";
2
+ import type { NextConfig } from "next";
3
+
4
+ const withMDX = createMDX();
5
+
6
+ const config: NextConfig = {
7
+ experimental: {
8
+ turbopackFileSystemCacheForDev: true,
9
+ },
10
+
11
+ images: {
12
+ formats: ["image/avif", "image/webp"],
13
+ remotePatterns: [
14
+ {
15
+ protocol: "https",
16
+ hostname: "placehold.co",
17
+ },
18
+ ],
19
+ },
20
+ };
21
+
22
+ export default withMDX(config);
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "template",
3
+ "description": "Template for Geistdocs projects.",
4
+ "version": "0.0.0",
5
+ "private": true,
6
+ "scripts": {
7
+ "build": "next build",
8
+ "dev": "next dev",
9
+ "start": "next start",
10
+ "postinstall": "fumadocs-mdx",
11
+ "translate": "npx @vercel/geistdocs translate"
12
+ },
13
+ "dependencies": {
14
+ "@ai-sdk/react": "^2.0.115",
15
+ "@icons-pack/react-simple-icons": "^13.8.0",
16
+ "@orama/tokenizers": "^3.1.16",
17
+ "@vercel/geistdocs": "1.2.3-canary.1d733b2",
18
+ "@streamdown/cjk": "^1.0.1",
19
+ "@streamdown/code": "^1.0.1",
20
+ "@vercel/agent-readability": "^0.2.1",
21
+ "@vercel/analytics": "^1.6.1",
22
+ "@vercel/speed-insights": "^1.3.1",
23
+ "ai": "^5.0.106",
24
+ "class-variance-authority": "^0.7.1",
25
+ "clsx": "^2.1.1",
26
+ "cmdk": "^1.1.1",
27
+ "dexie": "^4.2.1",
28
+ "dexie-react-hooks": "^4.2.0",
29
+ "feed": "^5.1.0",
30
+ "fumadocs-core": "16.2.2",
31
+ "fumadocs-mdx": "14.0.4",
32
+ "fumadocs-ui": "16.2.2",
33
+ "jotai": "^2.15.2",
34
+ "lucide-react": "^0.555.0",
35
+ "mermaid": "^11.12.2",
36
+ "motion": "^12.23.25",
37
+ "nanoid": "^5.1.6",
38
+ "next": "16.2.6",
39
+ "next-themes": "^0.4.6",
40
+ "radix-ui": "latest",
41
+ "react": "^19.2.3",
42
+ "react-dom": "^19.2.3",
43
+ "react-player": "^3.4.0",
44
+ "shiki": "3.19.0",
45
+ "sonner": "^2.0.7",
46
+ "streamdown": "^2.1.0",
47
+ "tailwind-merge": "^3.4.0",
48
+ "use-stick-to-bottom": "^1.1.1",
49
+ "vaul": "^1.1.2",
50
+ "zod": "^4.1.13"
51
+ },
52
+ "devDependencies": {
53
+ "@tailwindcss/postcss": "^4.1.17",
54
+ "@types/mdx": "^2.0.13",
55
+ "@types/node": "^24.10.1",
56
+ "@types/react": "^19.2.7",
57
+ "@types/react-dom": "^19.2.3",
58
+ "postcss": "^8.5.6",
59
+ "tailwindcss": "^4.1.17",
60
+ "tw-animate-css": "^1.4.0",
61
+ "typescript": "^5.9.3"
62
+ }
63
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ plugins: {
3
+ "@tailwindcss/postcss": {},
4
+ },
5
+ };
@@ -0,0 +1,17 @@
1
+ import { createProxy } from "@vercel/geistdocs/proxy";
2
+ import { config as geistdocsConfig } from "@/lib/geistdocs/config";
3
+ import { trackMdRequest } from "@/lib/geistdocs/md-tracking";
4
+
5
+ const proxy = createProxy({
6
+ config: geistdocsConfig,
7
+ trackMarkdownRequest: trackMdRequest,
8
+ before: () => null,
9
+ });
10
+
11
+ export const config = {
12
+ matcher: [
13
+ "/((?!api(?:/|$)|_next/static|_next/image|favicon.ico|sitemap.xml|robots.txt).*)",
14
+ ],
15
+ };
16
+
17
+ export default proxy;
@@ -0,0 +1,23 @@
1
+ import {
2
+ defineGeistdocsSourceConfig,
3
+ geistdocsFrontmatterSchema,
4
+ geistdocsMetaSchema,
5
+ } from "@vercel/geistdocs/source-config";
6
+ import { defineDocs } from "fumadocs-mdx/config";
7
+
8
+ // You can customise Zod schemas for frontmatter and `meta.json` here
9
+ // see https://fumadocs.dev/docs/mdx/collections
10
+ export const docs = defineDocs({
11
+ dir: "content/docs",
12
+ docs: {
13
+ schema: geistdocsFrontmatterSchema,
14
+ postprocess: {
15
+ includeProcessedMarkdown: true,
16
+ },
17
+ },
18
+ meta: {
19
+ schema: geistdocsMetaSchema,
20
+ },
21
+ });
22
+
23
+ export default defineGeistdocsSourceConfig();
@@ -0,0 +1,37 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "target": "ESNext",
5
+ "lib": ["dom", "dom.iterable", "esnext"],
6
+ "allowJs": true,
7
+ "skipLibCheck": true,
8
+ "strict": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "noEmit": true,
11
+ "esModuleInterop": true,
12
+ "module": "esnext",
13
+ "moduleResolution": "bundler",
14
+ "resolveJsonModule": true,
15
+ "isolatedModules": true,
16
+ "jsx": "react-jsx",
17
+ "incremental": true,
18
+ "paths": {
19
+ "@/*": ["./*"],
20
+ "@/.source": [".source"]
21
+ },
22
+ "plugins": [
23
+ {
24
+ "name": "next"
25
+ }
26
+ ],
27
+ "strictNullChecks": true
28
+ },
29
+ "include": [
30
+ "next-env.d.ts",
31
+ "**/*.ts",
32
+ "**/*.tsx",
33
+ ".next/types/**/*.ts",
34
+ ".next/dev/types/**/*.ts"
35
+ ],
36
+ "exclude": ["node_modules"]
37
+ }
package/dist/index.js DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{program as P}from"commander";import{copyFile as V,rm as q}from"fs/promises";import{join as R}from"path";import{cancel as W,intro as Y,isCancel as Z,log as Q,outro as tt,spinner as et,text as st}from"@clack/prompts";import{spawn as X}from"child_process";var v="https://github.com/vercel/geistdocs";var h={stdio:"ignore"};var x="geistdocs-update",f=(t,e)=>new Promise((s,r)=>{let[a,...i]=t.split(" "),n=X(a,i,{stdio:["ignore","pipe","pipe"],shell:e?.shell??!0,cwd:e?.cwd}),l="",c="";n.stdout?.on("data",p=>{l+=p.toString()}),n.stderr?.on("data",p=>{c+=p.toString()});let o=()=>{n.kill("SIGTERM"),setTimeout(()=>{n.killed||n.kill("SIGKILL")},1e3)};process.on("SIGINT",o),process.on("SIGTERM",o),n.on("close",p=>{process.removeListener("SIGINT",o),process.removeListener("SIGTERM",o),p===0?s({stdout:l,stderr:c}):r(new Error(`Command failed with code ${p}: ${c}`))}),n.on("error",p=>{process.removeListener("SIGINT",o),process.removeListener("SIGTERM",o),r(p)})});var nt="https://github.com/vercel/geistdocs.git",rt=async t=>{await f(`git clone --depth 1 --filter=blob:none --sparse ${nt} ${t}`,h),await f("git sparse-checkout set apps/template",{...h,cwd:t}),await f("mv apps/template/* apps/template/.[!.]* . 2>/dev/null || true",{...h,cwd:t,shell:"/bin/bash"}),await f("rm -rf apps .git",{...h,cwd:t})},ot=async()=>{await V(".env.example",".env.local")},at=async()=>{await q(R("content","docs"),{recursive:!0,force:!0})},it=async()=>{await f("pnpm install",h)},ct=async()=>{await f("git init",h),await f("git add .",h),await f('git commit -m "\u2728 Initial commit"',h)},lt=async()=>{let t=await st({message:"What is your project named?",placeholder:"my-app",validate(e){if(e.length===0)return"Please enter a project name."}});return Z(t)&&(W("Operation cancelled."),process.exit(0)),t.toString()},j=async t=>{try{Y("Let's start a Geistdocs project!");let e=process.cwd(),s=t.name||await lt(),r=et(),a=R(e,s);r.start("Cloning template..."),await rt(s),r.message("Moving into project..."),process.chdir(a),r.message("Setting up environment variables..."),await ot(),r.message("Deleting demo content..."),await at(),r.message("Installing dependencies..."),await it(),t.disableGit||(r.message("Initializing Git repository..."),await ct()),r.stop("Project initialized successfully!"),tt("Run `pnpm dev` to start the development server.")}catch(e){let s=e instanceof Error?e.message:`Failed to initialize project: ${e}`;Q.error(s),process.exit(1)}};import{createHash as pt}from"crypto";import{existsSync as L}from"fs";import{readFile as F,writeFile as U}from"fs/promises";import{dirname as gt,parse as D,resolve as $}from"path";import{intro as dt,isCancel as ft,log as m,outro as T,spinner as mt,text as ut}from"@clack/prompts";import{glob as ht}from"glob";import{Project as wt,SyntaxKind as S}from"ts-morph";var b=10,yt="content/docs/**/*.mdx",C=".translation-cache.json",Tt=/\.[a-z]{2}\.mdx$/,$t=async t=>(await ht(t,{cwd:process.cwd(),absolute:!0,nodir:!0})).filter(s=>s.endsWith(".mdx")).filter(s=>!Tt.test(s)),Pt=t=>{let e=$(process.cwd(),t),a=new wt({skipAddingFilesFromTsConfig:!0}).addSourceFileAtPath(e).getVariableDeclaration("translations");if(!a)throw new Error("Could not find translations export in config file");let i=a.getInitializer();if(!i||i.getKind()!==S.ObjectLiteralExpression)throw new Error("translations must be an object literal");let n=i.asKind(S.ObjectLiteralExpression);if(!n)throw new Error("Could not parse translations object");let l=n.getProperties().filter(p=>p.getKind()===S.PropertyAssignment).map(p=>p.asKind(S.PropertyAssignment)?.getName()).filter(p=>p!==void 0);if(l.length===0)throw new Error("No locales found in translations object");let[c,...o]=l;return o},xt=t=>pt("sha256").update(t).digest("hex"),St=async()=>{let t=$(process.cwd(),C);if(!L(t))return{};try{let e=await F(t,"utf-8");return JSON.parse(e)}catch{return m.warn("Failed to load translation cache, starting fresh"),{}}},N=async t=>{let e=$(process.cwd(),C);await U(e,JSON.stringify(t,null,2),"utf-8")},vt=(t,e,s,r)=>{let a=t[e];if(!a)return!0;let i=a[s];return i?i.hash!==r:!0},bt=async(t,e,s)=>{let r=await F(t,"utf-8"),a=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:r,locale:e})}),i=await a.text();if(!a.ok){let n=`Translation failed with status ${a.status}`;try{let l=JSON.parse(i);n=l.error||l.message||n}catch{n=i||n}throw new Error(n)}try{return JSON.parse(i).translation}catch{throw new Error(`Failed to parse response: ${i.slice(0,200)}`)}},Ft=async(t,e,s,r,a)=>{let i=gt(t),{name:n,ext:l}=D(t),c=$(i,`${n}.${e}${l}`);await U(c,s,"utf-8"),r[t]||(r[t]={}),r[t][e]={hash:a,translatedAt:new Date().toISOString()},await N(r)},Ct=t=>{try{let e=Pt(t);return m.info(`Loaded ${e.length} locale(s) from config: ${e.join(", ")}`),e}catch(e){m.error(`Failed to load config: ${e instanceof Error?e.message:String(e)}`),T("Translation cancelled"),process.exit(1)}},Et=async()=>{let t=await ut({message:"Enter target locales (comma-separated):",placeholder:"cn,fr,es",validate:e=>{if(!e)return"At least one locale is required"}});return ft(t)&&(T("Translation cancelled"),process.exit(0)),t.split(",").map(e=>e.trim())},It=async t=>{let e=new Map;for(let s of t){let r=await F(s,"utf-8");e.set(s,xt(r))}return e},Rt=(t,e,s,r,a)=>{let i=[],n=0;for(let l of t)for(let c of e){let o=s.get(c);if(!o)throw new Error(`Hash not found for file: ${c}`);a||vt(r,c,l,o)?i.push({filePath:c,locale:l,hash:o}):n+=1}return{tasks:i,skippedCount:n}},jt=async(t,e,s,r)=>{let a=mt(),i=[];a.start("Starting translation...");let n=0;for(let l=0;l<t.length;l++){let c=t[l];a.message(`Processing batch ${l+1}/${t.length} (${c.length} translations) - ${n}/${e} complete`),await Promise.all(c.map(async o=>{let{name:p,ext:u}=D(o.filePath),g=await bt(o.filePath,o.locale,s);await Ft(o.filePath,o.locale,g,r,o.hash),i.push({name:p,locale:o.locale,ext:u}),n+=1})),l<t.length-1&&(a.message(`Batch ${l+1}/${t.length} complete. Pausing...`),await new Promise(o=>setTimeout(o,1e3)))}return a.stop("Translation complete!"),i},O=async(t,e)=>{dt("Translate MDX content");let s=t??yt,r=e.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",a=Ct(e.config??"geistdocs.tsx"),i=await $t(s);i.length===0&&(m.error(`No MDX files found matching pattern: ${s}`),T("Translation cancelled"),process.exit(1)),m.info(`Found ${i.length} MDX file(s) matching pattern`),a.length===0&&(a=await Et());let n=$(process.cwd(),C),l=await St();L(n)||await N(l),m.info(`Using cache: ${n}`);let c=await It(i),{tasks:o,skippedCount:p}=Rt(a,i,c,l,e.force);if(o.length===0){m.success("All translations are up to date!"),T(`Skipped ${p} file(s) (unchanged)`);return}let u=[];for(let g=0;g<o.length;g+=b)u.push(o.slice(g,g+b));m.info(`Processing ${o.length} translation(s) in ${u.length} batch(es) of up to ${b}`),p>0&&m.info(`Skipped ${p} translation(s) (unchanged)`);try{let g=await jt(u,o.length,r,l);for(let{name:B,locale:K,ext:J}of g)m.success(`Saved: ${B}.${K}${J}`);let y=[`Translated ${g.length} file(s)`];p>0&&y.push(`Skipped ${p} unchanged`),T(y.join(" \u2022 "))}catch(g){let y=g instanceof Error?g.message:String(g);m.error(`Translation failed: ${y}`),T("Exiting"),process.exit(1)}};import{access as Lt,copyFile as Ut,mkdir as z,rm as I}from"fs/promises";import{dirname as Dt,join as w}from"path";import{intro as Nt,log as d,outro as A,spinner as Ot}from"@clack/prompts";import{glob as At}from"glob";var _="apps/template",kt=["**/*"],Gt=["content/docs/**"],Mt=async(t,e)=>{let s=w(t,e);await I(s,{recursive:!0,force:!0}),await z(s,{recursive:!0})},zt=async(t,e)=>{await f(`git clone --depth 1 --filter=blob:none --sparse ${v} ${e}`,{cwd:t}),await f("git sparse-checkout set apps/template",{cwd:w(t,e)})},E=async t=>await I(t,{recursive:!0,force:!0}),k=async(t,e,s)=>(await At(t,{cwd:s,nodir:!0,dot:!0,ignore:[".git/**",...e]})).sort(),_t=async t=>{try{return await Lt(t),!0}catch{return!1}},Ht=async(t,e,s)=>{let r=w(e,_,t),a=w(s,t);return await _t(r)?(await Ut(r,a),{success:!0}):{success:!1,error:`Source file not found: ${r}`}},Bt=async(t,e)=>{let s=w(e,t);return await I(s,{force:!0}),{success:!0}},G=20,M=async(t,e,s)=>{let r=[];for(let a=0;a<t.length;a+=s){let i=t.slice(a,a+s),n=await Promise.all(i.map(e));r.push(...n)}return r},Kt=async(t,e,s,r,a)=>{let i={success:[],deleted:[],failed:[]},n=[...new Set(t.map(c=>Dt(w(r,c))))];a.message(`Creating ${n.length} directories...`),await Promise.all(n.map(c=>z(c,{recursive:!0}))),a.message(`Updating ${t.length} files...`);let l=await M(t,async c=>{let o=await Ht(c,s,r);return{file:c,...o}},G);for(let{file:c,success:o,error:p}of l)o?i.success.push(c):i.failed.push({file:c,error:p??"Unknown error"});if(e.length>0){a.message(`Deleting ${e.length} files...`);let c=await M(e,async o=>{try{return await Bt(o,r),{file:o,success:!0}}catch(p){let u=p instanceof Error?p.message:`${p}`;return{file:o,success:!1,error:u}}},G);for(let o of c)o.success?i.deleted.push(o.file):i.failed.push({file:o.file,error:o.error})}return i},Jt=t=>{if(t.success.length>0){d.success(`Successfully updated ${t.success.length} files:`);for(let e of t.success)d.info(` \u2713 ${e}`)}if(t.deleted.length>0){d.success(`Deleted ${t.deleted.length} files:`);for(let e of t.deleted)d.info(` \u{1F5D1} ${e}`)}if(t.failed.length>0){d.warn(`Failed to update ${t.failed.length} files:`);for(let{file:e,error:s}of t.failed)d.error(` \u2717 ${e}: ${s}`)}},H=async(t,e)=>{let s=process.cwd(),r=w(s,x),a=t&&t.length>0?t:kt,i=t&&t.length>0?[]:Gt;try{Nt("Let's update your Geistdocs project!"),d.info(`Repository: ${v}`),t&&t.length>0&&d.info(`Updating specific files: ${t.join(", ")}`),e?.sync&&d.info("Sync mode enabled: will delete files removed from template");let n=Ot();n.start("Creating temporary directory..."),await Mt(s,x),n.message("Cloning repository..."),await zt(s,x),n.message("Scanning for files...");let l=w(r,_),c=await k(a,i,l),o=[];if(e?.sync){n.message("Comparing with local files...");let u=await k(a,i,s),g=new Set(c);o=u.filter(y=>!g.has(y))}if(n.stop(`Found ${c.length} files to update`),c.length===0&&o.length===0){d.warn("No files matched the patterns. Nothing to update."),await E(r),A("Update cancelled.");return}d.info(`Patterns: ${a.length}`),d.info(`Files to update: ${c.length}`),e?.sync&&d.info(`Files to delete: ${o.length}`),n.start("Updating files...");let p=await Kt(c,o,r,s,n);n.message("Cleaning up..."),await E(r),n.stop("Update complete!"),Jt(p),A("Please review and test the changes carefully.")}catch(n){let l=n instanceof Error?n.message:`${n}`;try{await E(r)}catch{}d.error(`Failed to update project: ${l}`),process.exit(1)}};P.name("geistdocs").description("CLI for Geistdocs projects").version("1.1.1","-v, --version","Output the current version");P.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").option("--disable-git","Disable git initialization").action(j);P.command("update [files...]").description("Update a Geistdocs project (optionally specify files/patterns to update)").option("--sync","Delete local files that no longer exist in the template").action(H);P.command("translate [pattern]").description("Translate MDX file(s) to one or more locales (default: content/docs/**/*.mdx)").option("--config <path>","Path to config file to load locales from (defaults to geistdocs.tsx)").option("--url <url>","Custom translation API URL (defaults to GEISTDOCS_TRANSLATE_URL or https://geistdocs.com/translate)").option("--force","Force re-translation of all files, ignoring cache").action(O);P.parse(process.argv);
File without changes