@blaaiz/docs-core 0.4.0 → 0.6.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 (43) hide show
  1. package/dist/{chunk-JHN5XQPU.js → chunk-2GUUVNTP.js} +226 -31
  2. package/dist/chunk-2GUUVNTP.js.map +1 -0
  3. package/dist/{chunk-ZKOOKLZ3.js → chunk-6H6OB7YP.js} +17 -2
  4. package/dist/chunk-6H6OB7YP.js.map +1 -0
  5. package/dist/generator.cjs +204 -30
  6. package/dist/generator.cjs.map +1 -1
  7. package/dist/generator.d.cts +24 -0
  8. package/dist/generator.d.ts +24 -0
  9. package/dist/generator.js +179 -22
  10. package/dist/generator.js.map +1 -1
  11. package/dist/index.cjs +228 -28
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +267 -8
  14. package/dist/index.d.ts +267 -8
  15. package/dist/index.js +1 -1
  16. package/dist/{navigation-CGqFIPlP.d.cts → navigation-DvgyWSZ4.d.cts} +22 -1
  17. package/dist/{navigation-CGqFIPlP.d.ts → navigation-DvgyWSZ4.d.ts} +22 -1
  18. package/dist/ui/api-try-it.cjs +15 -0
  19. package/dist/ui/api-try-it.cjs.map +1 -1
  20. package/dist/ui/api-try-it.js +1 -1
  21. package/dist/ui/ask-ai.cjs +26 -6
  22. package/dist/ui/ask-ai.cjs.map +1 -1
  23. package/dist/ui/ask-ai.d.cts +6 -1
  24. package/dist/ui/ask-ai.d.ts +6 -1
  25. package/dist/ui/ask-ai.js +26 -6
  26. package/dist/ui/ask-ai.js.map +1 -1
  27. package/dist/ui/copy-page.cjs +15 -0
  28. package/dist/ui/copy-page.cjs.map +1 -1
  29. package/dist/ui/copy-page.js +1 -1
  30. package/dist/ui.cjs +77 -6
  31. package/dist/ui.cjs.map +1 -1
  32. package/dist/ui.d.cts +99 -8
  33. package/dist/ui.d.ts +99 -8
  34. package/dist/ui.js +62 -8
  35. package/dist/ui.js.map +1 -1
  36. package/package.json +1 -1
  37. package/skills/SKILL.md +73 -27
  38. package/styles/api-reference.css +45 -2
  39. package/styles/ask-ai.css +28 -0
  40. package/styles/docs.css +96 -1
  41. package/styles/home.css +34 -1
  42. package/dist/chunk-JHN5XQPU.js.map +0 -1
  43. package/dist/chunk-ZKOOKLZ3.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AiConfig, T as ThemeConfig, D as DocsConfig, N as Navigation } from './navigation-CGqFIPlP.cjs';
2
- export { a as AI_PROVIDER_MODELS, b as AI_PROVIDER_NAMES, c as AiConfigError, d as AiProviderModels, e as AiProviderName, f as AuthConfig, g as DocPage, h as DocsConfigError, F as FeaturesConfig, G as GoogleProviderConfig, i as NavGroup, j as NavItem, k as NavMethod, l as NavPage, m as NavTab, O as OpenApiPage, P as ProxyConfig, R as ResolvedAiConfig, S as SecretProviderConfig, n as SeoConfig, o as ThemeLogo, p as ThemePalette, W as WorkspaceAuthConfig, q as WorkspaceProviders, r as defineDocsConfig, s as resolveAiConfig, v as validateDocsConfig } from './navigation-CGqFIPlP.cjs';
1
+ import { A as AiConfig, T as ThemeConfig, D as DocsConfig, N as Navigation } from './navigation-DvgyWSZ4.cjs';
2
+ export { a as AI_PROVIDER_MODELS, b as AI_PROVIDER_NAMES, c as AiConfigError, d as AiProviderModels, e as AiProviderName, f as AuthConfig, g as DocPage, h as DocsConfigError, F as FeaturesConfig, G as GoogleProviderConfig, i as NavGroup, j as NavItem, k as NavMethod, l as NavPage, m as NavTab, O as OpenApiPage, P as ProxyConfig, R as ResolvedAiConfig, S as SecretProviderConfig, n as SeoConfig, o as ThemeLogo, p as ThemePalette, W as WorkspaceAuthConfig, q as WorkspaceProviders, r as defineDocsConfig, s as resolveAiConfig, v as validateDocsConfig } from './navigation-DvgyWSZ4.cjs';
3
3
  import { b as OpenApiDocument, O as OpenApiInfo, a as OpenApiServer } from './openapi-types-CJ6p5Cux.cjs';
4
4
  export { c as OpenApiComponents, d as OpenApiOperation, e as OpenApiPathItem, f as OpenApiTag } from './openapi-types-CJ6p5Cux.cjs';
5
5
 
@@ -397,6 +397,152 @@ declare function createAskAiRoute(options: AskAiRouteOptions): AskAiRoute;
397
397
  */
398
398
  declare function buildThemeCss(theme: ThemeConfig): string;
399
399
 
