@farming-labs/docs 0.2.115 → 0.2.116

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 (70) hide show
  1. package/dist/{agent-5jyEosML.mjs → agent-CEZCaYto.mjs} +52 -7
  2. package/dist/{agent-Dlswu0Mm.mjs → agent-DGNTD-N6.mjs} +3 -3
  3. package/dist/{agent-evals-CnQC3W2a.mjs → agent-evals-CmeTjDMC.mjs} +3 -3
  4. package/dist/{agent-export-yilcRMg6.mjs → agent-export-DIKwVWYN.mjs} +11 -10
  5. package/dist/agent-skills-bundle.d.mts +1 -1
  6. package/dist/{agent-skills-progressive-disclosure-DL-q4JZo.mjs → agent-skills-progressive-disclosure-BDSjGGFd.mjs} +1 -1
  7. package/dist/{agent-skills-server-CF6iVTBR.d.mts → agent-skills-server-BWRJjIQG.d.mts} +2 -2
  8. package/dist/{agent-skills-server-Ddbf15pY.mjs → agent-skills-server-Ddm90WL6.mjs} +1 -1
  9. package/dist/agent-skills-vite.d.mts +3 -3
  10. package/dist/agent-skills-vite.mjs +1 -1
  11. package/dist/{agents-D5waM-jZ.mjs → agents-l8RtkFim.mjs} +10 -9
  12. package/dist/{analytics-CwXxM9oL.d.mts → analytics-R9c-Md4b.d.mts} +1 -1
  13. package/dist/api-reference-0XdEWya8.mjs +3033 -0
  14. package/dist/{authoring-CsR0sewh.mjs → authoring-CvsCmYuq.mjs} +4 -4
  15. package/dist/{authoring-mcp-BpwboE3k.mjs → authoring-mcp-C35lj3cI.mjs} +2 -2
  16. package/dist/browser.d.mts +3 -3
  17. package/dist/cli/index.mjs +75 -34
  18. package/dist/client/react.d.mts +1 -1
  19. package/dist/{cloud-Bvof6mET.mjs → cloud-DtmNQJg2.mjs} +3 -3
  20. package/dist/{cloud-ask-ai-C9dvEBpW.d.mts → cloud-ask-ai-DLyrydIR.d.mts} +1 -1
  21. package/dist/{codeblocks-C911CdyJ.mjs → codeblocks-DEcqNXve.mjs} +2 -2
  22. package/dist/{content-change-hydration-CDuohygf.d.mts → content-change-hydration-BWJNUIot.d.mts} +33 -5
  23. package/dist/{dev-Bx0JNglW.mjs → dev-Df77AKR1.mjs} +9 -24
  24. package/dist/docs-cloud-server.d.mts +2 -2
  25. package/dist/docs-cloud-server.mjs +1 -1
  26. package/dist/{doctor-DbsNvdb8.mjs → doctor-zNmt9s6j.mjs} +266 -17
  27. package/dist/{downgrade-BXmQMkMy.mjs → downgrade-C6DSsOO9.mjs} +2 -2
  28. package/dist/{feedback-DWVUMrxy.mjs → feedback-CNsQP2jY.mjs} +1 -1
  29. package/dist/{golden-evaluations-D49vhw5u.mjs → golden-evaluations-B1QDOzYj.mjs} +6 -2
  30. package/dist/index.d.mts +8 -8
  31. package/dist/index.mjs +5 -5
  32. package/dist/{init-CCV2eRNB.mjs → init-BXKzipSS.mjs} +3 -3
  33. package/dist/{mcp-D-1u1RBW.mjs → mcp-Bj3ZoEtt.mjs} +33 -19
  34. package/dist/mcp.d.mts +12 -4
  35. package/dist/mcp.mjs +50 -8
  36. package/dist/openapi-anOaQn9o.mjs +20 -0
  37. package/dist/openapi-diff-DKW3xkQU.mjs +461 -0
  38. package/dist/{openapi-mcp-D8NVpTW1.mjs → openapi-mcp-UF4Cx885.mjs} +43 -91
  39. package/dist/openapi-operations-DFpaqOqA.mjs +324 -0
  40. package/dist/openapi-sdk-DqRHPsCb.mjs +415 -0
  41. package/dist/openapi-source-CiKbUK71.mjs +37 -0
  42. package/dist/{package-version-Ci99L0yo.mjs → package-version-CTkii52k.mjs} +1 -1
  43. package/dist/{prompt-references-CV1zw72C.mjs → prompt-references-Cficetgk.mjs} +2 -2
  44. package/dist/{retrieval-digest-CBhsp9LK.d.mts → retrieval-digest-PD4fFy7P.d.mts} +2 -2
  45. package/dist/{review-BdM27yh7.mjs → review-CcplK9Hj.mjs} +9 -9
  46. package/dist/{robots-Bne9ODlC.mjs → robots-BPYWIGqD.mjs} +1 -1
  47. package/dist/{robots-D6VufwPn.mjs → robots-D4T3zZr_.mjs} +4 -4
  48. package/dist/{search-BCxmGlxh.mjs → search-BNmlDQJ2.mjs} +27 -11
  49. package/dist/server.d.mts +132 -9
  50. package/dist/server.mjs +12 -10
  51. package/dist/{sidebar-Bne72SU-.d.mts → sidebar-CGbvEPTX.d.mts} +1 -1
  52. package/dist/{sitemap-ChOEBnrk.mjs → sitemap-Bc4LkIcm.mjs} +10 -9
  53. package/dist/sitemap-server-C4bpuoLi.mjs +235 -0
  54. package/dist/{skills-qswruIKO.mjs → skills-B6wl1bUL.mjs} +10 -9
  55. package/dist/{standards-discovery-CjyUCxdy.d.mts → standards-discovery-C1RLKwV9.d.mts} +1 -1
  56. package/dist/{templates-DdB4BBGq.mjs → templates-BiORflC3.mjs} +1 -2
  57. package/dist/{types-BkAk6B2d.d.mts → types-Dkl2DUfp.d.mts} +39 -9
  58. package/dist/{upgrade-B92U83xo.mjs → upgrade-8zStRidw.mjs} +2 -2
  59. package/package.json +2 -1
  60. package/dist/sitemap-server-D3mFJkjE.mjs +0 -1166
  61. /package/dist/{agent-feedback-loop-vaC-M1sx.mjs → agent-feedback-loop-CcZL_sb1.mjs} +0 -0
  62. /package/dist/{audience-exposure-CkNZNeVX.d.mts → audience-exposure-BAjHjaTT.d.mts} +0 -0
  63. /package/dist/{cloud-ask-ai-CK2qlNns.mjs → cloud-ask-ai-BDtBbbZZ.mjs} +0 -0
  64. /package/dist/{code-blocks-D90CCJFs.mjs → code-blocks-GYdvS3BH.mjs} +0 -0
  65. /package/dist/{config-DrZ3fXgf.mjs → config-BnUOoj07.mjs} +0 -0
  66. /package/dist/{errors-BDmra6mz.mjs → errors-BkS29NUA.mjs} +0 -0
  67. /package/dist/{feedback-evals-k0sFDdms.mjs → feedback-evals-CYuS2wTu.mjs} +0 -0
  68. /package/dist/{openapi-mcp-node-vO3IXVGI.mjs → openapi-mcp-node-C4jUpZG6.mjs} +0 -0
  69. /package/dist/{propose-DJOiHu9Y.mjs → propose-ZH_mGMY_.mjs} +0 -0
  70. /package/dist/{utils-Cc1SrVza.mjs → utils-c9arebCi.mjs} +0 -0
