@farming-labs/docs 0.2.62 → 0.2.63

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 (58) hide show
  1. package/dist/agent-CQTH7NFu.mjs +624 -0
  2. package/dist/agent-DKKptIgy.mjs +4365 -0
  3. package/dist/agent-evals-B7MIxuEX.mjs +2144 -0
  4. package/dist/agent-export-CBgWgPvH.mjs +910 -0
  5. package/dist/agent-scope-C_U--OZ7.mjs +283 -0
  6. package/dist/agent-skills-bundle.d.mts +13 -0
  7. package/dist/agent-skills-bundle.mjs +12 -0
  8. package/dist/agent-skills-server-CPja6Syt.d.mts +14 -0
  9. package/dist/agent-skills-server-DraIb6FV.mjs +415 -0
  10. package/dist/agent-skills-vite.d.mts +31 -0
  11. package/dist/agent-skills-vite.mjs +70 -0
  12. package/dist/agents-XWZBub6f.mjs +221 -0
  13. package/dist/analytics-Bx44lg6d.mjs +177 -0
  14. package/dist/cli/index.d.mts +15 -0
  15. package/dist/cli/index.mjs +452 -0
  16. package/dist/client/react.d.mts +45 -0
  17. package/dist/client/react.mjs +223 -0
  18. package/dist/cloud-analytics-CSyFE6SS.mjs +132 -0
  19. package/dist/cloud-ask-ai-sbpjOR2K.mjs +382 -0
  20. package/dist/cloud-ask-ai-zpwkdwnF.d.mts +23 -0
  21. package/dist/cloud-pdNC-tyj.mjs +1615 -0
  22. package/dist/code-blocks-DnNVNK2M.mjs +871 -0
  23. package/dist/codeblocks-CFuurVIH.mjs +250 -0
  24. package/dist/config-Wcdj-D0a.mjs +369 -0
  25. package/dist/dev-Cmy6DtdF.mjs +1333 -0
  26. package/dist/docs-cloud-server.d.mts +70 -0
  27. package/dist/docs-cloud-server.mjs +310 -0
  28. package/dist/doctor-CJqtzKZT.mjs +2036 -0
  29. package/dist/downgrade-w7e6Se0L.mjs +184 -0
  30. package/dist/errors-DbOhkE1h.mjs +20 -0
  31. package/dist/golden-evaluations-Dsvh0etV.mjs +1503 -0
  32. package/dist/i18n-CCaFUnAN.mjs +40 -0
  33. package/dist/index.d.mts +1150 -0
  34. package/dist/index.mjs +10 -0
  35. package/dist/init-CQY0Woe3.mjs +1264 -0
  36. package/dist/mcp-B9dcsivk.mjs +156 -0
  37. package/dist/mcp.d.mts +298 -0
  38. package/dist/mcp.mjs +4430 -0
  39. package/dist/metadata-DWExHQnx.mjs +237 -0
  40. package/dist/package-version-n5AFur8a.mjs +128 -0
  41. package/dist/reading-time-CYZ5VvKU.mjs +742 -0
  42. package/dist/review-Fndl5brR.mjs +673 -0
  43. package/dist/robots-BIpC4j4P.mjs +201 -0
  44. package/dist/robots-CUTahhoY.mjs +179 -0
  45. package/dist/search-B6V6qtiI.mjs +1826 -0
  46. package/dist/search-CaSyi6H6.d.mts +279 -0
  47. package/dist/search-DSjCeOk7.mjs +104 -0
  48. package/dist/server.d.mts +343 -0
  49. package/dist/server.mjs +14 -0
  50. package/dist/sitemap-Cykpe3Tz.mjs +249 -0
  51. package/dist/sitemap-server-C_6Wes83.mjs +1137 -0
  52. package/dist/standards-discovery-C4HUqMd2.d.mts +227 -0
  53. package/dist/standards-discovery-jkykaXq1.mjs +519 -0
  54. package/dist/templates-Bq_P7ctv.mjs +2465 -0
  55. package/dist/types-lMBIdZg0.d.mts +3315 -0
  56. package/dist/upgrade-oz-GChgt.mjs +56 -0
  57. package/dist/utils-DpiIioYb.mjs +225 -0
  58. package/package.json +1 -1