400
+ /**
401
+ * Permanent redirects for renamed pages. The generator writes
402
+ * `content/redirects.json` (old page URL to current) whenever an operation's
403
+ * URL changes; the site's middleware serves `308`s from it, so an edited
404
+ * summary is a rename with a forwarding address, never a dead link.
405
+ *
406
+ * @packageDocumentation
407
+ */
408
+ /**
409
+ * The URL a renamed page's request should be redirected to, or `null` when
410
+ * the request matches no entry. The `.md` form of a renamed page redirects to
411
+ * the `.md` form of its new address.
412
+ *
413
+ * @example
414
+ * ```ts
415
+ * const redirected = redirectTarget(request.nextUrl, redirects);
416
+ * if (redirected) {
417
+ * return NextResponse.redirect(redirected, 308);
418
+ * }
419
+ * ```
420
+ *
421
+ * @param url - the request URL
422
+ * @param redirects - the parsed `content/redirects.json`
423
+ * @returns the redirect target, or `null`
424
+ * @public
425
+ */
426
+ declare function redirectTarget(url: URL, redirects: Readonly<Record<string, string>>): URL | null;
427
+
428
+ /**
429
+ * The site's `/llms.txt`: a Markdown index of every page, the entry point
430
+ * agents fetch first. Each entry links the page's `.md` address.
431
+ *
432
+ * @packageDocumentation
433
+ */
434
+ /**
435
+ * One page of the documentation index.
436
+ *
437
+ * @public
438
+ */
439
+ interface LlmsTxtPage {
440
+ readonly title: string;
441
+ /** The page URL (e.g. `/docs/guides/webhooks`); `.md` is appended. */
442
+ readonly url: string;
443
+ readonly description?: string;
444
+ }
445
+ /**
446
+ * Options for {@link buildLlmsTxt}.
447
+ *
448
+ * @public
449
+ */
450
+ interface BuildLlmsTxtOptions {
451
+ /** The site name, the index's `#` heading. */
452
+ readonly name: string;
453
+ /** One sentence on what the site documents. */
454
+ readonly description?: string;
455
+ /** Absolute origin to prefix every link with (e.g. `https://docs.example.com`). */
456
+ readonly origin?: string;
457
+ }
458
+ /**
459
+ * Build the `/llms.txt` document from the site's pages.
460
+ *
461
+ * @example
462
+ * ```ts
463
+ * // app/llms.txt/route.ts
464
+ * export function GET() {
465
+ * const body = buildLlmsTxt(pages, { name: config.theme.name });
466
+ * return new Response(body, { headers: { 'content-type': 'text/plain; charset=utf-8' } });
467
+ * }
468
+ * ```
469
+ *
470
+ * @param pages - the site's pages, in navigation order
471
+ * @param options - the site name, description, and link origin
472
+ * @returns the document text
473
+ * @public
474
+ */
475
+ declare function buildLlmsTxt(pages: readonly LlmsTxtPage[], options: BuildLlmsTxtOptions): string;
476
+
477
+ /**
478
+ * Code-sample generators for the API reference's usage panel.
479
+ *
480
+ * `fumadocs-openapi` renders one sample per registered generator; a site
481
+ * replaces a built-in one by adding a generator under the same id. The shapes
482
+ * here are structural, so this module needs no fumadocs types.
483
+ *
484
+ * @packageDocumentation
485
+ */
486
+ /**
487
+ * One resolved request parameter, as the usage panel passes it.
488
+ *
489
+ * @public
490
+ */
491
+ interface CodeUsageValue {
492
+ /** The parameter's example value. */
493
+ readonly value: string;
494
+ }
495
+ /**
496
+ * The resolved example request a code-sample generator receives.
497
+ *
498
+ * @public
499
+ */
500
+ interface CodeUsageRequest {
501
+ /** The HTTP method. */
502
+ readonly method: string;
503
+ /** The full request URL, path and query resolved. */
504
+ readonly url: string;
505
+ /** Header name to example value. */
506
+ readonly header?: Readonly<Record<string, CodeUsageValue>>;
507
+ /** Cookie name to example value. */
508
+ readonly cookie?: Readonly<Record<string, CodeUsageValue>>;
509
+ /** The example request body, when the operation takes one. */
510
+ readonly body?: unknown;
511
+ /** The body's media type, when the operation takes a body. */
512
+ readonly bodyMediaType?: string;
513
+ }
514
+ /**
515
+ * A code-sample generator, shaped for fumadocs-openapi's code-usage registry.
516
+ *
517
+ * @public
518
+ */
519
+ interface CodeUsageGenerator {
520
+ /** The tab label readers see. */
521
+ readonly label: string;
522
+ /** The sample's syntax-highlighting language. */
523
+ readonly lang: string;
524
+ /** Render the sample for one resolved example request. */
525
+ generate(data: CodeUsageRequest): string;
526
+ }
527
+ /**
528
+ * A cURL sample in long-form flags: `--request`, `--url`, `--header`,
529
+ * `--data`. Register it over the built-in `curl` entry:
530
+ *
531
+ * @example
532
+ * ```ts
533
+ * import { curlCodeUsage } from '@blaaiz/docs-core';
534
+ * import { createCodeUsageGeneratorRegistry } from 'fumadocs-openapi/requests/generators';
535
+ * import { registerDefault } from 'fumadocs-openapi/requests/generators/all';
536
+ *
537
+ * const codeUsages = registerDefault(createCodeUsageGeneratorRegistry());
538
+ * codeUsages.add('curl', curlCodeUsage);
539
+ * createOpenAPI({ input, codeUsages });
540
+ * ```
541
+ *
542
+ * @public
543
+ */
544
+ declare const curlCodeUsage: CodeUsageGenerator;
545
+
400
546
  /**
401
547
  * SEO metadata, derived from {@link DocsConfig}.
402
548
  *
@@ -628,6 +774,8 @@ interface PlannedGroupChild {
628
774
  readonly order: number;
629
775
  /** The child folder's name within the group directory. */
630
776
  readonly folder: string;