@@ -0,0 +1,415 @@
1
+ import "./markdown-sections-BKy4labo.mjs";
2
+ import "./agent-CEZCaYto.mjs";
3
+ import "./standards-discovery-Bpz90VYq.mjs";
4
+ import { n as buildNormalizedOpenApiModel } from "./openapi-operations-DFpaqOqA.mjs";
5
+ import "./api-reference-0XdEWya8.mjs";
6
+ import { n as loadOpenApiCliSource, t as displayOpenApiCliSource } from "./openapi-source-CiKbUK71.mjs";
7
+ import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
8
+ import path from "node:path";
9
+ import pc from "picocolors";
10
+
11
+ //#region src/cli/openapi-sdk.ts
12
+ const GENERATED_SDK_MARKER = "// Generated by @farming-labs/docs openapi sdk. Do not edit.";
13
+ const GENERATED_TYPE_NAMES = new Set([
14
+ "ApiClientOptions",
15
+ "ApiError",
16
+ "ApiResponse"
17
+ ]);
18
+ const RESERVED_METHOD_NAMES = new Set(["constructor"]);
19
+ function parseOpenApiSdkArgs(argv) {
20
+ const positionals = [];
21
+ let source;
22
+ let output;
23
+ let clientName;
24
+ let baseUrl;
25
+ let sourceBaseUrl;
26
+ let check = false;
27
+ let dryRun = false;
28
+ let force = false;
29
+ let help = false;
30
+ for (let index = 0; index < argv.length; index += 1) {
31
+ const argument = argv[index] ?? "";
32
+ if (argument === "--help" || argument === "-h") {
33
+ help = true;
34
+ continue;
35
+ }
36
+ if (argument === "--check") {
37
+ check = true;
38
+ continue;
39
+ }
40
+ if (argument === "--dry-run") {
41
+ dryRun = true;
42
+ continue;
43
+ }
44
+ if (argument === "--force") {
45
+ force = true;
46
+ continue;
47
+ }
48
+ if (!argument.startsWith("--")) {
49
+ positionals.push(argument);
50
+ continue;
51
+ }
52
+ const separator = argument.indexOf("=");
53
+ const flag = argument.slice(2, separator === -1 ? void 0 : separator);
54
+ const inlineValue = separator === -1 ? void 0 : argument.slice(separator + 1);
55
+ const value = inlineValue ?? argv[index + 1];
56
+ if (value === void 0 || value.startsWith("--")) throw new Error(`Missing value for --${flag}.`);
57
+ if (inlineValue === void 0) index += 1;
58
+ if (flag === "source") source = value;
59
+ else if (flag === "output" || flag === "out") output = value;
60
+ else if (flag === "client-name" || flag === "name") clientName = value;
61
+ else if (flag === "base-url") baseUrl = value;
62
+ else if (flag === "source-base-url") sourceBaseUrl = value;
63
+ else throw new Error(`Unknown OpenAPI SDK option: --${flag}.`);
64
+ }
65
+ for (const positional of positionals) if (!source) source = positional;
66
+ else throw new Error("Pass exactly one OpenAPI source.");
67
+ if (check && dryRun) throw new Error("Use either --check or --dry-run, not both.");
68
+ if (!help && !source) throw new Error("Pass an OpenAPI source.");
69
+ if (!help && !output) throw new Error("Pass --output <path> for the generated TypeScript SDK.");
70
+ return {
71
+ source,
72
+ output,
73
+ clientName,
74
+ baseUrl,
75
+ sourceBaseUrl,
76
+ check,
77
+ dryRun,
78
+ force,
79
+ help
80
+ };
81
+ }
82
+ async function runOpenApiSdk(options) {
83
+ if (!options.source || !options.output) throw new Error("OpenAPI SDK source and output are required.");
84
+ const rootDir = path.resolve(options.rootDir ?? process.cwd());
85
+ const outputPath = resolveOutputPath(rootDir, options.output);
86
+ const document = await loadOpenApiCliSource(options.source, {
87
+ rootDir,
88
+ baseUrl: options.sourceBaseUrl
89
+ });
90
+ const model = buildNormalizedOpenApiModel(document);
91
+ const clientName = normalizeTypeName(options.clientName ?? `${model.title} Client`);
92
+ const code = generateOpenApiTypeScriptSdk(document, {
93
+ clientName,
94
+ baseUrl: options.baseUrl,
95
+ source: displayOpenApiCliSource(options.source)
96
+ });
97
+ const current = existsSync(outputPath) ? readFileSync(outputPath, "utf-8") : void 0;
98
+ const changed = current !== code;
99
+ const report = {
100
+ format: "farming-labs-openapi-sdk.v1",
101
+ source: displayOpenApiCliSource(options.source),
102
+ output: normalizeRelativePath(path.relative(rootDir, outputPath)),
103
+ clientName,
104
+ operationCount: model.operationCount,
105
+ schemaCount: collectComponentSchemas(document).length,
106
+ changed,
107
+ wrote: false
108
+ };
109
+ if (options.dryRun) {
110
+ console.log(code);
111
+ return report;
112
+ }
113
+ if (options.check) {
114
+ if (changed) {
115
+ console.error(pc.red(`${report.output} is missing or stale. Run docs openapi sdk ${options.source} --output ${options.output}.`));
116
+ process.exitCode = 1;
117
+ } else console.log(pc.green(`${report.output} is up to date.`));
118
+ return report;
119
+ }
120
+ if (current !== void 0 && !current.startsWith(GENERATED_SDK_MARKER) && !options.force) throw new Error(`Refusing to replace non-generated file ${report.output}. Pass --force only after reviewing that file.`);
121
+ mkdirSync(path.dirname(outputPath), { recursive: true });
122
+ writeFileSync(outputPath, code, "utf-8");
123
+ report.wrote = true;
124
+ console.log(pc.green(`${changed ? "Generated" : "Refreshed"} ${report.output} with ${report.operationCount} operation${report.operationCount === 1 ? "" : "s"} and ${report.schemaCount} schema${report.schemaCount === 1 ? "" : "s"}.`));
125
+ return report;
126
+ }
127
+ function generateOpenApiTypeScriptSdk(document, options = {}) {
128
+ const model = buildNormalizedOpenApiModel(document);
129
+ const usedTypeNames = new Set(GENERATED_TYPE_NAMES);
130
+ const clientName = claimName(normalizeTypeName(options.clientName ?? `${model.title} Client`), usedTypeNames);
131
+ const components = collectComponentSchemas(document, usedTypeNames);
132
+ const referenceNames = new Map(components.map((component) => [component.reference, component.name]));
133
+ const operationNames = /* @__PURE__ */ new Map();
134
+ const usedMethodNames = /* @__PURE__ */ new Set();
135
+ for (const operation of model.operations) {
136
+ const baseName = normalizeTypeName(operation.operationId);
137
+ operationNames.set(operation, {
138
+ methodName: claimName(normalizeMethodName(operation.operationId), usedMethodNames),
139
+ inputName: claimName(`${baseName}Input`, usedTypeNames),
140
+ responseName: claimName(`${baseName}Response`, usedTypeNames)
141
+ });
142
+ }
143
+ const schemaContext = {
144
+ document,
145
+ referenceNames,
146
+ references: /* @__PURE__ */ new Set()
147
+ };
148
+ const defaultBaseUrl = resolveSdkBaseUrl(options.baseUrl, model.servers);
149
+ const lines = [
150
+ GENERATED_SDK_MARKER,
151
+ `// Source: ${sanitizeLineComment(options.source ?? "OpenAPI contract")}`,
152
+ "",
153
+ "export interface ApiClientOptions {",
154
+ " baseUrl?: string;",
155
+ " fetch?: typeof fetch;",
156
+ " headers?: HeadersInit;",
157
+ "}",
158
+ "",
159
+ "export interface ApiResponse<TStatus extends number | string, TData> {",
160
+ " status: TStatus;",
161
+ " data: TData;",
162
+ " headers: Headers;",
163
+ "}",
164
+ "",
165
+ "export class ApiError<TData = unknown> extends Error {",
166
+ " readonly status: number;",
167
+ " readonly data: TData;",
168
+ " readonly headers: Headers;",
169
+ "",
170
+ " constructor(status: number, data: TData, headers: Headers) {",
171
+ " super(`API request failed with status ${status}.`);",
172
+ " this.name = \"ApiError\";",
173
+ " this.status = status;",
174
+ " this.data = data;",
175
+ " this.headers = headers;",
176
+ " }",
177
+ "}"
178
+ ];
179
+ for (const component of components) lines.push("", `export type ${component.name} = ${schemaToTypeScript(component.schema, schemaContext)};`);
180
+ for (const operation of model.operations) {
181
+ const names = operationNames.get(operation);
182
+ lines.push("", ...renderOperationTypes(operation, names, schemaContext));
183
+ }
184
+ lines.push("", `const DEFAULT_BASE_URL = ${JSON.stringify(defaultBaseUrl)};`, "", "function joinUrl(baseUrl: string, pathname: string): string {", " return `${baseUrl.replace(/\\/+$/, \"\")}/${pathname.replace(/^\\/+/, \"\")}`;", "}", "", "function appendQueryParameter(searchParams: URLSearchParams, name: string, value: unknown): void {", " if (value === undefined || value === null) return;", " if (Array.isArray(value)) {", " for (const entry of value) appendQueryParameter(searchParams, name, entry);", " return;", " }", " searchParams.append(name, typeof value === \"object\" ? JSON.stringify(value) : String(value));", "}", "", "async function parseApiResponse(response: Response): Promise<unknown> {", " if (response.status === 204 || response.status === 205) return undefined;", " const contentLength = response.headers.get(\"content-length\");", " if (contentLength === \"0\") return undefined;", " const contentType = response.headers.get(\"content-type\")?.toLowerCase() ?? \"\";", " if (contentType.includes(\"json\") || contentType.includes(\"+json\")) return response.json();", " return response.text();", "}", "", `export class ${clientName} {`, " private readonly baseUrl: string;", " private readonly fetchImpl: typeof fetch;", " private readonly defaultHeaders: Headers;", "", " constructor(options: ApiClientOptions = {}) {", " this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;", " if (!this.baseUrl) {", " throw new Error(\"A baseUrl is required because the OpenAPI contract has no absolute server URL.\");", " }", " this.fetchImpl = options.fetch ?? globalThis.fetch.bind(globalThis);", " this.defaultHeaders = new Headers(options.headers);", " }");
185
+ for (const operation of model.operations) lines.push("", ...renderOperationMethod(operation, operationNames.get(operation)));
186
+ lines.push("}", "");
187
+ return lines.join("\n");
188
+ }
189
+ function printOpenApiSdkHelp() {
190
+ console.log(`${pc.bold("docs openapi sdk")} — Generate a typed TypeScript fetch client.
191
+
192
+ Usage:
193
+ docs openapi sdk <source> --output <path> [options]
194
+ docs api sdk --source <source> --out <path> [options]
195
+
196
+ Sources:
197
+ Project-relative or absolute JSON/YAML files, file: URLs, and HTTP(S) URLs.
198
+
199
+ Options:
200
+ ${pc.cyan("--source <source>")} OpenAPI contract; positional form is also accepted
201
+ ${pc.cyan("--output, --out <path>")} TypeScript output path inside the project root
202
+ ${pc.cyan("--client-name <name>")} Generated client class name
203
+ ${pc.cyan("--base-url <url>")} Override the generated client default base URL
204
+ ${pc.cyan("--source-base-url <url>")} Resolve a request-relative remote source
205
+ ${pc.cyan("--check")} Fail when the generated file is missing or stale
206
+ ${pc.cyan("--dry-run")} Print generated TypeScript without writing
207
+ ${pc.cyan("--force")} Replace an existing non-generated output file
208
+ ${pc.cyan("--help")} Show this help
209
+ `);
210
+ }
211
+ function renderOperationTypes(operation, names, context) {
212
+ const lines = [`export interface ${names.inputName} {`];
213
+ for (const location of [
214
+ "path",
215
+ "query",
216
+ "header",
217
+ "cookie"
218
+ ]) {
219
+ const parameters = operation.parameters.filter((parameter) => parameter.in === location);
220
+ if (parameters.length === 0) continue;
221
+ const required = parameters.some((parameter) => parameter.required);
222
+ lines.push(` ${location}${required ? "" : "?"}: ${renderParameterObject(parameters, context)};`);
223
+ }
224
+ if (operation.requestBody) {
225
+ const media = selectMediaType(operation.requestBody.content);
226
+ lines.push(` body${operation.requestBody.required ? "" : "?"}: ${schemaToTypeScript(media?.schema, context)};`);
227
+ }
228
+ lines.push(" request?: Omit<RequestInit, \"method\" | \"body\" | \"headers\"> & { headers?: HeadersInit };", "}", "", `export type ${names.responseName} = ${renderResponseType(operation.responses, context)};`);
229
+ return lines;
230
+ }
231
+ function renderOperationMethod(operation, names) {
232
+ const inputRequired = operation.parameters.some((parameter) => parameter.required) || operation.requestBody?.required === true;
233
+ const lines = [` async ${names.methodName}(input: ${names.inputName}${inputRequired ? "" : " = {}"}): Promise<${names.responseName}> {`, ` let operationPath = ${JSON.stringify(operation.path)};`];
234
+ for (const parameter of operation.parameters.filter((entry) => entry.in === "path")) lines.push(` operationPath = operationPath.replaceAll(${JSON.stringify(`{${parameter.name}}`)}, encodeURIComponent(String(input.path[${JSON.stringify(parameter.name)}])));`);
235
+ lines.push(" const url = new URL(joinUrl(this.baseUrl, operationPath));");
236
+ for (const parameter of operation.parameters.filter((entry) => entry.in === "query")) lines.push(` appendQueryParameter(url.searchParams, ${JSON.stringify(parameter.name)}, input.query?.[${JSON.stringify(parameter.name)}]);`);
237
+ lines.push(" const headers = new Headers(this.defaultHeaders);");
238
+ for (const parameter of operation.parameters.filter((entry) => entry.in === "header")) lines.push(` if (input.header?.[${JSON.stringify(parameter.name)}] !== undefined) headers.set(${JSON.stringify(parameter.name)}, String(input.header[${JSON.stringify(parameter.name)}]));`);
239
+ const cookieParameters = operation.parameters.filter((entry) => entry.in === "cookie");
240
+ if (cookieParameters.length > 0) {
241
+ lines.push(" const cookieParts: string[] = [];");
242
+ for (const parameter of cookieParameters) lines.push(` if (input.cookie?.[${JSON.stringify(parameter.name)}] !== undefined) cookieParts.push(${JSON.stringify(`${parameter.name}=`)} + encodeURIComponent(String(input.cookie[${JSON.stringify(parameter.name)}])));`);
243
+ lines.push(" if (cookieParts.length > 0) headers.set(\"cookie\", cookieParts.join(\"; \"));");
244
+ }
245
+ lines.push(" const requestHeaders = new Headers(input.request?.headers);", " requestHeaders.forEach((value, name) => headers.set(name, value));", " const requestOptions = { ...input.request };", " delete requestOptions.headers;");
246
+ const requestMedia = operation.requestBody ? selectMediaType(operation.requestBody.content) : void 0;
247
+ if (operation.requestBody) if (requestMedia?.mediaType.includes("json") || requestMedia?.mediaType.includes("+json")) lines.push(` headers.set("content-type", ${JSON.stringify(requestMedia.mediaType)});`, " const body = input.body === undefined ? undefined : JSON.stringify(input.body);");
248
+ else {
249
+ if (requestMedia) lines.push(` headers.set("content-type", ${JSON.stringify(requestMedia.mediaType)});`);
250
+ lines.push(" const body = input.body as BodyInit | null | undefined;");
251
+ }
252
+ else lines.push(" const body = undefined;");
253
+ lines.push(" const response = await this.fetchImpl(url, {", " ...requestOptions,", ` method: ${JSON.stringify(operation.method)},`, " headers,", " body,", " });", " const data = await parseApiResponse(response);", " if (!response.ok) throw new ApiError(response.status, data, response.headers);", ` return { status: response.status, data, headers: response.headers } as ${names.responseName};`, " }");
254
+ return lines;
255
+ }
256
+ function renderParameterObject(parameters, context) {
257
+ return `{ ${parameters.map((parameter) => `${JSON.stringify(parameter.name)}${parameter.required ? "" : "?"}: ${schemaToTypeScript(parameter.schema, context)}`).join("; ")} }`;
258
+ }
259
+ function renderResponseType(responses, context) {
260
+ const successful = responses.filter((response) => /^2\d\d$/.test(response.status) || /^2XX$/i.test(response.status));
261
+ const candidates = successful.length > 0 ? successful : responses.filter((response) => response.status === "default");
262
+ if (candidates.length === 0) return "ApiResponse<number, unknown>";
263
+ return candidates.map((response) => {
264
+ const media = selectMediaType(response.content);
265
+ const data = media ? schemaToTypeScript(media.schema, context) : "undefined";
266
+ return `ApiResponse<${/^\d+$/.test(response.status) ? response.status : "number"}, ${data}>`;
267
+ }).join(" | ");
268
+ }
269
+ function selectMediaType(mediaTypes) {
270
+ return mediaTypes.find((entry) => entry.mediaType === "application/json") ?? mediaTypes.find((entry) => entry.mediaType.includes("+json")) ?? mediaTypes[0];
271
+ }
272
+ function collectComponentSchemas(document, usedNames = /* @__PURE__ */ new Set()) {
273
+ const componentSchemas = asRecord(asRecord(document.components)?.schemas) ?? {};
274
+ const definitions = asRecord(document.definitions) ?? {};
275
+ const schemas = [];
276
+ for (const [prefix, entries] of [["#/components/schemas", componentSchemas], ["#/definitions", definitions]]) for (const key of Object.keys(entries).sort()) schemas.push({
277
+ name: claimName(normalizeTypeName(key), usedNames),
278
+ reference: `${prefix}/${escapeJsonPointer(key)}`,
279
+ schema: entries[key]
280
+ });
281
+ return schemas;
282
+ }
283
+ function schemaToTypeScript(schema, context) {
284
+ if (schema === void 0 || schema === true) return "unknown";
285
+ if (schema === false) return "never";
286
+ const record = asRecord(schema);
287
+ if (!record) return "unknown";
288
+ const reference = typeof record.$ref === "string" ? record.$ref : void 0;
289
+ if (reference) {
290
+ const named = context.referenceNames.get(reference);
291
+ if (named) return named;
292
+ if (!context.references.has(reference) && reference.startsWith("#/")) {
293
+ const target = resolvePointer(context.document, reference.slice(1));
294
+ if (target !== void 0) return schemaToTypeScript(target, {
295
+ ...context,
296
+ references: new Set(context.references).add(reference)
297
+ });
298
+ }
299
+ return "unknown";
300
+ }
301
+ if (Object.hasOwn(record, "const")) return literalType(record.const);
302
+ if (Array.isArray(record.enum) && record.enum.length > 0) return record.enum.map(literalType).join(" | ");
303
+ const allOf = schemaArray(record.allOf);
304
+ if (allOf.length > 0) return allOf.map((entry) => parenthesize(schemaToTypeScript(entry, context))).join(" & ");
305
+ const union = [...schemaArray(record.oneOf), ...schemaArray(record.anyOf)];
306
+ if (union.length > 0) return union.map((entry) => schemaToTypeScript(entry, context)).join(" | ");
307
+ const types = normalizeSchemaTypes(record.type);
308
+ let result;
309
+ if (types.length > 1) result = types.map((type) => schemaTypeToTypeScript(type, record, context)).join(" | ");
310
+ else result = schemaTypeToTypeScript(types[0], record, context);
311
+ if (record.nullable === true && !result.split(" | ").includes("null")) result += " | null";
312
+ return result;
313
+ }
314
+ function schemaTypeToTypeScript(type, schema, context) {
315
+ if (type === "string") return schema.format === "binary" ? "Blob" : "string";
316
+ if (type === "integer" || type === "number") return "number";
317
+ if (type === "boolean") return "boolean";
318
+ if (type === "null") return "null";
319
+ if (type === "array" || schema.items !== void 0) return `Array<${schemaToTypeScript(schema.items, context)}>`;
320
+ const properties = asRecord(schema.properties);
321
+ if (type === "object" || properties || schema.additionalProperties !== void 0) {
322
+ const required = new Set(stringArray(schema.required));
323
+ const fields = Object.keys(properties ?? {}).sort().map((name) => `${JSON.stringify(name)}${required.has(name) ? "" : "?"}: ${schemaToTypeScript(properties?.[name], context)}`);
324
+ const objectType = fields.length > 0 ? `{ ${fields.join("; ")} }` : "Record<string, never>";
325
+ const additional = schema.additionalProperties;
326
+ if (additional === false) return objectType;
327
+ const additionalType = additional === void 0 || additional === true ? "unknown" : schemaToTypeScript(additional, context);
328
+ if (fields.length === 0) return `Record<string, ${additionalType}>`;
329
+ return `${parenthesize(objectType)} & Record<string, ${additionalType}>`;
330
+ }
331
+ return "unknown";
332
+ }
333
+ function resolveSdkBaseUrl(override, servers) {
334
+ if (override) return override;
335
+ for (const server of servers) try {
336
+ const url = new URL(server);
337
+ if (url.protocol === "http:" || url.protocol === "https:") return url.href.replace(/\/$/, "");
338
+ } catch {}
339
+ return "";
340
+ }
341
+ function resolveOutputPath(rootDir, output) {
342
+ const outputPath = path.resolve(rootDir, output);
343
+ if (!isPathInside(rootDir, outputPath)) throw new Error("OpenAPI SDK output must be a file inside the project root.");
344
+ let existingAncestor = outputPath;
345
+ while (!existsSync(existingAncestor)) {
346
+ const parent = path.dirname(existingAncestor);
347
+ if (parent === existingAncestor) break;
348
+ existingAncestor = parent;
349
+ }
350
+ if (!isPathInside(realpathSync(rootDir), realpathSync(existingAncestor), true)) throw new Error("OpenAPI SDK output must not escape the project root through a symlink.");
351
+ return outputPath;
352
+ }
353
+ function isPathInside(rootDir, candidate, allowRoot = false) {
354
+ const relative = path.relative(rootDir, candidate);
355
+ return (allowRoot || relative.length > 0) && relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
356
+ }
357
+ function normalizeTypeName(value) {
358
+ const normalized = (value.match(/[A-Za-z0-9]+/g) ?? []).map((part) => `${part[0]?.toUpperCase() ?? ""}${part.slice(1)}`).join("") || "ApiClient";
359
+ return /^\d/.test(normalized) ? `_${normalized}` : normalized;
360
+ }
361
+ function normalizeMethodName(value) {
362
+ const typeName = normalizeTypeName(value);
363
+ const methodName = `${typeName[0]?.toLowerCase() ?? "a"}${typeName.slice(1)}`;
364
+ return RESERVED_METHOD_NAMES.has(methodName) ? `${methodName}Operation` : methodName;
365
+ }
366
+ function claimName(base, used) {
367
+ let candidate = base;
368
+ let suffix = 2;
369
+ while (used.has(candidate)) {
370
+ candidate = `${base}${suffix}`;
371
+ suffix += 1;
372
+ }
373
+ used.add(candidate);
374
+ return candidate;
375
+ }
376
+ function normalizeSchemaTypes(value) {
377
+ if (typeof value === "string") return [value];
378
+ return Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
379
+ }
380
+ function schemaArray(value) {
381
+ return Array.isArray(value) ? value : [];
382
+ }
383
+ function stringArray(value) {
384
+ return Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
385
+ }
386
+ function literalType(value) {
387
+ return typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null ? JSON.stringify(value) : "unknown";
388
+ }
389
+ function parenthesize(value) {
390
+ return value.includes(" | ") || value.includes(" & ") ? `(${value})` : value;
391
+ }
392
+ function asRecord(value) {
393
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
394
+ }
395
+ function resolvePointer(document, pointer) {
396
+ let current = document;
397
+ for (const token of pointer.slice(1).split("/")) {
398
+ const record = asRecord(current);
399
+ if (!record) return void 0;
400
+ current = record[token.replaceAll("~1", "/").replaceAll("~0", "~")];
401
+ }
402
+ return current;
403
+ }
404
+ function escapeJsonPointer(value) {
405
+ return value.replaceAll("~", "~0").replaceAll("/", "~1");
406
+ }
407
+ function normalizeRelativePath(value) {
408
+ return value.replaceAll(path.sep, "/");
409
+ }
410
+ function sanitizeLineComment(value) {
411
+ return value.replace(/[\r\n]+/g, " ");
412
+ }
413
+
414
+ //#endregion
415
+ export { parseOpenApiSdkArgs, printOpenApiSdkHelp, runOpenApiSdk };
@@ -0,0 +1,37 @@
1
+ import { d as loadApiReferenceOpenApiDocumentAsync } from "./api-reference-0XdEWya8.mjs";
2
+ import { existsSync } from "node:fs";
3
+ import path from "node:path";
4
+ import { pathToFileURL } from "node:url";
5
+
6
+ //#region src/cli/openapi-source.ts
7
+ async function loadOpenApiCliSource(source, options = {}) {
8
+ const rootDir = path.resolve(options.rootDir ?? process.cwd());
9
+ const localPath = path.isAbsolute(source) ? source : path.resolve(rootDir, source);
10
+ return loadApiReferenceOpenApiDocumentAsync({
11
+ entry: "docs",
12
+ apiReference: {
13
+ enabled: true,
14
+ specUrl: existsSync(localPath) && path.isAbsolute(source) ? pathToFileURL(localPath).href : source
15
+ }
16
+ }, {
17
+ framework: "next",
18
+ rootDir,
19
+ baseUrl: options.baseUrl
20
+ });
21
+ }
22
+ function displayOpenApiCliSource(source) {
23
+ if (!/^https?:/i.test(source)) return source;
24
+ try {
25
+ const url = new URL(source);
26
+ url.username = url.username ? "redacted" : "";
27
+ url.password = url.password ? "redacted" : "";
28
+ url.search = "";
29
+ url.hash = "";
30
+ return url.href;
31
+ } catch {
32
+ return "remote OpenAPI source";
33
+ }
34
+ }
35
+
36
+ //#endregion
37
+ export { loadOpenApiCliSource as n, displayOpenApiCliSource as t };
@@ -1,4 +1,4 @@
1
- import { i as detectPackageManagerFromProject, l as formatPackageManagerDetection, t as detectFramework, u as installCommand } from "./utils-Cc1SrVza.mjs";
1
+ import { i as detectPackageManagerFromProject, l as formatPackageManagerDetection, t as detectFramework, u as installCommand } from "./utils-c9arebCi.mjs";
2
2
  import pc from "picocolors";
