@farming-labs/docs 0.2.104 → 0.2.105
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-NerpHcQB.mjs → agent-CaCWThBY.mjs} +4 -4
- package/dist/{agent-PSrgiJD8.mjs → agent-DCTGj6J7.mjs} +48 -12
- package/dist/{agent-evals-U9d_db2u.mjs → agent-evals-D-sPJfXz.mjs} +5 -5
- package/dist/{agent-export-DlBUKkTt.mjs → agent-export-GcTZPLfB.mjs} +19 -17
- package/dist/agent-feedback-evaluations-DQCTFegz.mjs +240 -0
- package/dist/agent-maintenance-CuZ7iAKq.mjs +289 -0
- package/dist/agent-skills-bundle.d.mts +1 -1
- package/dist/{agent-skills-progressive-disclosure-CfIsq4Ew.mjs → agent-skills-progressive-disclosure-DL-q4JZo.mjs} +1 -1
- package/dist/{agent-skills-server-CIoL58X7.d.mts → agent-skills-server-D34054x5.d.mts} +2 -2
- package/dist/{agent-skills-server-DFqQyO_V.mjs → agent-skills-server-Ddbf15pY.mjs} +1 -1
- package/dist/agent-skills-vite.d.mts +3 -3
- package/dist/agent-skills-vite.mjs +2 -2
- package/dist/{agents-D3SLnQet.mjs → agents-e1SYT64z.mjs} +11 -11
- package/dist/{analytics-Bx44lg6d.mjs → analytics-CqfcIBdg.mjs} +1 -1
- package/dist/{analytics-B-jz7re8.d.mts → analytics-aeXwEvQX.d.mts} +1 -1
- package/dist/{authoring-BsWXMH43.mjs → authoring-Do87QzBd.mjs} +6 -6
- package/dist/{authoring-mcp-BCM5CJbJ.mjs → authoring-mcp-Be7quE5R.mjs} +2 -2
- package/dist/browser.d.mts +3 -3
- package/dist/browser.mjs +2 -2
- package/dist/cli/index.mjs +71 -35
- package/dist/client/react.d.mts +1 -1
- package/dist/client/react.mjs +1 -1
- package/dist/{cloud-BLxt_HYO.mjs → cloud-Bvof6mET.mjs} +3 -3
- package/dist/{cloud-ask-ai-19G2HJ62.d.mts → cloud-ask-ai-BqfiQaNZ.d.mts} +1 -1
- package/dist/{cloud-ask-ai-DeojA5lB.mjs → cloud-ask-ai-CK2qlNns.mjs} +1 -1
- package/dist/{codeblocks-qHdKGVaE.mjs → codeblocks-C911CdyJ.mjs} +2 -2
- package/dist/{agent-C9IdC__R.d.mts → content-change-hydration-CoYRs3pC.d.mts} +704 -678
- package/dist/{dev-B0iHJjTz.mjs → dev-Bx0JNglW.mjs} +2 -2
- package/dist/docs-cloud-server.d.mts +2 -2
- package/dist/docs-cloud-server.mjs +2 -2
- package/dist/{doctor-x3k6aE2I.mjs → doctor-CtK1CRPj.mjs} +17 -17
- package/dist/{downgrade-Dd3vvVdD.mjs → downgrade-BXmQMkMy.mjs} +2 -2
- package/dist/{feedback-DdWc33oO.mjs → feedback-DWVUMrxy.mjs} +1 -1
- package/dist/feedback-evals-k0sFDdms.mjs +146 -0
- package/dist/{golden-evaluations-7k7Akp3R.mjs → golden-evaluations-De4KwoYr.mjs} +3 -3
- package/dist/index.d.mts +174 -9
- package/dist/index.mjs +14 -11
- package/dist/{init-DKukQdOQ.mjs → init-CCV2eRNB.mjs} +3 -3
- package/dist/markdown-rendering.mjs +1 -1
- package/dist/{markdown-sections-7OoA7ylx.mjs → markdown-sections-BKy4labo.mjs} +110 -2
- package/dist/{mcp-B6ZZdp6F.mjs → mcp-DsjWxF7g.mjs} +11 -11
- package/dist/mcp.d.mts +5 -3
- package/dist/mcp.mjs +92 -29
- package/dist/{metadata-D4v_R1t5.mjs → metadata-7htr-Xj_.mjs} +1 -1
- package/dist/{openapi-mcp-B7u7Y0gB.mjs → openapi-mcp-DQ3xptKo.mjs} +68 -4
- package/dist/openapi-mcp-node-vO3IXVGI.mjs +43 -0
- package/dist/{package-version-P4TT_9IO.mjs → package-version-Ci99L0yo.mjs} +1 -1
- package/dist/{prompt-references-Ca2Rcrpw.mjs → prompt-references-1Wce71c7.mjs} +3 -3
- package/dist/propose-DJOiHu9Y.mjs +73 -0
- package/dist/retrieval-digest-B-SgtXKK.mjs +177 -0
- package/dist/retrieval-digest-DyNRD-mt.d.mts +467 -0
- package/dist/{review-DgaNTtP0.mjs → review-XI9FXeos.mjs} +12 -12
- package/dist/{robots-DNod0XKB.mjs → robots-BOjWB1ky.mjs} +2 -2
- package/dist/{robots-msD1xoH5.mjs → robots-CzKesbdX.mjs} +6 -6
- package/dist/{search-CNzq9S5S.mjs → search-DwAoC9X7.mjs} +12 -12
- package/dist/server.d.mts +6 -308
- package/dist/server.mjs +13 -12
- package/dist/{sidebar-DmXRpAAK.d.mts → sidebar-CJze8SBi.d.mts} +1 -1
- package/dist/{sitemap-CHvips7o.mjs → sitemap-DOaJIKJf.mjs} +11 -11
- package/dist/{sitemap-server-C2TauhKa.mjs → sitemap-server-NeVu8W38.mjs} +1 -1
- package/dist/{skills-aaE5L1go.mjs → skills-BILSESek.mjs} +11 -11
- package/dist/{standards-discovery-Ckx0tN7B.mjs → standards-discovery-Bpz90VYq.mjs} +2 -177
- package/dist/{standards-discovery-Cqq8QmlH.d.mts → standards-discovery-Xm84bS4M.d.mts} +1 -1
- package/dist/{types-BthCiAD9.d.mts → types-QhYMnKvb.d.mts} +35 -2
- package/dist/{upgrade-B0OA_7jE.mjs → upgrade-B92U83xo.mjs} +2 -2
- package/package.json +1 -1
- package/dist/retrieval-digest-DT9Ktc4C.d.mts +0 -164
- /package/dist/{agent-feedback-loop-CGrc-gDW.mjs → agent-feedback-loop-vaC-M1sx.mjs} +0 -0
- /package/dist/{audience-exposure-BW13cI2O.d.mts → audience-exposure-CkNZNeVX.d.mts} +0 -0
- /package/dist/{cloud-analytics-CSyFE6SS.mjs → cloud-analytics-Ci1yiwD8.mjs} +0 -0
- /package/dist/{code-blocks-c3nIrWOM.mjs → code-blocks-D90CCJFs.mjs} +0 -0
- /package/dist/{config-BhF6J2N4.mjs → config-DrZ3fXgf.mjs} +0 -0
- /package/dist/{errors-B5KTe1Xo.mjs → errors-BDmra6mz.mjs} +0 -0
- /package/dist/{i18n-B3BIxShC.mjs → i18n-B1gJ9EW0.mjs} +0 -0
- /package/dist/{sidebar-IcpElOVH.mjs → sidebar-3W51s2sF.mjs} +0 -0
- /package/dist/{templates-m_j4ARnu.mjs → templates-DdB4BBGq.mjs} +0 -0
- /package/dist/{utils-DcCUwxqS.mjs → utils-Cc1SrVza.mjs} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as detectPackageManagerFromProject } from "./utils-
|
|
2
|
-
import { $ as postcssConfigTemplate, C as globalCssTemplate, g as docsLayoutTemplate, kt as tsconfigTemplate, tt as rootLayoutTemplate } from "./templates-
|
|
1
|
+
import { i as detectPackageManagerFromProject } from "./utils-Cc1SrVza.mjs";
|
|
2
|
+
import { $ as postcssConfigTemplate, C as globalCssTemplate, g as docsLayoutTemplate, kt as tsconfigTemplate, tt as rootLayoutTemplate } from "./templates-DdB4BBGq.mjs";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as DocsCloudAskAIResponseOptions, t as DocsCloudAskAIConfig } from "./cloud-ask-ai-
|
|
1
|
+
import { gt as DocsAnalyticsEventInput, ht as DocsAnalyticsEvent, mt as DocsAnalyticsConfig } from "./types-QhYMnKvb.mjs";
|
|
2
|
+
import { n as DocsCloudAskAIResponseOptions, t as DocsCloudAskAIConfig } from "./cloud-ask-ai-BqfiQaNZ.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/docs-cloud-server.d.ts
|
|
5
5
|
type DocsCloudRuntimeValue<T = string> = T | undefined | null | (() => T | undefined | null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as sendDocsCloudAnalyticsEvent } from "./cloud-analytics-
|
|
2
|
-
import { t as createDocsCloudAskAIResponse } from "./cloud-ask-ai-
|
|
1
|
+
import { n as sendDocsCloudAnalyticsEvent } from "./cloud-analytics-Ci1yiwD8.mjs";
|
|
2
|
+
import { t as createDocsCloudAskAIResponse } from "./cloud-ask-ai-CK2qlNns.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/docs-cloud-server.ts
|
|
5
5
|
const DEFAULT_DOCS_CLOUD_API_BASE_URL = "https://api.farming-labs.dev";
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { i as scanDocsPageTargets, n as compactAgentDocs, r as inspectAgentCompactionState } from "./agent-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { I as resolveDocsDiscoveryApiRoute, _ as DEFAULT_API_CATALOG_FORMAT, d as DEFAULT_AGENT_SKILLS_ROUTE_PATTERN, f as DEFAULT_AGENT_SKILLS_ROUTE_PREFIX, h as DEFAULT_AGENT_SKILL_FORMAT, l as DEFAULT_AGENT_SKILLS_INDEX_FORMAT, 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 } from "./standards-discovery-
|
|
1
|
+
import { i as scanDocsPageTargets, n as compactAgentDocs, r as inspectAgentCompactionState } from "./agent-CaCWThBY.mjs";
|
|
2
|
+
import { f as PAGE_AGENT_CONTRACT_FIELDS } from "./markdown-sections-BKy4labo.mjs";
|
|
3
|
+
import { d as httpLinkHeaderHasTargetRelation, f as AGENT_SKILL_ARCHIVE_MAX_UNCOMPRESSED_BYTES, p as readAgentSkillDocumentFromTar } from "./prompt-references-1Wce71c7.mjs";
|
|
4
|
+
import { A as buildDocsAgentDiscoverySpec, At as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, F as buildDocsMcpEndpointCandidates, Gn as getDocsMcpProtectedResourceMetadataRoutes, Jn as isDocsMcpOAuthScopeToken, Lt as resolveDocsSitemapConfig, M as buildDocsConfigMap, Qn as normalizeDocsMcpAuthorizationServerUrls, S as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, T as DOCS_CONFIG_MAP_TOP_LEVEL_KEYS, Un as DEFAULT_MCP_WELL_KNOWN_ROUTE, Vn as DEFAULT_MCP_PUBLIC_ROUTE, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, cr as resolveDocsOkfTrustMetadata, 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, l as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, mn as resolveAskAISearchRequestConfig, n as DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE, sr as resolveDocsOkfConfig, t as DEFAULT_AGENTS_MD_ROUTE, v as DEFAULT_LLMS_TXT_ROUTE, x as DEFAULT_SKILL_MD_ROUTE } from "./agent-DCTGj6J7.mjs";
|
|
5
|
+
import { I as resolveDocsDiscoveryApiRoute, _ as DEFAULT_API_CATALOG_FORMAT, d as DEFAULT_AGENT_SKILLS_ROUTE_PATTERN, f as DEFAULT_AGENT_SKILLS_ROUTE_PREFIX, h as DEFAULT_AGENT_SKILL_FORMAT, l as DEFAULT_AGENT_SKILLS_INDEX_FORMAT, 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 } from "./standards-discovery-Bpz90VYq.mjs";
|
|
6
6
|
import { isDocsAgentSkillName, validateDocsAgentSkillFrontmatter } from "./agent-skills-spec.mjs";
|
|
7
|
-
import "./openapi-mcp-
|
|
8
|
-
import { a as analyzeDocsRobotsTxt, n as DEFAULT_ROBOTS_TXT_ROUTE, u as resolveDocsRobotsConfig } from "./robots-
|
|
9
|
-
import { a as resolveDocsMetadataBaseUrl } from "./metadata-
|
|
10
|
-
import "./sitemap-server-
|
|
11
|
-
import { r as resolveConfiguredAgentSkills } from "./agent-skills-server-
|
|
12
|
-
import { t as runDocsGoldenTasks } from "./agent-evals-
|
|
7
|
+
import "./openapi-mcp-DQ3xptKo.mjs";
|
|
8
|
+
import { a as analyzeDocsRobotsTxt, n as DEFAULT_ROBOTS_TXT_ROUTE, u as resolveDocsRobotsConfig } from "./robots-BOjWB1ky.mjs";
|
|
9
|
+
import { a as resolveDocsMetadataBaseUrl } from "./metadata-7htr-Xj_.mjs";
|
|
10
|
+
import "./sitemap-server-NeVu8W38.mjs";
|
|
11
|
+
import { r as resolveConfiguredAgentSkills } from "./agent-skills-server-Ddbf15pY.mjs";
|
|
12
|
+
import { t as runDocsGoldenTasks } from "./agent-evals-D-sPJfXz.mjs";
|
|
13
13
|
import { createFilesystemDocsMcpSource, getDocsConfigSchema, resolveDocsMcpConfig } from "./mcp.mjs";
|
|
14
|
-
import "./authoring-mcp-
|
|
15
|
-
import "./code-blocks-
|
|
14
|
+
import "./authoring-mcp-Be7quE5R.mjs";
|
|
15
|
+
import "./code-blocks-D90CCJFs.mjs";
|
|
16
16
|
import "./server.mjs";
|
|
17
|
-
import { _ as resolveDocsContentDir, d as readNavTitle, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, r as extractTopLevelConfigObject, s as loadDocsConfigModuleResultWithProjectEnv, t as extractNestedObjectLiteral, v as resolveDocsProjectRoot } from "./config-
|
|
18
|
-
import { t as detectFramework } from "./utils-
|
|
19
|
-
import { i as createAgentUsefulnessPagesFromMcp, n as analyzeAgentSurfaceDrift, r as analyzeAgentUsefulness, t as resolveGoldenEvaluationInput } from "./golden-evaluations-
|
|
20
|
-
import { t as analyzeConfiguredAgentSkillsProgressiveDisclosure } from "./agent-skills-progressive-disclosure-
|
|
17
|
+
import { _ as resolveDocsContentDir, d as readNavTitle, g as resolveDocsConfigPath, h as readTopLevelStringProperty, l as readBooleanProperty, r as extractTopLevelConfigObject, s as loadDocsConfigModuleResultWithProjectEnv, t as extractNestedObjectLiteral, v as resolveDocsProjectRoot } from "./config-DrZ3fXgf.mjs";
|
|
18
|
+
import { t as detectFramework } from "./utils-Cc1SrVza.mjs";
|
|
19
|
+
import { i as createAgentUsefulnessPagesFromMcp, n as analyzeAgentSurfaceDrift, r as analyzeAgentUsefulness, t as resolveGoldenEvaluationInput } from "./golden-evaluations-De4KwoYr.mjs";
|
|
20
|
+
import { t as analyzeConfiguredAgentSkillsProgressiveDisclosure } from "./agent-skills-progressive-disclosure-DL-q4JZo.mjs";
|
|
21
21
|
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
22
22
|
import path from "node:path";
|
|
23
23
|
import { createHash } from "node:crypto";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as fileExists, o as exec, s as execOutput } from "./utils-
|
|
2
|
-
import { a as getPackagesForFramework, c as resolveDocsPackageManager, l as validateUpgradeVersion, r as buildDocsPackageInstallCommand, s as resolveDocsPackageFramework } from "./package-version-
|
|
1
|
+
import { c as fileExists, o as exec, s as execOutput } from "./utils-Cc1SrVza.mjs";
|
|
2
|
+
import { a as getPackagesForFramework, c as resolveDocsPackageManager, l as validateUpgradeVersion, r as buildDocsPackageInstallCommand, s as resolveDocsPackageFramework } from "./package-version-Ci99L0yo.mjs";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import pc from "picocolors";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as analyzeDocsAgentFeedback, r as readDocsAgentFeedbackFile } from "./agent-feedback-loop-
|
|
1
|
+
import { n as analyzeDocsAgentFeedback, r as readDocsAgentFeedbackFile } from "./agent-feedback-loop-vaC-M1sx.mjs";
|
|
2
2
|
import { mkdirSync, renameSync, writeFileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import pc from "picocolors";
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { a as compareDocsAgentFeedbackEvaluationBaseline, i as buildDocsAgentFeedbackEvaluationCandidates, o as createDocsAgentFeedbackEvaluationBaseline, t as DOCS_AGENT_FEEDBACK_EVALUATION_BASELINE_FORMAT } from "./agent-feedback-evaluations-DQCTFegz.mjs";
|
|
2
|
+
import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import pc from "picocolors";
|
|
5
|
+
|
|
6
|
+
//#region src/agent-feedback-evaluations-node.ts
|
|
7
|
+
function isRecord(value) {
|
|
8
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
9
|
+
}
|
|
10
|
+
function readJsonFile(filePath) {
|
|
11
|
+
return JSON.parse(readFileSync(filePath, "utf8"));
|
|
12
|
+
}
|
|
13
|
+
function readDocsAgentFeedbackImprovementReport(filePath) {
|
|
14
|
+
const value = readJsonFile(filePath);
|
|
15
|
+
if (!isRecord(value) || value.format !== "farming-labs-agent-feedback-improvements.v1" || !Array.isArray(value.clusters) || typeof value.feedbackCount !== "number" || typeof value.recurringClusterCount !== "number") throw new Error("Input is not a supported agent feedback improvement report.");
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
function readDocsAgentEvaluationTasksFile(filePath) {
|
|
19
|
+
const value = readJsonFile(filePath);
|
|
20
|
+
if (Array.isArray(value)) return value;
|
|
21
|
+
if (!isRecord(value)) throw new Error("Existing evaluation tasks must be a JSON object or array.");
|
|
22
|
+
if (Array.isArray(value.candidates)) return value.candidates.flatMap((candidate) => isRecord(candidate) && isRecord(candidate.task) ? [candidate.task] : []);
|
|
23
|
+
if (Array.isArray(value.tasks)) return value.tasks;
|
|
24
|
+
if (isRecord(value.agent) && isRecord(value.agent.evaluations) && Array.isArray(value.agent.evaluations.tasks)) return value.agent.evaluations.tasks;
|
|
25
|
+
throw new Error("Could not find evaluation tasks in the existing JSON file.");
|
|
26
|
+
}
|
|
27
|
+
function readDocsGoldenTasksReportFile(filePath) {
|
|
28
|
+
const value = readJsonFile(filePath);
|
|
29
|
+
const report = isRecord(value) && isRecord(value.evaluations) ? value.evaluations : value;
|
|
30
|
+
if (!isRecord(report) || !Array.isArray(report.tasks) || typeof report.taskCount !== "number" || !(typeof report.score === "number" || report.score === null)) throw new Error("Input does not contain a golden-task evaluation report.");
|
|
31
|
+
return report;
|
|
32
|
+
}
|
|
33
|
+
function readDocsAgentFeedbackEvaluationBaseline(filePath) {
|
|
34
|
+
const value = readJsonFile(filePath);
|
|
35
|
+
if (!isRecord(value) || value.format !== DOCS_AGENT_FEEDBACK_EVALUATION_BASELINE_FORMAT || typeof value.score !== "number" || !Array.isArray(value.tasks)) throw new Error("Evaluation baseline format is not supported.");
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/cli/feedback-evals.ts
|
|
41
|
+
function parseAgentFeedbackEvaluationsArgs(argv) {
|
|
42
|
+
const options = { existing: [] };
|
|
43
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
44
|
+
const argument = argv[index];
|
|
45
|
+
if (argument === "--write") options.write = true;
|
|
46
|
+
else if (argument === "--write-baseline") options.writeBaseline = true;
|
|
47
|
+
else if (argument === "--check") options.check = true;
|
|
48
|
+
else if (argument === "--allow-new-failures") options.allowNewFailures = true;
|
|
49
|
+
else if (argument === "--json") options.json = true;
|
|
50
|
+
else if (argument === "--help" || argument === "-h") options.help = true;
|
|
51
|
+
else if (argument === "--input" || argument === "--existing" || argument === "--output" || argument === "--results" || argument === "--baseline" || argument === "--max-score-drop") {
|
|
52
|
+
const value = argv[index + 1];
|
|
53
|
+
if (!value || value.startsWith("--")) throw new Error(`${argument} requires a value.`);
|
|
54
|
+
index += 1;
|
|
55
|
+
if (argument === "--input") options.input = value;
|
|
56
|
+
else if (argument === "--existing") options.existing.push(value);
|
|
57
|
+
else if (argument === "--output") options.output = value;
|
|
58
|
+
else if (argument === "--results") options.results = value;
|
|
59
|
+
else if (argument === "--baseline") options.baseline = value;
|
|
60
|
+
else {
|
|
61
|
+
const parsed = Number(value);
|
|
62
|
+
if (!Number.isFinite(parsed) || parsed < 0 || parsed > 100) throw new Error("--max-score-drop must be a number from 0 through 100.");
|
|
63
|
+
options.maxScoreDrop = parsed;
|
|
64
|
+
}
|
|
65
|
+
} else throw new Error(`Unknown agent feedback-evals flag: ${argument}`);
|
|
66
|
+
}
|
|
67
|
+
return options;
|
|
68
|
+
}
|
|
69
|
+
function resolveProjectPath(rootDir, value) {
|
|
70
|
+
if (path.isAbsolute(value)) throw new Error("Evaluation paths must be project-relative.");
|
|
71
|
+
const candidate = path.resolve(rootDir, value);
|
|
72
|
+
const relative = path.relative(rootDir, candidate);
|
|
73
|
+
if (relative.startsWith("..") || path.isAbsolute(relative)) throw new Error("Evaluation paths must stay inside the project root.");
|
|
74
|
+
return candidate;
|
|
75
|
+
}
|
|
76
|
+
function writeJson(outputPath, value) {
|
|
77
|
+
mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
78
|
+
const temporaryPath = `${outputPath}.${process.pid}.tmp`;
|
|
79
|
+
writeFileSync(temporaryPath, `${JSON.stringify(value, null, 2)}\n`, "utf8");
|
|
80
|
+
renameSync(temporaryPath, outputPath);
|
|
81
|
+
}
|
|
82
|
+
async function runCandidateMode(rootDir, options) {
|
|
83
|
+
const registry = buildDocsAgentFeedbackEvaluationCandidates(readDocsAgentFeedbackImprovementReport(resolveProjectPath(rootDir, options.input ?? ".farming-labs/agent-feedback-improvements.json")), { existingTasks: (options.existing ?? []).flatMap((filePath) => readDocsAgentEvaluationTasksFile(resolveProjectPath(rootDir, filePath))) });
|
|
84
|
+
if (options.write) {
|
|
85
|
+
const outputPath = resolveProjectPath(rootDir, options.output ?? ".farming-labs/agent-evaluation-candidates.json");
|
|
86
|
+
writeJson(outputPath, registry);
|
|
87
|
+
if (!options.json) console.log(pc.green(`Wrote ${path.relative(rootDir, outputPath)} with ${registry.candidateCount} review-required candidate${registry.candidateCount === 1 ? "" : "s"}.`));
|
|
88
|
+
}
|
|
89
|
+
if (options.json || !options.write) console.log(JSON.stringify(registry, null, 2));
|
|
90
|
+
return registry;
|
|
91
|
+
}
|
|
92
|
+
async function runRegressionMode(rootDir, options) {
|
|
93
|
+
if (!options.results || !options.baseline) throw new Error("--results and --baseline are required for baseline or regression mode.");
|
|
94
|
+
const results = readDocsGoldenTasksReportFile(resolveProjectPath(rootDir, options.results));
|
|
95
|
+
const baselinePath = resolveProjectPath(rootDir, options.baseline);
|
|
96
|
+
if (options.writeBaseline) {
|
|
97
|
+
const baseline = createDocsAgentFeedbackEvaluationBaseline(results);
|
|
98
|
+
writeJson(baselinePath, baseline);
|
|
99
|
+
if (!options.json) console.log(pc.green(`Wrote ${path.relative(rootDir, baselinePath)}.`));
|
|
100
|
+
if (options.json) console.log(JSON.stringify(baseline, null, 2));
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const comparison = compareDocsAgentFeedbackEvaluationBaseline(results, readDocsAgentFeedbackEvaluationBaseline(baselinePath), {
|
|
104
|
+
maxScoreDrop: options.maxScoreDrop,
|
|
105
|
+
failOnNewFailures: options.allowNewFailures !== true
|
|
106
|
+
});
|
|
107
|
+
console.log(JSON.stringify(comparison, null, 2));
|
|
108
|
+
if (options.check && !comparison.passed) throw new Error(`Agent evaluation regression check failed with ${comparison.regressions.length} regression(s).`);
|
|
109
|
+
return comparison;
|
|
110
|
+
}
|
|
111
|
+
async function runAgentFeedbackEvaluations(options = {}) {
|
|
112
|
+
const rootDir = path.resolve(options.rootDir ?? process.cwd());
|
|
113
|
+
if (options.writeBaseline && options.check) throw new Error("--write-baseline and --check are separate operations.");
|
|
114
|
+
if (options.results !== void 0 || options.baseline !== void 0 || options.writeBaseline === true || options.check === true) return runRegressionMode(rootDir, options);
|
|
115
|
+
return runCandidateMode(rootDir, options);
|
|
116
|
+
}
|
|
117
|
+
function printAgentFeedbackEvaluationsHelp() {
|
|
118
|
+
console.log(`${pc.bold("docs agent feedback-evals")} — promote feedback into reviewed evaluations and guard regressions
|
|
119
|
+
|
|
120
|
+
${pc.dim("Candidate usage:")}
|
|
121
|
+
docs agent feedback-evals --input .farming-labs/agent-feedback-improvements.json
|
|
122
|
+
docs agent feedback-evals --existing docs-evaluations.json --write
|
|
123
|
+
|
|
124
|
+
${pc.dim("Regression usage:")}
|
|
125
|
+
docs agent feedback-evals --results doctor.json --baseline .farming-labs/agent-evaluation-baseline.json --write-baseline
|
|
126
|
+
docs agent feedback-evals --results doctor.json --baseline .farming-labs/agent-evaluation-baseline.json --check
|
|
127
|
+
|
|
128
|
+
${pc.dim("Options:")}
|
|
129
|
+
${pc.cyan("--input <path>")} Feedback improvement report
|
|
130
|
+
${pc.cyan("--existing <path>")} Repeatable registry/config/task JSON used for deduplication
|
|
131
|
+
${pc.cyan("--write")} Write sanitized candidates
|
|
132
|
+
${pc.cyan("--output <path>")} Candidate output (default: .farming-labs/agent-evaluation-candidates.json)
|
|
133
|
+
${pc.cyan("--results <path>")} Golden-task or doctor JSON evaluation results
|
|
134
|
+
${pc.cyan("--baseline <path>")} Baseline JSON path
|
|
135
|
+
${pc.cyan("--write-baseline")} Create or replace the baseline from --results
|
|
136
|
+
${pc.cyan("--check")} Fail when results regress from the baseline
|
|
137
|
+
${pc.cyan("--max-score-drop <0-100>")} Allowed suite/task score decrease (default: 0)
|
|
138
|
+
${pc.cyan("--allow-new-failures")} Do not fail only because a newly added task fails
|
|
139
|
+
${pc.cyan("--json")} Print written candidate/baseline JSON
|
|
140
|
+
|
|
141
|
+
Candidates are redacted, deduplicated, and never added to docs.config without human review.
|
|
142
|
+
`);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
//#endregion
|
|
146
|
+
export { parseAgentFeedbackEvaluationsArgs, printAgentFeedbackEvaluationsHelp, runAgentFeedbackEvaluations };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as extractCodeBlocksFromMarkdown } from "./code-blocks-
|
|
1
|
+
import { _ as hasStructuredPageAgentContract, v as normalizePageAgentFrontmatter } from "./markdown-sections-BKy4labo.mjs";
|
|
2
|
+
import { An as normalizeAgentFramework, En as resolveDocsAudienceMdxContent, Nn as normalizeAgentVersion, kn as agentVersionConstraintsOverlap, wn as findDocsAudienceMdxTags } from "./agent-DCTGj6J7.mjs";
|
|
3
|
+
import { t as extractCodeBlocksFromMarkdown } from "./code-blocks-D90CCJFs.mjs";
|
|
4
4
|
import { isMap, isScalar, isSeq, parseDocument } from "yaml";
|
|
5
5
|
import { existsSync, lstatSync, readFileSync, readdirSync } from "node:fs";
|
|
6
6
|
import path from "node:path";
|