@clarify-labs/cli 0.11.14 → 0.11.16

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/output/cli.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const require_engine = require("./engine-CkWY8FUi.cjs");
2
+ const require_engine = require("./engine-Btadz58U.cjs");
3
3
  let node_path = require("node:path");
4
4
  let node_fs_promises = require("node:fs/promises");
5
5
  let node_child_process = require("node:child_process");
package/output/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as createClarifyTempDir, c as cliPackageVersion, d as createViteAdapter, i as findRouteConflicts, l as cliPackageVersionWithCaret, n as createClarifyEngine, o as deserializeSearchIndex, r as createClarifyRuntimeAliases, s as searchMcpIndex, u as printCliVersion } from "./engine-Cfo7Ncux.js";
2
+ import { a as createClarifyTempDir, c as cliPackageVersion, d as createViteAdapter, i as findRouteConflicts, l as cliPackageVersionWithCaret, n as createClarifyEngine, o as deserializeSearchIndex, r as createClarifyRuntimeAliases, s as searchMcpIndex, u as printCliVersion } from "./engine-KIi5G_-d.js";
3
3
  import { dirname, extname, isAbsolute, join, normalize, relative, resolve } from "node:path";
4
4
  import { lstat, mkdir, readFile, stat, writeFile } from "node:fs/promises";
5
5
  import { spawnSync } from "node:child_process";
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { ClarifyNavbarMenuItem, ClarifyPagesGroup, ClarifyVariableValue } from '../../types.js';
2
+ import { ClarifyNavbarMenuItem, ClarifyVariableValue } from '../../types.js';
3
3
  export declare const clarifyFeaturesConfigSchema: z.ZodObject<{
4
4
  search: z.ZodPipe<z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodDefault<z.ZodObject<{
5
5
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -130,7 +130,7 @@ export declare const clarifyProjectConfigSchema: z.ZodObject<{
130
130
  tabs: z.ZodOptional<z.ZodArray<z.ZodObject<{
131
131
  tab: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
132
132
  icon: z.ZodOptional<z.ZodString>;
133
- pages: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodType<ClarifyPagesGroup, ClarifyPagesGroup, z.core.$ZodTypeInternals<ClarifyPagesGroup, ClarifyPagesGroup>>>, z.ZodLiteral<"FileTree">]>>;
133
+ pages: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodType<import('../../types.js').ClarifyPagesGroup, import('../../types.js').ClarifyPagesGroup, z.core.$ZodTypeInternals<import('../../types.js').ClarifyPagesGroup, import('../../types.js').ClarifyPagesGroup>>>, z.ZodLiteral<"FileTree">]>>;
134
134
  }, z.core.$strict>>>;
135
135
  }, z.core.$strict>>;
136
136
  banner: z.ZodOptional<z.ZodObject<{
@@ -1149,19 +1149,12 @@ var clarifyPagesItemSchema = zod.z.lazy(() => zod.z.union([
1149
1149
  filter: zod.z.object({ tags: zod.z.array(zod.z.string()).optional() }).strict().optional()
1150
1150
  }).strict()
1151
1151
  ]));
1152
- var clarifyPagesGroupShape = {
1152
+ var clarifyPagesGroupSchema = zod.z.lazy(() => zod.z.object({
1153
1153
  group: clarifyLocalizedTextSchema,
1154
1154
  icon: zod.z.string().optional(),
1155
- visible: zod.z.enum([
1156
- "always",
1157
- "active",
1158
- "never"
1159
- ]).optional(),
1160
- searchable: zod.z.boolean().optional(),
1161
1155
  layout: zod.z.enum(["documentation", "blog"]).optional(),
1162
1156
  pages: zod.z.array(clarifyPagesItemSchema)
1163
- };
1164
- var clarifyPagesGroupSchema = zod.z.lazy(() => zod.z.object(clarifyPagesGroupShape).strict());
1157
+ }).strict());
1165
1158
  var clarifyPagesConfigSchema = zod.z.union([zod.z.array(clarifyPagesGroupSchema), zod.z.literal("FileTree")]);
