@farming-labs/docs 0.1.106 → 0.1.108

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.
@@ -158,7 +158,7 @@ async function main() {
158
158
  printRobotsGenerateHelp();
159
159
  process.exit(1);
160
160
  } else if (parsedCommand.command === "downgrade") {
161
- const { downgrade } = await import("../downgrade-C2Hg1Yz7.mjs");
161
+ const { downgrade } = await import("../downgrade-Bt4yrVyy.mjs");
162
162
  const framework = (typeof flags.framework === "string" ? flags.framework : void 0) ?? (args[1] && !args[1].startsWith("--") ? args[1] : void 0);
163
163
  const hasVersionFlag = args.includes("--version") || args.some((arg) => arg.startsWith("--version="));
164
164
  await downgrade({
@@ -166,7 +166,7 @@ async function main() {
166
166
  version: typeof flags.version === "string" ? flags.version : hasVersionFlag ? "" : void 0
167
167
  });
168
168
  } else if (parsedCommand.command === "upgrade") {
169
- const { upgrade } = await import("../upgrade-BZ6SnqKP.mjs");
169
+ const { upgrade } = await import("../upgrade-B1EMfRQJ.mjs");
170
170
  const framework = (typeof flags.framework === "string" ? flags.framework : void 0) ?? (args[1] && !args[1].startsWith("--") ? args[1] : void 0);
171
171
  const hasVersionFlag = args.includes("--version") || args.some((arg) => arg.startsWith("--version="));
172
172
  const version = typeof flags.version === "string" ? flags.version : hasVersionFlag ? "" : void 0;
@@ -1,5 +1,5 @@
1
- import { c as fileExists, i as detectPackageManagerFromLockfile, o as exec, s as execOutput, t as detectFramework } from "./utils-TPe8H1P-.mjs";
2
- import { PRESETS, buildUpgradeCommand, frameworkFromPreset, getPackagesForFramework, presetFromFramework, validateUpgradeVersion } from "./upgrade-BZ6SnqKP.mjs";
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
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import pc from "picocolors";
@@ -112,70 +112,7 @@ function fetchPublishedVersions(cwd) {
112
112
  return parsePublishedVersions(execOutput("npm view @farming-labs/docs versions --json", cwd));
113
113
  }
114
114
  function buildDowngradeCommand(framework, version, pm) {
115
- return buildUpgradeCommand(framework, validateUpgradeVersion(version), pm);
116
- }
117
- function resolveFramework(cwd, rawFramework) {
118
- if (rawFramework) {
119
- const raw = rawFramework.toLowerCase().trim();
120
- const normalized = raw === "nextjs" ? "next" : raw;
121
- if (!PRESETS.includes(normalized)) {
122
- p.log.error(`Invalid framework ${pc.cyan(rawFramework)}. Use one of: ${PRESETS.map((t) => pc.cyan(t)).join(", ")}`);
123
- process.exit(1);
124
- }
125
- const preset = normalized;
126
- return {
127
- framework: frameworkFromPreset(preset),
128
- preset
129
- };
130
- }
131
- const detected = detectFramework(cwd);
132
- if (!detected) {
133
- 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.");
134
- process.exit(1);
135
- }
136
- return {
137
- framework: detected,
138
- preset: presetFromFramework(detected)
139
- };
140
- }
141
- async function resolvePackageManager(cwd) {
142
- const detected = detectPackageManagerFromLockfile(cwd);
143
- if (detected) {
144
- p.log.info(`Detected ${pc.cyan(detected)} from lockfile`);
145
- return detected;
146
- }
147
- const pmAnswer = await p.select({
148
- message: "Which package manager do you want to use for this downgrade?",
149
- options: [
150
- {
151
- value: "pnpm",
152
- label: "pnpm",
153
- hint: "Use pnpm add"
154
- },
155
- {
156
- value: "npm",
157
- label: "npm",
158
- hint: "Use npm add"
159
- },
160
- {
161
- value: "yarn",
162
- label: "yarn",
163
- hint: "Use yarn add"
164
- },
165
- {
166
- value: "bun",
167
- label: "bun",
168
- hint: "Use bun add"
169
- }
170
- ]
171
- });
172
- if (p.isCancel(pmAnswer)) {
173
- p.outro(pc.red("Downgrade cancelled."));
174
- process.exit(0);
175
- }
176
- const pm = pmAnswer;
177
- p.log.info(`Using ${pc.cyan(pm)} as package manager`);
178
- return pm;
115
+ return buildDocsPackageInstallCommand(framework, validateUpgradeVersion(version), pm);
179
116
  }
180
117
  async function downgrade(options = {}) {
181
118
  const cwd = process.cwd();
@@ -184,7 +121,7 @@ async function downgrade(options = {}) {
184
121
  p.log.error("No package.json found in the current directory. Run this from your project root.");
185
122
  process.exit(1);
186
123
  }
187
- const { framework, preset } = resolveFramework(cwd, options.framework);
124
+ const { framework, preset } = resolveDocsPackageFramework(cwd, options.framework);
188
125
  const packages = getPackagesForFramework(framework);
189
126
  const currentVersion = readCurrentPackageVersion(cwd, packages);
190
127
  if (!currentVersion) {
@@ -224,7 +161,7 @@ async function downgrade(options = {}) {
224
161
  }
225
162
  targetVersion = previousVersion;
226
163
  }
227
- const pm = await resolvePackageManager(cwd);
164
+ const pm = await resolveDocsPackageManager(cwd, "downgrade");
228
165
  const cmd = buildDowngradeCommand(framework, targetVersion, pm);
229
166
  p.log.step(`Downgrading ${preset} docs packages from ${currentVersion} to ${targetVersion}...`);
230
167
  p.log.message(pc.dim(packages.join(", ")));
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-fGTXVS-r.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-BjQMhpS-.mjs";
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
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-fGTXVS-r.mjs";
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,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-fGTXVS-r.mjs";
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-fGTXVS-r.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-BjQMhpS-.mjs";
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
@@ -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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/docs",
3
- "version": "0.1.106",
3
+ "version": "0.1.108",
4
4
  "description": "Modern, flexible MDX-based docs framework — core types, config, and CLI",
5
5
  "keywords": [
6
6
  "docs",
@@ -1,154 +0,0 @@
1
- import { c as fileExists, i as detectPackageManagerFromLockfile, l as installCommand, o as exec, t as detectFramework } from "./utils-TPe8H1P-.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 { PRESETS, buildUpgradeCommand, frameworkFromPreset, getPackagesForFramework, presetFromFramework, upgrade, validateUpgradeVersion };