@farming-labs/docs 0.1.62 → 0.1.64

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.
@@ -77,10 +77,10 @@ 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-CcgI3D7-.mjs");
80
+ const { init } = await import("../init-BFhnsS7P.mjs");
81
81
  await init(initOptions);
82
82
  } else if (parsedCommand.command === "dev") {
83
- const { dev } = await import("../dev-VD41gGZC.mjs");
83
+ const { dev } = await import("../dev-Cj7kSQsB.mjs");
84
84
  await dev(devOptions);
85
85
  } else if (parsedCommand.command === "mcp") {
86
86
  const { runMcp } = await import("../mcp-BANLcwQ0.mjs");
@@ -139,7 +139,7 @@ ${pc.dim("Usage:")}
139
139
 
140
140
  ${pc.dim("Commands:")}
141
141
  ${pc.cyan("init")} Scaffold docs in your project (default)
142
- ${pc.cyan("dev")} Run frameworkless docs locally from ${pc.dim("docs.cloud.json")}
142
+ ${pc.cyan("dev")} Run frameworkless docs locally from ${pc.dim("docs.json")}
143
143
  ${pc.cyan("agent")} Agent utilities (${pc.dim("compact")} to generate sibling agent.md files)
144
144
  ${pc.cyan("doctor")} Inspect and score agent or reader-facing docs quality
145
145
  ${pc.cyan("mcp")} Run the built-in docs MCP server over stdio
@@ -1,4 +1,4 @@
1
- import { K as rootLayoutTemplate, W as postcssConfigTemplate, g as docsLayoutTemplate, v as globalCssTemplate, yt as tsconfigTemplate } from "./templates-2M1vfnf-.mjs";
1
+ import { K as rootLayoutTemplate, W as postcssConfigTemplate, g as docsLayoutTemplate, v as globalCssTemplate, yt as tsconfigTemplate } from "./templates-BLSQ8EwL.mjs";
2
2
  import { i as detectPackageManagerFromLockfile } from "./utils-DSMXVnEu.mjs";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
@@ -63,7 +63,8 @@ function printDevBanner({ name = "@farming-labs/docs", version = "v0.0.0", port,
63
63
 
64
64
  //#endregion
65
65
  //#region src/cli/dev.ts
66
- const MANAGED_CONFIG_FILE = "docs.cloud.json";
66
+ const PRIMARY_MANAGED_CONFIG_FILE = "docs.json";
67
+ const LEGACY_MANAGED_CONFIG_FILE = "docs.cloud.json";
67
68
  const DEFAULT_RUNTIME_ROOT = ".docs/site";
68
69
  const DEFAULT_DOCS_ROOT = "docs";
69
70
  const DEFAULT_API_REFERENCE_ROOT = "api-reference";
@@ -134,6 +135,12 @@ const THEME_PRESETS = {
134
135
  importPath: "@farming-labs/theme/shiny",
135
136
  factory: "shiny"
136
137
  },
138
+ ledger: {
139
+ configName: "ledger",
140
+ templateTheme: "ledger",
141
+ importPath: "@farming-labs/theme/ledger",
142
+ factory: "ledger"
143
+ },
137
144
  greentree: {
138
145
  configName: "greentree",
139
146
  templateTheme: "greentree",
@@ -426,19 +433,31 @@ function detectNearestPackageManager(startDir) {
426
433
  current = parent;
427
434
  }
428
435
  }
436
+ function resolveManagedConfigPath(projectRoot) {
437
+ const primaryPath = path.join(projectRoot, PRIMARY_MANAGED_CONFIG_FILE);
438
+ if (fs.existsSync(primaryPath)) return {
439
+ configPath: primaryPath,
440
+ configFileName: PRIMARY_MANAGED_CONFIG_FILE
441
+ };
442
+ const legacyPath = path.join(projectRoot, LEGACY_MANAGED_CONFIG_FILE);
443
+ if (fs.existsSync(legacyPath)) return {
444
+ configPath: legacyPath,
445
+ configFileName: LEGACY_MANAGED_CONFIG_FILE
446
+ };
447
+ throw new Error(`Could not find ${PRIMARY_MANAGED_CONFIG_FILE} in ${projectRoot}. Frameworkless dev expects ${PRIMARY_MANAGED_CONFIG_FILE}, ${DEFAULT_DOCS_ROOT}/, and optionally ${DEFAULT_API_REFERENCE_ROOT}/. ${LEGACY_MANAGED_CONFIG_FILE} is still supported for older repos.`);
448
+ }
429
449
  function readManagedDocsProject(projectRoot) {
430
- const configPath = path.join(projectRoot, MANAGED_CONFIG_FILE);
431
- if (!fs.existsSync(configPath)) throw new Error(`Could not find ${MANAGED_CONFIG_FILE} in ${projectRoot}. Frameworkless dev expects ${MANAGED_CONFIG_FILE}, ${DEFAULT_DOCS_ROOT}/, and optionally ${DEFAULT_API_REFERENCE_ROOT}/.`);
450
+ const { configPath, configFileName } = resolveManagedConfigPath(projectRoot);
432
451
  let parsedJson;
433
452
  try {
434
453
  parsedJson = JSON.parse(fs.readFileSync(configPath, "utf-8"));
435
454
  } catch (error) {
436
- throw new Error(`Could not parse ${MANAGED_CONFIG_FILE}. The file must be valid JSON.${error instanceof Error ? ` ${error.message}` : ""}`);
455
+ throw new Error(`Could not parse ${configFileName}. The file must be valid JSON.${error instanceof Error ? ` ${error.message}` : ""}`);
437
456
  }
438
457
  const parsed = managedConfigSchema.safeParse(parsedJson);
439
- if (!parsed.success) throw new Error(`Invalid ${MANAGED_CONFIG_FILE}: ${formatZodError(parsed.error)}`);
458
+ if (!parsed.success) throw new Error(`Invalid ${configFileName}: ${formatZodError(parsed.error)}`);
440
459
  const docsConfig = parsed.data.docs;
441
- if (("mode" in docsConfig ? docsConfig.mode : docsConfig.framework === "managed" ? "frameworkless" : "framework") !== "frameworkless") throw new Error(`${MANAGED_CONFIG_FILE} uses docs.mode = "framework". ${pc.cyan("docs dev")} only supports frameworkless projects right now.`);
460
+ if (("mode" in docsConfig ? docsConfig.mode : docsConfig.framework === "managed" ? "frameworkless" : "framework") !== "frameworkless") throw new Error(`${configFileName} uses docs.mode = "framework". ${pc.cyan("docs dev")} only supports frameworkless projects right now.`);
442
461
  const runtimeFramework = "runtime" in docsConfig && docsConfig.runtime ? docsConfig.runtime : "nextjs";
443
462
  if (runtimeFramework !== "nextjs") throw new Error(`Frameworkless ${pc.cyan("docs dev")} currently supports only docs.runtime = "nextjs".`);
444
463
  const docsRoot = parsed.data.content?.docsRoot ?? DEFAULT_DOCS_ROOT;
@@ -452,6 +471,7 @@ function readManagedDocsProject(projectRoot) {
452
471
  const theme = resolveThemePreset(parsed.data.theme?.preset);
453
472
  return {
454
473
  configPath,
474
+ configFileName,
455
475
  projectRoot,
456
476
  runtimeDir,
457
477
  runtimeFramework,
@@ -665,7 +685,7 @@ function validateManagedOpenApiSpec(project) {
665
685
  if (!sourcePath) return;
666
686
  if (!fs.existsSync(sourcePath) || !fs.statSync(sourcePath).isFile()) {
667
687
  const relativePath = path.relative(project.projectRoot, sourcePath) || sourcePath;
668
- throw new Error(`OpenAPI source not found at ${relativePath}. Update ${MANAGED_CONFIG_FILE} or add the spec file and try again.`);
688
+ throw new Error(`OpenAPI source not found at ${relativePath}. Update ${project.configFileName} or add the spec file and try again.`);
669
689
  }
670
690
  }
671
691
  function renderAlternateSectionLayout(configImportPath) {
@@ -895,7 +915,7 @@ function materializeManagedRuntime(projectRoot) {
895
915
  const hasDocsMarkdown = directoryHasMarkdown(docsSourceDir);
896
916
  const hasApiReferenceMarkdown = directoryHasMarkdown(apiReferenceSourceDir);
897
917
  validateManagedOpenApiSpec(project);
898
- if (!hasDocsMarkdown && !hasApiReferenceMarkdown && !hasOpenApiSpec) throw new Error(`No docs content found. Add markdown files under ${project.docsRoot}/ or ${project.apiReferenceRoot}/, or point content.openapi at an OpenAPI file in ${MANAGED_CONFIG_FILE}.`);
918
+ if (!hasDocsMarkdown && !hasApiReferenceMarkdown && !hasOpenApiSpec) throw new Error(`No docs content found. Add markdown files under ${project.docsRoot}/ or ${project.apiReferenceRoot}/, or point content.openapi at an OpenAPI file in ${project.configFileName}.`);
899
919
  const templateConfig = {
900
920
  entry: "docs",
901
921
  theme: project.theme.templateTheme,
@@ -1140,9 +1160,9 @@ async function dev(options = {}) {
1140
1160
  const runtimeInstallStamp = getRuntimeInstallStamp(project);
1141
1161
  console.log(pc.dim("Preparing local preview..."));
1142
1162
  if (options.verbose) {
1143
- logLine("source", `${pc.cyan(MANAGED_CONFIG_FILE)} drives ${pc.cyan(`${project.docsRoot}/`)} and ${pc.cyan(`${project.apiReferenceRoot}/`)}`);
1163
+ logLine("source", `${pc.cyan(project.configFileName)} drives ${pc.cyan(`${project.docsRoot}/`)} and ${pc.cyan(`${project.apiReferenceRoot}/`)}`);
1144
1164
  logLine("runtime", `Generated runtime at ${pc.cyan(path.relative(projectRoot, project.runtimeDir) || project.runtimeDir)}`);
1145
- logLine("watch", `Watching ${project.docsRoot}/, ${project.apiReferenceRoot}/, and ${MANAGED_CONFIG_FILE}`);
1165
+ logLine("watch", `Watching ${project.docsRoot}/, ${project.apiReferenceRoot}/, and ${project.configFileName}`);
1146
1166
  logLine("sync", `Loaded ${initial.docs.pageCount} docs page${initial.docs.pageCount === 1 ? "" : "s"} and ${initial.apiReference.pageCount} api-reference page${initial.apiReference.pageCount === 1 ? "" : "s"}`);
1147
1167
  }
1148
1168
  if (!fs.existsSync(runtimeNodeModules) || !fs.existsSync(runtimeInstallMarker) || fs.readFileSync(runtimeInstallMarker, "utf-8") !== runtimeInstallStamp) {
@@ -1,4 +1,4 @@
1
- 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-2M1vfnf-.mjs";
1
+ 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-BLSQ8EwL.mjs";
2
2
  import { a as devInstallCommand, c as installCommand, d as writeFileSafe, i as detectPackageManagerFromLockfile, l as readFileSafe, n as detectGlobalCssFiles, o as exec, r as detectNextAppDir, s as fileExists, t as detectFramework, u as spawnAndWaitFor } from "./utils-DSMXVnEu.mjs";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
@@ -377,6 +377,11 @@ async function init(options = {}) {
377
377
  label: "Shiny",
378
378
  hint: "Glossy, modern look with subtle shimmer effects"
379
379
  },
380
+ {
381
+ value: "ledger",
382
+ label: "Ledger",
383
+ hint: "Stripe Docs-inspired product docs shell with navy code panels"
384
+ },
380
385
  {
381
386
  value: "greentree",
382
387
  label: "GreenTree",
@@ -1037,6 +1042,7 @@ function scaffoldSvelteKit(cwd, cfg, globalCssRelPath, write, skipped, written)
1037
1042
  colorful: "colorful",
1038
1043
  darkbold: "darkbold",
1039
1044
  shiny: "shiny",
1045
+ ledger: "ledger",
1040
1046
  greentree: "greentree",
1041
1047
  concrete: "concrete",
1042
1048
  "command-grid": "command-grid",
@@ -1093,6 +1099,7 @@ function scaffoldAstro(cwd, cfg, globalCssRelPath, write, skipped, written) {
1093
1099
  colorful: "colorful",
1094
1100
  darkbold: "darkbold",
1095
1101
  shiny: "shiny",
1102
+ ledger: "ledger",
1096
1103
  greentree: "greentree",
1097
1104
  concrete: "concrete",
1098
1105
  "command-grid": "command-grid",
@@ -1136,6 +1143,7 @@ function scaffoldNuxt(cwd, cfg, globalCssRelPath, write, skipped, written) {
1136
1143
  colorful: "colorful",
1137
1144
  darkbold: "darkbold",
1138
1145
  shiny: "shiny",
1146
+ ledger: "ledger",
1139
1147
  greentree: "greentree",
1140
1148
  concrete: "concrete",
1141
1149
  "command-grid": "command-grid",
@@ -68,6 +68,17 @@ const THEME_INFO = {
68
68
  astroCssTheme: "shiny",
69
69
  nuxtCssTheme: "shiny"
70
70
  },
71
+ ledger: {
72
+ factory: "ledger",
73
+ nextImport: "@farming-labs/theme/ledger",
74
+ svelteImport: "@farming-labs/svelte-theme/ledger",
75
+ astroImport: "@farming-labs/astro-theme/ledger",
76
+ nuxtImport: "@farming-labs/nuxt-theme/ledger",
77
+ nextCssImport: "ledger",
78
+ svelteCssTheme: "ledger",
79
+ astroCssTheme: "ledger",
80
+ nuxtCssTheme: "ledger"
81
+ },
71
82
  greentree: {
72
83
  factory: "greentree",
73
84
  nextImport: "@farming-labs/theme/greentree",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farming-labs/docs",
3
- "version": "0.1.62",
3
+ "version": "0.1.64",
4
4
  "description": "Modern, flexible MDX-based docs framework — core types, config, and CLI",
5
5
  "keywords": [
6
6
  "docs",