blodemd 0.0.15 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/README.md +26 -1
  2. package/dist/cli.mjs +217 -217
  3. package/dist/cli.mjs.map +1 -1
  4. package/package.json +3 -36
  5. package/dev-server/app/[[...slug]]/page.tsx +0 -140
  6. package/dev-server/app/blodemd-dev/invalidate/route.ts +0 -12
  7. package/dev-server/app/blodemd-dev/static/[...path]/route.ts +0 -32
  8. package/dev-server/app/blodemd-dev/version/route.ts +0 -14
  9. package/dev-server/app/blodemd-internal/proxy/route.ts +0 -86
  10. package/dev-server/app/error.tsx +0 -24
  11. package/dev-server/app/favicon.ico +0 -0
  12. package/dev-server/app/globals.css +0 -4
  13. package/dev-server/app/layout.tsx +0 -38
  14. package/dev-server/app/not-found.tsx +0 -18
  15. package/dev-server/app/search/route.ts +0 -17
  16. package/dev-server/components/dev-reload-script.tsx +0 -86
  17. package/dev-server/components/providers.tsx +0 -15
  18. package/dev-server/lib/dev-state.ts +0 -8
  19. package/dev-server/lib/local-content-source.ts +0 -103
  20. package/dev-server/lib/local-runtime.tsx +0 -555
  21. package/dev-server/next-env.d.ts +0 -5
  22. package/dev-server/next.config.js +0 -54
  23. package/dev-server/package.json +0 -61
  24. package/dev-server/postcss.config.mjs +0 -7
  25. package/dev-server/public/glide-variable.woff2 +0 -0
  26. package/dev-server/tsconfig.json +0 -50
  27. package/docs/app/globals.css +0 -471
  28. package/docs/components/animate-ui/primitives/buttons/button.tsx +0 -14
  29. package/docs/components/api/api-playground.tsx +0 -467
  30. package/docs/components/api/api-reference.tsx +0 -157
  31. package/docs/components/content/collection-index.tsx +0 -114
  32. package/docs/components/docs/contextual-menu.tsx +0 -495
  33. package/docs/components/docs/copy-page-menu.tsx +0 -364
  34. package/docs/components/docs/doc-header.tsx +0 -223
  35. package/docs/components/docs/doc-shell.tsx +0 -355
  36. package/docs/components/docs/doc-sidebar.tsx +0 -256
  37. package/docs/components/docs/doc-toc.tsx +0 -46
  38. package/docs/components/docs/mobile-nav.tsx +0 -195
  39. package/docs/components/docs/sidebar-active-highlight.tsx +0 -34
  40. package/docs/components/docs/sidebar-scroll-area.tsx +0 -63
  41. package/docs/components/git/repo-picker.tsx +0 -529
  42. package/docs/components/icons/doc-icon.tsx +0 -96
  43. package/docs/components/mdx/accordion.tsx +0 -83
  44. package/docs/components/mdx/agent-instructions.tsx +0 -17
  45. package/docs/components/mdx/badge.tsx +0 -79
  46. package/docs/components/mdx/callout.tsx +0 -88
  47. package/docs/components/mdx/card.tsx +0 -110
  48. package/docs/components/mdx/code-block.tsx +0 -80
  49. package/docs/components/mdx/code-group.tsx +0 -203
  50. package/docs/components/mdx/color.tsx +0 -87
  51. package/docs/components/mdx/columns.tsx +0 -25
  52. package/docs/components/mdx/expandable.tsx +0 -45
  53. package/docs/components/mdx/field-layout.tsx +0 -77
  54. package/docs/components/mdx/frame.tsx +0 -23
  55. package/docs/components/mdx/get-text-content.ts +0 -18
  56. package/docs/components/mdx/icon.tsx +0 -12
  57. package/docs/components/mdx/iframe.tsx +0 -62
  58. package/docs/components/mdx/index.tsx +0 -121
  59. package/docs/components/mdx/installer.tsx +0 -20
  60. package/docs/components/mdx/panel.tsx +0 -11
  61. package/docs/components/mdx/param-field.tsx +0 -56
  62. package/docs/components/mdx/preview.tsx +0 -36
  63. package/docs/components/mdx/prompt.tsx +0 -63
  64. package/docs/components/mdx/request-example.tsx +0 -27
  65. package/docs/components/mdx/response-field.tsx +0 -42
  66. package/docs/components/mdx/steps.tsx +0 -92
  67. package/docs/components/mdx/tabs.tsx +0 -193
  68. package/docs/components/mdx/tile.tsx +0 -43
  69. package/docs/components/mdx/tooltip.tsx +0 -71
  70. package/docs/components/mdx/tree.tsx +0 -120
  71. package/docs/components/mdx/type-table.tsx +0 -71
  72. package/docs/components/mdx/update.tsx +0 -44
  73. package/docs/components/mdx/video.tsx +0 -45
  74. package/docs/components/mdx/view.tsx +0 -66
  75. package/docs/components/posthog-provider.tsx +0 -42
  76. package/docs/components/providers.tsx +0 -15
  77. package/docs/components/tenant-analytics.tsx +0 -49
  78. package/docs/components/third-parties.tsx +0 -32
  79. package/docs/components/ui/badge.tsx +0 -61
  80. package/docs/components/ui/breadcrumb.tsx +0 -112
  81. package/docs/components/ui/button-group.tsx +0 -83
  82. package/docs/components/ui/button.tsx +0 -65
  83. package/docs/components/ui/card.tsx +0 -92
  84. package/docs/components/ui/command.tsx +0 -167
  85. package/docs/components/ui/copy-button.tsx +0 -129
  86. package/docs/components/ui/dialog.tsx +0 -146
  87. package/docs/components/ui/field.tsx +0 -237
  88. package/docs/components/ui/input.tsx +0 -23
  89. package/docs/components/ui/kbd.tsx +0 -98
  90. package/docs/components/ui/label.tsx +0 -22
  91. package/docs/components/ui/morph-icon.tsx +0 -79
  92. package/docs/components/ui/popover.tsx +0 -267
  93. package/docs/components/ui/search-dialog.tsx +0 -431
  94. package/docs/components/ui/search.tsx +0 -101
  95. package/docs/components/ui/separator.tsx +0 -26
  96. package/docs/components/ui/sheet.tsx +0 -133
  97. package/docs/components/ui/sidebar.tsx +0 -758
  98. package/docs/components/ui/skeleton.tsx +0 -11
  99. package/docs/components/ui/switch.tsx +0 -32
  100. package/docs/components/ui/tabs.tsx +0 -138
  101. package/docs/components/ui/theme-toggle.tsx +0 -62
  102. package/docs/components/ui/tooltip.tsx +0 -53
  103. package/docs/components/web-mcp.tsx +0 -115
  104. package/docs/lib/agent-skills.ts +0 -48
  105. package/docs/lib/api-client.ts +0 -72
  106. package/docs/lib/config.ts +0 -6
  107. package/docs/lib/content-root.ts +0 -33
  108. package/docs/lib/content-source.ts +0 -70
  109. package/docs/lib/contextual-options.ts +0 -222
  110. package/docs/lib/dashboard-session.ts +0 -167
  111. package/docs/lib/db.ts +0 -13
  112. package/docs/lib/docs-collection.ts +0 -7
  113. package/docs/lib/docs-runtime.tsx +0 -745
  114. package/docs/lib/edge-config.ts +0 -95
  115. package/docs/lib/env.ts +0 -23
  116. package/docs/lib/etag.ts +0 -22
  117. package/docs/lib/github-install.ts +0 -33
  118. package/docs/lib/llms-full.ts +0 -82
  119. package/docs/lib/marketing-markdown.ts +0 -79
  120. package/docs/lib/marketing-site.ts +0 -31
  121. package/docs/lib/mdx.ts +0 -98
  122. package/docs/lib/navigation.ts +0 -288
  123. package/docs/lib/openapi-proxy.ts +0 -88
  124. package/docs/lib/openapi.ts +0 -158
  125. package/docs/lib/platform-config.ts +0 -6
  126. package/docs/lib/project-authz.ts +0 -46
  127. package/docs/lib/routes.ts +0 -103
  128. package/docs/lib/server-cache.ts +0 -83
  129. package/docs/lib/shiki.ts +0 -44
  130. package/docs/lib/supabase.ts +0 -37
  131. package/docs/lib/tenancy.ts +0 -364
  132. package/docs/lib/tenant-headers.ts +0 -43
  133. package/docs/lib/tenant-static.ts +0 -705
  134. package/docs/lib/tenant-utility-context.ts +0 -62
  135. package/docs/lib/tenants.ts +0 -72
  136. package/docs/lib/theme.ts +0 -29
  137. package/docs/lib/time-ago.ts +0 -24
  138. package/docs/lib/toc.ts +0 -2
  139. package/docs/lib/use-mobile.ts +0 -19
  140. package/docs/lib/use-tab-observer.ts +0 -71
  141. package/docs/lib/utils.ts +0 -5
  142. package/packages/@repo/common/dist/index.d.ts +0 -16
  143. package/packages/@repo/common/dist/index.d.ts.map +0 -1
  144. package/packages/@repo/common/dist/index.js +0 -84
  145. package/packages/@repo/common/package.json +0 -34
  146. package/packages/@repo/common/src/index.ts +0 -101
  147. package/packages/@repo/contracts/dist/analytics.d.ts +0 -21
  148. package/packages/@repo/contracts/dist/analytics.d.ts.map +0 -1
  149. package/packages/@repo/contracts/dist/analytics.js +0 -18
  150. package/packages/@repo/contracts/dist/dates.d.ts +0 -4
  151. package/packages/@repo/contracts/dist/dates.d.ts.map +0 -1
  152. package/packages/@repo/contracts/dist/dates.js +0 -2
  153. package/packages/@repo/contracts/dist/deployment.d.ts +0 -71
  154. package/packages/@repo/contracts/dist/deployment.d.ts.map +0 -1
  155. package/packages/@repo/contracts/dist/deployment.js +0 -46
  156. package/packages/@repo/contracts/dist/domain.d.ts +0 -94
  157. package/packages/@repo/contracts/dist/domain.d.ts.map +0 -1
  158. package/packages/@repo/contracts/dist/domain.js +0 -36
  159. package/packages/@repo/contracts/dist/git.d.ts +0 -28
  160. package/packages/@repo/contracts/dist/git.d.ts.map +0 -1
  161. package/packages/@repo/contracts/dist/git.js +0 -24
  162. package/packages/@repo/contracts/dist/ids.d.ts +0 -14
  163. package/packages/@repo/contracts/dist/ids.d.ts.map +0 -1
  164. package/packages/@repo/contracts/dist/ids.js +0 -11
  165. package/packages/@repo/contracts/dist/index.d.ts +0 -11
  166. package/packages/@repo/contracts/dist/index.d.ts.map +0 -1
  167. package/packages/@repo/contracts/dist/index.js +0 -12
  168. package/packages/@repo/contracts/dist/pagination.d.ts +0 -23
  169. package/packages/@repo/contracts/dist/pagination.d.ts.map +0 -1
  170. package/packages/@repo/contracts/dist/pagination.js +0 -15
  171. package/packages/@repo/contracts/dist/project.d.ts +0 -42
  172. package/packages/@repo/contracts/dist/project.d.ts.map +0 -1
  173. package/packages/@repo/contracts/dist/project.js +0 -25
  174. package/packages/@repo/contracts/dist/tenant.d.ts +0 -147
  175. package/packages/@repo/contracts/dist/tenant.d.ts.map +0 -1
  176. package/packages/@repo/contracts/dist/tenant.js +0 -58
  177. package/packages/@repo/contracts/dist/user.d.ts +0 -9
  178. package/packages/@repo/contracts/dist/user.d.ts.map +0 -1
  179. package/packages/@repo/contracts/dist/user.js +0 -9
  180. package/packages/@repo/contracts/package.json +0 -37
  181. package/packages/@repo/contracts/src/analytics.ts +0 -33
  182. package/packages/@repo/contracts/src/dates.ts +0 -4
  183. package/packages/@repo/contracts/src/deployment.ts +0 -73
  184. package/packages/@repo/contracts/src/domain.ts +0 -51
  185. package/packages/@repo/contracts/src/git.ts +0 -31
  186. package/packages/@repo/contracts/src/ids.ts +0 -23
  187. package/packages/@repo/contracts/src/index.ts +0 -12
  188. package/packages/@repo/contracts/src/pagination.ts +0 -21
  189. package/packages/@repo/contracts/src/project.ts +0 -32
  190. package/packages/@repo/contracts/src/tenant.ts +0 -94
  191. package/packages/@repo/contracts/src/user.ts +0 -12
  192. package/packages/@repo/models/dist/docs-config.d.ts +0 -961
  193. package/packages/@repo/models/dist/docs-config.d.ts.map +0 -1
  194. package/packages/@repo/models/dist/docs-config.js +0 -531
  195. package/packages/@repo/models/dist/index.d.ts +0 -3
  196. package/packages/@repo/models/dist/index.d.ts.map +0 -1
  197. package/packages/@repo/models/dist/index.js +0 -3
  198. package/packages/@repo/models/dist/tenant.d.ts +0 -37
  199. package/packages/@repo/models/dist/tenant.d.ts.map +0 -1
  200. package/packages/@repo/models/dist/tenant.js +0 -1
  201. package/packages/@repo/models/package.json +0 -37
  202. package/packages/@repo/models/src/docs-config.ts +0 -629
  203. package/packages/@repo/models/src/index.ts +0 -3
  204. package/packages/@repo/models/src/tenant.ts +0 -44
  205. package/packages/@repo/prebuild/dist/index.d.ts +0 -2
  206. package/packages/@repo/prebuild/dist/index.d.ts.map +0 -1
  207. package/packages/@repo/prebuild/dist/index.js +0 -2
  208. package/packages/@repo/prebuild/dist/openapi.d.ts +0 -43
  209. package/packages/@repo/prebuild/dist/openapi.d.ts.map +0 -1
  210. package/packages/@repo/prebuild/dist/openapi.js +0 -86
  211. package/packages/@repo/prebuild/package.json +0 -39
  212. package/packages/@repo/prebuild/src/index.ts +0 -2
  213. package/packages/@repo/prebuild/src/openapi.ts +0 -154
  214. package/packages/@repo/previewing/dist/blob-source.d.ts +0 -16
  215. package/packages/@repo/previewing/dist/blob-source.d.ts.map +0 -1
  216. package/packages/@repo/previewing/dist/blob-source.js +0 -128
  217. package/packages/@repo/previewing/dist/config-loader.d.ts +0 -134
  218. package/packages/@repo/previewing/dist/config-loader.d.ts.map +0 -1
  219. package/packages/@repo/previewing/dist/config-loader.js +0 -231
  220. package/packages/@repo/previewing/dist/constants.d.ts +0 -15
  221. package/packages/@repo/previewing/dist/constants.d.ts.map +0 -1
  222. package/packages/@repo/previewing/dist/constants.js +0 -14
  223. package/packages/@repo/previewing/dist/content-index.d.ts +0 -7
  224. package/packages/@repo/previewing/dist/content-index.d.ts.map +0 -1
  225. package/packages/@repo/previewing/dist/content-index.js +0 -291
  226. package/packages/@repo/previewing/dist/content-source.d.ts +0 -12
  227. package/packages/@repo/previewing/dist/content-source.d.ts.map +0 -1
  228. package/packages/@repo/previewing/dist/content-source.js +0 -1
  229. package/packages/@repo/previewing/dist/fs-source.d.ts +0 -11
  230. package/packages/@repo/previewing/dist/fs-source.d.ts.map +0 -1
  231. package/packages/@repo/previewing/dist/fs-source.js +0 -71
  232. package/packages/@repo/previewing/dist/index.d.ts +0 -16
  233. package/packages/@repo/previewing/dist/index.d.ts.map +0 -1
  234. package/packages/@repo/previewing/dist/index.js +0 -13
  235. package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts +0 -3
  236. package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts.map +0 -1
  237. package/packages/@repo/previewing/dist/markdown/agent-markdown.js +0 -176
  238. package/packages/@repo/previewing/dist/markdown/format.d.ts +0 -8
  239. package/packages/@repo/previewing/dist/markdown/format.d.ts.map +0 -1
  240. package/packages/@repo/previewing/dist/markdown/format.js +0 -43
  241. package/packages/@repo/previewing/dist/markdown/links.d.ts +0 -3
  242. package/packages/@repo/previewing/dist/markdown/links.d.ts.map +0 -1
  243. package/packages/@repo/previewing/dist/markdown/links.js +0 -31
  244. package/packages/@repo/previewing/dist/openapi-pages.d.ts +0 -7
  245. package/packages/@repo/previewing/dist/openapi-pages.d.ts.map +0 -1
  246. package/packages/@repo/previewing/dist/openapi-pages.js +0 -200
  247. package/packages/@repo/previewing/dist/search-index.d.ts +0 -4
  248. package/packages/@repo/previewing/dist/search-index.d.ts.map +0 -1
  249. package/packages/@repo/previewing/dist/search-index.js +0 -23
  250. package/packages/@repo/previewing/dist/serialization.d.ts +0 -13
  251. package/packages/@repo/previewing/dist/serialization.d.ts.map +0 -1
  252. package/packages/@repo/previewing/dist/serialization.js +0 -108
  253. package/packages/@repo/previewing/dist/toc-index.d.ts +0 -5
  254. package/packages/@repo/previewing/dist/toc-index.d.ts.map +0 -1
  255. package/packages/@repo/previewing/dist/toc-index.js +0 -53
  256. package/packages/@repo/previewing/dist/types.d.ts +0 -92
  257. package/packages/@repo/previewing/dist/types.d.ts.map +0 -1
  258. package/packages/@repo/previewing/dist/types.js +0 -1
  259. package/packages/@repo/previewing/dist/utility-index.d.ts +0 -7
  260. package/packages/@repo/previewing/dist/utility-index.d.ts.map +0 -1
  261. package/packages/@repo/previewing/dist/utility-index.js +0 -201
  262. package/packages/@repo/previewing/package.json +0 -41
  263. package/packages/@repo/previewing/src/blob-source.ts +0 -185
  264. package/packages/@repo/previewing/src/config-loader.ts +0 -316
  265. package/packages/@repo/previewing/src/constants.ts +0 -16
  266. package/packages/@repo/previewing/src/content-index.ts +0 -384
  267. package/packages/@repo/previewing/src/content-source.ts +0 -12
  268. package/packages/@repo/previewing/src/fs-source.ts +0 -103
  269. package/packages/@repo/previewing/src/index.ts +0 -71
  270. package/packages/@repo/previewing/src/markdown/agent-markdown.ts +0 -254
  271. package/packages/@repo/previewing/src/markdown/format.ts +0 -63
  272. package/packages/@repo/previewing/src/markdown/links.ts +0 -46
  273. package/packages/@repo/previewing/src/openapi-pages.ts +0 -319
  274. package/packages/@repo/previewing/src/search-index.ts +0 -38
  275. package/packages/@repo/previewing/src/serialization.ts +0 -191
  276. package/packages/@repo/previewing/src/toc-index.ts +0 -72
  277. package/packages/@repo/previewing/src/types.ts +0 -105
  278. package/packages/@repo/previewing/src/utility-index.ts +0 -304
  279. package/packages/@repo/validation/dist/index.d.ts +0 -12
  280. package/packages/@repo/validation/dist/index.d.ts.map +0 -1
  281. package/packages/@repo/validation/dist/index.js +0 -30
  282. package/packages/@repo/validation/package.json +0 -38
  283. package/packages/@repo/validation/src/blodemd-docs-schema.json +0 -3575
  284. package/packages/@repo/validation/src/index.ts +0 -59
  285. package/scripts/prepare-package.mjs +0 -53
  286. package/scripts/repo-packages.mjs +0 -8
