blodemd 0.1.0 → 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 (289) hide show
  1. package/dist/cli.mjs +50 -174
  2. package/dist/cli.mjs.map +1 -1
  3. package/package.json +3 -36
  4. package/dev-server/app/[[...slug]]/page.tsx +0 -140
  5. package/dev-server/app/blodemd-dev/invalidate/route.ts +0 -12
  6. package/dev-server/app/blodemd-dev/static/[...path]/route.ts +0 -32
  7. package/dev-server/app/blodemd-dev/version/route.ts +0 -14
  8. package/dev-server/app/blodemd-internal/proxy/route.ts +0 -86
  9. package/dev-server/app/error.tsx +0 -24
  10. package/dev-server/app/favicon.ico +0 -0
  11. package/dev-server/app/globals.css +0 -4
  12. package/dev-server/app/layout.tsx +0 -38
  13. package/dev-server/app/not-found.tsx +0 -18
  14. package/dev-server/app/search/route.ts +0 -17
  15. package/dev-server/components/dev-reload-script.tsx +0 -86
  16. package/dev-server/components/providers.tsx +0 -15
  17. package/dev-server/lib/dev-state.ts +0 -8
  18. package/dev-server/lib/local-content-source.ts +0 -103
  19. package/dev-server/lib/local-runtime.tsx +0 -555
  20. package/dev-server/next-env.d.ts +0 -5
  21. package/dev-server/next.config.js +0 -54
  22. package/dev-server/package.json +0 -61
  23. package/dev-server/postcss.config.mjs +0 -7
  24. package/dev-server/public/glide-variable.woff2 +0 -0
  25. package/dev-server/tsconfig.json +0 -50
  26. package/docs/app/globals.css +0 -471
  27. package/docs/components/animate-ui/primitives/buttons/button.tsx +0 -14
  28. package/docs/components/api/api-playground.tsx +0 -467
  29. package/docs/components/api/api-reference.tsx +0 -157
  30. package/docs/components/content/collection-index.tsx +0 -114
  31. package/docs/components/docs/contextual-menu.tsx +0 -495
  32. package/docs/components/docs/copy-page-menu.tsx +0 -364
  33. package/docs/components/docs/doc-header.tsx +0 -223
  34. package/docs/components/docs/doc-shell.tsx +0 -355
  35. package/docs/components/docs/doc-sidebar.tsx +0 -256
  36. package/docs/components/docs/doc-toc.tsx +0 -46
  37. package/docs/components/docs/mobile-nav.tsx +0 -195
  38. package/docs/components/docs/sidebar-active-highlight.tsx +0 -34
  39. package/docs/components/docs/sidebar-scroll-area.tsx +0 -63
  40. package/docs/components/git/repo-picker.tsx +0 -529
  41. package/docs/components/icons/doc-icon.tsx +0 -96
  42. package/docs/components/mdx/accordion.tsx +0 -83
  43. package/docs/components/mdx/agent-instructions.tsx +0 -17
  44. package/docs/components/mdx/badge.tsx +0 -79
  45. package/docs/components/mdx/callout.tsx +0 -88
  46. package/docs/components/mdx/card.tsx +0 -110
  47. package/docs/components/mdx/code-block.tsx +0 -80
  48. package/docs/components/mdx/code-group.tsx +0 -203
  49. package/docs/components/mdx/color.tsx +0 -87
  50. package/docs/components/mdx/columns.tsx +0 -25
  51. package/docs/components/mdx/expandable.tsx +0 -45
  52. package/docs/components/mdx/field-layout.tsx +0 -77
  53. package/docs/components/mdx/frame.tsx +0 -23
  54. package/docs/components/mdx/get-text-content.ts +0 -18
  55. package/docs/components/mdx/icon.tsx +0 -12
  56. package/docs/components/mdx/iframe.tsx +0 -62
  57. package/docs/components/mdx/index.tsx +0 -121
  58. package/docs/components/mdx/installer.tsx +0 -20
  59. package/docs/components/mdx/panel.tsx +0 -11
  60. package/docs/components/mdx/param-field.tsx +0 -56
  61. package/docs/components/mdx/preview.tsx +0 -36
  62. package/docs/components/mdx/prompt.tsx +0 -63
  63. package/docs/components/mdx/request-example.tsx +0 -27
  64. package/docs/components/mdx/response-field.tsx +0 -42
  65. package/docs/components/mdx/steps.tsx +0 -92
  66. package/docs/components/mdx/tabs.tsx +0 -193
  67. package/docs/components/mdx/tile.tsx +0 -43
  68. package/docs/components/mdx/tooltip.tsx +0 -71
  69. package/docs/components/mdx/tree.tsx +0 -120
  70. package/docs/components/mdx/type-table.tsx +0 -71
  71. package/docs/components/mdx/update.tsx +0 -44
  72. package/docs/components/mdx/video.tsx +0 -45
  73. package/docs/components/mdx/view.tsx +0 -66
  74. package/docs/components/posthog-provider.tsx +0 -42
  75. package/docs/components/providers.tsx +0 -15
  76. package/docs/components/tenant-analytics.tsx +0 -49
  77. package/docs/components/third-parties.tsx +0 -32
  78. package/docs/components/ui/badge.tsx +0 -61
  79. package/docs/components/ui/breadcrumb.tsx +0 -112
  80. package/docs/components/ui/button-group.tsx +0 -83
  81. package/docs/components/ui/button.tsx +0 -65
  82. package/docs/components/ui/card.tsx +0 -92
  83. package/docs/components/ui/command.tsx +0 -167
  84. package/docs/components/ui/copy-button.tsx +0 -129
  85. package/docs/components/ui/dialog.tsx +0 -146
  86. package/docs/components/ui/field.tsx +0 -237
  87. package/docs/components/ui/input.tsx +0 -23
  88. package/docs/components/ui/kbd.tsx +0 -98
  89. package/docs/components/ui/label.tsx +0 -22
  90. package/docs/components/ui/morph-icon.tsx +0 -79
  91. package/docs/components/ui/popover.tsx +0 -267
  92. package/docs/components/ui/search-dialog.tsx +0 -431
  93. package/docs/components/ui/search.tsx +0 -101
  94. package/docs/components/ui/separator.tsx +0 -26
  95. package/docs/components/ui/sheet.tsx +0 -133
  96. package/docs/components/ui/sidebar.tsx +0 -758
  97. package/docs/components/ui/skeleton.tsx +0 -11
  98. package/docs/components/ui/switch.tsx +0 -32
  99. package/docs/components/ui/tabs.tsx +0 -138
  100. package/docs/components/ui/theme-toggle.tsx +0 -62
  101. package/docs/components/ui/tooltip.tsx +0 -53
  102. package/docs/components/web-mcp.tsx +0 -115
  103. package/docs/lib/agent-skills.ts +0 -48
  104. package/docs/lib/api-client.ts +0 -72
  105. package/docs/lib/config.ts +0 -6
  106. package/docs/lib/content-root.ts +0 -33
  107. package/docs/lib/content-source.ts +0 -70
  108. package/docs/lib/contextual-options.ts +0 -222
  109. package/docs/lib/dashboard-session.ts +0 -167
  110. package/docs/lib/db.ts +0 -13
  111. package/docs/lib/docs-collection.ts +0 -7
  112. package/docs/lib/docs-runtime.tsx +0 -745
  113. package/docs/lib/edge-config.ts +0 -95
  114. package/docs/lib/env.ts +0 -23
  115. package/docs/lib/etag.ts +0 -22
  116. package/docs/lib/github-install.ts +0 -33
  117. package/docs/lib/llms-full.ts +0 -82
  118. package/docs/lib/marketing-markdown.ts +0 -79
  119. package/docs/lib/marketing-site.ts +0 -31
  120. package/docs/lib/mdx.ts +0 -98
  121. package/docs/lib/navigation.ts +0 -288
  122. package/docs/lib/openapi-proxy.ts +0 -88
  123. package/docs/lib/openapi.ts +0 -158
  124. package/docs/lib/platform-config.ts +0 -6
  125. package/docs/lib/project-authz.ts +0 -46
  126. package/docs/lib/routes.ts +0 -103
  127. package/docs/lib/server-cache.ts +0 -83
  128. package/docs/lib/shiki.ts +0 -44
  129. package/docs/lib/supabase.ts +0 -37
  130. package/docs/lib/tenancy.ts +0 -364
  131. package/docs/lib/tenant-headers.ts +0 -43
  132. package/docs/lib/tenant-static.ts +0 -705
  133. package/docs/lib/tenant-utility-context.ts +0 -62
  134. package/docs/lib/tenants.ts +0 -72
  135. package/docs/lib/theme.ts +0 -29
  136. package/docs/lib/time-ago.ts +0 -24
  137. package/docs/lib/toc.ts +0 -2
  138. package/docs/lib/use-mobile.ts +0 -19
  139. package/docs/lib/use-tab-observer.ts +0 -71
  140. package/docs/lib/utils.ts +0 -5
  141. package/packages/@repo/common/dist/index.d.ts +0 -16
  142. package/packages/@repo/common/dist/index.d.ts.map +0 -1
  143. package/packages/@repo/common/dist/index.js +0 -84
  144. package/packages/@repo/common/package.json +0 -34
  145. package/packages/@repo/common/src/index.ts +0 -101
  146. package/packages/@repo/contracts/dist/analytics.d.ts +0 -21
  147. package/packages/@repo/contracts/dist/analytics.d.ts.map +0 -1
  148. package/packages/@repo/contracts/dist/analytics.js +0 -18
  149. package/packages/@repo/contracts/dist/api-key.d.ts +0 -27
  150. package/packages/@repo/contracts/dist/api-key.d.ts.map +0 -1
  151. package/packages/@repo/contracts/dist/api-key.js +0 -20
  152. package/packages/@repo/contracts/dist/dates.d.ts +0 -4
  153. package/packages/@repo/contracts/dist/dates.d.ts.map +0 -1
  154. package/packages/@repo/contracts/dist/dates.js +0 -2
  155. package/packages/@repo/contracts/dist/deployment.d.ts +0 -71
  156. package/packages/@repo/contracts/dist/deployment.d.ts.map +0 -1
  157. package/packages/@repo/contracts/dist/deployment.js +0 -46
  158. package/packages/@repo/contracts/dist/domain.d.ts +0 -94
  159. package/packages/@repo/contracts/dist/domain.d.ts.map +0 -1
  160. package/packages/@repo/contracts/dist/domain.js +0 -36
  161. package/packages/@repo/contracts/dist/git.d.ts +0 -28
  162. package/packages/@repo/contracts/dist/git.d.ts.map +0 -1
  163. package/packages/@repo/contracts/dist/git.js +0 -24
  164. package/packages/@repo/contracts/dist/ids.d.ts +0 -14
  165. package/packages/@repo/contracts/dist/ids.d.ts.map +0 -1
  166. package/packages/@repo/contracts/dist/ids.js +0 -11
  167. package/packages/@repo/contracts/dist/index.d.ts +0 -12
  168. package/packages/@repo/contracts/dist/index.d.ts.map +0 -1
  169. package/packages/@repo/contracts/dist/index.js +0 -13
  170. package/packages/@repo/contracts/dist/pagination.d.ts +0 -23
  171. package/packages/@repo/contracts/dist/pagination.d.ts.map +0 -1
  172. package/packages/@repo/contracts/dist/pagination.js +0 -15
  173. package/packages/@repo/contracts/dist/project.d.ts +0 -42
  174. package/packages/@repo/contracts/dist/project.d.ts.map +0 -1
  175. package/packages/@repo/contracts/dist/project.js +0 -25
  176. package/packages/@repo/contracts/dist/tenant.d.ts +0 -147
  177. package/packages/@repo/contracts/dist/tenant.d.ts.map +0 -1
  178. package/packages/@repo/contracts/dist/tenant.js +0 -58
  179. package/packages/@repo/contracts/dist/user.d.ts +0 -9
  180. package/packages/@repo/contracts/dist/user.d.ts.map +0 -1
  181. package/packages/@repo/contracts/dist/user.js +0 -9
  182. package/packages/@repo/contracts/package.json +0 -37
  183. package/packages/@repo/contracts/src/analytics.ts +0 -33
  184. package/packages/@repo/contracts/src/api-key.ts +0 -27
  185. package/packages/@repo/contracts/src/dates.ts +0 -4
  186. package/packages/@repo/contracts/src/deployment.ts +0 -73
  187. package/packages/@repo/contracts/src/domain.ts +0 -51
  188. package/packages/@repo/contracts/src/git.ts +0 -31
  189. package/packages/@repo/contracts/src/ids.ts +0 -23
  190. package/packages/@repo/contracts/src/index.ts +0 -13
  191. package/packages/@repo/contracts/src/pagination.ts +0 -21
  192. package/packages/@repo/contracts/src/project.ts +0 -32
  193. package/packages/@repo/contracts/src/tenant.ts +0 -94
  194. package/packages/@repo/contracts/src/user.ts +0 -12
  195. package/packages/@repo/models/dist/docs-config.d.ts +0 -961
  196. package/packages/@repo/models/dist/docs-config.d.ts.map +0 -1
  197. package/packages/@repo/models/dist/docs-config.js +0 -531
  198. package/packages/@repo/models/dist/index.d.ts +0 -3
  199. package/packages/@repo/models/dist/index.d.ts.map +0 -1
  200. package/packages/@repo/models/dist/index.js +0 -3
  201. package/packages/@repo/models/dist/tenant.d.ts +0 -37
  202. package/packages/@repo/models/dist/tenant.d.ts.map +0 -1
  203. package/packages/@repo/models/dist/tenant.js +0 -1
  204. package/packages/@repo/models/package.json +0 -37
  205. package/packages/@repo/models/src/docs-config.ts +0 -629
  206. package/packages/@repo/models/src/index.ts +0 -3
  207. package/packages/@repo/models/src/tenant.ts +0 -44
  208. package/packages/@repo/prebuild/dist/index.d.ts +0 -2
  209. package/packages/@repo/prebuild/dist/index.d.ts.map +0 -1
  210. package/packages/@repo/prebuild/dist/index.js +0 -2
  211. package/packages/@repo/prebuild/dist/openapi.d.ts +0 -43
  212. package/packages/@repo/prebuild/dist/openapi.d.ts.map +0 -1
  213. package/packages/@repo/prebuild/dist/openapi.js +0 -86
  214. package/packages/@repo/prebuild/package.json +0 -39
  215. package/packages/@repo/prebuild/src/index.ts +0 -2
  216. package/packages/@repo/prebuild/src/openapi.ts +0 -154
  217. package/packages/@repo/previewing/dist/blob-source.d.ts +0 -16
  218. package/packages/@repo/previewing/dist/blob-source.d.ts.map +0 -1
  219. package/packages/@repo/previewing/dist/blob-source.js +0 -128
  220. package/packages/@repo/previewing/dist/config-loader.d.ts +0 -134
  221. package/packages/@repo/previewing/dist/config-loader.d.ts.map +0 -1
  222. package/packages/@repo/previewing/dist/config-loader.js +0 -231
  223. package/packages/@repo/previewing/dist/constants.d.ts +0 -15
  224. package/packages/@repo/previewing/dist/constants.d.ts.map +0 -1
  225. package/packages/@repo/previewing/dist/constants.js +0 -14
  226. package/packages/@repo/previewing/dist/content-index.d.ts +0 -7
  227. package/packages/@repo/previewing/dist/content-index.d.ts.map +0 -1
  228. package/packages/@repo/previewing/dist/content-index.js +0 -291
  229. package/packages/@repo/previewing/dist/content-source.d.ts +0 -12
  230. package/packages/@repo/previewing/dist/content-source.d.ts.map +0 -1
  231. package/packages/@repo/previewing/dist/content-source.js +0 -1
  232. package/packages/@repo/previewing/dist/fs-source.d.ts +0 -11
  233. package/packages/@repo/previewing/dist/fs-source.d.ts.map +0 -1
  234. package/packages/@repo/previewing/dist/fs-source.js +0 -71
  235. package/packages/@repo/previewing/dist/index.d.ts +0 -16
  236. package/packages/@repo/previewing/dist/index.d.ts.map +0 -1
  237. package/packages/@repo/previewing/dist/index.js +0 -13
  238. package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts +0 -3
  239. package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts.map +0 -1
  240. package/packages/@repo/previewing/dist/markdown/agent-markdown.js +0 -176
  241. package/packages/@repo/previewing/dist/markdown/format.d.ts +0 -8
  242. package/packages/@repo/previewing/dist/markdown/format.d.ts.map +0 -1
  243. package/packages/@repo/previewing/dist/markdown/format.js +0 -43
  244. package/packages/@repo/previewing/dist/markdown/links.d.ts +0 -3
  245. package/packages/@repo/previewing/dist/markdown/links.d.ts.map +0 -1
  246. package/packages/@repo/previewing/dist/markdown/links.js +0 -31
  247. package/packages/@repo/previewing/dist/openapi-pages.d.ts +0 -7
  248. package/packages/@repo/previewing/dist/openapi-pages.d.ts.map +0 -1
  249. package/packages/@repo/previewing/dist/openapi-pages.js +0 -200
  250. package/packages/@repo/previewing/dist/search-index.d.ts +0 -4
  251. package/packages/@repo/previewing/dist/search-index.d.ts.map +0 -1
  252. package/packages/@repo/previewing/dist/search-index.js +0 -23
  253. package/packages/@repo/previewing/dist/serialization.d.ts +0 -13
  254. package/packages/@repo/previewing/dist/serialization.d.ts.map +0 -1
  255. package/packages/@repo/previewing/dist/serialization.js +0 -108
  256. package/packages/@repo/previewing/dist/toc-index.d.ts +0 -5
  257. package/packages/@repo/previewing/dist/toc-index.d.ts.map +0 -1
  258. package/packages/@repo/previewing/dist/toc-index.js +0 -53
  259. package/packages/@repo/previewing/dist/types.d.ts +0 -92
  260. package/packages/@repo/previewing/dist/types.d.ts.map +0 -1
  261. package/packages/@repo/previewing/dist/types.js +0 -1
  262. package/packages/@repo/previewing/dist/utility-index.d.ts +0 -7
  263. package/packages/@repo/previewing/dist/utility-index.d.ts.map +0 -1
  264. package/packages/@repo/previewing/dist/utility-index.js +0 -201
  265. package/packages/@repo/previewing/package.json +0 -41
  266. package/packages/@repo/previewing/src/blob-source.ts +0 -185
  267. package/packages/@repo/previewing/src/config-loader.ts +0 -316
  268. package/packages/@repo/previewing/src/constants.ts +0 -16
  269. package/packages/@repo/previewing/src/content-index.ts +0 -384
  270. package/packages/@repo/previewing/src/content-source.ts +0 -12
  271. package/packages/@repo/previewing/src/fs-source.ts +0 -103
  272. package/packages/@repo/previewing/src/index.ts +0 -71
  273. package/packages/@repo/previewing/src/markdown/agent-markdown.ts +0 -254
  274. package/packages/@repo/previewing/src/markdown/format.ts +0 -63
  275. package/packages/@repo/previewing/src/markdown/links.ts +0 -46
  276. package/packages/@repo/previewing/src/openapi-pages.ts +0 -319
  277. package/packages/@repo/previewing/src/search-index.ts +0 -38
  278. package/packages/@repo/previewing/src/serialization.ts +0 -191
  279. package/packages/@repo/previewing/src/toc-index.ts +0 -72
  280. package/packages/@repo/previewing/src/types.ts +0 -105
  281. package/packages/@repo/previewing/src/utility-index.ts +0 -304
  282. package/packages/@repo/validation/dist/index.d.ts +0 -12
  283. package/packages/@repo/validation/dist/index.d.ts.map +0 -1
  284. package/packages/@repo/validation/dist/index.js +0 -30
  285. package/packages/@repo/validation/package.json +0 -38
  286. package/packages/@repo/validation/src/blodemd-docs-schema.json +0 -3575
  287. package/packages/@repo/validation/src/index.ts +0 -59
  288. package/scripts/prepare-package.mjs +0 -53
  289. 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";