@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,184 +0,0 @@
1
- import { c as fileExists, o as exec, s as execOutput } from "./utils-6UCLxv4B.mjs";
2
- import { a as getPackagesForFramework, c as resolveDocsPackageManager, l as validateUpgradeVersion, r as buildDocsPackageInstallCommand, s as resolveDocsPackageFramework } from "./package-version-qik_4J6C.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
- if (options.dryRun) {
169
- p.log.info("Dry run. Would run:\n " + pc.cyan(cmd));
170
- p.outro(pc.green("Dry run complete. No changes made."));
171
- return;
172
- }
173
- try {
174
- exec(cmd, cwd);
175
- p.log.success(`Packages downgraded to ${targetVersion}.`);
176
- p.outro(pc.green("Done. Run your dev server to confirm everything works."));
177
- } catch {
178
- p.log.error("Downgrade failed. Try running manually:\n " + pc.cyan(cmd));
179
- process.exit(1);
180
- }
181
- }
182
-
183
- //#endregion
184
- export { downgrade };
@@ -1,20 +0,0 @@
1
- //#region src/cli/errors.ts
2
- const CLI_ERROR_REPORTED_KEY = "__farmingLabsDocsCliErrorReported";
3
- function formatCliError(error) {
4
- if (error instanceof Error && error.message.trim()) return error.message.trim();
5
- if (typeof error === "string" && error.trim()) return error.trim();
6
- return "An unexpected error occurred.";
7
- }
8
- function markCliErrorReported(error) {
9
- if (error && typeof error === "object") error[CLI_ERROR_REPORTED_KEY] = true;
10
- }
11
- function wasCliErrorReported(error) {
12
- return Boolean(error && typeof error === "object" && error[CLI_ERROR_REPORTED_KEY] === true);
13
- }
14
- function shouldPrintStackTrace(env = process.env) {
15
- const debug = env.DOCS_DEBUG ?? env.DEBUG;
16
- return debug === "1" || debug === "true" || debug === "@farming-labs/docs";
17
- }
18
-
19
- //#endregion
20
- export { wasCliErrorReported as i, markCliErrorReported as n, shouldPrintStackTrace as r, formatCliError as t };