@krak-stack/registry 0.1.11 → 0.1.14
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 +31 -2
- package/dist/components/ui/app-brand.d.ts +18 -13
- package/dist/components/ui/app-brand.js +48 -15
- package/dist/components/ui/code-block.js +10 -6
- package/dist/components/ui/copy-button.d.ts +1 -1
- package/dist/components/ui/copy-button.js +1 -1
- package/dist/components/ui/data-table.d.ts +1 -1
- package/dist/components/ui/data-table.js +21 -20
- package/dist/components/ui/effect-form.js +7 -6
- package/dist/components/ui/file-picker.js +2 -1
- package/dist/components/ui/form.js +17 -15
- package/dist/components/ui/google-map.d.ts +6 -10
- package/dist/components/ui/google-map.js +19 -14
- package/dist/components/ui/locale-switcher.js +7 -1
- package/dist/components/ui/sidebar-layout.js +19 -21
- package/dist/components/ui/theme-switcher.js +1 -1
- package/dist/lib/docs-core.js +165 -109
- package/dist/lib/documentation-toolkit.d.ts +140 -0
- package/dist/lib/{docs-ai.js → documentation-toolkit.js} +54 -63
- package/dist/lib/httpapi-cli.d.ts +6 -6
- package/dist/lib/httpapi-cli.js +75 -48
- package/dist/lib/httpapi-client.d.ts +8 -2
- package/dist/lib/httpapi-client.js +21 -9
- package/dist/lib/httpapi-helpers.d.ts +15 -21
- package/dist/lib/httpapi-helpers.js +38 -26
- package/dist/lib/httpapi-mcp.js +73 -50
- package/dist/lib/httpapi-toolkit.d.ts +20 -0
- package/dist/lib/{httpapi-ai.js → httpapi-toolkit.js} +123 -100
- package/dist/lib/seo.js +29 -17
- package/dist/lib/webfetch-toolkit.d.ts +45 -0
- package/dist/lib/webfetch-toolkit.js +276 -0
- package/dist/oxlint/anti-slop/index.js +1592 -0
- package/dist/services/agent/client/atom.d.ts +7 -7
- package/dist/services/agent/client/index.js +55 -54
- package/dist/services/agent/index.d.ts +71 -71
- package/dist/services/agent/index.js +38 -19
- package/dist/services/notification/channels/index.d.ts +11 -9
- package/dist/services/notification/channels/ses/index.d.ts +6 -6
- package/dist/services/notification/channels/ses/index.js +15 -11
- package/dist/services/notification/client/index.js +3 -2
- package/dist/services/notification/client/notification-menu.d.ts +9 -9
- package/dist/services/notification/index.d.ts +7 -6
- package/dist/services/notification/persistence/drizzle.js +214 -0
- package/dist/services/notification/persistence/index.js +227 -0
- package/dist/services/notification/persistence/schema.js +118 -0
- package/dist/services/notification/public.js +3 -2
- package/dist/services/s3/index.d.ts +2 -16
- package/dist/services/s3/index.js +12 -9
- package/package.json +33 -7
- package/dist/lib/docs-ai.d.ts +0 -142
- package/dist/lib/httpapi-ai.d.ts +0 -54
package/dist/lib/docs-core.js
CHANGED
|
@@ -3,7 +3,7 @@ import { icons as lucideIcons } from "@iconify-json/lucide";
|
|
|
3
3
|
import { Icon, addCollection } from "@iconify/react";
|
|
4
4
|
import { code } from "@streamdown/code";
|
|
5
5
|
import { Link as Link3, useNavigate } from "@tanstack/react-router";
|
|
6
|
-
import { Schema as
|
|
6
|
+
import { Schema as Schema3 } from "effect";
|
|
7
7
|
import {
|
|
8
8
|
Children,
|
|
9
9
|
forwardRef,
|
|
@@ -16,17 +16,17 @@ import { parse } from "yaml";
|
|
|
16
16
|
// ../../src/components/ui/app-brand.tsx
|
|
17
17
|
import { Link } from "@tanstack/react-router";
|
|
18
18
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
19
|
+
var isStaticBrand = (props) => props.to === null;
|
|
20
|
+
var isAnchorBrand = (props) => props.href !== undefined;
|
|
21
|
+
function AppBrand(brandProps) {
|
|
22
|
+
const {
|
|
23
|
+
className,
|
|
24
|
+
label,
|
|
25
|
+
subtitle,
|
|
26
|
+
icon: Icon,
|
|
27
|
+
imageSrc,
|
|
28
|
+
variant = "default"
|
|
29
|
+
} = brandProps;
|
|
30
30
|
const iconClassName = variant === "sidebar" ? "bg-sidebar-primary" : "bg-primary";
|
|
31
31
|
const iconColor = variant === "sidebar" ? "var(--sidebar-primary-foreground)" : "var(--primary-foreground)";
|
|
32
32
|
const contentClassName = variant === "sidebar" ? "group-data-[collapsible=icon]:hidden" : undefined;
|
|
@@ -66,21 +66,54 @@ function AppBrand({
|
|
|
66
66
|
variant === "sidebar" ? "p-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:p-0" : "",
|
|
67
67
|
className
|
|
68
68
|
].filter(Boolean).join(" ");
|
|
69
|
-
if (
|
|
69
|
+
if (isStaticBrand(brandProps)) {
|
|
70
|
+
const {
|
|
71
|
+
className: _className2,
|
|
72
|
+
label: _label2,
|
|
73
|
+
subtitle: _subtitle2,
|
|
74
|
+
icon: _icon2,
|
|
75
|
+
imageSrc: _imageSrc2,
|
|
76
|
+
variant: _variant2,
|
|
77
|
+
to: _to,
|
|
78
|
+
href: _href2,
|
|
79
|
+
...props2
|
|
80
|
+
} = brandProps;
|
|
70
81
|
return /* @__PURE__ */ jsx("div", {
|
|
71
82
|
className: brandClassName,
|
|
72
|
-
...
|
|
83
|
+
...props2,
|
|
73
84
|
children: content
|
|
74
85
|
});
|
|
75
86
|
}
|
|
76
|
-
if (
|
|
87
|
+
if (isAnchorBrand(brandProps)) {
|
|
88
|
+
const {
|
|
89
|
+
className: _className2,
|
|
90
|
+
label: _label2,
|
|
91
|
+
subtitle: _subtitle2,
|
|
92
|
+
icon: _icon2,
|
|
93
|
+
imageSrc: _imageSrc2,
|
|
94
|
+
variant: _variant2,
|
|
95
|
+
to: _to,
|
|
96
|
+
href,
|
|
97
|
+
...props2
|
|
98
|
+
} = brandProps;
|
|
77
99
|
return /* @__PURE__ */ jsx("a", {
|
|
78
100
|
className: brandClassName,
|
|
79
101
|
href,
|
|
80
|
-
...
|
|
102
|
+
...props2,
|
|
81
103
|
children: content
|
|
82
104
|
});
|
|
83
105
|
}
|
|
106
|
+
const {
|
|
107
|
+
className: _className,
|
|
108
|
+
label: _label,
|
|
109
|
+
subtitle: _subtitle,
|
|
110
|
+
icon: _icon,
|
|
111
|
+
imageSrc: _imageSrc,
|
|
112
|
+
variant: _variant,
|
|
113
|
+
href: _href,
|
|
114
|
+
to,
|
|
115
|
+
...props
|
|
116
|
+
} = brandProps;
|
|
84
117
|
return /* @__PURE__ */ jsx(Link, {
|
|
85
118
|
to: to ?? "/",
|
|
86
119
|
className: brandClassName,
|
|
@@ -960,7 +993,7 @@ function SearchMenu({
|
|
|
960
993
|
import { useAtom } from "@effect/atom-react";
|
|
961
994
|
import { BrowserKeyValueStore } from "@effect/platform-browser";
|
|
962
995
|
import { Link as Link2, Outlet, useRouterState } from "@tanstack/react-router";
|
|
963
|
-
import { Schema } from "effect";
|
|
996
|
+
import { Schema as Schema2 } from "effect";
|
|
964
997
|
import { Atom } from "effect/unstable/reactivity";
|
|
965
998
|
|
|
966
999
|
// ../../src/components/ui/badge.tsx
|
|
@@ -1170,6 +1203,7 @@ function TooltipContent({
|
|
|
1170
1203
|
|
|
1171
1204
|
// ../../src/components/ui/sidebar.tsx
|
|
1172
1205
|
import { PanelLeftIcon } from "lucide-react";
|
|
1206
|
+
import { Schema } from "effect";
|
|
1173
1207
|
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1174
1208
|
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
1175
1209
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
@@ -1198,18 +1232,17 @@ function SidebarProvider({
|
|
|
1198
1232
|
const [openMobile, setOpenMobile] = React2.useState(false);
|
|
1199
1233
|
const [_open, _setOpen] = React2.useState(defaultOpen);
|
|
1200
1234
|
const open = openProp ?? _open;
|
|
1201
|
-
const setOpen = React2.useCallback((
|
|
1202
|
-
const openState = typeof value === "function" ? value(open) : value;
|
|
1235
|
+
const setOpen = React2.useCallback((openState) => {
|
|
1203
1236
|
if (setOpenProp) {
|
|
1204
1237
|
setOpenProp(openState);
|
|
1205
1238
|
} else {
|
|
1206
1239
|
_setOpen(openState);
|
|
1207
1240
|
}
|
|
1208
1241
|
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
1209
|
-
}, [setOpenProp
|
|
1242
|
+
}, [setOpenProp]);
|
|
1210
1243
|
const toggleSidebar = React2.useCallback(() => {
|
|
1211
|
-
return isMobile ? setOpenMobile((open2) => !open2) : setOpen(
|
|
1212
|
-
}, [isMobile, setOpen, setOpenMobile]);
|
|
1244
|
+
return isMobile ? setOpenMobile((open2) => !open2) : setOpen(!open);
|
|
1245
|
+
}, [isMobile, open, setOpen, setOpenMobile]);
|
|
1213
1246
|
React2.useEffect(() => {
|
|
1214
1247
|
const handleKeyDown = (event) => {
|
|
1215
1248
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
@@ -1230,15 +1263,16 @@ function SidebarProvider({
|
|
|
1230
1263
|
setOpenMobile,
|
|
1231
1264
|
toggleSidebar
|
|
1232
1265
|
}), [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]);
|
|
1266
|
+
const wrapperStyle = {
|
|
1267
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
1268
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
1269
|
+
...style
|
|
1270
|
+
};
|
|
1233
1271
|
return /* @__PURE__ */ jsx12(SidebarContext.Provider, {
|
|
1234
1272
|
value: contextValue,
|
|
1235
1273
|
children: /* @__PURE__ */ jsx12("div", {
|
|
1236
1274
|
"data-slot": "sidebar-wrapper",
|
|
1237
|
-
style:
|
|
1238
|
-
"--sidebar-width": SIDEBAR_WIDTH,
|
|
1239
|
-
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
1240
|
-
...style
|
|
1241
|
-
},
|
|
1275
|
+
style: wrapperStyle,
|
|
1242
1276
|
className: cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", className),
|
|
1243
1277
|
...props,
|
|
1244
1278
|
children
|
|
@@ -1264,6 +1298,9 @@ function Sidebar({
|
|
|
1264
1298
|
});
|
|
1265
1299
|
}
|
|
1266
1300
|
if (isMobile) {
|
|
1301
|
+
const mobileStyle = {
|
|
1302
|
+
"--sidebar-width": SIDEBAR_WIDTH_MOBILE
|
|
1303
|
+
};
|
|
1267
1304
|
return /* @__PURE__ */ jsx12(Sheet, {
|
|
1268
1305
|
open: openMobile,
|
|
1269
1306
|
onOpenChange: setOpenMobile,
|
|
@@ -1274,9 +1311,7 @@ function Sidebar({
|
|
|
1274
1311
|
"data-slot": "sidebar",
|
|
1275
1312
|
"data-mobile": "true",
|
|
1276
1313
|
className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
|
|
1277
|
-
style:
|
|
1278
|
-
"--sidebar-width": SIDEBAR_WIDTH_MOBILE
|
|
1279
|
-
},
|
|
1314
|
+
style: mobileStyle,
|
|
1280
1315
|
side,
|
|
1281
1316
|
children: [
|
|
1282
1317
|
/* @__PURE__ */ jsxs7(SheetHeader, {
|
|
@@ -1492,11 +1527,7 @@ function SidebarMenuButton({
|
|
|
1492
1527
|
if (!tooltip) {
|
|
1493
1528
|
return comp;
|
|
1494
1529
|
}
|
|
1495
|
-
|
|
1496
|
-
tooltip = {
|
|
1497
|
-
children: tooltip
|
|
1498
|
-
};
|
|
1499
|
-
}
|
|
1530
|
+
const tooltipProps = Schema.is(Schema.String)(tooltip) ? { children: tooltip } : tooltip;
|
|
1500
1531
|
return /* @__PURE__ */ jsxs7(Tooltip, {
|
|
1501
1532
|
children: [
|
|
1502
1533
|
comp,
|
|
@@ -1504,7 +1535,7 @@ function SidebarMenuButton({
|
|
|
1504
1535
|
side: "right",
|
|
1505
1536
|
align: "center",
|
|
1506
1537
|
hidden: state !== "collapsed" || isMobile,
|
|
1507
|
-
...
|
|
1538
|
+
...tooltipProps
|
|
1508
1539
|
})
|
|
1509
1540
|
]
|
|
1510
1541
|
});
|
|
@@ -1516,7 +1547,7 @@ var sidebarStorageRuntime = Atom.runtime(BrowserKeyValueStore.layerLocalStorage)
|
|
|
1516
1547
|
var sidebarOpenAtom = Atom.kvs({
|
|
1517
1548
|
runtime: sidebarStorageRuntime,
|
|
1518
1549
|
key: "sidebar:open",
|
|
1519
|
-
schema:
|
|
1550
|
+
schema: Schema2.Boolean,
|
|
1520
1551
|
defaultValue: () => true
|
|
1521
1552
|
});
|
|
1522
1553
|
function AppSidebar({ footer, groups, header }) {
|
|
@@ -1692,24 +1723,36 @@ var seo = ({
|
|
|
1692
1723
|
const siteUrl = origin?.replace(/\/$/, "") ?? canonical;
|
|
1693
1724
|
const publisher = {
|
|
1694
1725
|
"@type": "Organization",
|
|
1695
|
-
name: siteName
|
|
1696
|
-
...siteUrl ? { url: siteUrl } : {},
|
|
1697
|
-
...sameAs?.length ? { sameAs } : {}
|
|
1698
|
-
};
|
|
1699
|
-
const structuredData = type === "article" ? {
|
|
1700
|
-
"@type": "Article",
|
|
1701
|
-
headline: title,
|
|
1702
|
-
description,
|
|
1703
|
-
...canonical ? { url: canonical } : {},
|
|
1704
|
-
...locale ? { inLanguage: locale } : {},
|
|
1705
|
-
...image ? { image } : {},
|
|
1706
|
-
publisher
|
|
1707
|
-
} : {
|
|
1708
|
-
"@type": "WebSite",
|
|
1709
|
-
name: siteName,
|
|
1710
|
-
...siteUrl ? { url: siteUrl } : {},
|
|
1711
|
-
publisher
|
|
1726
|
+
name: siteName
|
|
1712
1727
|
};
|
|
1728
|
+
if (siteUrl)
|
|
1729
|
+
publisher.url = siteUrl;
|
|
1730
|
+
if (sameAs?.length)
|
|
1731
|
+
publisher.sameAs = sameAs;
|
|
1732
|
+
const structuredData = type === "article" ? (() => {
|
|
1733
|
+
const article = {
|
|
1734
|
+
"@type": "Article",
|
|
1735
|
+
headline: title,
|
|
1736
|
+
description,
|
|
1737
|
+
publisher
|
|
1738
|
+
};
|
|
1739
|
+
if (canonical)
|
|
1740
|
+
article.url = canonical;
|
|
1741
|
+
if (locale)
|
|
1742
|
+
article.inLanguage = locale;
|
|
1743
|
+
if (image)
|
|
1744
|
+
article.image = image;
|
|
1745
|
+
return article;
|
|
1746
|
+
})() : (() => {
|
|
1747
|
+
const website = {
|
|
1748
|
+
"@type": "WebSite",
|
|
1749
|
+
name: siteName,
|
|
1750
|
+
publisher
|
|
1751
|
+
};
|
|
1752
|
+
if (siteUrl)
|
|
1753
|
+
website.url = siteUrl;
|
|
1754
|
+
return website;
|
|
1755
|
+
})();
|
|
1713
1756
|
const scripts = [
|
|
1714
1757
|
{
|
|
1715
1758
|
type: "application/ld+json",
|
|
@@ -1729,17 +1772,17 @@ var createSeo = (defaults) => (options) => seo({
|
|
|
1729
1772
|
// ../../src/lib/docs-core.tsx
|
|
1730
1773
|
import { jsx as jsx14, jsxs as jsxs9, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
1731
1774
|
addCollection(lucideIcons);
|
|
1732
|
-
var DocsSection =
|
|
1775
|
+
var DocsSection = Schema3.String.annotate({
|
|
1733
1776
|
identifier: "DocsSection"
|
|
1734
1777
|
});
|
|
1735
|
-
var DocsPageType =
|
|
1778
|
+
var DocsPageType = Schema3.Literals([
|
|
1736
1779
|
"concept",
|
|
1737
1780
|
"tutorial",
|
|
1738
1781
|
"how-to",
|
|
1739
1782
|
"reference",
|
|
1740
1783
|
"runbook"
|
|
1741
1784
|
]).annotate({ identifier: "DocsPageType" });
|
|
1742
|
-
var DocsDate =
|
|
1785
|
+
var DocsDate = Schema3.String.pipe(Schema3.check(Schema3.makeFilter((date) => Number.isNaN(new Date(date).getTime()) ? "Expected a valid date" : undefined)));
|
|
1743
1786
|
var NEW_DOCS_PAGE_DAYS = 14;
|
|
1744
1787
|
var isDocsPageNew = (createdAt, now = new Date) => {
|
|
1745
1788
|
if (!createdAt)
|
|
@@ -1747,31 +1790,31 @@ var isDocsPageNew = (createdAt, now = new Date) => {
|
|
|
1747
1790
|
const age = now.getTime() - new Date(createdAt).getTime();
|
|
1748
1791
|
return age >= 0 && age < NEW_DOCS_PAGE_DAYS * 24 * 60 * 60 * 1000;
|
|
1749
1792
|
};
|
|
1750
|
-
var DocsFrontmatter =
|
|
1751
|
-
slug:
|
|
1752
|
-
path:
|
|
1753
|
-
title:
|
|
1754
|
-
description:
|
|
1755
|
-
icon:
|
|
1756
|
-
order:
|
|
1757
|
-
locale:
|
|
1793
|
+
var DocsFrontmatter = Schema3.Struct({
|
|
1794
|
+
slug: Schema3.String,
|
|
1795
|
+
path: Schema3.String,
|
|
1796
|
+
title: Schema3.String,
|
|
1797
|
+
description: Schema3.String,
|
|
1798
|
+
icon: Schema3.optional(Schema3.String),
|
|
1799
|
+
order: Schema3.Number,
|
|
1800
|
+
locale: Schema3.String,
|
|
1758
1801
|
section: DocsSection,
|
|
1759
1802
|
type: DocsPageType,
|
|
1760
|
-
createdAt:
|
|
1761
|
-
updatedAt:
|
|
1762
|
-
legacySlugs:
|
|
1803
|
+
createdAt: Schema3.optional(DocsDate),
|
|
1804
|
+
updatedAt: Schema3.optional(DocsDate),
|
|
1805
|
+
legacySlugs: Schema3.optional(Schema3.Array(Schema3.String))
|
|
1763
1806
|
}).annotate({ identifier: "DocsFrontmatter" });
|
|
1764
|
-
var DocsHeadingSchema =
|
|
1765
|
-
depth:
|
|
1766
|
-
id:
|
|
1767
|
-
title:
|
|
1807
|
+
var DocsHeadingSchema = Schema3.Struct({
|
|
1808
|
+
depth: Schema3.Literals([2, 3]),
|
|
1809
|
+
id: Schema3.String,
|
|
1810
|
+
title: Schema3.String
|
|
1768
1811
|
}).annotate({ identifier: "DocsHeading" });
|
|
1769
|
-
var DocsPageSchema =
|
|
1812
|
+
var DocsPageSchema = Schema3.Struct({
|
|
1770
1813
|
...DocsFrontmatter.fields,
|
|
1771
|
-
headings:
|
|
1772
|
-
searchText:
|
|
1773
|
-
sourceFile:
|
|
1774
|
-
source:
|
|
1814
|
+
headings: Schema3.Array(DocsHeadingSchema),
|
|
1815
|
+
searchText: Schema3.String,
|
|
1816
|
+
sourceFile: Schema3.String,
|
|
1817
|
+
source: Schema3.String
|
|
1775
1818
|
}).annotate({ identifier: "DocsPage" });
|
|
1776
1819
|
var slugifyDocsHeading = (value) => value.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[`*_~]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
1777
1820
|
var stripMarkdown = (source) => source.replace(/```[\s\S]*?```/g, " ").replace(/!?(?:\[([^\]]+)\])\([^)]*\)/g, "$1").replace(/<[^>]+>/g, " ").replace(/[`*_>#|~-]/g, " ").replace(/\s+/g, " ").trim();
|
|
@@ -1814,14 +1857,14 @@ var parseDocsSource = (file, source) => {
|
|
|
1814
1857
|
const match = /^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/.exec(source);
|
|
1815
1858
|
if (!match)
|
|
1816
1859
|
throw new Error(`Missing frontmatter in ${file}`);
|
|
1817
|
-
const frontmatter =
|
|
1860
|
+
const frontmatter = Schema3.decodeUnknownSync(DocsFrontmatter)(parse(match[1] ?? ""));
|
|
1818
1861
|
const bodySource = match[2] ?? "";
|
|
1819
1862
|
const title = /^#\s+(.+?)\s*$/m.exec(bodySource)?.[1];
|
|
1820
1863
|
if (!title || stripMarkdown(title) !== stripMarkdown(frontmatter.title)) {
|
|
1821
1864
|
throw new Error(`Body title does not match frontmatter in ${file}`);
|
|
1822
1865
|
}
|
|
1823
1866
|
const body = stripBodyTitle(bodySource);
|
|
1824
|
-
return
|
|
1867
|
+
return Schema3.decodeUnknownSync(DocsPageSchema)({
|
|
1825
1868
|
...frontmatter,
|
|
1826
1869
|
headings: parseHeadings(body, file),
|
|
1827
1870
|
searchText: stripMarkdown(body),
|
|
@@ -1900,7 +1943,7 @@ var createDocsSource = (config) => {
|
|
|
1900
1943
|
if (new Set(config.locales).size !== config.locales.length) {
|
|
1901
1944
|
throw new Error("Documentation source locales must be unique");
|
|
1902
1945
|
}
|
|
1903
|
-
const pages = validateDocsPages(config.pages.map((page) =>
|
|
1946
|
+
const pages = validateDocsPages(config.pages.map((page) => Schema3.decodeUnknownSync(DocsPageSchema)(page)), config);
|
|
1904
1947
|
const getPage = (slug, locale) => pages.find((page) => page.slug === slug && page.locale === locale);
|
|
1905
1948
|
const resolvePage = (slug, locale) => pages.find((page) => page.locale === locale && (page.slug === slug || page.legacySlugs?.includes(slug)));
|
|
1906
1949
|
const getPages = (locale) => pages.filter((page) => page.locale === locale).sort((left, right) => left.order - right.order);
|
|
@@ -1937,12 +1980,14 @@ var makeDocs = (config) => {
|
|
|
1937
1980
|
icon: "lucide:book-open",
|
|
1938
1981
|
href: "/"
|
|
1939
1982
|
};
|
|
1940
|
-
const
|
|
1983
|
+
const seoDefaults = {
|
|
1941
1984
|
origin,
|
|
1942
1985
|
locales: source.locales,
|
|
1943
|
-
...config.defaultLocale ? { defaultLocale: config.defaultLocale } : {},
|
|
1944
1986
|
siteName: config.siteName
|
|
1945
|
-
}
|
|
1987
|
+
};
|
|
1988
|
+
if (config.defaultLocale)
|
|
1989
|
+
seoDefaults.defaultLocale = config.defaultLocale;
|
|
1990
|
+
const docsSeo = createSeo(seoDefaults);
|
|
1946
1991
|
const getMessages = (locale) => getDocsMessages(locale, config.messages?.(locale));
|
|
1947
1992
|
const normalizeSearchText = (value) => value.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
|
|
1948
1993
|
const searchIndex = source.pages.flatMap((page) => {
|
|
@@ -2021,10 +2066,12 @@ var makeDocs = (config) => {
|
|
|
2021
2066
|
if (entry.title.includes(normalizedQuery))
|
|
2022
2067
|
score += 20;
|
|
2023
2068
|
return [{ entry, score }];
|
|
2024
|
-
}).sort((left, right) => right.score - left.score || left.entry.page.order - right.entry.page.order).slice(0, limit).map(({ entry }) =>
|
|
2025
|
-
page: entry.page
|
|
2026
|
-
|
|
2027
|
-
|
|
2069
|
+
}).sort((left, right) => right.score - left.score || left.entry.page.order - right.entry.page.order).slice(0, limit).map(({ entry }) => {
|
|
2070
|
+
const result = { page: entry.page };
|
|
2071
|
+
if ("heading" in entry)
|
|
2072
|
+
result.heading = entry.heading;
|
|
2073
|
+
return result;
|
|
2074
|
+
});
|
|
2028
2075
|
};
|
|
2029
2076
|
const url = (page, locale) => `${origin}/${locale}${page.path}`;
|
|
2030
2077
|
const editUrl = (page) => githubUrl && (config.editable?.(page) ?? true) ? `${githubUrl}/edit/${config.github?.branch ?? "main"}/${page.sourceFile}` : undefined;
|
|
@@ -2100,7 +2147,7 @@ var docsPageTypeMessages = {
|
|
|
2100
2147
|
runbook: "Procédure d’exploitation"
|
|
2101
2148
|
}
|
|
2102
2149
|
};
|
|
2103
|
-
var defaultSectionLabel = (locale, section) => docsSectionMessages[locale][section] ?? humanizeDocsValue(section);
|
|
2150
|
+
var defaultSectionLabel = (locale, section) => Object.entries(docsSectionMessages[locale]).find(([key]) => key === section)?.[1] ?? humanizeDocsValue(section);
|
|
2104
2151
|
var messages2 = {
|
|
2105
2152
|
en: {
|
|
2106
2153
|
title: "Documentation",
|
|
@@ -2173,15 +2220,16 @@ var iconFor = (name) => {
|
|
|
2173
2220
|
icon: name,
|
|
2174
2221
|
ref,
|
|
2175
2222
|
ssr: true,
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2223
|
+
className,
|
|
2224
|
+
color,
|
|
2225
|
+
height: size,
|
|
2226
|
+
width: size
|
|
2179
2227
|
}));
|
|
2180
2228
|
DocsIcon.displayName = `DocsIcon(${name})`;
|
|
2181
2229
|
iconComponents.set(name, DocsIcon);
|
|
2182
2230
|
return DocsIcon;
|
|
2183
2231
|
};
|
|
2184
|
-
var headingText = (children) => Children.toArray(children).filter((child) => [
|
|
2232
|
+
var headingText = (children) => Children.toArray(children).filter((child) => Schema3.is(Schema3.Union([Schema3.String, Schema3.Number]))(child)).join("");
|
|
2185
2233
|
var makeDocsHeading = (level, copyLink) => {
|
|
2186
2234
|
const Heading = ({
|
|
2187
2235
|
children,
|
|
@@ -2385,19 +2433,22 @@ var DocsSearch = ({
|
|
|
2385
2433
|
ssr: true
|
|
2386
2434
|
}),
|
|
2387
2435
|
onSelect: () => navigate({ to: page.path, hash: heading.id })
|
|
2388
|
-
} : {
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2436
|
+
} : (() => {
|
|
2437
|
+
const item = {
|
|
2438
|
+
id: page.path,
|
|
2439
|
+
label: page.title,
|
|
2440
|
+
description: page.description,
|
|
2441
|
+
onSelect: () => navigate({ to: page.path })
|
|
2442
|
+
};
|
|
2443
|
+
if (page.icon) {
|
|
2444
|
+
item.icon = /* @__PURE__ */ jsx14(Icon, {
|
|
2394
2445
|
className: "size-4",
|
|
2395
2446
|
icon: page.icon,
|
|
2396
2447
|
ssr: true
|
|
2397
|
-
})
|
|
2398
|
-
}
|
|
2399
|
-
|
|
2400
|
-
})
|
|
2448
|
+
});
|
|
2449
|
+
}
|
|
2450
|
+
return item;
|
|
2451
|
+
})())
|
|
2401
2452
|
};
|
|
2402
2453
|
});
|
|
2403
2454
|
return /* @__PURE__ */ jsx14(SearchMenu, {
|
|
@@ -2424,12 +2475,17 @@ var DocsLayout = ({
|
|
|
2424
2475
|
const resolvedMessages = docs.getMessages(locale);
|
|
2425
2476
|
const groups = docs.sections(locale).map((section) => ({
|
|
2426
2477
|
label: () => resolvedMessages.sectionLabel(section.id),
|
|
2427
|
-
items: section.pages.map((item) =>
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2478
|
+
items: section.pages.map((item) => {
|
|
2479
|
+
const navItem = {
|
|
2480
|
+
label: () => item.title,
|
|
2481
|
+
href: item.path,
|
|
2482
|
+
icon: item.icon ? iconFor(item.icon) : EmptyIcon
|
|
2483
|
+
};
|
|
2484
|
+
if (isDocsPageNew(item.createdAt)) {
|
|
2485
|
+
navItem.badge = () => resolvedMessages.newLabel;
|
|
2486
|
+
}
|
|
2487
|
+
return navItem;
|
|
2488
|
+
})
|
|
2433
2489
|
}));
|
|
2434
2490
|
if (resources) {
|
|
2435
2491
|
groups.push({
|
|
@@ -2439,7 +2495,7 @@ var DocsLayout = ({
|
|
|
2439
2495
|
label: item.label,
|
|
2440
2496
|
href: item.href,
|
|
2441
2497
|
icon: iconFor(item.icon),
|
|
2442
|
-
|
|
2498
|
+
external: item.external
|
|
2443
2499
|
})),
|
|
2444
2500
|
...docs.githubUrl ? [
|
|
2445
2501
|
{
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Effect, Schema } from "effect";
|
|
2
|
+
import { Tool, Toolkit } from "effect/unstable/ai";
|
|
3
|
+
import { type DocsCatalog, type DocsLocale } from "./docs-core.js";
|
|
4
|
+
export declare const DocumentationToolkit: Toolkit.Toolkit<{
|
|
5
|
+
readonly readDocumentation: Tool.Tool<"readDocumentation", {
|
|
6
|
+
readonly parameters: Schema.Struct<{
|
|
7
|
+
readonly paths: Schema.$Array<Schema.String>;
|
|
8
|
+
}>;
|
|
9
|
+
readonly success: Schema.Struct<{
|
|
10
|
+
readonly pages: Schema.$Array<Schema.Struct<{
|
|
11
|
+
readonly slug: Schema.String;
|
|
12
|
+
readonly path: Schema.String;
|
|
13
|
+
readonly title: Schema.String;
|
|
14
|
+
readonly description: Schema.String;
|
|
15
|
+
readonly icon: Schema.optional<Schema.String>;
|
|
16
|
+
readonly order: Schema.Number;
|
|
17
|
+
readonly locale: Schema.String;
|
|
18
|
+
readonly section: Schema.String;
|
|
19
|
+
readonly type: Schema.Literals<readonly ["concept", "tutorial", "how-to", "reference", "runbook"]>;
|
|
20
|
+
readonly createdAt: Schema.optional<Schema.String>;
|
|
21
|
+
readonly updatedAt: Schema.optional<Schema.String>;
|
|
22
|
+
readonly legacySlugs: Schema.optional<Schema.$Array<Schema.String>>;
|
|
23
|
+
readonly headings: Schema.$Array<Schema.Struct<{
|
|
24
|
+
readonly depth: Schema.Literals<readonly [2, 3]>;
|
|
25
|
+
readonly id: Schema.String;
|
|
26
|
+
readonly title: Schema.String;
|
|
27
|
+
}>>;
|
|
28
|
+
readonly searchText: Schema.String;
|
|
29
|
+
readonly sourceFile: Schema.String;
|
|
30
|
+
readonly source: Schema.String;
|
|
31
|
+
}>>;
|
|
32
|
+
readonly missingPaths: Schema.$Array<Schema.String>;
|
|
33
|
+
}>;
|
|
34
|
+
readonly failure: Schema.Never;
|
|
35
|
+
readonly failureMode: "error";
|
|
36
|
+
}, never>;
|
|
37
|
+
readonly searchDocumentation: Tool.Tool<"searchDocumentation", {
|
|
38
|
+
readonly parameters: Schema.Struct<{
|
|
39
|
+
readonly query: Schema.String;
|
|
40
|
+
}>;
|
|
41
|
+
readonly success: Schema.$Array<Schema.Struct<{
|
|
42
|
+
readonly path: Schema.String;
|
|
43
|
+
readonly title: Schema.String;
|
|
44
|
+
readonly description: Schema.String;
|
|
45
|
+
readonly heading: Schema.optional<Schema.String>;
|
|
46
|
+
}>>;
|
|
47
|
+
readonly failure: Schema.Never;
|
|
48
|
+
readonly failureMode: "error";
|
|
49
|
+
}, never>;
|
|
50
|
+
}>;
|
|
51
|
+
export declare const searchDocumentation: (args_0: {
|
|
52
|
+
readonly docs: DocsCatalog;
|
|
53
|
+
readonly locale: DocsLocale;
|
|
54
|
+
readonly query: string;
|
|
55
|
+
}) => Effect.Effect<{
|
|
56
|
+
path: string;
|
|
57
|
+
title: string;
|
|
58
|
+
description: string;
|
|
59
|
+
heading: string | undefined;
|
|
60
|
+
}[], never, never>;
|
|
61
|
+
export declare const readDocumentation: (args_0: {
|
|
62
|
+
readonly locale: DocsLocale;
|
|
63
|
+
readonly paths: ReadonlyArray<string>;
|
|
64
|
+
readonly docs: DocsCatalog;
|
|
65
|
+
}) => Effect.Effect<{
|
|
66
|
+
pages: {
|
|
67
|
+
readonly slug: string;
|
|
68
|
+
readonly path: string;
|
|
69
|
+
readonly title: string;
|
|
70
|
+
readonly description: string;
|
|
71
|
+
readonly icon?: string | undefined;
|
|
72
|
+
readonly order: number;
|
|
73
|
+
readonly locale: string;
|
|
74
|
+
readonly section: string;
|
|
75
|
+
readonly type: "concept" | "how-to" | "reference" | "runbook" | "tutorial";
|
|
76
|
+
readonly createdAt?: string | undefined;
|
|
77
|
+
readonly updatedAt?: string | undefined;
|
|
78
|
+
readonly legacySlugs?: readonly string[] | undefined;
|
|
79
|
+
readonly headings: readonly Schema.Struct.ReadonlySide<{
|
|
80
|
+
readonly depth: Schema.Literals<readonly [2, 3]>;
|
|
81
|
+
readonly id: Schema.String;
|
|
82
|
+
readonly title: Schema.String;
|
|
83
|
+
}, "Type">[];
|
|
84
|
+
readonly searchText: string;
|
|
85
|
+
readonly sourceFile: string;
|
|
86
|
+
readonly source: string;
|
|
87
|
+
}[];
|
|
88
|
+
missingPaths: string[];
|
|
89
|
+
}, never, never>;
|
|
90
|
+
export type DocumentationToolkitOptions = {
|
|
91
|
+
readonly locale: DocsLocale;
|
|
92
|
+
readonly docs: DocsCatalog;
|
|
93
|
+
};
|
|
94
|
+
export declare const DocumentationToolkitLayer: ({ docs, locale, }: DocumentationToolkitOptions) => import("effect/Layer").Layer<Tool.HandlersFor<{
|
|
95
|
+
readonly readDocumentation: Tool.Tool<"readDocumentation", {
|
|
96
|
+
readonly parameters: Schema.Struct<{
|
|
97
|
+
readonly paths: Schema.$Array<Schema.String>;
|
|
98
|
+
}>;
|
|
99
|
+
readonly success: Schema.Struct<{
|
|
100
|
+
readonly pages: Schema.$Array<Schema.Struct<{
|
|
101
|
+
readonly slug: Schema.String;
|
|
102
|
+
readonly path: Schema.String;
|
|
103
|
+
readonly title: Schema.String;
|
|
104
|
+
readonly description: Schema.String;
|
|
105
|
+
readonly icon: Schema.optional<Schema.String>;
|
|
106
|
+
readonly order: Schema.Number;
|
|
107
|
+
readonly locale: Schema.String;
|
|
108
|
+
readonly section: Schema.String;
|
|
109
|
+
readonly type: Schema.Literals<readonly ["concept", "tutorial", "how-to", "reference", "runbook"]>;
|
|
110
|
+
readonly createdAt: Schema.optional<Schema.String>;
|
|
111
|
+
readonly updatedAt: Schema.optional<Schema.String>;
|
|
112
|
+
readonly legacySlugs: Schema.optional<Schema.$Array<Schema.String>>;
|
|
113
|
+
readonly headings: Schema.$Array<Schema.Struct<{
|
|
114
|
+
readonly depth: Schema.Literals<readonly [2, 3]>;
|
|
115
|
+
readonly id: Schema.String;
|
|
116
|
+
readonly title: Schema.String;
|
|
117
|
+
}>>;
|
|
118
|
+
readonly searchText: Schema.String;
|
|
119
|
+
readonly sourceFile: Schema.String;
|
|
120
|
+
readonly source: Schema.String;
|
|
121
|
+
}>>;
|
|
122
|
+
readonly missingPaths: Schema.$Array<Schema.String>;
|
|
123
|
+
}>;
|
|
124
|
+
readonly failure: Schema.Never;
|
|
125
|
+
readonly failureMode: "error";
|
|
126
|
+
}, never>;
|
|
127
|
+
readonly searchDocumentation: Tool.Tool<"searchDocumentation", {
|
|
128
|
+
readonly parameters: Schema.Struct<{
|
|
129
|
+
readonly query: Schema.String;
|
|
130
|
+
}>;
|
|
131
|
+
readonly success: Schema.$Array<Schema.Struct<{
|
|
132
|
+
readonly path: Schema.String;
|
|
133
|
+
readonly title: Schema.String;
|
|
134
|
+
readonly description: Schema.String;
|
|
135
|
+
readonly heading: Schema.optional<Schema.String>;
|
|
136
|
+
}>>;
|
|
137
|
+
readonly failure: Schema.Never;
|
|
138
|
+
readonly failureMode: "error";
|
|
139
|
+
}, never>;
|
|
140
|
+
}>, never, never>;
|