@farming-labs/docs 0.2.60 → 0.2.62

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.
Files changed (51) hide show
  1. package/README.md +1 -1
  2. package/package.json +11 -1
  3. package/dist/agent-BFqyqEnC.mjs +0 -4547
  4. package/dist/agent-DlxriaTs.mjs +0 -624
  5. package/dist/agent-evals-kJs2Y9xR.mjs +0 -2144
  6. package/dist/agent-export-BgUaiW8f.mjs +0 -869
  7. package/dist/agent-scope-CCaIY1aK.mjs +0 -283
  8. package/dist/agents-Djh-HXih.mjs +0 -219
  9. package/dist/analytics-Bx44lg6d.mjs +0 -177
  10. package/dist/cli/index.d.mts +0 -15
  11. package/dist/cli/index.mjs +0 -452
  12. package/dist/client/react.d.mts +0 -45
  13. package/dist/client/react.mjs +0 -223
  14. package/dist/cloud-BH_sHX64.mjs +0 -1615
  15. package/dist/cloud-analytics-CSyFE6SS.mjs +0 -132
  16. package/dist/cloud-ask-ai-B2WnG4fF.d.mts +0 -23
  17. package/dist/cloud-ask-ai-hnJfj8-X.mjs +0 -382
  18. package/dist/code-blocks-qe0T8-xe.mjs +0 -871
  19. package/dist/codeblocks-Bq67u32v.mjs +0 -250
  20. package/dist/config-DASewQ0x.mjs +0 -363
  21. package/dist/dev-DgY5xGl9.mjs +0 -1333
  22. package/dist/docs-cloud-server.d.mts +0 -70
  23. package/dist/docs-cloud-server.mjs +0 -310
  24. package/dist/doctor-CO1VMcF_.mjs +0 -1906
  25. package/dist/downgrade-BZs86NVr.mjs +0 -184
  26. package/dist/errors-CVqZ3kOO.mjs +0 -20
  27. package/dist/golden-evaluations-BN9u2wxw.mjs +0 -1483
  28. package/dist/i18n-CAlj1ADU.mjs +0 -40
  29. package/dist/index.d.mts +0 -1099
  30. package/dist/index.mjs +0 -9
  31. package/dist/init-Bd_k06bR.mjs +0 -1233
  32. package/dist/mcp-B_yXL5G5.mjs +0 -137
  33. package/dist/mcp.d.mts +0 -287
  34. package/dist/mcp.mjs +0 -4135
  35. package/dist/metadata-BDuewuzq.mjs +0 -237
  36. package/dist/package-version-qik_4J6C.mjs +0 -128
  37. package/dist/reading-time-BkEft6SD.mjs +0 -741
  38. package/dist/review-NC-sOdXn.mjs +0 -665
  39. package/dist/robots-DskPvGPw.mjs +0 -178
  40. package/dist/robots-ltltiLJF.mjs +0 -197
  41. package/dist/search-C1JitPwi.d.mts +0 -397
  42. package/dist/search-D57JXQLj.mjs +0 -1758
  43. package/dist/search-o4Ud6OXv.mjs +0 -102
  44. package/dist/server.d.mts +0 -341
  45. package/dist/server.mjs +0 -11
  46. package/dist/sitemap-Cq-Yj_iA.mjs +0 -247
  47. package/dist/sitemap-server-C1ibVKOy.mjs +0 -1137
  48. package/dist/templates-DNw15P-x.mjs +0 -2373
  49. package/dist/types-XHABMh_f.d.mts +0 -3248
  50. package/dist/upgrade-BCJTCW3O.mjs +0 -56
  51. package/dist/utils-6UCLxv4B.mjs +0 -225
