@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,247 +0,0 @@
1
- import { Lt as renderDocsSitemapMarkdown, Pt as buildDocsSitemapManifest, Rt as renderDocsSitemapXml, zt as resolveDocsSitemapConfig } from "./agent-BFqyqEnC.mjs";
2
- import "./search-D57JXQLj.mjs";
3
- import "./sitemap-server-C1ibVKOy.mjs";
4
- import "./agent-evals-kJs2Y9xR.mjs";
5
- import { createFilesystemDocsMcpSource } from "./mcp.mjs";
6
- import "./code-blocks-qe0T8-xe.mjs";
7
- import "./server.mjs";
8
- import { d as readStringProperty, h as resolveDocsContentDir, i as loadDocsConfigModule, l as readNavTitle, m as resolveDocsConfigPath, p as readTopLevelStringProperty, s as readBooleanProperty, t as extractNestedObjectLiteral } from "./config-DASewQ0x.mjs";
9
- import { t as detectFramework } from "./utils-6UCLxv4B.mjs";
10
- import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
11
- import path from "node:path";
12
- import { execFileSync } from "node:child_process";
13
- import pc from "picocolors";
14
-
15
- //#region src/cli/sitemap.ts
16
- function normalizePathSegment(value) {
17
- return value.replace(/^\/+|\/+$/g, "");
18
- }
19
- function parseInlineFlag(arg) {
20
- const [rawKey, value] = arg.slice(2).split("=", 2);
21
- return {
22
- key: rawKey.trim(),
23
- value
24
- };
25
- }
26
- function parseSitemapGenerateArgs(argv) {
27
- const parsed = {};
28
- for (let index = 0; index < argv.length; index += 1) {
29
- const arg = argv[index];
30
- if (arg === "--help" || arg === "-h") {
31
- parsed.help = true;
32
- continue;
33
- }
34
- if (arg === "--public") {
35
- parsed.public = true;
36
- continue;
37
- }
38
- if (arg === "--manifest-only") {
39
- parsed.manifestOnly = true;
40
- continue;
41
- }
42
- if (arg === "--check") {
43
- parsed.check = true;
44
- continue;
45
- }
46
- if (arg.startsWith("--config=")) {
47
- const value = parseInlineFlag(arg).value;
48
- if (!value) throw new Error("Missing value for --config.");
49
- parsed.configPath = value;
50
- continue;
51
- }
52
- if (arg === "--config") {
53
- const value = argv[index + 1];
54
- if (!value || value.startsWith("--")) throw new Error("Missing value for --config.");
55
- parsed.configPath = value;
56
- index += 1;
57
- continue;
58
- }
59
- throw new Error(`Unknown sitemap generate flag: ${arg}.`);
60
- }
61
- return parsed;
62
- }
63
- function readLlmsBaseUrlFromConfig(content, config) {
64
- if (config?.llmsTxt && typeof config.llmsTxt === "object") return config.llmsTxt.baseUrl;
65
- const block = extractNestedObjectLiteral(content, ["llmsTxt"]);
66
- return block ? readStringProperty(block, "baseUrl") : void 0;
67
- }
68
- function readSitemapConfigFromStatic(content) {
69
- if (/\bsitemap\s*:\s*false/.test(content)) return false;
70
- if (/\bsitemap\s*:\s*true/.test(content)) return true;
71
- const block = extractNestedObjectLiteral(content, ["sitemap"]);
72
- if (!block) return void 0;
73
- return {
74
- enabled: readBooleanProperty(block, "enabled") ?? true,
75
- routePrefix: readStringProperty(block, "routePrefix"),
76
- baseUrl: readStringProperty(block, "baseUrl"),
77
- manifestPath: readStringProperty(block, "manifestPath")
78
- };
79
- }
80
- function resolveConfiguredSitemap(content, config) {
81
- if (config?.sitemap !== void 0) return config.sitemap;
82
- return readSitemapConfigFromStatic(content) ?? true;
83
- }
84
- function formatDateOnly(value) {
85
- const parsed = new Date(value);
86
- if (Number.isNaN(parsed.getTime())) return void 0;
87
- return parsed.toISOString().slice(0, 10);
88
- }
89
- function gitLastCommitDate(rootDir, sourcePath) {
90
- if (!sourcePath) return void 0;
91
- try {
92
- return formatDateOnly(execFileSync("git", [
93
- "log",
94
- "-1",
95
- "--format=%cI",
96
- "--",
97
- sourcePath
98
- ], {
99
- cwd: rootDir,
100
- encoding: "utf-8",
101
- stdio: [
102
- "ignore",
103
- "pipe",
104
- "ignore"
105
- ]
106
- }).trim());
107
- } catch {
108
- return;
109
- }
110
- }
111
- function fileModifiedDate(rootDir, sourcePath) {
112
- if (!sourcePath) return void 0;
113
- const fullPath = path.isAbsolute(sourcePath) ? sourcePath : path.join(rootDir, sourcePath);
114
- if (!existsSync(fullPath)) return void 0;
115
- try {
116
- return statSync(fullPath).mtime.toISOString().slice(0, 10);
117
- } catch {
118
- return;
119
- }
120
- }
121
- function writeIfChanged(filePath, content, check) {
122
- if ((existsSync(filePath) ? readFileSync(filePath, "utf-8") : void 0) === content) return false;
123
- if (check) return true;
124
- mkdirSync(path.dirname(filePath), { recursive: true });
125
- writeFileSync(filePath, content, "utf-8");
126
- return true;
127
- }
128
- function readExistingManifest(filePath) {
129
- if (!existsSync(filePath)) return void 0;
130
- try {
131
- return JSON.parse(readFileSync(filePath, "utf-8"));
132
- } catch {
133
- return;
134
- }
135
- }
136
- function comparableManifest(manifest) {
137
- return {
138
- ...manifest,
139
- generatedAt: ""
140
- };
141
- }
142
- function preserveGeneratedAtWhenUnchanged(manifest, existing) {
143
- if (!existing?.generatedAt) return manifest;
144
- if (JSON.stringify(comparableManifest(manifest)) !== JSON.stringify(comparableManifest(existing))) return manifest;
145
- return {
146
- ...manifest,
147
- generatedAt: existing.generatedAt
148
- };
149
- }
150
- function resolvePublicDir(rootDir) {
151
- if (detectFramework(rootDir) === "sveltekit") return path.join(rootDir, "static");
152
- return path.join(rootDir, "public");
153
- }
154
- function publicFilePath(rootDir, route) {
155
- return path.join(resolvePublicDir(rootDir), route.replace(/^\/+/, ""));
156
- }
157
- async function generateSitemap(options = {}) {
158
- const rootDir = process.cwd();
159
- const loadedConfigModule = await loadDocsConfigModule(rootDir, options.configPath);
160
- const configContent = readFileSync(loadedConfigModule?.path ?? resolveDocsConfigPath(rootDir, options.configPath), "utf-8");
161
- const config = loadedConfigModule?.config;
162
- const entry = normalizePathSegment(config?.entry ?? readTopLevelStringProperty(configContent, "entry") ?? "docs") || "docs";
163
- const contentDir = typeof config?.contentDir === "string" ? config.contentDir : resolveDocsContentDir(rootDir, configContent, entry);
164
- const siteTitle = typeof config?.nav?.title === "string" ? config.nav.title : readNavTitle(configContent) ?? "Documentation";
165
- const sitemapInput = resolveConfiguredSitemap(configContent, config);
166
- if (sitemapInput === false) throw new Error("Sitemap generation is disabled by `sitemap: false`.");
167
- const sitemap = resolveDocsSitemapConfig(sitemapInput, { baseUrl: (typeof sitemapInput === "object" ? sitemapInput.baseUrl : void 0) ?? readLlmsBaseUrlFromConfig(configContent, config) });
168
- const source = createFilesystemDocsMcpSource({
169
- rootDir,
170
- entry,
171
- contentDir,
172
- siteTitle,
173
- ordering: config?.ordering
174
- });
175
- const pages = await Promise.resolve(source.getPages());
176
- if (pages.length === 0) throw new Error(`No docs content was found under ${contentDir}.`);
177
- const builtManifest = buildDocsSitemapManifest({
178
- pages,
179
- entry,
180
- siteTitle,
181
- baseUrl: sitemap.baseUrl,
182
- resolveLastmod(page) {
183
- const gitDate = gitLastCommitDate(rootDir, page.sourcePath);
184
- if (gitDate) return {
185
- lastmod: gitDate,
186
- lastmodSource: "git"
187
- };
188
- const fsDate = fileModifiedDate(rootDir, page.sourcePath);
189
- if (fsDate) return {
190
- lastmod: fsDate,
191
- lastmodSource: "filesystem"
192
- };
193
- }
194
- });
195
- const manifestPath = path.resolve(rootDir, sitemap.manifestPath);
196
- const manifest = preserveGeneratedAtWhenUnchanged(builtManifest, readExistingManifest(manifestPath));
197
- const manifestChanged = writeIfChanged(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`, options.check === true);
198
- const shouldWritePublic = options.manifestOnly !== true;
199
- const publicWrites = [];
200
- if (shouldWritePublic) {
201
- const xml = renderDocsSitemapXml(manifest, {
202
- baseUrl: sitemap.baseUrl,
203
- includeLastmod: sitemap.xml.includeLastmod
204
- });
205
- const markdown = renderDocsSitemapMarkdown(manifest, {
206
- baseUrl: sitemap.baseUrl,
207
- includeDescriptions: sitemap.markdown.includeDescriptions,
208
- includeLastmod: sitemap.markdown.includeLastmod,
209
- linkTarget: sitemap.markdown.linkTarget
210
- });
211
- if (sitemap.xml.enabled) {
212
- const filePath = publicFilePath(rootDir, sitemap.xml.route);
213
- if (writeIfChanged(filePath, xml, options.check === true)) publicWrites.push(filePath);
214
- }
215
- if (sitemap.markdown.enabled) for (const route of [
216
- sitemap.markdown.route,
217
- sitemap.markdown.docsRoute,
218
- sitemap.markdown.wellKnownRoute
219
- ]) {
220
- if (!route) continue;
221
- const filePath = publicFilePath(rootDir, route);
222
- if (writeIfChanged(filePath, markdown, options.check === true)) publicWrites.push(filePath);
223
- }
224
- }
225
- if (options.check && (manifestChanged || publicWrites.length > 0)) throw new Error("Sitemap output is stale. Run `docs sitemap generate` to update it.");
226
- console.log(pc.green(`Generated sitemap manifest for ${manifest.pages.length} page(s).`));
227
- console.log(pc.dim(path.relative(rootDir, manifestPath)));
228
- for (const filePath of publicWrites) console.log(pc.dim(path.relative(rootDir, filePath)));
229
- }
230
- function printSitemapGenerateHelp() {
231
- console.log(`
232
- ${pc.bold("docs sitemap generate")} — Generate sitemap metadata and static sitemap files.
233
-
234
- ${pc.dim("Usage:")}
235
- pnpm exec docs ${pc.cyan("sitemap generate")}
236
-
237
- ${pc.dim("Options:")}
238
- ${pc.cyan("--config <path>")} Use a custom docs config path instead of ${pc.dim("docs.config.ts[x]")}
239
- ${pc.cyan("--public")} Explicitly write public sitemap.xml, sitemap.md, and docs/sitemap.md files
240
- ${pc.cyan("--manifest-only")} Only write the internal sitemap manifest
241
- ${pc.cyan("--check")} Fail if generated output is stale
242
- ${pc.cyan("-h, --help")} Show this help message
243
- `);
244
- }
245
-
246
- //#endregion
247
- export { generateSitemap, parseSitemapGenerateArgs, printSitemapGenerateHelp };