@farming-labs/docs 0.1.45 → 0.1.48

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.
@@ -1,4 +1,6 @@
1
+ import "./reading-time-DCZXC6-3.mjs";
1
2
  import { C as renderDocsMarkdownDocument, g as findDocsMarkdownPage } from "./agent-CbAtuZAc.mjs";
3
+ import "./index.mjs";
2
4
  import "./api-reference-y7cqtq4w.mjs";
3
5
  import { createFilesystemDocsMcpSource } from "./mcp.mjs";
4
6
  import "./server.mjs";
@@ -75,7 +75,7 @@ async function main() {
75
75
  const { runMcp } = await import("../mcp-CYpMeMfi.mjs");
76
76
  await runMcp(mcpOptions);
77
77
  } else if (parsedCommand.command === "agent" && subcommand === "compact") {
78
- const { compactAgentDocs, parseAgentCompactArgs, printAgentCompactHelp } = await import("../agent-Dget5s8h.mjs");
78
+ const { compactAgentDocs, parseAgentCompactArgs, printAgentCompactHelp } = await import("../agent-D6Fa41gs.mjs");
79
79
  const agentCompactOptions = parseAgentCompactArgs(args.slice(2));
80
80
  if (agentCompactOptions.help) {
81
81
  printAgentCompactHelp();
@@ -85,7 +85,7 @@ async function main() {
85
85
  } else if (parsedCommand.command === "agent") {
86
86
  console.error(pc.red(`Unknown agent subcommand: ${subcommand ?? "(missing)"}`));
87
87
  console.error();
88
- const { printAgentCompactHelp } = await import("../agent-Dget5s8h.mjs");
88
+ const { printAgentCompactHelp } = await import("../agent-D6Fa41gs.mjs");
89
89
  printAgentCompactHelp();
90
90
  process.exit(1);
91
91
  } else if (parsedCommand.command === "doctor") {
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as SidebarFolderNode, A as DocsSearchQuery, B as McpDocsSearchConfig, C as DocsSearchAdapter, D as DocsSearchConfig, E as DocsSearchChunkingConfig, F as FeedbackConfig, G as OrderingItem, H as OpenDocsConfig, I as FontStyle, J as PageOpenGraph, K as PageActionsConfig, L as GithubConfig, M as DocsSearchResultType, N as DocsSearchSourcePage, O as DocsSearchDocument, P as DocsTheme, Q as SidebarConfig, R as LastUpdatedConfig, S as DocsRelatedItem, T as DocsSearchAdapterFactory, U as OpenDocsProvider, V as OGConfig, W as OpenGraphImage, X as ResolvedDocsRelatedLink, Y as PageTwitter, Z as SidebarComponentProps, _ as DocsI18nConfig, a as ApiReferenceRenderer, at as TypesenseDocsSearchConfig, b as DocsMetadata, c as ChangelogFrontmatter, d as CustomDocsSearchConfig, et as SidebarNode, f as DocsAgentFeedbackContext, g as DocsFeedbackValue, h as DocsFeedbackData, i as ApiReferenceConfig, it as ThemeToggleConfig, j as DocsSearchResult, k as DocsSearchEmbeddingsConfig, l as CodeBlockCopyData, m as DocsConfig, n as AgentFeedbackConfig, nt as SidebarTree, o as BreadcrumbConfig, ot as TypographyConfig, p as DocsAgentFeedbackData, q as PageFrontmatter, r as AlgoliaDocsSearchConfig, rt as SimpleDocsSearchConfig, s as ChangelogConfig, st as UIConfig, t as AIConfig, tt as SidebarPageNode, u as CopyMarkdownConfig, v as DocsMcpConfig, w as DocsSearchAdapterContext, x as DocsNav, y as DocsMcpToolsConfig, z as LlmsTxtConfig } from "./types-nlEL5lLq.mjs";
1
+ import { $ as SidebarConfig, A as DocsSearchQuery, B as McpDocsSearchConfig, C as DocsSearchAdapter, D as DocsSearchConfig, E as DocsSearchChunkingConfig, F as FeedbackConfig, G as OrderingItem, H as OpenDocsConfig, I as FontStyle, J as PageOpenGraph, K as PageActionsConfig, L as GithubConfig, M as DocsSearchResultType, N as DocsSearchSourcePage, O as DocsSearchDocument, P as DocsTheme, Q as SidebarComponentProps, R as LastUpdatedConfig, S as DocsRelatedItem, T as DocsSearchAdapterFactory, U as OpenDocsProvider, V as OGConfig, W as OpenGraphImage, X as ReadingTimeConfig, Y as PageTwitter, Z as ResolvedDocsRelatedLink, _ as DocsI18nConfig, a as ApiReferenceRenderer, at as ThemeToggleConfig, b as DocsMetadata, c as ChangelogFrontmatter, ct as UIConfig, d as CustomDocsSearchConfig, et as SidebarFolderNode, f as DocsAgentFeedbackContext, g as DocsFeedbackValue, h as DocsFeedbackData, i as ApiReferenceConfig, it as SimpleDocsSearchConfig, j as DocsSearchResult, k as DocsSearchEmbeddingsConfig, l as CodeBlockCopyData, m as DocsConfig, n as AgentFeedbackConfig, nt as SidebarPageNode, o as BreadcrumbConfig, ot as TypesenseDocsSearchConfig, p as DocsAgentFeedbackData, q as PageFrontmatter, r as AlgoliaDocsSearchConfig, rt as SidebarTree, s as ChangelogConfig, st as TypographyConfig, t as AIConfig, tt as SidebarNode, u as CopyMarkdownConfig, v as DocsMcpConfig, w as DocsSearchAdapterContext, x as DocsNav, y as DocsMcpToolsConfig, z as LlmsTxtConfig } from "./types-Boobvv2I.mjs";
2
2
  import { DocsMcpPage, DocsMcpResolvedConfig } from "./mcp.mjs";
3
- import { a as createSimpleSearchAdapter, c as resolveSearchRequestConfig, i as createMcpSearchAdapter, n as createAlgoliaSearchAdapter, o as createTypesenseSearchAdapter, r as createCustomSearchAdapter, s as performDocsSearch, t as buildDocsSearchDocuments } from "./search-cPHa_3jJ.mjs";
3
+ import { a as createSimpleSearchAdapter, c as resolveSearchRequestConfig, i as createMcpSearchAdapter, n as createAlgoliaSearchAdapter, o as createTypesenseSearchAdapter, r as createCustomSearchAdapter, s as performDocsSearch, t as buildDocsSearchDocuments } from "./search-BxJywXXB.mjs";
4
4
 
5
5
  //#region src/define-docs.d.ts
6
6
  /**
@@ -116,6 +116,20 @@ declare function buildPageOpenGraph(page: Pick<PageFrontmatter, "title" | "descr
116
116
  */
117
117
  declare function buildPageTwitter(page: Pick<PageFrontmatter, "title" | "description" | "ogImage" | "openGraph" | "twitter">, ogConfig?: OGConfig, baseUrl?: string): PageTwitter | undefined;
118
118
  //#endregion
119
+ //#region src/reading-time.d.ts
120
+ interface ResolvedReadingTimeOptions {
121
+ enabled: boolean;
122
+ wordsPerMinute?: number;
123
+ }
124
+ declare function estimateReadingTimeMinutes(content: string, wordsPerMinute?: number): number;
125
+ declare function resolveReadingTimeOptions(readingTime: boolean | ReadingTimeConfig | null | undefined): ResolvedReadingTimeOptions;
126
+ declare function resolveReadingTimeFromContent(frontmatter: Partial<PageFrontmatter> | undefined, content: string, wordsPerMinute?: number): number | null;
127
+ declare function resolvePageReadingTime(frontmatter: Partial<PageFrontmatter> | undefined, content: string, options?: {
128
+ enabledByDefault?: boolean;
129
+ wordsPerMinute?: number;
130
+ }): number | null | undefined;
131
+ declare function resolveReadingTimeFromSource(source: string, wordsPerMinute?: number): number | null;
132
+ //#endregion
119
133
  //#region src/related.d.ts
120
134
  declare function normalizeDocsRelated(value: unknown): ResolvedDocsRelatedLink[];
121
135
  declare function renderDocsRelatedMarkdownLines(related: ResolvedDocsRelatedLink[] | undefined): string[];
@@ -324,4 +338,4 @@ declare function buildDocsAgentDiscoverySpec({
324
338
  };
325
339
  };
326
340
  //#endregion
327
- export { type AIConfig, type AgentFeedbackConfig, type AlgoliaDocsSearchConfig, type ApiReferenceConfig, type ApiReferenceRenderer, type BreadcrumbConfig, type ChangelogConfig, type ChangelogEntrySummary, type ChangelogFrontmatter, type CodeBlockCopyData, type CopyMarkdownConfig, type CustomDocsSearchConfig, DEFAULT_AGENT_FEEDBACK_ROUTE, DEFAULT_AGENT_SPEC_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, DEFAULT_DOCS_API_ROUTE, DEFAULT_LLMS_FULL_TXT_ROUTE, DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, DEFAULT_LLMS_TXT_ROUTE, DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, DEFAULT_MCP_PUBLIC_ROUTE, DEFAULT_MCP_ROUTE, DEFAULT_MCP_WELL_KNOWN_ROUTE, DEFAULT_SKILL_MD_ROUTE, DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, type DocsAgentDiscoverySpecOptions, type DocsAgentFeedbackContext, type DocsAgentFeedbackData, type DocsAgentFeedbackDiscoveryConfig, type DocsConfig, type DocsFeedbackData, type DocsFeedbackValue, type DocsI18nConfig, type DocsLlmsDiscoveryConfig, type DocsMarkdownPage, type DocsMcpConfig, type DocsMcpToolsConfig, type DocsMetadata, type DocsNav, type DocsPathMatch, type DocsRelatedItem, type DocsSearchAdapter, type DocsSearchAdapterContext, type DocsSearchAdapterFactory, type DocsSearchChunkingConfig, type DocsSearchConfig, type DocsSearchDocument, type DocsSearchEmbeddingsConfig, type DocsSearchQuery, type DocsSearchResult, type DocsSearchResultType, type DocsSearchSourcePage, type DocsSkillDocumentOptions, type DocsTheme, type FeedbackConfig, type FontStyle, type GithubConfig, type LastUpdatedConfig, type LlmsTxtConfig, type McpDocsSearchConfig, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, type OpenGraphImage, type OrderingItem, type PageActionsConfig, type PageFrontmatter, type PageOpenGraph, type PageTwitter, type ResolvedChangelogConfig, type ResolvedDocsI18n, type ResolvedDocsRelatedLink, type SidebarComponentProps, type SidebarConfig, type SidebarFolderNode, type SidebarNode, type SidebarPageNode, type SidebarTree, type SimpleDocsSearchConfig, type ThemeToggleConfig, type TypesenseDocsSearchConfig, type TypographyConfig, type UIConfig, buildDocsAgentDiscoverySpec, buildDocsSearchDocuments, buildPageOpenGraph, buildPageTwitter, createAlgoliaSearchAdapter, createCustomSearchAdapter, createMcpSearchAdapter, createSimpleSearchAdapter, createTheme, createTypesenseSearchAdapter, deepMerge, defineDocs, extendTheme, findDocsMarkdownPage, isDocsAgentDiscoveryRequest, isDocsMcpRequest, isDocsPublicGetRequest, isDocsSkillRequest, normalizeDocsPathSegment, normalizeDocsRelated, normalizeDocsUrlPath, performDocsSearch, renderDocsMarkdownDocument, renderDocsRelatedMarkdownLines, renderDocsSkillDocument, resolveChangelogConfig, resolveDocsAgentMdxContent, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsPath, resolveDocsSkillFormat, resolveOGImage, resolveSearchRequestConfig, resolveTitle };
341
+ export { type AIConfig, type AgentFeedbackConfig, type AlgoliaDocsSearchConfig, type ApiReferenceConfig, type ApiReferenceRenderer, type BreadcrumbConfig, type ChangelogConfig, type ChangelogEntrySummary, type ChangelogFrontmatter, type CodeBlockCopyData, type CopyMarkdownConfig, type CustomDocsSearchConfig, DEFAULT_AGENT_FEEDBACK_ROUTE, DEFAULT_AGENT_SPEC_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, DEFAULT_DOCS_API_ROUTE, DEFAULT_LLMS_FULL_TXT_ROUTE, DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, DEFAULT_LLMS_TXT_ROUTE, DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, DEFAULT_MCP_PUBLIC_ROUTE, DEFAULT_MCP_ROUTE, DEFAULT_MCP_WELL_KNOWN_ROUTE, DEFAULT_SKILL_MD_ROUTE, DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, type DocsAgentDiscoverySpecOptions, type DocsAgentFeedbackContext, type DocsAgentFeedbackData, type DocsAgentFeedbackDiscoveryConfig, type DocsConfig, type DocsFeedbackData, type DocsFeedbackValue, type DocsI18nConfig, type DocsLlmsDiscoveryConfig, type DocsMarkdownPage, type DocsMcpConfig, type DocsMcpToolsConfig, type DocsMetadata, type DocsNav, type DocsPathMatch, type DocsRelatedItem, type DocsSearchAdapter, type DocsSearchAdapterContext, type DocsSearchAdapterFactory, type DocsSearchChunkingConfig, type DocsSearchConfig, type DocsSearchDocument, type DocsSearchEmbeddingsConfig, type DocsSearchQuery, type DocsSearchResult, type DocsSearchResultType, type DocsSearchSourcePage, type DocsSkillDocumentOptions, type DocsTheme, type FeedbackConfig, type FontStyle, type GithubConfig, type LastUpdatedConfig, type LlmsTxtConfig, type McpDocsSearchConfig, type OGConfig, type OpenDocsConfig, type OpenDocsProvider, type OpenGraphImage, type OrderingItem, type PageActionsConfig, type PageFrontmatter, type PageOpenGraph, type PageTwitter, type ReadingTimeConfig, type ResolvedChangelogConfig, type ResolvedDocsI18n, type ResolvedDocsRelatedLink, type SidebarComponentProps, type SidebarConfig, type SidebarFolderNode, type SidebarNode, type SidebarPageNode, type SidebarTree, type SimpleDocsSearchConfig, type ThemeToggleConfig, type TypesenseDocsSearchConfig, type TypographyConfig, type UIConfig, buildDocsAgentDiscoverySpec, buildDocsSearchDocuments, buildPageOpenGraph, buildPageTwitter, createAlgoliaSearchAdapter, createCustomSearchAdapter, createMcpSearchAdapter, createSimpleSearchAdapter, createTheme, createTypesenseSearchAdapter, deepMerge, defineDocs, estimateReadingTimeMinutes, extendTheme, findDocsMarkdownPage, isDocsAgentDiscoveryRequest, isDocsMcpRequest, isDocsPublicGetRequest, isDocsSkillRequest, normalizeDocsPathSegment, normalizeDocsRelated, normalizeDocsUrlPath, performDocsSearch, renderDocsMarkdownDocument, renderDocsRelatedMarkdownLines, renderDocsSkillDocument, resolveChangelogConfig, resolveDocsAgentMdxContent, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsPath, resolveDocsSkillFormat, resolveOGImage, resolvePageReadingTime, resolveReadingTimeFromContent, resolveReadingTimeFromSource, resolveReadingTimeOptions, resolveSearchRequestConfig, resolveTitle };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { a as resolveDocsI18n, c as createTheme, d as resolveChangelogConfig, f as defineDocs, i as resolveTitle, l as extendTheme, n as buildPageTwitter, o as resolveDocsLocale, r as resolveOGImage, s as resolveDocsPath, t as buildPageOpenGraph, u as deepMerge } from "./metadata-CdrtTSz-.mjs";
1
+ import { _ as defineDocs, a as resolveReadingTimeOptions, c as resolveOGImage, d as resolveDocsLocale, f as resolveDocsPath, g as resolveChangelogConfig, h as deepMerge, i as resolveReadingTimeFromSource, l as resolveTitle, m as extendTheme, n as resolvePageReadingTime, o as buildPageOpenGraph, p as createTheme, r as resolveReadingTimeFromContent, s as buildPageTwitter, t as estimateReadingTimeMinutes, u as resolveDocsI18n } from "./reading-time-DCZXC6-3.mjs";
2
2
  import { a as createSimpleSearchAdapter, c as resolveSearchRequestConfig, i as createMcpSearchAdapter, l as normalizeDocsRelated, n as createAlgoliaSearchAdapter, o as createTypesenseSearchAdapter, r as createCustomSearchAdapter, s as performDocsSearch, t as buildDocsSearchDocuments, u as renderDocsRelatedMarkdownLines } from "./search-8oEskRtz.mjs";
3
3
  import { C as renderDocsMarkdownDocument, D as resolveDocsMarkdownRequest, E as resolveDocsLlmsTxtFormat, O as resolveDocsSkillFormat, S as normalizeDocsUrlPath, T as resolveDocsAgentMdxContent, _ as isDocsAgentDiscoveryRequest, a as DEFAULT_DOCS_API_ROUTE, b as isDocsSkillRequest, c as DEFAULT_LLMS_TXT_ROUTE, d as DEFAULT_MCP_ROUTE, f as DEFAULT_MCP_WELL_KNOWN_ROUTE, g as findDocsMarkdownPage, h as buildDocsAgentDiscoverySpec, i as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, l as DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, m as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, n as DEFAULT_AGENT_SPEC_ROUTE, o as DEFAULT_LLMS_FULL_TXT_ROUTE, p as DEFAULT_SKILL_MD_ROUTE, r as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, s as DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, t as DEFAULT_AGENT_FEEDBACK_ROUTE, u as DEFAULT_MCP_PUBLIC_ROUTE, v as isDocsMcpRequest, w as renderDocsSkillDocument, x as normalizeDocsPathSegment, y as isDocsPublicGetRequest } from "./agent-CbAtuZAc.mjs";
4
4
 
5
- export { DEFAULT_AGENT_FEEDBACK_ROUTE, DEFAULT_AGENT_SPEC_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, DEFAULT_DOCS_API_ROUTE, DEFAULT_LLMS_FULL_TXT_ROUTE, DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, DEFAULT_LLMS_TXT_ROUTE, DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, DEFAULT_MCP_PUBLIC_ROUTE, DEFAULT_MCP_ROUTE, DEFAULT_MCP_WELL_KNOWN_ROUTE, DEFAULT_SKILL_MD_ROUTE, DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, buildDocsAgentDiscoverySpec, buildDocsSearchDocuments, buildPageOpenGraph, buildPageTwitter, createAlgoliaSearchAdapter, createCustomSearchAdapter, createMcpSearchAdapter, createSimpleSearchAdapter, createTheme, createTypesenseSearchAdapter, deepMerge, defineDocs, extendTheme, findDocsMarkdownPage, isDocsAgentDiscoveryRequest, isDocsMcpRequest, isDocsPublicGetRequest, isDocsSkillRequest, normalizeDocsPathSegment, normalizeDocsRelated, normalizeDocsUrlPath, performDocsSearch, renderDocsMarkdownDocument, renderDocsRelatedMarkdownLines, renderDocsSkillDocument, resolveChangelogConfig, resolveDocsAgentMdxContent, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsPath, resolveDocsSkillFormat, resolveOGImage, resolveSearchRequestConfig, resolveTitle };
5
+ export { DEFAULT_AGENT_FEEDBACK_ROUTE, DEFAULT_AGENT_SPEC_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, DEFAULT_DOCS_API_ROUTE, DEFAULT_LLMS_FULL_TXT_ROUTE, DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, DEFAULT_LLMS_TXT_ROUTE, DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, DEFAULT_MCP_PUBLIC_ROUTE, DEFAULT_MCP_ROUTE, DEFAULT_MCP_WELL_KNOWN_ROUTE, DEFAULT_SKILL_MD_ROUTE, DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, buildDocsAgentDiscoverySpec, buildDocsSearchDocuments, buildPageOpenGraph, buildPageTwitter, createAlgoliaSearchAdapter, createCustomSearchAdapter, createMcpSearchAdapter, createSimpleSearchAdapter, createTheme, createTypesenseSearchAdapter, deepMerge, defineDocs, estimateReadingTimeMinutes, extendTheme, findDocsMarkdownPage, isDocsAgentDiscoveryRequest, isDocsMcpRequest, isDocsPublicGetRequest, isDocsSkillRequest, normalizeDocsPathSegment, normalizeDocsRelated, normalizeDocsUrlPath, performDocsSearch, renderDocsMarkdownDocument, renderDocsRelatedMarkdownLines, renderDocsSkillDocument, resolveChangelogConfig, resolveDocsAgentMdxContent, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsPath, resolveDocsSkillFormat, resolveOGImage, resolvePageReadingTime, resolveReadingTimeFromContent, resolveReadingTimeFromSource, resolveReadingTimeOptions, resolveSearchRequestConfig, resolveTitle };
package/dist/mcp.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { D as DocsSearchConfig, G as OrderingItem, N as DocsSearchSourcePage, v as DocsMcpConfig } from "./types-nlEL5lLq.mjs";
1
+ import { D as DocsSearchConfig, G as OrderingItem, N as DocsSearchSourcePage, v as DocsMcpConfig } from "./types-Boobvv2I.mjs";
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
 
4
4
  //#region src/mcp.d.ts
package/dist/mcp.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { l as normalizeDocsRelated, s as performDocsSearch, u as renderDocsRelatedMarkdownLines } from "./search-8oEskRtz.mjs";
2
+ import matter from "gray-matter";
2
3
  import fs from "node:fs";
3
4
  import path from "node:path";
4
5
  import { randomUUID } from "node:crypto";
5
- import matter from "gray-matter";
6
6
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
7
7
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
8
8
  import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
@@ -1,3 +1,5 @@
1
+ import matter from "gray-matter";
2
+
1
3
  //#region src/define-docs.ts
2
4
  /**
3
5
  * Define docs configuration. Validates and returns the config.
@@ -21,6 +23,7 @@ function defineDocs(config) {
21
23
  icons: config.icons,
22
24
  pageActions: config.pageActions,
23
25
  lastUpdated: config.lastUpdated,
26
+ readingTime: config.readingTime,
24
27
  llmsTxt: config.llmsTxt,
25
28
  ai: config.ai,
26
29
  ordering: config.ordering,
@@ -265,4 +268,44 @@ function buildPageTwitter(page, ogConfig, baseUrl) {
265
268
  }
266
269
 
267
270
  //#endregion
268
- export { resolveDocsI18n as a, createTheme as c, resolveChangelogConfig as d, defineDocs as f, resolveTitle as i, extendTheme as l, buildPageTwitter as n, resolveDocsLocale as o, resolveOGImage as r, resolveDocsPath as s, buildPageOpenGraph as t, deepMerge as u };
271
+ //#region src/reading-time.ts
272
+ function hasExplicitReadingTime(frontmatter) {
273
+ return Object.prototype.hasOwnProperty.call(frontmatter ?? {}, "readingTime");
274
+ }
275
+ function normalizeWordsPerMinute(wordsPerMinute) {
276
+ if (typeof wordsPerMinute !== "number" || !Number.isFinite(wordsPerMinute)) return 220;
277
+ return Math.max(1, Math.floor(wordsPerMinute));
278
+ }
279
+ function stripNonReadingContent(content) {
280
+ return content.replace(/(`{3,})[^\n]*\n[\s\S]*?\1/g, " ").replace(/(~{3,})[^\n]*\n[\s\S]*?\1/g, " ").replace(/`[^`\n]+`/g, " ").replace(/!\[[^\]]*\]\([^)]+\)/g, " ").replace(/\[([^\]]+)\]\([^)]+\)/g, " $1 ").replace(/<[^>]+>/g, " ").replace(/\{[^{}]*\}/g, " ").replace(/https?:\/\/\S+/g, " ").replace(/[#>*_~|]/g, " ");
281
+ }
282
+ function estimateReadingTimeMinutes(content, wordsPerMinute) {
283
+ const wordCount = stripNonReadingContent(content).match(/\b[\p{L}\p{N}][\p{L}\p{N}'’-]*\b/gu)?.length ?? 0;
284
+ return Math.max(1, Math.ceil(wordCount / normalizeWordsPerMinute(wordsPerMinute)));
285
+ }
286
+ function resolveReadingTimeOptions(readingTime) {
287
+ if (readingTime === true) return { enabled: true };
288
+ if (readingTime === false || readingTime === void 0 || readingTime === null) return { enabled: false };
289
+ if (typeof readingTime !== "object") return { enabled: false };
290
+ return {
291
+ enabled: readingTime.enabled !== false,
292
+ wordsPerMinute: typeof readingTime.wordsPerMinute === "number" && Number.isFinite(readingTime.wordsPerMinute) ? readingTime.wordsPerMinute : void 0
293
+ };
294
+ }
295
+ function resolveReadingTimeFromContent(frontmatter, content, wordsPerMinute) {
296
+ const pageData = frontmatter ?? {};
297
+ if (pageData.readingTime === false) return null;
298
+ if (typeof pageData.readingTime === "number" && Number.isFinite(pageData.readingTime)) return Math.max(1, Math.ceil(pageData.readingTime));
299
+ return estimateReadingTimeMinutes(content, wordsPerMinute);
300
+ }
301
+ function resolvePageReadingTime(frontmatter, content, options) {
302
+ if (!(options?.enabledByDefault ?? false) && !hasExplicitReadingTime(frontmatter)) return;
303
+ return resolveReadingTimeFromContent(frontmatter, content, options?.wordsPerMinute);
304
+ }
305
+ function resolveReadingTimeFromSource(source, wordsPerMinute) {
306
+ const { data, content } = matter(source);
307
+ return resolveReadingTimeFromContent(data, content, wordsPerMinute);
308
+ }
309
+
310
+ //#endregion
311
+ export { defineDocs as _, resolveReadingTimeOptions as a, resolveOGImage as c, resolveDocsLocale as d, resolveDocsPath as f, resolveChangelogConfig as g, deepMerge as h, resolveReadingTimeFromSource as i, resolveTitle as l, extendTheme as m, resolvePageReadingTime as n, buildPageOpenGraph as o, createTheme as p, resolveReadingTimeFromContent as r, buildPageTwitter as s, estimateReadingTimeMinutes as t, resolveDocsI18n as u };
@@ -1,4 +1,4 @@
1
- import { B as McpDocsSearchConfig, C as DocsSearchAdapter, D as DocsSearchConfig, E as DocsSearchChunkingConfig, N as DocsSearchSourcePage, O as DocsSearchDocument, T as DocsSearchAdapterFactory, at as TypesenseDocsSearchConfig, d as CustomDocsSearchConfig, j as DocsSearchResult, r as AlgoliaDocsSearchConfig } from "./types-nlEL5lLq.mjs";
1
+ import { B as McpDocsSearchConfig, C as DocsSearchAdapter, D as DocsSearchConfig, E as DocsSearchChunkingConfig, N as DocsSearchSourcePage, O as DocsSearchDocument, T as DocsSearchAdapterFactory, d as CustomDocsSearchConfig, j as DocsSearchResult, ot as TypesenseDocsSearchConfig, r as AlgoliaDocsSearchConfig } from "./types-Boobvv2I.mjs";
2
2
 
3
3
  //#region src/search.d.ts
4
4
  declare function buildDocsSearchDocuments(pages: DocsSearchSourcePage[], chunking?: DocsSearchChunkingConfig): DocsSearchDocument[];
package/dist/server.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { A as DocsSearchQuery, B as McpDocsSearchConfig, C as DocsSearchAdapter, D as DocsSearchConfig, N as DocsSearchSourcePage, O as DocsSearchDocument, T as DocsSearchAdapterFactory, a as ApiReferenceRenderer, j as DocsSearchResult, m as DocsConfig, w as DocsSearchAdapterContext } from "./types-nlEL5lLq.mjs";
1
+ import { A as DocsSearchQuery, B as McpDocsSearchConfig, C as DocsSearchAdapter, D as DocsSearchConfig, N as DocsSearchSourcePage, O as DocsSearchDocument, T as DocsSearchAdapterFactory, a as ApiReferenceRenderer, j as DocsSearchResult, m as DocsConfig, w as DocsSearchAdapterContext } from "./types-Boobvv2I.mjs";
2
2
  import { DocsMcpHttpHandlers, DocsMcpNavigationNode, DocsMcpNavigationTree, DocsMcpPage, DocsMcpResolvedConfig, DocsMcpSource, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
3
- import { a as createSimpleSearchAdapter, c as resolveSearchRequestConfig, i as createMcpSearchAdapter, n as createAlgoliaSearchAdapter, o as createTypesenseSearchAdapter, r as createCustomSearchAdapter, s as performDocsSearch, t as buildDocsSearchDocuments } from "./search-cPHa_3jJ.mjs";
3
+ import { a as createSimpleSearchAdapter, c as resolveSearchRequestConfig, i as createMcpSearchAdapter, n as createAlgoliaSearchAdapter, o as createTypesenseSearchAdapter, r as createCustomSearchAdapter, s as performDocsSearch, t as buildDocsSearchDocuments } from "./search-BxJywXXB.mjs";
4
4
 
5
5
  //#region src/api-reference.d.ts
6
6
  type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
@@ -251,6 +251,8 @@ interface PageFrontmatter {
251
251
  description?: string;
252
252
  /** Related doc URLs rendered into machine-readable markdown routes and MCP page output. */
253
253
  related?: DocsRelatedItem[];
254
+ /** Override or disable the estimated reading time for this page. */
255
+ readingTime?: boolean | number;
254
256
  tags?: string[];
255
257
  icon?: string;
256
258
  /** Path to custom OG image for this page (shorthand). Ignored if `openGraph` is set. */
@@ -779,6 +781,26 @@ interface LastUpdatedConfig {
779
781
  */
780
782
  position?: "footer" | "below-title";
781
783
  }
784
+ /**
785
+ * Configuration for estimated page reading time.
786
+ *
787
+ * @example
788
+ * ```ts
789
+ * readingTime: { enabled: true, wordsPerMinute: 220 }
790
+ * ```
791
+ */
792
+ interface ReadingTimeConfig {
793
+ /**
794
+ * Whether to show the estimated reading time.
795
+ * @default true
796
+ */
797
+ enabled?: boolean;
798
+ /**
799
+ * Words-per-minute rate used for the estimate.
800
+ * @default 220
801
+ */
802
+ wordsPerMinute?: number;
803
+ }
782
804
  /**
783
805
  * GitHub repository configuration for "Edit on GitHub" links
784
806
  * and source file references.
@@ -1727,6 +1749,19 @@ interface DocsConfig {
1727
1749
  * ```
1728
1750
  */
1729
1751
  lastUpdated?: boolean | LastUpdatedConfig;
1752
+ /**
1753
+ * Estimated reading time shown at the top of docs pages.
1754
+ *
1755
+ * - `undefined` → disabled by default
1756
+ * - `true` or `{ enabled: true }` → show a computed "{n} min read" label
1757
+ * - `false` → hide it entirely
1758
+ *
1759
+ * @example
1760
+ * ```ts
1761
+ * readingTime: { enabled: true, wordsPerMinute: 220 }
1762
+ * ```
1763
+ */
1764
+ readingTime?: boolean | ReadingTimeConfig;
1730
1765
  /**
1731
1766
  * AI-powered "Ask AI" chat for documentation.
1732
1767
  *
@@ -1867,4 +1902,4 @@ interface DocsConfig {
1867
1902
  og?: OGConfig;
1868
1903
  }
1869
1904
  //#endregion
1870
- export { SidebarFolderNode as $, DocsSearchQuery as A, McpDocsSearchConfig as B, DocsSearchAdapter as C, DocsSearchConfig as D, DocsSearchChunkingConfig as E, FeedbackConfig as F, OrderingItem as G, OpenDocsConfig as H, FontStyle as I, PageOpenGraph as J, PageActionsConfig as K, GithubConfig as L, DocsSearchResultType as M, DocsSearchSourcePage as N, DocsSearchDocument as O, DocsTheme as P, SidebarConfig as Q, LastUpdatedConfig as R, DocsRelatedItem as S, DocsSearchAdapterFactory as T, OpenDocsProvider as U, OGConfig as V, OpenGraphImage as W, ResolvedDocsRelatedLink as X, PageTwitter as Y, SidebarComponentProps as Z, DocsI18nConfig as _, ApiReferenceRenderer as a, TypesenseDocsSearchConfig as at, DocsMetadata as b, ChangelogFrontmatter as c, CustomDocsSearchConfig as d, SidebarNode as et, DocsAgentFeedbackContext as f, DocsFeedbackValue as g, DocsFeedbackData as h, ApiReferenceConfig as i, ThemeToggleConfig as it, DocsSearchResult as j, DocsSearchEmbeddingsConfig as k, CodeBlockCopyData as l, DocsConfig as m, AgentFeedbackConfig as n, SidebarTree as nt, BreadcrumbConfig as o, TypographyConfig as ot, DocsAgentFeedbackData as p, PageFrontmatter as q, AlgoliaDocsSearchConfig as r, SimpleDocsSearchConfig as rt, ChangelogConfig as s, UIConfig as st, AIConfig as t, SidebarPageNode as tt, CopyMarkdownConfig as u, DocsMcpConfig as v, DocsSearchAdapterContext as w, DocsNav as x, DocsMcpToolsConfig as y, LlmsTxtConfig as z };
1905
+ export { SidebarConfig as $, DocsSearchQuery as A, McpDocsSearchConfig as B, DocsSearchAdapter as C, DocsSearchConfig as D, DocsSearchChunkingConfig as E, FeedbackConfig as F, OrderingItem as G, OpenDocsConfig as H, FontStyle as I, PageOpenGraph as J, PageActionsConfig as K, GithubConfig as L, DocsSearchResultType as M, DocsSearchSourcePage as N, DocsSearchDocument as O, DocsTheme as P, SidebarComponentProps as Q, LastUpdatedConfig as R, DocsRelatedItem as S, DocsSearchAdapterFactory as T, OpenDocsProvider as U, OGConfig as V, OpenGraphImage as W, ReadingTimeConfig as X, PageTwitter as Y, ResolvedDocsRelatedLink as Z, DocsI18nConfig as _, ApiReferenceRenderer as a, ThemeToggleConfig as at, DocsMetadata as b, ChangelogFrontmatter as c, UIConfig as ct, CustomDocsSearchConfig as d, SidebarFolderNode as et, DocsAgentFeedbackContext as f, DocsFeedbackValue as g, DocsFeedbackData as h, ApiReferenceConfig as i, SimpleDocsSearchConfig as it, DocsSearchResult as j, DocsSearchEmbeddingsConfig as k, CodeBlockCopyData as l, DocsConfig as m, AgentFeedbackConfig as n, SidebarPageNode as nt, BreadcrumbConfig as o, TypesenseDocsSearchConfig as ot, DocsAgentFeedbackData as p, PageFrontmatter as q, AlgoliaDocsSearchConfig as r, SidebarTree as rt, ChangelogConfig as s, TypographyConfig as st, AIConfig as t, SidebarNode as tt, CopyMarkdownConfig as u, DocsMcpConfig as v, DocsSearchAdapterContext as w, DocsNav as x, DocsMcpToolsConfig as y, LlmsTxtConfig as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/docs",
3
- "version": "0.1.45",
3
+ "version": "0.1.48",
4
4
  "description": "Modern, flexible MDX-based docs framework — core types, config, and CLI",
5
5
  "keywords": [
6
6
  "docs",