@farming-labs/docs 0.2.23 → 0.2.25
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/{agent-B7T4gauS.mjs → agent-DEr3FFdg.mjs} +300 -3
- package/dist/{agent-DpKOO7Ho.mjs → agent-DKYjtXUZ.mjs} +7 -6
- package/dist/{agents-Bhloif3y.mjs → agents-Cnc3dd_j.mjs} +5 -4
- package/dist/cli/index.mjs +27 -27
- package/dist/{cloud-DLc03Z41.mjs → cloud-B_bpA0Mh.mjs} +3 -3
- package/dist/{codeblocks-BnwZNsYO.mjs → codeblocks-CeKTPJGF.mjs} +3 -3
- package/dist/{dev-C5rHIIpC.mjs → dev-DxVevOP_.mjs} +3 -10
- package/dist/{doctor-kYJcYbcT.mjs → doctor-Dv15wAz6.mjs} +8 -8
- package/dist/{downgrade-D45M-NvV.mjs → downgrade-D7zavP20.mjs} +2 -2
- package/dist/index.d.mts +34 -3
- package/dist/index.mjs +5 -7
- package/dist/{init-D-Ki2dWn.mjs → init-CRS-LZdr.mjs} +6 -5
- package/dist/{mcp-Dvy_EkRx.mjs → mcp-ghAWpNPY.mjs} +4 -2
- package/dist/mcp.d.mts +3 -1
- package/dist/mcp.mjs +61 -2
- package/dist/{package-version-DMFdOnyC.mjs → package-version-CeNAB4NZ.mjs} +4 -4
- package/dist/{reading-time-DzuY0IRX.mjs → reading-time-CPAy1SWO.mjs} +1 -0
- package/dist/{review-DI_Ht3VO.mjs → review-Bnd4NH9y.mjs} +2 -2
- package/dist/{robots-CDdD2o-Q.mjs → robots-BcP7nSfi.mjs} +1 -2
- package/dist/{robots-DHQosx37.mjs → robots-BzO2bi0d.mjs} +4 -4
- package/dist/{search-BXupn-c-.mjs → search-BSqo7ypB.mjs} +4 -3
- package/dist/{search-D-iBv3VC.d.mts → search-CLP7-Z9w.d.mts} +1 -1
- package/dist/{search-B3JYx2zk.mjs → search-CdUxMazn.mjs} +268 -8
- package/dist/server.d.mts +2 -2
- package/dist/server.mjs +4 -4
- package/dist/{sitemap-BfViRvLP.mjs → sitemap-BSv5EDeM.mjs} +5 -4
- package/dist/{sitemap-server-CVSQQszk.mjs → sitemap-server-RZG9eOJB.mjs} +1 -1
- package/dist/{types-BCEobEGw.d.mts → types-CtF_65E4.d.mts} +69 -1
- package/dist/{upgrade-C1nInojy.mjs → upgrade-Dzej61y4.mjs} +2 -2
- package/dist/{utils-CGlOADu1.mjs → utils-CoHZJ1i4.mjs} +72 -6
- package/package.json +1 -1
- package/dist/related-BNj_NdHq.mjs +0 -50
- package/dist/sitemap-CMNj0Pt3.mjs +0 -252
- /package/dist/{config-rHQQuz98.mjs → config-De5z-2LK.mjs} +0 -0
- /package/dist/{errors-DqlZftq3.mjs → errors-Dw5gMhEZ.mjs} +0 -0
- /package/dist/{review-B7goPYUb.mjs → review-CJD85JTm.mjs} +0 -0
- /package/dist/{templates-CMcXQ0Gk.mjs → templates-BOoV0cIR.mjs} +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { $ as resolveDocsAgentsFormat, B as isDocsSkillRequest, F as isDocsAgentDiscoveryRequest, I as isDocsAgentsRequest, X as resolveDocsAgentFeedbackConfig, Z as resolveDocsAgentFeedbackRequest, at as resolveDocsMarkdownRequest, st as resolveDocsSkillFormat, tt as resolveDocsLlmsTxtRequest } from "./agent-DEr3FFdg.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/cloud-analytics.ts
|
|
2
4
|
const DEFAULT_DOCS_CLOUD_ANALYTICS_ENDPOINT = "https://api.farming-labs.dev/v1/analytics/events";
|
|
3
5
|
function normalizeRuntimeEnvValue(value) {
|
|
4
6
|
const normalized = value?.trim();
|
|
5
7
|
return normalized ? normalized : void 0;
|
|
6
8
|
}
|
|
7
|
-
function readRuntimeEnv(name) {
|
|
9
|
+
function readRuntimeEnv$1(name) {
|
|
8
10
|
if (typeof process === "undefined" || !process.env) return;
|
|
9
11
|
switch (name) {
|
|
10
12
|
case "NEXT_PUBLIC_DOCS_CLOUD_PROJECT_ID": return normalizeRuntimeEnvValue(process.env.NEXT_PUBLIC_DOCS_CLOUD_PROJECT_ID);
|
|
@@ -18,17 +20,17 @@ function readRuntimeEnv(name) {
|
|
|
18
20
|
default: return;
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
|
-
function isFalsyEnv(value) {
|
|
23
|
+
function isFalsyEnv$1(value) {
|
|
22
24
|
if (!value) return false;
|
|
23
25
|
return /^(0|false|no|off)$/i.test(value);
|
|
24
26
|
}
|
|
25
27
|
function resolveDocsCloudAnalyticsOptions(analytics) {
|
|
26
28
|
if (analytics === false || analytics && typeof analytics === "object" && analytics.enabled === false) return null;
|
|
27
|
-
const projectId = readRuntimeEnv("NEXT_PUBLIC_DOCS_CLOUD_PROJECT_ID") ?? readRuntimeEnv("DOCS_CLOUD_PROJECT_ID");
|
|
28
|
-
const apiKey = readRuntimeEnv("NEXT_PUBLIC_DOCS_CLOUD_ANALYTICS_KEY") ?? readRuntimeEnv("DOCS_CLOUD_ANALYTICS_KEY");
|
|
29
|
-
const enabled = readRuntimeEnv("NEXT_PUBLIC_DOCS_CLOUD_ANALYTICS_ENABLED") ?? readRuntimeEnv("DOCS_CLOUD_ANALYTICS_ENABLED");
|
|
30
|
-
const endpoint = readRuntimeEnv("NEXT_PUBLIC_DOCS_CLOUD_ANALYTICS_ENDPOINT") ?? readRuntimeEnv("DOCS_CLOUD_ANALYTICS_ENDPOINT") ?? DEFAULT_DOCS_CLOUD_ANALYTICS_ENDPOINT;
|
|
31
|
-
if (isFalsyEnv(enabled)) return null;
|
|
29
|
+
const projectId = readRuntimeEnv$1("NEXT_PUBLIC_DOCS_CLOUD_PROJECT_ID") ?? readRuntimeEnv$1("DOCS_CLOUD_PROJECT_ID");
|
|
30
|
+
const apiKey = readRuntimeEnv$1("NEXT_PUBLIC_DOCS_CLOUD_ANALYTICS_KEY") ?? readRuntimeEnv$1("DOCS_CLOUD_ANALYTICS_KEY");
|
|
31
|
+
const enabled = readRuntimeEnv$1("NEXT_PUBLIC_DOCS_CLOUD_ANALYTICS_ENABLED") ?? readRuntimeEnv$1("DOCS_CLOUD_ANALYTICS_ENABLED");
|
|
32
|
+
const endpoint = readRuntimeEnv$1("NEXT_PUBLIC_DOCS_CLOUD_ANALYTICS_ENDPOINT") ?? readRuntimeEnv$1("DOCS_CLOUD_ANALYTICS_ENDPOINT") ?? DEFAULT_DOCS_CLOUD_ANALYTICS_ENDPOINT;
|
|
33
|
+
if (isFalsyEnv$1(enabled)) return null;
|
|
32
34
|
if (!projectId) return null;
|
|
33
35
|
return {
|
|
34
36
|
endpoint,
|
|
@@ -297,6 +299,264 @@ async function emitDocsAgentTraceEvent(observability, event) {
|
|
|
297
299
|
});
|
|
298
300
|
}
|
|
299
301
|
|
|
302
|
+
//#endregion
|
|
303
|
+
//#region src/telemetry.ts
|
|
304
|
+
const DOCS_PACKAGE_NAME = "@farming-labs/docs";
|
|
305
|
+
const DOCS_PACKAGE_VERSION = "0.2.24";
|
|
306
|
+
const DEFAULT_DOCS_TELEMETRY_ENDPOINT = "https://docs.farming-labs.dev/api/telemetry/events";
|
|
307
|
+
const PROJECT_TELEMETRY_CACHE_TTL_MS = 1440 * 60 * 1e3;
|
|
308
|
+
const PROJECT_TELEMETRY_CACHE_MAX_KEYS = 256;
|
|
309
|
+
function getRuntimeEnv() {
|
|
310
|
+
if (typeof process === "undefined" || !process.env) return;
|
|
311
|
+
return process.env;
|
|
312
|
+
}
|
|
313
|
+
function readRuntimeEnv(name) {
|
|
314
|
+
const value = getRuntimeEnv()?.[name]?.trim();
|
|
315
|
+
return value ? value : void 0;
|
|
316
|
+
}
|
|
317
|
+
function isTruthyEnv(value) {
|
|
318
|
+
return /^(1|true|yes|on)$/i.test(value ?? "");
|
|
319
|
+
}
|
|
320
|
+
function isFalsyEnv(value) {
|
|
321
|
+
return /^(0|false|no|off)$/i.test(value ?? "");
|
|
322
|
+
}
|
|
323
|
+
function isBrowserRuntime() {
|
|
324
|
+
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
325
|
+
}
|
|
326
|
+
function isProductionTelemetryRuntime() {
|
|
327
|
+
if (isBrowserRuntime()) return false;
|
|
328
|
+
const env = getRuntimeEnv();
|
|
329
|
+
if (!env) return true;
|
|
330
|
+
if (env.NODE_ENV === "test") return false;
|
|
331
|
+
if (env.VERCEL_ENV === "production") return true;
|
|
332
|
+
if (env.CONTEXT === "production" && isTruthyEnv(env.NETLIFY)) return true;
|
|
333
|
+
if (isTruthyEnv(env.CF_PAGES)) return true;
|
|
334
|
+
if (env.RENDER_SERVICE_ID || env.FLY_APP_NAME || env.RAILWAY_ENVIRONMENT) return true;
|
|
335
|
+
return env.NODE_ENV === "production";
|
|
336
|
+
}
|
|
337
|
+
function resolveDocsTelemetryConfig(telemetry) {
|
|
338
|
+
const envToggle = readRuntimeEnv("DOCS_TELEMETRY");
|
|
339
|
+
const envDisabled = readRuntimeEnv("DOCS_TELEMETRY_DISABLED");
|
|
340
|
+
if (isFalsyEnv(envToggle) || isTruthyEnv(envDisabled) || telemetry === false) return { enabled: false };
|
|
341
|
+
const objectConfig = telemetry && typeof telemetry === "object" ? telemetry : void 0;
|
|
342
|
+
if (objectConfig?.enabled === false) return { enabled: false };
|
|
343
|
+
return {
|
|
344
|
+
enabled: telemetry === true || objectConfig?.enabled === true || isTruthyEnv(envToggle) || isProductionTelemetryRuntime(),
|
|
345
|
+
endpoint: objectConfig?.endpoint?.trim() || readRuntimeEnv("DOCS_TELEMETRY_ENDPOINT") || DEFAULT_DOCS_TELEMETRY_ENDPOINT
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
function readRequestOrigin(request) {
|
|
349
|
+
if (!request?.url) return void 0;
|
|
350
|
+
try {
|
|
351
|
+
return new URL(request.url).origin;
|
|
352
|
+
} catch {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
function readDeploymentOrigin() {
|
|
357
|
+
const candidates = [
|
|
358
|
+
readRuntimeEnv("DOCS_SITE_URL"),
|
|
359
|
+
readRuntimeEnv("NEXT_PUBLIC_SITE_URL"),
|
|
360
|
+
readRuntimeEnv("SITE_URL"),
|
|
361
|
+
readRuntimeEnv("URL"),
|
|
362
|
+
readRuntimeEnv("CF_PAGES_URL"),
|
|
363
|
+
readRuntimeEnv("VERCEL_PROJECT_PRODUCTION_URL"),
|
|
364
|
+
readRuntimeEnv("VERCEL_URL"),
|
|
365
|
+
readRuntimeEnv("DEPLOY_PRIME_URL")
|
|
366
|
+
];
|
|
367
|
+
for (const candidate of candidates) {
|
|
368
|
+
if (!candidate) continue;
|
|
369
|
+
try {
|
|
370
|
+
const withProtocol = /^https?:\/\//i.test(candidate) ? candidate : `https://${candidate}`;
|
|
371
|
+
return new URL(withProtocol).origin;
|
|
372
|
+
} catch {}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function detectDeployment() {
|
|
376
|
+
const env = getRuntimeEnv();
|
|
377
|
+
if (!env) return void 0;
|
|
378
|
+
if (env.VERCEL || env.VERCEL_ENV) return {
|
|
379
|
+
provider: "vercel",
|
|
380
|
+
environment: env.VERCEL_ENV,
|
|
381
|
+
id: env.VERCEL_DEPLOYMENT_ID ?? env.VERCEL_GIT_COMMIT_SHA,
|
|
382
|
+
region: env.VERCEL_REGION
|
|
383
|
+
};
|
|
384
|
+
if (env.NETLIFY) return {
|
|
385
|
+
provider: "netlify",
|
|
386
|
+
environment: env.CONTEXT,
|
|
387
|
+
id: env.DEPLOY_ID ?? env.COMMIT_REF
|
|
388
|
+
};
|
|
389
|
+
if (env.CF_PAGES) return {
|
|
390
|
+
provider: "cloudflare-pages",
|
|
391
|
+
environment: env.CF_PAGES_BRANCH,
|
|
392
|
+
id: env.CF_PAGES_COMMIT_SHA
|
|
393
|
+
};
|
|
394
|
+
if (env.RENDER_SERVICE_ID) return {
|
|
395
|
+
provider: "render",
|
|
396
|
+
environment: env.RENDER_ENV,
|
|
397
|
+
id: env.RENDER_SERVICE_ID
|
|
398
|
+
};
|
|
399
|
+
if (env.FLY_APP_NAME) return {
|
|
400
|
+
provider: "fly",
|
|
401
|
+
environment: env.FLY_APP_NAME,
|
|
402
|
+
id: env.FLY_ALLOC_ID,
|
|
403
|
+
region: env.FLY_REGION
|
|
404
|
+
};
|
|
405
|
+
if (env.RAILWAY_ENVIRONMENT) return {
|
|
406
|
+
provider: "railway",
|
|
407
|
+
environment: env.RAILWAY_ENVIRONMENT,
|
|
408
|
+
id: env.RAILWAY_DEPLOYMENT_ID
|
|
409
|
+
};
|
|
410
|
+
return env.NODE_ENV === "production" ? { environment: "production" } : void 0;
|
|
411
|
+
}
|
|
412
|
+
function detectRuntime() {
|
|
413
|
+
if (typeof process !== "undefined" && process.versions?.node) return {
|
|
414
|
+
name: "node",
|
|
415
|
+
version: process.versions.node
|
|
416
|
+
};
|
|
417
|
+
if (typeof navigator !== "undefined" && navigator.userAgent) return { name: "web-standard" };
|
|
418
|
+
}
|
|
419
|
+
function isObjectConfigEnabled(value, defaultEnabled) {
|
|
420
|
+
if (value === false) return false;
|
|
421
|
+
if (value === true) return true;
|
|
422
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
423
|
+
const enabled = value.enabled;
|
|
424
|
+
return enabled === false ? false : defaultEnabled || enabled === true;
|
|
425
|
+
}
|
|
426
|
+
return defaultEnabled;
|
|
427
|
+
}
|
|
428
|
+
function hasObjectConfig(value) {
|
|
429
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
430
|
+
}
|
|
431
|
+
function getDocsTelemetryFeatures(config) {
|
|
432
|
+
const pageActions = config.pageActions;
|
|
433
|
+
const feedback = config.feedback;
|
|
434
|
+
return {
|
|
435
|
+
search: isObjectConfigEnabled(config.search, true),
|
|
436
|
+
ai: isObjectConfigEnabled(config.ai, false),
|
|
437
|
+
mcp: isObjectConfigEnabled(config.mcp, true),
|
|
438
|
+
llmsTxt: isObjectConfigEnabled(config.llmsTxt, true),
|
|
439
|
+
pageActions: hasObjectConfig(pageActions),
|
|
440
|
+
feedback: feedback === true || hasObjectConfig(feedback) && feedback.enabled !== false,
|
|
441
|
+
agentFeedback: feedback !== false && !(hasObjectConfig(feedback) && feedback.agent === false) && !(hasObjectConfig(feedback) && hasObjectConfig(feedback.agent) && feedback.agent.enabled === false),
|
|
442
|
+
sitemap: isObjectConfigEnabled(config.sitemap, true),
|
|
443
|
+
robots: isObjectConfigEnabled(config.robots, true),
|
|
444
|
+
apiReference: isObjectConfigEnabled(config.apiReference, false),
|
|
445
|
+
staticExport: config.staticExport === true,
|
|
446
|
+
changelog: isObjectConfigEnabled(config.changelog, false),
|
|
447
|
+
cloud: typeof config.cloud !== "undefined" && isObjectConfigEnabled(config.cloud, true),
|
|
448
|
+
review: isObjectConfigEnabled(config.review, true),
|
|
449
|
+
codeBlocksValidate: hasObjectConfig(config.codeBlocks) && Boolean(config.codeBlocks.validate)
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
function createDocsTelemetryEvent(config, input, context = {}) {
|
|
453
|
+
const siteOrigin = context.siteOrigin ?? input.site?.origin ?? readRequestOrigin(context.request) ?? readDeploymentOrigin();
|
|
454
|
+
const deployment = input.deployment ?? detectDeployment();
|
|
455
|
+
const properties = context.properties || input.properties ? {
|
|
456
|
+
...input.properties ?? {},
|
|
457
|
+
...context.properties ?? {}
|
|
458
|
+
} : void 0;
|
|
459
|
+
return {
|
|
460
|
+
...input,
|
|
461
|
+
timestamp: input.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
462
|
+
package: {
|
|
463
|
+
name: DOCS_PACKAGE_NAME,
|
|
464
|
+
version: DOCS_PACKAGE_VERSION,
|
|
465
|
+
...input.package
|
|
466
|
+
},
|
|
467
|
+
framework: input.framework ?? context.framework,
|
|
468
|
+
runtime: input.runtime ?? detectRuntime(),
|
|
469
|
+
site: siteOrigin ? { origin: siteOrigin } : input.site,
|
|
470
|
+
deployment,
|
|
471
|
+
features: input.features ?? getDocsTelemetryFeatures(config),
|
|
472
|
+
properties
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
function projectEventKey(event) {
|
|
476
|
+
return [
|
|
477
|
+
event.package.name,
|
|
478
|
+
event.package.version,
|
|
479
|
+
event.framework ?? "",
|
|
480
|
+
event.site?.origin ?? "",
|
|
481
|
+
event.deployment?.provider ?? "",
|
|
482
|
+
event.deployment?.environment ?? "",
|
|
483
|
+
event.deployment?.id ?? ""
|
|
484
|
+
].join("|");
|
|
485
|
+
}
|
|
486
|
+
function getSentProjectKeys() {
|
|
487
|
+
const globalValue = globalThis;
|
|
488
|
+
globalValue.__farmingLabsDocsTelemetryProjectKeys__ ??= /* @__PURE__ */ new Map();
|
|
489
|
+
return globalValue.__farmingLabsDocsTelemetryProjectKeys__;
|
|
490
|
+
}
|
|
491
|
+
function pruneSentProjectKeys(sent, now) {
|
|
492
|
+
for (const [key, expiresAt] of sent) if (expiresAt <= now) sent.delete(key);
|
|
493
|
+
while (sent.size >= PROJECT_TELEMETRY_CACHE_MAX_KEYS) {
|
|
494
|
+
const oldestKey = sent.keys().next().value;
|
|
495
|
+
if (!oldestKey) return;
|
|
496
|
+
sent.delete(oldestKey);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
async function emitDocsTelemetryEvent(telemetry, event) {
|
|
500
|
+
const resolved = resolveDocsTelemetryConfig(telemetry);
|
|
501
|
+
if (!resolved.enabled || !resolved.endpoint || typeof fetch !== "function") return;
|
|
502
|
+
try {
|
|
503
|
+
const ingestKey = readRuntimeEnv("DOCS_TELEMETRY_INGEST_KEY");
|
|
504
|
+
const headers = { "content-type": "application/json" };
|
|
505
|
+
if (ingestKey) headers["x-docs-telemetry-key"] = ingestKey;
|
|
506
|
+
await fetch(resolved.endpoint, {
|
|
507
|
+
method: "POST",
|
|
508
|
+
headers,
|
|
509
|
+
body: JSON.stringify({ event }),
|
|
510
|
+
keepalive: true
|
|
511
|
+
});
|
|
512
|
+
} catch {}
|
|
513
|
+
}
|
|
514
|
+
function emitDocsTelemetryProjectEvent(config, context = {}) {
|
|
515
|
+
const event = createDocsTelemetryEvent(config, { type: "project_detected" }, context);
|
|
516
|
+
const key = projectEventKey(event);
|
|
517
|
+
const sent = getSentProjectKeys();
|
|
518
|
+
const now = Date.now();
|
|
519
|
+
const expiresAt = sent.get(key);
|
|
520
|
+
if (expiresAt && expiresAt > now) return;
|
|
521
|
+
if (typeof expiresAt === "number") sent.delete(key);
|
|
522
|
+
pruneSentProjectKeys(sent, now);
|
|
523
|
+
sent.set(key, now + PROJECT_TELEMETRY_CACHE_TTL_MS);
|
|
524
|
+
emitDocsTelemetryEvent(config.telemetry, event);
|
|
525
|
+
}
|
|
526
|
+
function emitDocsTelemetryAgentSurfaceEvent(config, context) {
|
|
527
|
+
const event = createDocsTelemetryEvent(config, {
|
|
528
|
+
type: context.surface === "mcp" ? "mcp_request" : "agent_surface_used",
|
|
529
|
+
properties: { surface: context.surface }
|
|
530
|
+
}, context);
|
|
531
|
+
emitDocsTelemetryEvent(config.telemetry, event);
|
|
532
|
+
}
|
|
533
|
+
function emitDocsTelemetryMcpToolEvent(config, context) {
|
|
534
|
+
const event = createDocsTelemetryEvent(config, {
|
|
535
|
+
type: "mcp_tool_used",
|
|
536
|
+
properties: {
|
|
537
|
+
tool: context.tool,
|
|
538
|
+
locale: context.locale,
|
|
539
|
+
resultCount: context.resultCount
|
|
540
|
+
}
|
|
541
|
+
}, context);
|
|
542
|
+
emitDocsTelemetryEvent(config.telemetry, event);
|
|
543
|
+
}
|
|
544
|
+
function inferDocsTelemetryAgentSurface(request, options) {
|
|
545
|
+
const url = new URL(request.url);
|
|
546
|
+
const method = request.method.toUpperCase();
|
|
547
|
+
const feedbackRequest = resolveDocsAgentFeedbackRequest(url, resolveDocsAgentFeedbackConfig(options.feedback));
|
|
548
|
+
if ((method === "GET" || method === "HEAD") && isDocsAgentDiscoveryRequest(url)) return "agent_spec";
|
|
549
|
+
if ((method === "GET" || method === "HEAD") && feedbackRequest?.kind === "schema") return "agent_feedback_schema";
|
|
550
|
+
if (method === "POST" && feedbackRequest?.kind === "submit") return "agent_feedback_submit";
|
|
551
|
+
if (method === "GET" || method === "HEAD") {
|
|
552
|
+
if (isDocsAgentsRequest(url) || resolveDocsAgentsFormat(url) === "agents") return "agents";
|
|
553
|
+
if (isDocsSkillRequest(url) || resolveDocsSkillFormat(url) === "skill") return "skill";
|
|
554
|
+
if (resolveDocsMarkdownRequest(options.entry, url, request)) return "markdown";
|
|
555
|
+
if (resolveDocsLlmsTxtRequest(url, options.llmsTxt, options.entry)) return "llms";
|
|
556
|
+
}
|
|
557
|
+
if (method === "POST") return "ask_ai";
|
|
558
|
+
}
|
|
559
|
+
|
|
300
560
|
//#endregion
|
|
301
561
|
//#region src/sidebar.ts
|
|
302
562
|
function resolvePageSidebarFolderIndexBehavior(sidebar) {
|
|
@@ -1428,4 +1688,4 @@ function createCustomSearchAdapter(adapter) {
|
|
|
1428
1688
|
}
|
|
1429
1689
|
|
|
1430
1690
|
//#endregion
|
|
1431
|
-
export {
|
|
1691
|
+
export { resolveDocsTelemetryConfig as A, resolveSidebarFolderIndexBehaviorForPath as C, emitDocsTelemetryProjectEvent as D, emitDocsTelemetryMcpToolEvent as E, emitDocsAnalyticsEvent as F, emitDocsObservabilityEvent as I, getDocsRequestAnalyticsProperties as L, createDocsAgentTraceContext as M, createDocsAgentTraceId as N, getDocsTelemetryFeatures as O, emitDocsAgentTraceEvent as P, resolveDocsAnalyticsConfig as R, resolveSidebarFolderIndexBehavior as S, emitDocsTelemetryEvent as T, parseGeneratedAgentDocument as _, createMcpSearchAdapter as a, applySidebarFolderIndexBehavior as b, formatDocsAskAIPackageHints as c, resolveAskAISearchRequestConfig as d, resolveSearchRequestConfig as f, normalizeGeneratedAgentContent as g, hashGeneratedAgentContent as h, createCustomSearchAdapter as i, DOCS_AGENT_TRACE_EVENT_TYPES as j, inferDocsTelemetryAgentSurface as k, inferDocsAskAIPackageHints as l, GENERATED_AGENT_PROVENANCE_VERSION as m, buildDocsSearchDocuments as n, createSimpleSearchAdapter as o, GENERATED_AGENT_PROVENANCE_MARKER as p, createAlgoliaSearchAdapter as r, createTypesenseSearchAdapter as s, buildDocsAskAIContext as t, performDocsSearch as u, serializeGeneratedAgentDocument as v, emitDocsTelemetryAgentSurfaceEvent as w, resolvePageSidebarFolderIndexBehavior as x, stripGeneratedAgentProvenance as y, resolveDocsObservabilityConfig as z };
|
package/dist/server.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as DocsObservabilityEvent, A as DocsAskAIMcpConfig, D as DocsAskAIFeedbackData, E as DocsAskAIFeedbackConfig, O as DocsAskAIFeedbackMessage, Q as DocsObservabilityConfig, W as DocsConfig, _ as DocsAgentTraceStatus, _t as DocsSearchQuery, a as ApiReferenceRenderer, at as DocsReviewRulesConfig, b as DocsAnalyticsEventInput, bt as DocsSearchSourcePage, dt as DocsSearchAdapterContext, et as DocsObservabilityEventInput, ft as DocsSearchAdapterFactory, g as DocsAgentTraceEventType, h as DocsAgentTraceEventInput, ht as DocsSearchDocument, it as DocsReviewConfig,
|
|
2
|
-
import { $ as createDocsAgentTraceId, A as resolveDocsSitemapRequest, B as normalizePromptProviderName, C as buildDocsSitemapManifest, D as renderDocsSitemapXml, E as renderDocsSitemapMarkdown, F as DEFAULT_PROMPT_PROVIDER_TEMPLATES, G as serializeDocsIconRegistry, H as resolvePromptProviderChoices, I as PromptAction, J as DOCS_AGENT_TRACE_EVENT_TYPES, K as serializeOpenDocsProvider, L as PromptProviderChoice, M as DEFAULT_OPEN_DOCS_PROMPT, N as DEFAULT_OPEN_DOCS_PROVIDER_IDS, O as resolveDocsSitemapConfig, P as DEFAULT_OPEN_DOCS_TARGET, Q as createDocsAgentTraceContext, R as SerializeOpenDocsProviderOptions, S as DocsSitemapResolvedConfig, T as readDocsSitemapManifestFromContentMap, U as sanitizePromptText, V as parsePromptStringArray, W as serializeDocsIcon, X as ResolvedDocsAnalyticsConfig, Y as DocsAgentTraceContext, Z as ResolvedDocsObservabilityConfig, _ as DEFAULT_SITEMAP_XML_ROUTE, a as createMcpSearchAdapter, at as resolveDocsObservabilityConfig, b as DocsSitemapManifestPage, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, et as emitDocsAgentTraceEvent, f as resolveSearchRequestConfig, g as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, h as DEFAULT_SITEMAP_MD_ROUTE, i as createCustomSearchAdapter, it as resolveDocsAnalyticsConfig, j as toDocsSitemapMarkdownUrl, k as resolveDocsSitemapPageLastmod, l as inferDocsAskAIPackageHints, m as DEFAULT_SITEMAP_MD_DOCS_ROUTE, n as buildDocsSearchDocuments, nt as emitDocsObservabilityEvent, o as createSimpleSearchAdapter, p as DEFAULT_SITEMAP_MANIFEST_PATH, q as serializeOpenDocsProviders, r as createAlgoliaSearchAdapter, rt as getDocsRequestAnalyticsProperties, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, tt as emitDocsAnalyticsEvent, u as performDocsSearch, v as DocsSitemapFormat, w as createDocsSitemapResponse, x as DocsSitemapPageInput, y as DocsSitemapManifest, z as SerializedOpenDocsProvider } from "./search-
|
|
1
|
+
import { $ as DocsObservabilityEvent, A as DocsAskAIMcpConfig, D as DocsAskAIFeedbackData, E as DocsAskAIFeedbackConfig, O as DocsAskAIFeedbackMessage, Q as DocsObservabilityConfig, Rt as McpDocsSearchConfig, W as DocsConfig, _ as DocsAgentTraceStatus, _t as DocsSearchQuery, a as ApiReferenceRenderer, at as DocsReviewRulesConfig, b as DocsAnalyticsEventInput, bt as DocsSearchSourcePage, dt as DocsSearchAdapterContext, et as DocsObservabilityEventInput, ft as DocsSearchAdapterFactory, g as DocsAgentTraceEventType, h as DocsAgentTraceEventInput, ht as DocsSearchDocument, it as DocsReviewConfig, k as DocsAskAIFeedbackValue, mt as DocsSearchConfig, rt as DocsReviewCiMode, ut as DocsSearchAdapter, v as DocsAnalyticsConfig, vt as DocsSearchResult, xt as DocsSitemapConfig, y as DocsAnalyticsEvent } from "./types-CtF_65E4.mjs";
|
|
2
|
+
import { $ as createDocsAgentTraceId, A as resolveDocsSitemapRequest, B as normalizePromptProviderName, C as buildDocsSitemapManifest, D as renderDocsSitemapXml, E as renderDocsSitemapMarkdown, F as DEFAULT_PROMPT_PROVIDER_TEMPLATES, G as serializeDocsIconRegistry, H as resolvePromptProviderChoices, I as PromptAction, J as DOCS_AGENT_TRACE_EVENT_TYPES, K as serializeOpenDocsProvider, L as PromptProviderChoice, M as DEFAULT_OPEN_DOCS_PROMPT, N as DEFAULT_OPEN_DOCS_PROVIDER_IDS, O as resolveDocsSitemapConfig, P as DEFAULT_OPEN_DOCS_TARGET, Q as createDocsAgentTraceContext, R as SerializeOpenDocsProviderOptions, S as DocsSitemapResolvedConfig, T as readDocsSitemapManifestFromContentMap, U as sanitizePromptText, V as parsePromptStringArray, W as serializeDocsIcon, X as ResolvedDocsAnalyticsConfig, Y as DocsAgentTraceContext, Z as ResolvedDocsObservabilityConfig, _ as DEFAULT_SITEMAP_XML_ROUTE, a as createMcpSearchAdapter, at as resolveDocsObservabilityConfig, b as DocsSitemapManifestPage, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, et as emitDocsAgentTraceEvent, f as resolveSearchRequestConfig, g as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, h as DEFAULT_SITEMAP_MD_ROUTE, i as createCustomSearchAdapter, it as resolveDocsAnalyticsConfig, j as toDocsSitemapMarkdownUrl, k as resolveDocsSitemapPageLastmod, l as inferDocsAskAIPackageHints, m as DEFAULT_SITEMAP_MD_DOCS_ROUTE, n as buildDocsSearchDocuments, nt as emitDocsObservabilityEvent, o as createSimpleSearchAdapter, p as DEFAULT_SITEMAP_MANIFEST_PATH, q as serializeOpenDocsProviders, r as createAlgoliaSearchAdapter, rt as getDocsRequestAnalyticsProperties, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, tt as emitDocsAnalyticsEvent, u as performDocsSearch, v as DocsSitemapFormat, w as createDocsSitemapResponse, x as DocsSitemapPageInput, y as DocsSitemapManifest, z as SerializedOpenDocsProvider } from "./search-CLP7-Z9w.mjs";
|
|
3
3
|
import { DocsMcpCodeExample, DocsMcpConfigSchema, DocsMcpConfigSchemaOption, DocsMcpDocsList, DocsMcpDocsPageSummary, DocsMcpDocsSection, DocsMcpHttpHandlers, DocsMcpNavigationNode, DocsMcpNavigationTree, DocsMcpPage, DocsMcpResolvedConfig, DocsMcpSource, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/code-group-mdx.d.ts
|
package/dist/server.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
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-
|
|
4
|
-
import { a as ensureDocsReviewWorkflow, i as buildDocsReviewWorkflowPathFilters, n as DEFAULT_DOCS_REVIEW_WORKFLOW_PATH, o as readDocsReviewConfigFromSource, r as buildDocsReviewWorkflow, s as resolveDocsReviewConfig, t as DEFAULT_DOCS_REVIEW_SCORE_THRESHOLD } from "./review-
|
|
1
|
+
import { F as emitDocsAnalyticsEvent, I as emitDocsObservabilityEvent, L as getDocsRequestAnalyticsProperties, M as createDocsAgentTraceContext, N as createDocsAgentTraceId, P as emitDocsAgentTraceEvent, R as resolveDocsAnalyticsConfig, a as createMcpSearchAdapter, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, f as resolveSearchRequestConfig, i as createCustomSearchAdapter, j as DOCS_AGENT_TRACE_EVENT_TYPES, l as inferDocsAskAIPackageHints, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch, z as resolveDocsObservabilityConfig } from "./search-CdUxMazn.mjs";
|
|
2
|
+
import { Ct as resolveDocsSitemapRequest, St as resolveDocsSitemapPageLastmod, _t as createDocsSitemapResponse, bt as renderDocsSitemapXml, dt as DEFAULT_SITEMAP_MANIFEST_PATH, ft as DEFAULT_SITEMAP_MD_DOCS_ROUTE, gt as buildDocsSitemapManifest, ht as DEFAULT_SITEMAP_XML_ROUTE, mt as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, pt as DEFAULT_SITEMAP_MD_ROUTE, vt as readDocsSitemapManifestFromContentMap, wt as toDocsSitemapMarkdownUrl, xt as resolveDocsSitemapConfig, yt as renderDocsSitemapMarkdown } from "./agent-DEr3FFdg.mjs";
|
|
3
|
+
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-RZG9eOJB.mjs";
|
|
4
|
+
import { a as ensureDocsReviewWorkflow, i as buildDocsReviewWorkflowPathFilters, n as DEFAULT_DOCS_REVIEW_WORKFLOW_PATH, o as readDocsReviewConfigFromSource, r as buildDocsReviewWorkflow, s as resolveDocsReviewConfig, t as DEFAULT_DOCS_REVIEW_SCORE_THRESHOLD } from "./review-CJD85JTm.mjs";
|
|
5
5
|
import { createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
|
|
6
6
|
|
|
7
7
|
export { DEFAULT_API_REFERENCE_OPENAPI_ROUTE, 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, buildApiReferenceHtmlDocument, buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocument, buildApiReferenceOpenApiDocumentAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, buildDocsAskAIContext, buildDocsReviewWorkflow, buildDocsReviewWorkflowPathFilters, buildDocsSearchDocuments, buildDocsSitemapManifest, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsMcpHttpHandler, createDocsMcpServer, createDocsSitemapResponse, createFilesystemDocsMcpSource, createMcpSearchAdapter, createSimpleSearchAdapter, createTypesenseSearchAdapter, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsObservabilityEvent, ensureDocsReviewWorkflow, formatDocsAskAIPackageHints, getDocsRequestAnalyticsProperties, inferDocsAskAIPackageHints, isApiReferenceOpenApiRequest, normalizeDocsMcpRoute, normalizePromptProviderName, parsePromptStringArray, performDocsSearch, readDocsReviewConfigFromSource, readDocsSitemapManifest, readDocsSitemapManifestFromContentMap, remarkCodeGroup, renderDocsSitemapMarkdown, renderDocsSitemapXml, resolveApiReferenceConfig, resolveApiReferenceOpenApiDiscovery, resolveApiReferenceRenderer, resolveAskAISearchRequestConfig, resolveDocsAnalyticsConfig, resolveDocsMcpConfig, resolveDocsObservabilityConfig, resolveDocsReviewConfig, resolveDocsSitemapConfig, resolveDocsSitemapPageLastmod, resolveDocsSitemapRequest, resolvePromptProviderChoices, resolveSearchRequestConfig, runDocsMcpStdio, sanitizePromptText, serializeDocsIcon, serializeDocsIconRegistry, serializeOpenDocsProvider, serializeOpenDocsProviders, toDocsSitemapMarkdownUrl };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./
|
|
1
|
+
import "./search-CdUxMazn.mjs";
|
|
2
|
+
import { bt as renderDocsSitemapXml, gt as buildDocsSitemapManifest, xt as resolveDocsSitemapConfig, yt as renderDocsSitemapMarkdown } from "./agent-DEr3FFdg.mjs";
|
|
3
|
+
import "./sitemap-server-RZG9eOJB.mjs";
|
|
3
4
|
import { createFilesystemDocsMcpSource } from "./mcp.mjs";
|
|
4
5
|
import "./server.mjs";
|
|
5
|
-
import { c as readNavTitle, f as readTopLevelStringProperty, i as loadDocsConfigModule, m as resolveDocsContentDir, o as readBooleanProperty, p as resolveDocsConfigPath, t as extractNestedObjectLiteral, u as readStringProperty } from "./config-
|
|
6
|
-
import { t as detectFramework } from "./utils-
|
|
6
|
+
import { c as readNavTitle, f as readTopLevelStringProperty, i as loadDocsConfigModule, m as resolveDocsContentDir, o as readBooleanProperty, p as resolveDocsConfigPath, t as extractNestedObjectLiteral, u as readStringProperty } from "./config-De5z-2LK.mjs";
|
|
7
|
+
import { t as detectFramework } from "./utils-CoHZJ1i4.mjs";
|
|
7
8
|
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
8
9
|
import path from "node:path";
|
|
9
10
|
import pc from "picocolors";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { xt as resolveDocsSitemapConfig } from "./agent-DEr3FFdg.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";
|
|
@@ -767,6 +767,64 @@ interface DocsAnalyticsConfig {
|
|
|
767
767
|
/** Callback fired for every emitted event. */
|
|
768
768
|
onEvent?: (event: DocsAnalyticsEvent) => void | Promise<void>;
|
|
769
769
|
}
|
|
770
|
+
type DocsTelemetryFramework = "next" | "tanstack-start" | "sveltekit" | "astro" | "nuxt" | "mcp" | (string & {});
|
|
771
|
+
type DocsTelemetryEventType = "project_detected" | "agent_surface_used" | "mcp_request" | "mcp_tool_used" | (string & {});
|
|
772
|
+
type DocsTelemetryAgentSurface = "agent_spec" | "agents" | "skill" | "markdown" | "llms" | "agent_feedback_schema" | "agent_feedback_submit" | "ask_ai" | "mcp";
|
|
773
|
+
interface DocsTelemetryConfig {
|
|
774
|
+
/** Enable Farming Labs maintainer telemetry. Defaults to production-only enabled. */
|
|
775
|
+
enabled?: boolean;
|
|
776
|
+
/**
|
|
777
|
+
* Override the telemetry ingestion endpoint.
|
|
778
|
+
*
|
|
779
|
+
* This is mostly useful for self-hosting, development verification, or tests.
|
|
780
|
+
*/
|
|
781
|
+
endpoint?: string;
|
|
782
|
+
}
|
|
783
|
+
interface DocsTelemetryFeatures {
|
|
784
|
+
search: boolean;
|
|
785
|
+
ai: boolean;
|
|
786
|
+
mcp: boolean;
|
|
787
|
+
llmsTxt: boolean;
|
|
788
|
+
pageActions: boolean;
|
|
789
|
+
feedback: boolean;
|
|
790
|
+
agentFeedback: boolean;
|
|
791
|
+
sitemap: boolean;
|
|
792
|
+
robots: boolean;
|
|
793
|
+
apiReference: boolean;
|
|
794
|
+
staticExport: boolean;
|
|
795
|
+
changelog: boolean;
|
|
796
|
+
cloud: boolean;
|
|
797
|
+
review: boolean;
|
|
798
|
+
codeBlocksValidate: boolean;
|
|
799
|
+
}
|
|
800
|
+
interface DocsTelemetryEvent {
|
|
801
|
+
type: DocsTelemetryEventType;
|
|
802
|
+
timestamp: string;
|
|
803
|
+
package: {
|
|
804
|
+
name: "@farming-labs/docs";
|
|
805
|
+
version?: string;
|
|
806
|
+
};
|
|
807
|
+
framework?: DocsTelemetryFramework;
|
|
808
|
+
runtime?: {
|
|
809
|
+
name?: string;
|
|
810
|
+
version?: string;
|
|
811
|
+
};
|
|
812
|
+
site?: {
|
|
813
|
+
origin?: string;
|
|
814
|
+
};
|
|
815
|
+
deployment?: {
|
|
816
|
+
provider?: string;
|
|
817
|
+
environment?: string;
|
|
818
|
+
id?: string;
|
|
819
|
+
region?: string;
|
|
820
|
+
};
|
|
821
|
+
features?: Partial<DocsTelemetryFeatures>;
|
|
822
|
+
properties?: Record<string, unknown>;
|
|
823
|
+
}
|
|
824
|
+
type DocsTelemetryEventInput = Omit<DocsTelemetryEvent, "timestamp" | "package"> & {
|
|
825
|
+
timestamp?: string;
|
|
826
|
+
package?: Partial<DocsTelemetryEvent["package"]>;
|
|
827
|
+
};
|
|
770
828
|
interface DocsCloudApiKeyConfig {
|
|
771
829
|
/**
|
|
772
830
|
* Environment variable that stores the Docs Cloud API key.
|
|
@@ -2414,6 +2472,16 @@ interface DocsConfig {
|
|
|
2414
2472
|
* included unless `includeInputs: true` is set.
|
|
2415
2473
|
*/
|
|
2416
2474
|
analytics?: boolean | DocsAnalyticsConfig;
|
|
2475
|
+
/**
|
|
2476
|
+
* Farming Labs maintainer telemetry for production adoption and coarse
|
|
2477
|
+
* agent-optimized feature usage.
|
|
2478
|
+
*
|
|
2479
|
+
* This is separate from project-owned `analytics`. It avoids visitor
|
|
2480
|
+
* identities, page views, raw inputs, docs content, cookies, and per-user
|
|
2481
|
+
* sessions. Disable with `telemetry: false`, `DOCS_TELEMETRY=false`, or
|
|
2482
|
+
* `DOCS_TELEMETRY_DISABLED=1`.
|
|
2483
|
+
*/
|
|
2484
|
+
telemetry?: boolean | DocsTelemetryConfig;
|
|
2417
2485
|
/**
|
|
2418
2486
|
* Docs Cloud integration settings.
|
|
2419
2487
|
*
|
|
@@ -2866,4 +2934,4 @@ interface DocsConfig {
|
|
|
2866
2934
|
og?: OGConfig;
|
|
2867
2935
|
}
|
|
2868
2936
|
//#endregion
|
|
2869
|
-
export { DocsObservabilityEvent as $,
|
|
2937
|
+
export { DocsObservabilityEvent as $, ReadingTimeFormat as $t, DocsAskAIMcpConfig as A, FeedbackConfig as At, DocsCodeBlocksRunnerProvider as B, OpenDocsConfig as Bt, DocsAnalyticsSource as C, DocsTelemetryConfig as Ct, DocsAskAIFeedbackData as D, DocsTelemetryFeatures as Dt, DocsAskAIFeedbackConfig as E, DocsTelemetryEventType as Et, DocsCloudPublishConfig as F, LlmsTxtMaxCharsConfig as Ft, DocsFeedbackData as G, OpenGraphImage as Gt, DocsCodeBlocksValidationMode as H, OpenDocsProviderConfig as Ht, DocsCodeBlocksConfig as I, LlmsTxtMaxCharsMode as It, DocsMcpConfig as J, PageFrontmatter as Jt, DocsFeedbackValue as K, OrderingItem as Kt, DocsCodeBlocksPlannerConfig as L, LlmsTxtSectionConfig as Lt, DocsCloudConfig as M, GithubConfig as Mt, DocsCloudFeatureConfig as N, LastUpdatedConfig as Nt, DocsAskAIFeedbackMessage as O, DocsTelemetryFramework as Ot, DocsCloudPreviewConfig as P, LlmsTxtConfig as Pt, DocsObservabilityConfig as Q, ReadingTimeConfig as Qt, DocsCodeBlocksPlannerProvider as R, McpDocsSearchConfig as Rt, DocsAnalyticsInput as S, DocsTelemetryAgentSurface as St, DocsAskAIActionType as T, DocsTelemetryEventInput as Tt, DocsCodeBlocksValidationPolicy as U, OpenDocsProviderId as Ut, DocsCodeBlocksValidateConfig as V, OpenDocsProvider as Vt, DocsConfig as W, OpenDocsTarget as Wt, DocsMetadata as X, PageSidebarFrontmatter as Xt, DocsMcpToolsConfig as Y, PageOpenGraph as Yt, DocsNav as Z, PageTwitter as Zt, DocsAgentTraceStatus as _, DocsSearchQuery as _t, ApiReferenceRenderer as a, SidebarNode as an, DocsReviewRulesConfig as at, DocsAnalyticsEventInput as b, DocsSearchSourcePage as bt, ChangelogFrontmatter as c, SimpleDocsSearchConfig as cn, DocsRobotsConfig as ct, CopyMarkdownFormat as d, TypographyConfig as dn, DocsSearchAdapterContext as dt, ResolvedDocsRelatedLink as en, DocsObservabilityEventInput as et, CustomDocsSearchConfig as f, UIConfig as fn, DocsSearchAdapterFactory as ft, DocsAgentTraceEventType as g, DocsSearchEmbeddingsConfig as gt, DocsAgentTraceEventInput as h, DocsSearchDocument as ht, ApiReferenceConfig as i, SidebarFolderNode as in, DocsReviewConfig as it, DocsCloudApiKeyConfig as j, FontStyle as jt, DocsAskAIFeedbackValue as k, DocsTheme as kt, CodeBlockCopyData as l, ThemeToggleConfig as ln, DocsRobotsRule as lt, DocsAgentFeedbackData as m, DocsSearchConfig as mt, AgentFeedbackConfig as n, SidebarConfig as nn, DocsReviewCiConfig as nt, BreadcrumbConfig as o, SidebarPageNode as on, DocsReviewScoreConfig as ot, DocsAgentFeedbackContext as p, DocsSearchChunkingConfig as pt, DocsI18nConfig as q, PageActionsConfig as qt, AlgoliaDocsSearchConfig as r, SidebarFolderIndexBehavior as rn, DocsReviewCiMode as rt, ChangelogConfig as s, SidebarTree as sn, DocsReviewSeverity as st, AIConfig as t, SidebarComponentProps as tn, DocsRelatedItem as tt, CopyMarkdownConfig as u, TypesenseDocsSearchConfig as un, DocsSearchAdapter as ut, DocsAnalyticsConfig as v, DocsSearchResult as vt, DocsAskAIActionData as w, DocsTelemetryEvent as wt, DocsAnalyticsEventType as x, DocsSitemapConfig as xt, DocsAnalyticsEvent as y, DocsSearchResultType as yt, DocsCodeBlocksRunnerConfig as z, OGConfig as zt };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as fileExists, o as exec } from "./utils-
|
|
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-
|
|
1
|
+
import { c as fileExists, o as exec } from "./utils-CoHZJ1i4.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-CeNAB4NZ.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import pc from "picocolors";
|
|
5
5
|
import * as p from "@clack/prompts";
|
|
@@ -18,13 +18,79 @@ function detectFramework(cwd) {
|
|
|
18
18
|
if (allDeps["nuxt"]) return "nuxt";
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const PACKAGE_MANAGER_LOCKFILES = [
|
|
22
|
+
{
|
|
23
|
+
fileName: "pnpm-lock.yaml",
|
|
24
|
+
packageManager: "pnpm"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
fileName: "bun.lockb",
|
|
28
|
+
packageManager: "bun"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
fileName: "bun.lock",
|
|
32
|
+
packageManager: "bun"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
fileName: "yarn.lock",
|
|
36
|
+
packageManager: "yarn"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
fileName: "package-lock.json",
|
|
40
|
+
packageManager: "npm"
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
function readPackageManagerName(value) {
|
|
44
|
+
if (typeof value !== "string") return null;
|
|
45
|
+
const name = value.trim().split("@")[0];
|
|
46
|
+
if (name === "pnpm" || name === "yarn" || name === "npm" || name === "bun") return name;
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
function detectPackageManagerLockfileInDirectory(directory) {
|
|
50
|
+
for (const { fileName, packageManager } of PACKAGE_MANAGER_LOCKFILES) {
|
|
51
|
+
const filePath = path.join(directory, fileName);
|
|
52
|
+
if (fs.existsSync(filePath)) return {
|
|
53
|
+
packageManager,
|
|
54
|
+
directory,
|
|
55
|
+
filePath,
|
|
56
|
+
source: "lockfile"
|
|
57
|
+
};
|
|
58
|
+
}
|
|
26
59
|
return null;
|
|
27
60
|
}
|
|
61
|
+
function detectPackageManagerInDirectory(directory) {
|
|
62
|
+
const lockfile = detectPackageManagerLockfileInDirectory(directory);
|
|
63
|
+
if (lockfile) return lockfile;
|
|
64
|
+
const packageJsonPath = path.join(directory, "package.json");
|
|
65
|
+
if (!fs.existsSync(packageJsonPath)) return null;
|
|
66
|
+
try {
|
|
67
|
+
const packageManager = readPackageManagerName(JSON.parse(fs.readFileSync(packageJsonPath, "utf-8")).packageManager);
|
|
68
|
+
if (!packageManager) return null;
|
|
69
|
+
return {
|
|
70
|
+
packageManager,
|
|
71
|
+
directory,
|
|
72
|
+
filePath: packageJsonPath,
|
|
73
|
+
source: "packageManager"
|
|
74
|
+
};
|
|
75
|
+
} catch {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function detectPackageManagerFromProject(cwd) {
|
|
80
|
+
let current = path.resolve(cwd);
|
|
81
|
+
while (true) {
|
|
82
|
+
const detected = detectPackageManagerInDirectory(current);
|
|
83
|
+
if (detected) return detected;
|
|
84
|
+
const parent = path.dirname(current);
|
|
85
|
+
if (parent === current) return null;
|
|
86
|
+
current = parent;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function formatPackageManagerDetection(cwd, detection) {
|
|
90
|
+
const displayPath = path.relative(path.resolve(cwd), detection.filePath) || path.basename(detection.filePath);
|
|
91
|
+
if (detection.source === "packageManager") return `packageManager in ${displayPath}`;
|
|
92
|
+
return displayPath;
|
|
93
|
+
}
|
|
28
94
|
function installCommand(pm) {
|
|
29
95
|
return pm === "yarn" ? "yarn add" : `${pm} add`;
|
|
30
96
|
}
|
|
@@ -156,4 +222,4 @@ function spawnAndWaitFor(command, args, cwd, waitFor, timeoutMs = 6e4) {
|
|
|
156
222
|
}
|
|
157
223
|
|
|
158
224
|
//#endregion
|
|
159
|
-
export { devInstallCommand as a, fileExists as c,
|
|
225
|
+
export { devInstallCommand as a, fileExists as c, readFileSafe as d, spawnAndWaitFor as f, detectPackageManagerFromProject as i, formatPackageManagerDetection as l, detectGlobalCssFiles as n, exec as o, writeFileSafe as p, detectNextAppDir as r, execOutput as s, detectFramework as t, installCommand as u };
|
package/package.json
CHANGED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
//#region src/related.ts
|
|
2
|
-
function normalizeDocsRelated(value) {
|
|
3
|
-
if (!Array.isArray(value)) return [];
|
|
4
|
-
const seen = /* @__PURE__ */ new Set();
|
|
5
|
-
const links = [];
|
|
6
|
-
for (const item of value) {
|
|
7
|
-
const parsed = parseRelatedInput(item);
|
|
8
|
-
if (!parsed) continue;
|
|
9
|
-
const dedupeKey = normalizeRelatedLookupPath(parsed.href) ?? parsed.href;
|
|
10
|
-
if (seen.has(dedupeKey)) continue;
|
|
11
|
-
seen.add(dedupeKey);
|
|
12
|
-
links.push({ href: parsed.href });
|
|
13
|
-
}
|
|
14
|
-
return links;
|
|
15
|
-
}
|
|
16
|
-
function renderDocsRelatedMarkdownLines(related) {
|
|
17
|
-
if (!related?.length) return [];
|
|
18
|
-
return [`Related: ${related.map((link) => normalizeInlineText(link.href)).join(", ")}`];
|
|
19
|
-
}
|
|
20
|
-
function parseRelatedInput(value) {
|
|
21
|
-
if (typeof value === "string") {
|
|
22
|
-
const href = cleanString(value);
|
|
23
|
-
return href ? { href } : null;
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
function cleanString(value) {
|
|
28
|
-
if (typeof value !== "string") return void 0;
|
|
29
|
-
return value.trim() || void 0;
|
|
30
|
-
}
|
|
31
|
-
function normalizeRelatedLookupPath(value) {
|
|
32
|
-
const trimmed = value.trim();
|
|
33
|
-
if (!trimmed) return null;
|
|
34
|
-
let pathname = trimmed;
|
|
35
|
-
try {
|
|
36
|
-
pathname = new URL(trimmed, "https://docs.local").pathname;
|
|
37
|
-
} catch {
|
|
38
|
-
pathname = trimmed.split(/[?#]/, 1)[0] ?? trimmed;
|
|
39
|
-
}
|
|
40
|
-
pathname = pathname.replace(/\/+/g, "/").replace(/\.md$/i, "");
|
|
41
|
-
if (!pathname.startsWith("/")) pathname = `/${pathname}`;
|
|
42
|
-
if (pathname !== "/") pathname = pathname.replace(/\/+$/, "");
|
|
43
|
-
return pathname;
|
|
44
|
-
}
|
|
45
|
-
function normalizeInlineText(value) {
|
|
46
|
-
return value.replace(/\s+/g, " ").trim();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
//#endregion
|
|
50
|
-
export { renderDocsRelatedMarkdownLines as n, normalizeDocsRelated as t };
|