@clarify-labs/cli 0.11.18 → 0.11.20

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-CNnlt59g.cjs");
2
+ const require_engine = require("./engine-CAis1rme.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 { d as createViteAdapter, f as defineConfig, n as createClarifyEngine, t as ClarifyEngine } from "./engine-DeA6EGHW.js";
1
+ import { d as createViteAdapter, f as defineConfig, n as createClarifyEngine, t as ClarifyEngine } from "./engine-BgfGFPKK.js";
2
2
  export { ClarifyEngine, createClarifyEngine, createViteAdapter, defineConfig };
@@ -2,6 +2,7 @@ import { ClarifyContentKind, ClarifyContentTransformInput, ClarifyHookContext, C
2
2
  export type ProcessedMdxContent = {
3
3
  frontmatter: Record<string, unknown>;
4
4
  content: string;
5
+ lineOffset: number;
5
6
  };
6
7
  export type ContentTransform = (input: ClarifyContentTransformInput) => Promise<ClarifyContentTransformInput> | ClarifyContentTransformInput;
7
8
  export type ContentProcessor = {
@@ -1,6 +1,7 @@
1
1
  export type ParsedFrontmatter = {
2
2
  frontmatter: Record<string, unknown>;
3
3
  content: string;
4
+ lineOffset: number;
4
5
  };
5
6
  /**
6
7
  * 在内容入口统一解析 MDX frontmatter,并返回可供后续流程复用的标准化正文。
@@ -0,0 +1,24 @@
1
+ import { ContentDiagnostic } from '../../types.js';
2
+ export declare const HEADING_ID_PATTERN: RegExp;
3
+ export type AnalyzedHeading = {
4
+ level: 1 | 2 | 3 | 4 | 5 | 6;
5
+ title: string;
6
+ id: string;
7
+ position: {
8
+ line: number;
9
+ column: number;
10
+ };
11
+ };
12
+ export type AnalyzeHeadingsOptions = {
13
+ kind: 'markdown' | 'markdown+jsx';
14
+ filePath?: string;
15
+ projectRoot?: string;
16
+ lineOffset?: number;
17
+ };
18
+ export type HeadingAnalysis = {
19
+ headings: AnalyzedHeading[];
20
+ normalizedContent: string;
21
+ diagnostic?: ContentDiagnostic;
22
+ };
23
+ export declare function analyzeHeadings(content: string, options: AnalyzeHeadingsOptions): HeadingAnalysis;
24
+ export declare function remarkApplyHeadingIds(): (tree: unknown) => void;
@@ -8,6 +8,7 @@ type HastNode = {
8
8
  children?: HastNode[];
9
9
  };
10
10
  export declare function rehypeParseCodeBlocks(): (tree: HastNode) => void;
11
+ export declare function rehypeAddMissingHeadingIds(): (tree: HastNode) => void;
11
12
  export declare const remarkPlugins: unknown[];
12
13
  export declare const rehypePlugins: NonNullable<CompileOptions['rehypePlugins']>;
13
14
  type ContentCompileDiagnosticOptions = {
@@ -0,0 +1,7 @@
1
+ import { ContentRoute } from '../../types.js';
2
+ import { analyzeHeadings } from '../markdown/headings.js';
3
+ type HeadingAnalysis = ReturnType<typeof analyzeHeadings>;
4
+ export declare function kebabToTitle(str: string): string;
5
+ export declare function headingMetadata(analysis: HeadingAnalysis): Pick<ContentRoute['meta'], 'sections'>;
6
+ export declare function reanalyzeMarkdownRoute(route: ContentRoute, projectRoot: string): Promise<ContentRoute>;
7
+ export {};
@@ -1,9 +1,10 @@
1
1
  import { ContentRoute, ClarifyNavigationNode, ClarifyPagesConfig, ClarifyPagesGroup, ClarifyPagesItem, ClarifyRouteIntent, ClarifyTabsConfig, LocalizedNavigation, LocalizedTabbedNavigation, MarkdownContentRoute, ResolvedClarifyLocalesConfig, TabbedNavigation } from '../../types.js';
2
2
  import { ContentProcessor } from '../content/content.js';
3
+ import { kebabToTitle } from './heading-metadata.js';
3
4
  export type FindContentRoutesOptions = {
4
5
  contentProcessor?: ContentProcessor;
5
6
  };
6
- export declare function kebabToTitle(str: string): string;
7
+ export { kebabToTitle };
7
8
  export declare function normalizePath(path: string): string;
8
9
  export declare function basePathFromRef(ref: string): string;
9
10
  export declare function openAPIPagePathFromRef(ref: string, tagFilter?: string[], explicitPath?: string): string;
@@ -0,0 +1,3 @@
1
+ import { ClarifyArtifact, ContentRoute, ResolvedProjectConfig } from '../../types.js';
2
+ export declare function createContentArtifacts(routes: ContentRoute[], projectConfig: ResolvedProjectConfig): ClarifyArtifact[];
3
+ export declare function findContentArtifact(path: string, routes: ContentRoute[], projectConfig: ResolvedProjectConfig): ClarifyArtifact | undefined;
@@ -0,0 +1,12 @@
1
+ import { OpenAPISpec } from '../../types.js';
2
+ export type OpenAPISourceDocument = {
3
+ id: string;
4
+ filePath: string;
5
+ document: OpenAPISpec;
6
+ };
7
+ export type OpenAPIAggregationInfo = {
8
+ title: string;
9
+ description: string;
10
+ version?: string;
11
+ };
12
+ export declare function aggregateOpenAPISources(sources: OpenAPISourceDocument[], info: OpenAPIAggregationInfo): OpenAPISpec;
@@ -0,0 +1,6 @@
1
+ import { ClarifyArtifact, ContentRoute, OpenAPISpec, ResolvedProjectConfig } from '../../types.js';
2
+ import { OpenAPISourceDocument } from './aggregation.js';
3
+ export declare function selectRootOpenAPISources(routes: ContentRoute[], projectConfig: ResolvedProjectConfig): OpenAPISourceDocument[];
4
+ export declare function createRootOpenAPISpec(routes: ContentRoute[], projectConfig: ResolvedProjectConfig): OpenAPISpec;
5
+ export declare function createOpenAPIRouteArtifacts(route: ContentRoute): ClarifyArtifact[];
6
+ export declare function createRootOpenAPIArtifact(routes: ContentRoute[], projectConfig: ResolvedProjectConfig): ClarifyArtifact;
@@ -12,5 +12,5 @@ export declare function normalizeOpenAPISpecSectionIds(spec: OpenAPISpec): OpenA
12
12
  /** Filter an OpenAPI spec to only include paths that have at least one operation matching the given tags. */
13
13
  export declare function filterSpecByTags(spec: OpenAPISpec, tags: string[]): OpenAPISpec;
14
14
  /** Extract endpoint operations from an OpenAPI spec as page sections. */
15
- export declare function extractOpenAPISections(spec: OpenAPISpec, filterTags?: string[]): ContentSection[];
15
+ export declare function extractOpenAPISections(spec: OpenAPISpec, filterTags?: string[], operationOrder?: string[]): ContentSection[];
16
16
  export declare function readOpenAPISpec(filePath: string, contentProcessor?: ContentProcessor, projectRoot?: string): Promise<OpenAPIParseResult>;
@@ -8,6 +8,7 @@ export declare function generateOpenAPIServerRegistryModule(openApiSpecs: Record
8
8
  export declare function generateOpenAPISpecModule(spec: OpenAPISpec): string;
9
9
  type OpenAPIPageModuleOptions = {
10
10
  specModuleId: string;
11
+ operationOrder?: string[];
11
12
  };
12
13
  export declare function generateOpenAPIPageModule(opts: OpenAPIPageModuleOptions): string;
13
14
  export {};
package/output/types.d.ts CHANGED
@@ -146,6 +146,8 @@ export type ClarifyPagesItem = string | ClarifyPagesGroup | {
146
146
  openapi: string;
147
147
  /** Explicit route path. Defaults to the path generated from openapi and filter. */
148
148
  path?: string;
149
+ /** Operation IDs to render first, in the configured order. Unlisted operations keep their stable order after these. */
150
+ operationOrder?: string[];
149
151
  /** Icon name from lucide-react, e.g. "Webhook". */
150
152
  icon?: string;
151
153
  /** Override the page title. Defaults to spec.info.title. */
@@ -183,6 +185,7 @@ export type ClarifyOpenAPIRouteIntent = {
183
185
  kind: 'openapi';
184
186
  ref: string;
185
187
  path?: string;
188
+ operationOrder?: string[];
186
189
  tagFilter?: string[];
187
190
  title?: ClarifyLocalizedText;
188
191
  icon?: string;
@@ -319,6 +322,8 @@ export type ContentRouteModule = MarkdownRouteModule | OpenAPIRouteModule;
319
322
  export type OpenAPIContentRouteState = {
320
323
  /** Operation tag filter applied to this route. Undefined means all operations. */
321
324
  tagFilter?: string[];
325
+ /** Operation IDs to render first, in the configured order. */
326
+ operationOrder?: string[];
322
327
  /** Deduplicated id derived from the source OpenAPI spec file path. */
323
328
  sourceSpecId?: string;
324
329
  /** Spec virtual module id fragment used by this route after route-level filtering. */
@@ -331,8 +336,10 @@ export type ContentRouteArtifacts = {
331
336
  export type ContentRouteSource = {
332
337
  filePath: string;
333
338
  frontmatter?: Record<string, unknown>;
334
- /** Normalized source content captured during route discovery. */
339
+ /** Original author content captured during route discovery. */
335
340
  content?: string;
341
+ /** Number of physical source lines removed before the stored body content. */
342
+ lineOffset?: number;
336
343
  /** Public edit URL for this route's source file. */
337
344
  sourceEditUrl?: string;
338
345
  };
@@ -455,6 +462,10 @@ export type ClarifyEmitAsset = {
455
462
  /** Asset content as a UTF-8 string or raw bytes. */
456
463
  source: string | Uint8Array;
457
464
  };
465
+ export type ClarifyArtifact = ClarifyEmitAsset & {
466
+ /** MIME type used when the artifact is served in development. */
467
+ contentType: string;
468
+ };
458
469
  export type MaybePromise<T> = T | Promise<T>;
459
470
  export type ClarifyTapHook = (ctx: ClarifyHookContext) => MaybePromise<void>;
460
471
  export type ClarifyInterceptHook = (ctx: ClarifyHookContext) => MaybePromise<boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clarify-labs/cli",
3
- "version": "0.11.18",
3
+ "version": "0.11.20",
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.11.18",
43
- "@clarify-labs/templates": "0.11.18",
42
+ "@clarify-labs/renderer": "0.11.20",
43
+ "@clarify-labs/templates": "0.11.20",
44
44
  "@mdx-js/mdx": "^3.1.1",
45
45
  "@mdx-js/rollup": "^3.1.1",
46
46
  "@modelcontextprotocol/sdk": "^1.29.0",