@@ -0,0 +1,343 @@
1
+ import { A as DocsAgentGoldenTask, B as DocsAnalyticsEventInput, Bt as DocsSearchAdapterContext, C as DocsAgentEvaluationTaskInput, D as DocsAgentGoldenAnswerExpectation, Dt as DocsObservabilityConfig, F as DocsAgentTraceEventInput, I as DocsAgentTraceEventType, J as DocsAskAIFeedbackMessage, K as DocsAskAIFeedbackConfig, Kt as DocsSearchQuery, L as DocsAgentTraceStatus, M as DocsAgentGoldenTaskFilters, Mt as DocsReviewCiMode, Nt as DocsReviewConfig, O as DocsAgentGoldenExampleVerification, Ot as DocsObservabilityEvent, Pt as DocsReviewRulesConfig, R as DocsAnalyticsConfig, S as DocsAgentEvaluationSurface, Ut as DocsSearchConfig, Vt as DocsSearchAdapterFactory, Wt as DocsSearchDocument, X as DocsAskAIMcpConfig, Xt as DocsSitemapConfig, Y as DocsAskAIFeedbackValue, Yt as DocsSearchSourcePage, _ as DocsAgentEvaluationAnswerProvider, a as ApiReferenceRenderer, b as DocsAgentEvaluationAnswerRunner, g as DocsAgentEvaluationAnswerInput, it as DocsCodeBlocksPlannerProvider, j as DocsAgentGoldenTaskExpectation, k as DocsAgentGoldenExpectedExample, kt as DocsObservabilityEventInput, pn as McpDocsSearchConfig, q as DocsAskAIFeedbackData, qt as DocsSearchResult, st as DocsCodeBlocksValidateConfig, ut as DocsConfig, v as DocsAgentEvaluationAnswerRequest, x as DocsAgentEvaluationSourceReference, y as DocsAgentEvaluationAnswerResult, z as DocsAnalyticsEvent, zt as DocsSearchAdapter } from "./types-lMBIdZg0.mjs";
2
+ import { n as resolveConfiguredAgentSkills, r as resolveConfiguredAgentSkillsSync, t as ResolveConfiguredAgentSkillsOptions } from "./agent-skills-server-CPja6Syt.mjs";
3
+ import { renderDocsAgentSkillsBundle } from "./agent-skills-vite.mjs";
4
+ import { i as isDocsCloudAskAIProvider, n as DocsCloudAskAIResponseOptions, r as createDocsCloudAskAIResponse, t as DocsCloudAskAIConfig } from "./cloud-ask-ai-zpwkdwnF.mjs";
5
+ import { DocsCloudAskAIOptions, DocsCloudPublicConfig, DocsCloudRouteHandlerOptions, DocsCloudRouteHandlers, DocsCloudRuntimeEnv, DocsCloudRuntimeValue, DocsCloudServer, DocsCloudServerOptions, DocsCloudTrackEventOptions, createDocsCloudRouteHandler, createDocsCloudServer } from "./docs-cloud-server.mjs";
6
+ import { A as resolveDocsSitemapPageLastmod, B as SerializedOpenDocsProvider, C as DocsSitemapResolvedConfig, D as renderDocsSitemapMarkdown, E as readDocsSitemapManifestFromContentMap, F as DEFAULT_OPEN_DOCS_TARGET, G as serializeDocsIcon, H as parsePromptStringArray, I as DEFAULT_PROMPT_PROVIDER_TEMPLATES, J as serializeOpenDocsProviders, K as serializeDocsIconRegistry, L as PromptAction, M as toDocsSitemapMarkdownUrl, N as DEFAULT_OPEN_DOCS_PROMPT, O as renderDocsSitemapXml, P as DEFAULT_OPEN_DOCS_PROVIDER_IDS, R as PromptProviderChoice, S as DocsSitemapPageInput, T as createDocsSitemapResponse, U as resolvePromptProviderChoices, V as normalizePromptProviderName, W as sanitizePromptText, _ as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, a as createMcpSearchAdapter, at as createDocsAgentTraceContext, b as DocsSitemapManifest, c as formatDocsAskAIPackageHints, ct as emitDocsAnalyticsEvent, d as resolveAskAISearchRequestConfig, dt as resolveDocsAnalyticsConfig, f as resolveDocsSearchAudience, ft as resolveDocsObservabilityConfig, g as DEFAULT_SITEMAP_MD_ROUTE, h as DEFAULT_SITEMAP_MD_DOCS_ROUTE, i as createCustomSearchAdapter, it as ResolvedDocsObservabilityConfig, j as resolveDocsSitemapRequest, k as resolveDocsSitemapConfig, l as inferDocsAskAIPackageHints, lt as emitDocsObservabilityEvent, m as DEFAULT_SITEMAP_MANIFEST_PATH, n as buildDocsSearchDocuments, nt as DocsAgentTraceContext, o as createSimpleSearchAdapter, ot as createDocsAgentTraceId, p as resolveSearchRequestConfig, q as serializeOpenDocsProvider, r as createAlgoliaSearchAdapter, rt as ResolvedDocsAnalyticsConfig, s as createTypesenseSearchAdapter, st as emitDocsAgentTraceEvent, t as buildDocsAskAIContext, tt as DOCS_AGENT_TRACE_EVENT_TYPES, u as performDocsSearch, ut as getDocsRequestAnalyticsProperties, v as DEFAULT_SITEMAP_XML_ROUTE, w as buildDocsSitemapManifest, x as DocsSitemapManifestPage, y as DocsSitemapFormat, z as SerializeOpenDocsProviderOptions } from "./search-CaSyi6H6.mjs";
7
+ import { CreateDocsMcpServerOptions, DEFAULT_DOCS_MCP_CORS_ALLOWED_HEADERS, DEFAULT_DOCS_MCP_CORS_EXPOSED_HEADERS, DEFAULT_DOCS_MCP_CORS_MAX_AGE_SECONDS, DEFAULT_DOCS_MCP_MAX_BODY_BYTES, DOCS_CONFIG_SCHEMA_OPTIONS, DocsMcpAgentContractSummary, DocsMcpCodeExample, DocsMcpConfigSchema, DocsMcpConfigSchemaOption, DocsMcpContextResult, DocsMcpContextSource, DocsMcpDocsList, DocsMcpDocsPageSummary, DocsMcpDocsSection, DocsMcpHttpHandlers, DocsMcpNavigationNode, DocsMcpNavigationTree, DocsMcpPage, DocsMcpRequestContext, DocsMcpResolvedConfig, DocsMcpResolvedCorsConfig, DocsMcpResolvedProtectedResourceConfig, DocsMcpResolvedSecurityConfig, DocsMcpSource, DocsMcpTaskSummary, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, getDocsConfigSchema, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
8
+
9
+ //#region src/code-group-mdx.d.ts
10
+ interface MarkdownNode {
11
+ type: string;
12
+ name?: string;
13
+ children?: MarkdownNode[];
14
+ lang?: string | null;
15
+ meta?: string | null;
16
+ }
17
+ declare function remarkCodeGroup(): (tree: MarkdownNode) => void;
18
+ //#endregion
19
+ //#region src/api-reference.d.ts
20
+ type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
21
+ type ApiReferenceFramework = "next" | "tanstack-start" | "sveltekit" | "astro" | "nuxt";
22
+ interface ApiReferenceRoute {
23
+ title: string;
24
+ summary: string;
25
+ description?: string;
26
+ routePath: string;
27
+ sourceFile: string;
28
+ methods: HttpMethod[];
29
+ tag: string;
30
+ parameters: Array<Record<string, unknown>>;
31
+ }
32
+ interface ResolvedApiReferenceConfig {
33
+ enabled: boolean;
34
+ path: string;
35
+ specUrl?: string;
36
+ renderer?: ApiReferenceRenderer;
37
+ routeRoot: string;
38
+ exclude: string[];
39
+ }
40
+ interface ApiReferenceOpenApiDiscovery {
41
+ enabled: boolean;
42
+ url?: string;
43
+ urlSource?: "default" | "configured";
44
+ source?: "generated" | "configured";
45
+ specUrl?: string;
46
+ apiReferencePath?: string;
47
+ }
48
+ interface BuildApiReferenceOptions {
49
+ framework: ApiReferenceFramework;
50
+ rootDir?: string;
51
+ baseUrl?: string;
52
+ }
53
+ interface BuildApiReferenceHtmlOptions extends BuildApiReferenceOptions {
54
+ title?: string;
55
+ }
56
+ declare const DEFAULT_API_REFERENCE_OPENAPI_ROUTE = "/api/docs?format=openapi";
57
+ declare function resolveApiReferenceConfig(value: DocsConfig["apiReference"]): ResolvedApiReferenceConfig;
58
+ declare function resolveApiReferenceRenderer(value: DocsConfig["apiReference"], framework: ApiReferenceFramework): ApiReferenceRenderer;
59
+ declare function resolveApiReferenceOpenApiDiscovery(value: DocsConfig["apiReference"], options?: {
60
+ route?: string;
61
+ }): ApiReferenceOpenApiDiscovery;
62
+ declare function isApiReferenceOpenApiRequest(url: URL): boolean;
63
+ declare function buildApiReferencePageTitle(config: DocsConfig, title?: string): string;
64
+ declare function buildApiReferenceScalarCss(config: DocsConfig): string;
65
+ declare function buildApiReferenceOpenApiDocument(config: DocsConfig, options: BuildApiReferenceOptions): Record<string, unknown>;
66
+ declare function buildApiReferenceOpenApiDocumentAsync(config: DocsConfig, options: BuildApiReferenceOptions): Promise<Record<string, unknown>>;
67
+ declare function buildApiReferenceHtmlDocument(config: DocsConfig, options: BuildApiReferenceHtmlOptions): string;
68
+ declare function buildApiReferenceHtmlDocumentAsync(config: DocsConfig, options: BuildApiReferenceHtmlOptions): Promise<string>;
69
+ //#endregion
70
+ //#region src/review.d.ts
71
+ declare const DEFAULT_DOCS_REVIEW_WORKFLOW_PATH = ".github/workflows/docs-review.yml";
72
+ declare const DEFAULT_DOCS_REVIEW_SCORE_THRESHOLD = 80;
73
+ interface ResolvedDocsReviewConfig {
74
+ enabled: boolean;
75
+ ci: {
76
+ enabled: boolean;
77
+ name: string;
78
+ mode: DocsReviewCiMode;
79
+ annotations: boolean;
80
+ comment: boolean;
81
+ };
82
+ score: {
83
+ threshold: number;
84
+ weights: {
85
+ error: number;
86
+ warn: number;
87
+ suggestion: number;
88
+ };
89
+ };
90
+ rules: Required<DocsReviewRulesConfig>;
91
+ }
92
+ interface DocsReviewWorkflowOptions {
93
+ packageManager?: "npm" | "pnpm" | "yarn" | "bun";
94
+ ciName?: string;
95
+ reusableWorkflow?: string;
96
+ pnpmVersion?: string;
97
+ projectDir?: string;
98
+ configPath?: string;
99
+ buildCommand?: string;
100
+ reviewCommand?: string;
101
+ pathFilters?: string[];
102
+ }
103
+ interface EnsureDocsReviewWorkflowOptions {
104
+ rootDir: string;
105
+ config?: DocsConfig;
106
+ configPath?: string;
107
+ configContent?: string;
108
+ workflowPath?: string;
109
+ log?: (message: string) => void;
110
+ }
111
+ type EnsureDocsReviewWorkflowResult = {
112
+ status: "created";
113
+ path: string;
114
+ relativePath: string;
115
+ } | {
116
+ status: "exists";
117
+ path: string;
118
+ relativePath: string;
119
+ } | {
120
+ status: "disabled";
121
+ path: string;
122
+ relativePath: string;
123
+ };
124
+ declare function resolveDocsReviewConfig(review?: boolean | DocsReviewConfig): ResolvedDocsReviewConfig;
125
+ declare function buildDocsReviewWorkflow(options?: DocsReviewWorkflowOptions): string;
126
+ declare function ensureDocsReviewWorkflow(options: EnsureDocsReviewWorkflowOptions): EnsureDocsReviewWorkflowResult;
127
+ declare function readDocsReviewConfigFromSource(content?: string): boolean | DocsReviewConfig | undefined;
128
+ declare function buildDocsReviewWorkflowPathFilters(options: {
129
+ rootDir: string;
130
+ repoRoot?: string;
131
+ config?: DocsConfig;
132
+ configPath?: string;
133
+ configContent?: string;
134
+ }): string[];
135
+ //#endregion
136
+ //#region src/code-blocks.d.ts
137
+ interface DocsCodeBlockTarget {
138
+ id: string;
139
+ filePath: string;
140
+ relativePath: string;
141
+ lineStart: number;
142
+ lineEnd: number;
143
+ language?: string;
144
+ title?: string;
145
+ framework?: string;
146
+ packageManager?: string;
147
+ runnable: boolean;
148
+ env: string[];
149
+ meta: Record<string, string | boolean>;
150
+ code: string;
151
+ }
152
+ interface DocsCodeBlockCommand {
153
+ cmd: string;
154
+ args: string[];
155
+ }
156
+ interface DocsCodeBlockExecutionPlan {
157
+ id: string;
158
+ target: DocsCodeBlockTarget;
159
+ action: "execute" | "validate-syntax" | "skip";
160
+ template: string;
161
+ runtime?: string;
162
+ filePath?: string;
163
+ command?: DocsCodeBlockCommand;
164
+ requiredEnv: string[];
165
+ reason?: string;
166
+ planner: DocsCodeBlocksPlannerProvider;
167
+ }
168
+ type DocsCodeBlockValidationStatus = "PLAN" | "PASS" | "SKIP" | "FAIL";
169
+ interface DocsCodeBlockValidationResult {
170
+ id: string;
171
+ target: DocsCodeBlockTarget;
172
+ plan: DocsCodeBlockExecutionPlan;
173
+ status: DocsCodeBlockValidationStatus;
174
+ stdout?: string;
175
+ stderr?: string;
176
+ exitCode?: number | null;
177
+ reason?: string;
178
+ }
179
+ type OptionalModuleImporter = (specifier: string) => Promise<unknown>;
180
+ declare global {
181
+ var __DOCS_CODE_BLOCKS_MODULE_IMPORTER__: OptionalModuleImporter | undefined;
182
+ }
183
+ //#endregion
184
+ //#region src/agent-evals.d.ts
185
+ type DocsGoldenEvaluationStatus = "unmeasured" | "passed" | "failed";
186
+ type DocsGoldenTaskFilters = DocsAgentGoldenTaskFilters;
187
+ type DocsGoldenExpectedExample = DocsAgentGoldenExpectedExample;
188
+ type DocsGoldenTaskExpectation = DocsAgentGoldenTaskExpectation;
189
+ type DocsGoldenTask = DocsAgentGoldenTask;
190
+ interface DocsGoldenRetrievedSource {
191
+ rank: number;
192
+ url: string;
193
+ title: string;
194
+ framework?: string;
195
+ version?: string;
196
+ utf8Bytes: number;
197
+ relevant: boolean;
198
+ truncated: boolean;
199
+ }
200
+ interface DocsGoldenRetrievalMetrics {
201
+ expectedRelevant: number;
202
+ retrievedRelevant: number;
203
+ recallAtK: number;
204
+ firstRelevantRank: number | null;
205
+ reciprocalRank: number;
206
+ forbiddenSources: string[];
207
+ passed: boolean;
208
+ }
209
+ interface DocsGoldenCitationMetrics {
210
+ /** Where the citation evidence came from. Context/results are not model-answer citations. */
211
+ evidence: "context" | "results";
212
+ expected: string[];
213
+ actual: string[];
214
+ missing: string[];
215
+ unexpected: string[];
216
+ precision: number;
217
+ recall: number;
218
+ /** True when every rendered Source line maps one-to-one to a returned source record. */
219
+ integrity: boolean;
220
+ passed: boolean;
221
+ }
222
+ interface DocsGoldenSelectionMetrics {
223
+ requestedFramework?: string;
224
+ requestedVersion?: string;
225
+ requestedLocale?: string;
226
+ expectedFramework?: string;
227
+ expectedVersion?: string;
228
+ expectedLocale?: string;
229
+ firstFrameworkMatchRank: number | null;
230
+ firstVersionMatchRank: number | null;
231
+ firstLocaleMatchRank: number | null;
232
+ conflictingSources: string[];
233
+ ambiguousSources: string[];
234
+ passed: boolean;
235
+ }
236
+ interface DocsGoldenExampleResult {
237
+ expected: DocsGoldenExpectedExample;
238
+ matchedId?: string;
239
+ source?: string;
240
+ verification: "present" | "syntax" | "execute";
241
+ status: "passed" | "failed" | "skipped";
242
+ reason?: string;
243
+ syntaxValid: boolean;
244
+ executed: boolean;
245
+ executionStatus?: DocsCodeBlockValidationResult["status"];
246
+ /** @deprecated Static/planner executability signal retained for report compatibility. */
247
+ executable: boolean;
248
+ passed: boolean;
249
+ }
250
+ interface DocsGoldenExampleMetrics {
251
+ expected: number;
252
+ matched: number;
253
+ syntaxValid: number;
254
+ executed: number;
255
+ /** @deprecated Count of statically/planner-executable examples retained for compatibility. */
256
+ executable: number;
257
+ results: DocsGoldenExampleResult[];
258
+ passed: boolean;
259
+ }
260
+ interface DocsGoldenUsageMetrics {
261
+ budgetUnit: "utf8-bytes";
262
+ tokenBudget: number;
263
+ usedUtf8Bytes: number;
264
+ remainingUtf8Bytes: number;
265
+ estimatedTokens: number;
266
+ /** Exact conservative upper bound: one token per UTF-8 byte. */
267
+ conservativeTokenUpperBound: number;
268
+ usefulUtf8Bytes: number;
269
+ usefulByteRatio: number;
270
+ truncated: boolean;
271
+ withinBudget: boolean;
272
+ passed: boolean;
273
+ }
274
+ interface DocsGoldenAnswerMetrics {
275
+ evidence: "answer";
276
+ expected: boolean;
277
+ provided: boolean;
278
+ textIncludesMissing: string[];
279
+ textExcludesPresent: string[];
280
+ citations: string[];
281
+ requiredCitations: string[];
282
+ missingCitations: string[];
283
+ unexpectedCitations: string[];
284
+ forbiddenCitations: string[];
285
+ passed: boolean;
286
+ }
287
+ interface DocsGoldenTaskReport {
288
+ id: string;
289
+ query: string;
290
+ surface: DocsAgentEvaluationSurface;
291
+ provider: string;
292
+ status: "passed" | "failed";
293
+ passed: boolean;
294
+ score: number;
295
+ context: string;
296
+ sources: DocsGoldenRetrievedSource[];
297
+ retrieval: DocsGoldenRetrievalMetrics;
298
+ citations: DocsGoldenCitationMetrics;
299
+ answer: DocsGoldenAnswerMetrics;
300
+ selection: DocsGoldenSelectionMetrics;
301
+ examples: DocsGoldenExampleMetrics;
302
+ usage: DocsGoldenUsageMetrics;
303
+ issues: string[];
304
+ }
305
+ interface DocsGoldenTasksReport {
306
+ status: DocsGoldenEvaluationStatus;
307
+ passed: boolean | null;
308
+ score: number | null;
309
+ taskCount: number;
310
+ passedTaskCount: number;
311
+ failedTaskCount: number;
312
+ tasks: DocsGoldenTaskReport[];
313
+ }
314
+ interface RunDocsGoldenTasksOptions {
315
+ /** Default evaluation surface. Tasks may override this with `task.surface`. */
316
+ surface?: DocsAgentEvaluationSurface;
317
+ /** Search configuration used by configured-search and ask-ai-context. */
318
+ search?: boolean | DocsSearchConfig;
319
+ /** Production-resolved Ask AI retrieval config, including `ai.useMcp`. */
320
+ askAISearch?: boolean | DocsSearchConfig;
321
+ siteTitle?: string;
322
+ baseUrl?: string;
323
+ rootDir?: string;
324
+ /** Permit external configured search or HTTP answer calls. @default false */
325
+ allowNetwork?: boolean;
326
+ /** Per-task configured-search/Ask-AI retrieval timeout in milliseconds. @default 30000 */
327
+ searchTimeoutMs?: number;
328
+ /** Project code-block validation config used only by explicit execute expectations. */
329
+ codeBlocksValidate?: boolean | DocsCodeBlocksValidateConfig;
330
+ /** Optional actual-answer runner. No model or HTTP request is made when omitted. */
331
+ answer?: DocsAgentEvaluationAnswerProvider;
332
+ }
333
+ /**
334
+ * Run offline-by-default golden-task evaluations against MCP-ready docs pages.
335
+ * Configured external retrieval, HTTP answers, and runtime execution require explicit opt-in.
336
+ * An empty task list is intentionally unmeasured so CI cannot turn absent coverage into a pass.
337
+ */
338
+ declare function runDocsGoldenTasks(pages: readonly DocsMcpPage[], tasks: readonly DocsGoldenTask[] | undefined, options?: RunDocsGoldenTasksOptions): Promise<DocsGoldenTasksReport>;
339
+ //#endregion
340
+ //#region src/sitemap-server.d.ts
341
+ declare function readDocsSitemapManifest(rootDir: string, sitemap?: boolean | DocsSitemapConfig): DocsSitemapManifest | null;
342
+ //#endregion
343
+ export { type ApiReferenceFramework, type ApiReferenceOpenApiDiscovery, type ApiReferenceRenderer, type ApiReferenceRoute, type CreateDocsMcpServerOptions, DEFAULT_API_REFERENCE_OPENAPI_ROUTE, DEFAULT_DOCS_MCP_CORS_ALLOWED_HEADERS, DEFAULT_DOCS_MCP_CORS_EXPOSED_HEADERS, DEFAULT_DOCS_MCP_CORS_MAX_AGE_SECONDS, DEFAULT_DOCS_MCP_MAX_BODY_BYTES, DEFAULT_DOCS_REVIEW_SCORE_THRESHOLD, DEFAULT_DOCS_REVIEW_WORKFLOW_PATH, DEFAULT_OPEN_DOCS_PROMPT, DEFAULT_OPEN_DOCS_PROVIDER_IDS, DEFAULT_OPEN_DOCS_TARGET, DEFAULT_PROMPT_PROVIDER_TEMPLATES, DEFAULT_SITEMAP_MANIFEST_PATH, DEFAULT_SITEMAP_MD_DOCS_ROUTE, DEFAULT_SITEMAP_MD_ROUTE, DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, DEFAULT_SITEMAP_XML_ROUTE, DOCS_AGENT_TRACE_EVENT_TYPES, DOCS_CONFIG_SCHEMA_OPTIONS, type DocsAgentEvaluationAnswerInput, type DocsAgentEvaluationAnswerProvider, type DocsAgentEvaluationAnswerRequest, type DocsAgentEvaluationAnswerResult, type DocsAgentEvaluationAnswerRunner, type DocsAgentEvaluationSourceReference, type DocsAgentEvaluationSurface, type DocsAgentEvaluationTaskInput, type DocsAgentGoldenAnswerExpectation, type DocsAgentGoldenExampleVerification, type DocsAgentTraceContext, type DocsAgentTraceEventInput, type DocsAgentTraceEventType, type DocsAgentTraceStatus, type DocsAnalyticsConfig, type DocsAnalyticsEvent, type DocsAnalyticsEventInput, type DocsAskAIFeedbackConfig, type DocsAskAIFeedbackData, type DocsAskAIFeedbackMessage, type DocsAskAIFeedbackValue, type DocsAskAIMcpConfig, type DocsCloudAskAIConfig, type DocsCloudAskAIOptions, type DocsCloudAskAIResponseOptions, type DocsCloudPublicConfig, type DocsCloudRouteHandlerOptions, type DocsCloudRouteHandlers, type DocsCloudRuntimeEnv, type DocsCloudRuntimeValue, type DocsCloudServer, type DocsCloudServerOptions, type DocsCloudTrackEventOptions, type DocsGoldenAnswerMetrics, type DocsGoldenCitationMetrics, type DocsGoldenEvaluationStatus, type DocsGoldenExampleMetrics, type DocsGoldenExampleResult, type DocsGoldenExpectedExample, type DocsGoldenRetrievalMetrics, type DocsGoldenRetrievedSource, type DocsGoldenSelectionMetrics, type DocsGoldenTask, type DocsGoldenTaskExpectation, type DocsGoldenTaskFilters, type DocsGoldenTaskReport, type DocsGoldenTasksReport, type DocsGoldenUsageMetrics, type DocsMcpAgentContractSummary, type DocsMcpCodeExample, type DocsMcpConfigSchema, type DocsMcpConfigSchemaOption, type DocsMcpContextResult, type DocsMcpContextSource, type DocsMcpDocsList, type DocsMcpDocsPageSummary, type DocsMcpDocsSection, type DocsMcpHttpHandlers, type DocsMcpNavigationNode, type DocsMcpNavigationTree, type DocsMcpPage, type DocsMcpRequestContext, type DocsMcpResolvedConfig, type DocsMcpResolvedCorsConfig, type DocsMcpResolvedProtectedResourceConfig, type DocsMcpResolvedSecurityConfig, type DocsMcpSource, type DocsMcpTaskSummary, type DocsObservabilityConfig, type DocsObservabilityEvent, type DocsObservabilityEventInput, type DocsSearchAdapter, type DocsSearchAdapterContext, type DocsSearchAdapterFactory, type DocsSearchConfig, type DocsSearchDocument, type DocsSearchQuery, type DocsSearchResult, type DocsSearchSourcePage, type DocsSitemapFormat, type DocsSitemapManifest, type DocsSitemapManifestPage, type DocsSitemapPageInput, type DocsSitemapResolvedConfig, type McpDocsSearchConfig, type PromptAction, type PromptProviderChoice, type ResolveConfiguredAgentSkillsOptions, type ResolvedApiReferenceConfig, type ResolvedDocsAnalyticsConfig, type ResolvedDocsObservabilityConfig, type ResolvedDocsReviewConfig, type RunDocsGoldenTasksOptions, type SerializeOpenDocsProviderOptions, type SerializedOpenDocsProvider, buildApiReferenceHtmlDocument, buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocument, buildApiReferenceOpenApiDocumentAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, buildDocsAskAIContext, buildDocsReviewWorkflow, buildDocsReviewWorkflowPathFilters, buildDocsSearchDocuments, buildDocsSitemapManifest, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsCloudAskAIResponse, createDocsCloudRouteHandler, createDocsCloudServer, createDocsMcpHttpHandler, createDocsMcpServer, createDocsSitemapResponse, createFilesystemDocsMcpSource, createMcpSearchAdapter, createSimpleSearchAdapter, createTypesenseSearchAdapter, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsObservabilityEvent, ensureDocsReviewWorkflow, formatDocsAskAIPackageHints, getDocsConfigSchema, getDocsRequestAnalyticsProperties, inferDocsAskAIPackageHints, isApiReferenceOpenApiRequest, isDocsCloudAskAIProvider, normalizeDocsMcpRoute, normalizePromptProviderName, parsePromptStringArray, performDocsSearch, readDocsReviewConfigFromSource, readDocsSitemapManifest, readDocsSitemapManifestFromContentMap, remarkCodeGroup, renderDocsAgentSkillsBundle, renderDocsSitemapMarkdown, renderDocsSitemapXml, resolveApiReferenceConfig, resolveApiReferenceOpenApiDiscovery, resolveApiReferenceRenderer, resolveAskAISearchRequestConfig, resolveConfiguredAgentSkills, resolveConfiguredAgentSkillsSync, resolveDocsAnalyticsConfig, resolveDocsMcpConfig, resolveDocsObservabilityConfig, resolveDocsReviewConfig, resolveDocsSearchAudience, resolveDocsSitemapConfig, resolveDocsSitemapPageLastmod, resolveDocsSitemapRequest, resolvePromptProviderChoices, resolveSearchRequestConfig, runDocsGoldenTasks, runDocsMcpStdio, sanitizePromptText, serializeDocsIcon, serializeDocsIconRegistry, serializeOpenDocsProvider, serializeOpenDocsProviders, toDocsSitemapMarkdownUrl };
@@ -0,0 +1,14 @@
1
+ import { a as emitDocsAnalyticsEvent, c as resolveDocsAnalyticsConfig, i as emitDocsAgentTraceEvent, l as resolveDocsObservabilityConfig, n as createDocsAgentTraceContext, o as emitDocsObservabilityEvent, r as createDocsAgentTraceId, s as getDocsRequestAnalyticsProperties, t as DOCS_AGENT_TRACE_EVENT_TYPES } from "./analytics-Bx44lg6d.mjs";
2
+ import { At as buildDocsSitemapManifest, Dt as DEFAULT_SITEMAP_MD_ROUTE, Et as DEFAULT_SITEMAP_MD_DOCS_ROUTE, Ft as resolveDocsSitemapConfig, It as resolveDocsSitemapPageLastmod, Lt as resolveDocsSitemapRequest, Mt as readDocsSitemapManifestFromContentMap, Nt as renderDocsSitemapMarkdown, Ot as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, Pt as renderDocsSitemapXml, Rt as toDocsSitemapMarkdownUrl, Tt as DEFAULT_SITEMAP_MANIFEST_PATH, jt as createDocsSitemapResponse, kt as DEFAULT_SITEMAP_XML_ROUTE } from "./agent-DKKptIgy.mjs";
3
+ import "./standards-discovery-jkykaXq1.mjs";
4
+ import { a as createMcpSearchAdapter, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, f as resolveDocsSearchAudience, i as createCustomSearchAdapter, l as inferDocsAskAIPackageHints, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, p as resolveSearchRequestConfig, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch } from "./search-B6V6qtiI.mjs";
5
+ import { C as resolveApiReferenceOpenApiDiscovery, S as resolveApiReferenceConfig, T as remarkCodeGroup, _ as buildApiReferenceOpenApiDocument, a as DEFAULT_PROMPT_PROVIDER_TEMPLATES, b as buildApiReferenceScalarCss, c as resolvePromptProviderChoices, d as serializeDocsIconRegistry, f as serializeOpenDocsProvider, g as buildApiReferenceHtmlDocumentAsync, h as buildApiReferenceHtmlDocument, i as DEFAULT_OPEN_DOCS_TARGET, l as sanitizePromptText, m as DEFAULT_API_REFERENCE_OPENAPI_ROUTE, n as DEFAULT_OPEN_DOCS_PROMPT, o as normalizePromptProviderName, p as serializeOpenDocsProviders, r as DEFAULT_OPEN_DOCS_PROVIDER_IDS, s as parsePromptStringArray, t as readDocsSitemapManifest, u as serializeDocsIcon, v as buildApiReferenceOpenApiDocumentAsync, w as resolveApiReferenceRenderer, x as isApiReferenceOpenApiRequest, y as buildApiReferencePageTitle } from "./sitemap-server-C_6Wes83.mjs";
6
+ import { a as buildDocsReviewWorkflowPathFilters, c as resolveDocsReviewConfig, i as buildDocsReviewWorkflow, n as DEFAULT_DOCS_REVIEW_SCORE_THRESHOLD, o as ensureDocsReviewWorkflow, r as DEFAULT_DOCS_REVIEW_WORKFLOW_PATH, s as readDocsReviewConfigFromSource, t as runDocsGoldenTasks } from "./agent-evals-B7MIxuEX.mjs";
7
+ import { DEFAULT_DOCS_MCP_CORS_ALLOWED_HEADERS, DEFAULT_DOCS_MCP_CORS_EXPOSED_HEADERS, DEFAULT_DOCS_MCP_CORS_MAX_AGE_SECONDS, DEFAULT_DOCS_MCP_MAX_BODY_BYTES, DOCS_CONFIG_SCHEMA_OPTIONS, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, getDocsConfigSchema, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
8
+ import { n as isDocsCloudAskAIProvider, t as createDocsCloudAskAIResponse } from "./cloud-ask-ai-sbpjOR2K.mjs";
9
+ import { createDocsCloudRouteHandler, createDocsCloudServer } from "./docs-cloud-server.mjs";
10
+ import "./code-blocks-DnNVNK2M.mjs";
11
+ import { n as resolveConfiguredAgentSkillsSync, t as resolveConfiguredAgentSkills } from "./agent-skills-server-DraIb6FV.mjs";
12
+ import { renderDocsAgentSkillsBundle } from "./agent-skills-vite.mjs";
13
+
14
+ export { DEFAULT_API_REFERENCE_OPENAPI_ROUTE, DEFAULT_DOCS_MCP_CORS_ALLOWED_HEADERS, DEFAULT_DOCS_MCP_CORS_EXPOSED_HEADERS, DEFAULT_DOCS_MCP_CORS_MAX_AGE_SECONDS, DEFAULT_DOCS_MCP_MAX_BODY_BYTES, DEFAULT_DOCS_REVIEW_SCORE_THRESHOLD, DEFAULT_DOCS_REVIEW_WORKFLOW_PATH, DEFAULT_OPEN_DOCS_PROMPT, DEFAULT_OPEN_DOCS_PROVIDER_IDS, DEFAULT_OPEN_DOCS_TARGET, DEFAULT_PROMPT_PROVIDER_TEMPLATES, DEFAULT_SITEMAP_MANIFEST_PATH, DEFAULT_SITEMAP_MD_DOCS_ROUTE, DEFAULT_SITEMAP_MD_ROUTE, DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, DEFAULT_SITEMAP_XML_ROUTE, DOCS_AGENT_TRACE_EVENT_TYPES, DOCS_CONFIG_SCHEMA_OPTIONS, buildApiReferenceHtmlDocument, buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocument, buildApiReferenceOpenApiDocumentAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, buildDocsAskAIContext, buildDocsReviewWorkflow, buildDocsReviewWorkflowPathFilters, buildDocsSearchDocuments, buildDocsSitemapManifest, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsCloudAskAIResponse, createDocsCloudRouteHandler, createDocsCloudServer, createDocsMcpHttpHandler, createDocsMcpServer, createDocsSitemapResponse, createFilesystemDocsMcpSource, createMcpSearchAdapter, createSimpleSearchAdapter, createTypesenseSearchAdapter, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsObservabilityEvent, ensureDocsReviewWorkflow, formatDocsAskAIPackageHints, getDocsConfigSchema, getDocsRequestAnalyticsProperties, inferDocsAskAIPackageHints, isApiReferenceOpenApiRequest, isDocsCloudAskAIProvider, normalizeDocsMcpRoute, normalizePromptProviderName, parsePromptStringArray, performDocsSearch, readDocsReviewConfigFromSource, readDocsSitemapManifest, readDocsSitemapManifestFromContentMap, remarkCodeGroup, renderDocsAgentSkillsBundle, renderDocsSitemapMarkdown, renderDocsSitemapXml, resolveApiReferenceConfig, resolveApiReferenceOpenApiDiscovery, resolveApiReferenceRenderer, resolveAskAISearchRequestConfig, resolveConfiguredAgentSkills, resolveConfiguredAgentSkillsSync, resolveDocsAnalyticsConfig, resolveDocsMcpConfig, resolveDocsObservabilityConfig, resolveDocsReviewConfig, resolveDocsSearchAudience, resolveDocsSitemapConfig, resolveDocsSitemapPageLastmod, resolveDocsSitemapRequest, resolvePromptProviderChoices, resolveSearchRequestConfig, runDocsGoldenTasks, runDocsMcpStdio, sanitizePromptText, serializeDocsIcon, serializeDocsIconRegistry, serializeOpenDocsProvider, serializeOpenDocsProviders, toDocsSitemapMarkdownUrl };
@@ -0,0 +1,249 @@
1
+ import { At as buildDocsSitemapManifest, Ft as resolveDocsSitemapConfig, Nt as renderDocsSitemapMarkdown, Pt as renderDocsSitemapXml } from "./agent-DKKptIgy.mjs";
2
+ import "./standards-discovery-jkykaXq1.mjs";
3
+ import "./search-B6V6qtiI.mjs";
4
+ import "./sitemap-server-C_6Wes83.mjs";
5
+ import "./agent-evals-B7MIxuEX.mjs";
6
+ import { createFilesystemDocsMcpSource } from "./mcp.mjs";
7
+ import "./code-blocks-DnNVNK2M.mjs";
8
+ import "./agent-skills-server-DraIb6FV.mjs";
9
+ import "./server.mjs";
10
+ import { _ as resolveDocsContentDir, a as loadDocsConfigModule, d as readNavTitle, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, p as readStringProperty, t as extractNestedObjectLiteral } from "./config-Wcdj-D0a.mjs";
11
+ import { t as detectFramework } from "./utils-DpiIioYb.mjs";
12
+ import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
13
+ import path from "node:path";
14
+ import { execFileSync } from "node:child_process";
15
+ import pc from "picocolors";
16
+
17
+ //#region src/cli/sitemap.ts
18
+ function normalizePathSegment(value) {
19
+ return value.replace(/^\/+|\/+$/g, "");
20
+ }
21
+ function parseInlineFlag(arg) {
22
+ const [rawKey, value] = arg.slice(2).split("=", 2);
23
+ return {
24
+ key: rawKey.trim(),
25
+ value
26
+ };
27
+ }
28
+ function parseSitemapGenerateArgs(argv) {
29
+ const parsed = {};
30
+ for (let index = 0; index < argv.length; index += 1) {
31
+ const arg = argv[index];
32
+ if (arg === "--help" || arg === "-h") {
33
+ parsed.help = true;
34
+ continue;
35
+ }
36
+ if (arg === "--public") {
37
+ parsed.public = true;
38
+ continue;
39
+ }
40
+ if (arg === "--manifest-only") {
41
+ parsed.manifestOnly = true;
42
+ continue;
43
+ }
44
+ if (arg === "--check") {
45
+ parsed.check = true;
46
+ continue;
47
+ }
48
+ if (arg.startsWith("--config=")) {
49
+ const value = parseInlineFlag(arg).value;
50
+ if (!value) throw new Error("Missing value for --config.");
51
+ parsed.configPath = value;
52
+ continue;
53
+ }
54
+ if (arg === "--config") {
55
+ const value = argv[index + 1];
56
+ if (!value || value.startsWith("--")) throw new Error("Missing value for --config.");
57
+ parsed.configPath = value;
58
+ index += 1;
59
+ continue;
60
+ }
61
+ throw new Error(`Unknown sitemap generate flag: ${arg}.`);
62
+ }
63
+ return parsed;
64
+ }
65
+ function readLlmsBaseUrlFromConfig(content, config) {
66
+ if (config?.llmsTxt && typeof config.llmsTxt === "object") return config.llmsTxt.baseUrl;
67
+ const block = extractNestedObjectLiteral(content, ["llmsTxt"]);
68
+ return block ? readStringProperty(block, "baseUrl") : void 0;
69
+ }
70
+ function readSitemapConfigFromStatic(content) {
71
+ if (/\bsitemap\s*:\s*false/.test(content)) return false;
72
+ if (/\bsitemap\s*:\s*true/.test(content)) return true;
73
+ const block = extractNestedObjectLiteral(content, ["sitemap"]);
74
+ if (!block) return void 0;
75
+ return {
76
+ enabled: readBooleanProperty(block, "enabled") ?? true,
77
+ routePrefix: readStringProperty(block, "routePrefix"),
78
+ baseUrl: readStringProperty(block, "baseUrl"),
79
+ manifestPath: readStringProperty(block, "manifestPath")
80
+ };
81
+ }
82
+ function resolveConfiguredSitemap(content, config) {
83
+ if (config?.sitemap !== void 0) return config.sitemap;
84
+ return readSitemapConfigFromStatic(content) ?? true;
85
+ }
86
+ function formatDateOnly(value) {
87
+ const parsed = new Date(value);
88
+ if (Number.isNaN(parsed.getTime())) return void 0;
89
+ return parsed.toISOString().slice(0, 10);
90
+ }
91
+ function gitLastCommitDate(rootDir, sourcePath) {
92
+ if (!sourcePath) return void 0;
93
+ try {
94
+ return formatDateOnly(execFileSync("git", [
95
+ "log",
96
+ "-1",
97
+ "--format=%cI",
98
+ "--",
99
+ sourcePath
100
+ ], {
101
+ cwd: rootDir,
102
+ encoding: "utf-8",
103
+ stdio: [
104
+ "ignore",
105
+ "pipe",
106
+ "ignore"
107
+ ]
108
+ }).trim());
109
+ } catch {
110
+ return;
111
+ }
112
+ }
113
+ function fileModifiedDate(rootDir, sourcePath) {
114
+ if (!sourcePath) return void 0;
115
+ const fullPath = path.isAbsolute(sourcePath) ? sourcePath : path.join(rootDir, sourcePath);
116
+ if (!existsSync(fullPath)) return void 0;
117
+ try {
118
+ return statSync(fullPath).mtime.toISOString().slice(0, 10);
119
+ } catch {
120
+ return;
121
+ }
122
+ }
123
+ function writeIfChanged(filePath, content, check) {
124
+ if ((existsSync(filePath) ? readFileSync(filePath, "utf-8") : void 0) === content) return false;
125
+ if (check) return true;
126
+ mkdirSync(path.dirname(filePath), { recursive: true });
127
+ writeFileSync(filePath, content, "utf-8");
128
+ return true;
129
+ }
130
+ function readExistingManifest(filePath) {
131
+ if (!existsSync(filePath)) return void 0;
132
+ try {
133
+ return JSON.parse(readFileSync(filePath, "utf-8"));
134
+ } catch {
135
+ return;
136
+ }
137
+ }
138
+ function comparableManifest(manifest) {
139
+ return {
140
+ ...manifest,
141
+ generatedAt: ""
142
+ };
143
+ }
144
+ function preserveGeneratedAtWhenUnchanged(manifest, existing) {
145
+ if (!existing?.generatedAt) return manifest;
146
+ if (JSON.stringify(comparableManifest(manifest)) !== JSON.stringify(comparableManifest(existing))) return manifest;
147
+ return {
148
+ ...manifest,
149
+ generatedAt: existing.generatedAt
150
+ };
151
+ }
152
+ function resolvePublicDir(rootDir) {
153
+ if (detectFramework(rootDir) === "sveltekit") return path.join(rootDir, "static");
154
+ return path.join(rootDir, "public");
155
+ }
156
+ function publicFilePath(rootDir, route) {
157
+ return path.join(resolvePublicDir(rootDir), route.replace(/^\/+/, ""));
158
+ }
159
+ async function generateSitemap(options = {}) {
160
+ const rootDir = process.cwd();
161
+ const loadedConfigModule = await loadDocsConfigModule(rootDir, options.configPath);
162
+ const configContent = readFileSync(loadedConfigModule?.path ?? resolveDocsConfigPath(rootDir, options.configPath), "utf-8");
163
+ const config = loadedConfigModule?.config;
164
+ const entry = normalizePathSegment(config?.entry ?? readTopLevelStringProperty(configContent, "entry") ?? "docs") || "docs";
165
+ const contentDir = typeof config?.contentDir === "string" ? config.contentDir : resolveDocsContentDir(rootDir, configContent, entry);
166
+ const siteTitle = typeof config?.nav?.title === "string" ? config.nav.title : readNavTitle(configContent) ?? "Documentation";
167
+ const sitemapInput = resolveConfiguredSitemap(configContent, config);
168
+ if (sitemapInput === false) throw new Error("Sitemap generation is disabled by `sitemap: false`.");
169
+ const sitemap = resolveDocsSitemapConfig(sitemapInput, { baseUrl: (typeof sitemapInput === "object" ? sitemapInput.baseUrl : void 0) ?? readLlmsBaseUrlFromConfig(configContent, config) });
170
+ const source = createFilesystemDocsMcpSource({
171
+ rootDir,
172
+ entry,
173
+ contentDir,
174
+ siteTitle,
175
+ ordering: config?.ordering
176
+ });
177
+ const pages = await Promise.resolve(source.getPages());
178
+ if (pages.length === 0) throw new Error(`No docs content was found under ${contentDir}.`);
179
+ const builtManifest = buildDocsSitemapManifest({
180
+ pages,
181
+ entry,
182
+ siteTitle,
183
+ baseUrl: sitemap.baseUrl,
184
+ resolveLastmod(page) {
185
+ const gitDate = gitLastCommitDate(rootDir, page.sourcePath);
186
+ if (gitDate) return {
187
+ lastmod: gitDate,
188
+ lastmodSource: "git"
189
+ };
190
+ const fsDate = fileModifiedDate(rootDir, page.sourcePath);
191
+ if (fsDate) return {
192
+ lastmod: fsDate,
193
+ lastmodSource: "filesystem"
194
+ };
195
+ }
196
+ });
197
+ const manifestPath = path.resolve(rootDir, sitemap.manifestPath);
198
+ const manifest = preserveGeneratedAtWhenUnchanged(builtManifest, readExistingManifest(manifestPath));
199
+ const manifestChanged = writeIfChanged(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`, options.check === true);
200
+ const shouldWritePublic = options.manifestOnly !== true;
201
+ const publicWrites = [];
202
+ if (shouldWritePublic) {
203
+ const xml = renderDocsSitemapXml(manifest, {
204
+ baseUrl: sitemap.baseUrl,
205
+ includeLastmod: sitemap.xml.includeLastmod
206
+ });
207
+ const markdown = renderDocsSitemapMarkdown(manifest, {
208
+ baseUrl: sitemap.baseUrl,
209
+ includeDescriptions: sitemap.markdown.includeDescriptions,
210
+ includeLastmod: sitemap.markdown.includeLastmod,
211
+ linkTarget: sitemap.markdown.linkTarget
212
+ });
213
+ if (sitemap.xml.enabled) {
214
+ const filePath = publicFilePath(rootDir, sitemap.xml.route);
215
+ if (writeIfChanged(filePath, xml, options.check === true)) publicWrites.push(filePath);
216
+ }
217
+ if (sitemap.markdown.enabled) for (const route of [
218
+ sitemap.markdown.route,
219
+ sitemap.markdown.docsRoute,
220
+ sitemap.markdown.wellKnownRoute
221
+ ]) {
222
+ if (!route) continue;
223
+ const filePath = publicFilePath(rootDir, route);
224
+ if (writeIfChanged(filePath, markdown, options.check === true)) publicWrites.push(filePath);
225
+ }
226
+ }
227
+ if (options.check && (manifestChanged || publicWrites.length > 0)) throw new Error("Sitemap output is stale. Run `docs sitemap generate` to update it.");
228
+ console.log(pc.green(`Generated sitemap manifest for ${manifest.pages.length} page(s).`));
229
+ console.log(pc.dim(path.relative(rootDir, manifestPath)));
230
+ for (const filePath of publicWrites) console.log(pc.dim(path.relative(rootDir, filePath)));
231
+ }
232
+ function printSitemapGenerateHelp() {
233
+ console.log(`
234
+ ${pc.bold("docs sitemap generate")} — Generate sitemap metadata and static sitemap files.
235
+
236
+ ${pc.dim("Usage:")}
237
+ pnpm exec docs ${pc.cyan("sitemap generate")}
238
+
239
+ ${pc.dim("Options:")}
240
+ ${pc.cyan("--config <path>")} Use a custom docs config path instead of ${pc.dim("docs.config.ts[x]")}
241
+ ${pc.cyan("--public")} Explicitly write public sitemap.xml, sitemap.md, and docs/sitemap.md files
242
+ ${pc.cyan("--manifest-only")} Only write the internal sitemap manifest
243
+ ${pc.cyan("--check")} Fail if generated output is stale
244
+ ${pc.cyan("-h, --help")} Show this help message
245
+ `);
246
+ }
247
+
248
+ //#endregion
249
+ export { generateSitemap, parseSitemapGenerateArgs, printSitemapGenerateHelp };