@blaaiz/docs-core 0.5.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-ZWDLAW5M.js → chunk-2GUUVNTP.js} +222 -28
  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 +161 -18
  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 +140 -13
  10. package/dist/generator.js.map +1 -1
  11. package/dist/index.cjs +224 -25
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +249 -4
  14. package/dist/index.d.ts +249 -4
  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 +68 -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-ZKOOKLZ3.js.map +0 -1
  43. package/dist/chunk-ZWDLAW5M.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
@@ -688,6 +836,17 @@ interface DocsTreePlan {
688
836
  */
689
837
  readonly apiDocLinks: readonly PlannedApiDocLink[];
690
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';
691
850
  /**
692
851
  * Options for {@link planDocsTree}.
693
852
  *
@@ -696,6 +855,8 @@ interface DocsTreePlan {
696
855
  interface PlanDocsTreeOptions {
697
856
  /** Folder for generated API pages when one tab publishes them. Default `api`. */
698
857
  readonly apiDir?: string;
858
+ /** The sidebar's group presentation. Default `collapsible`. */
859
+ readonly sidebar?: SidebarStyle;
699
860
  }
700
861
  /**
701
862
  * Plan the content tree for a navigation.
@@ -710,9 +871,11 @@ interface PlanDocsTreeOptions {
710
871
  * - Root-level doc pages (no `/` in the path) are listed in the root meta.
711
872
  * - Tab folders get `root: true`, so the sidebar scopes to the active tab.
712
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.
713
876
  *
714
877
  * @param navigation - the parsed navigation
715
- * @param options - the API folder name
878
+ * @param options - the API folder name and the sidebar style
716
879
  * @returns the plan the generator executes
717
880
  * @throws when two sibling groups slugify to the same folder
718
881
  * @public
@@ -799,6 +962,38 @@ interface CreateMarkdownRouteOptions {
799
962
  * when the document is expensive to build.
800
963
  */
801
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;
802
997
  }
803
998
  /**
804
999
  * Build a drop-in route that serves a page as plain Markdown. It reads the raw
@@ -816,6 +1011,56 @@ interface CreateMarkdownRouteOptions {
816
1011
  * @public
817
1012
  */
818
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;
819
1064
 
820
1065
  /**
821
1066
  * Allowed-domain checks.
@@ -1294,4 +1539,4 @@ declare class OpenApiMergeError extends Error {
1294
1539
  */
1295
1540
  declare function mergeOpenApiDocuments(inputs: readonly unknown[], options: MergeOpenApiOptions): OpenApiDocument;
1296
1541
 
1297
- 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 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, 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
@@ -688,6 +836,17 @@ interface DocsTreePlan {
688
836
  */
689
837
  readonly apiDocLinks: readonly PlannedApiDocLink[];
690
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';
691
850
  /**
692
851
  * Options for {@link planDocsTree}.
693
852
  *
@@ -696,6 +855,8 @@ interface DocsTreePlan {
696
855
  interface PlanDocsTreeOptions {
697
856
  /** Folder for generated API pages when one tab publishes them. Default `api`. */
698
857
  readonly apiDir?: string;
858
+ /** The sidebar's group presentation. Default `collapsible`. */
859
+ readonly sidebar?: SidebarStyle;
699
860
  }
700
861
  /**
701
862
  * Plan the content tree for a navigation.
@@ -710,9 +871,11 @@ interface PlanDocsTreeOptions {
710
871
  * - Root-level doc pages (no `/` in the path) are listed in the root meta.
711
872
  * - Tab folders get `root: true`, so the sidebar scopes to the active tab.
712
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.
713
876
  *
714
877
  * @param navigation - the parsed navigation
715
- * @param options - the API folder name
878
+ * @param options - the API folder name and the sidebar style
716
879
  * @returns the plan the generator executes
717
880
  * @throws when two sibling groups slugify to the same folder
718
881
  * @public
@@ -799,6 +962,38 @@ interface CreateMarkdownRouteOptions {
799
962
  * when the document is expensive to build.
800
963
  */
801
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;
802
997
  }
803
998
  /**
804
999
  * Build a drop-in route that serves a page as plain Markdown. It reads the raw
@@ -816,6 +1011,56 @@ interface CreateMarkdownRouteOptions {
816
1011
  * @public
817
1012
  */
818
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;
819
1064
 
820
1065
  /**
821
1066
  * Allowed-domain checks.
@@ -1294,4 +1539,4 @@ declare class OpenApiMergeError extends Error {
1294
1539
  */
1295
1540
  declare function mergeOpenApiDocuments(inputs: readonly unknown[], options: MergeOpenApiOptions): OpenApiDocument;
1296
1541
 