3
3
  import * as p from "@clack/prompts";
4
4
 
@@ -1,7 +1,7 @@
1
- import { Un as DEFAULT_MCP_WELL_KNOWN_ROUTE, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, f as DEFAULT_DOCS_CONFIG_ROUTE, h as DEFAULT_LLMS_FULL_TXT_ROUTE, i as DEFAULT_AGENT_FEEDBACK_ROUTE, jt as DEFAULT_SITEMAP_XML_ROUTE, kt as DEFAULT_SITEMAP_MD_ROUTE, m as DEFAULT_DOCS_DIAGNOSTICS_ROUTE, t as DEFAULT_AGENTS_MD_ROUTE, v as DEFAULT_LLMS_TXT_ROUTE, x as DEFAULT_SKILL_MD_ROUTE } from "./agent-5jyEosML.mjs";
1
+ import { At as DEFAULT_SITEMAP_MD_ROUTE, Mt as DEFAULT_SITEMAP_XML_ROUTE, Wn as DEFAULT_MCP_WELL_KNOWN_ROUTE, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, f as DEFAULT_DOCS_CONFIG_ROUTE, h as DEFAULT_LLMS_FULL_TXT_ROUTE, i as DEFAULT_AGENT_FEEDBACK_ROUTE, m as DEFAULT_DOCS_DIAGNOSTICS_ROUTE, t as DEFAULT_AGENTS_MD_ROUTE, v as DEFAULT_LLMS_TXT_ROUTE, x as DEFAULT_SKILL_MD_ROUTE } from "./agent-CEZCaYto.mjs";
2
2
  import { C as DOCS_AGENT_MANIFEST_SCHEMA_MEDIA_TYPE, S as DOCS_AGENT_MANIFEST_FORMAT, T as DOCS_AGENT_MANIFEST_VERSION, f as DEFAULT_AGENT_SKILLS_ROUTE_PREFIX, n as API_CATALOG_MEDIA_TYPE, r as API_CATALOG_PROFILE_URI, t as AGENT_SKILLS_DISCOVERY_SCHEMA_URI, u as DEFAULT_AGENT_SKILLS_INDEX_ROUTE, v as DEFAULT_API_CATALOG_ROUTE, w as DOCS_AGENT_MANIFEST_SCHEMA_URI } from "./standards-discovery-Bpz90VYq.mjs";
