@farming-labs/docs 0.1.89 → 0.1.92
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-B-CYVd4D.mjs → agent-DV2Qc7qh.mjs} +3 -3
- package/dist/cli/index.mjs +9 -9
- package/dist/{config-BR6CcCfr.mjs → config-UI31_wlO.mjs} +29 -1
- package/dist/{doctor-B8bT0Aol.mjs → doctor-DFseGu9S.mjs} +21 -21
- package/dist/index.d.mts +5 -2
- package/dist/index.mjs +2 -2
- package/dist/{mcp-RBCFEtoX.mjs → mcp-B7x8mPrj.mjs} +2 -2
- package/dist/mcp.mjs +11 -36
- package/dist/{robots-NI6VU8rj.mjs → robots-CbylLz5o.mjs} +2 -2
- package/dist/{robots-DR-Gy1Hs.mjs → robots-D7dvjbuN.mjs} +8 -1
- package/dist/{search-B5ze-heM.mjs → search-BL7o2rXk.mjs} +3 -4
- package/dist/{search-DrTVZ2XK.mjs → search-o8jXDckl.mjs} +2 -2
- package/dist/server.mjs +1 -1
- package/dist/{sitemap-CEE2vnGz.mjs → sitemap-DFVo9yr0.mjs} +2 -2
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./reading-time-CbbHNg9V.mjs";
|
|
2
|
-
import { _ as parseGeneratedAgentDocument, h as hashGeneratedAgentContent, m as GENERATED_AGENT_PROVENANCE_VERSION, v as serializeGeneratedAgentDocument } from "./search-
|
|
3
|
-
import { B as renderDocsMarkdownDocument, O as findDocsMarkdownPage } from "./robots-
|
|
2
|
+
import { _ as parseGeneratedAgentDocument, h as hashGeneratedAgentContent, m as GENERATED_AGENT_PROVENANCE_VERSION, v as serializeGeneratedAgentDocument } from "./search-BL7o2rXk.mjs";
|
|
3
|
+
import { B as renderDocsMarkdownDocument, O as findDocsMarkdownPage } from "./robots-D7dvjbuN.mjs";
|
|
4
4
|
import "./index.mjs";
|
|
5
5
|
import "./sitemap-server-DwEPfk13.mjs";
|
|
6
6
|
import { createFilesystemDocsMcpSource } from "./mcp.mjs";
|
|
7
7
|
import "./server.mjs";
|
|
8
|
-
import { a as loadProjectEnv, c as readNavTitle, d as readTopLevelStringProperty, f as resolveDocsConfigPath, i as loadDocsConfigModule, l as readNumberProperty, o as readBooleanProperty, p as resolveDocsContentDir, s as readEnvReferenceProperty, t as extractNestedObjectLiteral, u as readStringProperty } from "./config-
|
|
8
|
+
import { a as loadProjectEnv, c as readNavTitle, d as readTopLevelStringProperty, f as resolveDocsConfigPath, i as loadDocsConfigModule, l as readNumberProperty, o as readBooleanProperty, p as resolveDocsContentDir, s as readEnvReferenceProperty, t as extractNestedObjectLiteral, u as readStringProperty } from "./config-UI31_wlO.mjs";
|
|
9
9
|
import matter from "gray-matter";
|
|
10
10
|
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
11
11
|
import path from "node:path";
|
package/dist/cli/index.mjs
CHANGED
|
@@ -83,10 +83,10 @@ async function main() {
|
|
|
83
83
|
const { dev } = await import("../dev-B5L7k3b6.mjs");
|
|
84
84
|
await dev(devOptions);
|
|
85
85
|
} else if (parsedCommand.command === "mcp") {
|
|
86
|
-
const { runMcp } = await import("../mcp-
|
|
86
|
+
const { runMcp } = await import("../mcp-B7x8mPrj.mjs");
|
|
87
87
|
await runMcp(mcpOptions);
|
|
88
88
|
} else if (parsedCommand.command === "agent" && subcommand === "compact") {
|
|
89
|
-
const { compactAgentDocs, parseAgentCompactArgs, printAgentCompactHelp } = await import("../agent-
|
|
89
|
+
const { compactAgentDocs, parseAgentCompactArgs, printAgentCompactHelp } = await import("../agent-DV2Qc7qh.mjs");
|
|
90
90
|
const agentCompactOptions = parseAgentCompactArgs(args.slice(2));
|
|
91
91
|
if (agentCompactOptions.help) {
|
|
92
92
|
printAgentCompactHelp();
|
|
@@ -96,11 +96,11 @@ async function main() {
|
|
|
96
96
|
} else if (parsedCommand.command === "agent") {
|
|
97
97
|
console.error(pc.red(`Unknown agent subcommand: ${subcommand ?? "(missing)"}`));
|
|
98
98
|
console.error();
|
|
99
|
-
const { printAgentCompactHelp } = await import("../agent-
|
|
99
|
+
const { printAgentCompactHelp } = await import("../agent-DV2Qc7qh.mjs");
|
|
100
100
|
printAgentCompactHelp();
|
|
101
101
|
process.exit(1);
|
|
102
102
|
} else if (parsedCommand.command === "doctor") {
|
|
103
|
-
const { parseDoctorArgs, printDoctorHelp, runDoctor } = await import("../doctor-
|
|
103
|
+
const { parseDoctorArgs, printDoctorHelp, runDoctor } = await import("../doctor-DFseGu9S.mjs");
|
|
104
104
|
const doctorOptions = parseDoctorArgs(args.slice(1));
|
|
105
105
|
if (doctorOptions.help) {
|
|
106
106
|
printDoctorHelp();
|
|
@@ -108,7 +108,7 @@ async function main() {
|
|
|
108
108
|
}
|
|
109
109
|
await runDoctor(doctorOptions);
|
|
110
110
|
} else if (parsedCommand.command === "search" && subcommand === "sync") {
|
|
111
|
-
const { syncSearch } = await import("../search-
|
|
111
|
+
const { syncSearch } = await import("../search-o8jXDckl.mjs");
|
|
112
112
|
await syncSearch(searchSyncOptions);
|
|
113
113
|
} else if (parsedCommand.command === "search") {
|
|
114
114
|
console.error(pc.red(`Unknown search subcommand: ${subcommand ?? "(missing)"}`));
|
|
@@ -116,7 +116,7 @@ async function main() {
|
|
|
116
116
|
printHelp();
|
|
117
117
|
process.exit(1);
|
|
118
118
|
} else if (parsedCommand.command === "sitemap" && subcommand === "generate") {
|
|
119
|
-
const { generateSitemap, parseSitemapGenerateArgs, printSitemapGenerateHelp } = await import("../sitemap-
|
|
119
|
+
const { generateSitemap, parseSitemapGenerateArgs, printSitemapGenerateHelp } = await import("../sitemap-DFVo9yr0.mjs");
|
|
120
120
|
const sitemapOptions = parseSitemapGenerateArgs(args.slice(2));
|
|
121
121
|
if (sitemapOptions.help) {
|
|
122
122
|
printSitemapGenerateHelp();
|
|
@@ -126,11 +126,11 @@ async function main() {
|
|
|
126
126
|
} else if (parsedCommand.command === "sitemap") {
|
|
127
127
|
console.error(pc.red(`Unknown sitemap subcommand: ${subcommand ?? "(missing)"}`));
|
|
128
128
|
console.error();
|
|
129
|
-
const { printSitemapGenerateHelp } = await import("../sitemap-
|
|
129
|
+
const { printSitemapGenerateHelp } = await import("../sitemap-DFVo9yr0.mjs");
|
|
130
130
|
printSitemapGenerateHelp();
|
|
131
131
|
process.exit(1);
|
|
132
132
|
} else if (parsedCommand.command === "robots" && subcommand === "generate") {
|
|
133
|
-
const { generateRobots, parseRobotsGenerateArgs, printRobotsGenerateHelp } = await import("../robots-
|
|
133
|
+
const { generateRobots, parseRobotsGenerateArgs, printRobotsGenerateHelp } = await import("../robots-CbylLz5o.mjs");
|
|
134
134
|
const robotsOptions = parseRobotsGenerateArgs(args.slice(2));
|
|
135
135
|
if (robotsOptions.help) {
|
|
136
136
|
printRobotsGenerateHelp();
|
|
@@ -140,7 +140,7 @@ async function main() {
|
|
|
140
140
|
} else if (parsedCommand.command === "robots") {
|
|
141
141
|
console.error(pc.red(`Unknown robots subcommand: ${subcommand ?? "(missing)"}`));
|
|
142
142
|
console.error();
|
|
143
|
-
const { printRobotsGenerateHelp } = await import("../robots-
|
|
143
|
+
const { printRobotsGenerateHelp } = await import("../robots-CbylLz5o.mjs");
|
|
144
144
|
printRobotsGenerateHelp();
|
|
145
145
|
process.exit(1);
|
|
146
146
|
} else if (parsedCommand.command === "upgrade") {
|
|
@@ -115,6 +115,34 @@ function extractObjectLiteral(content, key) {
|
|
|
115
115
|
const braceEnd = findBalancedBraceEnd(content, braceStart);
|
|
116
116
|
return braceEnd === -1 ? void 0 : content.slice(braceStart + 1, braceEnd);
|
|
117
117
|
}
|
|
118
|
+
function stripLeadingPropertyTrivia(content) {
|
|
119
|
+
let current = content;
|
|
120
|
+
while (true) {
|
|
121
|
+
const trimmed = current.replace(/^\s+/, "");
|
|
122
|
+
if (trimmed.startsWith("//")) {
|
|
123
|
+
const lineEnd = trimmed.indexOf("\n");
|
|
124
|
+
current = lineEnd === -1 ? "" : trimmed.slice(lineEnd + 1);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (trimmed.startsWith("/*")) {
|
|
128
|
+
const blockEnd = trimmed.indexOf("*/");
|
|
129
|
+
current = blockEnd === -1 ? trimmed : trimmed.slice(blockEnd + 2);
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
return trimmed;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function extractTopLevelObjectLiteral(content, key) {
|
|
136
|
+
const propertyPattern = new RegExp(`^${escapeRegExp(key)}\\s*:\\s*\\{`);
|
|
137
|
+
for (const property of splitTopLevelProperties(content)) {
|
|
138
|
+
const normalizedProperty = stripLeadingPropertyTrivia(property);
|
|
139
|
+
if (!propertyPattern.test(normalizedProperty)) continue;
|
|
140
|
+
const braceStart = normalizedProperty.indexOf("{");
|
|
141
|
+
if (braceStart === -1) return void 0;
|
|
142
|
+
const braceEnd = findBalancedBraceEnd(normalizedProperty, braceStart);
|
|
143
|
+
return braceEnd === -1 ? void 0 : normalizedProperty.slice(braceStart + 1, braceEnd);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
118
146
|
function extractTopLevelConfigObject(content) {
|
|
119
147
|
for (const marker of ["defineDocs(", "export default"]) {
|
|
120
148
|
const markerIndex = content.indexOf(marker);
|
|
@@ -129,7 +157,7 @@ function extractNestedObjectLiteral(content, keys) {
|
|
|
129
157
|
if (keys.length === 0) return void 0;
|
|
130
158
|
let current = extractTopLevelConfigObject(content) ?? content;
|
|
131
159
|
for (const key of keys) {
|
|
132
|
-
const next =
|
|
160
|
+
const next = extractTopLevelObjectLiteral(current, key);
|
|
133
161
|
if (!next) return void 0;
|
|
134
162
|
current = next;
|
|
135
163
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "./reading-time-CbbHNg9V.mjs";
|
|
2
|
-
import "./search-
|
|
2
|
+
import "./search-BL7o2rXk.mjs";
|
|
3
3
|
import { i as DEFAULT_SITEMAP_XML_ROUTE, n as DEFAULT_SITEMAP_MD_ROUTE, r as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, u as resolveDocsSitemapConfig } from "./sitemap-BIQIYMKe.mjs";
|
|
4
|
-
import { C as DEFAULT_MCP_WELL_KNOWN_ROUTE, T as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, a as analyzeDocsRobotsTxt, d as DEFAULT_AGENT_FEEDBACK_ROUTE, g as DEFAULT_LLMS_FULL_TXT_ROUTE, l as resolveDocsRobotsConfig, m as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, n as DEFAULT_ROBOTS_TXT_ROUTE, p as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, w as DEFAULT_SKILL_MD_ROUTE, x as DEFAULT_MCP_PUBLIC_ROUTE, y as DEFAULT_LLMS_TXT_ROUTE } from "./robots-
|
|
4
|
+
import { C as DEFAULT_MCP_WELL_KNOWN_ROUTE, T as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, a as analyzeDocsRobotsTxt, d as DEFAULT_AGENT_FEEDBACK_ROUTE, g as DEFAULT_LLMS_FULL_TXT_ROUTE, l as resolveDocsRobotsConfig, m as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, n as DEFAULT_ROBOTS_TXT_ROUTE, p as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, w as DEFAULT_SKILL_MD_ROUTE, x as DEFAULT_MCP_PUBLIC_ROUTE, y as DEFAULT_LLMS_TXT_ROUTE } from "./robots-D7dvjbuN.mjs";
|
|
5
5
|
import "./sitemap-server-DwEPfk13.mjs";
|
|
6
6
|
import { createFilesystemDocsMcpSource, resolveDocsMcpConfig } from "./mcp.mjs";
|
|
7
7
|
import "./server.mjs";
|
|
8
|
-
import { a as loadProjectEnv, c as readNavTitle, d as readTopLevelStringProperty, f as resolveDocsConfigPath, i as loadDocsConfigModule, o as readBooleanProperty, p as resolveDocsContentDir, r as extractTopLevelConfigObject, t as extractNestedObjectLiteral } from "./config-
|
|
9
|
-
import { inspectAgentCompactionState, scanDocsPageTargets } from "./agent-
|
|
8
|
+
import { a as loadProjectEnv, c as readNavTitle, d as readTopLevelStringProperty, f as resolveDocsConfigPath, i as loadDocsConfigModule, o as readBooleanProperty, p as resolveDocsContentDir, r as extractTopLevelConfigObject, t as extractNestedObjectLiteral } from "./config-UI31_wlO.mjs";
|
|
9
|
+
import { inspectAgentCompactionState, scanDocsPageTargets } from "./agent-DV2Qc7qh.mjs";
|
|
10
10
|
import { t as detectFramework } from "./utils-AmYxHDoz.mjs";
|
|
11
11
|
import { existsSync, lstatSync, readFileSync, readdirSync } from "node:fs";
|
|
12
12
|
import path from "node:path";
|
|
@@ -536,6 +536,12 @@ function percentageScore(score, maxScore) {
|
|
|
536
536
|
if (maxScore <= 0) return 0;
|
|
537
537
|
return Math.round(score / maxScore * 100);
|
|
538
538
|
}
|
|
539
|
+
function normalizedDoctorScore(score, maxScore) {
|
|
540
|
+
return {
|
|
541
|
+
score: percentageScore(score, maxScore),
|
|
542
|
+
maxScore: 100
|
|
543
|
+
};
|
|
544
|
+
}
|
|
539
545
|
function formatStatus(status) {
|
|
540
546
|
if (status === "pass") return pc.green("PASS");
|
|
541
547
|
if (status === "warn") return pc.yellow("WARN");
|
|
@@ -613,7 +619,7 @@ function compactionFreshnessScore(coverage, compactConfigured) {
|
|
|
613
619
|
}
|
|
614
620
|
if (coverage.unknownGeneratedPages > 0) return {
|
|
615
621
|
status: "pass",
|
|
616
|
-
score: compactConfigured ?
|
|
622
|
+
score: compactConfigured ? 5 : 3
|
|
617
623
|
};
|
|
618
624
|
if (coverage.freshGeneratedPages > 0) return {
|
|
619
625
|
status: "pass",
|
|
@@ -839,12 +845,8 @@ async function probeMcpRoute(baseUrl, route) {
|
|
|
839
845
|
ok: false,
|
|
840
846
|
detail: `${route} initialize returned HTTP ${initializeResponse.status}: ${String(initializePayload.error?.message ?? "unknown MCP error")}.`
|
|
841
847
|
};
|
|
842
|
-
const sessionId = initializeResponse.headers.get("mcp-session-id");
|
|
843
|
-
if (
|
|
844
|
-
ok: false,
|
|
845
|
-
detail: `${route} initialize did not return mcp-session-id.`
|
|
846
|
-
};
|
|
847
|
-
await postMcpJson(baseUrl, route, {
|
|
848
|
+
const sessionId = initializeResponse.headers.get("mcp-session-id") ?? void 0;
|
|
849
|
+
if (sessionId) await postMcpJson(baseUrl, route, {
|
|
848
850
|
jsonrpc: "2.0",
|
|
849
851
|
method: "notifications/initialized",
|
|
850
852
|
params: {}
|
|
@@ -856,7 +858,7 @@ async function probeMcpRoute(baseUrl, route) {
|
|
|
856
858
|
params: {}
|
|
857
859
|
}, sessionId);
|
|
858
860
|
const toolsPayload = await parseMcpResponse(toolsResponse);
|
|
859
|
-
await fetchWithTimeout(joinDoctorUrl(baseUrl, route), {
|
|
861
|
+
if (sessionId) await fetchWithTimeout(joinDoctorUrl(baseUrl, route), {
|
|
860
862
|
method: "DELETE",
|
|
861
863
|
headers: {
|
|
862
864
|
"mcp-protocol-version": LATEST_PROTOCOL_VERSION,
|
|
@@ -881,7 +883,7 @@ async function probeMcpRoute(baseUrl, route) {
|
|
|
881
883
|
};
|
|
882
884
|
return {
|
|
883
885
|
ok: true,
|
|
884
|
-
detail: `${route} initialized and exposed ${toolNames.length} MCP tool${toolNames.length === 1 ? "" : "s"}.`
|
|
886
|
+
detail: `${route} initialized ${sessionId ? "with a session" : "statelessly"} and exposed ${toolNames.length} MCP tool${toolNames.length === 1 ? "" : "s"}.`
|
|
885
887
|
};
|
|
886
888
|
} catch (error) {
|
|
887
889
|
return {
|
|
@@ -1092,8 +1094,7 @@ async function inspectAgentReadiness(options = {}) {
|
|
|
1092
1094
|
checks.push(makeCheck("compact", "Agent compaction freshness", compactionResult.status, compactionResult.score, 5, `${compactionCoverage.freshGeneratedPages} fresh, ${compactionCoverage.staleGeneratedPages} stale, ${compactionCoverage.modifiedGeneratedPages} modified, ${compactionCoverage.unknownGeneratedPages} unknown, ${compactionCoverage.tokenBudgetMissingPages} token-budget missing, and ${compactionCoverage.otherMissingPages} other missing page${compactionCoverage.otherMissingPages === 1 ? "" : "s"} across compactable docs pages.` + (compactConfigured ? " agent.compact defaults are configured." : " No agent.compact defaults were found in docs config."), compactionResult.recommendation));
|
|
1093
1095
|
const hosted = options.url ? await buildHostedAgentChecks(options.url, pages) : void 0;
|
|
1094
1096
|
if (hosted) checks.push(...hosted.checks);
|
|
1095
|
-
const score = checks.reduce((total, check) => total + check.score, 0);
|
|
1096
|
-
const maxScore = checks.reduce((total, check) => total + check.maxScore, 0);
|
|
1097
|
+
const { score, maxScore } = normalizedDoctorScore(checks.reduce((total, check) => total + check.score, 0), checks.reduce((total, check) => total + check.maxScore, 0));
|
|
1097
1098
|
return {
|
|
1098
1099
|
mode: "agent",
|
|
1099
1100
|
framework,
|
|
@@ -1103,7 +1104,7 @@ async function inspectAgentReadiness(options = {}) {
|
|
|
1103
1104
|
url: hosted?.baseUrl,
|
|
1104
1105
|
score,
|
|
1105
1106
|
maxScore,
|
|
1106
|
-
grade: gradeForAgentScore(
|
|
1107
|
+
grade: gradeForAgentScore(score),
|
|
1107
1108
|
checks,
|
|
1108
1109
|
coverage,
|
|
1109
1110
|
recommendations: checks.map((check) => check.recommendation).filter((recommendation) => Boolean(recommendation)).slice(0, 3)
|
|
@@ -1174,8 +1175,7 @@ async function inspectHumanReadiness(options = {}) {
|
|
|
1174
1175
|
checks.push(makeCheck("trust", "Trust signals", trustScore === 10 ? "pass" : "warn", trustScore, 10, githubEnabled && lastUpdatedEnabled ? "Edit links and last-updated metadata are configured." : githubEnabled ? "Edit links are configured, but last-updated metadata is not enabled." : lastUpdatedEnabled ? "Last-updated metadata is enabled, but edit links are not configured." : "Edit links and last-updated metadata are not configured.", trustScore === 10 ? void 0 : "Configure GitHub edit links and/or lastUpdated so readers can trust freshness and find the source of truth faster."));
|
|
1175
1176
|
checks.push(humanFeedbackEnabled ? makeCheck("feedback", "Reader feedback", "pass", 5, 5, "Built-in page feedback is enabled for the docs site.") : makeCheck("feedback", "Reader feedback", "warn", 0, 5, "Built-in page feedback is not enabled.", "Enable feedback if you want readers to leave quick page-level quality signals without opening an issue."));
|
|
1176
1177
|
checks.push(readingTimeEnabled ? makeCheck("reading-time", "Reading-time cues", "pass", 5, 5, "Reading time is configured for the docs site.") : makeCheck("reading-time", "Reading-time cues", "warn", 0, 5, "Reading time is not enabled.", "Enable readingTime if you want readers to get a quick effort estimate before they dive into longer pages."));
|
|
1177
|
-
const score = checks.reduce((total, check) => total + check.score, 0);
|
|
1178
|
-
const maxScore = checks.reduce((total, check) => total + check.maxScore, 0);
|
|
1178
|
+
const { score, maxScore } = normalizedDoctorScore(checks.reduce((total, check) => total + check.score, 0), checks.reduce((total, check) => total + check.maxScore, 0));
|
|
1179
1179
|
return {
|
|
1180
1180
|
mode: "human",
|
|
1181
1181
|
framework,
|
|
@@ -1184,7 +1184,7 @@ async function inspectHumanReadiness(options = {}) {
|
|
|
1184
1184
|
contentDir,
|
|
1185
1185
|
score,
|
|
1186
1186
|
maxScore,
|
|
1187
|
-
grade: gradeForHumanScore(
|
|
1187
|
+
grade: gradeForHumanScore(score),
|
|
1188
1188
|
checks,
|
|
1189
1189
|
coverage,
|
|
1190
1190
|
recommendations: checks.map((check) => check.recommendation).filter((recommendation) => Boolean(recommendation)).slice(0, 3)
|
|
@@ -1193,7 +1193,7 @@ async function inspectHumanReadiness(options = {}) {
|
|
|
1193
1193
|
function printAgentDoctorReport(report) {
|
|
1194
1194
|
console.log(`${pc.bold("@farming-labs/docs doctor")} ${pc.dim("—")} ${pc.bold("agent")}`);
|
|
1195
1195
|
console.log();
|
|
1196
|
-
console.log(`${pc.bold("Score:")} ${pc.cyan(`${report.score}
|
|
1196
|
+
console.log(`${pc.bold("Score:")} ${pc.cyan(`${report.score}%`)} ${pc.dim(`(${report.grade})`)}`);
|
|
1197
1197
|
console.log(`${pc.bold("Framework:")} ${report.framework} ${pc.dim("•")} ${pc.bold("Entry:")} ${report.entry ?? "docs"} ${pc.dim("•")} ${pc.bold("Content:")} ${report.contentDir ?? "-"}`);
|
|
1198
1198
|
if (report.url) console.log(`${pc.bold("Hosted URL:")} ${report.url}`);
|
|
1199
1199
|
console.log(`${pc.bold("Explicit agent-friendly pages:")} ${report.coverage.explicitPages}/${report.coverage.totalPages} pages ${pc.dim(`(${report.coverage.explicitCoverage}%)`)}`);
|
|
@@ -1214,7 +1214,7 @@ function printAgentDoctorReport(report) {
|
|
|
1214
1214
|
function printHumanDoctorReport(report) {
|
|
1215
1215
|
console.log(`${pc.bold("@farming-labs/docs doctor")} ${pc.dim("—")} ${pc.bold("site")}`);
|
|
1216
1216
|
console.log();
|
|
1217
|
-
console.log(`${pc.bold("Score:")} ${pc.cyan(`${report.score}
|
|
1217
|
+
console.log(`${pc.bold("Score:")} ${pc.cyan(`${report.score}%`)} ${pc.dim(`(${report.grade})`)}`);
|
|
1218
1218
|
console.log(`${pc.bold("Framework:")} ${report.framework} ${pc.dim("•")} ${pc.bold("Entry:")} ${report.entry ?? "docs"} ${pc.dim("•")} ${pc.bold("Content:")} ${report.contentDir ?? "-"}`);
|
|
1219
1219
|
console.log(`${pc.bold("Described pages:")} ${report.coverage.describedPages}/${report.coverage.totalPages} pages ${pc.dim(`(${report.coverage.descriptionCoverage}%)`)}`);
|
|
1220
1220
|
console.log();
|
package/dist/index.d.mts
CHANGED
|
@@ -315,6 +315,9 @@ interface DocsMarkdownPage {
|
|
|
315
315
|
agentFallbackContent?: string;
|
|
316
316
|
agentFallbackRawContent?: string;
|
|
317
317
|
}
|
|
318
|
+
interface DocsMarkdownDocumentOptions {
|
|
319
|
+
llms?: boolean | DocsLlmsDiscoveryConfig | LlmsTxtConfig;
|
|
320
|
+
}
|
|
318
321
|
interface DocsMarkdownNotFoundOptions {
|
|
319
322
|
entry?: string;
|
|
320
323
|
requestedPath: string;
|
|
@@ -351,8 +354,8 @@ declare function renderDocsMarkdownNotFound({
|
|
|
351
354
|
sitemap
|
|
352
355
|
}: DocsMarkdownNotFoundOptions): string;
|
|
353
356
|
declare function findDocsMarkdownPage<T extends DocsMarkdownPage>(entry: string, pages: T[], requestedPath: string): T | null;
|
|
354
|
-
declare function renderDocsMarkdownDocument(page: DocsMcpPage | DocsSearchSourcePage): string;
|
|
355
|
-
declare function renderDocsMarkdownDocument(page: DocsMarkdownPage): string;
|
|
357
|
+
declare function renderDocsMarkdownDocument(page: DocsMcpPage | DocsSearchSourcePage, options?: DocsMarkdownDocumentOptions): string;
|
|
358
|
+
declare function renderDocsMarkdownDocument(page: DocsMarkdownPage, options?: DocsMarkdownDocumentOptions): string;
|
|
356
359
|
declare function renderDocsSkillDocument({
|
|
357
360
|
origin,
|
|
358
361
|
entry,
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as extendTheme, a as resolveReadingTimeOptions, b as defineDocs, c as buildPageTwitter, d as resolveOGImage, f as resolveTitle, g as createTheme, h as resolveDocsPath, i as resolveReadingTimeFromSource, l as renderDocsPageStructuredDataJson, m as resolveDocsLocale, n as resolvePageReadingTime, o as buildDocsPageStructuredData, p as resolveDocsI18n, r as resolveReadingTimeFromContent, s as buildPageOpenGraph, t as estimateReadingTimeMinutes, u as resolveDocsMetadataBaseUrl, v as deepMerge, y as resolveChangelogConfig } from "./reading-time-CbbHNg9V.mjs";
|
|
2
|
-
import { A as resolveDocsAnalyticsConfig, C as resolveSidebarFolderIndexBehaviorForPath, D as emitDocsAgentTraceEvent, E as createDocsAgentTraceId, M as createDocsCloudAnalytics, O as emitDocsAnalyticsEvent, S as resolveSidebarFolderIndexBehavior, T as createDocsAgentTraceContext, _ as parseGeneratedAgentDocument, a as createMcpSearchAdapter, b as applySidebarFolderIndexBehavior, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, f as resolveSearchRequestConfig, g as normalizeGeneratedAgentContent, h as hashGeneratedAgentContent, i as createCustomSearchAdapter, j as resolveDocsObservabilityConfig, k as emitDocsObservabilityEvent, l as inferDocsAskAIPackageHints, m as GENERATED_AGENT_PROVENANCE_VERSION, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, p as GENERATED_AGENT_PROVENANCE_MARKER, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch, v as serializeGeneratedAgentDocument, w as DOCS_AGENT_TRACE_EVENT_TYPES, x as resolvePageSidebarFolderIndexBehavior, y as stripGeneratedAgentProvenance } from "./search-
|
|
2
|
+
import { A as resolveDocsAnalyticsConfig, C as resolveSidebarFolderIndexBehaviorForPath, D as emitDocsAgentTraceEvent, E as createDocsAgentTraceId, M as createDocsCloudAnalytics, O as emitDocsAnalyticsEvent, S as resolveSidebarFolderIndexBehavior, T as createDocsAgentTraceContext, _ as parseGeneratedAgentDocument, a as createMcpSearchAdapter, b as applySidebarFolderIndexBehavior, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, f as resolveSearchRequestConfig, g as normalizeGeneratedAgentContent, h as hashGeneratedAgentContent, i as createCustomSearchAdapter, j as resolveDocsObservabilityConfig, k as emitDocsObservabilityEvent, l as inferDocsAskAIPackageHints, m as GENERATED_AGENT_PROVENANCE_VERSION, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, p as GENERATED_AGENT_PROVENANCE_MARKER, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch, v as serializeGeneratedAgentDocument, w as DOCS_AGENT_TRACE_EVENT_TYPES, x as resolvePageSidebarFolderIndexBehavior, y as stripGeneratedAgentProvenance } from "./search-BL7o2rXk.mjs";
|
|
3
3
|
import { n as renderDocsRelatedMarkdownLines, t as normalizeDocsRelated } from "./related-BNj_NdHq.mjs";
|
|
4
4
|
import { a as buildDocsSitemapManifest, c as renderDocsSitemapMarkdown, d as resolveDocsSitemapPageLastmod, f as resolveDocsSitemapRequest, i as DEFAULT_SITEMAP_XML_ROUTE, l as renderDocsSitemapXml, n as DEFAULT_SITEMAP_MD_ROUTE, o as createDocsSitemapResponse, p as toDocsSitemapMarkdownUrl, r as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, s as readDocsSitemapManifestFromContentMap, t as DEFAULT_SITEMAP_MANIFEST_PATH, u as resolveDocsSitemapConfig } from "./sitemap-BIQIYMKe.mjs";
|
|
5
|
-
import { A as getDocsMarkdownVaryHeader, B as renderDocsMarkdownDocument, C as DEFAULT_MCP_WELL_KNOWN_ROUTE, D as buildDocsAgentDiscoverySpec, E as DOCS_MARKDOWN_SIGNATURE_AGENT_HEADER, F as isDocsSkillRequest, G as resolveDocsLlmsTxtRequest, H as renderDocsSkillDocument, I as matchesDocsLlmsTxtSection, J as resolveDocsSkillFormat, K as resolveDocsLlmsTxtSections, L as normalizeDocsPathSegment, M as isDocsAgentDiscoveryRequest, N as isDocsMcpRequest, O as findDocsMarkdownPage, P as isDocsPublicGetRequest, R as normalizeDocsUrlPath, S as DEFAULT_MCP_ROUTE, T as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, U as resolveDocsAgentMdxContent, V as renderDocsMarkdownNotFound, W as resolveDocsLlmsTxtFormat, X as toDocsMarkdownUrl, Y as selectDocsLlmsTxtContent, _ as DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, a as analyzeDocsRobotsTxt, b as DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, c as renderDocsRobotsTxt, d as DEFAULT_AGENT_FEEDBACK_ROUTE, f as DEFAULT_AGENT_SPEC_ROUTE, g as DEFAULT_LLMS_FULL_TXT_ROUTE, h as DEFAULT_DOCS_API_ROUTE, i as DOCS_ROBOTS_GENERATED_BLOCK_START, j as hasDocsMarkdownSignatureAgent, k as getDocsLlmsTxtMaxCharsIssue, l as resolveDocsRobotsConfig, m as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, n as DEFAULT_ROBOTS_TXT_ROUTE, o as getDocsRobotsAllowRoutes, p as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, q as resolveDocsMarkdownRequest, r as DOCS_ROBOTS_GENERATED_BLOCK_END, s as renderDocsRobotsGeneratedBlock, t as DEFAULT_DOCS_AI_ROBOTS_USER_AGENTS, u as upsertDocsRobotsGeneratedBlock, v as DEFAULT_LLMS_TXT_MAX_CHARS, w as DEFAULT_SKILL_MD_ROUTE, x as DEFAULT_MCP_PUBLIC_ROUTE, y as DEFAULT_LLMS_TXT_ROUTE, z as renderDocsLlmsTxt } from "./robots-
|
|
5
|
+
import { A as getDocsMarkdownVaryHeader, B as renderDocsMarkdownDocument, C as DEFAULT_MCP_WELL_KNOWN_ROUTE, D as buildDocsAgentDiscoverySpec, E as DOCS_MARKDOWN_SIGNATURE_AGENT_HEADER, F as isDocsSkillRequest, G as resolveDocsLlmsTxtRequest, H as renderDocsSkillDocument, I as matchesDocsLlmsTxtSection, J as resolveDocsSkillFormat, K as resolveDocsLlmsTxtSections, L as normalizeDocsPathSegment, M as isDocsAgentDiscoveryRequest, N as isDocsMcpRequest, O as findDocsMarkdownPage, P as isDocsPublicGetRequest, R as normalizeDocsUrlPath, S as DEFAULT_MCP_ROUTE, T as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, U as resolveDocsAgentMdxContent, V as renderDocsMarkdownNotFound, W as resolveDocsLlmsTxtFormat, X as toDocsMarkdownUrl, Y as selectDocsLlmsTxtContent, _ as DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, a as analyzeDocsRobotsTxt, b as DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, c as renderDocsRobotsTxt, d as DEFAULT_AGENT_FEEDBACK_ROUTE, f as DEFAULT_AGENT_SPEC_ROUTE, g as DEFAULT_LLMS_FULL_TXT_ROUTE, h as DEFAULT_DOCS_API_ROUTE, i as DOCS_ROBOTS_GENERATED_BLOCK_START, j as hasDocsMarkdownSignatureAgent, k as getDocsLlmsTxtMaxCharsIssue, l as resolveDocsRobotsConfig, m as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, n as DEFAULT_ROBOTS_TXT_ROUTE, o as getDocsRobotsAllowRoutes, p as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, q as resolveDocsMarkdownRequest, r as DOCS_ROBOTS_GENERATED_BLOCK_END, s as renderDocsRobotsGeneratedBlock, t as DEFAULT_DOCS_AI_ROBOTS_USER_AGENTS, u as upsertDocsRobotsGeneratedBlock, v as DEFAULT_LLMS_TXT_MAX_CHARS, w as DEFAULT_SKILL_MD_ROUTE, x as DEFAULT_MCP_PUBLIC_ROUTE, y as DEFAULT_LLMS_TXT_ROUTE, z as renderDocsLlmsTxt } from "./robots-D7dvjbuN.mjs";
|
|
6
6
|
|
|
7
7
|
export { DEFAULT_AGENT_FEEDBACK_ROUTE, DEFAULT_AGENT_SPEC_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, DEFAULT_DOCS_AI_ROBOTS_USER_AGENTS, DEFAULT_DOCS_API_ROUTE, DEFAULT_LLMS_FULL_TXT_ROUTE, DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, DEFAULT_LLMS_TXT_MAX_CHARS, DEFAULT_LLMS_TXT_ROUTE, DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, DEFAULT_MCP_PUBLIC_ROUTE, DEFAULT_MCP_ROUTE, DEFAULT_MCP_WELL_KNOWN_ROUTE, DEFAULT_ROBOTS_TXT_ROUTE, DEFAULT_SITEMAP_MANIFEST_PATH, DEFAULT_SITEMAP_MD_ROUTE, DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, DEFAULT_SITEMAP_XML_ROUTE, DEFAULT_SKILL_MD_ROUTE, DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, DOCS_AGENT_TRACE_EVENT_TYPES, DOCS_MARKDOWN_SIGNATURE_AGENT_HEADER, DOCS_ROBOTS_GENERATED_BLOCK_END, DOCS_ROBOTS_GENERATED_BLOCK_START, GENERATED_AGENT_PROVENANCE_MARKER, GENERATED_AGENT_PROVENANCE_VERSION, analyzeDocsRobotsTxt, applySidebarFolderIndexBehavior, buildDocsAgentDiscoverySpec, buildDocsAskAIContext, buildDocsPageStructuredData, buildDocsSearchDocuments, buildDocsSitemapManifest, buildPageOpenGraph, buildPageTwitter, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsAgentTraceContext, createDocsAgentTraceId, createDocsCloudAnalytics, createDocsSitemapResponse, createMcpSearchAdapter, createSimpleSearchAdapter, createTheme, createTypesenseSearchAdapter, deepMerge, defineDocs, emitDocsAgentTraceEvent, emitDocsAnalyticsEvent, emitDocsObservabilityEvent, estimateReadingTimeMinutes, extendTheme, findDocsMarkdownPage, formatDocsAskAIPackageHints, getDocsLlmsTxtMaxCharsIssue, getDocsMarkdownVaryHeader, getDocsRobotsAllowRoutes, hasDocsMarkdownSignatureAgent, hashGeneratedAgentContent, inferDocsAskAIPackageHints, isDocsAgentDiscoveryRequest, isDocsMcpRequest, isDocsPublicGetRequest, isDocsSkillRequest, matchesDocsLlmsTxtSection, normalizeDocsPathSegment, normalizeDocsRelated, normalizeDocsUrlPath, normalizeGeneratedAgentContent, parseGeneratedAgentDocument, performDocsSearch, readDocsSitemapManifestFromContentMap, renderDocsLlmsTxt, renderDocsMarkdownDocument, renderDocsMarkdownNotFound, renderDocsPageStructuredDataJson, renderDocsRelatedMarkdownLines, renderDocsRobotsGeneratedBlock, renderDocsRobotsTxt, renderDocsSitemapMarkdown, renderDocsSitemapXml, renderDocsSkillDocument, resolveAskAISearchRequestConfig, resolveChangelogConfig, resolveDocsAgentMdxContent, resolveDocsAnalyticsConfig, resolveDocsI18n, resolveDocsLlmsTxtFormat, resolveDocsLlmsTxtRequest, resolveDocsLlmsTxtSections, resolveDocsLocale, resolveDocsMarkdownRequest, resolveDocsMetadataBaseUrl, resolveDocsObservabilityConfig, resolveDocsPath, resolveDocsRobotsConfig, resolveDocsSitemapConfig, resolveDocsSitemapPageLastmod, resolveDocsSitemapRequest, resolveDocsSkillFormat, resolveOGImage, resolvePageReadingTime, resolvePageSidebarFolderIndexBehavior, resolveReadingTimeFromContent, resolveReadingTimeFromSource, resolveReadingTimeOptions, resolveSearchRequestConfig, resolveSidebarFolderIndexBehavior, resolveSidebarFolderIndexBehaviorForPath, resolveTitle, selectDocsLlmsTxtContent, serializeGeneratedAgentDocument, stripGeneratedAgentProvenance, toDocsMarkdownUrl, toDocsSitemapMarkdownUrl, upsertDocsRobotsGeneratedBlock };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./search-
|
|
1
|
+
import "./search-BL7o2rXk.mjs";
|
|
2
2
|
import "./sitemap-server-DwEPfk13.mjs";
|
|
3
3
|
import { createFilesystemDocsMcpSource, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
|
|
4
4
|
import "./server.mjs";
|
|
5
|
-
import { c as readNavTitle, f as resolveDocsConfigPath, n as extractObjectLiteral, o as readBooleanProperty, p as resolveDocsContentDir, u as readStringProperty } from "./config-
|
|
5
|
+
import { c as readNavTitle, f as resolveDocsConfigPath, n as extractObjectLiteral, o as readBooleanProperty, p as resolveDocsContentDir, u as readStringProperty } from "./config-UI31_wlO.mjs";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
7
|
|
|
8
8
|
//#region src/cli/mcp.ts
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { D as emitDocsAgentTraceEvent, E as createDocsAgentTraceId, O as emitDocsAnalyticsEvent, T as createDocsAgentTraceContext, u as performDocsSearch, x as resolvePageSidebarFolderIndexBehavior, y as stripGeneratedAgentProvenance } from "./search-
|
|
1
|
+
import { D as emitDocsAgentTraceEvent, E as createDocsAgentTraceId, O as emitDocsAnalyticsEvent, T as createDocsAgentTraceContext, u as performDocsSearch, x as resolvePageSidebarFolderIndexBehavior, y as stripGeneratedAgentProvenance } from "./search-BL7o2rXk.mjs";
|
|
2
2
|
import { n as renderDocsRelatedMarkdownLines, t as normalizeDocsRelated } from "./related-BNj_NdHq.mjs";
|
|
3
3
|
import matter from "gray-matter";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
|
-
import { randomUUID } from "node:crypto";
|
|
7
6
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
7
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
9
8
|
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
@@ -522,23 +521,9 @@ function createDocsMcpHttpHandler(options) {
|
|
|
522
521
|
}),
|
|
523
522
|
DELETE: async () => createJsonErrorResponse(404, disabledMessage)
|
|
524
523
|
};
|
|
525
|
-
|
|
526
|
-
async function createSession() {
|
|
524
|
+
async function createStatelessTransport() {
|
|
527
525
|
const server = await createDocsMcpServer(options);
|
|
528
|
-
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
529
|
-
sessionIdGenerator: () => randomUUID(),
|
|
530
|
-
onsessioninitialized(sessionId) {
|
|
531
|
-
sessions.set(sessionId, {
|
|
532
|
-
server,
|
|
533
|
-
transport
|
|
534
|
-
});
|
|
535
|
-
},
|
|
536
|
-
async onsessionclosed(sessionId) {
|
|
537
|
-
const session = sessions.get(sessionId);
|
|
538
|
-
sessions.delete(sessionId);
|
|
539
|
-
await session?.server.close().catch(() => void 0);
|
|
540
|
-
}
|
|
541
|
-
});
|
|
526
|
+
const transport = new WebStandardStreamableHTTPServerTransport({ sessionIdGenerator: void 0 });
|
|
542
527
|
await server.connect(transport);
|
|
543
528
|
return {
|
|
544
529
|
server,
|
|
@@ -549,7 +534,6 @@ function createDocsMcpHttpHandler(options) {
|
|
|
549
534
|
const url = new URL(request.url);
|
|
550
535
|
const method = request.method.toUpperCase();
|
|
551
536
|
const sessionId = request.headers.get("mcp-session-id") ?? request.headers.get("Mcp-Session-Id");
|
|
552
|
-
const existing = sessionId ? sessions.get(sessionId) : void 0;
|
|
553
537
|
let parsedBody;
|
|
554
538
|
let bodyParseFailed = false;
|
|
555
539
|
if (method === "POST") try {
|
|
@@ -566,26 +550,17 @@ function createDocsMcpHttpHandler(options) {
|
|
|
566
550
|
path: url.pathname,
|
|
567
551
|
properties: {
|
|
568
552
|
method,
|
|
569
|
-
hasSession: Boolean(
|
|
553
|
+
hasSession: Boolean(sessionId),
|
|
554
|
+
stateless: true,
|
|
570
555
|
initialize: Boolean(initializeRequest)
|
|
571
556
|
}
|
|
572
557
|
});
|
|
573
|
-
if (
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
if (!initializeRequest) return createJsonRpcErrorResponse({
|
|
580
|
-
status: sessionId || method === "DELETE" ? 404 : 400,
|
|
581
|
-
code: sessionId ? -32001 : -32e3,
|
|
582
|
-
message: sessionId ? "Session not found. Reinitialize the MCP client before calling docs tools." : "MCP session not initialized. Start with an initialize request against this endpoint.",
|
|
583
|
-
id: readJsonRpcId(parsedBody),
|
|
584
|
-
data: { reason: sessionId ? "session_not_found" : "session_not_initialized" }
|
|
585
|
-
});
|
|
586
|
-
return (await createSession()).transport.handleRequest(request, parsedBody === void 0 ? void 0 : { parsedBody });
|
|
587
|
-
}
|
|
588
|
-
return existing.transport.handleRequest(request, parsedBody === void 0 ? void 0 : { parsedBody });
|
|
558
|
+
if (method === "POST" && bodyParseFailed) return createJsonRpcErrorResponse({
|
|
559
|
+
status: 400,
|
|
560
|
+
code: -32700,
|
|
561
|
+
message: "Parse error: Invalid JSON"
|
|
562
|
+
});
|
|
563
|
+
return (await createStatelessTransport()).transport.handleRequest(request, parsedBody === void 0 ? void 0 : { parsedBody });
|
|
589
564
|
}
|
|
590
565
|
return {
|
|
591
566
|
GET: async ({ request }) => handle(request),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as DOCS_ROBOTS_GENERATED_BLOCK_START, l as resolveDocsRobotsConfig, r as DOCS_ROBOTS_GENERATED_BLOCK_END, s as renderDocsRobotsGeneratedBlock, u as upsertDocsRobotsGeneratedBlock } from "./robots-
|
|
2
|
-
import { d as readTopLevelStringProperty, f as resolveDocsConfigPath, i as loadDocsConfigModule, o as readBooleanProperty, t as extractNestedObjectLiteral, u as readStringProperty } from "./config-
|
|
1
|
+
import { i as DOCS_ROBOTS_GENERATED_BLOCK_START, l as resolveDocsRobotsConfig, r as DOCS_ROBOTS_GENERATED_BLOCK_END, s as renderDocsRobotsGeneratedBlock, u as upsertDocsRobotsGeneratedBlock } from "./robots-D7dvjbuN.mjs";
|
|
2
|
+
import { d as readTopLevelStringProperty, f as resolveDocsConfigPath, i as loadDocsConfigModule, o as readBooleanProperty, t as extractNestedObjectLiteral, u as readStringProperty } from "./config-UI31_wlO.mjs";
|
|
3
3
|
import { t as detectFramework } from "./utils-AmYxHDoz.mjs";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -19,6 +19,7 @@ const DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE = "/.well-known/skill.md";
|
|
|
19
19
|
const DEFAULT_AGENT_DISCOVERY_ROBOTS_TXT_ROUTE = "/robots.txt";
|
|
20
20
|
const DEFAULT_AGENT_FEEDBACK_ROUTE = "/api/docs/agent/feedback";
|
|
21
21
|
const DOCS_MARKDOWN_SIGNATURE_AGENT_HEADER = "Signature-Agent";
|
|
22
|
+
const DOCS_LLMS_TXT_DIRECTIVE_LINE = "LLM index: /llms.txt";
|
|
22
23
|
function normalizeDocsPathSegment(value) {
|
|
23
24
|
return value.replace(/^\/+|\/+$/g, "");
|
|
24
25
|
}
|
|
@@ -328,10 +329,16 @@ function findDocsMarkdownPage(entry, pages, requestedPath) {
|
|
|
328
329
|
for (const page of pages) if (page.slug !== void 0 && normalizeDocsPathSegment(page.slug) === normalizedSlug) return page;
|
|
329
330
|
return null;
|
|
330
331
|
}
|
|
331
|
-
function
|
|
332
|
+
function shouldRenderLlmsDirective(options) {
|
|
333
|
+
if (options?.llms === false) return false;
|
|
334
|
+
if (options?.llms && typeof options.llms === "object" && options.llms.enabled === false) return false;
|
|
335
|
+
return true;
|
|
336
|
+
}
|
|
337
|
+
function renderDocsMarkdownDocument(page, options) {
|
|
332
338
|
if (page.agentRawContent !== void 0) return page.agentRawContent;
|
|
333
339
|
const relatedLines = renderDocsRelatedMarkdownLines(page.related);
|
|
334
340
|
const lines = [`# ${page.title}`, `URL: ${page.url}`];
|
|
341
|
+
if (shouldRenderLlmsDirective(options)) lines.push(DOCS_LLMS_TXT_DIRECTIVE_LINE);
|
|
335
342
|
if (page.description) lines.push(`Description: ${page.description}`);
|
|
336
343
|
lines.push(...relatedLines);
|
|
337
344
|
lines.push("", page.agentFallbackRawContent ?? page.rawContent ?? page.content);
|
|
@@ -1112,8 +1112,7 @@ function createMcpSearchAdapter(config) {
|
|
|
1112
1112
|
const initializePayload = await readMcpResponsePayload(initializeResponse);
|
|
1113
1113
|
ensureOk(initializeResponse, "MCP search initialization failed");
|
|
1114
1114
|
ensureJsonRpcOk(initializePayload, "MCP search initialization failed");
|
|
1115
|
-
const sessionId = initializeResponse.headers.get("mcp-session-id");
|
|
1116
|
-
if (!sessionId) throw new Error("MCP search endpoint did not return an mcp-session-id header.");
|
|
1115
|
+
const sessionId = initializeResponse.headers.get("mcp-session-id") ?? void 0;
|
|
1117
1116
|
try {
|
|
1118
1117
|
const searchResponse = await fetch(endpoint, {
|
|
1119
1118
|
method: "POST",
|
|
@@ -1122,7 +1121,7 @@ function createMcpSearchAdapter(config) {
|
|
|
1122
1121
|
"Content-Type": "application/json",
|
|
1123
1122
|
accept: "application/json, text/event-stream",
|
|
1124
1123
|
"mcp-protocol-version": protocolVersion,
|
|
1125
|
-
"mcp-session-id": sessionId
|
|
1124
|
+
...sessionId ? { "mcp-session-id": sessionId } : {}
|
|
1126
1125
|
},
|
|
1127
1126
|
body: JSON.stringify({
|
|
1128
1127
|
jsonrpc: "2.0",
|
|
@@ -1146,7 +1145,7 @@ function createMcpSearchAdapter(config) {
|
|
|
1146
1145
|
const parsed = JSON.parse(resultText);
|
|
1147
1146
|
return (Array.isArray(parsed) ? parsed : Array.isArray(parsed.results) ? parsed.results : Array.isArray(parsed.pages) ? parsed.pages : []).map(mapMcpSearchResult).filter((result) => Boolean(result));
|
|
1148
1147
|
} finally {
|
|
1149
|
-
await fetch(endpoint, {
|
|
1148
|
+
if (sessionId) await fetch(endpoint, {
|
|
1150
1149
|
method: "DELETE",
|
|
1151
1150
|
headers: {
|
|
1152
1151
|
...baseHeaders,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as buildDocsSearchDocuments, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter } from "./search-
|
|
1
|
+
import { n as buildDocsSearchDocuments, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter } from "./search-BL7o2rXk.mjs";
|
|
2
2
|
import "./sitemap-server-DwEPfk13.mjs";
|
|
3
3
|
import { createFilesystemDocsMcpSource } from "./mcp.mjs";
|
|
4
4
|
import "./server.mjs";
|
|
5
|
-
import { a as loadProjectEnv, d as readTopLevelStringProperty, f as resolveDocsConfigPath, p as resolveDocsContentDir } from "./config-
|
|
5
|
+
import { a as loadProjectEnv, d as readTopLevelStringProperty, f as resolveDocsConfigPath, p as resolveDocsContentDir } from "./config-UI31_wlO.mjs";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
7
|
import pc from "picocolors";
|
|
8
8
|
|
package/dist/server.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as resolveDocsAnalyticsConfig, D as emitDocsAgentTraceEvent, E as createDocsAgentTraceId, M as createDocsCloudAnalytics, O as emitDocsAnalyticsEvent, T as createDocsAgentTraceContext, a as createMcpSearchAdapter, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, f as resolveSearchRequestConfig, i as createCustomSearchAdapter, j as resolveDocsObservabilityConfig, k as emitDocsObservabilityEvent, l as inferDocsAskAIPackageHints, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch, w as DOCS_AGENT_TRACE_EVENT_TYPES } from "./search-
|
|
1
|
+
import { A as resolveDocsAnalyticsConfig, D as emitDocsAgentTraceEvent, E as createDocsAgentTraceId, M as createDocsCloudAnalytics, O as emitDocsAnalyticsEvent, T as createDocsAgentTraceContext, a as createMcpSearchAdapter, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, f as resolveSearchRequestConfig, i as createCustomSearchAdapter, j as resolveDocsObservabilityConfig, k as emitDocsObservabilityEvent, l as inferDocsAskAIPackageHints, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch, w as DOCS_AGENT_TRACE_EVENT_TYPES } from "./search-BL7o2rXk.mjs";
|
|
2
2
|
import { a as buildDocsSitemapManifest, c as renderDocsSitemapMarkdown, d as resolveDocsSitemapPageLastmod, f as resolveDocsSitemapRequest, i as DEFAULT_SITEMAP_XML_ROUTE, l as renderDocsSitemapXml, n as DEFAULT_SITEMAP_MD_ROUTE, o as createDocsSitemapResponse, p as toDocsSitemapMarkdownUrl, r as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, s as readDocsSitemapManifestFromContentMap, t as DEFAULT_SITEMAP_MANIFEST_PATH, u as resolveDocsSitemapConfig } from "./sitemap-BIQIYMKe.mjs";
|
|
3
3
|
import { _ as resolveApiReferenceRenderer, a as resolvePromptProviderChoices, c as serializeDocsIconRegistry, d as buildApiReferenceHtmlDocumentAsync, f as buildApiReferenceOpenApiDocument, g as resolveApiReferenceConfig, h as buildApiReferenceScalarCss, i as parsePromptStringArray, l as serializeOpenDocsProviders, m as buildApiReferencePageTitle, n as DEFAULT_PROMPT_PROVIDER_TEMPLATES, o as sanitizePromptText, p as buildApiReferenceOpenApiDocumentAsync, r as normalizePromptProviderName, s as serializeDocsIcon, t as readDocsSitemapManifest, u as buildApiReferenceHtmlDocument } from "./sitemap-server-DwEPfk13.mjs";
|
|
4
4
|
import { createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./search-
|
|
1
|
+
import "./search-BL7o2rXk.mjs";
|
|
2
2
|
import { a as buildDocsSitemapManifest, c as renderDocsSitemapMarkdown, l as renderDocsSitemapXml, u as resolveDocsSitemapConfig } from "./sitemap-BIQIYMKe.mjs";
|
|
3
3
|
import "./sitemap-server-DwEPfk13.mjs";
|
|
4
4
|
import { createFilesystemDocsMcpSource } from "./mcp.mjs";
|
|
5
5
|
import "./server.mjs";
|
|
6
|
-
import { c as readNavTitle, d as readTopLevelStringProperty, f as resolveDocsConfigPath, i as loadDocsConfigModule, o as readBooleanProperty, p as resolveDocsContentDir, t as extractNestedObjectLiteral, u as readStringProperty } from "./config-
|
|
6
|
+
import { c as readNavTitle, d as readTopLevelStringProperty, f as resolveDocsConfigPath, i as loadDocsConfigModule, o as readBooleanProperty, p as resolveDocsContentDir, t as extractNestedObjectLiteral, u as readStringProperty } from "./config-UI31_wlO.mjs";
|
|
7
7
|
import { t as detectFramework } from "./utils-AmYxHDoz.mjs";
|
|
8
8
|
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
9
9
|
import path from "node:path";
|