@farming-labs/docs 0.1.105 → 0.1.107
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-sUT6Bsop.mjs → agent-BkBIpBPu.mjs} +1 -1
- package/dist/{agents-B04j1KsE.mjs → agents-CpXgpIkR.mjs} +1 -1
- package/dist/cli/index.mjs +28 -14
- package/dist/{dev-CpvDdmY3.mjs → dev-cvGfM7qo.mjs} +1 -1
- package/dist/{doctor-DPFrn2se.mjs → doctor-BLBWvfy5.mjs} +2 -2
- package/dist/downgrade-Bt4yrVyy.mjs +179 -0
- package/dist/index.d.mts +2 -2
- package/dist/{init-BJbBtnBz.mjs → init-CCDM1jpD.mjs} +1 -1
- package/dist/mcp.d.mts +1 -1
- package/dist/package-version-DQgrHnSb.mjs +125 -0
- package/dist/{robots-HU8yTWZv.mjs → robots-DuDAetXn.mjs} +1 -1
- package/dist/{search-BlXlCmne.d.mts → search-CvfF6EKZ.d.mts} +1 -1
- package/dist/server.d.mts +2 -2
- package/dist/{sitemap-DqzvA3BI.mjs → sitemap-DF2RCPGq.mjs} +1 -1
- package/dist/upgrade-B1EMfRQJ.mjs +51 -0
- package/dist/{utils-AmYxHDoz.mjs → utils-TPe8H1P-.mjs} +15 -1
- package/package.json +1 -1
- package/dist/upgrade-G2f_v09Z.mjs +0 -154
- /package/dist/{mcp-B-zWyAlw.mjs → mcp-Cbg5V9qX.mjs} +0 -0
- /package/dist/{search-0H8jdm8S.mjs → search-D5TyB13g.mjs} +0 -0
- /package/dist/{types-BSnCAFHc.d.mts → types-DabWZeFx.d.mts} +0 -0
|
@@ -4,6 +4,6 @@ import "./agent-BK7q65dn.mjs";
|
|
|
4
4
|
import "./robots-DDrj6Cpo.mjs";
|
|
5
5
|
import "./sitemap-server-DJvxOqX2.mjs";
|
|
6
6
|
import "./config-Cio3byUJ.mjs";
|
|
7
|
-
import { a as readPageTokenBudget, i as printAgentCompactHelp, n as inspectAgentCompactionState, o as scanDocsPageTargets, r as parseAgentCompactArgs, t as compactAgentDocs } from "./agents-
|
|
7
|
+
import { a as readPageTokenBudget, i as printAgentCompactHelp, n as inspectAgentCompactionState, o as scanDocsPageTargets, r as parseAgentCompactArgs, t as compactAgentDocs } from "./agents-CpXgpIkR.mjs";
|
|
8
8
|
|
|
9
9
|
export { compactAgentDocs, parseAgentCompactArgs, printAgentCompactHelp };
|
|
@@ -5,7 +5,7 @@ import { v as resolveApiReferenceConfig } from "./sitemap-server-DJvxOqX2.mjs";
|
|
|
5
5
|
import { createFilesystemDocsMcpSource, resolveDocsMcpConfig } from "./mcp.mjs";
|
|
6
6
|
import "./server.mjs";
|
|
7
7
|
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-Cio3byUJ.mjs";
|
|
8
|
-
import { t as detectFramework } from "./utils-
|
|
8
|
+
import { t as detectFramework } from "./utils-TPe8H1P-.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
|
@@ -77,16 +77,16 @@ async function main() {
|
|
|
77
77
|
searchApiKey: typeof flags["search-api-key"] === "string" ? flags["search-api-key"] : void 0
|
|
78
78
|
};
|
|
79
79
|
if (!parsedCommand.command || parsedCommand.command === "init") {
|
|
80
|
-
const { init } = await import("../init-
|
|
80
|
+
const { init } = await import("../init-CCDM1jpD.mjs");
|
|
81
81
|
await init(initOptions);
|
|
82
82
|
} else if (parsedCommand.command === "dev") {
|
|
83
|
-
const { dev } = await import("../dev-
|
|
83
|
+
const { dev } = await import("../dev-cvGfM7qo.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-Cbg5V9qX.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-BkBIpBPu.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-BkBIpBPu.mjs");
|
|
100
100
|
printAgentCompactHelp();
|
|
101
101
|
process.exit(1);
|
|
102
102
|
} else if (parsedCommand.command === "agents" && subcommand === "generate") {
|
|
103
|
-
const { generateAgents, parseAgentsGenerateArgs, printAgentsGenerateHelp } = await import("../agents-
|
|
103
|
+
const { generateAgents, parseAgentsGenerateArgs, printAgentsGenerateHelp } = await import("../agents-CpXgpIkR.mjs");
|
|
104
104
|
const agentsOptions = parseAgentsGenerateArgs(args.slice(2));
|
|
105
105
|
if (agentsOptions.help) {
|
|
106
106
|
printAgentsGenerateHelp();
|
|
@@ -110,11 +110,11 @@ async function main() {
|
|
|
110
110
|
} else if (parsedCommand.command === "agents") {
|
|
111
111
|
console.error(pc.red(`Unknown agents subcommand: ${subcommand ?? "(missing)"}`));
|
|
112
112
|
console.error();
|
|
113
|
-
const { printAgentsGenerateHelp } = await import("../agents-
|
|
113
|
+
const { printAgentsGenerateHelp } = await import("../agents-CpXgpIkR.mjs");
|
|
114
114
|
printAgentsGenerateHelp();
|
|
115
115
|
process.exit(1);
|
|
116
116
|
} else if (parsedCommand.command === "doctor") {
|
|
117
|
-
const { parseDoctorArgs, printDoctorHelp, runDoctor } = await import("../doctor-
|
|
117
|
+
const { parseDoctorArgs, printDoctorHelp, runDoctor } = await import("../doctor-BLBWvfy5.mjs");
|
|
118
118
|
const doctorOptions = parseDoctorArgs(args.slice(1));
|
|
119
119
|
if (doctorOptions.help) {
|
|
120
120
|
printDoctorHelp();
|
|
@@ -122,7 +122,7 @@ async function main() {
|
|
|
122
122
|
}
|
|
123
123
|
await runDoctor(doctorOptions);
|
|
124
124
|
} else if (parsedCommand.command === "search" && subcommand === "sync") {
|
|
125
|
-
const { syncSearch } = await import("../search-
|
|
125
|
+
const { syncSearch } = await import("../search-D5TyB13g.mjs");
|
|
126
126
|
await syncSearch(searchSyncOptions);
|
|
127
127
|
} else if (parsedCommand.command === "search") {
|
|
128
128
|
console.error(pc.red(`Unknown search subcommand: ${subcommand ?? "(missing)"}`));
|
|
@@ -130,7 +130,7 @@ async function main() {
|
|
|
130
130
|
printHelp();
|
|
131
131
|
process.exit(1);
|
|
132
132
|
} else if (parsedCommand.command === "sitemap" && subcommand === "generate") {
|
|
133
|
-
const { generateSitemap, parseSitemapGenerateArgs, printSitemapGenerateHelp } = await import("../sitemap-
|
|
133
|
+
const { generateSitemap, parseSitemapGenerateArgs, printSitemapGenerateHelp } = await import("../sitemap-DF2RCPGq.mjs");
|
|
134
134
|
const sitemapOptions = parseSitemapGenerateArgs(args.slice(2));
|
|
135
135
|
if (sitemapOptions.help) {
|
|
136
136
|
printSitemapGenerateHelp();
|
|
@@ -140,11 +140,11 @@ async function main() {
|
|
|
140
140
|
} else if (parsedCommand.command === "sitemap") {
|
|
141
141
|
console.error(pc.red(`Unknown sitemap subcommand: ${subcommand ?? "(missing)"}`));
|
|
142
142
|
console.error();
|
|
143
|
-
const { printSitemapGenerateHelp } = await import("../sitemap-
|
|
143
|
+
const { printSitemapGenerateHelp } = await import("../sitemap-DF2RCPGq.mjs");
|
|
144
144
|
printSitemapGenerateHelp();
|
|
145
145
|
process.exit(1);
|
|
146
146
|
} else if (parsedCommand.command === "robots" && subcommand === "generate") {
|
|
147
|
-
const { generateRobots, parseRobotsGenerateArgs, printRobotsGenerateHelp } = await import("../robots-
|
|
147
|
+
const { generateRobots, parseRobotsGenerateArgs, printRobotsGenerateHelp } = await import("../robots-DuDAetXn.mjs");
|
|
148
148
|
const robotsOptions = parseRobotsGenerateArgs(args.slice(2));
|
|
149
149
|
if (robotsOptions.help) {
|
|
150
150
|
printRobotsGenerateHelp();
|
|
@@ -154,11 +154,19 @@ async function main() {
|
|
|
154
154
|
} else if (parsedCommand.command === "robots") {
|
|
155
155
|
console.error(pc.red(`Unknown robots subcommand: ${subcommand ?? "(missing)"}`));
|
|
156
156
|
console.error();
|
|
157
|
-
const { printRobotsGenerateHelp } = await import("../robots-
|
|
157
|
+
const { printRobotsGenerateHelp } = await import("../robots-DuDAetXn.mjs");
|
|
158
158
|
printRobotsGenerateHelp();
|
|
159
159
|
process.exit(1);
|
|
160
|
+
} else if (parsedCommand.command === "downgrade") {
|
|
161
|
+
const { downgrade } = await import("../downgrade-Bt4yrVyy.mjs");
|
|
162
|
+
const framework = (typeof flags.framework === "string" ? flags.framework : void 0) ?? (args[1] && !args[1].startsWith("--") ? args[1] : void 0);
|
|
163
|
+
const hasVersionFlag = args.includes("--version") || args.some((arg) => arg.startsWith("--version="));
|
|
164
|
+
await downgrade({
|
|
165
|
+
framework,
|
|
166
|
+
version: typeof flags.version === "string" ? flags.version : hasVersionFlag ? "" : void 0
|
|
167
|
+
});
|
|
160
168
|
} else if (parsedCommand.command === "upgrade") {
|
|
161
|
-
const { upgrade } = await import("../upgrade-
|
|
169
|
+
const { upgrade } = await import("../upgrade-B1EMfRQJ.mjs");
|
|
162
170
|
const framework = (typeof flags.framework === "string" ? flags.framework : void 0) ?? (args[1] && !args[1].startsWith("--") ? args[1] : void 0);
|
|
163
171
|
const hasVersionFlag = args.includes("--version") || args.some((arg) => arg.startsWith("--version="));
|
|
164
172
|
const version = typeof flags.version === "string" ? flags.version : hasVersionFlag ? "" : void 0;
|
|
@@ -194,6 +202,7 @@ ${pc.dim("Commands:")}
|
|
|
194
202
|
${pc.cyan("search")} Search utilities (${pc.dim("sync")} for external indexes)
|
|
195
203
|
${pc.cyan("sitemap")} Sitemap utilities (${pc.dim("generate")} for sitemap XML/Markdown data)
|
|
196
204
|
${pc.cyan("upgrade")} Upgrade @farming-labs/* packages (auto-detect or use --framework)
|
|
205
|
+
${pc.cyan("downgrade")} Downgrade @farming-labs/* packages (auto-detect or use --framework)
|
|
197
206
|
|
|
198
207
|
${pc.dim("Supported frameworks:")}
|
|
199
208
|
Next.js, TanStack Start, SvelteKit, Astro, Nuxt
|
|
@@ -281,6 +290,11 @@ ${pc.dim("Options for upgrade:")}
|
|
|
281
290
|
${pc.cyan("upgrade@beta")} Shortcut for ${pc.cyan("upgrade --beta")}
|
|
282
291
|
${pc.cyan("upgrade@latest")} Shortcut for ${pc.cyan("upgrade --latest")}
|
|
283
292
|
|
|
293
|
+
${pc.dim("Options for downgrade:")}
|
|
294
|
+
${pc.cyan("downgrade")} Install the published version immediately below the current installed version
|
|
295
|
+
${pc.cyan("--framework <name>")} Explicit framework (${pc.dim("next")}, ${pc.dim("tanstack-start")}, ${pc.dim("nuxt")}, ${pc.dim("sveltekit")}, ${pc.dim("astro")}); omit to auto-detect
|
|
296
|
+
${pc.cyan("--version <version>")} Install an exact lower version (e.g. ${pc.dim("0.1.103")})
|
|
297
|
+
|
|
284
298
|
${pc.cyan("-h, --help")} Show this help message
|
|
285
299
|
${pc.cyan("-v, --version")} Show version
|
|
286
300
|
`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as detectPackageManagerFromLockfile } from "./utils-
|
|
1
|
+
import { i as detectPackageManagerFromLockfile } from "./utils-TPe8H1P-.mjs";
|
|
2
2
|
import { K as rootLayoutTemplate, W as postcssConfigTemplate, g as docsLayoutTemplate, v as globalCssTemplate, yt as tsconfigTemplate } from "./templates-BpSkUico.mjs";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
@@ -7,8 +7,8 @@ import "./sitemap-server-DJvxOqX2.mjs";
|
|
|
7
7
|
import { createFilesystemDocsMcpSource, resolveDocsMcpConfig } from "./mcp.mjs";
|
|
8
8
|
import "./server.mjs";
|
|
9
9
|
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-Cio3byUJ.mjs";
|
|
10
|
-
import { t as detectFramework } from "./utils-
|
|
11
|
-
import { n as inspectAgentCompactionState, o as scanDocsPageTargets } from "./agents-
|
|
10
|
+
import { t as detectFramework } from "./utils-TPe8H1P-.mjs";
|
|
11
|
+
import { n as inspectAgentCompactionState, o as scanDocsPageTargets } from "./agents-CpXgpIkR.mjs";
|
|
12
12
|
import { existsSync, lstatSync, readFileSync, readdirSync } from "node:fs";
|
|
13
13
|
import path from "node:path";
|
|
14
14
|
import { LATEST_PROTOCOL_VERSION } from "@modelcontextprotocol/sdk/types.js";
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { c as fileExists, o as exec, s as execOutput } from "./utils-TPe8H1P-.mjs";
|
|
2
|
+
import { a as getPackagesForFramework, c as resolveDocsPackageManager, l as validateUpgradeVersion, r as buildDocsPackageInstallCommand, s as resolveDocsPackageFramework } from "./package-version-DQgrHnSb.mjs";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import pc from "picocolors";
|
|
6
|
+
import * as p from "@clack/prompts";
|
|
7
|
+
|
|
8
|
+
//#region src/cli/downgrade.ts
|
|
9
|
+
/**
|
|
10
|
+
* Downgrade @farming-labs/* packages to a lower exact version.
|
|
11
|
+
* Detects framework from package.json by default, or use --framework (next, tanstack-start, nuxt, sveltekit, astro).
|
|
12
|
+
*/
|
|
13
|
+
function parseSemver(version) {
|
|
14
|
+
const normalized = validateUpgradeVersion(version).split("+", 1)[0] ?? version;
|
|
15
|
+
const prereleaseIndex = normalized.indexOf("-");
|
|
16
|
+
const core = prereleaseIndex === -1 ? normalized : normalized.slice(0, prereleaseIndex);
|
|
17
|
+
const prerelease = prereleaseIndex === -1 ? "" : normalized.slice(prereleaseIndex + 1);
|
|
18
|
+
const [major = "0", minor = "0", patch = "0"] = core.split(".");
|
|
19
|
+
return {
|
|
20
|
+
major: Number.parseInt(major, 10),
|
|
21
|
+
minor: Number.parseInt(minor, 10),
|
|
22
|
+
patch: Number.parseInt(patch, 10),
|
|
23
|
+
prerelease: prerelease ? prerelease.split(".") : []
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function comparePrereleaseIdentifier(a, b) {
|
|
27
|
+
const aNumber = /^\d+$/.test(a) ? Number.parseInt(a, 10) : null;
|
|
28
|
+
const bNumber = /^\d+$/.test(b) ? Number.parseInt(b, 10) : null;
|
|
29
|
+
if (aNumber !== null && bNumber !== null) return Math.sign(aNumber - bNumber);
|
|
30
|
+
if (aNumber !== null) return -1;
|
|
31
|
+
if (bNumber !== null) return 1;
|
|
32
|
+
return a.localeCompare(b);
|
|
33
|
+
}
|
|
34
|
+
function compareSemver(a, b) {
|
|
35
|
+
const left = parseSemver(a);
|
|
36
|
+
const right = parseSemver(b);
|
|
37
|
+
for (const key of [
|
|
38
|
+
"major",
|
|
39
|
+
"minor",
|
|
40
|
+
"patch"
|
|
41
|
+
]) if (left[key] !== right[key]) return Math.sign(left[key] - right[key]);
|
|
42
|
+
if (left.prerelease.length === 0 && right.prerelease.length === 0) return 0;
|
|
43
|
+
if (left.prerelease.length === 0) return 1;
|
|
44
|
+
if (right.prerelease.length === 0) return -1;
|
|
45
|
+
const length = Math.max(left.prerelease.length, right.prerelease.length);
|
|
46
|
+
for (let index = 0; index < length; index++) {
|
|
47
|
+
const leftPart = left.prerelease[index];
|
|
48
|
+
const rightPart = right.prerelease[index];
|
|
49
|
+
if (leftPart === void 0) return -1;
|
|
50
|
+
if (rightPart === void 0) return 1;
|
|
51
|
+
const compared = comparePrereleaseIdentifier(leftPart, rightPart);
|
|
52
|
+
if (compared !== 0) return compared;
|
|
53
|
+
}
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
function normalizeMaybeVersion(value) {
|
|
57
|
+
try {
|
|
58
|
+
return validateUpgradeVersion(value);
|
|
59
|
+
} catch {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function extractVersionFromSpec(spec) {
|
|
64
|
+
const exact = normalizeMaybeVersion(spec);
|
|
65
|
+
if (exact) return exact;
|
|
66
|
+
const rangeMatch = spec.match(/^[~^]([^~^<>=|\s]+)/);
|
|
67
|
+
if (!rangeMatch) return null;
|
|
68
|
+
return normalizeMaybeVersion(rangeMatch[1] ?? "");
|
|
69
|
+
}
|
|
70
|
+
function readJsonFile(filePath) {
|
|
71
|
+
try {
|
|
72
|
+
return JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
73
|
+
} catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function packageJsonPath(cwd, packageName) {
|
|
78
|
+
return path.join(cwd, "node_modules", ...packageName.split("/"), "package.json");
|
|
79
|
+
}
|
|
80
|
+
function readCurrentPackageVersion(cwd, packageNames) {
|
|
81
|
+
for (const packageName of packageNames) {
|
|
82
|
+
const installedPackageJson = readJsonFile(packageJsonPath(cwd, packageName));
|
|
83
|
+
const installedVersion = typeof installedPackageJson?.version === "string" ? normalizeMaybeVersion(installedPackageJson.version) : null;
|
|
84
|
+
if (installedVersion) return installedVersion;
|
|
85
|
+
}
|
|
86
|
+
const projectPackageJson = readJsonFile(path.join(cwd, "package.json"));
|
|
87
|
+
const dependencyGroups = [
|
|
88
|
+
projectPackageJson?.dependencies,
|
|
89
|
+
projectPackageJson?.devDependencies,
|
|
90
|
+
projectPackageJson?.peerDependencies
|
|
91
|
+
];
|
|
92
|
+
for (const group of dependencyGroups) {
|
|
93
|
+
if (!group || typeof group !== "object") continue;
|
|
94
|
+
for (const packageName of packageNames) {
|
|
95
|
+
const spec = group[packageName];
|
|
96
|
+
if (typeof spec !== "string") continue;
|
|
97
|
+
const version = extractVersionFromSpec(spec);
|
|
98
|
+
if (version) return version;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
function parsePublishedVersions(raw) {
|
|
104
|
+
const parsed = JSON.parse(raw);
|
|
105
|
+
return (Array.isArray(parsed) ? parsed : [parsed]).filter((version) => typeof version === "string").map((version) => normalizeMaybeVersion(version)).filter((version) => version !== null);
|
|
106
|
+
}
|
|
107
|
+
function getPreviousVersion(versions, currentVersion) {
|
|
108
|
+
const current = validateUpgradeVersion(currentVersion);
|
|
109
|
+
return versions.filter((version) => compareSemver(version, current) < 0).sort(compareSemver).at(-1) ?? null;
|
|
110
|
+
}
|
|
111
|
+
function fetchPublishedVersions(cwd) {
|
|
112
|
+
return parsePublishedVersions(execOutput("npm view @farming-labs/docs versions --json", cwd));
|
|
113
|
+
}
|
|
114
|
+
function buildDowngradeCommand(framework, version, pm) {
|
|
115
|
+
return buildDocsPackageInstallCommand(framework, validateUpgradeVersion(version), pm);
|
|
116
|
+
}
|
|
117
|
+
async function downgrade(options = {}) {
|
|
118
|
+
const cwd = process.cwd();
|
|
119
|
+
p.intro(pc.bgCyan(pc.black(" @farming-labs/docs downgrade ")));
|
|
120
|
+
if (!fileExists(path.join(cwd, "package.json"))) {
|
|
121
|
+
p.log.error("No package.json found in the current directory. Run this from your project root.");
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
const { framework, preset } = resolveDocsPackageFramework(cwd, options.framework);
|
|
125
|
+
const packages = getPackagesForFramework(framework);
|
|
126
|
+
const currentVersion = readCurrentPackageVersion(cwd, packages);
|
|
127
|
+
if (!currentVersion) {
|
|
128
|
+
p.log.error("Could not determine the current @farming-labs docs package version. Install dependencies first or use an exact package version in package.json.");
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
let targetVersion;
|
|
132
|
+
if (options.version !== void 0) {
|
|
133
|
+
try {
|
|
134
|
+
targetVersion = validateUpgradeVersion(options.version);
|
|
135
|
+
} catch (error) {
|
|
136
|
+
p.log.error(error instanceof Error ? error.message : "Invalid downgrade version.");
|
|
137
|
+
process.exit(1);
|
|
138
|
+
}
|
|
139
|
+
const comparison = compareSemver(targetVersion, currentVersion);
|
|
140
|
+
if (comparison > 0) {
|
|
141
|
+
p.log.error(`Version ${pc.cyan(targetVersion)} is newer than current ${pc.cyan(currentVersion)}.`);
|
|
142
|
+
p.log.info(`Use ${pc.cyan(`docs upgrade --version ${targetVersion}`)} instead.`);
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
145
|
+
if (comparison === 0) {
|
|
146
|
+
p.log.error(`Version ${pc.cyan(targetVersion)} is already installed. Choose a lower version to downgrade.`);
|
|
147
|
+
process.exit(1);
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
let publishedVersions;
|
|
151
|
+
try {
|
|
152
|
+
publishedVersions = fetchPublishedVersions(cwd);
|
|
153
|
+
} catch {
|
|
154
|
+
p.log.error("Could not fetch published @farming-labs/docs versions. Pass an exact version with " + pc.cyan("--version <version>") + ".");
|
|
155
|
+
process.exit(1);
|
|
156
|
+
}
|
|
157
|
+
const previousVersion = getPreviousVersion(publishedVersions, currentVersion);
|
|
158
|
+
if (!previousVersion) {
|
|
159
|
+
p.log.error(`No published version found below current ${pc.cyan(currentVersion)}.`);
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
targetVersion = previousVersion;
|
|
163
|
+
}
|
|
164
|
+
const pm = await resolveDocsPackageManager(cwd, "downgrade");
|
|
165
|
+
const cmd = buildDowngradeCommand(framework, targetVersion, pm);
|
|
166
|
+
p.log.step(`Downgrading ${preset} docs packages from ${currentVersion} to ${targetVersion}...`);
|
|
167
|
+
p.log.message(pc.dim(packages.join(", ")));
|
|
168
|
+
try {
|
|
169
|
+
exec(cmd, cwd);
|
|
170
|
+
p.log.success(`Packages downgraded to ${targetVersion}.`);
|
|
171
|
+
p.outro(pc.green("Done. Run your dev server to confirm everything works."));
|
|
172
|
+
} catch {
|
|
173
|
+
p.log.error("Downgrade failed. Try running manually:\n " + pc.cyan(cmd));
|
|
174
|
+
process.exit(1);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
//#endregion
|
|
179
|
+
export { downgrade };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as DocsSearchResultType, A as DocsConfig, At as SidebarTree, B as DocsObservabilityEventInput, C as DocsAskAIActionData, Ct as ResolvedDocsRelatedLink, D as DocsAskAIFeedbackMessage, Dt as SidebarFolderNode, E as DocsAskAIFeedbackData, Et as SidebarFolderIndexBehavior, F as DocsMcpToolsConfig, Ft as UIConfig, G as DocsSearchAdapterContext, H as DocsRobotsConfig, I as DocsMetadata, J as DocsSearchConfig, K as DocsSearchAdapterFactory, L as DocsNav, M as DocsFeedbackValue, Mt as ThemeToggleConfig, N as DocsI18nConfig, Nt as TypesenseDocsSearchConfig, O as DocsAskAIFeedbackValue, Ot as SidebarNode, P as DocsMcpConfig, Pt as TypographyConfig, Q as DocsSearchResult, R as DocsObservabilityConfig, S as DocsAnalyticsSource, St as ReadingTimeConfig, T as DocsAskAIFeedbackConfig, Tt as SidebarConfig, U as DocsRobotsRule, V as DocsRelatedItem, W as DocsSearchAdapter, X as DocsSearchEmbeddingsConfig, Y as DocsSearchDocument, Z as DocsSearchQuery, _ as DocsAnalyticsConfig, _t as PageActionsConfig, a as ApiReferenceRenderer, at as GithubConfig, b as DocsAnalyticsEventType, bt as PageSidebarFrontmatter, c as ChangelogFrontmatter, ct as LlmsTxtMaxCharsConfig, d as CustomDocsSearchConfig, dt as McpDocsSearchConfig, et as DocsSearchSourcePage, f as DocsAgentFeedbackContext, ft as OGConfig, g as DocsAgentTraceStatus, gt as OrderingItem, h as DocsAgentTraceEventType, ht as OpenGraphImage, i as ApiReferenceConfig, it as FontStyle, j as DocsFeedbackData, jt as SimpleDocsSearchConfig, k as DocsAskAIMcpConfig, kt as SidebarPageNode, l as CodeBlockCopyData, lt as LlmsTxtMaxCharsMode, m as DocsAgentTraceEventInput, mt as OpenDocsProvider, n as AgentFeedbackConfig, nt as DocsTheme, o as BreadcrumbConfig, ot as LastUpdatedConfig, p as DocsAgentFeedbackData, pt as OpenDocsConfig, q as DocsSearchChunkingConfig, r as AlgoliaDocsSearchConfig, rt as FeedbackConfig, s as ChangelogConfig, st as LlmsTxtConfig, t as AIConfig, tt as DocsSitemapConfig, u as CopyMarkdownConfig, ut as LlmsTxtSectionConfig, v as DocsAnalyticsEvent, vt as PageFrontmatter, w as DocsAskAIActionType, wt as SidebarComponentProps, x as DocsAnalyticsInput, xt as PageTwitter, y as DocsAnalyticsEventInput, yt as PageOpenGraph, z as DocsObservabilityEvent } from "./types-
|
|
2
|
-
import { A as toDocsSitemapMarkdownUrl, B as resolveDocsAnalyticsConfig, C as createDocsSitemapResponse, D as resolveDocsSitemapConfig, E as renderDocsSitemapXml, F as createDocsAgentTraceContext, H as DocsCloudAnalyticsOptions, I as createDocsAgentTraceId, L as emitDocsAgentTraceEvent, M as DocsAgentTraceContext, N as ResolvedDocsAnalyticsConfig, O as resolveDocsSitemapPageLastmod, P as ResolvedDocsObservabilityConfig, R as emitDocsAnalyticsEvent, S as buildDocsSitemapManifest, T as renderDocsSitemapMarkdown, U as createDocsCloudAnalytics, V as resolveDocsObservabilityConfig, _ as DocsSitemapFormat, a as createMcpSearchAdapter, b as DocsSitemapPageInput, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, f as resolveSearchRequestConfig, g as DEFAULT_SITEMAP_XML_ROUTE, h as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, i as createCustomSearchAdapter, j as DOCS_AGENT_TRACE_EVENT_TYPES, k as resolveDocsSitemapRequest, l as inferDocsAskAIPackageHints, m as DEFAULT_SITEMAP_MD_ROUTE, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, p as DEFAULT_SITEMAP_MANIFEST_PATH, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch, v as DocsSitemapManifest, w as readDocsSitemapManifestFromContentMap, x as DocsSitemapResolvedConfig, y as DocsSitemapManifestPage, z as emitDocsObservabilityEvent } from "./search-
|
|
1
|
+
import { $ as DocsSearchResultType, A as DocsConfig, At as SidebarTree, B as DocsObservabilityEventInput, C as DocsAskAIActionData, Ct as ResolvedDocsRelatedLink, D as DocsAskAIFeedbackMessage, Dt as SidebarFolderNode, E as DocsAskAIFeedbackData, Et as SidebarFolderIndexBehavior, F as DocsMcpToolsConfig, Ft as UIConfig, G as DocsSearchAdapterContext, H as DocsRobotsConfig, I as DocsMetadata, J as DocsSearchConfig, K as DocsSearchAdapterFactory, L as DocsNav, M as DocsFeedbackValue, Mt as ThemeToggleConfig, N as DocsI18nConfig, Nt as TypesenseDocsSearchConfig, O as DocsAskAIFeedbackValue, Ot as SidebarNode, P as DocsMcpConfig, Pt as TypographyConfig, Q as DocsSearchResult, R as DocsObservabilityConfig, S as DocsAnalyticsSource, St as ReadingTimeConfig, T as DocsAskAIFeedbackConfig, Tt as SidebarConfig, U as DocsRobotsRule, V as DocsRelatedItem, W as DocsSearchAdapter, X as DocsSearchEmbeddingsConfig, Y as DocsSearchDocument, Z as DocsSearchQuery, _ as DocsAnalyticsConfig, _t as PageActionsConfig, a as ApiReferenceRenderer, at as GithubConfig, b as DocsAnalyticsEventType, bt as PageSidebarFrontmatter, c as ChangelogFrontmatter, ct as LlmsTxtMaxCharsConfig, d as CustomDocsSearchConfig, dt as McpDocsSearchConfig, et as DocsSearchSourcePage, f as DocsAgentFeedbackContext, ft as OGConfig, g as DocsAgentTraceStatus, gt as OrderingItem, h as DocsAgentTraceEventType, ht as OpenGraphImage, i as ApiReferenceConfig, it as FontStyle, j as DocsFeedbackData, jt as SimpleDocsSearchConfig, k as DocsAskAIMcpConfig, kt as SidebarPageNode, l as CodeBlockCopyData, lt as LlmsTxtMaxCharsMode, m as DocsAgentTraceEventInput, mt as OpenDocsProvider, n as AgentFeedbackConfig, nt as DocsTheme, o as BreadcrumbConfig, ot as LastUpdatedConfig, p as DocsAgentFeedbackData, pt as OpenDocsConfig, q as DocsSearchChunkingConfig, r as AlgoliaDocsSearchConfig, rt as FeedbackConfig, s as ChangelogConfig, st as LlmsTxtConfig, t as AIConfig, tt as DocsSitemapConfig, u as CopyMarkdownConfig, ut as LlmsTxtSectionConfig, v as DocsAnalyticsEvent, vt as PageFrontmatter, w as DocsAskAIActionType, wt as SidebarComponentProps, x as DocsAnalyticsInput, xt as PageTwitter, y as DocsAnalyticsEventInput, yt as PageOpenGraph, z as DocsObservabilityEvent } from "./types-DabWZeFx.mjs";
|
|
2
|
+
import { A as toDocsSitemapMarkdownUrl, B as resolveDocsAnalyticsConfig, C as createDocsSitemapResponse, D as resolveDocsSitemapConfig, E as renderDocsSitemapXml, F as createDocsAgentTraceContext, H as DocsCloudAnalyticsOptions, I as createDocsAgentTraceId, L as emitDocsAgentTraceEvent, M as DocsAgentTraceContext, N as ResolvedDocsAnalyticsConfig, O as resolveDocsSitemapPageLastmod, P as ResolvedDocsObservabilityConfig, R as emitDocsAnalyticsEvent, S as buildDocsSitemapManifest, T as renderDocsSitemapMarkdown, U as createDocsCloudAnalytics, V as resolveDocsObservabilityConfig, _ as DocsSitemapFormat, a as createMcpSearchAdapter, b as DocsSitemapPageInput, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, f as resolveSearchRequestConfig, g as DEFAULT_SITEMAP_XML_ROUTE, h as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, i as createCustomSearchAdapter, j as DOCS_AGENT_TRACE_EVENT_TYPES, k as resolveDocsSitemapRequest, l as inferDocsAskAIPackageHints, m as DEFAULT_SITEMAP_MD_ROUTE, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, p as DEFAULT_SITEMAP_MANIFEST_PATH, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch, v as DocsSitemapManifest, w as readDocsSitemapManifestFromContentMap, x as DocsSitemapResolvedConfig, y as DocsSitemapManifestPage, z as emitDocsObservabilityEvent } from "./search-CvfF6EKZ.mjs";
|
|
3
3
|
import { DocsMcpPage, DocsMcpResolvedConfig } from "./mcp.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/define-docs.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as devInstallCommand, c as
|
|
1
|
+
import { a as devInstallCommand, c as fileExists, d as spawnAndWaitFor, f as writeFileSafe, i as detectPackageManagerFromLockfile, l as installCommand, n as detectGlobalCssFiles, o as exec, r as detectNextAppDir, t as detectFramework, u as readFileSafe } from "./utils-TPe8H1P-.mjs";
|
|
2
2
|
import { $ as svelteDocsPublicHookTemplate, A as nextConfigMergedTemplate, B as nuxtServerApiDocsRouteTemplate, C as injectRootProviderIntoLayout, D as injectTanstackVitePlugins, E as injectTanstackRootProviderIntoRoute, F as nuxtDocsConfigTemplate, G as quickstartPageTemplate, H as nuxtServerDocsPublicMiddlewareTemplate, I as nuxtDocsPageTemplate, J as svelteDocsApiRouteTemplate, K as rootLayoutTemplate, L as nuxtGlobalCssTemplate, M as nextLocaleDocPageTemplate, N as nextLocalizedPageTemplate, O as installationPageTemplate, P as nuxtConfigTemplate, Q as svelteDocsPageTemplate, R as nuxtInstallationPageTemplate, S as injectNuxtCssImport, T as injectSvelteDocsPublicHook, U as nuxtWelcomePageTemplate, V as nuxtServerApiReferenceRouteTemplate, W as postcssConfigTemplate, X as svelteDocsLayoutServerTemplate, Y as svelteDocsConfigTemplate, Z as svelteDocsLayoutTemplate, _ as getAstroAdapterPkg, _t as tanstackViteConfigTemplate, a as astroDocsIndexTemplate, at as svelteWelcomePageTemplate, b as injectAstroDocsMiddleware, bt as welcomePageTemplate, c as astroDocsServerTemplate, ct as tanstackDocsCatchAllRouteTemplate, d as astroQuickstartPageTemplate, dt as tanstackDocsIndexRouteTemplate, et as svelteDocsServerTemplate, f as astroWelcomePageTemplate, ft as tanstackDocsPublicRouteTemplate, g as docsLayoutTemplate, gt as tanstackRootRouteTemplate, h as docsConfigTemplate, ht as tanstackQuickstartPageTemplate, i as astroDocsConfigTemplate, it as svelteRootLayoutTemplate, j as nextConfigTemplate, k as nextApiReferencePageTemplate, l as astroGlobalCssTemplate, lt as tanstackDocsConfigTemplate, m as customThemeTsTemplate, mt as tanstackInstallationPageTemplate, n as astroApiRouteTemplate, nt as svelteInstallationPageTemplate, o as astroDocsMiddlewareTemplate, ot as tanstackApiDocsRouteTemplate, p as customThemeCssTemplate, pt as tanstackDocsServerTemplate, q as svelteApiReferenceRouteTemplate, r as astroConfigTemplate, rt as svelteQuickstartPageTemplate, s as astroDocsPageTemplate, st as tanstackApiReferenceRouteTemplate, t as astroApiReferenceRouteTemplate, tt as svelteGlobalCssTemplate, u as astroInstallationPageTemplate, ut as tanstackDocsFunctionsTemplate, v as globalCssTemplate, vt as tanstackWelcomePageTemplate, w as injectSvelteCssImport, x as injectCssImport, y as injectAstroCssImport, yt as tsconfigTemplate, z as nuxtQuickstartPageTemplate } from "./templates-BpSkUico.mjs";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
package/dist/mcp.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as DocsSearchConfig, P as DocsMcpConfig, R as DocsObservabilityConfig, _ as DocsAnalyticsConfig, et as DocsSearchSourcePage, gt as OrderingItem } from "./types-
|
|
1
|
+
import { J as DocsSearchConfig, P as DocsMcpConfig, R as DocsObservabilityConfig, _ as DocsAnalyticsConfig, et as DocsSearchSourcePage, gt as OrderingItem } from "./types-DabWZeFx.mjs";
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
|
|
4
4
|
//#region src/mcp.d.ts
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { i as detectPackageManagerFromLockfile, l as installCommand, t as detectFramework } from "./utils-TPe8H1P-.mjs";
|
|
2
|
+
import pc from "picocolors";
|
|
3
|
+
import * as p from "@clack/prompts";
|
|
4
|
+
|
|
5
|
+
//#region src/cli/package-version.ts
|
|
6
|
+
const PRESETS = [
|
|
7
|
+
"next",
|
|
8
|
+
"tanstack-start",
|
|
9
|
+
"nuxt",
|
|
10
|
+
"sveltekit",
|
|
11
|
+
"astro"
|
|
12
|
+
];
|
|
13
|
+
const PACKAGES_BY_FRAMEWORK = {
|
|
14
|
+
nextjs: [
|
|
15
|
+
"@farming-labs/docs",
|
|
16
|
+
"@farming-labs/theme",
|
|
17
|
+
"@farming-labs/next"
|
|
18
|
+
],
|
|
19
|
+
"tanstack-start": [
|
|
20
|
+
"@farming-labs/docs",
|
|
21
|
+
"@farming-labs/theme",
|
|
22
|
+
"@farming-labs/tanstack-start"
|
|
23
|
+
],
|
|
24
|
+
nuxt: [
|
|
25
|
+
"@farming-labs/docs",
|
|
26
|
+
"@farming-labs/nuxt",
|
|
27
|
+
"@farming-labs/nuxt-theme"
|
|
28
|
+
],
|
|
29
|
+
sveltekit: [
|
|
30
|
+
"@farming-labs/docs",
|
|
31
|
+
"@farming-labs/svelte",
|
|
32
|
+
"@farming-labs/svelte-theme"
|
|
33
|
+
],
|
|
34
|
+
astro: [
|
|
35
|
+
"@farming-labs/docs",
|
|
36
|
+
"@farming-labs/astro",
|
|
37
|
+
"@farming-labs/astro-theme"
|
|
38
|
+
]
|
|
39
|
+
};
|
|
40
|
+
function presetFromFramework(fw) {
|
|
41
|
+
return fw === "nextjs" ? "next" : fw;
|
|
42
|
+
}
|
|
43
|
+
function frameworkFromPreset(preset) {
|
|
44
|
+
return preset === "next" ? "nextjs" : preset;
|
|
45
|
+
}
|
|
46
|
+
function getPackagesForFramework(framework) {
|
|
47
|
+
return PACKAGES_BY_FRAMEWORK[framework];
|
|
48
|
+
}
|
|
49
|
+
const exactSemverPattern = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
50
|
+
function validateUpgradeVersion(version) {
|
|
51
|
+
const normalized = version.trim();
|
|
52
|
+
if (!exactSemverPattern.test(normalized)) throw new Error(`Invalid version "${version}". Use an exact semver version like 0.1.104.`);
|
|
53
|
+
return normalized;
|
|
54
|
+
}
|
|
55
|
+
function buildDocsPackageInstallCommand(framework, target, pm) {
|
|
56
|
+
const packagesWithTarget = getPackagesForFramework(framework).map((name) => `${name}@${target}`);
|
|
57
|
+
return `${installCommand(pm)} ${packagesWithTarget.join(" ")}`;
|
|
58
|
+
}
|
|
59
|
+
function resolveDocsPackageFramework(cwd, rawFramework) {
|
|
60
|
+
if (rawFramework) {
|
|
61
|
+
const raw = rawFramework.toLowerCase().trim();
|
|
62
|
+
const normalized = raw === "nextjs" ? "next" : raw;
|
|
63
|
+
if (!PRESETS.includes(normalized)) {
|
|
64
|
+
p.log.error(`Invalid framework ${pc.cyan(rawFramework)}. Use one of: ${PRESETS.map((t) => pc.cyan(t)).join(", ")}`);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
const preset = normalized;
|
|
68
|
+
return {
|
|
69
|
+
framework: frameworkFromPreset(preset),
|
|
70
|
+
preset
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const detected = detectFramework(cwd);
|
|
74
|
+
if (!detected) {
|
|
75
|
+
p.log.error("Could not detect a supported framework (Next.js, TanStack Start, Nuxt, SvelteKit, Astro). Use " + pc.cyan("--framework <next|tanstack-start|nuxt|sveltekit|astro>") + " to specify.");
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
framework: detected,
|
|
80
|
+
preset: presetFromFramework(detected)
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
async function resolveDocsPackageManager(cwd, command) {
|
|
84
|
+
const detected = detectPackageManagerFromLockfile(cwd);
|
|
85
|
+
if (detected) {
|
|
86
|
+
p.log.info(`Detected ${pc.cyan(detected)} from lockfile`);
|
|
87
|
+
return detected;
|
|
88
|
+
}
|
|
89
|
+
const pmAnswer = await p.select({
|
|
90
|
+
message: `Which package manager do you want to use for this ${command}?`,
|
|
91
|
+
options: [
|
|
92
|
+
{
|
|
93
|
+
value: "pnpm",
|
|
94
|
+
label: "pnpm",
|
|
95
|
+
hint: "Use pnpm add"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
value: "npm",
|
|
99
|
+
label: "npm",
|
|
100
|
+
hint: "Use npm add"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
value: "yarn",
|
|
104
|
+
label: "yarn",
|
|
105
|
+
hint: "Use yarn add"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
value: "bun",
|
|
109
|
+
label: "bun",
|
|
110
|
+
hint: "Use bun add"
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
});
|
|
114
|
+
if (p.isCancel(pmAnswer)) {
|
|
115
|
+
const label = command === "upgrade" ? "Upgrade" : "Downgrade";
|
|
116
|
+
p.outro(pc.red(`${label} cancelled.`));
|
|
117
|
+
process.exit(0);
|
|
118
|
+
}
|
|
119
|
+
const pm = pmAnswer;
|
|
120
|
+
p.log.info(`Using ${pc.cyan(pm)} as package manager`);
|
|
121
|
+
return pm;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
//#endregion
|
|
125
|
+
export { getPackagesForFramework as a, resolveDocsPackageManager as c, frameworkFromPreset as i, validateUpgradeVersion as l, PRESETS as n, presetFromFramework as o, buildDocsPackageInstallCommand as r, resolveDocsPackageFramework as s, PACKAGES_BY_FRAMEWORK as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./agent-BK7q65dn.mjs";
|
|
2
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-DDrj6Cpo.mjs";
|
|
3
3
|
import { d as readTopLevelStringProperty, f as resolveDocsConfigPath, i as loadDocsConfigModule, o as readBooleanProperty, t as extractNestedObjectLiteral, u as readStringProperty } from "./config-Cio3byUJ.mjs";
|
|
4
|
-
import { t as detectFramework } from "./utils-
|
|
4
|
+
import { t as detectFramework } from "./utils-TPe8H1P-.mjs";
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import pc from "picocolors";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as DocsObservabilityEventInput, Ct as ResolvedDocsRelatedLink, J as DocsSearchConfig, K as DocsSearchAdapterFactory, Nt as TypesenseDocsSearchConfig, Q as DocsSearchResult, R as DocsObservabilityConfig, W as DocsSearchAdapter, Y as DocsSearchDocument, _ as DocsAnalyticsConfig, d as CustomDocsSearchConfig, dt as McpDocsSearchConfig, et as DocsSearchSourcePage, k as DocsAskAIMcpConfig, m as DocsAgentTraceEventInput, q as DocsSearchChunkingConfig, r as AlgoliaDocsSearchConfig, tt as DocsSitemapConfig, v as DocsAnalyticsEvent, y as DocsAnalyticsEventInput, z as DocsObservabilityEvent } from "./types-
|
|
1
|
+
import { B as DocsObservabilityEventInput, Ct as ResolvedDocsRelatedLink, J as DocsSearchConfig, K as DocsSearchAdapterFactory, Nt as TypesenseDocsSearchConfig, Q as DocsSearchResult, R as DocsObservabilityConfig, W as DocsSearchAdapter, Y as DocsSearchDocument, _ as DocsAnalyticsConfig, d as CustomDocsSearchConfig, dt as McpDocsSearchConfig, et as DocsSearchSourcePage, k as DocsAskAIMcpConfig, m as DocsAgentTraceEventInput, q as DocsSearchChunkingConfig, r as AlgoliaDocsSearchConfig, tt as DocsSitemapConfig, v as DocsAnalyticsEvent, y as DocsAnalyticsEventInput, z as DocsObservabilityEvent } from "./types-DabWZeFx.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/cloud-analytics.d.ts
|
|
4
4
|
interface DocsCloudAnalyticsOptions {
|
package/dist/server.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as DocsConfig, B as DocsObservabilityEventInput, D as DocsAskAIFeedbackMessage, E as DocsAskAIFeedbackData, G as DocsSearchAdapterContext, J as DocsSearchConfig, K as DocsSearchAdapterFactory, O as DocsAskAIFeedbackValue, Q as DocsSearchResult, R as DocsObservabilityConfig, T as DocsAskAIFeedbackConfig, W as DocsSearchAdapter, Y as DocsSearchDocument, Z as DocsSearchQuery, _ as DocsAnalyticsConfig, a as ApiReferenceRenderer, dt as McpDocsSearchConfig, et as DocsSearchSourcePage, g as DocsAgentTraceStatus, h as DocsAgentTraceEventType, k as DocsAskAIMcpConfig, m as DocsAgentTraceEventInput, mt as OpenDocsProvider, tt as DocsSitemapConfig, v as DocsAnalyticsEvent, y as DocsAnalyticsEventInput, z as DocsObservabilityEvent } from "./types-
|
|
2
|
-
import { A as toDocsSitemapMarkdownUrl, B as resolveDocsAnalyticsConfig, C as createDocsSitemapResponse, D as resolveDocsSitemapConfig, E as renderDocsSitemapXml, F as createDocsAgentTraceContext, H as DocsCloudAnalyticsOptions, I as createDocsAgentTraceId, L as emitDocsAgentTraceEvent, M as DocsAgentTraceContext, N as ResolvedDocsAnalyticsConfig, O as resolveDocsSitemapPageLastmod, P as ResolvedDocsObservabilityConfig, R as emitDocsAnalyticsEvent, S as buildDocsSitemapManifest, T as renderDocsSitemapMarkdown, U as createDocsCloudAnalytics, V as resolveDocsObservabilityConfig, _ as DocsSitemapFormat, a as createMcpSearchAdapter, b as DocsSitemapPageInput, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, f as resolveSearchRequestConfig, g as DEFAULT_SITEMAP_XML_ROUTE, h as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, i as createCustomSearchAdapter, j as DOCS_AGENT_TRACE_EVENT_TYPES, k as resolveDocsSitemapRequest, l as inferDocsAskAIPackageHints, m as DEFAULT_SITEMAP_MD_ROUTE, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, p as DEFAULT_SITEMAP_MANIFEST_PATH, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch, v as DocsSitemapManifest, w as readDocsSitemapManifestFromContentMap, x as DocsSitemapResolvedConfig, y as DocsSitemapManifestPage, z as emitDocsObservabilityEvent } from "./search-
|
|
1
|
+
import { A as DocsConfig, B as DocsObservabilityEventInput, D as DocsAskAIFeedbackMessage, E as DocsAskAIFeedbackData, G as DocsSearchAdapterContext, J as DocsSearchConfig, K as DocsSearchAdapterFactory, O as DocsAskAIFeedbackValue, Q as DocsSearchResult, R as DocsObservabilityConfig, T as DocsAskAIFeedbackConfig, W as DocsSearchAdapter, Y as DocsSearchDocument, Z as DocsSearchQuery, _ as DocsAnalyticsConfig, a as ApiReferenceRenderer, dt as McpDocsSearchConfig, et as DocsSearchSourcePage, g as DocsAgentTraceStatus, h as DocsAgentTraceEventType, k as DocsAskAIMcpConfig, m as DocsAgentTraceEventInput, mt as OpenDocsProvider, tt as DocsSitemapConfig, v as DocsAnalyticsEvent, y as DocsAnalyticsEventInput, z as DocsObservabilityEvent } from "./types-DabWZeFx.mjs";
|
|
2
|
+
import { A as toDocsSitemapMarkdownUrl, B as resolveDocsAnalyticsConfig, C as createDocsSitemapResponse, D as resolveDocsSitemapConfig, E as renderDocsSitemapXml, F as createDocsAgentTraceContext, H as DocsCloudAnalyticsOptions, I as createDocsAgentTraceId, L as emitDocsAgentTraceEvent, M as DocsAgentTraceContext, N as ResolvedDocsAnalyticsConfig, O as resolveDocsSitemapPageLastmod, P as ResolvedDocsObservabilityConfig, R as emitDocsAnalyticsEvent, S as buildDocsSitemapManifest, T as renderDocsSitemapMarkdown, U as createDocsCloudAnalytics, V as resolveDocsObservabilityConfig, _ as DocsSitemapFormat, a as createMcpSearchAdapter, b as DocsSitemapPageInput, c as formatDocsAskAIPackageHints, d as resolveAskAISearchRequestConfig, f as resolveSearchRequestConfig, g as DEFAULT_SITEMAP_XML_ROUTE, h as DEFAULT_SITEMAP_MD_WELL_KNOWN_ROUTE, i as createCustomSearchAdapter, j as DOCS_AGENT_TRACE_EVENT_TYPES, k as resolveDocsSitemapRequest, l as inferDocsAskAIPackageHints, m as DEFAULT_SITEMAP_MD_ROUTE, n as buildDocsSearchDocuments, o as createSimpleSearchAdapter, p as DEFAULT_SITEMAP_MANIFEST_PATH, r as createAlgoliaSearchAdapter, s as createTypesenseSearchAdapter, t as buildDocsAskAIContext, u as performDocsSearch, v as DocsSitemapManifest, w as readDocsSitemapManifestFromContentMap, x as DocsSitemapResolvedConfig, y as DocsSitemapManifestPage, z as emitDocsObservabilityEvent } from "./search-CvfF6EKZ.mjs";
|
|
3
3
|
import { DocsMcpHttpHandlers, DocsMcpNavigationNode, DocsMcpNavigationTree, DocsMcpPage, DocsMcpResolvedConfig, DocsMcpSource, createDocsMcpHttpHandler, createDocsMcpServer, createFilesystemDocsMcpSource, normalizeDocsMcpRoute, resolveDocsMcpConfig, runDocsMcpStdio } from "./mcp.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/api-reference.d.ts
|
|
@@ -4,7 +4,7 @@ import "./sitemap-server-DJvxOqX2.mjs";
|
|
|
4
4
|
import { createFilesystemDocsMcpSource } from "./mcp.mjs";
|
|
5
5
|
import "./server.mjs";
|
|
6
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-Cio3byUJ.mjs";
|
|
7
|
-
import { t as detectFramework } from "./utils-
|
|
7
|
+
import { t as detectFramework } from "./utils-TPe8H1P-.mjs";
|
|
8
8
|
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
import pc from "picocolors";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { c as fileExists, o as exec } from "./utils-TPe8H1P-.mjs";
|
|
2
|
+
import { a as getPackagesForFramework, c as resolveDocsPackageManager, i as frameworkFromPreset, l as validateUpgradeVersion, n as PRESETS, o as presetFromFramework, r as buildDocsPackageInstallCommand, s as resolveDocsPackageFramework, t as PACKAGES_BY_FRAMEWORK } from "./package-version-DQgrHnSb.mjs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import pc from "picocolors";
|
|
5
|
+
import * as p from "@clack/prompts";
|
|
6
|
+
|
|
7
|
+
//#region src/cli/upgrade.ts
|
|
8
|
+
/**
|
|
9
|
+
* Upgrade @farming-labs/* packages to a dist-tag or exact version.
|
|
10
|
+
* Detects framework from package.json by default, or use --framework (next, tanstack-start, nuxt, sveltekit, astro).
|
|
11
|
+
*/
|
|
12
|
+
function resolveUpgradeTarget(options) {
|
|
13
|
+
if (options.version !== void 0) return validateUpgradeVersion(options.version);
|
|
14
|
+
return options.tag ?? "latest";
|
|
15
|
+
}
|
|
16
|
+
/** Build the install command for upgrade (for testing). */
|
|
17
|
+
function buildUpgradeCommand(framework, target, pm) {
|
|
18
|
+
return buildDocsPackageInstallCommand(framework, target, pm);
|
|
19
|
+
}
|
|
20
|
+
async function upgrade(options = {}) {
|
|
21
|
+
const cwd = process.cwd();
|
|
22
|
+
p.intro(pc.bgCyan(pc.black(" @farming-labs/docs upgrade ")));
|
|
23
|
+
let target;
|
|
24
|
+
try {
|
|
25
|
+
target = resolveUpgradeTarget(options);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
p.log.error(error instanceof Error ? error.message : "Invalid upgrade version.");
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
if (!fileExists(path.join(cwd, "package.json"))) {
|
|
31
|
+
p.log.error("No package.json found in the current directory. Run this from your project root.");
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
const { framework, preset } = resolveDocsPackageFramework(cwd, options.framework);
|
|
35
|
+
const pm = await resolveDocsPackageManager(cwd, "upgrade");
|
|
36
|
+
const cmd = buildUpgradeCommand(framework, target, pm);
|
|
37
|
+
const packages = getPackagesForFramework(framework);
|
|
38
|
+
p.log.step(`Upgrading ${preset} docs packages to ${target}...`);
|
|
39
|
+
p.log.message(pc.dim(packages.join(", ")));
|
|
40
|
+
try {
|
|
41
|
+
exec(cmd, cwd);
|
|
42
|
+
p.log.success(`Packages upgraded to ${target}.`);
|
|
43
|
+
p.outro(pc.green("Done. Run your dev server to confirm everything works."));
|
|
44
|
+
} catch {
|
|
45
|
+
p.log.error("Upgrade failed. Try running manually:\n " + pc.cyan(cmd));
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
export { upgrade };
|
|
@@ -99,6 +99,20 @@ function exec(command, cwd) {
|
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
|
+
* Run a shell command synchronously and return stdout.
|
|
103
|
+
*/
|
|
104
|
+
function execOutput(command, cwd) {
|
|
105
|
+
return execSync(command, {
|
|
106
|
+
cwd,
|
|
107
|
+
encoding: "utf-8",
|
|
108
|
+
stdio: [
|
|
109
|
+
"ignore",
|
|
110
|
+
"pipe",
|
|
111
|
+
"pipe"
|
|
112
|
+
]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
102
116
|
* Spawn a process and wait for a specific string in stdout,
|
|
103
117
|
* then resolve with the child process (still running).
|
|
104
118
|
*/
|
|
@@ -142,4 +156,4 @@ function spawnAndWaitFor(command, args, cwd, waitFor, timeoutMs = 6e4) {
|
|
|
142
156
|
}
|
|
143
157
|
|
|
144
158
|
//#endregion
|
|
145
|
-
export { devInstallCommand as a,
|
|
159
|
+
export { devInstallCommand as a, fileExists as c, spawnAndWaitFor as d, writeFileSafe as f, detectPackageManagerFromLockfile as i, installCommand as l, detectGlobalCssFiles as n, exec as o, detectNextAppDir as r, execOutput as s, detectFramework as t, readFileSafe as u };
|
package/package.json
CHANGED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { c as installCommand, i as detectPackageManagerFromLockfile, o as exec, s as fileExists, t as detectFramework } from "./utils-AmYxHDoz.mjs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import pc from "picocolors";
|
|
4
|
-
import * as p from "@clack/prompts";
|
|
5
|
-
|
|
6
|
-
//#region src/cli/upgrade.ts
|
|
7
|
-
/**
|
|
8
|
-
* Upgrade @farming-labs/* packages to a dist-tag or exact version.
|
|
9
|
-
* Detects framework from package.json by default, or use --framework (next, tanstack-start, nuxt, sveltekit, astro).
|
|
10
|
-
*/
|
|
11
|
-
const PRESETS = [
|
|
12
|
-
"next",
|
|
13
|
-
"tanstack-start",
|
|
14
|
-
"nuxt",
|
|
15
|
-
"sveltekit",
|
|
16
|
-
"astro"
|
|
17
|
-
];
|
|
18
|
-
const PACKAGES_BY_FRAMEWORK = {
|
|
19
|
-
nextjs: [
|
|
20
|
-
"@farming-labs/docs",
|
|
21
|
-
"@farming-labs/theme",
|
|
22
|
-
"@farming-labs/next"
|
|
23
|
-
],
|
|
24
|
-
"tanstack-start": [
|
|
25
|
-
"@farming-labs/docs",
|
|
26
|
-
"@farming-labs/theme",
|
|
27
|
-
"@farming-labs/tanstack-start"
|
|
28
|
-
],
|
|
29
|
-
nuxt: [
|
|
30
|
-
"@farming-labs/docs",
|
|
31
|
-
"@farming-labs/nuxt",
|
|
32
|
-
"@farming-labs/nuxt-theme"
|
|
33
|
-
],
|
|
34
|
-
sveltekit: [
|
|
35
|
-
"@farming-labs/docs",
|
|
36
|
-
"@farming-labs/svelte",
|
|
37
|
-
"@farming-labs/svelte-theme"
|
|
38
|
-
],
|
|
39
|
-
astro: [
|
|
40
|
-
"@farming-labs/docs",
|
|
41
|
-
"@farming-labs/astro",
|
|
42
|
-
"@farming-labs/astro-theme"
|
|
43
|
-
]
|
|
44
|
-
};
|
|
45
|
-
function presetFromFramework(fw) {
|
|
46
|
-
return fw === "nextjs" ? "next" : fw;
|
|
47
|
-
}
|
|
48
|
-
function frameworkFromPreset(preset) {
|
|
49
|
-
return preset === "next" ? "nextjs" : preset;
|
|
50
|
-
}
|
|
51
|
-
/** Return package list for a framework (for testing and CLI). */
|
|
52
|
-
function getPackagesForFramework(framework) {
|
|
53
|
-
return PACKAGES_BY_FRAMEWORK[framework];
|
|
54
|
-
}
|
|
55
|
-
const exactSemverPattern = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
56
|
-
function validateUpgradeVersion(version) {
|
|
57
|
-
const normalized = version.trim();
|
|
58
|
-
if (!exactSemverPattern.test(normalized)) throw new Error(`Invalid version "${version}". Use an exact semver version like 0.1.104.`);
|
|
59
|
-
return normalized;
|
|
60
|
-
}
|
|
61
|
-
function resolveUpgradeTarget(options) {
|
|
62
|
-
if (options.version !== void 0) return validateUpgradeVersion(options.version);
|
|
63
|
-
return options.tag ?? "latest";
|
|
64
|
-
}
|
|
65
|
-
/** Build the install command for upgrade (for testing). */
|
|
66
|
-
function buildUpgradeCommand(framework, target, pm) {
|
|
67
|
-
const packagesWithTarget = PACKAGES_BY_FRAMEWORK[framework].map((name) => `${name}@${target}`);
|
|
68
|
-
return `${installCommand(pm)} ${packagesWithTarget.join(" ")}`;
|
|
69
|
-
}
|
|
70
|
-
async function upgrade(options = {}) {
|
|
71
|
-
const cwd = process.cwd();
|
|
72
|
-
p.intro(pc.bgCyan(pc.black(" @farming-labs/docs upgrade ")));
|
|
73
|
-
let target;
|
|
74
|
-
try {
|
|
75
|
-
target = resolveUpgradeTarget(options);
|
|
76
|
-
} catch (error) {
|
|
77
|
-
p.log.error(error instanceof Error ? error.message : "Invalid upgrade version.");
|
|
78
|
-
process.exit(1);
|
|
79
|
-
}
|
|
80
|
-
if (!fileExists(path.join(cwd, "package.json"))) {
|
|
81
|
-
p.log.error("No package.json found in the current directory. Run this from your project root.");
|
|
82
|
-
process.exit(1);
|
|
83
|
-
}
|
|
84
|
-
let framework = null;
|
|
85
|
-
let preset;
|
|
86
|
-
if (options.framework) {
|
|
87
|
-
const raw = options.framework.toLowerCase().trim();
|
|
88
|
-
const normalized = raw === "nextjs" ? "next" : raw;
|
|
89
|
-
if (!PRESETS.includes(normalized)) {
|
|
90
|
-
p.log.error(`Invalid framework ${pc.cyan(options.framework)}. Use one of: ${PRESETS.map((t) => pc.cyan(t)).join(", ")}`);
|
|
91
|
-
process.exit(1);
|
|
92
|
-
}
|
|
93
|
-
preset = normalized;
|
|
94
|
-
framework = frameworkFromPreset(preset);
|
|
95
|
-
} else {
|
|
96
|
-
const detected = detectFramework(cwd);
|
|
97
|
-
if (!detected) {
|
|
98
|
-
p.log.error("Could not detect a supported framework (Next.js, TanStack Start, Nuxt, SvelteKit, Astro). Use " + pc.cyan("--framework <next|tanstack-start|nuxt|sveltekit|astro>") + " to specify.");
|
|
99
|
-
process.exit(1);
|
|
100
|
-
}
|
|
101
|
-
framework = detected;
|
|
102
|
-
preset = presetFromFramework(framework);
|
|
103
|
-
}
|
|
104
|
-
let pm = detectPackageManagerFromLockfile(cwd);
|
|
105
|
-
if (pm) p.log.info(`Detected ${pc.cyan(pm)} from lockfile`);
|
|
106
|
-
else {
|
|
107
|
-
const pmAnswer = await p.select({
|
|
108
|
-
message: "Which package manager do you want to use for this upgrade?",
|
|
109
|
-
options: [
|
|
110
|
-
{
|
|
111
|
-
value: "pnpm",
|
|
112
|
-
label: "pnpm",
|
|
113
|
-
hint: "Use pnpm add"
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
value: "npm",
|
|
117
|
-
label: "npm",
|
|
118
|
-
hint: "Use npm add"
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
value: "yarn",
|
|
122
|
-
label: "yarn",
|
|
123
|
-
hint: "Use yarn add"
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
value: "bun",
|
|
127
|
-
label: "bun",
|
|
128
|
-
hint: "Use bun add"
|
|
129
|
-
}
|
|
130
|
-
]
|
|
131
|
-
});
|
|
132
|
-
if (p.isCancel(pmAnswer)) {
|
|
133
|
-
p.outro(pc.red("Upgrade cancelled."));
|
|
134
|
-
process.exit(0);
|
|
135
|
-
}
|
|
136
|
-
pm = pmAnswer;
|
|
137
|
-
p.log.info(`Using ${pc.cyan(pm)} as package manager`);
|
|
138
|
-
}
|
|
139
|
-
const cmd = buildUpgradeCommand(framework, target, pm);
|
|
140
|
-
const packages = getPackagesForFramework(framework);
|
|
141
|
-
p.log.step(`Upgrading ${preset} docs packages to ${target}...`);
|
|
142
|
-
p.log.message(pc.dim(packages.join(", ")));
|
|
143
|
-
try {
|
|
144
|
-
exec(cmd, cwd);
|
|
145
|
-
p.log.success(`Packages upgraded to ${target}.`);
|
|
146
|
-
p.outro(pc.green("Done. Run your dev server to confirm everything works."));
|
|
147
|
-
} catch {
|
|
148
|
-
p.log.error("Upgrade failed. Try running manually:\n " + pc.cyan(cmd));
|
|
149
|
-
process.exit(1);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
//#endregion
|
|
154
|
-
export { upgrade };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|