3
3
  import { isDocsAgentSkillName, validateDocsAgentSkillFrontmatter } from "./agent-skills-spec.mjs";
4
- import { n as DEFAULT_ROBOTS_TXT_ROUTE } from "./robots-Bne9ODlC.mjs";
4
+ import { n as DEFAULT_ROBOTS_TXT_ROUTE } from "./robots-BPYWIGqD.mjs";
5
5
  import matter from "gray-matter";
6
6
 
7
7
  //#region src/define-docs.ts
@@ -1,5 +1,5 @@
1
- import { $ as DocsAgentGoldenExpectedExample, Ft as DocsCodeBlocksPlannerProvider, J as DocsAgentFeedbackData, Rr as OpenDocsProvider, Rt as DocsCodeBlocksValidateConfig, Vr as OpenDocsTarget, W as DocsAgentEvaluationSurface, Z as DocsAgentGoldenCoverageApplicability, ai as ResolvedDocsRelatedLink, at as DocsAgentGoldenTask, nt as DocsAgentGoldenQueryVariant, ot as DocsAgentGoldenTaskExpectation, qn as DocsSearchConfig, st as DocsAgentGoldenTaskFilters, vr as DocsSitemapConfig, z as DocsAgentEvaluationAnswerProvider } from "./types-BkAk6B2d.mjs";
2
- import { R as DocsDiscoveryApiRouteOptions } from "./standards-discovery-CjyUCxdy.mjs";
1
+ import { B as DocsAgentEvaluationAnswerProvider, G as DocsAgentEvaluationSurface, Hr as OpenDocsTarget, It as DocsCodeBlocksPlannerProvider, Jn as DocsSearchConfig, Q as DocsAgentGoldenCoverageApplicability, Y as DocsAgentFeedbackData, ct as DocsAgentGoldenTaskFilters, et as DocsAgentGoldenExpectedExample, oi as ResolvedDocsRelatedLink, ot as DocsAgentGoldenTask, rt as DocsAgentGoldenQueryVariant, st as DocsAgentGoldenTaskExpectation, yr as DocsSitemapConfig, zr as OpenDocsProvider, zt as DocsCodeBlocksValidateConfig } from "./types-Dkl2DUfp.mjs";
2
+ import { R as DocsDiscoveryApiRouteOptions } from "./standards-discovery-C1RLKwV9.mjs";
3
3
  import { DocsMcpPage } from "./mcp.mjs";
