@clarify-labs/cli 0.11.15 → 0.11.17

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.
@@ -1118,7 +1118,7 @@ var clarifyPagesItemSchema = z.lazy(() => z.union([
1118
1118
  filter: z.object({ tags: z.array(z.string()).optional() }).strict().optional()
1119
1119
  }).strict()
1120
1120
  ]));
1121
- var clarifyPagesGroupShape = {
1121
+ var clarifyPagesGroupSchema = z.lazy(() => z.object({
1122
1122
  group: clarifyLocalizedTextSchema,
1123
1123
  icon: z.string().optional(),
1124
1124
  visible: z.enum([
@@ -1129,8 +1129,7 @@ var clarifyPagesGroupShape = {
1129
1129
  searchable: z.boolean().optional(),
1130
1130
  layout: z.enum(["documentation", "blog"]).optional(),
1131
1131
  pages: z.array(clarifyPagesItemSchema)
1132
- };
1133
- var clarifyPagesGroupSchema = z.lazy(() => z.object(clarifyPagesGroupShape).strict());
1132
+ }).strict());
1134
1133
  var clarifyPagesConfigSchema = z.union([z.array(clarifyPagesGroupSchema), z.literal("FileTree")]);
1135
1134
  var clarifyTabItemSchema = z.object({
1136
1135
  tab: clarifyLocalizedTextSchema,
@@ -1789,7 +1788,7 @@ function createViteAdapter(engine) {
1789
1788
  }
1790
1789
  var cliPackageVersion = {
1791
1790
  name: "@clarify-labs/cli",
1792
- version: "0.11.15",
1791
+ version: "0.11.17",
1793
1792
  license: "AGPL-3.0-only",
1794
1793
  type: "module",
1795
1794
  repository: {
@@ -1915,49 +1914,6 @@ function readRouteArtifactContent(route) {
1915
1914
  const content = readRouteContent(route);
1916
1915
  return shouldUseUtf8Signature(route) ? withUtf8Signature(content) : content;
1917
1916
  }
1918
- function mergeOpenAPIRecord(target, source, section, filePath) {
1919
- if (!source) return;
1920
- for (const [key, value] of Object.entries(source)) {
1921
- const existing = target[key];
1922
- if (existing !== void 0 && JSON.stringify(existing) !== JSON.stringify(value)) throw new Error(`[clarify] Cannot aggregate OpenAPI specs: conflicting ${section} entry "${key}" in ${filePath}.`);
1923
- target[key] = value;
1924
- }
1925
- }
1926
- function createRootOpenAPISpec(routes, projectConfig) {
1927
- const paths = {};
1928
- const webhooks = {};
1929
- const components = {};
1930
- const tags = /* @__PURE__ */ new Map();
1931
- const defaultLocale = projectConfig.locales?.default;
1932
- for (const route of routes) {
1933
- if (route.kind !== "openapi" || route.diagnostic || !route.source.content || defaultLocale && route.locale && route.locale !== defaultLocale) continue;
1934
- const filePath = route.source.filePath;
1935
- const spec = JSON.parse(route.source.content);
1936
- mergeOpenAPIRecord(paths, spec.paths, "paths", filePath);
1937
- mergeOpenAPIRecord(webhooks, "webhooks" in spec ? spec.webhooks : void 0, "webhooks", filePath);
1938
- for (const [section, entries] of Object.entries(spec.components ?? {})) {
1939
- components[section] ??= {};
1940
- mergeOpenAPIRecord(components[section], entries, `components.${section}`, filePath);
1941
- }
1942
- for (const tag of spec.tags ?? []) {
1943
- const existing = tags.get(tag.name);
1944
- if (existing !== void 0 && JSON.stringify(existing) !== JSON.stringify(tag)) throw new Error(`[clarify] Cannot aggregate OpenAPI specs: conflicting tag "${tag.name}" in ${filePath}.`);
1945
- tags.set(tag.name, tag);
1946
- }
1947
- }
1948
- return {
1949
- openapi: "3.1.0",
1950
- info: {
1951
- title: projectConfig.title,
1952
- description: projectConfig.description,
1953
- version: "1.0.0"
1954
- },
1955
- paths,
1956
- ...Object.keys(webhooks).length > 0 ? { webhooks } : {},
1957
- ...Object.keys(components).length > 0 ? { components } : {},
1958
- ...tags.size > 0 ? { tags: [...tags.values()] } : {}
1959
- };
1960
- }
1961
1917
  function isLlmsTxtRoute(route) {
1962
1918
  return !route.path.split("/").includes("404");
1963
1919
  }
@@ -2057,14 +2013,6 @@ function serveContentArtifacts(req, res, projectConfig, routes) {
2057
2013
  res.end(createLlmsTxtArtifact(routes, projectConfig), "utf8");
2058
2014
  return true;
2059
2015
  }
2060
- if (contentPath === "/openapi.json" || contentPath === "/openapi.yml") {
2061
- const spec = createRootOpenAPISpec(routes, projectConfig);
2062
- const isJson = contentPath.endsWith(".json");
2063
- res.statusCode = 200;
2064
- res.setHeader("Content-Type", isJson ? "application/json; charset=utf-8" : "text/yaml; charset=utf-8");
2065
- res.end(isJson ? JSON.stringify(spec, null, 2) : stringify(spec, { lineWidth: 0 }), "utf8");
2066
- return true;
2067
- }
2068
2016
  if (contentPath.endsWith(".openapi.yaml")) {
2069
2017
  const jsonPath = contentPath.replace(/\.yaml$/, ".json");
2070
2018
  const route = routes.find((route) => route.artifacts?.contentArtifactUrl === jsonPath);
@@ -2124,14 +2072,6 @@ function createContentArtifactsPlugin() {
2124
2072
  fileName: "llms.txt",
2125
2073
  source: createLlmsTxtArtifact(ctx.routes, ctx.projectConfig)
2126
2074
  });
2127
- const rootOpenAPISpec = createRootOpenAPISpec(ctx.routes, ctx.projectConfig);
2128
- assets.push({
2129
- fileName: "openapi.json",
2130
- source: JSON.stringify(rootOpenAPISpec, null, 2)
2131
- }, {
2132
- fileName: "openapi.yml",
2133
- source: stringify(rootOpenAPISpec, { lineWidth: 0 })
2134
- });
2135
2075
  return assets;
2136
2076
  }
2137
2077
  }
@@ -4176,8 +4116,7 @@ var ClarifyEngine = class {
4176
4116
  assertNoContentDiagnostics(this.routes);
4177
4117
  const outputDir = this.runtime.outputDirectory ?? this.generateOptions.outputDirectory;
4178
4118
  if (!outputDir) throw new Error("[clarify] outputDirectory is required before SSG runs");
4179
- const resolvedOutputDir = resolve(this.root, outputDir);
4180
- const ssrOutputDir = createClarifyTempDir("ssr-output");
4119
+ const ssrOutputDir = join(outputDir, ".ssr");
4181
4120
  let tempEntryPath;
4182
4121
  try {
4183
4122
  tempEntryPath = createTempEntryFile(SSR_ENTRY_CODE);
@@ -4188,12 +4127,11 @@ var ClarifyEngine = class {
4188
4127
  plugins: this.runtime.ssrPlugins ?? []
4189
4128
  });
4190
4129
  const ssrBundlePath = join(ssrOutputDir, "entry-server.js");
4191
- await renderSSGRoutes(this.routes, this.runtimeContext(), resolvedOutputDir, ssrBundlePath);
4130
+ await renderSSGRoutes(this.routes, this.runtimeContext(), outputDir, ssrBundlePath);
4192
4131
  } catch (err) {
4193
4132
  console.error("[clarify] SSG failed:", err);
4194
4133
  throw err;
4195
4134
  } finally {
4196
- removeClarifyTempDir(ssrOutputDir);
4197
4135
  if (tempEntryPath) try {
4198
4136
  rmSync(tempEntryPath, { force: true });
4199
4137
  } catch {}
@@ -4236,4 +4174,4 @@ function createClarifyEngine(options = {}) {
4236
4174
  //#endregion
4237
4175
  export { createClarifyTempDir as a, cliPackageVersion as c, createViteAdapter as d, defineConfig as f, findRouteConflicts as i, cliPackageVersionWithCaret as l, createClarifyEngine as n, deserializeSearchIndex as o, createClarifyRuntimeAliases as r, searchMcpIndex as s, ClarifyEngine as t, printCliVersion as u };
4238
4176
 
4239
- //# sourceMappingURL=engine-DMfwsN-k.js.map
4177
+ //# sourceMappingURL=engine-CIhcMyvD.js.map