@farming-labs/docs 0.1.59 → 0.1.62

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.
@@ -630,6 +630,50 @@ interface PageActionsConfig {
630
630
  */
631
631
  alignment?: "left" | "right";
632
632
  }
633
+ type DocsAnalyticsSource = "client" | "server" | "mcp";
634
+ type DocsAnalyticsEventType = "page_view" | "search_open" | "search_close" | "search_query" | "search_result_click" | "search_error" | "ai_open" | "ai_close" | "ai_question" | "ai_response" | "ai_error" | "ai_clear" | "page_action_copy_markdown" | "page_action_open_docs_menu" | "page_action_open_docs" | "code_block_copy" | "feedback_select" | "feedback_submit" | "feedback_error" | "agent_read" | "agent_spec_request" | "agent_feedback_schema" | "agent_feedback_submit" | "agent_feedback_error" | "markdown_request" | "llms_request" | "skill_request" | "api_search" | "api_ai_request" | "api_ai_response" | "api_ai_error" | "mcp_request" | "mcp_tool";
635
+ interface DocsAnalyticsInput {
636
+ query?: string;
637
+ question?: string;
638
+ feedbackComment?: string;
639
+ content?: string;
640
+ }
641
+ interface DocsAnalyticsEvent {
642
+ type: DocsAnalyticsEventType | (string & {});
643
+ timestamp: string;
644
+ source: DocsAnalyticsSource;
645
+ url?: string;
646
+ path?: string;
647
+ referrer?: string;
648
+ locale?: string;
649
+ input?: DocsAnalyticsInput;
650
+ properties?: Record<string, unknown>;
651
+ }
652
+ type DocsAnalyticsEventInput = Omit<DocsAnalyticsEvent, "timestamp" | "source"> & {
653
+ timestamp?: string;
654
+ source?: DocsAnalyticsSource;
655
+ };
656
+ interface DocsAnalyticsConfig {
657
+ /** Enable analytics event emission. Defaults to `true` when this object is provided. */
658
+ enabled?: boolean;
659
+ /**
660
+ * Log analytics events to the console.
661
+ *
662
+ * `analytics: true` logs with `console.info`. When `onEvent` is provided,
663
+ * console logging is disabled unless this is set.
664
+ */
665
+ console?: boolean | "log" | "info" | "debug";
666
+ /**
667
+ * Include raw search queries, AI questions, feedback comments, and copied
668
+ * content in emitted events.
669
+ *
670
+ * Defaults to `false`; events still include safe metadata such as lengths,
671
+ * counts, routes, status, and duration.
672
+ */
673
+ includeInputs?: boolean;
674
+ /** Callback fired for every analytics event. */
675
+ onEvent?: (event: DocsAnalyticsEvent) => void | Promise<void>;
676
+ }
633
677
  /**
634
678
  * Configuration for the "Last updated" date display.
635
679
  *
@@ -1624,6 +1668,17 @@ interface DocsConfig {
1624
1668
  staticExport?: boolean;
1625
1669
  /** Theme configuration - single source of truth for UI */
1626
1670
  theme?: DocsTheme;
