@farming-labs/docs 0.1.122 → 0.1.124

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 (33) hide show
  1. package/dist/{agent-Dt6kdGqw.mjs → agent-BS39vnhS.mjs} +6 -3
  2. package/dist/agent-BtZrMCt8.mjs +9 -0
  3. package/dist/agents-BPX4YRPs.mjs +209 -0
  4. package/dist/cli/index.mjs +33 -18
  5. package/dist/codeblocks-RacO12_K.mjs +1494 -0
  6. package/dist/{config-BHRL4R2v.mjs → config-B8wA38OC.mjs} +2 -2
  7. package/dist/{dev-C03tUSTz.mjs → dev-1VFeAWUi.mjs} +2 -2
  8. package/dist/{doctor-DMs3Q0wj.mjs → doctor-B0nFg8oM.mjs} +15 -9
  9. package/dist/{downgrade-Bv7E5LV2.mjs → downgrade-BGANzvQb.mjs} +1 -1
  10. package/dist/index.d.mts +5 -3
  11. package/dist/index.mjs +5 -5
  12. package/dist/{init-_HAuo5Dv.mjs → init-DzQWiVN1.mjs} +1 -1
  13. package/dist/{mcp-DojNlB8t.mjs → mcp-BvERlrP_.mjs} +2 -2
  14. package/dist/mcp.d.mts +1 -1
  15. package/dist/mcp.mjs +69 -8
  16. package/dist/{reading-time-Io7iRZ7S.mjs → reading-time-HpTq-0VB.mjs} +1 -0
  17. package/dist/{review-DEG_UnxV.mjs → review-ClNDYRnn.mjs} +1 -1
  18. package/dist/{robots-tohhTNbU.mjs → robots-B2BfoyVM.mjs} +6 -3
  19. package/dist/{robots-BxZaiGH3.mjs → robots-CNLiZCay.mjs} +3 -3
  20. package/dist/{search-DKpKe0rf.mjs → search-BjyDm30M.mjs} +2 -2
  21. package/dist/{search-DSgDbYBT.d.mts → search-mF8wT9LQ.d.mts} +4 -2
  22. package/dist/server.d.mts +3 -3
  23. package/dist/server.mjs +3 -3
  24. package/dist/{sitemap-CXwYOIIb.mjs → sitemap-BdSdcAmS.mjs} +10 -5
  25. package/dist/{sitemap-CnqcTdQg.mjs → sitemap-CMNj0Pt3.mjs} +4 -2
  26. package/dist/{sitemap-server-DdHzJorR.mjs → sitemap-server-BZHoJHqC.mjs} +1 -1
  27. package/dist/{types-CHD7M60f.d.mts → types-hDUu4K7W.d.mts} +134 -2
  28. package/dist/{upgrade-DrOWQIKI.mjs → upgrade-C7DvvfTR.mjs} +1 -1
  29. package/package.json +2 -1
  30. package/dist/agent-ByXnegrS.mjs +0 -9
  31. package/dist/agents-CpTNRbsh.mjs +0 -795
  32. /package/dist/{package-version-L4GZowaF.mjs → package-version-OrjpmqoR.mjs} +0 -0
  33. /package/dist/{templates-CakZBXK8.mjs → templates-CGaORZOY.mjs} +0 -0
@@ -1,6 +1,7 @@
1
1
  //#region src/sitemap.ts
2
2
  const DEFAULT_SITEMAP_XML_ROUTE = "/sitemap.xml";
3
3
  const DEFAULT_SITEMAP_MD_ROUTE = "/sitemap.md";
4
+ const DEFAULT_SITEMAP_MD_DOCS_ROUTE = "/docs/sitemap.md";
4
5
  const DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE = "/.well-known/sitemap.md";
5
6
  const DEFAULT_SITEMAP_MANIFEST_PATH = ".farming-labs/sitemap-manifest.json";
