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.
- package/README.md +26 -1
- package/dist/cli.mjs +217 -217
- package/dist/cli.mjs.map +1 -1
- package/package.json +3 -36
- package/dev-server/app/[[...slug]]/page.tsx +0 -140
- package/dev-server/app/blodemd-dev/invalidate/route.ts +0 -12
- package/dev-server/app/blodemd-dev/static/[...path]/route.ts +0 -32
- package/dev-server/app/blodemd-dev/version/route.ts +0 -14
- package/dev-server/app/blodemd-internal/proxy/route.ts +0 -86
- package/dev-server/app/error.tsx +0 -24
- package/dev-server/app/favicon.ico +0 -0
- package/dev-server/app/globals.css +0 -4
- package/dev-server/app/layout.tsx +0 -38
- package/dev-server/app/not-found.tsx +0 -18
- package/dev-server/app/search/route.ts +0 -17
- package/dev-server/components/dev-reload-script.tsx +0 -86
- package/dev-server/components/providers.tsx +0 -15
- package/dev-server/lib/dev-state.ts +0 -8
- package/dev-server/lib/local-content-source.ts +0 -103
- package/dev-server/lib/local-runtime.tsx +0 -555
- package/dev-server/next-env.d.ts +0 -5
- package/dev-server/next.config.js +0 -54
- package/dev-server/package.json +0 -61
- package/dev-server/postcss.config.mjs +0 -7
- package/dev-server/public/glide-variable.woff2 +0 -0
- package/dev-server/tsconfig.json +0 -50
- package/docs/app/globals.css +0 -471
- package/docs/components/animate-ui/primitives/buttons/button.tsx +0 -14
- package/docs/components/api/api-playground.tsx +0 -467
- package/docs/components/api/api-reference.tsx +0 -157
- package/docs/components/content/collection-index.tsx +0 -114
- package/docs/components/docs/contextual-menu.tsx +0 -495
- package/docs/components/docs/copy-page-menu.tsx +0 -364
- package/docs/components/docs/doc-header.tsx +0 -223
- package/docs/components/docs/doc-shell.tsx +0 -355
- package/docs/components/docs/doc-sidebar.tsx +0 -256
- package/docs/components/docs/doc-toc.tsx +0 -46
- package/docs/components/docs/mobile-nav.tsx +0 -195
- package/docs/components/docs/sidebar-active-highlight.tsx +0 -34
- package/docs/components/docs/sidebar-scroll-area.tsx +0 -63
- package/docs/components/git/repo-picker.tsx +0 -529
- package/docs/components/icons/doc-icon.tsx +0 -96
- package/docs/components/mdx/accordion.tsx +0 -83
- package/docs/components/mdx/agent-instructions.tsx +0 -17
- package/docs/components/mdx/badge.tsx +0 -79
- package/docs/components/mdx/callout.tsx +0 -88
- package/docs/components/mdx/card.tsx +0 -110
- package/docs/components/mdx/code-block.tsx +0 -80
- package/docs/components/mdx/code-group.tsx +0 -203
- package/docs/components/mdx/color.tsx +0 -87
- package/docs/components/mdx/columns.tsx +0 -25
- package/docs/components/mdx/expandable.tsx +0 -45
- package/docs/components/mdx/field-layout.tsx +0 -77
- package/docs/components/mdx/frame.tsx +0 -23
- package/docs/components/mdx/get-text-content.ts +0 -18
- package/docs/components/mdx/icon.tsx +0 -12
- package/docs/components/mdx/iframe.tsx +0 -62
- package/docs/components/mdx/index.tsx +0 -121
- package/docs/components/mdx/installer.tsx +0 -20
- package/docs/components/mdx/panel.tsx +0 -11
- package/docs/components/mdx/param-field.tsx +0 -56
- package/docs/components/mdx/preview.tsx +0 -36
- package/docs/components/mdx/prompt.tsx +0 -63
- package/docs/components/mdx/request-example.tsx +0 -27
- package/docs/components/mdx/response-field.tsx +0 -42
- package/docs/components/mdx/steps.tsx +0 -92
- package/docs/components/mdx/tabs.tsx +0 -193
- package/docs/components/mdx/tile.tsx +0 -43
- package/docs/components/mdx/tooltip.tsx +0 -71
- package/docs/components/mdx/tree.tsx +0 -120
- package/docs/components/mdx/type-table.tsx +0 -71
- package/docs/components/mdx/update.tsx +0 -44
- package/docs/components/mdx/video.tsx +0 -45
- package/docs/components/mdx/view.tsx +0 -66
- package/docs/components/posthog-provider.tsx +0 -42
- package/docs/components/providers.tsx +0 -15
- package/docs/components/tenant-analytics.tsx +0 -49
- package/docs/components/third-parties.tsx +0 -32
- package/docs/components/ui/badge.tsx +0 -61
- package/docs/components/ui/breadcrumb.tsx +0 -112
- package/docs/components/ui/button-group.tsx +0 -83
- package/docs/components/ui/button.tsx +0 -65
- package/docs/components/ui/card.tsx +0 -92
- package/docs/components/ui/command.tsx +0 -167
- package/docs/components/ui/copy-button.tsx +0 -129
- package/docs/components/ui/dialog.tsx +0 -146
- package/docs/components/ui/field.tsx +0 -237
- package/docs/components/ui/input.tsx +0 -23
- package/docs/components/ui/kbd.tsx +0 -98
- package/docs/components/ui/label.tsx +0 -22
- package/docs/components/ui/morph-icon.tsx +0 -79
- package/docs/components/ui/popover.tsx +0 -267
- package/docs/components/ui/search-dialog.tsx +0 -431
- package/docs/components/ui/search.tsx +0 -101
- package/docs/components/ui/separator.tsx +0 -26
- package/docs/components/ui/sheet.tsx +0 -133
- package/docs/components/ui/sidebar.tsx +0 -758
- package/docs/components/ui/skeleton.tsx +0 -11
- package/docs/components/ui/switch.tsx +0 -32
- package/docs/components/ui/tabs.tsx +0 -138
- package/docs/components/ui/theme-toggle.tsx +0 -62
- package/docs/components/ui/tooltip.tsx +0 -53
- package/docs/components/web-mcp.tsx +0 -115
- package/docs/lib/agent-skills.ts +0 -48
- package/docs/lib/api-client.ts +0 -72
- package/docs/lib/config.ts +0 -6
- package/docs/lib/content-root.ts +0 -33
- package/docs/lib/content-source.ts +0 -70
- package/docs/lib/contextual-options.ts +0 -222
- package/docs/lib/dashboard-session.ts +0 -167
- package/docs/lib/db.ts +0 -13
- package/docs/lib/docs-collection.ts +0 -7
- package/docs/lib/docs-runtime.tsx +0 -745
- package/docs/lib/edge-config.ts +0 -95
- package/docs/lib/env.ts +0 -23
- package/docs/lib/etag.ts +0 -22
- package/docs/lib/github-install.ts +0 -33
- package/docs/lib/llms-full.ts +0 -82
- package/docs/lib/marketing-markdown.ts +0 -79
- package/docs/lib/marketing-site.ts +0 -31
- package/docs/lib/mdx.ts +0 -98
- package/docs/lib/navigation.ts +0 -288
- package/docs/lib/openapi-proxy.ts +0 -88
- package/docs/lib/openapi.ts +0 -158
- package/docs/lib/platform-config.ts +0 -6
- package/docs/lib/project-authz.ts +0 -46
- package/docs/lib/routes.ts +0 -103
- package/docs/lib/server-cache.ts +0 -83
- package/docs/lib/shiki.ts +0 -44
- package/docs/lib/supabase.ts +0 -37
- package/docs/lib/tenancy.ts +0 -364
- package/docs/lib/tenant-headers.ts +0 -43
- package/docs/lib/tenant-static.ts +0 -705
- package/docs/lib/tenant-utility-context.ts +0 -62
- package/docs/lib/tenants.ts +0 -72
- package/docs/lib/theme.ts +0 -29
- package/docs/lib/time-ago.ts +0 -24
- package/docs/lib/toc.ts +0 -2
- package/docs/lib/use-mobile.ts +0 -19
- package/docs/lib/use-tab-observer.ts +0 -71
- package/docs/lib/utils.ts +0 -5
- package/packages/@repo/common/dist/index.d.ts +0 -16
- package/packages/@repo/common/dist/index.d.ts.map +0 -1
- package/packages/@repo/common/dist/index.js +0 -84
- package/packages/@repo/common/package.json +0 -34
- package/packages/@repo/common/src/index.ts +0 -101
- package/packages/@repo/contracts/dist/analytics.d.ts +0 -21
- package/packages/@repo/contracts/dist/analytics.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/analytics.js +0 -18
- package/packages/@repo/contracts/dist/dates.d.ts +0 -4
- package/packages/@repo/contracts/dist/dates.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/dates.js +0 -2
- package/packages/@repo/contracts/dist/deployment.d.ts +0 -71
- package/packages/@repo/contracts/dist/deployment.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/deployment.js +0 -46
- package/packages/@repo/contracts/dist/domain.d.ts +0 -94
- package/packages/@repo/contracts/dist/domain.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/domain.js +0 -36
- package/packages/@repo/contracts/dist/git.d.ts +0 -28
- package/packages/@repo/contracts/dist/git.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/git.js +0 -24
- package/packages/@repo/contracts/dist/ids.d.ts +0 -14
- package/packages/@repo/contracts/dist/ids.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/ids.js +0 -11
- package/packages/@repo/contracts/dist/index.d.ts +0 -11
- package/packages/@repo/contracts/dist/index.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/index.js +0 -12
- package/packages/@repo/contracts/dist/pagination.d.ts +0 -23
- package/packages/@repo/contracts/dist/pagination.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/pagination.js +0 -15
- package/packages/@repo/contracts/dist/project.d.ts +0 -42
- package/packages/@repo/contracts/dist/project.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/project.js +0 -25
- package/packages/@repo/contracts/dist/tenant.d.ts +0 -147
- package/packages/@repo/contracts/dist/tenant.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/tenant.js +0 -58
- package/packages/@repo/contracts/dist/user.d.ts +0 -9
- package/packages/@repo/contracts/dist/user.d.ts.map +0 -1
- package/packages/@repo/contracts/dist/user.js +0 -9
- package/packages/@repo/contracts/package.json +0 -37
- package/packages/@repo/contracts/src/analytics.ts +0 -33
- package/packages/@repo/contracts/src/dates.ts +0 -4
- package/packages/@repo/contracts/src/deployment.ts +0 -73
- package/packages/@repo/contracts/src/domain.ts +0 -51
- package/packages/@repo/contracts/src/git.ts +0 -31
- package/packages/@repo/contracts/src/ids.ts +0 -23
- package/packages/@repo/contracts/src/index.ts +0 -12
- package/packages/@repo/contracts/src/pagination.ts +0 -21
- package/packages/@repo/contracts/src/project.ts +0 -32
- package/packages/@repo/contracts/src/tenant.ts +0 -94
- package/packages/@repo/contracts/src/user.ts +0 -12
- package/packages/@repo/models/dist/docs-config.d.ts +0 -961
- package/packages/@repo/models/dist/docs-config.d.ts.map +0 -1
- package/packages/@repo/models/dist/docs-config.js +0 -531
- package/packages/@repo/models/dist/index.d.ts +0 -3
- package/packages/@repo/models/dist/index.d.ts.map +0 -1
- package/packages/@repo/models/dist/index.js +0 -3
- package/packages/@repo/models/dist/tenant.d.ts +0 -37
- package/packages/@repo/models/dist/tenant.d.ts.map +0 -1
- package/packages/@repo/models/dist/tenant.js +0 -1
- package/packages/@repo/models/package.json +0 -37
- package/packages/@repo/models/src/docs-config.ts +0 -629
- package/packages/@repo/models/src/index.ts +0 -3
- package/packages/@repo/models/src/tenant.ts +0 -44
- package/packages/@repo/prebuild/dist/index.d.ts +0 -2
- package/packages/@repo/prebuild/dist/index.d.ts.map +0 -1
- package/packages/@repo/prebuild/dist/index.js +0 -2
- package/packages/@repo/prebuild/dist/openapi.d.ts +0 -43
- package/packages/@repo/prebuild/dist/openapi.d.ts.map +0 -1
- package/packages/@repo/prebuild/dist/openapi.js +0 -86
- package/packages/@repo/prebuild/package.json +0 -39
- package/packages/@repo/prebuild/src/index.ts +0 -2
- package/packages/@repo/prebuild/src/openapi.ts +0 -154
- package/packages/@repo/previewing/dist/blob-source.d.ts +0 -16
- package/packages/@repo/previewing/dist/blob-source.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/blob-source.js +0 -128
- package/packages/@repo/previewing/dist/config-loader.d.ts +0 -134
- package/packages/@repo/previewing/dist/config-loader.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/config-loader.js +0 -231
- package/packages/@repo/previewing/dist/constants.d.ts +0 -15
- package/packages/@repo/previewing/dist/constants.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/constants.js +0 -14
- package/packages/@repo/previewing/dist/content-index.d.ts +0 -7
- package/packages/@repo/previewing/dist/content-index.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/content-index.js +0 -291
- package/packages/@repo/previewing/dist/content-source.d.ts +0 -12
- package/packages/@repo/previewing/dist/content-source.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/content-source.js +0 -1
- package/packages/@repo/previewing/dist/fs-source.d.ts +0 -11
- package/packages/@repo/previewing/dist/fs-source.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/fs-source.js +0 -71
- package/packages/@repo/previewing/dist/index.d.ts +0 -16
- package/packages/@repo/previewing/dist/index.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/index.js +0 -13
- package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts +0 -3
- package/packages/@repo/previewing/dist/markdown/agent-markdown.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/markdown/agent-markdown.js +0 -176
- package/packages/@repo/previewing/dist/markdown/format.d.ts +0 -8
- package/packages/@repo/previewing/dist/markdown/format.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/markdown/format.js +0 -43
- package/packages/@repo/previewing/dist/markdown/links.d.ts +0 -3
- package/packages/@repo/previewing/dist/markdown/links.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/markdown/links.js +0 -31
- package/packages/@repo/previewing/dist/openapi-pages.d.ts +0 -7
- package/packages/@repo/previewing/dist/openapi-pages.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/openapi-pages.js +0 -200
- package/packages/@repo/previewing/dist/search-index.d.ts +0 -4
- package/packages/@repo/previewing/dist/search-index.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/search-index.js +0 -23
- package/packages/@repo/previewing/dist/serialization.d.ts +0 -13
- package/packages/@repo/previewing/dist/serialization.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/serialization.js +0 -108
- package/packages/@repo/previewing/dist/toc-index.d.ts +0 -5
- package/packages/@repo/previewing/dist/toc-index.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/toc-index.js +0 -53
- package/packages/@repo/previewing/dist/types.d.ts +0 -92
- package/packages/@repo/previewing/dist/types.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/types.js +0 -1
- package/packages/@repo/previewing/dist/utility-index.d.ts +0 -7
- package/packages/@repo/previewing/dist/utility-index.d.ts.map +0 -1
- package/packages/@repo/previewing/dist/utility-index.js +0 -201
- package/packages/@repo/previewing/package.json +0 -41
- package/packages/@repo/previewing/src/blob-source.ts +0 -185
- package/packages/@repo/previewing/src/config-loader.ts +0 -316
- package/packages/@repo/previewing/src/constants.ts +0 -16
- package/packages/@repo/previewing/src/content-index.ts +0 -384
- package/packages/@repo/previewing/src/content-source.ts +0 -12
- package/packages/@repo/previewing/src/fs-source.ts +0 -103
- package/packages/@repo/previewing/src/index.ts +0 -71
- package/packages/@repo/previewing/src/markdown/agent-markdown.ts +0 -254
- package/packages/@repo/previewing/src/markdown/format.ts +0 -63
- package/packages/@repo/previewing/src/markdown/links.ts +0 -46
- package/packages/@repo/previewing/src/openapi-pages.ts +0 -319
- package/packages/@repo/previewing/src/search-index.ts +0 -38
- package/packages/@repo/previewing/src/serialization.ts +0 -191
- package/packages/@repo/previewing/src/toc-index.ts +0 -72
- package/packages/@repo/previewing/src/types.ts +0 -105
- package/packages/@repo/previewing/src/utility-index.ts +0 -304
- package/packages/@repo/validation/dist/index.d.ts +0 -12
- package/packages/@repo/validation/dist/index.d.ts.map +0 -1
- package/packages/@repo/validation/dist/index.js +0 -30
- package/packages/@repo/validation/package.json +0 -38
- package/packages/@repo/validation/src/blodemd-docs-schema.json +0 -3575
- package/packages/@repo/validation/src/index.ts +0 -59
- package/scripts/prepare-package.mjs +0 -53
- 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();
|