@farming-labs/theme 0.1.25 → 0.1.28
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.
- package/dist/docs-api.mjs +28 -1
- package/package.json +2 -2
package/dist/docs-api.mjs
CHANGED
|
@@ -149,12 +149,30 @@ function resolveAgentSpecRequest(url) {
|
|
|
149
149
|
if (url.searchParams.get("agent")?.trim() === "spec") return true;
|
|
150
150
|
return normalizeUrlPath(url.pathname) === DEFAULT_AGENT_SPEC_ROUTE;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function isSearchEnabled(search) {
|
|
153
|
+
if (search === false) return false;
|
|
154
|
+
if (search && typeof search === "object" && search.enabled === false) return false;
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
function buildAgentSpec({ origin, entry, i18n, search, mcp, feedback, llms }) {
|
|
153
158
|
const normalizedEntry = normalizePathSegment(entry) || "docs";
|
|
154
159
|
return {
|
|
155
160
|
version: "1",
|
|
156
161
|
name: "@farming-labs/docs",
|
|
157
162
|
baseUrl: origin,
|
|
163
|
+
site: {
|
|
164
|
+
title: llms.siteTitle ?? "Documentation",
|
|
165
|
+
description: llms.siteDescription,
|
|
166
|
+
entry: normalizedEntry,
|
|
167
|
+
baseUrl: llms.baseUrl ?? origin
|
|
168
|
+
},
|
|
169
|
+
locales: {
|
|
170
|
+
enabled: i18n !== null,
|
|
171
|
+
available: i18n?.locales ?? [],
|
|
172
|
+
default: i18n?.defaultLocale ?? null,
|
|
173
|
+
queryParam: "lang",
|
|
174
|
+
fallbackQueryParam: "locale"
|
|
175
|
+
},
|
|
158
176
|
api: {
|
|
159
177
|
docs: DEFAULT_DOCS_API_ROUTE,
|
|
160
178
|
agentSpec: DEFAULT_AGENT_SPEC_ROUTE,
|
|
@@ -176,6 +194,13 @@ function buildAgentSpec({ origin, entry, mcp, feedback, llms }) {
|
|
|
176
194
|
txt: `${DEFAULT_DOCS_API_ROUTE}?format=llms`,
|
|
177
195
|
full: `${DEFAULT_DOCS_API_ROUTE}?format=llms-full`
|
|
178
196
|
},
|
|
197
|
+
search: {
|
|
198
|
+
enabled: isSearchEnabled(search),
|
|
199
|
+
endpoint: `${DEFAULT_DOCS_API_ROUTE}?query={query}`,
|
|
200
|
+
method: "GET",
|
|
201
|
+
queryParam: "query",
|
|
202
|
+
localeParam: "lang"
|
|
203
|
+
},
|
|
179
204
|
skills: {
|
|
180
205
|
enabled: true,
|
|
181
206
|
registry: "skills.sh",
|
|
@@ -995,6 +1020,8 @@ function createDocsAPI(options) {
|
|
|
995
1020
|
if (resolveAgentSpecRequest(url)) return Response.json(buildAgentSpec({
|
|
996
1021
|
origin: url.origin,
|
|
997
1022
|
entry,
|
|
1023
|
+
i18n,
|
|
1024
|
+
search: searchConfig,
|
|
998
1025
|
mcp: mcpConfig,
|
|
999
1026
|
feedback: agentFeedbackConfig,
|
|
1000
1027
|
llms: llmsConfig
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/theme",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"description": "Theme package for @farming-labs/docs — layout, provider, MDX components, and styles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"tsdown": "^0.20.3",
|
|
134
134
|
"typescript": "^5.9.3",
|
|
135
135
|
"vitest": "^3.2.4",
|
|
136
|
-
"@farming-labs/docs": "0.1.
|
|
136
|
+
"@farming-labs/docs": "0.1.28"
|
|
137
137
|
},
|
|
138
138
|
"peerDependencies": {
|
|
139
139
|
"@farming-labs/docs": ">=0.0.1",
|