4
4
 
5
5
  //#region src/agent-feedback-loop.d.ts
@@ -1,16 +1,16 @@
1
1
  import { _ as hasStructuredPageAgentContract, f as PAGE_AGENT_CONTRACT_FIELDS, g as getPageAgentFrontmatterIssues, v as normalizePageAgentFrontmatter } from "./markdown-sections-BKy4labo.mjs";
2
- import { A as buildDocsAgentDiscoverySpec, Cn as findDocsAudienceMdxIssues, Gn as getDocsMcpProtectedResourceMetadataRoutes, M as buildDocsConfigMap, T as DOCS_CONFIG_MAP_TOP_LEVEL_KEYS, mn as resolveAskAISearchRequestConfig } from "./agent-5jyEosML.mjs";
2
+ import { A as buildDocsAgentDiscoverySpec, Kn as getDocsMcpProtectedResourceMetadataRoutes, M as buildDocsConfigMap, T as DOCS_CONFIG_MAP_TOP_LEVEL_KEYS, hn as resolveAskAISearchRequestConfig, wn as findDocsAudienceMdxIssues } from "./agent-CEZCaYto.mjs";
3
3
  import { I as resolveDocsDiscoveryApiRoute, _ as DEFAULT_API_CATALOG_FORMAT, d as DEFAULT_AGENT_SKILLS_ROUTE_PATTERN, h as DEFAULT_AGENT_SKILL_FORMAT, l as DEFAULT_AGENT_SKILLS_INDEX_FORMAT, u as DEFAULT_AGENT_SKILLS_INDEX_ROUTE, v as DEFAULT_API_CATALOG_ROUTE } from "./standards-discovery-Bpz90VYq.mjs";