@@ -1,178 +0,0 @@
1
- import "./agent-BFqyqEnC.mjs";
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-ltltiLJF.mjs";
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
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
6
- import path from "node:path";
7
- import pc from "picocolors";
8
-
9
- //#region src/cli/robots.ts
10
- function parseInlineFlag(arg) {
11
- const [rawKey, value] = arg.slice(2).split("=", 2);
12
- return {
13
- key: rawKey.trim(),
14
- value
15
- };
16
- }
17
- function parseRobotsGenerateArgs(argv) {
18
- const parsed = {};
19
- for (let index = 0; index < argv.length; index += 1) {
20
- const arg = argv[index];
21
- if (arg === "--help" || arg === "-h") {
22
- parsed.help = true;
23
- continue;
24
- }
25
- if (arg === "--append") {
26
- parsed.append = true;
27
- continue;
28
- }
29
- if (arg === "--force") {
30
- parsed.force = true;
31
- continue;
32
- }
33
- if (arg === "--check") {
34
- parsed.check = true;
35
- continue;
36
- }
37
- if (arg.startsWith("--config=")) {
38
- const value = parseInlineFlag(arg).value;
39
- if (!value) throw new Error("Missing value for --config.");
40
- parsed.configPath = value;
41
- continue;
42
- }
43
- if (arg === "--config") {
44
- const value = argv[index + 1];
45
- if (!value || value.startsWith("--")) throw new Error("Missing value for --config.");
46
- parsed.configPath = value;
47
- index += 1;
48
- continue;
49
- }
50
- if (arg.startsWith("--path=")) {
51
- const value = parseInlineFlag(arg).value;
52
- if (!value) throw new Error("Missing value for --path.");
53
- parsed.path = value;
54
- continue;
55
- }
56
- if (arg === "--path") {
57
- const value = argv[index + 1];
58
- if (!value || value.startsWith("--")) throw new Error("Missing value for --path.");
59
- parsed.path = value;
60
- index += 1;
61
- continue;
62
- }
63
- if (!arg.startsWith("--") && !parsed.path) {
64
- parsed.path = arg;
65
- continue;
66
- }
67
- throw new Error(`Unknown robots generate flag: ${arg}.`);
68
- }
69
- if (parsed.append && parsed.force) throw new Error("Use either --append or --force, not both.");
70
- return parsed;
71
- }
72
- function readTopLevelBooleanProperty(content, key) {
73
- const match = content.match(new RegExp(`\\b${key}\\b\\s*:\\s*(true|false)`));
74
- return match ? match[1] === "true" : void 0;
75
- }
76
- function readLlmsBaseUrlFromConfig(content, config) {
77
- if (config?.llmsTxt && typeof config.llmsTxt === "object") return config.llmsTxt.baseUrl;
78
- const block = extractNestedObjectLiteral(content, ["llmsTxt"]);
79
- return block ? readStringProperty(block, "baseUrl") : void 0;
80
- }
81
- function readSitemapConfigFromStatic(content) {
82
- const topLevelBoolean = readTopLevelBooleanProperty(content, "sitemap");
83
- if (typeof topLevelBoolean === "boolean") return topLevelBoolean;
84
- const block = extractNestedObjectLiteral(content, ["sitemap"]);
85
- if (!block) return void 0;
86
- return {
87
- enabled: readBooleanProperty(block, "enabled") ?? true,
88
- routePrefix: readStringProperty(block, "routePrefix"),
89
- baseUrl: readStringProperty(block, "baseUrl"),
90
- manifestPath: readStringProperty(block, "manifestPath")
91
- };
92
- }
93
- function readRobotsConfigFromStatic(content) {
94
- const topLevelBoolean = readTopLevelBooleanProperty(content, "robots");
95
- if (typeof topLevelBoolean === "boolean") return topLevelBoolean;
96
- const block = extractNestedObjectLiteral(content, ["robots"]);
97
- if (!block) return void 0;
98
- const aiString = readStringProperty(block, "ai");
99
- const aiBoolean = readBooleanProperty(block, "ai");
100
- return {
101
- enabled: readBooleanProperty(block, "enabled") ?? true,
102
- path: readStringProperty(block, "path"),
103
- baseUrl: readStringProperty(block, "baseUrl"),
104
- ai: aiString === "allow" || aiString === "disallow" ? aiString : typeof aiBoolean === "boolean" ? aiBoolean : void 0
105
- };
106
- }
107
- function resolveConfiguredRobots(content, config) {
108
- if (config?.robots !== void 0) return config.robots;
109
- return readRobotsConfigFromStatic(content) ?? true;
110
- }
111
- function resolvePublicDir(rootDir) {
112
- if (detectFramework(rootDir) === "sveltekit") return path.join(rootDir, "static");
113
- return path.join(rootDir, "public");
114
- }
115
- function resolveRobotsPath(rootDir, options, robots) {
116
- const configuredPath = options.path ?? robots?.path;
117
- if (configuredPath) return path.isAbsolute(configuredPath) ? configuredPath : path.resolve(rootDir, configuredPath);
118
- return path.join(resolvePublicDir(rootDir), "robots.txt");
119
- }
120
- function writeIfChanged(filePath, content, check) {
121
- if ((existsSync(filePath) ? readFileSync(filePath, "utf-8") : void 0) === content) return false;
122
- if (check) return true;
123
- mkdirSync(path.dirname(filePath), { recursive: true });
124
- writeFileSync(filePath, content, "utf-8");
125
- return true;
126
- }
127
- async function generateRobots(options = {}) {
128
- const rootDir = process.cwd();
129
- const loadedConfigModule = await loadDocsConfigModule(rootDir, options.configPath);
130
- const configContent = readFileSync(loadedConfigModule?.path ?? resolveDocsConfigPath(rootDir, options.configPath), "utf-8");
131
- const config = loadedConfigModule?.config;
132
- const entry = config?.entry ?? readTopLevelStringProperty(configContent, "entry") ?? "docs";
133
- const sitemap = config?.sitemap ?? readSitemapConfigFromStatic(configContent) ?? true;
134
- const sitemapBaseUrl = typeof sitemap === "object" ? sitemap.baseUrl : void 0;
135
- const llmsBaseUrl = readLlmsBaseUrlFromConfig(configContent, config);
136
- const configuredRobots = resolveConfiguredRobots(configContent, config);
137
- if (configuredRobots === false) throw new Error("Robots generation is disabled by `robots: false`.");
138
- const robotsInput = typeof configuredRobots === "object" ? configuredRobots : {};
139
- const robots = resolveDocsRobotsConfig(robotsInput, { baseUrl: robotsInput.baseUrl ?? sitemapBaseUrl ?? llmsBaseUrl });
140
- if (!robots.enabled) throw new Error("Robots generation is disabled by `robots.enabled: false`.");
141
- const robotsPath = resolveRobotsPath(rootDir, options, robotsInput);
142
- const relativeRobotsPath = path.relative(rootDir, robotsPath).replace(/\\/g, "/");
143
- const generatedBlock = renderDocsRobotsGeneratedBlock({
144
- entry,
145
- sitemap,
146
- baseUrl: robots.baseUrl,
147
- robots
148
- });
149
- const existing = existsSync(robotsPath) ? readFileSync(robotsPath, "utf-8") : void 0;
150
- const hasGeneratedBlock = existing?.includes(DOCS_ROBOTS_GENERATED_BLOCK_START) === true && existing.includes(DOCS_ROBOTS_GENERATED_BLOCK_END);
151
- if (existing !== void 0 && !options.force && !options.append && !hasGeneratedBlock) {
152
- console.log(pc.yellow(`Found existing robots.txt at ${relativeRobotsPath}.`));
153
- console.log(pc.dim("Keeping the user-owned file. Use --append to add/update the generated block, or --force to replace it."));
154
- return;
155
- }
156
- const changed = writeIfChanged(robotsPath, existing !== void 0 && (options.append || hasGeneratedBlock) ? upsertDocsRobotsGeneratedBlock(existing, generatedBlock) : generatedBlock, options.check === true);
157
- if (options.check && changed) throw new Error(`Robots output is stale at ${relativeRobotsPath}. Run \`docs robots generate${options.append ? " --append" : options.force ? " --force" : ""}${options.path ? ` --path ${options.path}` : ""}\` to update it.`);
158
- console.log(changed ? pc.green(`Generated robots policy at ${relativeRobotsPath}.`) : pc.green(`Robots policy is current at ${relativeRobotsPath}.`));
159
- }
160
- function printRobotsGenerateHelp() {
161
- console.log(`
162
- ${pc.bold("docs robots generate")} — Generate a static robots.txt agent access policy.
163
-
164
- ${pc.dim("Usage:")}
165
- pnpm exec docs ${pc.cyan("robots generate")} ${pc.dim("[path]")}
166
-
167
- ${pc.dim("Options:")}
168
- ${pc.cyan("--path <path>")} Write to a specific robots.txt path; defaults to the framework public directory
169
- ${pc.cyan("--append")} Add or update a generated block inside an existing robots.txt
170
- ${pc.cyan("--force")} Replace the target robots.txt with the generated policy
171
- ${pc.cyan("--check")} Fail if the generated output would change
172
- ${pc.cyan("--config <path>")} Use a custom docs config path instead of ${pc.dim("docs.config.ts[x]")}
173
- ${pc.cyan("-h, --help")} Show this help message
174
- `);
175
- }
176
-
177
- //#endregion
178
- export { generateRobots, parseRobotsGenerateArgs, printRobotsGenerateHelp };
@@ -1,197 +0,0 @@
1
- import { Qt as DEFAULT_API_CATALOG_ROUTE, S as DEFAULT_MCP_WELL_KNOWN_ROUTE, T as DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, Yt as DEFAULT_AGENT_SKILLS_ROUTE_PREFIX, a as DEFAULT_AGENT_MD_ROUTE, b as DEFAULT_MCP_PUBLIC_ROUTE, c as DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, et as normalizeDocsPathSegment, g as DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, h as DEFAULT_LLMS_FULL_TXT_ROUTE, l as DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, n as DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE, o as DEFAULT_AGENT_MD_WELL_KNOWN_ROUTE, qt as DEFAULT_AGENT_SKILLS_INDEX_ROUTE, t as DEFAULT_AGENTS_MD_ROUTE, v as DEFAULT_LLMS_TXT_ROUTE, w as DEFAULT_SKILL_MD_ROUTE, y as DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, zt as resolveDocsSitemapConfig } from "./agent-BFqyqEnC.mjs";
2
-
3
- //#region src/robots.ts
4
- const DEFAULT_ROBOTS_TXT_ROUTE = "/robots.txt";
5
- const DOCS_ROBOTS_GENERATED_BLOCK_START = "# BEGIN @farming-labs/docs robots";
6
- const DOCS_ROBOTS_GENERATED_BLOCK_END = "# END @farming-labs/docs robots";
7
- const DEFAULT_DOCS_AI_ROBOTS_USER_AGENTS = [
8
- "GPTBot",
9
- "ChatGPT-User",
10
- "OAI-SearchBot",
11
- "ClaudeBot",
12
- "Claude-User",
13
- "anthropic-ai",
14
- "CCBot",
15
- "Google-Extended"
16
- ];
17
- function normalizeRoute(value) {
18
- const trimmed = value.trim();
19
- if (!trimmed) return "/";
20
- return trimmed.startsWith("/") ? trimmed.replace(/\/{2,}/g, "/") : `/${trimmed}`;
21
- }
22
- function normalizeBaseUrl(value) {
23
- if (!value) return void 0;
24
- try {
25
- const url = new URL(value);
26
- url.pathname = url.pathname.replace(/\/+$/, "");
27
- url.search = "";
28
- url.hash = "";
29
- return url.toString().replace(/\/+$/, "");
30
- } catch {
31
- return;
32
- }
33
- }
34
- function normalizeStringArray(value) {
35
- if (Array.isArray(value)) return value;
36
- return value ? [value] : [];
37
- }
38
- function normalizeAiPolicy(value) {
39
- return value === false || value === "disallow" ? "disallow" : "allow";
40
- }
41
- function unique(values) {
42
- return [...new Set(values.filter(Boolean))];
43
- }
44
- function resolveDocsRobotsConfig(input, options = {}) {
45
- if (input === false) return {
46
- enabled: false,
47
- ai: "allow",
48
- userAgents: [...DEFAULT_DOCS_AI_ROBOTS_USER_AGENTS],
49
- extraRules: []
50
- };
51
- const config = typeof input === "object" ? input : {};
52
- return {
53
- enabled: config.enabled ?? true,
54
- path: config.path,
55
- baseUrl: normalizeBaseUrl(config.baseUrl) ?? normalizeBaseUrl(options.baseUrl),
56
- ai: normalizeAiPolicy(config.ai),
57
- userAgents: unique([...DEFAULT_DOCS_AI_ROBOTS_USER_AGENTS, ...normalizeStringArray(config.aiUserAgents)]),
58
- extraRules: config.extraRules ?? []
59
- };
60
- }
61
- function getDocsRobotsAllowRoutes(options = {}) {
62
- const normalizedEntry = normalizeDocsPathSegment(options.entry ?? "docs") || "docs";
63
- const sitemapConfig = resolveDocsSitemapConfig(options.sitemap);
64
- const routes = [
65
- "/",
66
- `/${normalizedEntry}`,
67
- `/${normalizedEntry}/`,
68
- `/${normalizedEntry}.md`,
69
- `/${normalizedEntry}/*.md`,
70
- DEFAULT_LLMS_TXT_ROUTE,
71
- DEFAULT_LLMS_FULL_TXT_ROUTE,
72
- DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE,
73
- DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE,
74
- DEFAULT_SKILL_MD_ROUTE,
75
- DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE,
76
- DEFAULT_AGENTS_MD_ROUTE,
77
- DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE,
78
- DEFAULT_AGENT_MD_ROUTE,
79
- DEFAULT_AGENT_MD_WELL_KNOWN_ROUTE,
80
- DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE,
81
- DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE,
82
- ...options.apiCatalog === false ? [] : [DEFAULT_API_CATALOG_ROUTE],
83
- DEFAULT_AGENT_SKILLS_INDEX_ROUTE,
84
- `${DEFAULT_AGENT_SKILLS_ROUTE_PREFIX}/*/SKILL.md`,
85
- DEFAULT_MCP_PUBLIC_ROUTE,
86
- DEFAULT_MCP_WELL_KNOWN_ROUTE
87
- ];
88
- if (sitemapConfig.enabled) {
89
- if (sitemapConfig.xml.enabled) routes.push(sitemapConfig.xml.route);
90
- if (sitemapConfig.markdown.enabled) {
91
- routes.push(sitemapConfig.markdown.route, sitemapConfig.markdown.wellKnownRoute);
92
- if (sitemapConfig.markdown.docsRoute) routes.push(sitemapConfig.markdown.docsRoute);
93
- }
94
- }
95
- return unique(routes.map(normalizeRoute));
96
- }
97
- function sitemapUrls(robots, sitemap) {
98
- const sitemapConfig = resolveDocsSitemapConfig(sitemap, { baseUrl: robots.baseUrl });
99
- if (!robots.baseUrl || !sitemapConfig.enabled || !sitemapConfig.xml.enabled) return [];
100
- try {
101
- return [new URL(sitemapConfig.xml.route, `${robots.baseUrl}/`).toString()];
102
- } catch {
103
- return [];
104
- }
105
- }
106
- function appendRule(lines, rule) {
107
- const userAgents = normalizeStringArray(rule.userAgent);
108
- if (userAgents.length === 0) return;
109
- lines.push("");
110
- for (const userAgent of userAgents) lines.push(`User-agent: ${userAgent}`);
111
- for (const route of normalizeStringArray(rule.allow)) lines.push(`Allow: ${normalizeRoute(route)}`);
112
- for (const route of normalizeStringArray(rule.disallow)) lines.push(`Disallow: ${normalizeRoute(route)}`);
113
- if (typeof rule.crawlDelay === "number" && Number.isFinite(rule.crawlDelay)) lines.push(`Crawl-delay: ${rule.crawlDelay}`);
114
- }
115
- function renderDocsRobotsTxt(options = {}) {
116
- const robots = resolveDocsRobotsConfig(options.robots, { baseUrl: options.baseUrl });
117
- if (!robots.enabled) return "";
118
- const lines = [
119
- "# Generated by @farming-labs/docs.",
120
- "# Edit docs.config or rerun `docs robots generate --append` / `--force`.",
121
- "",
122
- "User-agent: *"
123
- ];
124
- for (const route of getDocsRobotsAllowRoutes(options)) lines.push(`Allow: ${route}`);
125
- for (const userAgent of robots.userAgents) {
126
- lines.push("", `User-agent: ${userAgent}`);
127
- lines.push(robots.ai === "allow" ? "Allow: /" : "Disallow: /");
128
- }
129
- for (const rule of robots.extraRules) appendRule(lines, rule);
130
- const sitemap = sitemapUrls(robots, options.sitemap);
131
- if (sitemap.length > 0) {
132
- lines.push("");
133
- for (const url of sitemap) lines.push(`Sitemap: ${url}`);
134
- }
135
- return `${lines.join("\n")}\n`;
136
- }
137
- function resolveDocsRobotsRequest(url, robots) {
138
- const pathname = normalizeRoute(url.pathname);
139
- const format = url.searchParams.get("format")?.trim();
140
- if (pathname === "/api/docs" && format === "robots") return "robots";
141
- if (!resolveDocsRobotsConfig(robots).enabled) return null;
142
- return pathname === DEFAULT_ROBOTS_TXT_ROUTE ? "robots" : null;
143
- }
144
- function createDocsRobotsResponse({ request, ...options }) {
145
- const url = new URL(request.url);
146
- if (!resolveDocsRobotsRequest(url, options.robots)) return null;
147
- const content = renderDocsRobotsTxt({
148
- ...options,
149
- baseUrl: options.baseUrl ?? url.origin
150
- });
151
- if (!content) return null;
152
- return new Response(content, { headers: {
153
- "Content-Type": "text/plain; charset=utf-8",
154
- "Cache-Control": "public, max-age=0, s-maxage=3600"
155
- } });
156
- }
157
- function renderDocsRobotsGeneratedBlock(options = {}) {
158
- return `${DOCS_ROBOTS_GENERATED_BLOCK_START}\n${renderDocsRobotsTxt(options).trimEnd()}\n${DOCS_ROBOTS_GENERATED_BLOCK_END}\n`;
159
- }
160
- function upsertDocsRobotsGeneratedBlock(existing, block) {
161
- const escapedStart = DOCS_ROBOTS_GENERATED_BLOCK_START.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
162
- const escapedEnd = DOCS_ROBOTS_GENERATED_BLOCK_END.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
163
- const pattern = new RegExp(`${escapedStart}[\\s\\S]*?${escapedEnd}\\n?`);
164
- if (pattern.test(existing)) return existing.replace(pattern, block);
165
- const prefix = existing.trimEnd();
166
- return `${prefix}${prefix ? "\n\n" : ""}${block}`;
167
- }
168
- function blockForUserAgent(content, userAgent) {
169
- const escaped = userAgent.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
170
- return content.match(new RegExp(`(?:^|\\n)\\s*User-agent:\\s*${escaped}\\s*(?:\\n[ \\t]*(?!User-agent:).*)*`, "i"))?.[0] ?? "";
171
- }
172
- function disallowsRoute(content, route) {
173
- const escapedRoute = route.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
174
- return new RegExp(`^\\s*Disallow:\\s*${escapedRoute}(?:\\s|$)`, "im").test(content);
175
- }
176
- function analyzeDocsRobotsTxt(content, options = {}) {
177
- const expectedRoutes = getDocsRobotsAllowRoutes(options).filter((route) => [
178
- DEFAULT_LLMS_TXT_ROUTE,
179
- DEFAULT_LLMS_FULL_TXT_ROUTE,
180
- DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE,
181
- DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE,
182
- DEFAULT_AGENTS_MD_ROUTE,
183
- DEFAULT_SKILL_MD_ROUTE,
184
- DEFAULT_MCP_PUBLIC_ROUTE
185
- ].includes(route) || route.includes("sitemap"));
186
- const missingRoutes = expectedRoutes.filter((route) => !content.includes(route));
187
- return {
188
- blocksAgentRoutes: /Disallow:\s*\/(?:\s|$)/i.test(blockForUserAgent(content, "*")) || expectedRoutes.some((route) => disallowsRoute(content, route)),
189
- blocksAiAgents: DEFAULT_DOCS_AI_ROBOTS_USER_AGENTS.some((userAgent) => /Disallow:\s*\/(?:\s|$)/i.test(blockForUserAgent(content, userAgent))),
190
- hasAgentRoutes: missingRoutes.length === 0,
191
- hasAiPolicy: DEFAULT_DOCS_AI_ROBOTS_USER_AGENTS.some((userAgent) => content.includes(userAgent)),
192
- missingRoutes
193
- };
194
- }
195
-
196
- //#endregion
197
- export { analyzeDocsRobotsTxt as a, renderDocsRobotsGeneratedBlock as c, resolveDocsRobotsRequest as d, upsertDocsRobotsGeneratedBlock as f, DOCS_ROBOTS_GENERATED_BLOCK_START as i, renderDocsRobotsTxt as l, DEFAULT_ROBOTS_TXT_ROUTE as n, createDocsRobotsResponse as o, DOCS_ROBOTS_GENERATED_BLOCK_END as r, getDocsRobotsAllowRoutes as s, DEFAULT_DOCS_AI_ROBOTS_USER_AGENTS as t, resolveDocsRobotsConfig as u };