777
+ /** The child group's title, for the heading the `headings` style renders. */
778
+ readonly title: string;
631
779
  }
632
780
  /**
633
781
  * A planned API group folder. The generator fills its page order once the
@@ -645,6 +793,21 @@ interface PlannedApiGroup {
645
793
  /** The tab's icon, on a `root` group. */
646
794
  readonly icon?: string;
647
795
  }
796
+ /**
797
+ * A doc page declared inside an API tab, at its position among the group's
798
+ * operations. The generator links it into the group's `meta.json`: the page
799
+ * keeps living in its own folder, outside the generated tree.
800
+ *
801
+ * @public
802
+ */
803
+ interface PlannedApiDocLink {
804
+ /** Page path relative to the docs output directory, without extension. */
805
+ readonly file: string;
806
+ /** The generated group folder whose meta lists the link. */
807
+ readonly dir: string;
808
+ /** Position within the group. */
809
+ readonly order: number;
810
+ }
648
811
  /**
649
812
  * A `meta.json` file the plan wants written.
650
813
  *
@@ -668,12 +831,22 @@ interface DocsTreePlan {
668
831
  /** Fully-known meta files: the root, doc tab folders, and doc groups. */
669
832
  readonly metas: readonly PlannedMeta[];
670
833
  /**
671
- * Doc pages declared inside API tabs. The plan cannot place them in the
672
- * generated folders, so the generator reports them instead of dropping them
673
- * silently; they stay reachable at their own URLs.
834
+ * Doc pages declared inside API tabs, each linked into its group's meta at
835
+ * its declared position.
674
836
  */
675
- readonly apiTabDocPages: readonly string[];
837
+ readonly apiDocLinks: readonly PlannedApiDocLink[];
676
838
  }
839
+ /**
840
+ * How the sidebar presents a tab's top-level groups.
841
+ *
842
+ * - `collapsible`: every group is a collapsible folder (the fumadocs default).
843
+ * - `headings`: a top-level group is a flat, always-open section heading with
844
+ * its pages listed beneath it; only nested groups collapse, and they start
845
+ * closed. The Mintlify presentation.
846
+ *
847
+ * @public
848
+ */
849
+ type SidebarStyle = 'collapsible' | 'headings';
677
850
  /**
678
851
  * Options for {@link planDocsTree}.
679
852
  *
@@ -682,6 +855,8 @@ interface DocsTreePlan {
682
855
  interface PlanDocsTreeOptions {
683
856
  /** Folder for generated API pages when one tab publishes them. Default `api`. */
684
857
  readonly apiDir?: string;
858
+ /** The sidebar's group presentation. Default `collapsible`. */
859
+ readonly sidebar?: SidebarStyle;
685
860
  }
686
861
  /**
687
862
  * Plan the content tree for a navigation.
@@ -696,9 +871,11 @@ interface PlanDocsTreeOptions {
696
871
  * - Root-level doc pages (no `/` in the path) are listed in the root meta.
697
872
  * - Tab folders get `root: true`, so the sidebar scopes to the active tab.
698
873
  * - Sidebar order is declaration order, pages and groups interleaved.
874
+ * - With `sidebar: 'headings'`, a tab-level group renders as a flat heading
875
+ * with its pages extracted beneath it, and nested groups start closed.
699
876
  *
700
877
  * @param navigation - the parsed navigation
701
- * @param options - the API folder name
878
+ * @param options - the API folder name and the sidebar style
702
879
  * @returns the plan the generator executes
703
880
  * @throws when two sibling groups slugify to the same folder
704
881
  * @public
@@ -785,6 +962,38 @@ interface CreateMarkdownRouteOptions {
785
962
  * when the document is expensive to build.
786
963
  */
787
964
  readonly loadOpenApiDocuments?: () => Readonly<Record<string, OpenApiDocument>> | Promise<Readonly<Record<string, OpenApiDocument>>>;
965
+ /**
966
+ * Loads a generated API page's original operation source: the spec file
967
+ * path, the method and route, and the file's raw contents. When it returns
968
+ * one, the page's Markdown is the operation spec in full under an
969
+ * `## OpenAPI` heading, the shape agents get from the major docs platforms;
970
+ * pages it returns `null` for fall through to the MDX conversion. Wire it
971
+ * from the generator's `api-sources.json`.
972
+ */
973
+ readonly loadOperationSource?: (slug: readonly string[] | undefined) => Promise<OperationSource | null>;
974
+ /**
975
+ * The site's documentation index path (`/llms.txt`). When set, every
976
+ * response opens with a blockquote pointing agents at it, on the origin the
977
+ * request came in on — correct on localhost, a preview deploy, and
978
+ * production alike.
979
+ */
980
+ readonly llmsTxtPath?: string;
981
+ }
982
+ /**
983
+ * A generated API page's original operation source, as
984
+ * {@link CreateMarkdownRouteOptions.loadOperationSource} returns it.
985
+ *
986
+ * @public
987
+ */
988
+ interface OperationSource {
989
+ /** The spec file, relative to the content directory. */
990
+ readonly file: string;
991
+ /** The operation's HTTP method. */
992
+ readonly method: string;
993
+ /** The operation's API route. */
994
+ readonly route: string;
995
+ /** The spec file's raw contents. */
996
+ readonly source: string;
788
997
  }
789
998
  /**
790
999
  * Build a drop-in route that serves a page as plain Markdown. It reads the raw
@@ -802,6 +1011,56 @@ interface CreateMarkdownRouteOptions {
802
1011
  * @public
803
1012
  */