6
7
  function normalizeUrlPath(value) {
@@ -59,6 +60,7 @@ function resolveDocsSitemapConfig(sitemap, defaults = {}) {
59
60
  includeLastmod: typeof markdownConfig === "object" ? markdownConfig.includeLastmod ?? true : true,
60
61
  linkTarget: typeof markdownConfig === "object" ? markdownConfig.linkTarget ?? "both" : "both",
61
62
  route: joinRoute(routePrefix, DEFAULT_SITEMAP_MD_ROUTE),
63
+ docsRoute: routePrefix ? void 0 : DEFAULT_SITEMAP_MD_DOCS_ROUTE,
62
64
  wellKnownRoute: joinRoute(routePrefix, DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE)
63
65
  }
64
66
  };
@@ -73,7 +75,7 @@ function resolveDocsSitemapRequest(url, sitemap) {
73
75
  const resolved = resolveDocsSitemapConfig(sitemap);
74
76
  if (!resolved.enabled) return null;
75
77
  if (resolved.xml.enabled && pathname === resolved.xml.route) return "xml";
76
- if (resolved.markdown.enabled && (pathname === resolved.markdown.route || pathname === resolved.markdown.wellKnownRoute)) return "markdown";
78
+ if (resolved.markdown.enabled && (pathname === resolved.markdown.route || pathname === resolved.markdown.docsRoute || pathname === resolved.markdown.wellKnownRoute)) return "markdown";
77
79
  return null;
78
80
  }