4
- import "./openapi-mcp-D8NVpTW1.mjs";
4
+ import "./openapi-mcp-UF4Cx885.mjs";
5
5
  import { a as resolveDocsMetadataBaseUrl } from "./metadata-7htr-Xj_.mjs";
6
- import "./agent-skills-server-Ddbf15pY.mjs";
7
- import { c as resolveDocsReviewConfig, o as ensureDocsReviewWorkflow, s as readDocsReviewConfigFromSource, t as runDocsGoldenTasks } from "./agent-evals-CnQC3W2a.mjs";
6
+ import "./agent-skills-server-Ddm90WL6.mjs";
7
+ import { c as resolveDocsReviewConfig, o as ensureDocsReviewWorkflow, s as readDocsReviewConfigFromSource, t as runDocsGoldenTasks } from "./agent-evals-CmeTjDMC.mjs";
8
8
  import { createFilesystemDocsMcpSource, getDocsConfigSchema, resolveDocsMcpConfig } from "./mcp.mjs";
9
- import "./code-blocks-D90CCJFs.mjs";
10
- import { _ as resolveDocsContentDir, g as resolveDocsConfigPath, h as readTopLevelStringProperty, s as loadDocsConfigModuleResultWithProjectEnv } from "./config-DrZ3fXgf.mjs";
11
- import { t as detectFramework } from "./utils-Cc1SrVza.mjs";
12
- import { a as extractAgentBlocks, i as createAgentUsefulnessPagesFromMcp, n as analyzeAgentSurfaceDrift, r as analyzeAgentUsefulness, t as resolveGoldenEvaluationInput } from "./golden-evaluations-D49vhw5u.mjs";
13
- import { t as analyzeConfiguredAgentSkillsProgressiveDisclosure } from "./agent-skills-progressive-disclosure-DL-q4JZo.mjs";
9
+ import "./code-blocks-GYdvS3BH.mjs";
10
+ import { _ as resolveDocsContentDir, g as resolveDocsConfigPath, h as readTopLevelStringProperty, s as loadDocsConfigModuleResultWithProjectEnv } from "./config-BnUOoj07.mjs";
11
+ import { t as detectFramework } from "./utils-c9arebCi.mjs";
12
+ import { a as extractAgentBlocks, i as createAgentUsefulnessPagesFromMcp, n as analyzeAgentSurfaceDrift, r as analyzeAgentUsefulness, t as resolveGoldenEvaluationInput } from "./golden-evaluations-B1QDOzYj.mjs";
13
+ import { t as analyzeConfiguredAgentSkillsProgressiveDisclosure } from "./agent-skills-progressive-disclosure-BDSjGGFd.mjs";
14
14
  import matter from "gray-matter";