@@ -1,222 +0,0 @@
1
- import type {
2
- ContextualBuiltinOption,
3
- ContextualCustomOption,
4
- ContextualOption,
5
- } from "@repo/models";
6
-
7
- interface BuiltinOptionDefinition {
8
- title: string;
9
- description: string;
10
- iconName: string;
11
- type: "action" | "link";
12
- }
13
-
14
- export const builtinOptions: Record<
15
- ContextualBuiltinOption,
16
- BuiltinOptionDefinition
17
- > = {
18
- "add-mcp": {
19
- description: "Copy the npx add-mcp command",
20
- iconName: "CodeBracketsIcon",
21
- title: "Copy MCP install command",
22
- type: "action",
23
- },
24
- aistudio: {
25
- description: "Ask questions about this page",
26
- iconName: "GoogleColoredIcon",
27
- title: "Open in Google AI Studio",
28
- type: "link",
29
- },
30
- assistant: {
31
- description: "Open the assistant with this page as context",
32
- iconName: "SparkleIcon",
33
- title: "Ask assistant",
34
- type: "action",
35
- },
36
- chatgpt: {
37
- description: "Ask questions about this page",
38
- iconName: "OpenaiIcon",
39
- title: "Open in ChatGPT",
40
- type: "link",
41
- },
42
- claude: {
43
- description: "Ask questions about this page",
44
- iconName: "ClaudeaiIcon",
45
- title: "Open in Claude",
46
- type: "link",
47
- },
48
- copy: {
49
- description: "Copy page as Markdown for LLMs",
50
- iconName: "CopySimpleIcon",
51
- title: "Copy page",
52
- type: "action",
53
- },
54
- cursor: {
55
- description: "Install MCP server in Cursor",
56
- iconName: "CodeIcon",
57
- title: "Connect to Cursor",
58
- type: "link",
59
- },
60
- devin: {
61
- description: "Create a Devin session with this page",
62
- iconName: "CodeAssistantIcon",
63
- title: "Open in Devin",
64
- type: "link",
65
- },
66
- "devin-mcp": {
67
- description: "Install MCP server in Devin",
68
- iconName: "CodeAssistantIcon",
69
- title: "Connect to Devin",
70
- type: "link",
71
- },
72
- gemini: {
73
- description: "Ask questions about this page",
74
- iconName: "GoogleColoredIcon",
75
- title: "Open in Gemini",
76
- type: "link",
77
- },
78
- grok: {
79
- description: "Ask questions about this page",
80
- iconName: "GrokIcon",
81
- title: "Open in Grok",
82
- type: "link",
83
- },
84
- mcp: {
85
- description: "Copy your MCP server URL to clipboard",
86
- iconName: "Plugin1Icon",
87
- title: "Copy MCP server URL",
88
- type: "action",
89
- },
90
- perplexity: {
91
- description: "Ask questions about this page",
92
- iconName: "PerplexityIcon",
93
- title: "Open in Perplexity",
94
- type: "link",
95
- },
96
- view: {
97
- description: "Open the current page as Markdown",
98
- iconName: "MarkdownIcon",
99
- title: "View as Markdown",
100
- type: "link",
101
- },
102
- vscode: {
103
- description: "Install MCP server in VS Code",
104
- iconName: "CodeLinesIcon",
105
- title: "Connect to VS Code",
106
- type: "link",
107
- },
108
- windsurf: {
109
- description: "Open Windsurf Cascade with this page",
110
- iconName: "WindIcon",
111
- title: "Open in Windsurf",
112
- type: "link",
113
- },
114
- };
115
-
116
- interface UrlContext {
117
- pageUrl: string;
118
- pagePath: string;
119
- pageContent: string;
120
- mcpServerUrl?: string;
121
- }
122
-
123
- const PAGE_PLACEHOLDER = "$page";
124
- const BUILTIN_OPTIONS_REQUIRING_PAGE_CONTENT = new Set<ContextualBuiltinOption>(
125
- ["assistant", "copy"]
126
- );
127
-
128
- const askPrompt = (url: string) =>
129
- `Read from ${url} so I can ask questions about it.`;
130
-
131
- const encoded = (text: string) => encodeURIComponent(text);
132
-
133
- const customHrefUsesPageContent = (href: ContextualCustomOption["href"]) =>
134
- typeof href === "string"
135
- ? href.includes(PAGE_PLACEHOLDER)
136
- : href.query.some((item) => item.value.includes(PAGE_PLACEHOLDER));
137
-
138
- export const contextualOptionsRequirePageContent = (
139
- options: ContextualOption[]
140
- ) =>
141
- options.some((option) =>
142
- typeof option === "string"
143
- ? BUILTIN_OPTIONS_REQUIRING_PAGE_CONTENT.has(option)
144
- : customHrefUsesPageContent(option.href)
145
- );
146
-
147
- export const buildBuiltinUrl = (
148
- id: ContextualBuiltinOption,
149
- context: UrlContext
150
- ): string | null => {
151
- const { pageUrl, pagePath, mcpServerUrl } = context;
152
-
153
- switch (id) {
154
- case "chatgpt": {
155
- return `https://chatgpt.com/?hints=search&q=${encoded(askPrompt(pageUrl))}`;
156
- }
157
- case "claude": {
158
- return `https://claude.ai/new?q=${encoded(askPrompt(pageUrl))}`;
159
- }
160
- case "perplexity": {
161
- return `https://www.perplexity.ai/?q=${encoded(askPrompt(pageUrl))}`;
162
- }
163
- case "grok": {
164
- return `https://grok.com/?q=${encoded(askPrompt(pageUrl))}`;
165
- }
166
- case "aistudio": {
167
- return `https://aistudio.google.com/prompts/new_chat?q=${encoded(askPrompt(pageUrl))}`;
168
- }
169
- case "gemini": {
170
- return `https://gemini.google.com/app?q=${encoded(askPrompt(pageUrl))}`;
171
- }
172
- case "devin": {
173
- return `https://app.devin.ai/sessions?url=${encoded(pageUrl)}`;
174
- }
175
- case "windsurf": {
176
- return `windsurf://cascade?url=${encoded(pageUrl)}`;
177
- }
178
- case "view": {
179
- const mdxPath = pagePath === "index" ? "/index" : `/${pagePath}`;
180
- return `${mdxPath}.mdx`;
181
- }
182
- case "cursor": {
183
- return mcpServerUrl
184
- ? `cursor://anysphere.cursor-deeplink/mcp/install?url=${encoded(mcpServerUrl)}`
185
- : null;
186
- }
187
- case "vscode": {
188
- return mcpServerUrl
189
- ? `vscode://anysphere.open-mcp?url=${encoded(mcpServerUrl)}`
190
- : null;
191
- }
192
- case "devin-mcp": {
193
- return mcpServerUrl
194
- ? `https://app.devin.ai/mcp/install?url=${encoded(mcpServerUrl)}`
195
- : null;
196
- }
197
- default: {
198
- return null;
199
- }
200
- }
201
- };
202
-
203
- export const resolveCustomHref = (
204
- href: ContextualCustomOption["href"],
205
- context: UrlContext
206
- ): string => {
207
- const substitute = (value: string) =>
208
- value
209
- .replaceAll("$page", context.pageContent)
210
- .replaceAll("$path", context.pagePath)
211
- .replaceAll("$mcp", context.mcpServerUrl ?? "");
212
-
213
- if (typeof href === "string") {
214
- return substitute(href);
215
- }
216
-
217
- const params = new URLSearchParams();
218
- for (const item of href.query) {
219
- params.set(item.key, substitute(item.value));
220
- }
221
- return `${href.base}?${params.toString()}`;
222
- };
@@ -1,167 +0,0 @@
1
- import {
2
- createRemoteJWKSet,
3
- decodeProtectedHeader,
4
- errors as joseErrors,
5
- jwtVerify,
6
- } from "jose";
7
- import { cookies } from "next/headers";
8
- import { cache } from "react";
9
-
10
- export interface DashboardSession {
11
- accessToken: string;
12
- authId: string;
13
- userEmail: string;
14
- userName: string;
15
- }
16
-
17
- const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL ?? "";
18
- const supabaseJwtSecret = process.env.SUPABASE_JWT_SECRET ?? "";
19
-
20
- let cachedSecret: Uint8Array | null = null;
21
- const getHmacKey = (): Uint8Array | null => {
22
- if (!supabaseJwtSecret) {
23
- return null;
24
- }
25
- if (!cachedSecret) {
26
- cachedSecret = new TextEncoder().encode(supabaseJwtSecret);
27
- }
28
- return cachedSecret;
29
- };
30
-
31
- let cachedJwks: ReturnType<typeof createRemoteJWKSet> | null = null;
32
- const getJwks = () => {
33
- if (!supabaseUrl) {
34
- return null;
35
- }
36
- if (!cachedJwks) {
37
- cachedJwks = createRemoteJWKSet(
38
- new URL(`${supabaseUrl.replace(/\/$/, "")}/auth/v1/.well-known/jwks.json`)
39
- );
40
- }
41
- return cachedJwks;
42
- };
43
-
44
- const getIssuer = (): string | undefined =>
45
- supabaseUrl ? `${supabaseUrl.replace(/\/$/, "")}/auth/v1` : undefined;
46
-
47
- const verifyAccessToken = (token: string) => {
48
- const header = decodeProtectedHeader(token);
49
- const options = {
50
- audience: "authenticated",
51
- clockTolerance: "5s",
52
- issuer: getIssuer(),
53
- };
54
- if (header.alg === "HS256") {
55
- const secret = getHmacKey();
56
- if (!secret) {
57
- throw new Error("SUPABASE_JWT_SECRET required for HS256 tokens.");
58
- }
59
- return jwtVerify(token, secret, { ...options, algorithms: ["HS256"] });
60
- }
61
- const jwks = getJwks();
62
- if (!jwks) {
63
- throw new Error("SUPABASE_URL required for asymmetric token verification.");
64
- }
65
- return jwtVerify(token, jwks, options);
66
- };
67
-
68
- // Supabase's auth-helpers cookie name is derived from the project ref. We
69
- // match the default pattern the browser client writes: `sb-<ref>-auth-token`.
70
- const getProjectRef = (): string | null => {
71
- if (!supabaseUrl) {
72
- return null;
73
- }
74
- const match = supabaseUrl.match(/https?:\/\/([^.]+)\./);
75
- return match?.[1] ?? null;
76
- };
77
-
78
- interface StoredSupabaseSession {
79
- access_token?: unknown;
80
- user?: {
81
- email?: unknown;
82
- user_metadata?: { full_name?: unknown; name?: unknown };
83
- };
84
- }
85
-
86
- const parseCookieValue = (value: string): StoredSupabaseSession | null => {
87
- // Supabase SSR stores either a JSON string or an array; both are URL-encoded.
88
- try {
89
- const decoded = value.startsWith("base64-")
90
- ? Buffer.from(value.slice(7), "base64").toString("utf8")
91
- : decodeURIComponent(value);
92
- const parsed = JSON.parse(decoded);
93
- if (Array.isArray(parsed)) {
94
- const [sessionBlob] = parsed;
95
- return typeof sessionBlob === "object"
96
- ? (sessionBlob as StoredSupabaseSession)
97
- : null;
98
- }
99
- return parsed as StoredSupabaseSession;
100
- } catch {
101
- return null;
102
- }
103
- };
104
-
105
- const readChunkedCookie = async (
106
- baseName: string
107
- ): Promise<StoredSupabaseSession | null> => {
108
- const store = await cookies();
109
- const direct = store.get(baseName)?.value;
110
- if (direct) {
111
- return parseCookieValue(direct);
112
- }
113
-
114
- // Supabase splits large cookies into baseName.0, baseName.1, ...
115
- const chunks: string[] = [];
116
- for (let i = 0; i < 10; i += 1) {
117
- const chunk = store.get(`${baseName}.${i}`)?.value;
118
- if (!chunk) {
119
- break;
120
- }
121
- chunks.push(chunk);
122
- }
123
- if (chunks.length === 0) {
124
- return null;
125
- }
126
- return parseCookieValue(chunks.join(""));
127
- };
128
-
129
- const asString = (value: unknown): string | null =>
130
- typeof value === "string" ? value : null;
131
-
132
- export const getDashboardSession = cache(
133
- async (): Promise<DashboardSession | null> => {
134
- const ref = getProjectRef();
135
- if (!ref) {
136
- return null;
137
- }
138
-
139
- const stored = await readChunkedCookie(`sb-${ref}-auth-token`);
140
- const accessToken = asString(stored?.access_token);
141
- if (!accessToken) {
142
- return null;
143
- }
144
-
145
- let authId: string;
146
- try {
147
- const { payload } = await verifyAccessToken(accessToken);
148
- const sub = asString(payload.sub);
149
- if (!sub) {
150
- return null;
151
- }
152
- authId = sub;
153
- } catch (error) {
154
- if (!(error instanceof joseErrors.JOSEError)) {
155
- throw error;
156
- }
157
- return null;
158
- }
159
-
160
- const userEmail = asString(stored?.user?.email) ?? "";
161
- const metadata = stored?.user?.user_metadata;
162
- const userName =
163
- asString(metadata?.full_name) ?? asString(metadata?.name) ?? userEmail;
164
-
165
- return { accessToken, authId, userEmail, userName };
166
- }
167
- );
package/docs/lib/db.ts DELETED
@@ -1,13 +0,0 @@
1
- import {
2
- DeploymentDao,
3
- DomainDao,
4
- GitConnectionDao,
5
- ProjectDao,
6
- UserDao,
7
- } from "@repo/db";
8
-
9
- export const projectDao = new ProjectDao();
10
- export const deploymentDao = new DeploymentDao();
11
- export const userDao = new UserDao();
12
- export const gitConnectionDao = new GitConnectionDao();
13
- export const domainDao = new DomainDao();
@@ -1,7 +0,0 @@
1
- // These helpers live in @repo/previewing; re-exported here so existing docs
2
- // imports keep working against the single shared implementation.
3
- export {
4
- getDocsCollection,
5
- getDocsCollectionWithNavigation,
6
- getDocsNavigation,
7
- } from "@repo/previewing";