1671
+ /**
1672
+ * Built-in analytics event stream for docs interactions.
1673
+ *
1674
+ * - `false` or omitted -> analytics disabled (default)
1675
+ * - `true` -> log all framework events to the console
1676
+ * - `{ onEvent(event) { ... } }` -> send events to your analytics sink
1677
+ *
1678
+ * Raw queries, AI questions, feedback comments, and copied content are not
1679
+ * included unless `includeInputs: true` is set.
1680
+ */
1681
+ analytics?: boolean | DocsAnalyticsConfig;
1627
1682
  /**
1628
1683
  * GitHub repository URL or config. Enables "Edit on GitHub" links
1629
1684
  * on each docs page footer, pointing to the source `.mdx` file.
@@ -1989,4 +2044,4 @@ interface DocsConfig {
1989
2044
  og?: OGConfig;
1990
2045
  }
1991
2046
  //#endregion
1992
- export { SidebarComponentProps 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, ResolvedDocsRelatedLink as Q, LastUpdatedConfig as R, DocsRelatedItem as S, DocsSearchAdapterFactory as T, OpenDocsProvider as U, OGConfig as V, OpenGraphImage as W, PageTwitter as X, PageSidebarFrontmatter as Y, ReadingTimeConfig as Z, DocsI18nConfig as _, ApiReferenceRenderer as a, SidebarTree as at, DocsMetadata as b, ChangelogFrontmatter as c, TypesenseDocsSearchConfig as ct, CustomDocsSearchConfig as d, SidebarConfig as et, DocsAgentFeedbackContext as f, DocsFeedbackValue as g, DocsFeedbackData as h, ApiReferenceConfig as i, SidebarPageNode as it, DocsSearchResult as j, DocsSearchEmbeddingsConfig as k, CodeBlockCopyData as l, TypographyConfig as lt, DocsConfig as m, AgentFeedbackConfig as n, SidebarFolderNode as nt, BreadcrumbConfig as o, SimpleDocsSearchConfig as ot, DocsAgentFeedbackData as p, PageFrontmatter as q, AlgoliaDocsSearchConfig as r, SidebarNode as rt, ChangelogConfig as s, ThemeToggleConfig as st, AIConfig as t, SidebarFolderIndexBehavior as tt, CopyMarkdownConfig as u, UIConfig as ut, DocsMcpConfig as v, DocsSearchAdapterContext as w, DocsNav as x, DocsMcpToolsConfig as y, LlmsTxtConfig as z };
2047
+ export { PageFrontmatter as $, DocsSearchAdapterContext as A, DocsTheme as B, DocsI18nConfig as C, DocsNav as D, DocsMetadata as E, DocsSearchEmbeddingsConfig as F, LlmsTxtConfig as G, FontStyle as H, DocsSearchQuery as I, OpenDocsConfig as J, McpDocsSearchConfig as K, DocsSearchResult as L, DocsSearchChunkingConfig as M, DocsSearchConfig as N, DocsRelatedItem as O, DocsSearchDocument as P, PageActionsConfig as Q, DocsSearchResultType as R, DocsFeedbackValue as S, DocsMcpToolsConfig as T, GithubConfig as U, FeedbackConfig as V, LastUpdatedConfig as W, OpenGraphImage as X, OpenDocsProvider as Y, OrderingItem as Z, DocsAnalyticsEventType as _, ApiReferenceRenderer as a, SidebarComponentProps as at, DocsConfig as b, ChangelogFrontmatter as c, SidebarFolderNode as ct, CustomDocsSearchConfig as d, SidebarTree as dt, PageOpenGraph as et, DocsAgentFeedbackContext as f, SimpleDocsSearchConfig as ft, DocsAnalyticsEventInput as g, UIConfig as gt, DocsAnalyticsEvent as h, TypographyConfig as ht, ApiReferenceConfig as i, ResolvedDocsRelatedLink as it, DocsSearchAdapterFactory as j, DocsSearchAdapter as k, CodeBlockCopyData as l, SidebarNode as lt, DocsAnalyticsConfig as m, TypesenseDocsSearchConfig as mt, AgentFeedbackConfig as n, PageTwitter as nt, BreadcrumbConfig as o, SidebarConfig as ot, DocsAgentFeedbackData as p, ThemeToggleConfig as pt, OGConfig as q, AlgoliaDocsSearchConfig as r, ReadingTimeConfig as rt, ChangelogConfig as s, SidebarFolderIndexBehavior as st, AIConfig as t, PageSidebarFrontmatter as tt, CopyMarkdownConfig as u, SidebarPageNode as ut, DocsAnalyticsInput as v, DocsMcpConfig as w, DocsFeedbackData as x, DocsAnalyticsSource as y, DocsSearchSourcePage as z };
@@ -1,4 +1,4 @@
1
- import { c as installCommand, i as detectPackageManagerFromLockfile, o as exec, s as fileExists, t as detectFramework } from "./utils-CpTFbAiS.mjs";
1
+ import { c as installCommand, i as detectPackageManagerFromLockfile, o as exec, s as fileExists, t as detectFramework } from "./utils-DSMXVnEu.mjs";
2
2
  import path from "node:path";
3
3
  import pc from "picocolors";
4
4
  import * as p from "@clack/prompts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/docs",
3
- "version": "0.1.59",
3
+ "version": "0.1.62",
4
4
  "description": "Modern, flexible MDX-based docs framework — core types, config, and CLI",
5
5
  "keywords": [
6
6
  "docs",
@@ -1,21 +0,0 @@
1
- import { B as McpDocsSearchConfig, C as DocsSearchAdapter, D as DocsSearchConfig, E as DocsSearchChunkingConfig, N as DocsSearchSourcePage, O as DocsSearchDocument, T as DocsSearchAdapterFactory, ct as TypesenseDocsSearchConfig, d as CustomDocsSearchConfig, j as DocsSearchResult, r as AlgoliaDocsSearchConfig } from "./types-bAjvrTGU.mjs";
2
-
3
- //#region src/search.d.ts
4
- declare function buildDocsSearchDocuments(pages: DocsSearchSourcePage[], chunking?: DocsSearchChunkingConfig): DocsSearchDocument[];
5
- declare function createSimpleSearchAdapter(): DocsSearchAdapter;
6
- declare function createTypesenseSearchAdapter(config: TypesenseDocsSearchConfig): DocsSearchAdapter;
7
- declare function resolveSearchRequestConfig(search: boolean | DocsSearchConfig | undefined, requestUrl?: string): boolean | DocsSearchConfig | undefined;
8
- declare function createMcpSearchAdapter(config: McpDocsSearchConfig): DocsSearchAdapter;
9
- declare function createAlgoliaSearchAdapter(config: AlgoliaDocsSearchConfig): DocsSearchAdapter;
10
- declare function performDocsSearch(options: {
11
- pages: DocsSearchSourcePage[];
12
- query: string;
13
- search?: boolean | DocsSearchConfig;
14
- locale?: string;
15
- pathname?: string;
16
- siteTitle?: string;
17
- limit?: number;
18
- }): Promise<DocsSearchResult[]>;
19
- declare function createCustomSearchAdapter(adapter: DocsSearchAdapter | DocsSearchAdapterFactory): CustomDocsSearchConfig;
20
- //#endregion
21
- export { createSimpleSearchAdapter as a, resolveSearchRequestConfig as c, createMcpSearchAdapter as i, createAlgoliaSearchAdapter as n, createTypesenseSearchAdapter as o, createCustomSearchAdapter as r, performDocsSearch as s, buildDocsSearchDocuments as t };
File without changes