@farming-labs/docs 0.2.120 → 0.2.121
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/README.md +8 -0
- package/dist/access.d.mts +13 -0
- package/dist/access.mjs +56 -0
- package/dist/agent-conformance.d.mts +60 -0
- package/dist/agent-conformance.mjs +538 -0
- package/dist/agent-contract.d.mts +47 -0
- package/dist/agent-contract.mjs +645 -0
- package/dist/agent-detection.d.mts +6 -0
- package/dist/agent-detection.mjs +83 -0
- package/dist/agent-evals.d.mts +224 -0
- package/dist/{agent-evals-BLNLvXbG.mjs → agent-evals.mjs} +7 -565
- package/dist/agent-feedback-evaluations-node.mjs +38 -0
- package/dist/agent-feedback-evaluations.d.mts +91 -0
- package/dist/{agent-feedback-evaluations-CcMGlgsO.mjs → agent-feedback-evaluations.mjs} +2 -2
- package/dist/agent-feedback-loop.d.mts +45 -0
- package/dist/{agent-feedback-loop-CcZL_sb1.mjs → agent-feedback-loop.mjs} +1 -1
- package/dist/agent-maintenance.d.mts +71 -0
- package/dist/{agent-maintenance-CuZ7iAKq.mjs → agent-maintenance.mjs} +1 -1
- package/dist/agent-provenance.d.mts +23 -0
- package/dist/agent-provenance.mjs +77 -0
- package/dist/agent-scope.mjs +321 -0
- package/dist/agent-skills-archive.mjs +86 -0
- package/dist/agent-skills-bundle.d.mts +1 -1
- package/dist/{agent-skills-progressive-disclosure-PjPtTYL-.mjs → agent-skills-progressive-disclosure.mjs} +2 -2
- package/dist/{agent-skills-server-D5IuvwM7.d.mts → agent-skills-server.d.mts} +3 -3
- package/dist/{agent-skills-server-BC7md56k.mjs → agent-skills-server.mjs} +2 -2
- package/dist/agent-skills-vite.d.mts +3 -3
- package/dist/agent-skills-vite.mjs +1 -2
- package/dist/agent-surface-drift.mjs +236 -0
- package/dist/{golden-evaluations-CLUViycJ.mjs → agent-usefulness.mjs} +5 -290
- package/dist/{content-change-hydration-wqXIZHp6.d.mts → agent.d.mts} +10 -411
- package/dist/agent.mjs +2729 -0
- package/dist/{analytics-w3FDOksr.d.mts → analytics.d.mts} +2 -2
- package/dist/{analytics-p8Vhhu2P.mjs → analytics.mjs} +2 -2
- package/dist/{sitemap-server-BUdPBcGs.d.mts → api-reference.d.mts} +2 -6
- package/dist/api-reference.mjs +1481 -0
- package/dist/{audience-exposure-DBrFWULA.d.mts → audience-exposure.d.mts} +1 -1
- package/dist/audience-exposure.mjs +8 -0
- package/dist/audience.d.mts +44 -0
- package/dist/audience.mjs +1654 -0
- package/dist/authoring-mcp.d.mts +44 -0
- package/dist/{authoring-mcp-CiCUQe3o.mjs → authoring-mcp.mjs} +3 -3
- package/dist/browser.d.mts +6 -4
- package/dist/browser.mjs +6 -7
- package/dist/build.d.mts +8 -0
- package/dist/build.mjs +8 -0
- package/dist/changelog.d.mts +20 -0
- package/dist/changelog.mjs +39 -0
- package/dist/{agent-export-CA6IUQ7T.mjs → cli/agent-export.mjs} +19 -45
- package/dist/{agent-CYk2DxY7.mjs → cli/agent.mjs} +6 -35
- package/dist/{agents-BUiVmj8i.mjs → cli/agents.mjs} +5 -18
- package/dist/cli/api-doctor.mjs +206 -0
- package/dist/{authoring-C2ymvYWl.mjs → cli/authoring.mjs} +2 -8
- package/dist/{cloud-6eKrlmKd.mjs → cli/cloud.mjs} +3 -3
- package/dist/{codeblocks-CHpgAwY-.mjs → cli/codeblocks.mjs} +2 -2
- package/dist/cli/config.d.mts +11 -0
- package/dist/{config-BZnKAj_Y.mjs → cli/config.mjs} +1 -1
- package/dist/cli/dev-banner.mjs +58 -0
- package/dist/{dev-Bnn-NUNa.mjs → cli/dev.mjs} +3 -57
- package/dist/{doctor-Bfkrkzad.mjs → cli/doctor.mjs} +41 -226
- package/dist/{downgrade-CHMta85e.mjs → cli/downgrade.mjs} +2 -2
- package/dist/cli/errors.d.mts +4 -0
- package/dist/{errors-BtnVLhNF.mjs → cli/errors.mjs} +1 -1
- package/dist/{feedback-evals-DMilg9pY.mjs → cli/feedback-evals.mjs} +3 -36
- package/dist/{feedback-DL4T5oIO.mjs → cli/feedback.mjs} +1 -1
- package/dist/cli/git-dates.mjs +35 -0
- package/dist/cli/golden-evaluations.mjs +52 -0
- package/dist/cli/index.d.mts +2 -3
- package/dist/cli/index.mjs +38 -38
- package/dist/{init-K0LmXDZ5.mjs → cli/init.mjs} +3 -3
- package/dist/{mcp-iLCmnPJI.mjs → cli/mcp.mjs} +7 -19
- package/dist/{openapi-diff-HcpUNjA-.mjs → cli/openapi-diff.mjs} +2 -7
- package/dist/{openapi-sdk-BQKC6H-_.mjs → cli/openapi-sdk.mjs} +2 -7
- package/dist/{openapi-source-DK6ts_Bk.mjs → cli/openapi-source.mjs} +2 -2
- package/dist/{package-version-HJhYeq4M.mjs → cli/package-version.mjs} +2 -2
- package/dist/{propose-JmUv_BTt.mjs → cli/propose.mjs} +1 -1
- package/dist/{review-C6EmbV0l.mjs → cli/review.mjs} +16 -15
- package/dist/{robots-DteZB8vl.mjs → cli/robots.mjs} +3 -7
- package/dist/{search-Bhuv_YsL.mjs → cli/search.mjs} +7 -20
- package/dist/{sitemap-DW5LDKDa.mjs → cli/sitemap.mjs} +7 -42
- package/dist/{skills-BAPQLSCm.mjs → cli/skills.mjs} +5 -19
- package/dist/{templates-BuQ8YsGv.mjs → cli/templates.mjs} +1 -1
- package/dist/{upgrade-DlQMOFV1.mjs → cli/upgrade.mjs} +2 -2
- package/dist/{utils-C7KDrPpA.mjs → cli/utils.mjs} +1 -1
- package/dist/client/react.d.mts +2 -18
- package/dist/client/react.mjs +1 -157
- package/dist/{cloud-analytics-D14HplI7.mjs → cloud-analytics.mjs} +1 -1
- package/dist/{cloud-ask-ai-BrsTXQf6.d.mts → cloud-ask-ai.d.mts} +2 -2
- package/dist/{cloud-ask-ai-BqKhjpS5.mjs → cloud-ask-ai.mjs} +3 -3
- package/dist/code-blocks.d.mts +51 -0
- package/dist/{code-blocks-GYdvS3BH.mjs → code-blocks.mjs} +2 -2
- package/dist/code-group-mdx.d.mts +11 -0
- package/dist/code-group-mdx.mjs +57 -0
- package/dist/content-change-hydration.d.mts +87 -0
- package/dist/{openapi-mcp-BIOTLiA7.mjs → content-change-hydration.mjs} +5 -210
- package/dist/content-changes.d.mts +47 -0
- package/dist/content-changes.mjs +216 -0
- package/dist/create-theme.d.mts +48 -0
- package/dist/create-theme.mjs +57 -0
- package/dist/date.d.mts +5 -0
- package/dist/date.mjs +17 -0
- package/dist/define-docs.d.mts +9 -0
- package/dist/define-docs.mjs +46 -0
- package/dist/docs-cloud-client.d.mts +18 -0
- package/dist/docs-cloud-client.mjs +161 -0
- package/dist/docs-cloud-server.d.mts +2 -2
- package/dist/docs-cloud-server.mjs +2 -3
- package/dist/heading-toc.d.mts +10 -0
- package/dist/heading-toc.mjs +23 -0
- package/dist/http-body.d.mts +14 -0
- package/dist/{http-body-DkAPk6D5.mjs → http-body.mjs} +1 -1
- package/dist/http-cache.d.mts +25 -0
- package/dist/http-cache.mjs +140 -0
- package/dist/http-link.mjs +81 -0
- package/dist/i18n.d.mts +18 -0
- package/dist/{i18n-B1gJ9EW0.mjs → i18n.mjs} +1 -1
- package/dist/index.d.mts +42 -674
- package/dist/index.mjs +40 -14
- package/dist/markdown-rendering.mjs +1 -1
- package/dist/markdown-section-cache.mjs +49 -0
- package/dist/markdown-sections.d.mts +47 -0
- package/dist/{markdown-sections-9Oxr33b-.mjs → markdown-sections.mjs} +29 -703
- package/dist/mcp-auth.d.mts +14 -0
- package/dist/mcp-auth.mjs +99 -0
- package/dist/mcp.d.mts +5 -3
- package/dist/mcp.mjs +21 -9
- package/dist/mdx.d.mts +6 -0
- package/dist/mdx.mjs +7 -0
- package/dist/metadata.d.mts +60 -0
- package/dist/{metadata-BOHn0Y5K.mjs → metadata.mjs} +2 -2
- package/dist/native-api-reference.mjs +968 -0
- package/dist/okf.d.mts +42 -0
- package/dist/okf.mjs +145 -0
- package/dist/openapi-contract.mjs +154 -0
- package/dist/{openapi-mcp-node-C4jUpZG6.mjs → openapi-mcp-node.mjs} +1 -1
- package/dist/openapi-mcp.d.mts +26 -0
- package/dist/openapi-mcp.mjs +132 -0
- package/dist/openapi-operations.d.mts +71 -0
- package/dist/{openapi-operations-DFpaqOqA.mjs → openapi-operations.mjs} +1 -1
- package/dist/openapi-overlays.mjs +221 -0
- package/dist/openapi-references.mjs +233 -0
- package/dist/pagination.d.mts +7 -0
- package/dist/pagination.mjs +100 -0
- package/dist/prompt-references.d.mts +12 -0
- package/dist/prompt-references.mjs +132 -0
- package/dist/prompt-utils.d.mts +36 -0
- package/dist/{prompt-utils-B5g-bv7o.mjs → prompt-utils.mjs} +1 -57
- package/dist/reading-time.d.mts +23 -0
- package/dist/reading-time.mjs +58 -0
- package/dist/related.d.mts +7 -0
- package/dist/related.mjs +50 -0
- package/dist/retrieval-digest.d.mts +16 -0
- package/dist/{retrieval-digest-CT-eIEcp.mjs → retrieval-digest.mjs} +1 -1
- package/dist/review.d.mts +69 -0
- package/dist/review.mjs +562 -0
- package/dist/robots.d.mts +54 -0
- package/dist/{robots-BYJAVeI6.mjs → robots.mjs} +5 -3
- package/dist/runtime.d.mts +3 -3
- package/dist/runtime.mjs +3 -9
- package/dist/search.d.mts +210 -0
- package/dist/search.mjs +3401 -0
- package/dist/server.d.mts +22 -198
- package/dist/server.mjs +21 -19
- package/dist/sidebar.d.mts +15 -0
- package/dist/sidebar.mjs +73 -0
- package/dist/sitemap-server.d.mts +7 -0
- package/dist/{sitemap-server-Lg3YhUx4.mjs → sitemap-server.mjs} +2 -2
- package/dist/{sitemap-Cl8vrixd.d.mts → sitemap.d.mts} +3 -3
- package/dist/sitemap.mjs +254 -0
- package/dist/{standards-discovery-BHPc7YIX.d.mts → standards-discovery.d.mts} +2 -2
- package/dist/{standards-discovery-sSEojU80.mjs → standards-discovery.mjs} +3 -139
- package/dist/telemetry-runtime.d.mts +42 -0
- package/dist/telemetry-runtime.mjs +238 -0
- package/dist/telemetry.d.mts +15 -0
- package/dist/telemetry.mjs +117 -0
- package/dist/{types-BJFeMXWZ.d.mts → types.d.mts} +3 -2
- package/dist/urls.d.mts +7 -0
- package/dist/urls.mjs +21 -0
- package/dist/utils.d.mts +8 -0
- package/dist/utils.mjs +22 -0
- package/package.json +21 -3
- package/dist/agent-DkAidqtV.mjs +0 -9026
- package/dist/api-reference-BYee4zMo.mjs +0 -3046
- package/dist/prompt-references-DMgbu_dz.mjs +0 -1082
- package/dist/retrieval-digest-AOx2-LbC.d.mts +0 -367
- package/dist/sidebar-CFHBj29f.mjs +0 -421
- package/dist/sidebar-CMPbVfGP.d.mts +0 -63
- /package/dist/{openapi-CfCzX_a1.mjs → cli/openapi.mjs} +0 -0
package/dist/review.mjs
ADDED
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
import { getDocsAgentSkillsConfiguredPaths } from "./agent-skills-server.mjs";
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname, isAbsolute, join, relative } from "node:path";
|
|
4
|
+
|
|
5
|
+
//#region src/review.ts
|
|
6
|
+
const DEFAULT_DOCS_REVIEW_WORKFLOW_PATH = ".github/workflows/docs-review.yml";
|
|
7
|
+
const DEFAULT_DOCS_REVIEW_REUSABLE_WORKFLOW_PATH = ".github/workflows/docs-review-reusable.yml";
|
|
8
|
+
const DEFAULT_DOCS_REVIEW_REUSABLE_WORKFLOW = "farming-labs/docs/.github/workflows/docs-review-reusable.yml@main";
|
|
9
|
+
const LOCAL_DOCS_REVIEW_REUSABLE_WORKFLOW = "./.github/workflows/docs-review-reusable.yml";
|
|
10
|
+
const DEFAULT_DOCS_REVIEW_PNPM_VERSION = "10";
|
|
11
|
+
const DEFAULT_DOCS_REVIEW_SCORE_THRESHOLD = 80;
|
|
12
|
+
const DEFAULT_DOCS_REVIEW_CI_NAME = "docs-review";
|
|
13
|
+
const DEFAULT_REVIEW_RULES = {
|
|
14
|
+
brokenLinks: "error",
|
|
15
|
+
frontmatter: "error",
|
|
16
|
+
duplicateSlugs: "error",
|
|
17
|
+
invalidMdx: "error",
|
|
18
|
+
configExamples: "warn",
|
|
19
|
+
codeFenceMetadata: "warn",
|
|
20
|
+
runnableMetadata: "warn",
|
|
21
|
+
agentContext: "warn",
|
|
22
|
+
commandHealth: "warn",
|
|
23
|
+
relatedCoverage: "suggestion",
|
|
24
|
+
configConfidence: "warn",
|
|
25
|
+
agentSurfaceDrift: "error",
|
|
26
|
+
goldenTasks: "warn",
|
|
27
|
+
agentSkills: "warn"
|
|
28
|
+
};
|
|
29
|
+
const DEFAULT_REVIEW_WEIGHTS = {
|
|
30
|
+
error: 20,
|
|
31
|
+
warn: 8,
|
|
32
|
+
suggestion: 2
|
|
33
|
+
};
|
|
34
|
+
const REVIEW_SEVERITIES = new Set([
|
|
35
|
+
"off",
|
|
36
|
+
"suggestion",
|
|
37
|
+
"warn",
|
|
38
|
+
"error"
|
|
39
|
+
]);
|
|
40
|
+
const REVIEW_CI_MODES = new Set([
|
|
41
|
+
"off",
|
|
42
|
+
"warn",
|
|
43
|
+
"block"
|
|
44
|
+
]);
|
|
45
|
+
const FILE_EXTS = [
|
|
46
|
+
"tsx",
|
|
47
|
+
"ts",
|
|
48
|
+
"jsx",
|
|
49
|
+
"js"
|
|
50
|
+
];
|
|
51
|
+
function resolveDocsReviewConfig(review) {
|
|
52
|
+
if (review === false) return {
|
|
53
|
+
enabled: false,
|
|
54
|
+
ci: {
|
|
55
|
+
enabled: false,
|
|
56
|
+
name: DEFAULT_DOCS_REVIEW_CI_NAME,
|
|
57
|
+
mode: "off",
|
|
58
|
+
annotations: false,
|
|
59
|
+
comment: false
|
|
60
|
+
},
|
|
61
|
+
score: {
|
|
62
|
+
threshold: DEFAULT_DOCS_REVIEW_SCORE_THRESHOLD,
|
|
63
|
+
weights: DEFAULT_REVIEW_WEIGHTS
|
|
64
|
+
},
|
|
65
|
+
rules: DEFAULT_REVIEW_RULES
|
|
66
|
+
};
|
|
67
|
+
const objectConfig = review && typeof review === "object" ? review : {};
|
|
68
|
+
const ciConfig = objectConfig.ci;
|
|
69
|
+
const ciObject = ciConfig && typeof ciConfig === "object" ? ciConfig : {};
|
|
70
|
+
const configuredMode = ciObject.mode;
|
|
71
|
+
const mode = configuredMode && REVIEW_CI_MODES.has(configuredMode) ? configuredMode : "warn";
|
|
72
|
+
const enabled = objectConfig.enabled !== false;
|
|
73
|
+
const ciEnabled = enabled && ciConfig !== false && ciObject.enabled !== false && mode !== "off";
|
|
74
|
+
return {
|
|
75
|
+
enabled,
|
|
76
|
+
ci: {
|
|
77
|
+
enabled: ciEnabled,
|
|
78
|
+
name: normalizeCiName(ciObject.name),
|
|
79
|
+
mode: ciEnabled ? mode : "off",
|
|
80
|
+
annotations: ciObject.annotations !== false,
|
|
81
|
+
comment: ciObject.comment !== false
|
|
82
|
+
},
|
|
83
|
+
score: {
|
|
84
|
+
threshold: clampScoreThreshold(objectConfig.score?.threshold),
|
|
85
|
+
weights: {
|
|
86
|
+
error: normalizeWeight(objectConfig.score?.weights?.error, DEFAULT_REVIEW_WEIGHTS.error),
|
|
87
|
+
warn: normalizeWeight(objectConfig.score?.weights?.warn, DEFAULT_REVIEW_WEIGHTS.warn),
|
|
88
|
+
suggestion: normalizeWeight(objectConfig.score?.weights?.suggestion, DEFAULT_REVIEW_WEIGHTS.suggestion)
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
rules: {
|
|
92
|
+
...DEFAULT_REVIEW_RULES,
|
|
93
|
+
...normalizeRules(objectConfig.rules)
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function buildDocsReviewWorkflow(options = {}) {
|
|
98
|
+
const packageManager = options.packageManager ?? "npm";
|
|
99
|
+
const ciName = normalizeCiName(options.ciName);
|
|
100
|
+
const projectDir = normalizeProjectDir(options.projectDir);
|
|
101
|
+
const configPath = options.configPath ?? "docs.config.ts";
|
|
102
|
+
const reusableWorkflow = options.reusableWorkflow ?? DEFAULT_DOCS_REVIEW_REUSABLE_WORKFLOW;
|
|
103
|
+
const filters = normalizePathFilters(options.pathFilters);
|
|
104
|
+
const workflowInputs = [
|
|
105
|
+
["check-name", ciName],
|
|
106
|
+
["config", configPath],
|
|
107
|
+
["working-directory", projectDir],
|
|
108
|
+
["package-manager", packageManager],
|
|
109
|
+
options.pnpmVersion ? ["pnpm-version", options.pnpmVersion] : void 0,
|
|
110
|
+
options.buildCommand ? ["build-command", options.buildCommand] : void 0,
|
|
111
|
+
options.reviewCommand ? ["review-command", options.reviewCommand] : void 0
|
|
112
|
+
].filter((input) => Boolean(input)).map(([key, value]) => ` ${key}: ${JSON.stringify(value)}`).join("\n");
|
|
113
|
+
return `# Generated by @farming-labs/docs. You can edit this file.
|
|
114
|
+
name: Docs Review
|
|
115
|
+
|
|
116
|
+
on:
|
|
117
|
+
pull_request:
|
|
118
|
+
paths:
|
|
119
|
+
${filters.map((filter) => ` - ${JSON.stringify(filter)}`).join("\n")}
|
|
120
|
+
|
|
121
|
+
permissions:
|
|
122
|
+
contents: read
|
|
123
|
+
checks: write
|
|
124
|
+
pull-requests: write
|
|
125
|
+
|
|
126
|
+
jobs:
|
|
127
|
+
docs-review:
|
|
128
|
+
name: ${JSON.stringify(ciName)}
|
|
129
|
+
uses: ${reusableWorkflow}
|
|
130
|
+
with:
|
|
131
|
+
${workflowInputs}
|
|
132
|
+
permissions:
|
|
133
|
+
contents: read
|
|
134
|
+
checks: write
|
|
135
|
+
pull-requests: write
|
|
136
|
+
`;
|
|
137
|
+
}
|
|
138
|
+
function ensureDocsReviewWorkflow(options) {
|
|
139
|
+
const rootDir = options.rootDir;
|
|
140
|
+
const repoRoot = findGitRoot(rootDir) ?? rootDir;
|
|
141
|
+
const workflowRelativePath = options.workflowPath ?? DEFAULT_DOCS_REVIEW_WORKFLOW_PATH;
|
|
142
|
+
const workflowPath = isAbsolute(workflowRelativePath) ? workflowRelativePath : join(repoRoot, workflowRelativePath);
|
|
143
|
+
const resultRelativePath = toPosixPath(relative(repoRoot, workflowPath));
|
|
144
|
+
const review = resolveDocsReviewConfig(options.config?.review ?? readDocsReviewConfigFromSource(options.configContent ?? readConfig(rootDir)));
|
|
145
|
+
if (!review.enabled || !review.ci.enabled) return {
|
|
146
|
+
status: "disabled",
|
|
147
|
+
path: workflowPath,
|
|
148
|
+
relativePath: resultRelativePath
|
|
149
|
+
};
|
|
150
|
+
if (existsSync(workflowPath)) return {
|
|
151
|
+
status: "exists",
|
|
152
|
+
path: workflowPath,
|
|
153
|
+
relativePath: resultRelativePath
|
|
154
|
+
};
|
|
155
|
+
const configPath = options.configPath ?? findDocsConfigPath(rootDir);
|
|
156
|
+
const configContent = options.configContent ?? readConfig(rootDir, configPath);
|
|
157
|
+
const projectDir = toPosixPath(relative(repoRoot, rootDir)) || ".";
|
|
158
|
+
const packageManager = detectPackageManager(repoRoot);
|
|
159
|
+
const workflow = buildDocsReviewWorkflow({
|
|
160
|
+
packageManager,
|
|
161
|
+
ciName: review.ci.name,
|
|
162
|
+
reusableWorkflow: hasLocalDocsWorkspacePackage(repoRoot) ? LOCAL_DOCS_REVIEW_REUSABLE_WORKFLOW : DEFAULT_DOCS_REVIEW_REUSABLE_WORKFLOW,
|
|
163
|
+
pnpmVersion: detectPnpmVersionFallback(repoRoot, packageManager),
|
|
164
|
+
projectDir,
|
|
165
|
+
configPath,
|
|
166
|
+
buildCommand: detectLocalDocsCliBuildCommand(repoRoot, packageManager),
|
|
167
|
+
reviewCommand: detectLocalDocsCliReviewCommand(repoRoot, rootDir),
|
|
168
|
+
pathFilters: buildDocsReviewWorkflowPathFilters({
|
|
169
|
+
rootDir,
|
|
170
|
+
repoRoot,
|
|
171
|
+
config: options.config,
|
|
172
|
+
configPath,
|
|
173
|
+
configContent
|
|
174
|
+
})
|
|
175
|
+
});
|
|
176
|
+
mkdirSync(dirname(workflowPath), { recursive: true });
|
|
177
|
+
writeFileSync(workflowPath, workflow, "utf-8");
|
|
178
|
+
options.log?.(`[docs] Created ${resultRelativePath} for Docs Review CI.`);
|
|
179
|
+
return {
|
|
180
|
+
status: "created",
|
|
181
|
+
path: workflowPath,
|
|
182
|
+
relativePath: resultRelativePath
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function readDocsReviewConfigFromSource(content) {
|
|
186
|
+
if (!content) return void 0;
|
|
187
|
+
const rootObject = extractRootObjectLiteral(content) ?? content;
|
|
188
|
+
const reviewCursor = findTopLevelPropertyValueIndex(rootObject, "review");
|
|
189
|
+
if (reviewCursor === void 0) return void 0;
|
|
190
|
+
if (rootObject.startsWith("true", reviewCursor)) return true;
|
|
191
|
+
if (rootObject.startsWith("false", reviewCursor)) return false;
|
|
192
|
+
if (rootObject[reviewCursor] !== "{") return void 0;
|
|
193
|
+
const reviewEnd = findMatchingObjectEnd(rootObject, reviewCursor);
|
|
194
|
+
if (reviewEnd === void 0) return void 0;
|
|
195
|
+
const reviewBlock = rootObject.slice(reviewCursor + 1, reviewEnd);
|
|
196
|
+
const scoreBlock = extractTopLevelObjectLiteral(reviewBlock, "score");
|
|
197
|
+
const ciCursor = findTopLevelPropertyValueIndex(reviewBlock, "ci");
|
|
198
|
+
const rulesBlock = extractTopLevelObjectLiteral(reviewBlock, "rules");
|
|
199
|
+
const ci = ciCursor === void 0 ? void 0 : reviewBlock.startsWith("true", ciCursor) ? true : reviewBlock.startsWith("false", ciCursor) ? false : reviewBlock[ciCursor] === "{" ? readReviewCiObject(reviewBlock, ciCursor) : void 0;
|
|
200
|
+
return {
|
|
201
|
+
enabled: readTopLevelBoolean(reviewBlock, "enabled"),
|
|
202
|
+
score: scoreBlock ? {
|
|
203
|
+
threshold: readTopLevelNumber(scoreBlock, "threshold"),
|
|
204
|
+
weights: readReviewWeights(scoreBlock)
|
|
205
|
+
} : void 0,
|
|
206
|
+
ci,
|
|
207
|
+
rules: rulesBlock ? readReviewRules(rulesBlock) : void 0
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function buildDocsReviewWorkflowPathFilters(options) {
|
|
211
|
+
const repoRoot = options.repoRoot ?? findGitRoot(options.rootDir) ?? options.rootDir;
|
|
212
|
+
const configPath = options.configPath ?? findDocsConfigPath(options.rootDir);
|
|
213
|
+
const configContent = options.configContent ?? readConfig(options.rootDir, configPath);
|
|
214
|
+
const entry = options.config?.entry ?? readTopLevelString(configContent, "entry") ?? "docs";
|
|
215
|
+
const contentDir = options.config?.contentDir ?? readTopLevelString(configContent, "contentDir");
|
|
216
|
+
const projectDir = toPosixPath(relative(repoRoot, options.rootDir));
|
|
217
|
+
const projectPrefix = projectDir && projectDir !== "." ? `${projectDir}/` : "";
|
|
218
|
+
const candidates = [
|
|
219
|
+
prefixPath(projectPrefix, configPath),
|
|
220
|
+
prefixPath(projectPrefix, `${entry}/**`),
|
|
221
|
+
prefixPath(projectPrefix, `app/${entry}/**`),
|
|
222
|
+
prefixPath(projectPrefix, `src/app/${entry}/**`),
|
|
223
|
+
contentDir ? prefixPath(projectPrefix, `${trimSlashes(contentDir)}/**`) : void 0,
|
|
224
|
+
prefixPath(projectPrefix, "content/docs/**"),
|
|
225
|
+
prefixPath(projectPrefix, "src/content/docs/**"),
|
|
226
|
+
prefixPath(projectPrefix, "src/lib/docs.config.*"),
|
|
227
|
+
DEFAULT_DOCS_REVIEW_WORKFLOW_PATH,
|
|
228
|
+
DEFAULT_DOCS_REVIEW_REUSABLE_WORKFLOW_PATH,
|
|
229
|
+
...buildAgentSkillPathFilters({
|
|
230
|
+
rootDir: options.rootDir,
|
|
231
|
+
repoRoot,
|
|
232
|
+
skills: options.config?.agent?.skills
|
|
233
|
+
})
|
|
234
|
+
];
|
|
235
|
+
return Array.from(new Set(candidates.filter((candidate) => Boolean(candidate))));
|
|
236
|
+
}
|
|
237
|
+
function buildAgentSkillPathFilters(options) {
|
|
238
|
+
return getDocsAgentSkillsConfiguredPaths(options.skills).map((configuredPath) => {
|
|
239
|
+
const absolutePath = isAbsolute(configuredPath) ? configuredPath : join(options.rootDir, configuredPath);
|
|
240
|
+
const repoRelative = toPosixPath(relative(options.repoRoot, absolutePath));
|
|
241
|
+
if (!repoRelative || repoRelative.startsWith("../")) return void 0;
|
|
242
|
+
return repoRelative.endsWith("/SKILL.md") || repoRelative === "SKILL.md" ? repoRelative : `${repoRelative.replace(/\/+$/u, "")}/**`;
|
|
243
|
+
}).filter((candidate) => Boolean(candidate));
|
|
244
|
+
}
|
|
245
|
+
function normalizeRules(rules) {
|
|
246
|
+
if (!rules) return {};
|
|
247
|
+
const knownRules = new Set(Object.keys(DEFAULT_REVIEW_RULES));
|
|
248
|
+
return Object.fromEntries(Object.entries(rules).filter((entry) => knownRules.has(entry[0]) && REVIEW_SEVERITIES.has(entry[1])));
|
|
249
|
+
}
|
|
250
|
+
function normalizeWeight(value, fallback) {
|
|
251
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : fallback;
|
|
252
|
+
}
|
|
253
|
+
function normalizeCiName(value) {
|
|
254
|
+
return value?.trim() || DEFAULT_DOCS_REVIEW_CI_NAME;
|
|
255
|
+
}
|
|
256
|
+
function clampScoreThreshold(value) {
|
|
257
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return DEFAULT_DOCS_REVIEW_SCORE_THRESHOLD;
|
|
258
|
+
return Math.min(100, Math.max(0, Math.round(value)));
|
|
259
|
+
}
|
|
260
|
+
function readReviewCiObject(source, cursor) {
|
|
261
|
+
const end = findMatchingObjectEnd(source, cursor);
|
|
262
|
+
if (end === void 0) return void 0;
|
|
263
|
+
const block = source.slice(cursor + 1, end);
|
|
264
|
+
const mode = readTopLevelString(block, "mode");
|
|
265
|
+
return {
|
|
266
|
+
enabled: readTopLevelBoolean(block, "enabled"),
|
|
267
|
+
name: readTopLevelString(block, "name"),
|
|
268
|
+
mode: mode && REVIEW_CI_MODES.has(mode) ? mode : void 0,
|
|
269
|
+
annotations: readTopLevelBoolean(block, "annotations"),
|
|
270
|
+
comment: readTopLevelBoolean(block, "comment")
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function readReviewRules(block) {
|
|
274
|
+
const rules = {};
|
|
275
|
+
for (const key of Object.keys(DEFAULT_REVIEW_RULES)) {
|
|
276
|
+
const value = readTopLevelString(block, key);
|
|
277
|
+
if (value && REVIEW_SEVERITIES.has(value)) rules[key] = value;
|
|
278
|
+
}
|
|
279
|
+
return rules;
|
|
280
|
+
}
|
|
281
|
+
function readReviewWeights(block) {
|
|
282
|
+
const weightsBlock = extractTopLevelObjectLiteral(block, "weights");
|
|
283
|
+
if (!weightsBlock) return void 0;
|
|
284
|
+
return {
|
|
285
|
+
error: readTopLevelNumber(weightsBlock, "error"),
|
|
286
|
+
warn: readTopLevelNumber(weightsBlock, "warn"),
|
|
287
|
+
suggestion: readTopLevelNumber(weightsBlock, "suggestion")
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function detectPackageManager(rootDir) {
|
|
291
|
+
if (existsSync(join(rootDir, "pnpm-lock.yaml"))) return "pnpm";
|
|
292
|
+
if (existsSync(join(rootDir, "yarn.lock"))) return "yarn";
|
|
293
|
+
if (existsSync(join(rootDir, "bun.lock")) || existsSync(join(rootDir, "bun.lockb"))) return "bun";
|
|
294
|
+
return "npm";
|
|
295
|
+
}
|
|
296
|
+
function detectLocalDocsCliBuildCommand(repoRoot, packageManager) {
|
|
297
|
+
if (!hasLocalDocsWorkspacePackage(repoRoot)) return void 0;
|
|
298
|
+
if (packageManager === "pnpm") return "pnpm --filter @farming-labs/docs run build";
|
|
299
|
+
if (packageManager === "yarn") return "yarn workspace @farming-labs/docs build";
|
|
300
|
+
if (packageManager === "bun") return "bun run --filter @farming-labs/docs build";
|
|
301
|
+
return "npm run build --workspace=@farming-labs/docs";
|
|
302
|
+
}
|
|
303
|
+
function detectPnpmVersionFallback(repoRoot, packageManager) {
|
|
304
|
+
if (packageManager !== "pnpm") return void 0;
|
|
305
|
+
try {
|
|
306
|
+
if (JSON.parse(readFileSync(join(repoRoot, "package.json"), "utf-8")).packageManager?.startsWith("pnpm@")) return void 0;
|
|
307
|
+
} catch {}
|
|
308
|
+
return DEFAULT_DOCS_REVIEW_PNPM_VERSION;
|
|
309
|
+
}
|
|
310
|
+
function detectLocalDocsCliReviewCommand(repoRoot, rootDir) {
|
|
311
|
+
if (!hasLocalDocsWorkspacePackage(repoRoot)) return void 0;
|
|
312
|
+
return `node ${shellQuote(toPosixPath(relative(rootDir, join(repoRoot, "packages", "docs", "dist", "cli", "index.mjs"))) || "./packages/docs/dist/cli/index.mjs")}`;
|
|
313
|
+
}
|
|
314
|
+
function hasLocalDocsWorkspacePackage(repoRoot) {
|
|
315
|
+
const packageJsonPath = join(repoRoot, "packages", "docs", "package.json");
|
|
316
|
+
if (!existsSync(packageJsonPath)) return false;
|
|
317
|
+
try {
|
|
318
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
319
|
+
return packageJson.name === "@farming-labs/docs" && Boolean(packageJson.scripts?.build);
|
|
320
|
+
} catch {
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function shellQuote(value) {
|
|
325
|
+
if (/^[A-Za-z0-9_./:-]+$/.test(value)) return value;
|
|
326
|
+
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
327
|
+
}
|
|
328
|
+
function normalizeProjectDir(value) {
|
|
329
|
+
if (!value || value === "") return ".";
|
|
330
|
+
return toPosixPath(value).replace(/\/+$/, "") || ".";
|
|
331
|
+
}
|
|
332
|
+
function normalizePathFilters(filters) {
|
|
333
|
+
const normalized = (filters && filters.length > 0 ? filters : ["docs.config.*", "app/docs/**"]).map((filter) => toPosixPath(filter).replace(/^\.\/+/, "")).filter(Boolean);
|
|
334
|
+
return Array.from(new Set(normalized));
|
|
335
|
+
}
|
|
336
|
+
function findGitRoot(start) {
|
|
337
|
+
let current = start;
|
|
338
|
+
while (true) {
|
|
339
|
+
if (existsSync(join(current, ".git"))) return current;
|
|
340
|
+
const parent = dirname(current);
|
|
341
|
+
if (parent === current) return void 0;
|
|
342
|
+
current = parent;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
function findDocsConfigPath(rootDir) {
|
|
346
|
+
for (const ext of FILE_EXTS) {
|
|
347
|
+
const path = `docs.config.${ext}`;
|
|
348
|
+
if (existsSync(join(rootDir, path))) return path;
|
|
349
|
+
}
|
|
350
|
+
return "docs.config.ts";
|
|
351
|
+
}
|
|
352
|
+
function readConfig(rootDir, configPath = findDocsConfigPath(rootDir)) {
|
|
353
|
+
const fullPath = join(rootDir, configPath);
|
|
354
|
+
if (!existsSync(fullPath)) return void 0;
|
|
355
|
+
try {
|
|
356
|
+
return readFileSync(fullPath, "utf-8");
|
|
357
|
+
} catch {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function prefixPath(prefix, value) {
|
|
362
|
+
return `${prefix}${toPosixPath(value).replace(/^\.\/+/, "")}`;
|
|
363
|
+
}
|
|
364
|
+
function trimSlashes(value) {
|
|
365
|
+
return toPosixPath(value).replace(/^\/+|\/+$/g, "");
|
|
366
|
+
}
|
|
367
|
+
function toPosixPath(value) {
|
|
368
|
+
return value.replaceAll("\\", "/");
|
|
369
|
+
}
|
|
370
|
+
function extractRootObjectLiteral(content) {
|
|
371
|
+
const candidateIndexes = [content.search(/\bdefineDocs\s*\(/), content.search(/\bexport\s+default\b/)].filter((value) => value !== -1);
|
|
372
|
+
for (const startIndex of candidateIndexes) {
|
|
373
|
+
const braceStart = content.indexOf("{", startIndex);
|
|
374
|
+
if (braceStart === -1) continue;
|
|
375
|
+
const braceEnd = findMatchingObjectEnd(content, braceStart);
|
|
376
|
+
if (braceEnd !== void 0) return content.slice(braceStart + 1, braceEnd);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
function extractTopLevelObjectLiteral(content, key) {
|
|
380
|
+
const cursor = findTopLevelPropertyValueIndex(content, key);
|
|
381
|
+
if (cursor === void 0 || content[cursor] !== "{") return void 0;
|
|
382
|
+
const end = findMatchingObjectEnd(content, cursor);
|
|
383
|
+
return end === void 0 ? void 0 : content.slice(cursor + 1, end);
|
|
384
|
+
}
|
|
385
|
+
function readTopLevelBoolean(content, key) {
|
|
386
|
+
const cursor = findTopLevelPropertyValueIndex(content, key);
|
|
387
|
+
if (cursor === void 0) return void 0;
|
|
388
|
+
if (content.startsWith("true", cursor)) return true;
|
|
389
|
+
if (content.startsWith("false", cursor)) return false;
|
|
390
|
+
}
|
|
391
|
+
function readTopLevelNumber(content, key) {
|
|
392
|
+
const cursor = findTopLevelPropertyValueIndex(content, key);
|
|
393
|
+
if (cursor === void 0) return void 0;
|
|
394
|
+
const match = content.slice(cursor).match(/^-?\d+(?:\.\d+)?/);
|
|
395
|
+
if (!match) return void 0;
|
|
396
|
+
const value = Number(match[0]);
|
|
397
|
+
return Number.isFinite(value) ? value : void 0;
|
|
398
|
+
}
|
|
399
|
+
function readTopLevelString(content, key) {
|
|
400
|
+
if (!content) return void 0;
|
|
401
|
+
const cursor = findTopLevelPropertyValueIndex(content, key);
|
|
402
|
+
if (cursor === void 0) return void 0;
|
|
403
|
+
const quote = content[cursor];
|
|
404
|
+
if (quote !== "\"" && quote !== "'") return void 0;
|
|
405
|
+
let value = "";
|
|
406
|
+
for (let index = cursor + 1; index < content.length; index += 1) {
|
|
407
|
+
const char = content[index];
|
|
408
|
+
if (char === "\\") {
|
|
409
|
+
const escaped = content[index + 1];
|
|
410
|
+
if (escaped) {
|
|
411
|
+
value += escaped;
|
|
412
|
+
index += 1;
|
|
413
|
+
}
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
if (char === quote) return value;
|
|
417
|
+
value += char;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
function findTopLevelPropertyValueIndex(block, key) {
|
|
421
|
+
let objectDepth = 0;
|
|
422
|
+
let arrayDepth = 0;
|
|
423
|
+
let parenDepth = 0;
|
|
424
|
+
let inString = null;
|
|
425
|
+
let inLineComment = false;
|
|
426
|
+
let inBlockComment = false;
|
|
427
|
+
let escaped = false;
|
|
428
|
+
for (let index = 0; index < block.length; index += 1) {
|
|
429
|
+
const char = block[index];
|
|
430
|
+
const next = block[index + 1];
|
|
431
|
+
if (inLineComment) {
|
|
432
|
+
if (char === "\n") inLineComment = false;
|
|
433
|
+
continue;
|
|
434
|
+
}
|
|
435
|
+
if (inBlockComment) {
|
|
436
|
+
if (char === "*" && next === "/") {
|
|
437
|
+
inBlockComment = false;
|
|
438
|
+
index += 1;
|
|
439
|
+
}
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
if (inString) {
|
|
443
|
+
if (escaped) {
|
|
444
|
+
escaped = false;
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
if (char === "\\") {
|
|
448
|
+
escaped = true;
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
451
|
+
if (char === inString) inString = null;
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
if (char === "/" && next === "/") {
|
|
455
|
+
inLineComment = true;
|
|
456
|
+
index += 1;
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
if (char === "/" && next === "*") {
|
|
460
|
+
inBlockComment = true;
|
|
461
|
+
index += 1;
|
|
462
|
+
continue;
|
|
463
|
+
}
|
|
464
|
+
if (char === "\"" || char === "'" || char === "`") {
|
|
465
|
+
inString = char;
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
if (char === "{") {
|
|
469
|
+
objectDepth += 1;
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
472
|
+
if (char === "}") {
|
|
473
|
+
objectDepth = Math.max(0, objectDepth - 1);
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
if (char === "[") {
|
|
477
|
+
arrayDepth += 1;
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
if (char === "]") {
|
|
481
|
+
arrayDepth = Math.max(0, arrayDepth - 1);
|
|
482
|
+
continue;
|
|
483
|
+
}
|
|
484
|
+
if (char === "(") {
|
|
485
|
+
parenDepth += 1;
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
if (char === ")") {
|
|
489
|
+
parenDepth = Math.max(0, parenDepth - 1);
|
|
490
|
+
continue;
|
|
491
|
+
}
|
|
492
|
+
if (objectDepth !== 0 || arrayDepth !== 0 || parenDepth !== 0) continue;
|
|
493
|
+
if (!block.startsWith(key, index)) continue;
|
|
494
|
+
const before = block[index - 1] ?? "";
|
|
495
|
+
const after = block[index + key.length] ?? "";
|
|
496
|
+
if (/[A-Za-z0-9_$]/.test(before) || /[A-Za-z0-9_$]/.test(after)) continue;
|
|
497
|
+
let cursor = index + key.length;
|
|
498
|
+
while (/\s/.test(block[cursor] ?? "")) cursor += 1;
|
|
499
|
+
if (block[cursor] !== ":") continue;
|
|
500
|
+
cursor += 1;
|
|
501
|
+
while (/\s/.test(block[cursor] ?? "")) cursor += 1;
|
|
502
|
+
return cursor;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
function findMatchingObjectEnd(block, start) {
|
|
506
|
+
let depth = 0;
|
|
507
|
+
let inString = null;
|
|
508
|
+
let inLineComment = false;
|
|
509
|
+
let inBlockComment = false;
|
|
510
|
+
let escaped = false;
|
|
511
|
+
for (let index = start; index < block.length; index += 1) {
|
|
512
|
+
const char = block[index];
|
|
513
|
+
const next = block[index + 1];
|
|
514
|
+
if (inLineComment) {
|
|
515
|
+
if (char === "\n") inLineComment = false;
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
if (inBlockComment) {
|
|
519
|
+
if (char === "*" && next === "/") {
|
|
520
|
+
inBlockComment = false;
|
|
521
|
+
index += 1;
|
|
522
|
+
}
|
|
523
|
+
continue;
|
|
524
|
+
}
|
|
525
|
+
if (inString) {
|
|
526
|
+
if (escaped) {
|
|
527
|
+
escaped = false;
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
if (char === "\\") {
|
|
531
|
+
escaped = true;
|
|
532
|
+
continue;
|
|
533
|
+
}
|
|
534
|
+
if (char === inString) inString = null;
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
if (char === "/" && next === "/") {
|
|
538
|
+
inLineComment = true;
|
|
539
|
+
index += 1;
|
|
540
|
+
continue;
|
|
541
|
+
}
|
|
542
|
+
if (char === "/" && next === "*") {
|
|
543
|
+
inBlockComment = true;
|
|
544
|
+
index += 1;
|
|
545
|
+
continue;
|
|
546
|
+
}
|
|
547
|
+
if (char === "\"" || char === "'" || char === "`") {
|
|
548
|
+
inString = char;
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
551
|
+
if (char === "{") {
|
|
552
|
+
depth += 1;
|
|
553
|
+
continue;
|
|
554
|
+
}
|
|
555
|
+
if (char !== "}") continue;
|
|
556
|
+
depth -= 1;
|
|
557
|
+
if (depth === 0) return index;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
//#endregion
|
|
562
|
+
export { DEFAULT_DOCS_REVIEW_SCORE_THRESHOLD, DEFAULT_DOCS_REVIEW_WORKFLOW_PATH, buildDocsReviewWorkflow, buildDocsReviewWorkflowPathFilters, ensureDocsReviewWorkflow, readDocsReviewConfigFromSource, resolveDocsReviewConfig };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { DocsRobotsConfig, DocsRobotsRule, DocsSitemapConfig } from "./types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/robots.d.ts
|
|
4
|
+
declare const DEFAULT_ROBOTS_TXT_ROUTE = "/robots.txt";
|
|
5
|
+
declare const DOCS_ROBOTS_GENERATED_BLOCK_START = "# BEGIN @farming-labs/docs robots";
|
|
6
|
+
declare const DOCS_ROBOTS_GENERATED_BLOCK_END = "# END @farming-labs/docs robots";
|
|
7
|
+
declare const DEFAULT_DOCS_AI_ROBOTS_USER_AGENTS: readonly ["GPTBot", "ChatGPT-User", "OAI-SearchBot", "ClaudeBot", "Claude-User", "anthropic-ai", "CCBot", "Google-Extended"];
|
|
8
|
+
interface DocsRobotsResolvedConfig {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
path?: string;
|
|
11
|
+
baseUrl?: string;
|
|
12
|
+
ai: "allow" | "disallow";
|
|
13
|
+
userAgents: string[];
|
|
14
|
+
extraRules: DocsRobotsRule[];
|
|
15
|
+
}
|
|
16
|
+
interface DocsRobotsRenderOptions {
|
|
17
|
+
entry?: string;
|
|
18
|
+
/** Include the RFC 9727 catalog route only when the deployment actually serves it. */
|
|
19
|
+
apiCatalog?: boolean;
|
|
20
|
+
/** Include an A2A Agent Card only when a real A2A service is configured. */
|
|
21
|
+
agentCard?: boolean;
|
|
22
|
+
sitemap?: boolean | DocsSitemapConfig;
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
robots?: boolean | DocsRobotsConfig;
|
|
25
|
+
}
|
|
26
|
+
interface DocsRobotsAnalysis {
|
|
27
|
+
blocksAgentRoutes: boolean;
|
|
28
|
+
blocksAiAgents: boolean;
|
|
29
|
+
hasAgentRoutes: boolean;
|
|
30
|
+
hasAiPolicy: boolean;
|
|
31
|
+
missingRoutes: string[];
|
|
32
|
+
}
|
|
33
|
+
interface DocsRobotsAnalysisOptions extends DocsRobotsRenderOptions {
|
|
34
|
+
/** Exact sitemap routes advertised by a fetched discovery manifest. */
|
|
35
|
+
sitemapRoutes?: readonly string[];
|
|
36
|
+
}
|
|
37
|
+
interface CreateDocsRobotsResponseOptions extends DocsRobotsRenderOptions {
|
|
38
|
+
request: Request;
|
|
39
|
+
}
|
|
40
|
+
declare function resolveDocsRobotsConfig(input: boolean | DocsRobotsConfig | undefined, options?: {
|
|
41
|
+
baseUrl?: string;
|
|
42
|
+
}): DocsRobotsResolvedConfig;
|
|
43
|
+
declare function getDocsRobotsAllowRoutes(options?: DocsRobotsRenderOptions): string[];
|
|
44
|
+
declare function renderDocsRobotsTxt(options?: DocsRobotsRenderOptions): string;
|
|
45
|
+
declare function resolveDocsRobotsRequest(url: URL, robots?: boolean | DocsRobotsConfig): "robots" | null;
|
|
46
|
+
declare function createDocsRobotsResponse({
|
|
47
|
+
request,
|
|
48
|
+
...options
|
|
49
|
+
}: CreateDocsRobotsResponseOptions): Response | null;
|
|
50
|
+
declare function renderDocsRobotsGeneratedBlock(options?: DocsRobotsRenderOptions): string;
|
|
51
|
+
declare function upsertDocsRobotsGeneratedBlock(existing: string, block: string): string;
|
|
52
|
+
declare function analyzeDocsRobotsTxt(content: string, options?: DocsRobotsAnalysisOptions): DocsRobotsAnalysis;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { DEFAULT_DOCS_AI_ROBOTS_USER_AGENTS, DEFAULT_ROBOTS_TXT_ROUTE, DOCS_ROBOTS_GENERATED_BLOCK_END, DOCS_ROBOTS_GENERATED_BLOCK_START, DocsRobotsAnalysis, DocsRobotsAnalysisOptions, DocsRobotsRenderOptions, DocsRobotsResolvedConfig, analyzeDocsRobotsTxt, createDocsRobotsResponse, getDocsRobotsAllowRoutes, renderDocsRobotsGeneratedBlock, renderDocsRobotsTxt, resolveDocsRobotsConfig, resolveDocsRobotsRequest, upsertDocsRobotsGeneratedBlock };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { DEFAULT_MCP_PUBLIC_ROUTE, DEFAULT_MCP_WELL_KNOWN_ROUTE } from "./mcp-auth.mjs";
|
|
2
|
+
import { DEFAULT_A2A_AGENT_CARD_ROUTE, DEFAULT_AGENT_SKILLS_INDEX_ROUTE, DEFAULT_AGENT_SKILLS_ROUTE_PREFIX, DEFAULT_API_CATALOG_ROUTE, DEFAULT_LEGACY_SKILLS_INDEX_ROUTE, DEFAULT_LEGACY_SKILLS_ROUTE_PREFIX } from "./standards-discovery.mjs";
|
|
3
|
+
import { resolveDocsSitemapConfig } from "./sitemap.mjs";
|
|
4
|
+
import { DEFAULT_AGENTS_MD_ROUTE, DEFAULT_AGENTS_MD_WELL_KNOWN_ROUTE, DEFAULT_AGENT_MD_ROUTE, DEFAULT_AGENT_MD_WELL_KNOWN_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_JSON_ROUTE, DEFAULT_AGENT_SPEC_WELL_KNOWN_ROUTE, DEFAULT_LLMS_FULL_TXT_ROUTE, DEFAULT_LLMS_FULL_TXT_WELL_KNOWN_ROUTE, DEFAULT_LLMS_TXT_ROUTE, DEFAULT_LLMS_TXT_WELL_KNOWN_ROUTE, DEFAULT_SKILL_MD_ROUTE, DEFAULT_SKILL_MD_WELL_KNOWN_ROUTE, normalizeDocsPathSegment } from "./agent.mjs";
|
|
3
5
|
|
|
4
6
|
//#region src/robots.ts
|
|
5
7
|
const DEFAULT_ROBOTS_TXT_ROUTE = "/robots.txt";
|
|
@@ -266,4 +268,4 @@ function analyzeDocsRobotsTxt(content, options = {}) {
|
|
|
266
268
|
}
|
|
267
269
|
|
|
268
270
|
//#endregion
|
|
269
|
-
export {
|
|
271
|
+
export { DEFAULT_DOCS_AI_ROBOTS_USER_AGENTS, DEFAULT_ROBOTS_TXT_ROUTE, DOCS_ROBOTS_GENERATED_BLOCK_END, DOCS_ROBOTS_GENERATED_BLOCK_START, analyzeDocsRobotsTxt, createDocsRobotsResponse, getDocsRobotsAllowRoutes, renderDocsRobotsGeneratedBlock, renderDocsRobotsTxt, resolveDocsRobotsConfig, resolveDocsRobotsRequest, upsertDocsRobotsGeneratedBlock };
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./content-change-hydration-wqXIZHp6.mjs";
|
|
1
|
+
import { resolveConfiguredAgentSkills } from "./agent-skills-server.mjs";
|
|
3
2
|
import { DocsMcpPage, createDocsMcpHttpHandler, createFilesystemDocsMcpSource, resolveDocsMcpConfig } from "./mcp.mjs";
|
|
4
|
-
import {
|
|
3
|
+
import { buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocumentAsync, buildApiReferenceOperationPagesAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, createApiReferenceOperationMarkdownResponse, resolveApiReferenceConfig, resolveApiReferenceOpenApiDiscovery, resolveApiReferenceRenderer, resolveApiReferenceVersion, resolveApiReferenceVersionFromPathname } from "./api-reference.mjs";
|
|
4
|
+
import { readDocsSitemapManifest } from "./sitemap-server.mjs";
|
|
5
5
|
export { type DocsMcpPage, buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocumentAsync, buildApiReferenceOperationPagesAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, createApiReferenceOperationMarkdownResponse, createDocsMcpHttpHandler, createFilesystemDocsMcpSource, readDocsSitemapManifest, resolveApiReferenceConfig, resolveApiReferenceOpenApiDiscovery, resolveApiReferenceRenderer, resolveApiReferenceVersion, resolveApiReferenceVersionFromPathname, resolveConfiguredAgentSkills, resolveDocsMcpConfig };
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./
|
|
3
|
-
import "./agent-DkAidqtV.mjs";
|
|
4
|
-
import "./standards-discovery-sSEojU80.mjs";
|
|
5
|
-
import "./sidebar-CFHBj29f.mjs";
|
|
6
|
-
import "./openapi-mcp-BIOTLiA7.mjs";
|
|
7
|
-
import { a as buildApiReferenceOpenApiDocumentAsync, c as buildApiReferenceScalarCss, f as resolveApiReferenceConfig, g as resolveApiReferenceVersionFromPathname, h as resolveApiReferenceVersion, l as createApiReferenceOperationMarkdownResponse, m as resolveApiReferenceRenderer, o as buildApiReferenceOperationPagesAsync, p as resolveApiReferenceOpenApiDiscovery, r as buildApiReferenceHtmlDocumentAsync, s as buildApiReferencePageTitle } from "./api-reference-BYee4zMo.mjs";
|
|
8
|
-
import { r as resolveConfiguredAgentSkills } from "./agent-skills-server-BC7md56k.mjs";
|
|
1
|
+
import { buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocumentAsync, buildApiReferenceOperationPagesAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, createApiReferenceOperationMarkdownResponse, resolveApiReferenceConfig, resolveApiReferenceOpenApiDiscovery, resolveApiReferenceRenderer, resolveApiReferenceVersion, resolveApiReferenceVersionFromPathname } from "./api-reference.mjs";
|
|
2
|
+
import { resolveConfiguredAgentSkills } from "./agent-skills-server.mjs";
|
|
9
3
|
import { createDocsMcpHttpHandler, createFilesystemDocsMcpSource, resolveDocsMcpConfig } from "./mcp.mjs";
|
|
10
|
-
import {
|
|
4
|
+
import { readDocsSitemapManifest } from "./sitemap-server.mjs";
|
|
11
5
|
|
|
12
6
|
export { buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocumentAsync, buildApiReferenceOperationPagesAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, createApiReferenceOperationMarkdownResponse, createDocsMcpHttpHandler, createFilesystemDocsMcpSource, readDocsSitemapManifest, resolveApiReferenceConfig, resolveApiReferenceOpenApiDiscovery, resolveApiReferenceRenderer, resolveApiReferenceVersion, resolveApiReferenceVersionFromPathname, resolveConfiguredAgentSkills, resolveDocsMcpConfig };
|