@farming-labs/docs 0.0.2-beta.3 → 0.0.2-beta.30
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/dist/cli/index.mjs +1586 -227
- package/dist/index.d.mts +580 -9
- package/dist/index.mjs +6 -1
- package/package.json +14 -14
package/dist/index.d.mts
CHANGED
|
@@ -137,6 +137,13 @@ interface UIConfig {
|
|
|
137
137
|
toc?: {
|
|
138
138
|
enabled?: boolean;
|
|
139
139
|
depth?: number;
|
|
140
|
+
/**
|
|
141
|
+
* Visual style of the TOC indicator.
|
|
142
|
+
* - `"default"` — highlight active link text color only
|
|
143
|
+
* - `"directional"` — animated thumb bar that tracks active headings (fumadocs style)
|
|
144
|
+
* @default "default"
|
|
145
|
+
*/
|
|
146
|
+
style?: "default" | "directional";
|
|
140
147
|
};
|
|
141
148
|
header?: {
|
|
142
149
|
height?: number;
|
|
@@ -223,6 +230,8 @@ interface PageFrontmatter {
|
|
|
223
230
|
icon?: string;
|
|
224
231
|
/** Path to custom OG image for this page */
|
|
225
232
|
ogImage?: string;
|
|
233
|
+
/** Sort order in the sidebar. Lower numbers appear first. Pages without `order` are sorted alphabetically after ordered pages. */
|
|
234
|
+
order?: number;
|
|
226
235
|
}
|
|
227
236
|
interface DocsNav {
|
|
228
237
|
/**
|
|
@@ -288,6 +297,54 @@ interface BreadcrumbConfig {
|
|
|
288
297
|
*/
|
|
289
298
|
component?: unknown;
|
|
290
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* A leaf page in the sidebar tree.
|
|
302
|
+
*/
|
|
303
|
+
interface SidebarPageNode {
|
|
304
|
+
type: "page";
|
|
305
|
+
name: string;
|
|
306
|
+
url: string;
|
|
307
|
+
icon?: unknown;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* A folder (group) in the sidebar tree. May contain child pages
|
|
311
|
+
* and nested folders, forming a recursive hierarchy.
|
|
312
|
+
*/
|
|
313
|
+
interface SidebarFolderNode {
|
|
314
|
+
type: "folder";
|
|
315
|
+
name: string;
|
|
316
|
+
icon?: unknown;
|
|
317
|
+
/** Index page for this folder (the folder's own landing page). */
|
|
318
|
+
index?: SidebarPageNode;
|
|
319
|
+
/** Child pages and sub-folders. */
|
|
320
|
+
children: SidebarNode[];
|
|
321
|
+
/** Whether this folder section is collapsible. */
|
|
322
|
+
collapsible?: boolean;
|
|
323
|
+
/** Whether this folder starts open. */
|
|
324
|
+
defaultOpen?: boolean;
|
|
325
|
+
}
|
|
326
|
+
/** A node in the sidebar tree — either a page or a folder. */
|
|
327
|
+
type SidebarNode = SidebarPageNode | SidebarFolderNode;
|
|
328
|
+
/** The full sidebar tree passed to custom sidebar components. */
|
|
329
|
+
interface SidebarTree {
|
|
330
|
+
name: string;
|
|
331
|
+
children: SidebarNode[];
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Props passed to a custom sidebar component.
|
|
335
|
+
*
|
|
336
|
+
* Contains all the information needed to build a fully custom sidebar:
|
|
337
|
+
* the complete page tree with parent-child relationships, and the
|
|
338
|
+
* current sidebar configuration.
|
|
339
|
+
*/
|
|
340
|
+
interface SidebarComponentProps {
|
|
341
|
+
/** Full page tree with all parent-child-folder relationships. */
|
|
342
|
+
tree: SidebarTree;
|
|
343
|
+
/** Whether folders are collapsible. */
|
|
344
|
+
collapsible: boolean;
|
|
345
|
+
/** Whether folders are rendered flat (Mintlify-style). */
|
|
346
|
+
flat: boolean;
|
|
347
|
+
}
|
|
291
348
|
interface SidebarConfig {
|
|
292
349
|
/**
|
|
293
350
|
* Whether to show the sidebar.
|
|
@@ -295,17 +352,46 @@ interface SidebarConfig {
|
|
|
295
352
|
*/
|
|
296
353
|
enabled?: boolean;
|
|
297
354
|
/**
|
|
298
|
-
* Custom sidebar component to
|
|
299
|
-
* Receives the page tree and config as context.
|
|
355
|
+
* Custom sidebar component to replace the default navigation.
|
|
300
356
|
*
|
|
301
|
-
*
|
|
357
|
+
* **Next.js** — Pass a render function that receives `SidebarComponentProps`:
|
|
302
358
|
* ```tsx
|
|
303
359
|
* sidebar: {
|
|
304
|
-
* component:
|
|
360
|
+
* component: ({ tree, collapsible, flat }) => (
|
|
361
|
+
* <MySidebar tree={tree} />
|
|
362
|
+
* ),
|
|
305
363
|
* }
|
|
306
364
|
* ```
|
|
365
|
+
*
|
|
366
|
+
* **Astro** — Use the `sidebar` named slot on `<DocsLayout>`:
|
|
367
|
+
* ```astro
|
|
368
|
+
* <DocsLayout tree={tree} config={config}>
|
|
369
|
+
* <MySidebar slot="sidebar" tree={tree} />
|
|
370
|
+
* <slot />
|
|
371
|
+
* </DocsLayout>
|
|
372
|
+
* ```
|
|
373
|
+
*
|
|
374
|
+
* **SvelteKit** — Use the `sidebar` snippet on `<DocsLayout>`:
|
|
375
|
+
* ```svelte
|
|
376
|
+
* <DocsLayout {tree} {config}>
|
|
377
|
+
* {#snippet sidebar({ tree, isActive })}
|
|
378
|
+
* <MySidebarNav {tree} {isActive} />
|
|
379
|
+
* {/snippet}
|
|
380
|
+
* {@render children()}
|
|
381
|
+
* </DocsLayout>
|
|
382
|
+
* ```
|
|
383
|
+
*
|
|
384
|
+
* **Nuxt / Vue** — Use the `#sidebar` scoped slot on `<DocsLayout>`:
|
|
385
|
+
* ```vue
|
|
386
|
+
* <DocsLayout :tree="tree" :config="config">
|
|
387
|
+
* <template #sidebar="{ tree, isActive }">
|
|
388
|
+
* <MySidebarNav :tree="tree" :is-active="isActive" />
|
|
389
|
+
* </template>
|
|
390
|
+
* <DocsContent />
|
|
391
|
+
* </DocsLayout>
|
|
392
|
+
* ```
|
|
307
393
|
*/
|
|
308
|
-
component?: unknown;
|
|
394
|
+
component?: (props: SidebarComponentProps) => unknown;
|
|
309
395
|
/**
|
|
310
396
|
* Sidebar footer content (rendered below navigation items).
|
|
311
397
|
*/
|
|
@@ -319,6 +405,17 @@ interface SidebarConfig {
|
|
|
319
405
|
* @default true
|
|
320
406
|
*/
|
|
321
407
|
collapsible?: boolean;
|
|
408
|
+
/**
|
|
409
|
+
* When true, all folder children are rendered flat in the sidebar
|
|
410
|
+
* (no collapsible sections). Folder index pages appear as category
|
|
411
|
+
* headings with all children listed directly below them.
|
|
412
|
+
*
|
|
413
|
+
* This creates a Mintlify-style sidebar where all navigation items
|
|
414
|
+
* are always visible.
|
|
415
|
+
*
|
|
416
|
+
* @default false
|
|
417
|
+
*/
|
|
418
|
+
flat?: boolean;
|
|
322
419
|
}
|
|
323
420
|
/**
|
|
324
421
|
* A single "Open in …" provider shown in the Open dropdown.
|
|
@@ -334,10 +431,13 @@ interface OpenDocsProvider {
|
|
|
334
431
|
/** Icon element rendered next to the name */
|
|
335
432
|
icon?: unknown;
|
|
336
433
|
/**
|
|
337
|
-
* URL template.
|
|
338
|
-
* `{
|
|
434
|
+
* URL template. Placeholders:
|
|
435
|
+
* - `{url}` — current page URL (encoded).
|
|
436
|
+
* - `{mdxUrl}` — page URL with `.mdx` suffix (encoded).
|
|
437
|
+
* - `{githubUrl}` — GitHub edit URL for the current page (same as "Edit on GitHub"). Requires `github` in config.
|
|
339
438
|
*
|
|
340
439
|
* @example "https://claude.ai/new?q=Read+this+doc:+{url}"
|
|
440
|
+
* @example "{githubUrl}" — open current page file on GitHub (edit view)
|
|
341
441
|
*/
|
|
342
442
|
urlTemplate: string;
|
|
343
443
|
}
|
|
@@ -404,6 +504,65 @@ interface PageActionsConfig {
|
|
|
404
504
|
* @default "below-title"
|
|
405
505
|
*/
|
|
406
506
|
position?: "above-title" | "below-title";
|
|
507
|
+
/**
|
|
508
|
+
* Horizontal alignment of page action buttons.
|
|
509
|
+
*
|
|
510
|
+
* - `"left"` — align to the left (default)
|
|
511
|
+
* - `"right"` — align to the right
|
|
512
|
+
*
|
|
513
|
+
* @default "left"
|
|
514
|
+
*/
|
|
515
|
+
alignment?: "left" | "right";
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Configuration for the "Last updated" date display.
|
|
519
|
+
*
|
|
520
|
+
* @example
|
|
521
|
+
* ```ts
|
|
522
|
+
* lastUpdated: { position: "below-title" }
|
|
523
|
+
* ```
|
|
524
|
+
*/
|
|
525
|
+
/**
|
|
526
|
+
* Configuration for auto-generated `/llms.txt` and `/llms-full.txt` routes.
|
|
527
|
+
*
|
|
528
|
+
* @see https://llmstxt.org
|
|
529
|
+
*/
|
|
530
|
+
interface LlmsTxtConfig {
|
|
531
|
+
/**
|
|
532
|
+
* Whether to enable llms.txt generation.
|
|
533
|
+
* @default true
|
|
534
|
+
*/
|
|
535
|
+
enabled?: boolean;
|
|
536
|
+
/**
|
|
537
|
+
* Base URL for your docs site (used to build absolute links in llms.txt).
|
|
538
|
+
* @example "https://docs.example.com"
|
|
539
|
+
*/
|
|
540
|
+
baseUrl?: string;
|
|
541
|
+
/**
|
|
542
|
+
* Site title shown at the top of llms.txt.
|
|
543
|
+
* Falls back to `nav.title` if not set.
|
|
544
|
+
*/
|
|
545
|
+
siteTitle?: string;
|
|
546
|
+
/**
|
|
547
|
+
* Site description shown below the title.
|
|
548
|
+
*/
|
|
549
|
+
siteDescription?: string;
|
|
550
|
+
}
|
|
551
|
+
interface LastUpdatedConfig {
|
|
552
|
+
/**
|
|
553
|
+
* Whether to show the "Last updated" date.
|
|
554
|
+
* @default true
|
|
555
|
+
*/
|
|
556
|
+
enabled?: boolean;
|
|
557
|
+
/**
|
|
558
|
+
* Where to render the "Last updated" date.
|
|
559
|
+
*
|
|
560
|
+
* - `"footer"` — next to the "Edit on GitHub" link at the bottom (default)
|
|
561
|
+
* - `"below-title"` — below the page title/description, above the content
|
|
562
|
+
*
|
|
563
|
+
* @default "footer"
|
|
564
|
+
*/
|
|
565
|
+
position?: "footer" | "below-title";
|
|
407
566
|
}
|
|
408
567
|
/**
|
|
409
568
|
* GitHub repository configuration for "Edit on GitHub" links
|
|
@@ -442,9 +601,321 @@ interface GithubConfig {
|
|
|
442
601
|
*/
|
|
443
602
|
directory?: string;
|
|
444
603
|
}
|
|
604
|
+
/**
|
|
605
|
+
* Configuration for "Ask AI" — a RAG-powered chat that lets users
|
|
606
|
+
* ask questions about the documentation content.
|
|
607
|
+
*
|
|
608
|
+
* The AI handler searches relevant doc pages, builds context, and
|
|
609
|
+
* streams a response from an LLM (OpenAI-compatible API).
|
|
610
|
+
*
|
|
611
|
+
* The API key is **never** stored in the config. It is read from the
|
|
612
|
+
* `OPENAI_API_KEY` environment variable at runtime on the server.
|
|
613
|
+
*
|
|
614
|
+
* @example
|
|
615
|
+
* ```ts
|
|
616
|
+
* ai: {
|
|
617
|
+
* enabled: true,
|
|
618
|
+
* model: "gpt-4o-mini",
|
|
619
|
+
* systemPrompt: "You are a helpful assistant for our developer docs.",
|
|
620
|
+
* }
|
|
621
|
+
* ```
|
|
622
|
+
*/
|
|
623
|
+
interface AIConfig {
|
|
624
|
+
/**
|
|
625
|
+
* Whether to enable "Ask AI" functionality.
|
|
626
|
+
* When enabled, the unified `/api/docs` route handler will accept
|
|
627
|
+
* POST requests for AI chat.
|
|
628
|
+
* @default false
|
|
629
|
+
*/
|
|
630
|
+
enabled?: boolean;
|
|
631
|
+
/**
|
|
632
|
+
* How the AI chat UI is presented.
|
|
633
|
+
*
|
|
634
|
+
* - `"search"` — AI tab integrated into the Cmd+K search dialog (default)
|
|
635
|
+
* - `"floating"` — A floating chat widget (bubble button + slide-out panel)
|
|
636
|
+
*
|
|
637
|
+
* @default "search"
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* ```ts
|
|
641
|
+
* // Floating chat bubble in the bottom-right corner
|
|
642
|
+
* ai: {
|
|
643
|
+
* enabled: true,
|
|
644
|
+
* mode: "floating",
|
|
645
|
+
* position: "bottom-right",
|
|
646
|
+
* }
|
|
647
|
+
* ```
|
|
648
|
+
*/
|
|
649
|
+
mode?: "search" | "floating" | "sidebar-icon";
|
|
650
|
+
/**
|
|
651
|
+
* Position of the floating chat button on screen.
|
|
652
|
+
* Only used when `mode` is `"floating"`.
|
|
653
|
+
*
|
|
654
|
+
* - `"bottom-right"` — bottom-right corner (default)
|
|
655
|
+
* - `"bottom-left"` — bottom-left corner
|
|
656
|
+
* - `"bottom-center"` — bottom center
|
|
657
|
+
*
|
|
658
|
+
* @default "bottom-right"
|
|
659
|
+
*/
|
|
660
|
+
position?: "bottom-right" | "bottom-left" | "bottom-center";
|
|
661
|
+
/**
|
|
662
|
+
* Visual style of the floating chat when opened.
|
|
663
|
+
* Only used when `mode` is `"floating"`.
|
|
664
|
+
*
|
|
665
|
+
* - `"panel"` — A tall panel that slides up from the button position (default).
|
|
666
|
+
* Stays anchored near the floating button. No backdrop overlay.
|
|
667
|
+
*
|
|
668
|
+
* - `"modal"` — A centered modal dialog with a backdrop overlay,
|
|
669
|
+
* similar to the Cmd+K search dialog. Feels more focused and immersive.
|
|
670
|
+
*
|
|
671
|
+
* - `"popover"` — A compact popover near the button. Smaller than the
|
|
672
|
+
* panel, suitable for quick questions without taking much screen space.
|
|
673
|
+
*
|
|
674
|
+
* - `"full-modal"` — A full-screen immersive overlay (inspired by better-auth).
|
|
675
|
+
* Messages scroll in the center, input is pinned at the bottom.
|
|
676
|
+
* Suggested questions appear as horizontal pills. Best for
|
|
677
|
+
* documentation-heavy sites that want a premium AI experience.
|
|
678
|
+
*
|
|
679
|
+
* @default "panel"
|
|
680
|
+
*
|
|
681
|
+
* @example
|
|
682
|
+
* ```ts
|
|
683
|
+
* ai: {
|
|
684
|
+
* enabled: true,
|
|
685
|
+
* mode: "floating",
|
|
686
|
+
* position: "bottom-right",
|
|
687
|
+
* floatingStyle: "full-modal",
|
|
688
|
+
* }
|
|
689
|
+
* ```
|
|
690
|
+
*/
|
|
691
|
+
floatingStyle?: "panel" | "modal" | "popover" | "full-modal";
|
|
692
|
+
/**
|
|
693
|
+
* Custom trigger component for the floating chat button (Next.js only).
|
|
694
|
+
* Only used when `mode` is `"floating"`.
|
|
695
|
+
*
|
|
696
|
+
* The click handler is attached automatically by the wrapper.
|
|
697
|
+
*
|
|
698
|
+
* - **Next.js**: Pass a JSX element via this config option.
|
|
699
|
+
* - **SvelteKit**: Use the `aiTrigger` snippet on `<DocsLayout>`.
|
|
700
|
+
* - **Nuxt / Vue**: Use the `ai-trigger` slot on `<DocsLayout>`.
|
|
701
|
+
* - **Astro**: Use `<MyTrigger slot="ai-trigger" />` on `<DocsLayout>`.
|
|
702
|
+
*
|
|
703
|
+
* @example
|
|
704
|
+
* ```tsx
|
|
705
|
+
* // Next.js — pass JSX directly in config
|
|
706
|
+
* triggerComponent: <button className="my-chat-btn">Ask AI</button>,
|
|
707
|
+
* ```
|
|
708
|
+
*
|
|
709
|
+
* ```svelte
|
|
710
|
+
* <!-- SvelteKit — use snippet in layout -->
|
|
711
|
+
* <DocsLayout {tree} {config}>
|
|
712
|
+
* {#snippet aiTrigger()}<AskAITrigger />{/snippet}
|
|
713
|
+
* {@render children()}
|
|
714
|
+
* </DocsLayout>
|
|
715
|
+
* ```
|
|
716
|
+
*
|
|
717
|
+
* ```vue
|
|
718
|
+
* <!-- Nuxt / Vue — use named slot in layout -->
|
|
719
|
+
* <DocsLayout :tree="tree" :config="config">
|
|
720
|
+
* <template #ai-trigger><AskAITrigger /></template>
|
|
721
|
+
* <DocsContent />
|
|
722
|
+
* </DocsLayout>
|
|
723
|
+
* ```
|
|
724
|
+
*
|
|
725
|
+
* ```astro
|
|
726
|
+
* <!-- Astro — use named slot in layout -->
|
|
727
|
+
* <DocsLayout tree={tree} config={config}>
|
|
728
|
+
* <AskAITrigger slot="ai-trigger" />
|
|
729
|
+
* <DocsContent />
|
|
730
|
+
* </DocsLayout>
|
|
731
|
+
* ```
|
|
732
|
+
*/
|
|
733
|
+
triggerComponent?: unknown;
|
|
734
|
+
/**
|
|
735
|
+
* The LLM model to use for chat completions.
|
|
736
|
+
* Must be compatible with the OpenAI Chat Completions API.
|
|
737
|
+
* @default "gpt-4o-mini"
|
|
738
|
+
*/
|
|
739
|
+
model?: string;
|
|
740
|
+
/**
|
|
741
|
+
* Custom system prompt prepended to the AI conversation.
|
|
742
|
+
* The documentation context is automatically appended after this prompt.
|
|
743
|
+
*
|
|
744
|
+
* @default "You are a helpful documentation assistant. Answer questions
|
|
745
|
+
* based on the provided documentation context. Be concise and accurate.
|
|
746
|
+
* If the answer is not in the context, say so honestly."
|
|
747
|
+
*/
|
|
748
|
+
systemPrompt?: string;
|
|
749
|
+
/**
|
|
750
|
+
* Base URL for an OpenAI-compatible API endpoint.
|
|
751
|
+
* Use this to point to a self-hosted model, Azure OpenAI, or any
|
|
752
|
+
* compatible provider (e.g. Groq, Together, OpenRouter).
|
|
753
|
+
* @default "https://api.openai.com/v1"
|
|
754
|
+
*/
|
|
755
|
+
baseUrl?: string;
|
|
756
|
+
/**
|
|
757
|
+
* API key for the LLM provider.
|
|
758
|
+
* Pass it via an environment variable to keep it out of source control.
|
|
759
|
+
*
|
|
760
|
+
* @default process.env.OPENAI_API_KEY
|
|
761
|
+
*
|
|
762
|
+
* @example
|
|
763
|
+
* ```ts
|
|
764
|
+
* // Default — reads OPENAI_API_KEY automatically
|
|
765
|
+
* ai: { enabled: true }
|
|
766
|
+
*
|
|
767
|
+
* // Custom provider key
|
|
768
|
+
* ai: {
|
|
769
|
+
* enabled: true,
|
|
770
|
+
* apiKey: process.env.GROQ_API_KEY,
|
|
771
|
+
* }
|
|
772
|
+
* ```
|
|
773
|
+
*/
|
|
774
|
+
apiKey?: string;
|
|
775
|
+
/**
|
|
776
|
+
* Maximum number of search results to include as context for the AI.
|
|
777
|
+
* More results = more context but higher token usage.
|
|
778
|
+
* @default 5
|
|
779
|
+
*/
|
|
780
|
+
maxResults?: number;
|
|
781
|
+
/**
|
|
782
|
+
* Pre-filled suggested questions shown in the AI chat when empty.
|
|
783
|
+
* When a user clicks one, it fills the input and submits automatically.
|
|
784
|
+
*
|
|
785
|
+
* @example
|
|
786
|
+
* ```ts
|
|
787
|
+
* ai: {
|
|
788
|
+
* enabled: true,
|
|
789
|
+
* suggestedQuestions: [
|
|
790
|
+
* "How do I install this?",
|
|
791
|
+
* "What themes are available?",
|
|
792
|
+
* "How do I create a custom component?",
|
|
793
|
+
* ],
|
|
794
|
+
* }
|
|
795
|
+
* ```
|
|
796
|
+
*/
|
|
797
|
+
suggestedQuestions?: string[];
|
|
798
|
+
/**
|
|
799
|
+
* Display name for the AI assistant in the chat UI.
|
|
800
|
+
* Shown as the message label, header title, and passed to the loading component.
|
|
801
|
+
*
|
|
802
|
+
* @default "AI"
|
|
803
|
+
*
|
|
804
|
+
* @example
|
|
805
|
+
* ```ts
|
|
806
|
+
* ai: {
|
|
807
|
+
* enabled: true,
|
|
808
|
+
* aiLabel: "DocsBot",
|
|
809
|
+
* }
|
|
810
|
+
* ```
|
|
811
|
+
*/
|
|
812
|
+
aiLabel?: string;
|
|
813
|
+
/**
|
|
814
|
+
* The npm package name used in import examples.
|
|
815
|
+
* The AI will use this in code snippets instead of generic placeholders.
|
|
816
|
+
*
|
|
817
|
+
* @example
|
|
818
|
+
* ```ts
|
|
819
|
+
* ai: {
|
|
820
|
+
* enabled: true,
|
|
821
|
+
* packageName: "@farming-labs/docs",
|
|
822
|
+
* }
|
|
823
|
+
* ```
|
|
824
|
+
*/
|
|
825
|
+
packageName?: string;
|
|
826
|
+
/**
|
|
827
|
+
* The public URL of the documentation site.
|
|
828
|
+
* The AI will use this for links instead of relative paths.
|
|
829
|
+
*
|
|
830
|
+
* @example
|
|
831
|
+
* ```ts
|
|
832
|
+
* ai: {
|
|
833
|
+
* enabled: true,
|
|
834
|
+
* docsUrl: "https://docs.farming-labs.dev",
|
|
835
|
+
* }
|
|
836
|
+
* ```
|
|
837
|
+
*/
|
|
838
|
+
docsUrl?: string;
|
|
839
|
+
/**
|
|
840
|
+
* Loading indicator variant shown while the AI generates a response.
|
|
841
|
+
*
|
|
842
|
+
* - `"shimmer-dots"` — shimmer text + typing dots (default)
|
|
843
|
+
* - `"circular"` — spinning ring
|
|
844
|
+
* - `"dots"` — bouncing dots
|
|
845
|
+
* - `"typing"` — typing dots
|
|
846
|
+
* - `"wave"` — wave bars
|
|
847
|
+
* - `"bars"` — thick wave bars
|
|
848
|
+
* - `"pulse"` — pulsing ring
|
|
849
|
+
* - `"pulse-dot"` — pulsing dot
|
|
850
|
+
* - `"terminal"` — blinking terminal cursor
|
|
851
|
+
* - `"text-blink"` — blinking text
|
|
852
|
+
* - `"text-shimmer"` — shimmer text only
|
|
853
|
+
* - `"loading-dots"` — "Thinking..." with animated dots
|
|
854
|
+
*
|
|
855
|
+
* @default "shimmer-dots"
|
|
856
|
+
*
|
|
857
|
+
* @example
|
|
858
|
+
* ```ts
|
|
859
|
+
* ai: {
|
|
860
|
+
* enabled: true,
|
|
861
|
+
* loader: "wave",
|
|
862
|
+
* }
|
|
863
|
+
* ```
|
|
864
|
+
*/
|
|
865
|
+
loader?: "shimmer-dots" | "circular" | "dots" | "typing" | "wave" | "bars" | "pulse" | "pulse-dot" | "terminal" | "text-blink" | "text-shimmer" | "loading-dots";
|
|
866
|
+
/**
|
|
867
|
+
* Custom loading indicator that overrides the built-in `loader` variant.
|
|
868
|
+
* Receives `{ name }` (the `aiLabel` value) and returns a React element.
|
|
869
|
+
*
|
|
870
|
+
* Only works in Next.js. For other frameworks, use the `loader` option.
|
|
871
|
+
*
|
|
872
|
+
* @example
|
|
873
|
+
* ```tsx
|
|
874
|
+
* ai: {
|
|
875
|
+
* enabled: true,
|
|
876
|
+
* aiLabel: "Sage",
|
|
877
|
+
* loadingComponent: ({ name }) => (
|
|
878
|
+
* <div className="flex items-center gap-2 text-sm text-zinc-400">
|
|
879
|
+
* <span className="animate-pulse">🤔</span>
|
|
880
|
+
* <span>{name} is thinking...</span>
|
|
881
|
+
* </div>
|
|
882
|
+
* ),
|
|
883
|
+
* }
|
|
884
|
+
* ```
|
|
885
|
+
*/
|
|
886
|
+
loadingComponent?: (props: {
|
|
887
|
+
name: string;
|
|
888
|
+
}) => unknown;
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* A single item in the slug-based sidebar ordering.
|
|
892
|
+
*
|
|
893
|
+
* @example
|
|
894
|
+
* ```ts
|
|
895
|
+
* ordering: [
|
|
896
|
+
* { slug: "installation" },
|
|
897
|
+
* { slug: "cli" },
|
|
898
|
+
* { slug: "themes", children: [
|
|
899
|
+
* { slug: "default" },
|
|
900
|
+
* { slug: "darksharp" },
|
|
901
|
+
* { slug: "pixel-border" },
|
|
902
|
+
* { slug: "creating-themes" },
|
|
903
|
+
* ]},
|
|
904
|
+
* { slug: "reference" },
|
|
905
|
+
* ]
|
|
906
|
+
* ```
|
|
907
|
+
*/
|
|
908
|
+
interface OrderingItem {
|
|
909
|
+
/** Folder name (not the full path, just the directory name at this level) */
|
|
910
|
+
slug: string;
|
|
911
|
+
/** Ordering for child pages within this folder */
|
|
912
|
+
children?: OrderingItem[];
|
|
913
|
+
}
|
|
445
914
|
interface DocsConfig {
|
|
446
915
|
/** Entry folder for docs (e.g. "docs" → /docs) */
|
|
447
916
|
entry: string;
|
|
917
|
+
/** Path to the content directory. Defaults to `entry` value. */
|
|
918
|
+
contentDir?: string;
|
|
448
919
|
/** Theme configuration - single source of truth for UI */
|
|
449
920
|
theme?: DocsTheme;
|
|
450
921
|
/**
|
|
@@ -579,6 +1050,106 @@ interface DocsConfig {
|
|
|
579
1050
|
* ```
|
|
580
1051
|
*/
|
|
581
1052
|
pageActions?: PageActionsConfig;
|
|
1053
|
+
/**
|
|
1054
|
+
* Configuration for the "Last updated" date display.
|
|
1055
|
+
*
|
|
1056
|
+
* - `true` or `undefined` → shown in footer next to "Edit on GitHub" (default)
|
|
1057
|
+
* - `false` → hidden
|
|
1058
|
+
* - `{ position: "below-title" }` → shown below the page title
|
|
1059
|
+
* - `{ position: "footer" }` → shown next to "Edit on GitHub" (default)
|
|
1060
|
+
*
|
|
1061
|
+
* @example
|
|
1062
|
+
* ```ts
|
|
1063
|
+
* // Show below title (Mintlify style)
|
|
1064
|
+
* lastUpdated: { position: "below-title" }
|
|
1065
|
+
*
|
|
1066
|
+
* // Hide entirely
|
|
1067
|
+
* lastUpdated: false
|
|
1068
|
+
* ```
|
|
1069
|
+
*/
|
|
1070
|
+
lastUpdated?: boolean | LastUpdatedConfig;
|
|
1071
|
+
/**
|
|
1072
|
+
* AI-powered "Ask AI" chat for documentation.
|
|
1073
|
+
*
|
|
1074
|
+
* When enabled, the unified API route handler (`/api/docs`) accepts
|
|
1075
|
+
* POST requests for AI chat. The handler uses RAG (Retrieval-Augmented
|
|
1076
|
+
* Generation) — it searches relevant docs, builds context, and streams
|
|
1077
|
+
* a response from an LLM.
|
|
1078
|
+
*
|
|
1079
|
+
* The API key defaults to `process.env.OPENAI_API_KEY`. For other providers,
|
|
1080
|
+
* pass the key via `apiKey: process.env.YOUR_KEY`.
|
|
1081
|
+
*
|
|
1082
|
+
* @example
|
|
1083
|
+
* ```ts
|
|
1084
|
+
* // Enable with defaults (gpt-4o-mini, OPENAI_API_KEY)
|
|
1085
|
+
* ai: { enabled: true }
|
|
1086
|
+
*
|
|
1087
|
+
* // Custom model + system prompt
|
|
1088
|
+
* ai: {
|
|
1089
|
+
* enabled: true,
|
|
1090
|
+
* model: "gpt-4o",
|
|
1091
|
+
* systemPrompt: "You are an expert on our SDK. Be concise.",
|
|
1092
|
+
* }
|
|
1093
|
+
*
|
|
1094
|
+
* // Use a different provider (e.g. Groq)
|
|
1095
|
+
* ai: {
|
|
1096
|
+
* enabled: true,
|
|
1097
|
+
* baseUrl: "https://api.groq.com/openai/v1",
|
|
1098
|
+
* apiKey: process.env.GROQ_API_KEY,
|
|
1099
|
+
* model: "llama-3.1-70b-versatile",
|
|
1100
|
+
* }
|
|
1101
|
+
* ```
|
|
1102
|
+
*/
|
|
1103
|
+
ai?: AIConfig;
|
|
1104
|
+
/**
|
|
1105
|
+
* Sidebar ordering strategy.
|
|
1106
|
+
*
|
|
1107
|
+
* - `"alphabetical"` — sort pages alphabetically by folder name (default)
|
|
1108
|
+
* - `"numeric"` — sort by frontmatter `order` field (lower first, unset pages last)
|
|
1109
|
+
* - `OrderingItem[]` — explicit slug-based ordering with nested children
|
|
1110
|
+
*
|
|
1111
|
+
* @default "alphabetical"
|
|
1112
|
+
*
|
|
1113
|
+
* @example
|
|
1114
|
+
* ```ts
|
|
1115
|
+
* // Alphabetical (default)
|
|
1116
|
+
* ordering: "alphabetical",
|
|
1117
|
+
*
|
|
1118
|
+
* // Use frontmatter `order: 1`, `order: 2`, etc.
|
|
1119
|
+
* ordering: "numeric",
|
|
1120
|
+
*
|
|
1121
|
+
* // Explicit slug-based ordering
|
|
1122
|
+
* ordering: [
|
|
1123
|
+
* { slug: "installation" },
|
|
1124
|
+
* { slug: "cli" },
|
|
1125
|
+
* { slug: "configuration" },
|
|
1126
|
+
* { slug: "themes", children: [
|
|
1127
|
+
* { slug: "default" },
|
|
1128
|
+
* { slug: "darksharp" },
|
|
1129
|
+
* { slug: "pixel-border" },
|
|
1130
|
+
* { slug: "creating-themes" },
|
|
1131
|
+
* ]},
|
|
1132
|
+
* { slug: "customization" },
|
|
1133
|
+
* { slug: "reference" },
|
|
1134
|
+
* ]
|
|
1135
|
+
* ```
|
|
1136
|
+
*/
|
|
1137
|
+
ordering?: "alphabetical" | "numeric" | OrderingItem[];
|
|
1138
|
+
/**
|
|
1139
|
+
* Auto-generate `/llms.txt` and `/llms-full.txt` routes for LLM-friendly
|
|
1140
|
+
* documentation. These files let AI tools quickly understand your docs.
|
|
1141
|
+
*
|
|
1142
|
+
* @example
|
|
1143
|
+
* ```ts
|
|
1144
|
+
* llmsTxt: {
|
|
1145
|
+
* enabled: true,
|
|
1146
|
+
* baseUrl: "https://docs.example.com",
|
|
1147
|
+
* }
|
|
1148
|
+
* ```
|
|
1149
|
+
*
|
|
1150
|
+
* @see https://llmstxt.org
|
|
1151
|
+
*/
|
|
1152
|
+
llmsTxt?: boolean | LlmsTxtConfig;
|
|
582
1153
|
/** SEO metadata - separate from theme */
|
|
583
1154
|
metadata?: DocsMetadata;
|
|
584
1155
|
/** Open Graph image handling */
|
|
@@ -632,7 +1203,7 @@ declare function createTheme(baseTheme: DocsTheme): (overrides?: Partial<DocsThe
|
|
|
632
1203
|
* @example
|
|
633
1204
|
* ```ts
|
|
634
1205
|
* import { extendTheme } from "@farming-labs/docs";
|
|
635
|
-
* import { fumadocs } from "@farming-labs/
|
|
1206
|
+
* import { fumadocs } from "@farming-labs/theme/default";
|
|
636
1207
|
*
|
|
637
1208
|
* // Start with fumadocs defaults, override some values
|
|
638
1209
|
* export const myTheme = extendTheme(fumadocs(), {
|
|
@@ -654,4 +1225,4 @@ declare function resolveTitle(pageTitle: string, metadata?: DocsMetadata): strin
|
|
|
654
1225
|
*/
|
|
655
1226
|
declare function resolveOGImage(page: PageFrontmatter, ogConfig?: OGConfig, baseUrl?: string): string | undefined;
|
|
656
1227
|
//#endregion
|
|
657
|
-
export { type BreadcrumbConfig, type CopyMarkdownConfig, type DocsConfig, type DocsMetadata, type DocsNav, type DocsTheme, type FontStyle, type GithubConfig, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, type PageActionsConfig, type PageFrontmatter, type SidebarConfig, type ThemeToggleConfig, type TypographyConfig, type UIConfig, createTheme, deepMerge, defineDocs, extendTheme, resolveOGImage, resolveTitle };
|
|
1228
|
+
export { type AIConfig, type BreadcrumbConfig, type CopyMarkdownConfig, type DocsConfig, type DocsMetadata, type DocsNav, type DocsTheme, type FontStyle, type GithubConfig, type LastUpdatedConfig, type LlmsTxtConfig, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, type OrderingItem, type PageActionsConfig, type PageFrontmatter, type SidebarComponentProps, type SidebarConfig, type SidebarFolderNode, type SidebarNode, type SidebarPageNode, type SidebarTree, type ThemeToggleConfig, type TypographyConfig, type UIConfig, createTheme, deepMerge, defineDocs, extendTheme, resolveOGImage, resolveTitle };
|
package/dist/index.mjs
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
function defineDocs(config) {
|
|
6
6
|
return {
|
|
7
7
|
entry: config.entry ?? "docs",
|
|
8
|
+
contentDir: config.contentDir,
|
|
8
9
|
theme: config.theme,
|
|
9
10
|
nav: config.nav,
|
|
10
11
|
github: config.github,
|
|
@@ -14,6 +15,10 @@ function defineDocs(config) {
|
|
|
14
15
|
components: config.components,
|
|
15
16
|
icons: config.icons,
|
|
16
17
|
pageActions: config.pageActions,
|
|
18
|
+
lastUpdated: config.lastUpdated,
|
|
19
|
+
llmsTxt: config.llmsTxt,
|
|
20
|
+
ai: config.ai,
|
|
21
|
+
ordering: config.ordering,
|
|
17
22
|
metadata: config.metadata,
|
|
18
23
|
og: config.og
|
|
19
24
|
};
|
|
@@ -81,7 +86,7 @@ function createTheme(baseTheme) {
|
|
|
81
86
|
* @example
|
|
82
87
|
* ```ts
|
|
83
88
|
* import { extendTheme } from "@farming-labs/docs";
|
|
84
|
-
* import { fumadocs } from "@farming-labs/
|
|
89
|
+
* import { fumadocs } from "@farming-labs/theme/default";
|
|
85
90
|
*
|
|
86
91
|
* // Start with fumadocs defaults, override some values
|
|
87
92
|
* export const myTheme = extendTheme(fumadocs(), {
|