@farming-labs/docs 0.2.57 → 0.2.58
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-v6R0V3lm.mjs → agent-BFtIbSyJ.mjs} +2 -2
- package/dist/agent-evals-BW0vEc-F.mjs +2144 -0
- package/dist/{agent-export-CZR20g0e.mjs → agent-export-vsdq0Huq.mjs} +6 -6
- package/dist/{agents-BPonjolo.mjs → agents-ChKj-VYw.mjs} +6 -6
- package/dist/cli/index.mjs +29 -29
- package/dist/client/react.d.mts +1 -1
- package/dist/{cloud-C45jpBtp.mjs → cloud-BH_sHX64.mjs} +3 -3
- package/dist/{cloud-ask-ai-CvRVnwdK.d.mts → cloud-ask-ai-a5Juvlvh.d.mts} +1 -1
- package/dist/{code-blocks-C9awWzEQ.mjs → code-blocks-qe0T8-xe.mjs} +1 -1
- package/dist/{codeblocks-CSqgqbg-.mjs → codeblocks-Bq67u32v.mjs} +2 -2
- package/dist/{dev-BA2kRuCn.mjs → dev-CAQlbguk.mjs} +2 -2
- package/dist/docs-cloud-server.d.mts +2 -2
- package/dist/docs-cloud-server.mjs +1 -1
- package/dist/{doctor-svA9Flsx.mjs → doctor-H8gilyTg.mjs} +34 -31
- package/dist/{downgrade-BStNhyCc.mjs → downgrade-BZs86NVr.mjs} +2 -2
- package/dist/{agent-surface-drift-rGFS38Ak.mjs → golden-evaluations-BiUg5Xe_.mjs} +59 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -2
- package/dist/{init-Dm0yDz6v.mjs → init-B_9ENq8Z.mjs} +3 -3
- package/dist/{mcp-BYIgKsPn.mjs → mcp-CiNww-Wu.mjs} +5 -5
- package/dist/mcp.d.mts +1 -1
- package/dist/mcp.mjs +148 -6
- package/dist/metadata-3ljRN9MM.mjs +237 -0
- package/dist/{package-version-DRIc08EU.mjs → package-version-qik_4J6C.mjs} +1 -1
- package/dist/{reading-time-W_Id2ayC.mjs → reading-time-EaVom2cl.mjs} +2 -234
- package/dist/{review-DZ81wm7h.mjs → review-BEgX7ey7.mjs} +28 -27
- package/dist/{robots-mSc98PMp.mjs → robots-CFlsfYdA.mjs} +2 -2
- package/dist/{search-9uEaC23e.d.mts → search-BblemZl4.d.mts} +25 -3
- package/dist/{search-OHp36znm.mjs → search-Bo9ubPVO.mjs} +149 -38
- package/dist/{search-AMEoabYU.mjs → search-CoajN9X1.mjs} +5 -5
- package/dist/server.d.mts +107 -6
- package/dist/server.mjs +5 -5
- package/dist/{sitemap-Cyc0Bbbn.mjs → sitemap-D_aXWPdJ.mjs} +6 -6
- package/dist/{types-R-DN23yw.d.mts → types-C1nPRXqo.d.mts} +90 -6
- package/dist/{upgrade-CXYRNV0C.mjs → upgrade-BCJTCW3O.mjs} +2 -2
- package/package.json +1 -1
- package/dist/agent-evals-BD17jOqL.mjs +0 -1166
- /package/dist/{agent-scope-B8lptqCd.mjs → agent-scope-CCaIY1aK.mjs} +0 -0
- /package/dist/{cloud-ask-ai-1k0q6OAH.mjs → cloud-ask-ai-hnJfj8-X.mjs} +0 -0
- /package/dist/{config-DZbZiYEa.mjs → config-DASewQ0x.mjs} +0 -0
- /package/dist/{errors-BFUtdZfC.mjs → errors-CVqZ3kOO.mjs} +0 -0
- /package/dist/{sitemap-server-zFYctvCa.mjs → sitemap-server-BYwE0zXs.mjs} +0 -0
- /package/dist/{templates-1Cod8KrJ.mjs → templates-CfQjpDWW.mjs} +0 -0
- /package/dist/{utils-DBCCkkJS.mjs → utils-6UCLxv4B.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as DEFAULT_MCP_WELL_KNOWN_ROUTE,
|
|
1
|
+
import { S 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, w as DEFAULT_SKILL_MD_ROUTE } from "./agent-CxDzPqtl.mjs";
|
|
2
2
|
import { n as DEFAULT_ROBOTS_TXT_ROUTE } from "./robots-DRpoiYAV.mjs";
|
|
3
3
|
import matter from "gray-matter";
|
|
4
4
|
|
|
@@ -393,238 +393,6 @@ async function runDocsAgentConformance(options) {
|
|
|
393
393
|
};
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
-
//#endregion
|
|
397
|
-
//#region src/metadata.ts
|
|
398
|
-
/**
|
|
399
|
-
* Resolve page title using metadata titleTemplate.
|
|
400
|
-
* %s is replaced with page title.
|
|
401
|
-
*/
|
|
402
|
-
function resolveTitle(pageTitle, metadata) {
|
|
403
|
-
return (metadata?.titleTemplate ?? "%s").replace("%s", pageTitle);
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Resolve OG image URL for a page.
|
|
407
|
-
* Prefers page.openGraph.images[0], then page.ogImage, then config endpoint/default.
|
|
408
|
-
*/
|
|
409
|
-
function resolveOGImage(page, ogConfig, baseUrl) {
|
|
410
|
-
if (page.openGraph?.images?.length) return resolveImageUrl(page.openGraph.images[0].url, baseUrl);
|
|
411
|
-
if (!ogConfig?.enabled) return void 0;
|
|
412
|
-
if (page.ogImage) return resolveImageUrl(page.ogImage, baseUrl);
|
|
413
|
-
if (ogConfig.type === "dynamic" && ogConfig.endpoint) return `${baseUrl ?? ""}${ogConfig.endpoint}`;
|
|
414
|
-
return ogConfig.defaultImage;
|
|
415
|
-
}
|
|
416
|
-
function resolveImageUrl(url, baseUrl) {
|
|
417
|
-
if (url.startsWith("/") || url.startsWith("http")) return url;
|
|
418
|
-
const base = baseUrl ?? "";
|
|
419
|
-
return `${base}${base.length > 0 && !base.endsWith("/") ? "/" : ""}${url}`;
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Build the Open Graph metadata object for a page.
|
|
423
|
-
* When the page has openGraph in frontmatter, uses it (with title/description filled from page if omitted).
|
|
424
|
-
* Otherwise uses ogImage or config (dynamic endpoint / defaultImage).
|
|
425
|
-
*/
|
|
426
|
-
function buildPageOpenGraph(page, ogConfig, baseUrl) {
|
|
427
|
-
if (page.openGraph) {
|
|
428
|
-
const images = page.openGraph.images?.length ? page.openGraph.images.map((img) => ({
|
|
429
|
-
url: resolveImageUrl(img.url, baseUrl),
|
|
430
|
-
width: img.width ?? 1200,
|
|
431
|
-
height: img.height ?? 630
|
|
432
|
-
})) : void 0;
|
|
433
|
-
return {
|
|
434
|
-
title: page.openGraph.title ?? page.title,
|
|
435
|
-
description: page.openGraph.description ?? page.description,
|
|
436
|
-
...images && { images }
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
const url = resolveOGImage(page, ogConfig, baseUrl);
|
|
440
|
-
if (!url) return void 0;
|
|
441
|
-
return {
|
|
442
|
-
title: page.title,
|
|
443
|
-
...page.description && { description: page.description },
|
|
444
|
-
images: [{
|
|
445
|
-
url,
|
|
446
|
-
width: 1200,
|
|
447
|
-
height: 630
|
|
448
|
-
}]
|
|
449
|
-
};
|
|
450
|
-
}
|
|
451
|
-
/**
|
|
452
|
-
* Build the Twitter card metadata object for a page.
|
|
453
|
-
* When the page has twitter in frontmatter, uses it.
|
|
454
|
-
* Otherwise builds from ogImage or config (dynamic endpoint).
|
|
455
|
-
*/
|
|
456
|
-
function buildPageTwitter(page, ogConfig, baseUrl) {
|
|
457
|
-
if (page.twitter) {
|
|
458
|
-
const images = page.twitter.images?.length ? page.twitter.images.map((url) => resolveImageUrl(url, baseUrl)) : void 0;
|
|
459
|
-
return {
|
|
460
|
-
...page.twitter.card && { card: page.twitter.card },
|
|
461
|
-
...page.twitter.title !== void 0 && { title: page.twitter.title },
|
|
462
|
-
...page.twitter.description !== void 0 && { description: page.twitter.description },
|
|
463
|
-
...images && { images }
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
const url = resolveOGImage(page, ogConfig, baseUrl);
|
|
467
|
-
if (!url) return void 0;
|
|
468
|
-
return {
|
|
469
|
-
card: "summary_large_image",
|
|
470
|
-
title: page.title,
|
|
471
|
-
...page.description && { description: page.description },
|
|
472
|
-
images: [url]
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
function normalizeBaseUrl(value) {
|
|
476
|
-
if (!value) return void 0;
|
|
477
|
-
try {
|
|
478
|
-
return new URL(value).toString().replace(/\/+$/, "");
|
|
479
|
-
} catch {
|
|
480
|
-
return;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
function absolutizeUrl(url, baseUrl) {
|
|
484
|
-
const base = normalizeBaseUrl(baseUrl);
|
|
485
|
-
if (!base) return url;
|
|
486
|
-
try {
|
|
487
|
-
return new URL(url, `${base}/`).toString();
|
|
488
|
-
} catch {
|
|
489
|
-
return url;
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
function titleFromSegment(segment) {
|
|
493
|
-
return segment.replace(/\.[a-z0-9]+$/i, "").replace(/[-_]+/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
|
|
494
|
-
}
|
|
495
|
-
function normalizeRoutePath(url) {
|
|
496
|
-
try {
|
|
497
|
-
return new URL(url, "https://farming-labs.local").pathname.replace(/\/+$/, "") || "/";
|
|
498
|
-
} catch {
|
|
499
|
-
return `/${url.replace(/^\/+/, "")}`.replace(/\/+$/, "") || "/";
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
function buildDefaultBreadcrumbs(input) {
|
|
503
|
-
const routePath = normalizeRoutePath(input.url);
|
|
504
|
-
const entry = (input.entry ?? "docs").replace(/^\/+|\/+$/g, "") || "docs";
|
|
505
|
-
const segments = routePath.split("/").filter(Boolean);
|
|
506
|
-
const entryParts = entry.split("/").filter(Boolean);
|
|
507
|
-
const contentSegments = segments.slice(0, entryParts.length).join("/") === entryParts.join("/") ? segments.slice(entryParts.length) : segments;
|
|
508
|
-
const breadcrumbs = [{
|
|
509
|
-
name: titleFromSegment(entryParts[entryParts.length - 1] ?? "Docs"),
|
|
510
|
-
url: `/${entry}`
|
|
511
|
-
}];
|
|
512
|
-
let current = `/${entry}`;
|
|
513
|
-
contentSegments.forEach((segment, index) => {
|
|
514
|
-
current = `${current}/${segment}`.replace(/\/+/g, "/");
|
|
515
|
-
breadcrumbs.push({
|
|
516
|
-
name: index === contentSegments.length - 1 ? input.title : titleFromSegment(segment),
|
|
517
|
-
url: current
|
|
518
|
-
});
|
|
519
|
-
});
|
|
520
|
-
return breadcrumbs;
|
|
521
|
-
}
|
|
522
|
-
function normalizeDateModified(value) {
|
|
523
|
-
if (!value) return void 0;
|
|
524
|
-
const date = new Date(value);
|
|
525
|
-
return Number.isNaN(date.getTime()) ? value : date.toISOString();
|
|
526
|
-
}
|
|
527
|
-
function buildAgentContractHowTo(value, fallback) {
|
|
528
|
-
const agent = normalizePageAgentFrontmatter(value);
|
|
529
|
-
if (!agent || !hasStructuredPageAgentContract(agent)) return void 0;
|
|
530
|
-
const steps = [];
|
|
531
|
-
for (const command of agent.commands ?? []) {
|
|
532
|
-
const run = typeof command === "string" ? command : command.run;
|
|
533
|
-
const description = typeof command === "string" ? void 0 : command.description;
|
|
534
|
-
const cwd = typeof command === "string" ? void 0 : command.cwd;
|
|
535
|
-
steps.push({
|
|
536
|
-
"@type": "HowToStep",
|
|
537
|
-
position: steps.length + 1,
|
|
538
|
-
name: description ?? "Run command",
|
|
539
|
-
text: cwd ? `${run} (from ${cwd})` : run
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
for (const verification of agent.verification ?? []) {
|
|
543
|
-
const description = typeof verification === "string" ? verification : verification.description ?? "Verify the result";
|
|
544
|
-
const details = typeof verification === "string" ? verification : [verification.run, verification.expect ? `Expected: ${verification.expect}` : void 0].filter(Boolean).join(". ");
|
|
545
|
-
steps.push({
|
|
546
|
-
"@type": "HowToStep",
|
|
547
|
-
position: steps.length + 1,
|
|
548
|
-
name: description,
|
|
549
|
-
text: details || description
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
const supplies = [...(agent.prerequisites ?? []).map((name) => ({
|
|
553
|
-
"@type": "HowToSupply",
|
|
554
|
-
name
|
|
555
|
-
})), ...(agent.files ?? []).map((name) => ({
|
|
556
|
-
"@type": "HowToSupply",
|
|
557
|
-
name
|
|
558
|
-
}))];
|
|
559
|
-
const about = Object.entries(agent.appliesTo ?? {}).flatMap(([kind, values]) => (typeof values === "string" ? [values] : values ?? []).map((name) => ({
|
|
560
|
-
"@type": "Thing",
|
|
561
|
-
name: `${kind}: ${name}`
|
|
562
|
-
})));
|
|
563
|
-
return {
|
|
564
|
-
"@type": "HowTo",
|
|
565
|
-
name: agent.task ?? fallback.title,
|
|
566
|
-
...agent.outcome ?? fallback.description ? { description: agent.outcome ?? fallback.description } : {},
|
|
567
|
-
...about.length > 0 ? { about } : {},
|
|
568
|
-
...supplies.length > 0 ? { supply: supplies } : {},
|
|
569
|
-
...steps.length > 0 ? { step: steps } : {}
|
|
570
|
-
};
|
|
571
|
-
}
|
|
572
|
-
/**
|
|
573
|
-
* Resolve the public docs site URL from existing agent-facing config.
|
|
574
|
-
*
|
|
575
|
-
* The framework intentionally reuses `sitemap.baseUrl`, `llmsTxt.baseUrl`,
|
|
576
|
-
* `robots.baseUrl`, or `ai.docsUrl` instead of requiring another setting.
|
|
577
|
-
*/
|
|
578
|
-
function resolveDocsMetadataBaseUrl(config) {
|
|
579
|
-
return [
|
|
580
|
-
typeof config.sitemap === "object" ? config.sitemap.baseUrl : void 0,
|
|
581
|
-
typeof config.llmsTxt === "object" ? config.llmsTxt.baseUrl : void 0,
|
|
582
|
-
typeof config.robots === "object" ? config.robots.baseUrl : void 0,
|
|
583
|
-
config.ai?.docsUrl
|
|
584
|
-
].map((value) => normalizeBaseUrl(value)).find((value) => Boolean(value));
|
|
585
|
-
}
|
|
586
|
-
/**
|
|
587
|
-
* Build Schema.org JSON-LD for a docs page.
|
|
588
|
-
*
|
|
589
|
-
* The shape follows Vercel's agent readability guidance: a `TechArticle`
|
|
590
|
-
* with title, description, canonical URL, freshness, and breadcrumbs.
|
|
591
|
-
*/
|
|
592
|
-
function buildDocsPageStructuredData(input) {
|
|
593
|
-
const breadcrumbs = input.breadcrumbs?.length ? input.breadcrumbs : buildDefaultBreadcrumbs(input);
|
|
594
|
-
const result = {
|
|
595
|
-
"@context": "https://schema.org",
|
|
596
|
-
"@type": "TechArticle",
|
|
597
|
-
headline: input.title,
|
|
598
|
-
name: input.title,
|
|
599
|
-
url: absolutizeUrl(input.url, input.baseUrl),
|
|
600
|
-
mainEntityOfPage: {
|
|
601
|
-
"@type": "WebPage",
|
|
602
|
-
"@id": absolutizeUrl(input.url, input.baseUrl)
|
|
603
|
-
},
|
|
604
|
-
breadcrumb: {
|
|
605
|
-
"@type": "BreadcrumbList",
|
|
606
|
-
itemListElement: breadcrumbs.map((item, index) => ({
|
|
607
|
-
"@type": "ListItem",
|
|
608
|
-
position: index + 1,
|
|
609
|
-
name: item.name,
|
|
610
|
-
item: absolutizeUrl(item.url, input.baseUrl)
|
|
611
|
-
}))
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
if (input.description) result.description = input.description;
|
|
615
|
-
const agentContract = buildAgentContractHowTo(input.agent, input);
|
|
616
|
-
if (agentContract) result.mainEntity = agentContract;
|
|
617
|
-
const dateModified = normalizeDateModified(input.dateModified);
|
|
618
|
-
if (dateModified) result.dateModified = dateModified;
|
|
619
|
-
return result;
|
|
620
|
-
}
|
|
621
|
-
/**
|
|
622
|
-
* Serialize Schema.org JSON-LD for safe insertion into a `<script>` tag.
|
|
623
|
-
*/
|
|
624
|
-
function renderDocsPageStructuredDataJson(input) {
|
|
625
|
-
return JSON.stringify(buildDocsPageStructuredData(input)).replace(/</g, "\\u003c");
|
|
626
|
-
}
|
|
627
|
-
|
|
628
396
|
//#endregion
|
|
629
397
|
//#region src/reading-time.ts
|
|
630
398
|
function hasExplicitReadingTime(frontmatter) {
|
|
@@ -681,4 +449,4 @@ function resolveReadingTimeFromSource(source, wordsPerMinute, options) {
|
|
|
681
449
|
}
|
|
682
450
|
|
|
683
451
|
//#endregion
|
|
684
|
-
export {
|
|
452
|
+
export { resolveReadingTimeOptions as a, runDocsAgentConformance as c, deepMerge as d, resolveChangelogConfig as f, resolveReadingTimeFromSource as i, createTheme as l, resolvePageReadingTime as n, DOCS_AGENT_CONTRACT_VERSION as o, defineDocs as p, resolveReadingTimeFromContent as r, createDocsAgentContractCases as s, estimateReadingTimeMinutes as t, extendTheme as u };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Jt as getPageAgentFrontmatterIssues, M as buildDocsAgentDiscoverySpec, O as DOCS_CONFIG_MAP_TOP_LEVEL_KEYS, P as buildDocsConfigMap, St as findDocsAudienceMdxIssues, Wt as PAGE_AGENT_CONTRACT_FIELDS, Xt as normalizePageAgentFrontmatter, Yt as hasStructuredPageAgentContract, f as DEFAULT_DOCS_CONFIG_ROUTE, u as DEFAULT_DOCS_API_ROUTE } from "./agent-CxDzPqtl.mjs";
|
|
2
|
-
import "./search-
|
|
3
|
-
import {
|
|
2
|
+
import { d as resolveAskAISearchRequestConfig } from "./search-Bo9ubPVO.mjs";
|
|
3
|
+
import { a as resolveDocsMetadataBaseUrl } from "./metadata-3ljRN9MM.mjs";
|
|
4
|
+
import { c as resolveDocsReviewConfig, o as ensureDocsReviewWorkflow, s as readDocsReviewConfigFromSource, t as runDocsGoldenTasks } from "./agent-evals-BW0vEc-F.mjs";
|
|
4
5
|
import { createFilesystemDocsMcpSource, getDocsConfigSchema, resolveDocsMcpConfig } from "./mcp.mjs";
|
|
5
|
-
import "./code-blocks-
|
|
6
|
-
import { a as loadDocsConfigModuleResultWithProjectEnv, h as resolveDocsContentDir, m as resolveDocsConfigPath, p as readTopLevelStringProperty } from "./config-
|
|
7
|
-
import { t as detectFramework } from "./utils-
|
|
8
|
-
import {
|
|
6
|
+
import "./code-blocks-qe0T8-xe.mjs";
|
|
7
|
+
import { a as loadDocsConfigModuleResultWithProjectEnv, h as resolveDocsContentDir, m as resolveDocsConfigPath, p as readTopLevelStringProperty } from "./config-DASewQ0x.mjs";
|
|
8
|
+
import { t as detectFramework } from "./utils-6UCLxv4B.mjs";
|
|
9
|
+
import { a as extractAgentBlocks, i as createAgentUsefulnessPagesFromMcp, n as analyzeAgentSurfaceDrift, r as analyzeAgentUsefulness, t as resolveGoldenEvaluationInput } from "./golden-evaluations-BiUg5Xe_.mjs";
|
|
9
10
|
import matter from "gray-matter";
|
|
10
11
|
import { existsSync, lstatSync, readFileSync, readdirSync } from "node:fs";
|
|
11
12
|
import path from "node:path";
|
|
@@ -25,26 +26,6 @@ const IGNORED_DIRS = new Set([
|
|
|
25
26
|
"node_modules",
|
|
26
27
|
"out"
|
|
27
28
|
]);
|
|
28
|
-
function isPlainRecord(value) {
|
|
29
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
30
|
-
}
|
|
31
|
-
function resolveGoldenEvaluationTasks(evaluationInput) {
|
|
32
|
-
if (evaluationInput === void 0 || typeof evaluationInput === "boolean") return void 0;
|
|
33
|
-
if (!isPlainRecord(evaluationInput)) return { evaluationConfig: evaluationInput };
|
|
34
|
-
if (evaluationInput.enabled === false) return void 0;
|
|
35
|
-
if ("enabled" in evaluationInput && typeof evaluationInput.enabled !== "boolean") return evaluationInput;
|
|
36
|
-
if (!("tasks" in evaluationInput)) return void 0;
|
|
37
|
-
const runtimeTasks = evaluationInput.tasks;
|
|
38
|
-
if (!Array.isArray(runtimeTasks)) return runtimeTasks;
|
|
39
|
-
return runtimeTasks.map((task) => {
|
|
40
|
-
if (!isPlainRecord(task)) return task;
|
|
41
|
-
return {
|
|
42
|
-
...task,
|
|
43
|
-
tokenBudget: task.tokenBudget ?? evaluationInput.tokenBudget,
|
|
44
|
-
topK: task.topK ?? evaluationInput.topK
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
29
|
function parseReviewArgs(argv) {
|
|
49
30
|
const parsed = {};
|
|
50
31
|
for (let index = 0; index < argv.length; index += 1) {
|
|
@@ -182,7 +163,27 @@ async function runReview(options = {}) {
|
|
|
182
163
|
});
|
|
183
164
|
}
|
|
184
165
|
const evaluationInput = config?.agent?.evaluations;
|
|
185
|
-
const
|
|
166
|
+
const evaluation = resolveGoldenEvaluationInput(evaluationInput);
|
|
167
|
+
const evaluationBaseUrl = config ? resolveDocsMetadataBaseUrl(config) : void 0;
|
|
168
|
+
const evaluationSiteTitle = typeof config?.nav?.title === "string" ? config.nav.title : void 0;
|
|
169
|
+
const evaluationMcp = resolveDocsMcpConfig(config?.mcp, { defaultName: evaluationSiteTitle });
|
|
170
|
+
const askAISearch = resolveAskAISearchRequestConfig({
|
|
171
|
+
search: config?.search,
|
|
172
|
+
useMcp: config?.ai?.useMcp,
|
|
173
|
+
mcpEndpoint: evaluationMcp.route,
|
|
174
|
+
mcpEnabled: evaluationMcp.enabled,
|
|
175
|
+
mcpSearchEnabled: evaluationMcp.tools.searchDocs,
|
|
176
|
+
requestUrl: evaluationBaseUrl
|
|
177
|
+
});
|
|
178
|
+
const evaluations = await runDocsGoldenTasks(corpusPages, evaluation.tasks, {
|
|
179
|
+
...evaluation.options,
|
|
180
|
+
search: config?.search,
|
|
181
|
+
askAISearch,
|
|
182
|
+
siteTitle: evaluationSiteTitle,
|
|
183
|
+
baseUrl: evaluationBaseUrl,
|
|
184
|
+
rootDir,
|
|
185
|
+
codeBlocksValidate: config?.codeBlocks?.validate
|
|
186
|
+
});
|
|
186
187
|
if (relevantFiles.length > 0 && evaluations.status === "unmeasured") pushFinding(findings, review, {
|
|
187
188
|
rule: "goldenTasks",
|
|
188
189
|
code: "golden-tasks-unmeasured",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./agent-CxDzPqtl.mjs";
|
|
2
2
|
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-DRpoiYAV.mjs";
|
|
3
|
-
import { d as readStringProperty, i as loadDocsConfigModule, m as resolveDocsConfigPath, p as readTopLevelStringProperty, s as readBooleanProperty, t as extractNestedObjectLiteral } from "./config-
|
|
4
|
-
import { t as detectFramework } from "./utils-
|
|
3
|
+
import { d as readStringProperty, i as loadDocsConfigModule, m as resolveDocsConfigPath, p as readTopLevelStringProperty, s as readBooleanProperty, t as extractNestedObjectLiteral } from "./config-DASewQ0x.mjs";
|
|
4
|
+
import { t as detectFramework } from "./utils-6UCLxv4B.mjs";
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import pc from "picocolors";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { An as ResolvedDocsRelatedLink, Bn as TypesenseDocsSearchConfig, Bt as DocsSearchDocument, Ct as DocsObservabilityConfig, F as DocsAnalyticsConfig, Ft as DocsSearchAdapter, Gt as DocsSearchSourcePage, I as DocsAnalyticsEvent, Kt as DocsSitemapConfig, L as DocsAnalyticsEventInput, Lt as DocsSearchAdapterFactory, M as DocsAgentTraceEventInput, Rt as DocsSearchChunkingConfig, Tt as DocsObservabilityEventInput, Ut as DocsSearchResult, f as CustomDocsSearchConfig, fn as OpenDocsProvider, hn as OpenDocsTarget, ln as McpDocsSearchConfig, q as DocsAskAIMcpConfig, r as AlgoliaDocsSearchConfig, wt as DocsObservabilityEvent, zt as DocsSearchConfig } from "./types-C1nPRXqo.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/analytics.d.ts
|
|
4
4
|
declare const DOCS_AGENT_TRACE_EVENT_TYPES: readonly ["run.start", "run.end", "run.error", "user.input", "prompt.build", "retrieval.query", "retrieval.result", "retrieval.error", "model.call", "model.response", "model.stream", "model.error", "tool.call", "tool.result", "tool.error", "retry", "timeout", "error", "agent.final"];
|
|
@@ -198,6 +198,11 @@ interface DocsAskAIContextResult extends DocsSearchResult {
|
|
|
198
198
|
}
|
|
199
199
|
interface DocsAskAIContext {
|
|
200
200
|
context: string;
|
|
201
|
+
/** Structured production context blocks; avoids reparsing markdown horizontal rules. */
|
|
202
|
+
blocks: Array<{
|
|
203
|
+
text: string;
|
|
204
|
+
result: DocsAskAIContextResult;
|
|
205
|
+
}>;
|
|
201
206
|
results: DocsAskAIContextResult[];
|
|
202
207
|
searchResults: DocsSearchResult[];
|
|
203
208
|
packageHints: DocsAskAIPackageHints;
|
|
@@ -230,8 +235,22 @@ declare function performDocsSearch(options: {
|
|
|
230
235
|
audience?: DocsContentAudience;
|
|
231
236
|
locale?: string;
|
|
232
237
|
pathname?: string;
|
|
233
|
-
siteTitle?: string;
|
|
238
|
+
siteTitle?: string; /** Canonical docs URL used to distinguish same-site absolute hits from foreign MCP results. */
|
|
239
|
+
baseUrl?: string;
|
|
234
240
|
limit?: number;
|
|
241
|
+
/**
|
|
242
|
+
* Controls provider failures. Runtime search keeps the resilient `fallback` default;
|
|
243
|
+
* diagnostics can request `throw` so a broken configured provider cannot be scored as
|
|
244
|
+
* successful simple search.
|
|
245
|
+
*/
|
|
246
|
+
failureMode?: "fallback" | "throw";
|
|
247
|
+
/**
|
|
248
|
+
* Whether non-simple provider hits are supplemented with exact/local simple results.
|
|
249
|
+
* Runtime search defaults to true; provider diagnostics can disable supplementation.
|
|
250
|
+
*/
|
|
251
|
+
supplementExternalResults?: boolean; /** Fail closed on absolute provider hits when no canonical docs origin is available. */
|
|
252
|
+
strictExternalOrigins?: boolean; /** Optional cancellation signal forwarded to adapters and their managed requests. */
|
|
253
|
+
signal?: AbortSignal;
|
|
235
254
|
}): Promise<DocsSearchResult[]>;
|
|
236
255
|
declare function buildDocsAskAIContext(options: {
|
|
237
256
|
pages: DocsSearchSourcePage[];
|
|
@@ -243,7 +262,10 @@ declare function buildDocsAskAIContext(options: {
|
|
|
243
262
|
baseUrl?: string;
|
|
244
263
|
limit?: number;
|
|
245
264
|
maxContextChars?: number;
|
|
246
|
-
maxResultChars?: number;
|
|
265
|
+
maxResultChars?: number; /** See `performDocsSearch.failureMode`. Defaults to resilient runtime fallback. */
|
|
266
|
+
searchFailureMode?: "fallback" | "throw"; /** See `performDocsSearch.strictExternalOrigins`. */
|
|
267
|
+
strictExternalOrigins?: boolean; /** Optional cancellation signal forwarded to the configured search provider. */
|
|
268
|
+
signal?: AbortSignal;
|
|
247
269
|
}): Promise<DocsAskAIContext>;
|
|
248
270
|
declare function createCustomSearchAdapter(adapter: DocsSearchAdapter | DocsSearchAdapterFactory): CustomDocsSearchConfig;
|
|
249
271
|
//#endregion
|