79
81
  function toDocsSitemapMarkdownUrl(url) {
@@ -247,4 +249,4 @@ function createDocsSitemapResponse({ request, sitemap, entry = "docs", siteTitle
247
249
  }
248
250
 
249
251
  //#endregion
250
- export { buildDocsSitemapManifest as a, renderDocsSitemapMarkdown as c, resolveDocsSitemapPageLastmod as d, resolveDocsSitemapRequest as f, DEFAULT_SITEMAP_XML_ROUTE as i, renderDocsSitemapXml as l, DEFAULT_SITEMAP_MD_ROUTE as n, createDocsSitemapResponse as o, toDocsSitemapMarkdownUrl as p, DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE as r, readDocsSitemapManifestFromContentMap as s, DEFAULT_SITEMAP_MANIFEST_PATH as t, resolveDocsSitemapConfig as u };
252
+ export { DEFAULT_SITEMAP_XML_ROUTE as a, readDocsSitemapManifestFromContentMap as c, resolveDocsSitemapConfig as d, resolveDocsSitemapPageLastmod as f, DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE as i, renderDocsSitemapMarkdown as l, toDocsSitemapMarkdownUrl as m, DEFAULT_SITEMAP_MD_DOCS_ROUTE as n, buildDocsSitemapManifest as o, resolveDocsSitemapRequest as p, DEFAULT_SITEMAP_MD_ROUTE as r, createDocsSitemapResponse as s, DEFAULT_SITEMAP_MANIFEST_PATH as t, renderDocsSitemapXml as u };
@@ -1,4 +1,4 @@
1
- import { u as resolveDocsSitemapConfig } from "./sitemap-CnqcTdQg.mjs";
1
+ import { d as resolveDocsSitemapConfig } from "./sitemap-CMNj0Pt3.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
4
4
  import path, { basename, join, relative } from "node:path";
@@ -899,7 +899,7 @@ interface SitemapMarkdownConfig {
899
899
  linkTarget?: "html" | "markdown" | "both";
900
900
  }
901
901
  /**
902
- * Configuration for generated `/sitemap.xml`, `/sitemap.md`, and
902
+ * Configuration for generated `/sitemap.xml`, `/sitemap.md`, `/docs/sitemap.md`, and
903
903
  * `/.well-known/sitemap.md` routes.
904
904
  */
905
905
  interface DocsSitemapConfig {
@@ -2120,6 +2120,133 @@ interface DocsReviewConfig {
2120
2120
  /** Optional rule severity overrides. */
2121
2121
  rules?: DocsReviewRulesConfig;
2122
2122
  }
2123
+ type DocsCodeBlocksPlannerProvider = "metadata" | "openai" | "openai-compatible" | "cloud";
2124
+ type DocsCodeBlocksRunnerProvider = "local" | "vercel-sandbox" | "cloud";
2125
+ type DocsCodeBlocksValidationMode = "plan" | "report";
2126
+ type DocsCodeBlocksValidationPolicy = "skip" | "warn" | "error";
2127
+ interface DocsCodeBlocksPlannerConfig {
2128
+ /**
2129
+ * Planner used to turn code fence metadata into an execution plan.
2130
+ *
2131
+ * - `"metadata"` reads the fence language and metadata locally.
2132
+ * - `"openai"` calls OpenAI's chat completions API.
2133
+ * - `"openai-compatible"` calls an OpenAI-compatible chat completions endpoint.
2134
+ * - `"cloud"` is reserved for the hosted Farming Labs planner.
2135
+ *
2136
+ * @default "metadata"
2137
+ */
2138
+ provider?: DocsCodeBlocksPlannerProvider;
2139
+ /** Model name for LLM-backed planners. */
2140
+ model?: string;
2141
+ /** OpenAI-compatible base URL. Defaults to `https://api.openai.com/v1` for `provider: "openai"`. */
2142
+ baseUrl?: string;
2143
+ /** Environment variable containing the OpenAI-compatible base URL. */
2144
+ baseUrlEnv?: string;
2145
+ /** API key value. Prefer `apiKeyEnv` so secrets stay out of docs.config. */
2146
+ apiKey?: string;
2147
+ /** Environment variable containing the planner API key. */
2148
+ apiKeyEnv?: string;
2149
+ }
2150
+ interface DocsCodeBlocksRunnerConfig {
2151
+ /**
2152
+ * Runner used to execute planned code blocks.
2153
+ *
2154
+ * @default "local"
2155
+ */
2156
+ provider?: DocsCodeBlocksRunnerProvider;
2157
+ /** Environment variable containing the Vercel token for `provider: "vercel-sandbox"`. */
2158
+ tokenEnv?: string;
2159
+ /** Advanced override for the Vercel project id env var used by `provider: "vercel-sandbox"`. */
2160
+ projectIdEnv?: string;
2161
+ /** Advanced override for the Vercel team/org id env var used by `provider: "vercel-sandbox"`. */
2162
+ teamIdEnv?: string;
2163
+ /**
2164
+ * Path to a Vercel project metadata file. When enabled, the runner reads
2165
+ * `projectId` and `orgId` from `.vercel/project.json`. If those are not
2166
+ * available, the runner can auto-discover an accessible project from
2167
+ * `VERCEL_TOKEN`.
2168
+ *
2169
+ * @default ".vercel/project.json"
2170
+ */
2171
+ projectJson?: string | false;
2172
+ /** Vercel Sandbox runtime. */
2173
+ runtime?: "node24" | "node22" | "python3.13";
2174
+ /** Per-command timeout in milliseconds. */
2175
+ timeoutMs?: number;
2176
+ }
2177
+ interface DocsCodeBlocksValidateConfig {
2178
+ /**
2179
+ * Enable code block validation.
2180
+ *
2181
+ * @default true when `codeBlocks.validate` is an object or `true`
2182
+ */
2183
+ enabled?: boolean;
2184
+ /** Planner config. Use `"metadata"` for local deterministic planning. */
2185
+ planner?: DocsCodeBlocksPlannerProvider | DocsCodeBlocksPlannerConfig;
2186
+ /** Runner config. Use `"vercel-sandbox"` for isolated runtime checks. */
2187
+ runner?: DocsCodeBlocksRunnerProvider | DocsCodeBlocksRunnerConfig;
2188
+ /**
2189
+ * Env files loaded for validation. These are read locally and never committed.
2190
+ *
2191
+ * @default [".env.local", ".env.test", ".env"]
2192
+ */
2193
+ envFile?: string | string[];
2194
+ /**
2195
+ * Runtime env mapping.
2196
+ *
2197
+ * The key is the env var used by the docs code block. The value is the local
2198
+ * env var to read from. For example, `{ OPENAI_API_KEY: "OPENAI_TEST_API_KEY" }`
2199
+ * injects `OPENAI_API_KEY` into the runner from `OPENAI_TEST_API_KEY`.
2200
+ */
2201
+ env?: Record<string, string>;
2202
+ /**
2203
+ * Behavior when a runnable block declares an env var that cannot be resolved.
2204
+ *
2205
+ * @default "skip"
2206
+ */
2207
+ missingEnv?: DocsCodeBlocksValidationPolicy;
2208
+ /**
2209
+ * Behavior when a language cannot be executed by the selected runner.
2210
+ *
2211
+ * @default "skip"
2212
+ */
2213
+ unsupportedLanguage?: DocsCodeBlocksValidationPolicy;
2214
+ /**
2215
+ * Default command mode.
2216
+ *
2217
+ * - `"plan"` builds execution plans without running them.
2218
+ * - `"report"` runs executable plans and reports pass/skip/fail.
2219
+ *
2220
+ * @default "report"
2221
+ */
2222
+ mode?: DocsCodeBlocksValidationMode;
2223
+ }
2224
+ interface DocsCodeBlocksConfig {
2225
+ /**
2226
+ * Validate fenced code blocks from MD/MDX docs.
2227
+ *
2228
+ * @example
2229
+ * ```ts
2230
+ * codeBlocks: {
2231
+ * validate: {
2232
+ * planner: {
2233
+ * provider: "openai",
2234
+ * model: "gpt-4.1-mini",
2235
+ * apiKeyEnv: "OPENAI_API_KEY",
2236
+ * },
2237
+ * runner: {
2238
+ * provider: "vercel-sandbox",
2239
+ * tokenEnv: "VERCEL_TOKEN",
2240
+ * },
2241
+ * env: {
2242
+ * OPENAI_API_KEY: "OPENAI_TEST_API_KEY",
2243
+ * },
2244
+ * },
2245
+ * }
2246
+ * ```
2247
+ */
2248
+ validate?: boolean | DocsCodeBlocksValidateConfig;
2249
+ }
2123
2250
  interface DocsConfig {
2124
2251
  /** Entry folder for docs (e.g. "docs" → /docs) */
2125
2252
  entry: string;
@@ -2271,6 +2398,11 @@ interface DocsConfig {
2271
2398
  * ```
2272
2399
  */
2273
2400
  onCopyClick?: (data: CodeBlockCopyData) => void;
2401
+ /**
2402
+ * Code block intelligence for MD/MDX fences, including validation planning
2403
+ * and optional sandboxed execution.
2404
+ */
2405
+ codeBlocks?: DocsCodeBlocksConfig;
2274
2406
  /**
2275
2407
  * Built-in page feedback prompt shown at the end of a docs page.
2276
2408
  *
@@ -2586,4 +2718,4 @@ interface DocsConfig {
2586
2718
  og?: OGConfig;
2587
2719
  }
2588
2720
  //#endregion
2589
- export { DocsSearchChunkingConfig as $, DocsConfig as A, PageTwitter as At, DocsObservabilityEventInput as B, SimpleDocsSearchConfig as Bt, DocsAskAIActionData as C, OpenDocsTarget as Ct, DocsAskAIFeedbackMessage as D, PageFrontmatter as Dt, DocsAskAIFeedbackData as E, PageActionsConfig as Et, DocsMcpToolsConfig as F, SidebarFolderIndexBehavior as Ft, DocsReviewRulesConfig as G, DocsReviewCiConfig as H, TypesenseDocsSearchConfig as Ht, DocsMetadata as I, SidebarFolderNode as It, DocsRobotsConfig as J, DocsReviewScoreConfig as K, DocsNav as L, SidebarNode as Lt, DocsFeedbackValue as M, ResolvedDocsRelatedLink as Mt, DocsI18nConfig as N, SidebarComponentProps as Nt, DocsAskAIFeedbackValue as O, PageOpenGraph as Ot, DocsMcpConfig as P, SidebarConfig as Pt, DocsSearchAdapterFactory as Q, DocsObservabilityConfig as R, SidebarPageNode as Rt, DocsAnalyticsSource as S, OpenDocsProviderId as St, DocsAskAIFeedbackConfig as T, OrderingItem as Tt, DocsReviewCiMode as U, TypographyConfig as Ut, DocsRelatedItem as V, ThemeToggleConfig as Vt, DocsReviewConfig as W, UIConfig as Wt, DocsSearchAdapter as X, DocsRobotsRule as Y, DocsSearchAdapterContext as Z, DocsAnalyticsConfig as _, McpDocsSearchConfig as _t, ApiReferenceRenderer as a, DocsSearchResultType as at, DocsAnalyticsEventType as b, OpenDocsProvider as bt, ChangelogFrontmatter as c, DocsTheme as ct, CustomDocsSearchConfig as d, GithubConfig as dt, DocsSearchConfig as et, DocsAgentFeedbackContext as f, LastUpdatedConfig as ft, DocsAgentTraceStatus as g, LlmsTxtSectionConfig as gt, DocsAgentTraceEventType as h, LlmsTxtMaxCharsMode as ht, ApiReferenceConfig as i, DocsSearchResult as it, DocsFeedbackData as j, ReadingTimeConfig as jt, DocsAskAIMcpConfig as k, PageSidebarFrontmatter as kt, CodeBlockCopyData as l, FeedbackConfig as lt, DocsAgentTraceEventInput as m, LlmsTxtMaxCharsConfig as mt, AgentFeedbackConfig as n, DocsSearchEmbeddingsConfig as nt, BreadcrumbConfig as o, DocsSearchSourcePage as ot, DocsAgentFeedbackData as p, LlmsTxtConfig as pt, DocsReviewSeverity as q, AlgoliaDocsSearchConfig as r, DocsSearchQuery as rt, ChangelogConfig as s, DocsSitemapConfig as st, AIConfig as t, DocsSearchDocument as tt, CopyMarkdownConfig as u, FontStyle as ut, DocsAnalyticsEvent as v, OGConfig as vt, DocsAskAIActionType as w, OpenGraphImage as wt, DocsAnalyticsInput as x, OpenDocsProviderConfig as xt, DocsAnalyticsEventInput as y, OpenDocsConfig as yt, DocsObservabilityEvent as z, SidebarTree as zt };
2721
+ export { DocsReviewRulesConfig as $, DocsCodeBlocksConfig as A, OpenDocsProviderId as At, DocsFeedbackValue as B, ResolvedDocsRelatedLink as Bt, DocsAskAIActionData as C, LlmsTxtMaxCharsMode as Ct, DocsAskAIFeedbackMessage as D, OpenDocsConfig as Dt, DocsAskAIFeedbackData as E, OGConfig as Et, DocsCodeBlocksValidateConfig as F, PageFrontmatter as Ft, DocsNav as G, SidebarNode as Gt, DocsMcpConfig as H, SidebarConfig as Ht, DocsCodeBlocksValidationMode as I, PageOpenGraph as It, DocsObservabilityEventInput as J, SimpleDocsSearchConfig as Jt, DocsObservabilityConfig as K, SidebarPageNode as Kt, DocsCodeBlocksValidationPolicy as L, PageSidebarFrontmatter as Lt, DocsCodeBlocksPlannerProvider as M, OpenGraphImage as Mt, DocsCodeBlocksRunnerConfig as N, OrderingItem as Nt, DocsAskAIFeedbackValue as O, OpenDocsProvider as Ot, DocsCodeBlocksRunnerProvider as P, PageActionsConfig as Pt, DocsReviewConfig as Q, UIConfig as Qt, DocsConfig as R, PageTwitter as Rt, DocsAnalyticsSource as S, LlmsTxtMaxCharsConfig as St, DocsAskAIFeedbackConfig as T, McpDocsSearchConfig as Tt, DocsMcpToolsConfig as U, SidebarFolderIndexBehavior as Ut, DocsI18nConfig as V, SidebarComponentProps as Vt, DocsMetadata as W, SidebarFolderNode as Wt, DocsReviewCiConfig as X, TypesenseDocsSearchConfig as Xt, DocsRelatedItem as Y, ThemeToggleConfig as Yt, DocsReviewCiMode as Z, TypographyConfig as Zt, DocsAnalyticsConfig as _, FeedbackConfig as _t, ApiReferenceRenderer as a, DocsSearchAdapterContext as at, DocsAnalyticsEventType as b, LastUpdatedConfig as bt, ChangelogFrontmatter as c, DocsSearchConfig as ct, CustomDocsSearchConfig as d, DocsSearchQuery as dt, DocsReviewScoreConfig as et, DocsAgentFeedbackContext as f, DocsSearchResult as ft, DocsAgentTraceStatus as g, DocsTheme as gt, DocsAgentTraceEventType as h, DocsSitemapConfig as ht, ApiReferenceConfig as i, DocsSearchAdapter as it, DocsCodeBlocksPlannerConfig as j, OpenDocsTarget as jt, DocsAskAIMcpConfig as k, OpenDocsProviderConfig as kt, CodeBlockCopyData as l, DocsSearchDocument as lt, DocsAgentTraceEventInput as m, DocsSearchSourcePage as mt, AgentFeedbackConfig as n, DocsRobotsConfig as nt, BreadcrumbConfig as o, DocsSearchAdapterFactory as ot, DocsAgentFeedbackData as p, DocsSearchResultType as pt, DocsObservabilityEvent as q, SidebarTree as qt, AlgoliaDocsSearchConfig as r, DocsRobotsRule as rt, ChangelogConfig as s, DocsSearchChunkingConfig as st, AIConfig as t, DocsReviewSeverity as tt, CopyMarkdownConfig as u, DocsSearchEmbeddingsConfig as ut, DocsAnalyticsEvent as v, FontStyle as vt, DocsAskAIActionType as w, LlmsTxtSectionConfig as wt, DocsAnalyticsInput as x, LlmsTxtConfig as xt, DocsAnalyticsEventInput as y, GithubConfig as yt, DocsFeedbackData as z, ReadingTimeConfig as zt };
@@ -1,5 +1,5 @@
1
1
  import { c as fileExists, o as exec } from "./utils-x5EtYWjC.mjs";
2
- import { a as getPackagesForFramework, c as resolveDocsPackageManager, i as frameworkFromPreset, l as validateUpgradeVersion, n as PRESETS, o as presetFromFramework, r as buildDocsPackageInstallCommand, s as resolveDocsPackageFramework, t as PACKAGES_BY_FRAMEWORK } from "./package-version-L4GZowaF.mjs";
2
+ import { a as getPackagesForFramework, c as resolveDocsPackageManager, i as frameworkFromPreset, l as validateUpgradeVersion, n as PRESETS, o as presetFromFramework, r as buildDocsPackageInstallCommand, s as resolveDocsPackageFramework, t as PACKAGES_BY_FRAMEWORK } from "./package-version-OrjpmqoR.mjs";
3
3
  import path from "node:path";
4
4
  import pc from "picocolors";
5
5
  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.122",
3
+ "version": "0.1.124",
4
4
  "description": "Modern, flexible MDX-based docs framework — core types, config, and CLI",
5
5
  "keywords": [
6
6
  "docs",
@@ -40,6 +40,7 @@
40
40
  "@clack/prompts": "^0.9.1",
41
41
  "@modelcontextprotocol/sdk": "1.29.0",
42
42
  "@scalar/core": "^0.4.3",
43
+ "@vercel/sandbox": "^2.0.0",
43
44
  "gray-matter": "^4.0.3",
44
45
  "jiti": "^2.6.1",
45
46
  "picocolors": "^1.1.1",
@@ -1,9 +0,0 @@
1
- import "./reading-time-Io7iRZ7S.mjs";
2
- import "./search-BL7o2rXk.mjs";
3
- import "./agent-Dt6kdGqw.mjs";
4
- import "./robots-tohhTNbU.mjs";
5
- import "./sitemap-server-DdHzJorR.mjs";
6
- import "./config-BHRL4R2v.mjs";
7
- import { a as readPageTokenBudget, i as printAgentCompactHelp, n as inspectAgentCompactionState, o as scanDocsPageTargets, r as parseAgentCompactArgs, t as compactAgentDocs } from "./agents-CpTNRbsh.mjs";
8
-
9
- export { compactAgentDocs, parseAgentCompactArgs, printAgentCompactHelp };