804
1013
  declare function createMarkdownRoute(options: CreateMarkdownRouteOptions): MarkdownRoute;
1014
+ /**
1015
+ * Options for {@link markdownRewriteTarget}.
1016
+ *
1017
+ * @public
1018
+ */
1019
+ interface MarkdownRewriteOptions {
1020
+ /** The docs base URL. Default `/docs`. */
1021
+ readonly baseUrl?: string;
1022
+ /** Where the Markdown route is mounted. Default `/md`. */
1023
+ readonly markdownBase?: string;
1024
+ }
1025
+ /**
1026
+ * The internal URL serving a docs page's Markdown, for a request whose path is
1027
+ * the page URL plus `.md` — the convention agents and other tools expect
1028
+ * (`/docs/guides/webhooks.md`). Returns `null` for every other request. A
1029
+ * site's middleware rewrites to the returned URL:
1030
+ *
1031
+ * @example
1032
+ * ```ts
1033
+ * const markdown = markdownRewriteTarget(request.nextUrl);
1034
+ * if (markdown) {
1035
+ * return NextResponse.rewrite(markdown);
1036
+ * }
1037
+ * ```
1038
+ *
1039
+ * @param url - the request URL
1040
+ * @param options - the docs base and the Markdown route's mount point
1041
+ * @returns the rewrite target, or `null` when the request is not a `.md` path
1042
+ * @public
1043
+ */
1044
+ declare function markdownRewriteTarget(url: URL, options?: MarkdownRewriteOptions): URL | null;
1045
+ /**
1046
+ * Whether a request addresses the Markdown route's internal mount directly.
1047
+ * The route exists as the rewrite target for the page-URL-plus-`.md`
1048
+ * convention; a direct request to it gets `404` from the site's middleware,
1049
+ * so every page's Markdown has one public address.
1050
+ *
1051
+ * @example
1052
+ * ```ts
1053
+ * if (isMarkdownRouteRequest(request.nextUrl)) {
1054
+ * return new NextResponse('Not found', { status: 404 });
1055
+ * }
1056
+ * ```
1057
+ *
1058
+ * @param url - the request URL
1059
+ * @param options - the Markdown route's mount point
1060
+ * @returns whether the request must be refused
1061
+ * @public
1062
+ */
1063
+ declare function isMarkdownRouteRequest(url: URL, options?: Pick<MarkdownRewriteOptions, 'markdownBase'>): boolean;
805
1064
 
806
1065
  /**
807
1066
  * Allowed-domain checks.
@@ -1280,4 +1539,4 @@ declare class OpenApiMergeError extends Error {
1280
1539
  */
1281
1540
  declare function mergeOpenApiDocuments(inputs: readonly unknown[], options: MergeOpenApiOptions): OpenApiDocument;
1282
1541
 
