@farming-labs/docs 0.1.40 → 0.1.41
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-CoO9z8aW.mjs +359 -0
- package/dist/agent-qcweNgy-.mjs +588 -0
- package/dist/cli/index.mjs +29 -4
- package/dist/config-CyqDp8tD.mjs +270 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -585
- package/dist/{init-DHlRFytW.mjs → init-9U8AijRu.mjs} +1 -1
- package/dist/{mcp-DLP94P1H.mjs → mcp-1j3-_z66.mjs} +2 -2
- package/dist/mcp.d.mts +1 -1
- package/dist/mcp.mjs +1 -1
- package/dist/{search-CNesqs89.mjs → search-B2HvbbeE.mjs} +4 -4
- package/dist/{search-BWqFW9rt.d.mts → search-C15yRNVE.d.mts} +1 -1
- package/dist/server.d.mts +2 -2
- package/dist/server.mjs +2 -2
- package/dist/{types-CP2NmW5c.d.mts → types-CKdSg7n8.d.mts} +49 -0
- package/dist/{upgrade-J_kkv-ti.mjs → upgrade-BGWZ_NLh.mjs} +1 -1
- package/package.json +2 -1
- package/dist/config-CSywk3ou.mjs +0 -95
- /package/dist/{api-reference-BQ16eRPP.mjs → api-reference-GDAEzQn1.mjs} +0 -0
- /package/dist/{search-CfnJVeh-.mjs → search-8oEskRtz.mjs} +0 -0
- /package/dist/{utils-CRhME2g-.mjs → utils-CpTFbAiS.mjs} +0 -0
package/dist/server.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as createSimpleSearchAdapter, c as resolveSearchRequestConfig, i as createMcpSearchAdapter, n as createAlgoliaSearchAdapter, o as createTypesenseSearchAdapter, r as createCustomSearchAdapter, s as performDocsSearch, t as buildDocsSearchDocuments } from "./search-
|
|
2
|
-
import { a as buildApiReferencePageTitle, c as resolveApiReferenceRenderer, i as buildApiReferenceOpenApiDocumentAsync, n as buildApiReferenceHtmlDocumentAsync, o as buildApiReferenceScalarCss, r as buildApiReferenceOpenApiDocument, s as resolveApiReferenceConfig, t as buildApiReferenceHtmlDocument } from "./api-reference-
|
|
1
|
+
import { a as createSimpleSearchAdapter, c as resolveSearchRequestConfig, i as createMcpSearchAdapter, n as createAlgoliaSearchAdapter, o as createTypesenseSearchAdapter, r as createCustomSearchAdapter, s as performDocsSearch, t as buildDocsSearchDocuments } from "./search-8oEskRtz.mjs";
|
|
2
|
+
import { a as buildApiReferencePageTitle, c as resolveApiReferenceRenderer, i as buildApiReferenceOpenApiDocumentAsync, n as buildApiReferenceHtmlDocumentAsync, o as buildApiReferenceScalarCss, r as buildApiReferenceOpenApiDocument, s as resolveApiReferenceConfig, t as buildApiReferenceHtmlDocument } from "./api-reference-GDAEzQn1.mjs";
|
|
3
3
|
import { createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
|
|
4
4
|
|
|
5
5
|
export { buildApiReferenceHtmlDocument, buildApiReferenceHtmlDocumentAsync, buildApiReferenceOpenApiDocument, buildApiReferenceOpenApiDocumentAsync, buildApiReferencePageTitle, buildApiReferenceScalarCss, buildDocsSearchDocuments, createAlgoliaSearchAdapter, createCustomSearchAdapter, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, createMcpSearchAdapter, createSimpleSearchAdapter, createTypesenseSearchAdapter, normalizeDocsMcpRoute, performDocsSearch, resolveApiReferenceConfig, resolveApiReferenceRenderer, resolveDocsMcpConfig, resolveSearchRequestConfig, runDocsMcpStdio };
|
|
@@ -1453,6 +1453,51 @@ interface ApiReferenceConfig {
|
|
|
1453
1453
|
*/
|
|
1454
1454
|
exclude?: string[];
|
|
1455
1455
|
}
|
|
1456
|
+
interface DocsAgentCompactConfig {
|
|
1457
|
+
/**
|
|
1458
|
+
* Direct API key for the Token Company compression API.
|
|
1459
|
+
*
|
|
1460
|
+
* Prefer `apiKeyEnv` for checked-in config files so secrets stay in the environment.
|
|
1461
|
+
*/
|
|
1462
|
+
apiKey?: string;
|
|
1463
|
+
/**
|
|
1464
|
+
* Environment variable name that stores the Token Company API key.
|
|
1465
|
+
*/
|
|
1466
|
+
apiKeyEnv?: string;
|
|
1467
|
+
/**
|
|
1468
|
+
* Base URL for the Token Company API.
|
|
1469
|
+
*/
|
|
1470
|
+
baseUrl?: string;
|
|
1471
|
+
/**
|
|
1472
|
+
* Compression model name.
|
|
1473
|
+
* @default "bear-1.2"
|
|
1474
|
+
*/
|
|
1475
|
+
model?: string;
|
|
1476
|
+
/**
|
|
1477
|
+
* Compression aggressiveness passed to the API.
|
|
1478
|
+
* Must be between `0` and `1`.
|
|
1479
|
+
* @default 0.3
|
|
1480
|
+
*/
|
|
1481
|
+
aggressiveness?: number;
|
|
1482
|
+
/**
|
|
1483
|
+
* Upper token target for compressed output.
|
|
1484
|
+
*/
|
|
1485
|
+
maxOutputTokens?: number;
|
|
1486
|
+
/**
|
|
1487
|
+
* Lower token target for compressed output.
|
|
1488
|
+
*/
|
|
1489
|
+
minOutputTokens?: number;
|
|
1490
|
+
/**
|
|
1491
|
+
* Preserve JSON objects during compression when supported by the provider.
|
|
1492
|
+
*/
|
|
1493
|
+
protectJson?: boolean;
|
|
1494
|
+
}
|
|
1495
|
+
interface DocsAgentConfig {
|
|
1496
|
+
/**
|
|
1497
|
+
* Defaults for `docs agent compact`.
|
|
1498
|
+
*/
|
|
1499
|
+
compact?: DocsAgentCompactConfig;
|
|
1500
|
+
}
|
|
1456
1501
|
interface DocsConfig {
|
|
1457
1502
|
/** Entry folder for docs (e.g. "docs" → /docs) */
|
|
1458
1503
|
entry: string;
|
|
@@ -1812,6 +1857,10 @@ interface DocsConfig {
|
|
|
1812
1857
|
* ```
|
|
1813
1858
|
*/
|
|
1814
1859
|
apiReference?: boolean | ApiReferenceConfig;
|
|
1860
|
+
/**
|
|
1861
|
+
* Agent-oriented configuration, including defaults for `docs agent compact`.
|
|
1862
|
+
*/
|
|
1863
|
+
agent?: DocsAgentConfig;
|
|
1815
1864
|
/** SEO metadata - separate from theme */
|
|
1816
1865
|
metadata?: DocsMetadata;
|
|
1817
1866
|
/** Open Graph image handling */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as installCommand, i as detectPackageManagerFromLockfile, o as exec, s as fileExists, t as detectFramework } from "./utils-
|
|
1
|
+
import { c as installCommand, i as detectPackageManagerFromLockfile, o as exec, s as fileExists, t as detectFramework } from "./utils-CpTFbAiS.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import pc from "picocolors";
|
|
4
4
|
import * as p from "@clack/prompts";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farming-labs/docs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.41",
|
|
4
4
|
"description": "Modern, flexible MDX-based docs framework — core types, config, and CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
42
42
|
"@scalar/core": "^0.4.3",
|
|
43
43
|
"gray-matter": "^4.0.3",
|
|
44
|
+
"jiti": "^2.6.1",
|
|
44
45
|
"picocolors": "^1.1.1",
|
|
45
46
|
"zod": "^3.25.76"
|
|
46
47
|
},
|
package/dist/config-CSywk3ou.mjs
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { join, resolve } from "node:path";
|
|
3
|
-
|
|
4
|
-
//#region src/cli/config.ts
|
|
5
|
-
const FILE_EXTS = [
|
|
6
|
-
"tsx",
|
|
7
|
-
"ts",
|
|
8
|
-
"jsx",
|
|
9
|
-
"js"
|
|
10
|
-
];
|
|
11
|
-
function escapeRegExp(value) {
|
|
12
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
13
|
-
}
|
|
14
|
-
function createPropertyPattern(key, valuePattern) {
|
|
15
|
-
return new RegExp(`\\b${escapeRegExp(key)}\\b\\s*:\\s*${valuePattern}`);
|
|
16
|
-
}
|
|
17
|
-
function resolveDocsConfigPath(rootDir, explicitPath) {
|
|
18
|
-
if (explicitPath) {
|
|
19
|
-
const resolvedPath = resolve(rootDir, explicitPath);
|
|
20
|
-
if (!existsSync(resolvedPath)) throw new Error(`Could not find docs config at ${explicitPath}.`);
|
|
21
|
-
return resolvedPath;
|
|
22
|
-
}
|
|
23
|
-
for (const ext of FILE_EXTS) {
|
|
24
|
-
const configPath = join(rootDir, `docs.config.${ext}`);
|
|
25
|
-
if (existsSync(configPath)) return configPath;
|
|
26
|
-
}
|
|
27
|
-
throw new Error("Could not find docs.config.ts or docs.config.tsx in the current project. Use --config to point at a custom path.");
|
|
28
|
-
}
|
|
29
|
-
function readStringProperty(content, key) {
|
|
30
|
-
return content.match(createPropertyPattern(key, `["']([^"']+)["']`))?.[1];
|
|
31
|
-
}
|
|
32
|
-
function readBooleanProperty(content, key) {
|
|
33
|
-
const match = content.match(createPropertyPattern(key, "(true|false)"));
|
|
34
|
-
return match ? match[1] === "true" : void 0;
|
|
35
|
-
}
|
|
36
|
-
function extractObjectLiteral(content, key) {
|
|
37
|
-
const keyIndex = content.search(new RegExp(`${key}\\s*:\\s*\\{`));
|
|
38
|
-
if (keyIndex === -1) return void 0;
|
|
39
|
-
const braceStart = content.indexOf("{", keyIndex);
|
|
40
|
-
if (braceStart === -1) return void 0;
|
|
41
|
-
let depth = 0;
|
|
42
|
-
for (let index = braceStart; index < content.length; index += 1) {
|
|
43
|
-
const char = content[index];
|
|
44
|
-
if (char === "{") {
|
|
45
|
-
depth += 1;
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
if (char !== "}") continue;
|
|
49
|
-
depth -= 1;
|
|
50
|
-
if (depth === 0) return content.slice(braceStart + 1, index);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function readNavTitle(content) {
|
|
54
|
-
const block = extractObjectLiteral(content, "nav");
|
|
55
|
-
if (!block) return void 0;
|
|
56
|
-
return readStringProperty(block, "title");
|
|
57
|
-
}
|
|
58
|
-
function resolveDocsContentDir(rootDir, content, entry) {
|
|
59
|
-
const configuredContentDir = readStringProperty(content, "contentDir");
|
|
60
|
-
if (configuredContentDir) return configuredContentDir;
|
|
61
|
-
const candidates = [
|
|
62
|
-
entry,
|
|
63
|
-
join("app", entry),
|
|
64
|
-
join("src", "app", entry)
|
|
65
|
-
];
|
|
66
|
-
for (const candidate of candidates) if (existsSync(join(rootDir, candidate))) return candidate;
|
|
67
|
-
return entry;
|
|
68
|
-
}
|
|
69
|
-
function parseEnvValue(rawValue) {
|
|
70
|
-
const value = rawValue.trim();
|
|
71
|
-
if (value.startsWith("\"") && value.endsWith("\"") || value.startsWith("'") && value.endsWith("'")) return value.slice(1, -1);
|
|
72
|
-
return value;
|
|
73
|
-
}
|
|
74
|
-
function loadProjectEnv(rootDir) {
|
|
75
|
-
const env = {};
|
|
76
|
-
for (const filename of [".env", ".env.local"]) {
|
|
77
|
-
const fullPath = join(rootDir, filename);
|
|
78
|
-
if (!existsSync(fullPath)) continue;
|
|
79
|
-
const lines = readFileSync(fullPath, "utf-8").split(/\r?\n/);
|
|
80
|
-
for (const line of lines) {
|
|
81
|
-
const trimmed = line.trim();
|
|
82
|
-
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
83
|
-
const equalsIndex = trimmed.indexOf("=");
|
|
84
|
-
if (equalsIndex === -1) continue;
|
|
85
|
-
const key = trimmed.slice(0, equalsIndex).trim();
|
|
86
|
-
const rawValue = trimmed.slice(equalsIndex + 1);
|
|
87
|
-
if (!key) continue;
|
|
88
|
-
env[key] = parseEnvValue(rawValue);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return env;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
//#endregion
|
|
95
|
-
export { readStringProperty as a, readNavTitle as i, loadProjectEnv as n, resolveDocsConfigPath as o, readBooleanProperty as r, resolveDocsContentDir as s, extractObjectLiteral as t };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|