@clarify-labs/cli 0.11.2 → 0.11.4

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--5unu78V.cjs");
2
+ const require_engine = require("./engine-Cgc71w13.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 { l as createViteAdapter, n as createClarifyEngine, t as ClarifyEngine, u as defineConfig } from "./engine-DI8Nd3v0.js";
1
+ import { l as createViteAdapter, n as createClarifyEngine, t as ClarifyEngine, u as defineConfig } from "./engine-CJmXVTo5.js";
2
2
  export { ClarifyEngine, createClarifyEngine, createViteAdapter, defineConfig };
@@ -0,0 +1,34 @@
1
+ import { ContentDiagnostic } from '../../types.js';
2
+ type CompileMarkdownContentOptions = {
3
+ filePath?: string;
4
+ projectRoot?: string;
5
+ };
6
+ /**
7
+ * Validate Markdown content for diagnostics WITHOUT running the build-time
8
+ * rehype pipeline (Shiki highlighting, slug injection, code-block parsing).
9
+ *
10
+ * `rehypePlugins` includes `rehypeShiki`, which loads grammar/WASM assets and
11
+ * is expensive. The real highlighting happens at Vite build time via the
12
+ * `@mdx-js/rollup` plugin (see `createContentCompilerPlugin` in
13
+ * `core/adapters.ts`), which runs the full remark + rehype pipeline.
14
+ * Re-running it here, during route discovery (Phase 3), would compile every
15
+ * `.md` file twice and invoke Shiki once per file per `engine.refresh()` -
16
+ * see ARCHITECTURE.md §2.2 which states "不应在 core 中执行代码高亮".
17
+ *
18
+ * `format: 'md'` mirrors the adapter's markdown compiler semantics (no JSX,
19
+ * raw HTML allowed via `remarkRehypeOptions`), so the same class of syntax
20
+ * errors that would break the Vite build is surfaced as a diagnostic here
21
+ * instead of leaking out as an opaque
22
+ * `Failed to fetch dynamically imported module` at runtime.
23
+ *
24
+ * MDX files are handled by `compileMdxContent` in `mdx.ts`. Keep the two
25
+ * compilers separate so each format can evolve its own diagnostic rules
26
+ * without contaminating the other.
27
+ */
28
+ export declare function compileMarkdownContent(content: string, options?: CompileMarkdownContentOptions): Promise<{
29
+ ok: true;
30
+ } | {
31
+ ok: false;
32
+ diagnostic: ContentDiagnostic;
33
+ }>;
34
+ export {};
@@ -18,25 +18,33 @@ type ContentCompileDiagnosticOptions = {
18
18
  projectRoot?: string;
19
19
  };
20
20
  export declare function createContentCompileDiagnostic(options: ContentCompileDiagnosticOptions): ContentDiagnostic;
21
+ type CompileContentOptions = {
22
+ filePath?: string;
23
+ projectRoot?: string;
24
+ };
21
25
  /**
22
26
  * Validate MDX content for diagnostics WITHOUT running the build-time rehype
23
27
  * pipeline (Shiki highlighting, slug injection, code-block parsing).
24
28
  *
25
29
  * `rehypePlugins` includes `rehypeShiki`, which loads grammar/WASM assets and
26
30
  * is expensive. The real highlighting happens at Vite build time via the
27
- * `@mdx-js/rollup` plugins (see `createMarkdownPlugin` and `createMdxPlugin`
28
- * in `core/adapters.ts`), which
29
- * runs the full remark + rehype pipeline. Re-running it here, during route
30
- * discovery (Phase 3), would compile every `.mdx` file twice and invoke Shiki
31
- * once per file per `engine.refresh()` — see ARCHITECTURE.md §2.2 which states
32
- * "不应在 core 中执行代码高亮".
31
+ * `@mdx-js/rollup` plugin (see `createContentCompilerPlugin` in
32
+ * `core/adapters.ts`), which runs the full remark + rehype pipeline.
33
+ * Re-running it here, during route discovery (Phase 3), would compile every
34
+ * `.mdx` file twice and invoke Shiki once per file per `engine.refresh()` -
35
+ * see ARCHITECTURE.md §2.2 which states "不应在 core 中执行代码高亮".
33
36
  *
34
37
  * The remark pipeline still runs (shared with the Vite plugin via
35
- * `remarkPlugins`), so MDX/JSX syntax errors — the only class of error this
36
- * diagnostic is meant to surface ahead of the Vite build — are caught. The
38
+ * `remarkPlugins`), so MDX/JSX syntax errors - the only class of error this
39
+ * diagnostic is meant to surface ahead of the Vite build - are caught. The
37
40
  * output is discarded; only the thrown error is used.
41
+ *
42
+ * `.md` files are handled by `compileMarkdownContent` in `markdown.ts`, which
43
+ * mirrors the adapter's markdown compiler semantics (`format: 'md'`, raw HTML
44
+ * allowed). Keep the two compilers separate so each format can evolve its own
45
+ * diagnostic rules without contaminating the other.
38
46
  */
39
- export declare function compileMdxContent(content: string, filePath?: string, projectRoot?: string): Promise<{
47
+ export declare function compileMdxContent(content: string, options?: CompileContentOptions): Promise<{
40
48
  ok: true;
41
49
  } | {
42
50
  ok: false;
@@ -127,15 +127,16 @@ export type McpSearchResult = {
127
127
  */
128
128
  export declare function searchMcpIndex(db: McpSearchDb, params: McpSearchParams): McpSearchResult;
129
129
  /**
130
- * Serialize an Orama index to a msgpack binary buffer.
130
+ * Serialize an Orama index to a versioned, Brotli-compressed binary buffer.
131
131
  *
132
- * Uses `save()` to extract the raw index data, then msgpack-encodes it for a
133
- * compact binary representation. The same schema + tokenizer must be supplied
134
- * when loading so query-time tokenization matches indexing-time tokenization.
132
+ * Uses `save()` to extract the raw index data, MessagePack-encodes it, then
133
+ * compresses the payload so source documents are not embedded as contiguous
134
+ * plaintext. The leading magic bytes identify the container and its version.
135
135
  */
136
136
  export declare function serializeSearchIndex(db: McpSearchDb): Uint8Array;
137
137
  /**
138
- * Deserialize a msgpack binary buffer into a ready-to-search Orama index.
138
+ * Deserialize a current compressed container or legacy MessagePack buffer
139
+ * into a ready-to-search Orama index.
139
140
  *
140
141
  * The caller must supply the same `defaultLocale` used when the index was
141
142
  * built, so the tokenizer matches. A mismatch would not corrupt data but
@@ -144,10 +145,10 @@ export declare function serializeSearchIndex(db: McpSearchDb): Uint8Array;
144
145
  */
145
146
  export declare function deserializeSearchIndex(buffer: Uint8Array, defaultLocale?: string): McpSearchDb;
146
147
  /**
147
- * Write an Orama index to a `.msp` (msgpack) file on disk.
148
+ * Write an Orama index to a versioned `.msp` file on disk.
148
149
  */
149
150
  export declare function writeSearchIndex(db: McpSearchDb, filePath: string): void;
150
151
  /**
151
- * Read an Orama index from a `.msp` (msgpack) file on disk.
152
+ * Read a current or legacy Orama `.msp` index from disk.
152
153
  */
153
154
  export declare function readSearchIndex(filePath: string, defaultLocale?: string): McpSearchDb;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clarify-labs/cli",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
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.2",
43
- "@clarify-labs/templates": "0.11.2",
42
+ "@clarify-labs/renderer": "0.11.4",
43
+ "@clarify-labs/templates": "0.11.4",
44
44
  "@mdx-js/mdx": "^3.1.1",
45
45
  "@mdx-js/rollup": "^3.1.1",
46
46
  "@modelcontextprotocol/sdk": "^1.29.0",