15
15
  import { existsSync, lstatSync, readFileSync, readdirSync } from "node:fs";
16
16
  import path from "node:path";
@@ -1,4 +1,4 @@
1
- import { Lt as resolveDocsSitemapConfig, S as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, Un as DEFAULT_MCP_WELL_KNOWN_ROUTE, Vn as DEFAULT_MCP_PUBLIC_ROUTE, a as DEFAULT_AGENT_MD_ROUTE, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, g as DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, h as DEFAULT_LLMS_FULL_TXT_ROUTE, l as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, n as DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE, o as DEFAULT_AGENT_MD_WELL_KNOWN_ROUTE, t as DEFAULT_AGENTS_MD_ROUTE, tt as normalizeDocsPathSegment, v as DEFAULT_LLMS_TXT_ROUTE, x as DEFAULT_SKILL_MD_ROUTE, y as DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE } from "./agent-5jyEosML.mjs";
1
+ import { Hn as DEFAULT_MCP_PUBLIC_ROUTE, Rt as resolveDocsSitemapConfig, S as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, Wn as DEFAULT_MCP_WELL_KNOWN_ROUTE, a as DEFAULT_AGENT_MD_ROUTE, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, g as DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, h as DEFAULT_LLMS_FULL_TXT_ROUTE, l as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, n as DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE, o as DEFAULT_AGENT_MD_WELL_KNOWN_ROUTE, t as DEFAULT_AGENTS_MD_ROUTE, tt as normalizeDocsPathSegment, v as DEFAULT_LLMS_TXT_ROUTE, x as DEFAULT_SKILL_MD_ROUTE, y as DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE } from "./agent-CEZCaYto.mjs";
2
2
  import { a as DEFAULT_A2A_AGENT_CARD_ROUTE, b as DEFAULT_LEGACY_SKILLS_INDEX_ROUTE, f as DEFAULT_AGENT_SKILLS_ROUTE_PREFIX, u as DEFAULT_AGENT_SKILLS_INDEX_ROUTE, v as DEFAULT_API_CATALOG_ROUTE, x as DEFAULT_LEGACY_SKILLS_ROUTE_PREFIX } from "./standards-discovery-Bpz90VYq.mjs";
