@clarify-labs/cli 0.10.2 → 0.11.0

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/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_engine = require("./engine-qafLfnXQ.cjs");
2
+ const require_engine = require("./engine-BfkoyVNo.cjs");
3
3
  exports.ClarifyEngine = require_engine.ClarifyEngine;
4
4
  exports.createClarifyEngine = require_engine.createClarifyEngine;
5
5
  exports.createViteAdapter = require_engine.createViteAdapter;
package/output/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { c as defineConfig, n as createClarifyEngine, s as createViteAdapter, t as ClarifyEngine } from "./engine-CSSL_gGd.js";
1
+ import { c as defineConfig, n as createClarifyEngine, s as createViteAdapter, t as ClarifyEngine } from "./engine-DfF5RJjC.js";
2
2
  export { ClarifyEngine, createClarifyEngine, createViteAdapter, defineConfig };
@@ -0,0 +1,12 @@
1
+ import { ContentDiagnostic } from '@clarify-labs/renderer';
2
+ type CreateContentDiagnosticOptions = {
3
+ kind: ContentDiagnostic['kind'];
4
+ title: string;
5
+ message: string;
6
+ error: unknown;
7
+ filePath?: string;
8
+ projectRoot?: string;
9
+ includeStack?: boolean;
10
+ };
11
+ export declare function createContentDiagnostic(options: CreateContentDiagnosticOptions): ContentDiagnostic;
12
+ export {};
@@ -10,6 +10,14 @@ type HastNode = {
10
10
  export declare function rehypeParseCodeBlocks(): (tree: HastNode) => void;
11
11
  export declare const remarkPlugins: unknown[];
12
12
  export declare const rehypePlugins: NonNullable<CompileOptions['rehypePlugins']>;
13
+ type ContentCompileDiagnosticOptions = {
14
+ format: 'markdown' | 'mdx';
15
+ phase: 'syntax' | 'compilation';
16
+ error: unknown;
17
+ filePath?: string;
18
+ projectRoot?: string;
19
+ };
20
+ export declare function createContentCompileDiagnostic(options: ContentCompileDiagnosticOptions): ContentDiagnostic;
13
21
  /**
14
22
  * Validate MDX content for diagnostics WITHOUT running the build-time rehype
15
23
  * pipeline (Shiki highlighting, slug injection, code-block parsing).
@@ -1,4 +1,4 @@
1
- import { ContentRoute, ContentSection, ClarifyNavigationNode, ClarifyPagesConfig, ClarifyPagesGroup, ClarifyPagesItem, ClarifyRouteIntent, ClarifyLocalizedText, ClarifyTabsConfig, LocalizedNavigation, LocalizedTabbedNavigation, ResolvedClarifyI18nConfig, TabbedNavigation } from '../../types.js';
1
+ import { ContentRoute, ContentSection, ClarifyNavigationNode, ClarifyPagesConfig, ClarifyPagesGroup, ClarifyPagesItem, ClarifyRouteIntent, ClarifyLocalizedText, ClarifyTabsConfig, LocalizedNavigation, LocalizedTabbedNavigation, ResolvedClarifyLocalesConfig, TabbedNavigation } from '../../types.js';
2
2
  import { ContentProcessor } from '../content/content.js';
3
3
  export type FindContentRoutesOptions = {
4
4
  contentProcessor?: ContentProcessor;
@@ -12,15 +12,15 @@ export declare function basePathFromRef(ref: string): string;
12
12
  export declare function openAPIPagePathFromRef(ref: string, tagFilter?: string[], explicitPath?: string): string;
13
13
  export declare function routePathFromRef(ref: string, explicitPath?: string): string;
14
14
  export declare function virtualModuleIdFromRef(ref: string): string;
15
- export declare function localizedRoutePath(basePath: string, locale: string, _i18n: ResolvedClarifyI18nConfig): string;
15
+ export declare function localizedRoutePath(basePath: string, locale: string, _i18n: ResolvedClarifyLocalesConfig): string;
16
16
  export declare function resolveLocalizedText(text: ClarifyLocalizedText | undefined, locale: string, fallbackLocale?: string): string | undefined;
17
17
  export declare function findContentRoutes(dir: string, base?: string, options?: FindContentRoutesOptions): Promise<ContentRoute[]>;
18
- export declare function withAlternates(route: ContentRoute, routes: ContentRoute[], i18n: ResolvedClarifyI18nConfig): ContentRoute;
19
- export declare function findLocalizedContentRoutes(contentRoot: string, i18n?: ResolvedClarifyI18nConfig, options?: FindContentRoutesOptions): Promise<ContentRoute[]>;
18
+ export declare function withAlternates(route: ContentRoute, routes: ContentRoute[], locales: ResolvedClarifyLocalesConfig): ContentRoute;
19
+ export declare function findLocalizedContentRoutes(contentRoot: string, locales?: ResolvedClarifyLocalesConfig, options?: FindContentRoutesOptions): Promise<ContentRoute[]>;
20
20
  export declare function buildNavigation(routes: ContentRoute[]): ClarifyNavigationNode[];
21
21
  export declare function routeIntentFromPagesItem(item: ClarifyPagesItem): ClarifyRouteIntent;
22
- export declare function applyConfiguredPageRoutePaths(routes: ContentRoute[], tabs?: ClarifyTabsConfig, i18n?: ResolvedClarifyI18nConfig): ContentRoute[];
22
+ export declare function applyConfiguredPageRoutePaths(routes: ContentRoute[], tabs?: ClarifyTabsConfig, locales?: ResolvedClarifyLocalesConfig): ContentRoute[];
23
23
  export declare function buildNavigationFromTabsConfig(routes: ContentRoute[], tabs: ClarifyTabsConfig): TabbedNavigation;
24
24
  export declare function buildNavigationFromConfig(routes: ContentRoute[], config: ClarifyPagesGroup[]): ClarifyNavigationNode[];
25
- export declare function buildLocalizedNavigation(routes: ContentRoute[], config: ClarifyPagesConfig | undefined, i18n?: ResolvedClarifyI18nConfig): LocalizedNavigation | undefined;
26
- export declare function buildLocalizedNavigationFromTabsConfig(routes: ContentRoute[], tabs: ClarifyTabsConfig, i18n?: ResolvedClarifyI18nConfig): LocalizedTabbedNavigation | undefined;
25
+ export declare function buildLocalizedNavigation(routes: ContentRoute[], config: ClarifyPagesConfig | undefined, localesConfig?: ResolvedClarifyLocalesConfig): LocalizedNavigation | undefined;
26
+ export declare function buildLocalizedNavigationFromTabsConfig(routes: ContentRoute[], tabs: ClarifyTabsConfig, localesConfig?: ResolvedClarifyLocalesConfig): LocalizedTabbedNavigation | undefined;
@@ -1,4 +1,4 @@
1
- import { ContentRoute, ResolvedClarifyI18nConfig } from '../../types.js';
1
+ import { ContentRoute, ResolvedClarifyLocalesConfig } from '../../types.js';
2
2
  type ContentRouteFixture = Partial<Omit<ContentRoute, 'kind' | 'meta' | 'module' | 'source'>> & {
3
3
  kind?: ContentRoute['kind'];
4
4
  title?: string;
@@ -16,5 +16,5 @@ type ContentRouteFixture = Partial<Omit<ContentRoute, 'kind' | 'meta' | 'module'
16
16
  };
17
17
  export declare function contentRoute(route?: ContentRouteFixture): ContentRoute;
18
18
  export declare function mdxRoute(route?: ContentRouteFixture): ContentRoute;
19
- export declare const testI18n: ResolvedClarifyI18nConfig;
19
+ export declare const testI18n: ResolvedClarifyLocalesConfig;
20
20
  export {};
@@ -13,4 +13,4 @@ export declare function normalizeOpenAPISpecSectionIds(spec: OpenAPISpec): OpenA
13
13
  export declare function filterSpecByTags(spec: OpenAPISpec, tags: string[]): OpenAPISpec;
14
14
  /** Extract endpoint operations from an OpenAPI spec as page sections. */
15
15
  export declare function extractOpenAPISections(spec: OpenAPISpec, filterTags?: string[]): ContentSection[];
16
- export declare function readOpenAPISpec(filePath: string, contentProcessor?: ContentProcessor): Promise<OpenAPIParseResult>;
16
+ export declare function readOpenAPISpec(filePath: string, contentProcessor?: ContentProcessor, projectRoot?: string): Promise<OpenAPIParseResult>;
@@ -1,4 +1,4 @@
1
- import { ContentDiagnostic, OpenAPISpec } from '../../types.js';
1
+ import { OpenAPISpec } from '../../types.js';
2
2
  export declare const openApiRegistryModuleId = "virtual:clarify/openapi";
3
3
  export declare const openApiServerRegistryModuleId = "virtual:clarify/openapi/server";
4
4
  export declare const OPENAPI_SPEC_PREFIX = "virtual:clarify/openapi-spec/";
@@ -11,5 +11,4 @@ type OpenAPIPageModuleOptions = {
11
11
  specModuleId: string;
12
12
  };
13
13
  export declare function generateOpenAPIPageModule(opts: OpenAPIPageModuleOptions): string;
14
- export declare function generateOpenAPIErrorModule(diagnostic: ContentDiagnostic): string;
15
14
  export {};
@@ -1,3 +1,3 @@
1
- import { ClarifySourceConfig, ContentRoute } from '../../types.js';
2
- export declare function createSourceEditUrl(filePath: string, contentRoot: string, source: ClarifySourceConfig): string;
3
- export declare function attachSourceEditUrls(routes: ContentRoute[], contentRoot: string, source?: ClarifySourceConfig): void;
1
+ import { ClarifyRepositoryConfig, ContentRoute } from '../../types.js';
2
+ export declare function createSourceEditUrl(filePath: string, contentRoot: string, source: ClarifyRepositoryConfig): string;
3
+ export declare function attachSourceEditUrls(routes: ContentRoute[], contentRoot: string, source?: ClarifyRepositoryConfig): void;
package/output/types.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
2
2
  import { HtmlTagDescriptor, ViteDevServer } from 'vite';
3
- import { UISlotRegistration } from '@clarify-labs/renderer';
3
+ import { ContentDiagnostic, UISlotRegistration } from '@clarify-labs/renderer';
4
4
  import { ResolvedBuildOptions } from './core/config/options.js';
5
5
  export type { ClarifyBuildOptions, ResolvedBuildOptions, } from './core/config/options.js';
6
+ export type { ContentDiagnostic } from '@clarify-labs/renderer';
6
7
  export type OpenAPISpec = OpenAPIV3.Document | OpenAPIV3_1.Document;
7
8
  export type ClarifyLogoConfig = string | {
8
9
  light?: string;
@@ -18,14 +19,16 @@ export type ClarifyLocaleConfig = {
18
19
  label: string;
19
20
  dir?: 'ltr' | 'rtl';
20
21
  };
21
- export type ClarifyI18nConfig = {
22
- /** Default visible locale. Content is read from rootDirectory/defaultLocale. */
23
- defaultLocale?: string;
22
+ export type ClarifyLocalesConfig = {
23
+ /** Default visible locale. Localized content is read from rootDirectory/<locale>. */
24
+ default?: string;
24
25
  /** Missing translation behavior. Fallback uses default locale content. */
25
26
  missing?: 'fallback' | '404' | 'hide';
26
27
  locales: ClarifyLocaleConfig[];
27
28
  };
28
- export type ResolvedClarifyI18nConfig = Required<Pick<ClarifyI18nConfig, 'defaultLocale' | 'missing'>> & {
29
+ export type ResolvedClarifyLocalesConfig = {
30
+ default: string;
31
+ missing: 'fallback' | '404' | 'hide';
29
32
  locales: ClarifyLocaleConfig[];
30
33
  };
31
34
  export type ClarifyNavbarLink = {
@@ -48,10 +51,10 @@ export type ClarifyVariableValue = ClarifyVariablePrimitive | {
48
51
  [key: string]: ClarifyVariableValue;
49
52
  };
50
53
  export type ClarifyVariablesConfig = Record<string, ClarifyVariableValue>;
51
- export type ClarifySourceConfig = {
54
+ export type ClarifyRepositoryConfig = {
52
55
  /** Repository web URL, for example https://github.com/owner/repo. */
53
- repository: string;
54
- /** Source branch used for edit links. Default: main. */
56
+ url?: string;
57
+ /** Source branch. Default: main. */
55
58
  branch?: string;
56
59
  /** Directory prefix inside the repository that maps to rootDirectory. */
57
60
  directory?: string;
@@ -101,8 +104,6 @@ export type ClarifyThemeConfig = {
101
104
  tokens?: ClarifyThemeTokensConfig;
102
105
  /** Documentation layout overrides applied on top of the selected preset. */
103
106
  layout?: ClarifyThemeLayoutConfig;
104
- /** Expose the live theme editor in the built site. Dev mode enables it automatically. */
105
- editor?: boolean;
106
107
  };
107
108
  export type ResolvedClarifyThemeTokensConfig = {
108
109
  colors: Required<ClarifyThemeColorTokensConfig>;
@@ -113,9 +114,8 @@ export type ResolvedClarifyThemeConfig = {
113
114
  preset: ClarifyThemePreset;
114
115
  tokens: ResolvedClarifyThemeTokensConfig;
115
116
  layout: ResolvedClarifyThemeLayoutConfig;
116
- editor: boolean;
117
117
  };
118
- export type ClarifyPagesItem = string | {
118
+ export type ClarifyPagesItem = string | ClarifyPagesGroup | {
119
119
  page: string;
120
120
  /** Explicit route path. Defaults to the path generated from page. */
121
121
  path?: string;
@@ -144,6 +144,7 @@ export type ClarifyPagesGroup = {
144
144
  group: ClarifyLocalizedText;
145
145
  /** Icon name from lucide-react, e.g. "BookOpen". */
146
146
  icon?: string;
147
+ /** Pages or nested groups within this section. */
147
148
  pages: ClarifyPagesItem[];
148
149
  };
149
150
  /** Use the string "FileTree" to auto-generate pages from the file system. */
@@ -173,6 +174,44 @@ export type ClarifyTabItem = {
173
174
  pages?: ClarifyPagesConfig;
174
175
  };
175
176
  export type ClarifyTabsConfig = ClarifyTabItem[];
177
+ export type ClarifyNavigationConfig = {
178
+ /** Links displayed in the top navigation. */
179
+ links?: ClarifyNavbarLink[];
180
+ /** Top-level documentation tabs. Each tab owns its sidebar pages. */
181
+ tabs?: ClarifyTabsConfig;
182
+ };
183
+ export type ClarifyFeatureConfig<Options extends object = Record<never, never>> = boolean | ({
184
+ enabled?: boolean;
185
+ } & Options);
186
+ export type ClarifyFeaturesConfig = {
187
+ search?: ClarifyFeatureConfig<{
188
+ provider?: 'pagefind';
189
+ }>;
190
+ repository?: ClarifyFeatureConfig<ClarifyRepositoryConfig>;
191
+ themeEditor?: ClarifyFeatureConfig;
192
+ openapi?: ClarifyFeatureConfig<{
193
+ playground?: boolean;
194
+ }>;
195
+ };
196
+ export type ResolvedClarifyFeaturesConfig = {
197
+ search: {
198
+ enabled: boolean;
199
+ provider: 'pagefind';
200
+ };
201
+ repository: {
202
+ enabled: boolean;
203
+ url?: string;
204
+ branch?: string;
205
+ directory?: string;
206
+ };
207
+ themeEditor: {
208
+ enabled: boolean;
209
+ };
210
+ openapi: {
211
+ enabled: boolean;
212
+ playground: boolean;
213
+ };
214
+ };
176
215
  export type ClarifyProjectConfig = {
177
216
  /** Site title. Used in Header and SEO meta tags. */
178
217
  title?: string;
@@ -180,54 +219,47 @@ export type ClarifyProjectConfig = {
180
219
  description?: string;
181
220
  /** Canonical public site URL. Enables sitemap.xml and robots.txt generation. */
182
221
  siteUrl?: string;
183
- /** Source repository configuration for Edit this page links. */
184
- source?: ClarifySourceConfig;
222
+ /** Route prefix where the site is mounted. Default: '/'. */
223
+ routePrefix?: string;
224
+ /** Path or URL prefix for emitted assets. Defaults to routePrefix. */
225
+ assetPrefix?: string;
185
226
  /** Path to site logo image (relative to rootDirectory or absolute). Supports light/dark mode. */
186
227
  logo?: ClarifyLogoConfig;
187
228
  /** URL used when clicking the top navigation logo. Defaults to '/'. */
188
229
  homeUrl?: string;
189
230
  /** Favicon path or light/dark variants. */
190
231
  favicon?: ClarifyFaviconConfig;
191
- /** Theme preset, token overrides, and editor options. */
232
+ /** Theme preset, token overrides, and layout options. */
192
233
  theme?: ClarifyThemeConfig;
193
- /** Base path for the docs site. Default: '/' */
194
- routePrefix?: string;
195
- /** Base path or URL for emitted static assets. Defaults to routePrefix. */
196
- assetPrefix?: string;
197
- /** Top navigation links. */
198
- navbar?: {
199
- links?: ClarifyNavbarLink[];
200
- };
234
+ /** Top navigation links and documentation tabs. */
235
+ navigation?: ClarifyNavigationConfig;
201
236
  /** Announcement banner displayed at the top of the page. */
202
237
  banner?: ClarifyBannerConfig;
203
238
  /** Footer configuration. */
204
239
  footer?: ClarifyFooterConfig;
240
+ /** Localized content configuration. */
241
+ locales?: ClarifyLocalesConfig;
205
242
  /** Reusable constants available in supported content via {{ variableName }} placeholders. */
206
243
  variables?: ClarifyVariablesConfig;
207
- /** Native multi-language support. Locale content lives under rootDirectory/{locale}. */
208
- i18n?: ClarifyI18nConfig;
209
- /** Top-level documentation tabs. Each tab owns its own sidebar pages. */
210
- tabs?: ClarifyTabsConfig;
244
+ /** Optional product capabilities. All built-in features are enabled by default. */
245
+ features?: ClarifyFeaturesConfig;
211
246
  };
212
247
  export type ResolvedProjectConfig = {
213
248
  title: string;
214
- logo?: ClarifyLogoConfig;
215
- homeUrl?: string;
216
249
  description: string;
217
250
  siteUrl?: string;
218
- source?: ClarifySourceConfig;
219
251
  routePrefix: string;
220
252
  assetPrefix: string;
253
+ logo?: ClarifyLogoConfig;
254
+ homeUrl?: string;
221
255
  favicon?: ClarifyFaviconConfig;
222
256
  theme: ResolvedClarifyThemeConfig;
223
- navbar?: {
224
- links?: ClarifyNavbarLink[];
225
- };
257
+ navigation?: ClarifyNavigationConfig;
226
258
  banner?: ClarifyBannerConfig;
227
259
  footer?: ClarifyFooterConfig;
260
+ locales?: ResolvedClarifyLocalesConfig;
228
261
  variables: ClarifyVariablesConfig;
229
- i18n?: ResolvedClarifyI18nConfig;
230
- tabs?: ClarifyTabsConfig;
262
+ features: ResolvedClarifyFeaturesConfig;
231
263
  };
232
264
  export type ContentSection = {
233
265
  id: string;
@@ -236,13 +268,6 @@ export type ContentSection = {
236
268
  badge?: string;
237
269
  tags?: string[];
238
270
  };
239
- export type ContentDiagnostic = {
240
- kind: string;
241
- title: string;
242
- message: string;
243
- details?: string;
244
- filePath?: string;
245
- };
246
271
  export type ContentRouteMeta = {
247
272
  title: string;
248
273
  description?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clarify-labs/cli",
3
- "version": "0.10.2",
3
+ "version": "0.11.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "repository": {
@@ -39,8 +39,8 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@apidevtools/swagger-parser": "^12.1.0",
42
- "@clarify-labs/renderer": "0.10.2",
43
- "@clarify-labs/templates": "0.10.2",
42
+ "@clarify-labs/renderer": "0.11.0",
43
+ "@clarify-labs/templates": "0.11.0",
44
44
  "@mdx-js/mdx": "^3.1.1",
45
45
  "@mdx-js/rollup": "^3.1.1",
46
46
  "@shikijs/rehype": "^4.3.0",