1166
1159
  var clarifyTabItemSchema = zod.z.object({
1167
1160
  tab: clarifyLocalizedTextSchema,
@@ -1820,7 +1813,7 @@ function createViteAdapter(engine) {
1820
1813
  }
1821
1814
  var cliPackageVersion = {
1822
1815
  name: "@clarify-labs/cli",
1823
- version: "0.11.14",
1816
+ version: "0.11.16",
1824
1817
  license: "AGPL-3.0-only",
1825
1818
  type: "module",
1826
1819
  repository: {
@@ -1946,49 +1939,6 @@ function readRouteArtifactContent(route) {
1946
1939
  const content = readRouteContent(route);
1947
1940
  return shouldUseUtf8Signature(route) ? withUtf8Signature(content) : content;
1948
1941
  }
1949
- function mergeOpenAPIRecord(target, source, section, filePath) {
1950
- if (!source) return;
1951
- for (const [key, value] of Object.entries(source)) {
1952
- const existing = target[key];
1953
- if (existing !== void 0 && JSON.stringify(existing) !== JSON.stringify(value)) throw new Error(`[clarify] Cannot aggregate OpenAPI specs: conflicting ${section} entry "${key}" in ${filePath}.`);
1954
- target[key] = value;
1955
- }
1956
- }
1957
- function createRootOpenAPISpec(routes, projectConfig) {
1958
- const paths = {};
1959
- const webhooks = {};
1960
- const components = {};
1961
- const tags = /* @__PURE__ */ new Map();
1962
- const defaultLocale = projectConfig.locales?.default;
1963
- for (const route of routes) {
1964
- if (route.kind !== "openapi" || route.diagnostic || !route.source.content || defaultLocale && route.locale && route.locale !== defaultLocale) continue;
1965
- const filePath = route.source.filePath;
1966
- const spec = JSON.parse(route.source.content);
1967
- mergeOpenAPIRecord(paths, spec.paths, "paths", filePath);
1968
- mergeOpenAPIRecord(webhooks, "webhooks" in spec ? spec.webhooks : void 0, "webhooks", filePath);
1969
- for (const [section, entries] of Object.entries(spec.components ?? {})) {
1970
- components[section] ??= {};
1971
- mergeOpenAPIRecord(components[section], entries, `components.${section}`, filePath);
1972
- }
1973
- for (const tag of spec.tags ?? []) {
1974
- const existing = tags.get(tag.name);
1975
- if (existing !== void 0 && JSON.stringify(existing) !== JSON.stringify(tag)) throw new Error(`[clarify] Cannot aggregate OpenAPI specs: conflicting tag "${tag.name}" in ${filePath}.`);
1976
- tags.set(tag.name, tag);
1977
- }
1978
- }
1979
- return {
1980
- openapi: "3.1.0",
1981
- info: {
1982
- title: projectConfig.title,
1983
- description: projectConfig.description,
1984
- version: "1.0.0"
1985
- },
1986
- paths,
1987
- ...Object.keys(webhooks).length > 0 ? { webhooks } : {},
1988
- ...Object.keys(components).length > 0 ? { components } : {},
1989
- ...tags.size > 0 ? { tags: [...tags.values()] } : {}
1990
- };
1991
- }
1992
1942
  function isLlmsTxtRoute(route) {
1993
1943
  return !route.path.split("/").includes("404");
1994
1944
  }
@@ -2088,14 +2038,6 @@ function serveContentArtifacts(req, res, projectConfig, routes) {
2088
2038
  res.end(createLlmsTxtArtifact(routes, projectConfig), "utf8");
2089
2039
  return true;
2090
2040
  }
2091
- if (contentPath === "/openapi.json" || contentPath === "/openapi.yml") {
2092
- const spec = createRootOpenAPISpec(routes, projectConfig);
2093
- const isJson = contentPath.endsWith(".json");
2094
- res.statusCode = 200;
2095
- res.setHeader("Content-Type", isJson ? "application/json; charset=utf-8" : "text/yaml; charset=utf-8");
2096
- res.end(isJson ? JSON.stringify(spec, null, 2) : (0, yaml.stringify)(spec, { lineWidth: 0 }), "utf8");
2097
- return true;
2098
- }
2099
2041
  if (contentPath.endsWith(".openapi.yaml")) {
2100
2042
  const jsonPath = contentPath.replace(/\.yaml$/, ".json");
2101
2043
  const route = routes.find((route) => route.artifacts?.contentArtifactUrl === jsonPath);
@@ -2155,14 +2097,6 @@ function createContentArtifactsPlugin() {
2155
2097
  fileName: "llms.txt",
2156
2098
  source: createLlmsTxtArtifact(ctx.routes, ctx.projectConfig)
2157
2099
  });
2158
- const rootOpenAPISpec = createRootOpenAPISpec(ctx.routes, ctx.projectConfig);
2159
- assets.push({
2160
- fileName: "openapi.json",
2161
- source: JSON.stringify(rootOpenAPISpec, null, 2)
2162
- }, {
2163
- fileName: "openapi.yml",
2164
- source: (0, yaml.stringify)(rootOpenAPISpec, { lineWidth: 0 })
2165
- });
2166
2100
  return assets;
2167
2101
  }
2168
2102
  }
@@ -4207,7 +4141,7 @@ var ClarifyEngine = class {
4207
4141
  assertNoContentDiagnostics(this.routes);
4208
4142
  const outputDir = this.runtime.outputDirectory ?? this.generateOptions.outputDirectory;
4209
4143
  if (!outputDir) throw new Error("[clarify] outputDirectory is required before SSG runs");
4210
- const ssrOutputDir = createClarifyTempDir("ssr-output");
4144
+ const ssrOutputDir = (0, node_path.join)(outputDir, ".ssr");
4211
4145
  let tempEntryPath;
4212
4146
  try {
4213
4147
  tempEntryPath = createTempEntryFile(SSR_ENTRY_CODE);
@@ -4223,7 +4157,6 @@ var ClarifyEngine = class {
4223
4157
  console.error("[clarify] SSG failed:", err);
4224
4158
  throw err;
4225
4159
  } finally {
4226
- removeClarifyTempDir(ssrOutputDir);
4227
4160
  if (tempEntryPath) try {
4228
4161
  (0, node_fs.rmSync)(tempEntryPath, { force: true });
4229
4162
  } catch {}
@@ -4337,4 +4270,4 @@ Object.defineProperty(exports, "searchMcpIndex", {
4337
4270
  }
4338
4271
  });
4339
4272
 
4340
- //# sourceMappingURL=engine-CkWY8FUi.cjs.map
4273
+ //# sourceMappingURL=engine-Btadz58U.cjs.map