1297
- 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 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, 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.js CHANGED
@@ -1,3 +1,3 @@
1
- export { AI_PROVIDER_MODELS, AI_PROVIDER_NAMES, AiConfigError, DocsConfigError, InvalidNavigationError, OpenApiMergeError, ProxyTargetError, SESSION_COOKIE, assertAllowedTarget, buildMetadata, buildRobots, buildSearchIndex, buildSessionCookie, buildSitemap, buildThemeCss, clearSessionCookie, createAskAiRoute, createAuthGate, createEmailSignIn, createGoogleAuth, createMarkdownRoute, createSecretSignIn, createSignOut, createSiteAuth, createTryItProxy, createTryItProxyRoute, defineDocsConfig, isAllowedEmail, mdxToMarkdown, mergeOpenApiDocuments, openApiOperationToMarkdown, parseNavigation, planDocsTree, readCookie, resolveAiConfig, searchIndex, signSession, unwrapProxyTarget, validateDocsConfig, verifySession } from './chunk-ZWDLAW5M.js';
1
+ export { AI_PROVIDER_MODELS, AI_PROVIDER_NAMES, AiConfigError, DocsConfigError, InvalidNavigationError, OpenApiMergeError, ProxyTargetError, SESSION_COOKIE, assertAllowedTarget, buildLlmsTxt, buildMetadata, buildRobots, buildSearchIndex, buildSessionCookie, buildSitemap, buildThemeCss, clearSessionCookie, createAskAiRoute, createAuthGate, createEmailSignIn, createGoogleAuth, createMarkdownRoute, createSecretSignIn, createSignOut, createSiteAuth, createTryItProxy, createTryItProxyRoute, curlCodeUsage, defineDocsConfig, isAllowedEmail, isMarkdownRouteRequest, markdownRewriteTarget, mdxToMarkdown, mergeOpenApiDocuments, openApiOperationToMarkdown, parseNavigation, planDocsTree, readCookie, redirectTarget, resolveAiConfig, searchIndex, signSession, unwrapProxyTarget, validateDocsConfig, verifySession } from './chunk-2GUUVNTP.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
@@ -330,10 +330,31 @@ interface FeaturesConfig {
330
330
  *
331
331
  * @public
332
332
  */
333
+ /**
334
+ * One top-bar action: a call to action rendered in the site header.
335
+ *
336
+ * @public
337
+ */
338
+ interface NavbarAction {
339
+ readonly text: string;
340
+ readonly href: string;
341
+ }
342
+ /**
343
+ * Top-bar calls to action. The primary renders as a button in the theme's
344
+ * primary colour; the secondary as a quiet link beside it.
345
+ *
346
+ * @public
347
+ */
348
+ interface NavbarConfig {
349
+ readonly primary?: NavbarAction;
350
+ readonly secondary?: NavbarAction;
351
+ }
333
352
  interface DocsConfig {
334
353
  readonly theme: ThemeConfig;
335
354
  readonly auth: AuthConfig;
336
355
  readonly proxy: ProxyConfig;
356
+ /** Top-bar calls to action (a Dashboard button, a Support link). */
357
+ readonly navbar?: NavbarConfig;
337
358
  /** Opt-in features. Omit it entirely and every feature stays off. */
338
359
  readonly features?: FeaturesConfig;
339
360
  /** Search-engine and social-sharing metadata. Omit for name-only defaults. */
@@ -495,4 +516,4 @@ interface NavTab {
495
516
  */
496
517
  type Navigation = readonly NavTab[];
497
518
 
498
- export { type AiConfig as A, type DocsConfig as D, type FeaturesConfig as F, type GoogleProviderConfig as G, type Navigation as N, type OpenApiPage as O, type ProxyConfig as P, type ResolvedAiConfig as R, type SecretProviderConfig as S, type ThemeConfig as T, type WorkspaceAuthConfig as W, AI_PROVIDER_MODELS as a, AI_PROVIDER_NAMES as b, AiConfigError as c, type AiProviderModels as d, type AiProviderName as e, type AuthConfig as f, type DocPage as g, DocsConfigError as h, type NavGroup as i, type NavItem as j, type NavMethod as k, type NavPage as l, type NavTab as m, type SeoConfig as n, type ThemeLogo as o, type ThemePalette as p, type WorkspaceProviders as q, defineDocsConfig as r, resolveAiConfig as s, validateDocsConfig as v };
519
+ export { type AiConfig as A, type DocsConfig as D, type FeaturesConfig as F, type GoogleProviderConfig as G, type Navigation as N, type OpenApiPage as O, type ProxyConfig as P, type ResolvedAiConfig as R, type SecretProviderConfig as S, type ThemeConfig as T, type WorkspaceAuthConfig as W, AI_PROVIDER_MODELS as a, AI_PROVIDER_NAMES as b, AiConfigError as c, type AiProviderModels as d, type AiProviderName as e, type AuthConfig as f, type DocPage as g, DocsConfigError as h, type NavGroup as i, type NavItem as j, type NavMethod as k, type NavPage as l, type NavTab as m, type SeoConfig as n, type ThemeLogo as o, type ThemePalette as p, type WorkspaceProviders as q, defineDocsConfig as r, resolveAiConfig as s, type NavbarConfig as t, validateDocsConfig as v };