1283
- export { AiConfig, type AiMessage, type AskAiDocumentsSource, type AskAiRoute, type AskAiRouteOptions, type AskAiSource, type AuthGateOptions, type BuildSitemapOptions, type CreateMarkdownRouteOptions, type CreateTryItProxyOptions, DocsConfig, type DocsMetadata, type DocsRobots, type DocsSitemapEntry, type DocsTreePlan, type EmailSignInOptions, type FetchLike, type GoogleAuthHandlers, type GoogleAuthOptions, type IndexedDocument, InvalidNavigationError, type MarkdownRoute, type MdxReader, type MdxToMarkdownOptions, type MergeOpenApiOptions, Navigation, OpenApiDocument, OpenApiInfo, OpenApiMergeError, type OpenApiOperationRef, OpenApiServer, type PageSeo, type PlanDocsTreeOptions, type PlannedApiGroup, type PlannedApiPage, type PlannedGroupChild, type PlannedMeta, ProxyTargetError, SESSION_COOKIE, type SearchDocument, type SearchIndex, type SearchResult, type SecretSignInOptions, type SessionPayload, type SignOutOptions, type SiteAuth, type SiteAuthOptions, type SitemapChangeFrequency, type SitemapEntry, ThemeConfig, type TryItEnvelope, type TryItProxyRoute, assertAllowedTarget, buildMetadata, buildRobots, buildSearchIndex, buildSessionCookie, buildSitemap, buildThemeCss, clearSessionCookie, createAskAiRoute, createAuthGate, createEmailSignIn, createGoogleAuth, createMarkdownRoute, createSecretSignIn, createSignOut, createSiteAuth, createTryItProxy, createTryItProxyRoute, isAllowedEmail, mdxToMarkdown, mergeOpenApiDocuments, openApiOperationToMarkdown, parseNavigation, planDocsTree, readCookie, searchIndex, signSession, unwrapProxyTarget, verifySession };
1542
+ export { AiConfig, type AiMessage, type AskAiDocumentsSource, type AskAiRoute, type AskAiRouteOptions, type AskAiSource, type AuthGateOptions, type BuildLlmsTxtOptions, type BuildSitemapOptions, type CodeUsageGenerator, type CodeUsageRequest, type CodeUsageValue, type CreateMarkdownRouteOptions, type CreateTryItProxyOptions, DocsConfig, type DocsMetadata, type DocsRobots, type DocsSitemapEntry, type DocsTreePlan, type EmailSignInOptions, type FetchLike, type GoogleAuthHandlers, type GoogleAuthOptions, type IndexedDocument, InvalidNavigationError, type LlmsTxtPage, type MarkdownRewriteOptions, type MarkdownRoute, type MdxReader, type MdxToMarkdownOptions, type MergeOpenApiOptions, Navigation, OpenApiDocument, OpenApiInfo, OpenApiMergeError, type OpenApiOperationRef, OpenApiServer, type OperationSource, type PageSeo, type PlanDocsTreeOptions, type PlannedApiDocLink, type PlannedApiGroup, type PlannedApiPage, type PlannedGroupChild, type PlannedMeta, ProxyTargetError, SESSION_COOKIE, type SearchDocument, type SearchIndex, type SearchResult, type SecretSignInOptions, type SessionPayload, type SignOutOptions, type SiteAuth, type SiteAuthOptions, type SitemapChangeFrequency, type SitemapEntry, ThemeConfig, type TryItEnvelope, type TryItProxyRoute, assertAllowedTarget, buildLlmsTxt, buildMetadata, buildRobots, buildSearchIndex, buildSessionCookie, buildSitemap, buildThemeCss, clearSessionCookie, createAskAiRoute, createAuthGate, createEmailSignIn, createGoogleAuth, createMarkdownRoute, createSecretSignIn, createSignOut, createSiteAuth, createTryItProxy, createTryItProxyRoute, curlCodeUsage, isAllowedEmail, isMarkdownRouteRequest, markdownRewriteTarget, mdxToMarkdown, mergeOpenApiDocuments, openApiOperationToMarkdown, parseNavigation, planDocsTree, readCookie, redirectTarget, searchIndex, signSession, unwrapProxyTarget, verifySession };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AiConfig, T as ThemeConfig, D as DocsConfig, N as Navigation } from './navigation-CGqFIPlP.js';
2
- export { a as AI_PROVIDER_MODELS, b as AI_PROVIDER_NAMES, c as AiConfigError, d as AiProviderModels, e as AiProviderName, f as AuthConfig, g as DocPage, h as DocsConfigError, F as FeaturesConfig, G as GoogleProviderConfig, i as NavGroup, j as NavItem, k as NavMethod, l as NavPage, m as NavTab, O as OpenApiPage, P as ProxyConfig, R as ResolvedAiConfig, S as SecretProviderConfig, n as SeoConfig, o as ThemeLogo, p as ThemePalette, W as WorkspaceAuthConfig, q as WorkspaceProviders, r as defineDocsConfig, s as resolveAiConfig, v as validateDocsConfig } from './navigation-CGqFIPlP.js';
1
+ import { A as AiConfig, T as ThemeConfig, D as DocsConfig, N as Navigation } from './navigation-DvgyWSZ4.js';
2
+ export { a as AI_PROVIDER_MODELS, b as AI_PROVIDER_NAMES, c as AiConfigError, d as AiProviderModels, e as AiProviderName, f as AuthConfig, g as DocPage, h as DocsConfigError, F as FeaturesConfig, G as GoogleProviderConfig, i as NavGroup, j as NavItem, k as NavMethod, l as NavPage, m as NavTab, O as OpenApiPage, P as ProxyConfig, R as ResolvedAiConfig, S as SecretProviderConfig, n as SeoConfig, o as ThemeLogo, p as ThemePalette, W as WorkspaceAuthConfig, q as WorkspaceProviders, r as defineDocsConfig, s as resolveAiConfig, v as validateDocsConfig } from './navigation-DvgyWSZ4.js';
3
3
  import { b as OpenApiDocument, O as OpenApiInfo, a as OpenApiServer } from './openapi-types-CJ6p5Cux.js';
4
4
  export { c as OpenApiComponents, d as OpenApiOperation, e as OpenApiPathItem, f as OpenApiTag } from './openapi-types-CJ6p5Cux.js';
5
5
 
@@ -397,6 +397,152 @@ declare function createAskAiRoute(options: AskAiRouteOptions): AskAiRoute;
397
397
  */
398
398
  declare function buildThemeCss(theme: ThemeConfig): string;
399
399
 
