@clarify-labs/cli 0.11.19 → 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-0ROqtF4o.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-DH8Hi6Fr.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;
package/output/types.d.ts CHANGED
@@ -336,8 +336,10 @@ export type ContentRouteArtifacts = {
336
336
  export type ContentRouteSource = {
337
337
  filePath: string;
338
338
  frontmatter?: Record<string, unknown>;
339
- /** Normalized source content captured during route discovery. */
339
+ /** Original author content captured during route discovery. */
340
340
  content?: string;
341
+ /** Number of physical source lines removed before the stored body content. */
342
+ lineOffset?: number;
341
343
  /** Public edit URL for this route's source file. */
342
344
  sourceEditUrl?: string;
343
345
  };
@@ -460,6 +462,10 @@ export type ClarifyEmitAsset = {
460
462
  /** Asset content as a UTF-8 string or raw bytes. */
461
463
  source: string | Uint8Array;
462
464
  };
465
+ export type ClarifyArtifact = ClarifyEmitAsset & {
466
+ /** MIME type used when the artifact is served in development. */
467
+ contentType: string;
468
+ };
463
469
  export type MaybePromise<T> = T | Promise<T>;
464
470
  export type ClarifyTapHook = (ctx: ClarifyHookContext) => MaybePromise<void>;
465
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.19",
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.19",
43
- "@clarify-labs/templates": "0.11.19",
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",