3
3
 
4
4
  //#region src/robots.ts
@@ -1,9 +1,9 @@
1
1
  import "./markdown-sections-BKy4labo.mjs";
2
- import "./agent-5jyEosML.mjs";
2
+ import "./agent-CEZCaYto.mjs";
3
3
  import "./standards-discovery-Bpz90VYq.mjs";
4
- import { c as renderDocsRobotsGeneratedBlock, f as upsertDocsRobotsGeneratedBlock, i as DOCS_ROBOTS_GENERATED_BLOCK_START, r as DOCS_ROBOTS_GENERATED_BLOCK_END, u as resolveDocsRobotsConfig } from "./robots-Bne9ODlC.mjs";
5
- import { a as loadDocsConfigModule, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, m as readTopLevelBooleanProperty, p as readStringProperty, t as extractNestedObjectLiteral } from "./config-DrZ3fXgf.mjs";
6
- import { t as detectFramework } from "./utils-Cc1SrVza.mjs";
4
+ import { c as renderDocsRobotsGeneratedBlock, f as upsertDocsRobotsGeneratedBlock, i as DOCS_ROBOTS_GENERATED_BLOCK_START, r as DOCS_ROBOTS_GENERATED_BLOCK_END, u as resolveDocsRobotsConfig } from "./robots-BPYWIGqD.mjs";
5
+ import { a as loadDocsConfigModule, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, m as readTopLevelBooleanProperty, p as readStringProperty, t as extractNestedObjectLiteral } from "./config-BnUOoj07.mjs";
6
+ import { t as detectFramework } from "./utils-c9arebCi.mjs";
7
7
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
8
8
  import path from "node:path";
9
9
  import pc from "picocolors";
@@ -1,22 +1,28 @@
1
1
  import "./markdown-sections-BKy4labo.mjs";
2
- import { rn as createAlgoliaSearchAdapter, sn as createTypesenseSearchAdapter, tn as buildDocsSearchDocuments } from "./agent-5jyEosML.mjs";
2
+ import { cn as createTypesenseSearchAdapter, in as createAlgoliaSearchAdapter, nn as buildDocsSearchDocuments } from "./agent-CEZCaYto.mjs";
3
3
  import "./standards-discovery-Bpz90VYq.mjs";
4
- import "./openapi-mcp-D8NVpTW1.mjs";
4
+ import "./openapi-mcp-UF4Cx885.mjs";
5
5
  import { t as resolveDocsI18n } from "./i18n-B1gJ9EW0.mjs";
6
6
  import { a as resolveDocsMetadataBaseUrl } from "./metadata-7htr-Xj_.mjs";
7
- import "./sitemap-server-D3mFJkjE.mjs";
8
- import "./agent-skills-server-Ddbf15pY.mjs";
9
- import "./agent-evals-CnQC3W2a.mjs";
7
+ import "./sitemap-server-C4bpuoLi.mjs";
8
+ import { o as buildApiReferenceOperationPagesAsync } from "./api-reference-0XdEWya8.mjs";
9
+ import "./agent-skills-server-Ddm90WL6.mjs";
10
+ import "./agent-evals-CmeTjDMC.mjs";
10
11
  import { createFilesystemDocsMcpSource } from "./mcp.mjs";
11
- import "./authoring-mcp-BpwboE3k.mjs";
12
- import "./code-blocks-D90CCJFs.mjs";
12
+ import "./authoring-mcp-C35lj3cI.mjs";
13
+ import "./code-blocks-GYdvS3BH.mjs";
13
14
  import "./server.mjs";
14
- import { _ as resolveDocsContentDir, c as loadProjectEnv, g as resolveDocsConfigPath, h as readTopLevelStringProperty, s as loadDocsConfigModuleResultWithProjectEnv } from "./config-DrZ3fXgf.mjs";
15
+ import { _ as resolveDocsContentDir, c as loadProjectEnv, g as resolveDocsConfigPath, h as readTopLevelStringProperty, s as loadDocsConfigModuleResultWithProjectEnv } from "./config-BnUOoj07.mjs";
16
+ import { t as detectFramework } from "./utils-c9arebCi.mjs";
15
17
  import { readFileSync } from "node:fs";
16
18
  import path from "node:path";
17
19
  import pc from "picocolors";
18
20
 
19
21
  //#region src/cli/search.ts
22
+ function resolveApiReferenceFramework(rootDir) {
23
+ const framework = detectFramework(rootDir);
24
+ return framework === "nextjs" ? "next" : framework ?? void 0;
25
+ }
20
26
  function getEnvValue(loadedEnv, key) {
21
27
  return process.env[key] ?? loadedEnv[key];
22
28
  }
@@ -101,6 +107,12 @@ async function syncSearch(options = {}) {
101
107
  contentDir
102
108
  }];
103
109
  const contexts = [];
110
+ const apiReferenceFramework = resolveApiReferenceFramework(rootDir);
111
+ const apiOperationPages = configLoad.status === "evaluated" && apiReferenceFramework ? await buildApiReferenceOperationPagesAsync(configLoad.config, {
112
+ framework: apiReferenceFramework,
113
+ rootDir,
114
+ baseUrl: canonicalBaseUrl
115
+ }) : [];
104
116
  for (const localized of localizedSources) {
105
117
  const source = createFilesystemDocsMcpSource({
106
118
  rootDir,
@@ -110,11 +122,15 @@ async function syncSearch(options = {}) {
110
122
  baseUrl: canonicalBaseUrl
111
123
  });
112
124
  const scannedPages = await source.getPages();
113
- if (scannedPages.length === 0) continue;
114
- const pages = localized.locale ? scannedPages.map((page) => ({
125
+ const projectedApiPages = localized.locale ? apiOperationPages.map((page) => ({
126
+ ...page,
127
+ locale: localized.locale
128
+ })) : apiOperationPages;
129
+ const pages = [...localized.locale ? scannedPages.map((page) => ({
115
130
  ...page,
116
131
  locale: localized.locale
117
- })) : scannedPages;
132
+ })) : scannedPages, ...projectedApiPages];
133
+ if (pages.length === 0) continue;
118
134
  contexts.push({
119
135
  pages,
120
136
  documents: buildDocsSearchDocuments(pages),