400
+ /**
401
+ * Permanent redirects for renamed pages. The generator writes
402
+ * `content/redirects.json` (old page URL to current) whenever an operation's
403
+ * URL changes; the site's middleware serves `308`s from it, so an edited
404
+ * summary is a rename with a forwarding address, never a dead link.
405
+ *
406
+ * @packageDocumentation
407
+ */
408
+ /**
409
+ * The URL a renamed page's request should be redirected to, or `null` when
410
+ * the request matches no entry. The `.md` form of a renamed page redirects to
411
+ * the `.md` form of its new address.
412
+ *
413
+ * @example
414
+ * ```ts
415
+ * const redirected = redirectTarget(request.nextUrl, redirects);
416
+ * if (redirected) {
417
+ * return NextResponse.redirect(redirected, 308);
418
+ * }
419
+ * ```
420
+ *
421
+ * @param url - the request URL
422
+ * @param redirects - the parsed `content/redirects.json`
423
+ * @returns the redirect target, or `null`
424
+ * @public
425
+ */
426
+ declare function redirectTarget(url: URL, redirects: Readonly<Record<string, string>>): URL | null;
427
+
428
+ /**
429
+ * The site's `/llms.txt`: a Markdown index of every page, the entry point
430
+ * agents fetch first. Each entry links the page's `.md` address.
431
+ *
432
+ * @packageDocumentation
433
+ */
434
+ /**
435
+ * One page of the documentation index.
436
+ *
437
+ * @public
438
+ */
439
+ interface LlmsTxtPage {
440
+ readonly title: string;
441
+ /** The page URL (e.g. `/docs/guides/webhooks`); `.md` is appended. */
442
+ readonly url: string;
443
+ readonly description?: string;
444
+ }
445
+ /**
446
+ * Options for {@link buildLlmsTxt}.
447
+ *
448
+ * @public
449
+ */
450
+ interface BuildLlmsTxtOptions {
451
+ /** The site name, the index's `#` heading. */
452
+ readonly name: string;
453
+ /** One sentence on what the site documents. */
454
+ readonly description?: string;
455
+ /** Absolute origin to prefix every link with (e.g. `https://docs.example.com`). */
456
+ readonly origin?: string;
457
+ }
458
+ /**
459
+ * Build the `/llms.txt` document from the site's pages.
460
+ *
461
+ * @example
462
+ * ```ts
463
+ * // app/llms.txt/route.ts
464
+ * export function GET() {
465
+ * const body = buildLlmsTxt(pages, { name: config.theme.name });
466
+ * return new Response(body, { headers: { 'content-type': 'text/plain; charset=utf-8' } });
467
+ * }
468
+ * ```
469
+ *
470
+ * @param pages - the site's pages, in navigation order
471
+ * @param options - the site name, description, and link origin
472
+ * @returns the document text
473
+ * @public
474
+ */
475
+ declare function buildLlmsTxt(pages: readonly LlmsTxtPage[], options: BuildLlmsTxtOptions): string;
476
+
477
+ /**
478
+ * Code-sample generators for the API reference's usage panel.
479
+ *
480
+ * `fumadocs-openapi` renders one sample per registered generator; a site
481
+ * replaces a built-in one by adding a generator under the same id. The shapes
482
+ * here are structural, so this module needs no fumadocs types.
483
+ *
484
+ * @packageDocumentation
485
+ */
486
+ /**
487
+ * One resolved request parameter, as the usage panel passes it.
488
+ *
489
+ * @public
490
+ */
491
+ interface CodeUsageValue {
492
+ /** The parameter's example value. */
493
+ readonly value: string;
494
+ }
495
+ /**
496
+ * The resolved example request a code-sample generator receives.
497
+ *
498
+ * @public
499
+ */
500
+ interface CodeUsageRequest {
501
+ /** The HTTP method. */
502
+ readonly method: string;
503
+ /** The full request URL, path and query resolved. */
504
+ readonly url: string;
505
+ /** Header name to example value. */
506
+ readonly header?: Readonly<Record<string, CodeUsageValue>>;
507
+ /** Cookie name to example value. */
508
+ readonly cookie?: Readonly<Record<string, CodeUsageValue>>;
509
+ /** The example request body, when the operation takes one. */
510
+ readonly body?: unknown;
511
+ /** The body's media type, when the operation takes a body. */
512
+ readonly bodyMediaType?: string;
513
+ }
514
+ /**
515
+ * A code-sample generator, shaped for fumadocs-openapi's code-usage registry.
516
+ *
517
+ * @public
518
+ */
519
+ interface CodeUsageGenerator {
520
+ /** The tab label readers see. */
521
+ readonly label: string;
522
+ /** The sample's syntax-highlighting language. */
523
+ readonly lang: string;
524
+ /** Render the sample for one resolved example request. */
525
+ generate(data: CodeUsageRequest): string;
526
+ }
527
+ /**
528
+ * A cURL sample in long-form flags: `--request`, `--url`, `--header`,
529
+ * `--data`. Register it over the built-in `curl` entry:
530
+ *
531
+ * @example
532
+ * ```ts
533
+ * import { curlCodeUsage } from '@blaaiz/docs-core';
534
+ * import { createCodeUsageGeneratorRegistry } from 'fumadocs-openapi/requests/generators';
535
+ * import { registerDefault } from 'fumadocs-openapi/requests/generators/all';
536
+ *
537
+ * const codeUsages = registerDefault(createCodeUsageGeneratorRegistry());
538
+ * codeUsages.add('curl', curlCodeUsage);
539
+ * createOpenAPI({ input, codeUsages });
540
+ * ```
541
+ *
542
+ * @public
543
+ */
544
+ declare const curlCodeUsage: CodeUsageGenerator;
545
+
400
546
  /**
401
547
  * SEO metadata, derived from {@link DocsConfig}.
402
548
  *
@@ -628,6 +774,8 @@ interface PlannedGroupChild {
628
774
  readonly order: number;
629
775
  /** The child folder's name within the group directory. */
630
776
  readonly folder: string;
777
+ /** The child group's title, for the heading the `headings` style renders. */
778
+ readonly title: string;
631
779
  }
632
780
  /**
633
781
  * A planned API group folder. The generator fills its page order once the
@@ -645,6 +793,21 @@ interface PlannedApiGroup {
645
793
  /** The tab's icon, on a `root` group. */
646
794
  readonly icon?: string;
647
795
  }
796
+ /**
797
+ * A doc page declared inside an API tab, at its position among the group's
798
+ * operations. The generator links it into the group's `meta.json`: the page
799
+ * keeps living in its own folder, outside the generated tree.
800
+ *
801
+ * @public
802
+ */
803
+ interface PlannedApiDocLink {
804
+ /** Page path relative to the docs output directory, without extension. */
805
+ readonly file: string;
806
+ /** The generated group folder whose meta lists the link. */
807
+ readonly dir: string;
808
+ /** Position within the group. */
809
+ readonly order: number;
810
+ }
648
811
  /**
649
812
  * A `meta.json` file the plan wants written.
650
813
  *
@@ -668,12 +831,22 @@ interface DocsTreePlan {
668
831
  /** Fully-known meta files: the root, doc tab folders, and doc groups. */
669
832
  readonly metas: readonly PlannedMeta[];
670
833
  /**
671
- * Doc pages declared inside API tabs. The plan cannot place them in the
672
- * generated folders, so the generator reports them instead of dropping them
673
- * silently; they stay reachable at their own URLs.
834
+ * Doc pages declared inside API tabs, each linked into its group's meta at
835
+ * its declared position.
674
836
  */
675
- readonly apiTabDocPages: readonly string[];
837
+ readonly apiDocLinks: readonly PlannedApiDocLink[];
676
838
  }
839
+ /**
840
+ * How the sidebar presents a tab's top-level groups.
841
+ *
842
+ * - `collapsible`: every group is a collapsible folder (the fumadocs default).
843
+ * - `headings`: a top-level group is a flat, always-open section heading with
844
+ * its pages listed beneath it; only nested groups collapse, and they start
845
+ * closed. The Mintlify presentation.
846
+ *
847
+ * @public
848
+ */
849
+ type SidebarStyle = 'collapsible' | 'headings';
677
850
  /**
678
851
  * Options for {@link planDocsTree}.
679
852
  *
@@ -682,6 +855,8 @@ interface DocsTreePlan {
682
855
  interface PlanDocsTreeOptions {
683
856
  /** Folder for generated API pages when one tab publishes them. Default `api`. */
684
857
  readonly apiDir?: string;
858
+ /** The sidebar's group presentation. Default `collapsible`. */
859
+ readonly sidebar?: SidebarStyle;
685
860
  }
686
861
  /**
687
862
  * Plan the content tree for a navigation.
@@ -696,9 +871,11 @@ interface PlanDocsTreeOptions {
696
871
  * - Root-level doc pages (no `/` in the path) are listed in the root meta.
697
872
  * - Tab folders get `root: true`, so the sidebar scopes to the active tab.
698
873
  * - Sidebar order is declaration order, pages and groups interleaved.
874
+ * - With `sidebar: 'headings'`, a tab-level group renders as a flat heading
875
+ * with its pages extracted beneath it, and nested groups start closed.
699
876
  *
700
877
  * @param navigation - the parsed navigation
701
- * @param options - the API folder name
878
+ * @param options - the API folder name and the sidebar style
702
879
  * @returns the plan the generator executes
703
880
  * @throws when two sibling groups slugify to the same folder
704
881
  * @public
@@ -785,6 +962,38 @@ interface CreateMarkdownRouteOptions {
785
962
  * when the document is expensive to build.
786
963
  */
787
964
  readonly loadOpenApiDocuments?: () => Readonly<Record<string, OpenApiDocument>> | Promise<Readonly<Record<string, OpenApiDocument>>>;
965
+ /**
966
+ * Loads a generated API page's original operation source: the spec file
967
+ * path, the method and route, and the file's raw contents. When it returns
968
+ * one, the page's Markdown is the operation spec in full under an
969
+ * `## OpenAPI` heading, the shape agents get from the major docs platforms;
970
+ * pages it returns `null` for fall through to the MDX conversion. Wire it
971
+ * from the generator's `api-sources.json`.
972
+ */
973
+ readonly loadOperationSource?: (slug: readonly string[] | undefined) => Promise<OperationSource | null>;
974
+ /**
975
+ * The site's documentation index path (`/llms.txt`). When set, every
976
+ * response opens with a blockquote pointing agents at it, on the origin the
977
+ * request came in on — correct on localhost, a preview deploy, and
978
+ * production alike.
979
+ */
980
+ readonly llmsTxtPath?: string;
981
+ }
982
+ /**
983
+ * A generated API page's original operation source, as
984
+ * {@link CreateMarkdownRouteOptions.loadOperationSource} returns it.
985
+ *
986
+ * @public
987
+ */
988
+ interface OperationSource {
989
+ /** The spec file, relative to the content directory. */
990
+ readonly file: string;
991
+ /** The operation's HTTP method. */
992
+ readonly method: string;
993
+ /** The operation's API route. */
994
+ readonly route: string;
995
+ /** The spec file's raw contents. */
996
+ readonly source: string;
788
997
  }
789
998
  /**
790
999
  * Build a drop-in route that serves a page as plain Markdown. It reads the raw
@@ -802,6 +1011,56 @@ interface CreateMarkdownRouteOptions {
802
1011
  * @public
803
1012
  */
804
1013
  declare function createMarkdownRoute(options: CreateMarkdownRouteOptions): MarkdownRoute;
1014
+ /**
1015
+ * Options for {@link markdownRewriteTarget}.
1016
+ *
1017
+ * @public
1018
+ */
1019
+ interface MarkdownRewriteOptions {
1020
+ /** The docs base URL. Default `/docs`. */
1021
+ readonly baseUrl?: string;
1022
+ /** Where the Markdown route is mounted. Default `/md`. */
1023
+ readonly markdownBase?: string;
1024
+ }
1025
+ /**
1026
+ * The internal URL serving a docs page's Markdown, for a request whose path is
1027
+ * the page URL plus `.md` — the convention agents and other tools expect
1028
+ * (`/docs/guides/webhooks.md`). Returns `null` for every other request. A
1029
+ * site's middleware rewrites to the returned URL:
1030
+ *
1031
+ * @example
1032
+ * ```ts
1033
+ * const markdown = markdownRewriteTarget(request.nextUrl);
1034
+ * if (markdown) {
1035
+ * return NextResponse.rewrite(markdown);
1036
+ * }
1037
+ * ```
1038
+ *
1039
+ * @param url - the request URL
1040
+ * @param options - the docs base and the Markdown route's mount point
1041
+ * @returns the rewrite target, or `null` when the request is not a `.md` path
1042
+ * @public
1043
+ */
1044
+ declare function markdownRewriteTarget(url: URL, options?: MarkdownRewriteOptions): URL | null;
1045
+ /**
1046
+ * Whether a request addresses the Markdown route's internal mount directly.
1047
+ * The route exists as the rewrite target for the page-URL-plus-`.md`
1048
+ * convention; a direct request to it gets `404` from the site's middleware,
1049
+ * so every page's Markdown has one public address.
1050
+ *
1051
+ * @example
1052
+ * ```ts
1053
+ * if (isMarkdownRouteRequest(request.nextUrl)) {
1054
+ * return new NextResponse('Not found', { status: 404 });
1055
+ * }
1056
+ * ```
1057
+ *
1058
+ * @param url - the request URL
1059
+ * @param options - the Markdown route's mount point
1060
+ * @returns whether the request must be refused
1061
+ * @public
1062
+ */
1063
+ declare function isMarkdownRouteRequest(url: URL, options?: Pick<MarkdownRewriteOptions, 'markdownBase'>): boolean;
805
1064
 
806
1065
  /**
807
1066
  * Allowed-domain checks.
@@ -1280,4 +1539,4 @@ declare class OpenApiMergeError extends Error {
1280
1539
  */
1281
1540
  declare function mergeOpenApiDocuments(inputs: readonly unknown[], options: MergeOpenApiOptions): OpenApiDocument;
1282
1541
 
1283
- export { AiConfig, type AiMessage, type AskAiDocumentsSource, type AskAiRoute, type AskAiRouteOptions, type AskAiSource, type AuthGateOptions, type BuildSitemapOptions, type CreateMarkdownRouteOptions, type CreateTryItProxyOptions, DocsConfig, type DocsMetadata, type DocsRobots, type DocsSitemapEntry, type DocsTreePlan, type EmailSignInOptions, type FetchLike, type GoogleAuthHandlers, type GoogleAuthOptions, type IndexedDocument, InvalidNavigationError, type MarkdownRoute, type MdxReader, type MdxToMarkdownOptions, type MergeOpenApiOptions, Navigation, OpenApiDocument, OpenApiInfo, OpenApiMergeError, type OpenApiOperationRef, OpenApiServer, type PageSeo, type PlanDocsTreeOptions, type PlannedApiGroup, type PlannedApiPage, type PlannedGroupChild, type PlannedMeta, ProxyTargetError, SESSION_COOKIE, type SearchDocument, type SearchIndex, type SearchResult, type SecretSignInOptions, type SessionPayload, type SignOutOptions, type SiteAuth, type SiteAuthOptions, type SitemapChangeFrequency, type SitemapEntry, ThemeConfig, type TryItEnvelope, type TryItProxyRoute, assertAllowedTarget, buildMetadata, buildRobots, buildSearchIndex, buildSessionCookie, buildSitemap, buildThemeCss, clearSessionCookie, createAskAiRoute, createAuthGate, createEmailSignIn, createGoogleAuth, createMarkdownRoute, createSecretSignIn, createSignOut, createSiteAuth, createTryItProxy, createTryItProxyRoute, isAllowedEmail, mdxToMarkdown, mergeOpenApiDocuments, openApiOperationToMarkdown, parseNavigation, planDocsTree, readCookie, searchIndex, signSession, unwrapProxyTarget, verifySession };
1542
+ export { AiConfig, type AiMessage, type AskAiDocumentsSource, type AskAiRoute, type AskAiRouteOptions, type AskAiSource, type AuthGateOptions, type BuildLlmsTxtOptions, type BuildSitemapOptions, type CodeUsageGenerator, type CodeUsageRequest, type CodeUsageValue, type CreateMarkdownRouteOptions, type CreateTryItProxyOptions, DocsConfig, type DocsMetadata, type DocsRobots, type DocsSitemapEntry, type DocsTreePlan, type EmailSignInOptions, type FetchLike, type GoogleAuthHandlers, type GoogleAuthOptions, type IndexedDocument, InvalidNavigationError, type LlmsTxtPage, type MarkdownRewriteOptions, type MarkdownRoute, type MdxReader, type MdxToMarkdownOptions, type MergeOpenApiOptions, Navigation, OpenApiDocument, OpenApiInfo, OpenApiMergeError, type OpenApiOperationRef, OpenApiServer, type OperationSource, type PageSeo, type PlanDocsTreeOptions, type PlannedApiDocLink, type PlannedApiGroup, type PlannedApiPage, type PlannedGroupChild, type PlannedMeta, ProxyTargetError, SESSION_COOKIE, type SearchDocument, type SearchIndex, type SearchResult, type SecretSignInOptions, type SessionPayload, type SignOutOptions, type SiteAuth, type SiteAuthOptions, type SitemapChangeFrequency, type SitemapEntry, ThemeConfig, type TryItEnvelope, type TryItProxyRoute, assertAllowedTarget, buildLlmsTxt, buildMetadata, buildRobots, buildSearchIndex, buildSessionCookie, buildSitemap, buildThemeCss, clearSessionCookie, createAskAiRoute, createAuthGate, createEmailSignIn, createGoogleAuth, createMarkdownRoute, createSecretSignIn, createSignOut, createSiteAuth, createTryItProxy, createTryItProxyRoute, curlCodeUsage, isAllowedEmail, isMarkdownRouteRequest, markdownRewriteTarget, mdxToMarkdown, mergeOpenApiDocuments, openApiOperationToMarkdown, parseNavigation, planDocsTree, readCookie, redirectTarget, searchIndex, signSession, unwrapProxyTarget, verifySession };