@clarify-labs/cli 0.10.3 → 0.11.1
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/commands/mcp.d.ts +27 -0
- package/output/cli/mcp/orama-loader.d.ts +56 -0
- package/output/cli/mcp/search-server.d.ts +34 -0
- package/output/cli/program.d.ts +0 -1
- package/output/cli.cjs +294 -13
- package/output/cli.cjs.map +1 -1
- package/output/cli.js +295 -14
- package/output/cli.js.map +1 -1
- package/output/core/config/config-schema.d.ts +138 -253
- package/output/core/config/config.d.ts +2 -1
- package/output/core/config/options.d.ts +0 -8
- package/output/core/config/user-config.d.ts +4 -3
- package/output/core/plugin/hooks.d.ts +0 -1
- package/output/core/project/project-info.d.ts +3 -3
- package/output/core/runtime/html-template.d.ts +0 -6
- package/output/core/runtime/ssg.d.ts +1 -1
- package/output/core/runtime/virtual-modules.d.ts +1 -5
- package/output/{engine-BDdPszs2.cjs → engine-Cbn_coqg.cjs} +569 -170
- package/output/engine-Cbn_coqg.cjs.map +1 -0
- package/output/{engine-CyFtr8Pz.js → engine-CxnKEKv8.js} +558 -171
- package/output/engine-CxnKEKv8.js.map +1 -0
- package/output/index.cjs +1 -1
- package/output/index.js +1 -1
- package/output/parsers/routes/routes.d.ts +7 -11
- package/output/parsers/routes/routes.test-utils.d.ts +2 -2
- package/output/plugins/content-artifacts/artifacts.d.ts +0 -2
- package/output/plugins/mcp-search/index.d.ts +15 -0
- package/output/plugins/mcp-search/mcp-config.d.ts +72 -0
- package/output/plugins/mcp-search/orama-index.d.ts +153 -0
- package/output/plugins/openapi/virtual-modules.d.ts +0 -1
- package/output/plugins/page-search/index.d.ts +2 -0
- package/output/plugins/source-links/source-links.d.ts +3 -3
- package/output/types.d.ts +64 -33
- package/package.json +6 -4
- package/output/engine-BDdPszs2.cjs.map +0 -1
- package/output/engine-CyFtr8Pz.js.map +0 -1
- package/output/plugins/search-index/index.d.ts +0 -2
- /package/output/plugins/{search-index → page-search}/search-language.d.ts +0 -0
package/output/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_engine = require("./engine-
|
|
2
|
+
const require_engine = require("./engine-Cbn_coqg.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 {
|
|
1
|
+
import { l as createViteAdapter, n as createClarifyEngine, t as ClarifyEngine, u as defineConfig } from "./engine-CxnKEKv8.js";
|
|
2
2
|
export { ClarifyEngine, createClarifyEngine, createViteAdapter, defineConfig };
|
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
import { ContentRoute,
|
|
1
|
+
import { ContentRoute, ClarifyNavigationNode, ClarifyPagesConfig, ClarifyPagesGroup, ClarifyPagesItem, ClarifyRouteIntent, 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;
|
|
5
5
|
};
|
|
6
6
|
export declare function kebabToTitle(str: string): string;
|
|
7
|
-
/** 从 MDX/Markdown 内容中提取 H2/H3 章节 */
|
|
8
|
-
export declare function extractMdxSections(content: string): ContentSection[];
|
|
9
7
|
export declare function normalizePath(path: string): string;
|
|
10
|
-
export declare function openAPITagsPathSegment(tags: string[]): string;
|
|
11
8
|
export declare function basePathFromRef(ref: string): string;
|
|
12
9
|
export declare function openAPIPagePathFromRef(ref: string, tagFilter?: string[], explicitPath?: string): string;
|
|
13
10
|
export declare function routePathFromRef(ref: string, explicitPath?: string): string;
|
|
14
11
|
export declare function virtualModuleIdFromRef(ref: string): string;
|
|
15
|
-
export declare function localizedRoutePath(basePath: string, locale: string, _i18n:
|
|
16
|
-
export declare function resolveLocalizedText(text: ClarifyLocalizedText | undefined, locale: string, fallbackLocale?: string): string | undefined;
|
|
12
|
+
export declare function localizedRoutePath(basePath: string, locale: string, _i18n: ResolvedClarifyLocalesConfig): string;
|
|
17
13
|
export declare function findContentRoutes(dir: string, base?: string, options?: FindContentRoutesOptions): Promise<ContentRoute[]>;
|
|
18
|
-
export declare function withAlternates(route: ContentRoute, routes: ContentRoute[],
|
|
19
|
-
export declare function findLocalizedContentRoutes(contentRoot: string,
|
|
14
|
+
export declare function withAlternates(route: ContentRoute, routes: ContentRoute[], locales: ResolvedClarifyLocalesConfig): ContentRoute;
|
|
15
|
+
export declare function findLocalizedContentRoutes(contentRoot: string, locales?: ResolvedClarifyLocalesConfig, options?: FindContentRoutesOptions): Promise<ContentRoute[]>;
|
|
20
16
|
export declare function buildNavigation(routes: ContentRoute[]): ClarifyNavigationNode[];
|
|
21
17
|
export declare function routeIntentFromPagesItem(item: ClarifyPagesItem): ClarifyRouteIntent;
|
|
22
|
-
export declare function applyConfiguredPageRoutePaths(routes: ContentRoute[], tabs?: ClarifyTabsConfig,
|
|
18
|
+
export declare function applyConfiguredPageRoutePaths(routes: ContentRoute[], tabs?: ClarifyTabsConfig, locales?: ResolvedClarifyLocalesConfig): ContentRoute[];
|
|
23
19
|
export declare function buildNavigationFromTabsConfig(routes: ContentRoute[], tabs: ClarifyTabsConfig): TabbedNavigation;
|
|
24
20
|
export declare function buildNavigationFromConfig(routes: ContentRoute[], config: ClarifyPagesGroup[]): ClarifyNavigationNode[];
|
|
25
|
-
export declare function buildLocalizedNavigation(routes: ContentRoute[], config: ClarifyPagesConfig | undefined,
|
|
26
|
-
export declare function buildLocalizedNavigationFromTabsConfig(routes: ContentRoute[], tabs: ClarifyTabsConfig,
|
|
21
|
+
export declare function buildLocalizedNavigation(routes: ContentRoute[], config: ClarifyPagesConfig | undefined, localesConfig?: ResolvedClarifyLocalesConfig): LocalizedNavigation | undefined;
|
|
22
|
+
export declare function buildLocalizedNavigationFromTabsConfig(routes: ContentRoute[], tabs: ClarifyTabsConfig, localesConfig?: ResolvedClarifyLocalesConfig): LocalizedTabbedNavigation | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContentRoute,
|
|
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:
|
|
19
|
+
export declare const testI18n: ResolvedClarifyLocalesConfig;
|
|
20
20
|
export {};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { ContentRoute, ResolvedProjectConfig } from '../../types.js';
|
|
2
|
-
export declare function routeToMarkdownArtifactUrl(routePath: string): string;
|
|
3
|
-
export declare function routeToOpenAPIArtifactUrl(routePath: string): string;
|
|
4
2
|
export declare function attachContentArtifactUrls(routes: ContentRoute[]): void;
|
|
5
3
|
export declare function readRouteContent(route: ContentRoute): string;
|
|
6
4
|
export declare function readRouteArtifactContent(route: ContentRoute): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ClarifyPlugin } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* MCP search index plugin.
|
|
4
|
+
*
|
|
5
|
+
* Generates the Orama binary index (`mcp-search.msp`) and the MCP site
|
|
6
|
+
* descriptor (`mcp.json`) as build assets consumed by the `clarify mcp`
|
|
7
|
+
* command to serve documentation search to MCP-aware clients (e.g. AI coding
|
|
8
|
+
* assistants).
|
|
9
|
+
*
|
|
10
|
+
* This plugin is independent of `clarify:page-search` (Pagefind), which
|
|
11
|
+
* powers in-browser search. The MCP server runs in Node and needs a
|
|
12
|
+
* self-contained, compact index with CJK-aware tokenization that doesn't
|
|
13
|
+
* depend on the browser-only Pagefind runtime.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createMcpSearchPlugin(): ClarifyPlugin;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ResolvedProjectConfig } from '../../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Descriptor for a single MCP capability surfaced by a Clarify site.
|
|
4
|
+
*
|
|
5
|
+
* Capabilities are intentionally open-ended so future versions can add
|
|
6
|
+
* `resources`, `prompts`, etc. without reshaping the top-level file. Each
|
|
7
|
+
* capability carries its own metadata block; the CLI selects the block(s)
|
|
8
|
+
* it understands and ignores the rest.
|
|
9
|
+
*/
|
|
10
|
+
export type McpCapability = McpSearchCapability;
|
|
11
|
+
/**
|
|
12
|
+
* Full-text search capability backed by an Orama binary index.
|
|
13
|
+
*/
|
|
14
|
+
export type McpSearchCapability = {
|
|
15
|
+
/** Capability discriminator. */
|
|
16
|
+
type: 'search';
|
|
17
|
+
/**
|
|
18
|
+
* Root-relative path to the Orama binary index (`.msp`) produced at build
|
|
19
|
+
* time. Always served from the site root, so it already includes the
|
|
20
|
+
* routePrefix when one is configured.
|
|
21
|
+
*/
|
|
22
|
+
indexPath: string;
|
|
23
|
+
/** Locale used when the caller does not specify one. Drives tokenizer. */
|
|
24
|
+
defaultLocale?: string;
|
|
25
|
+
/** Number of documents stored in the index. */
|
|
26
|
+
documentCount: number;
|
|
27
|
+
/** Locales present in the index, for surfacing in tool descriptions. */
|
|
28
|
+
locales: string[];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* MCP server descriptor emitted to `<output>/mcp.json` during build.
|
|
32
|
+
*
|
|
33
|
+
* Consumed by `clarify mcp <url>` to bootstrap a local MCP server that
|
|
34
|
+
* exposes site capabilities (currently full-text search) to LLM clients.
|
|
35
|
+
* The descriptor points the CLI at the Orama binary index (`.msp`) written
|
|
36
|
+
* alongside `mcp.json` and carries the locale metadata needed to reconstruct
|
|
37
|
+
* the tokenizer at runtime.
|
|
38
|
+
*/
|
|
39
|
+
export type McpSiteConfig = {
|
|
40
|
+
/** Schema version of this file. Bumped on breaking shape changes. */
|
|
41
|
+
version: 3;
|
|
42
|
+
site: {
|
|
43
|
+
title?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
/** Canonical public site URL, if `siteUrl` is configured. */
|
|
46
|
+
url?: string;
|
|
47
|
+
/** Route prefix where the site is mounted. Default: '/'. */
|
|
48
|
+
routePrefix: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Capability map keyed by capability id. The id is stable across builds so
|
|
52
|
+
* clients can address a specific capability (e.g. `search`) even as new
|
|
53
|
+
* ones are added. Only capabilities actually emitted by the build are
|
|
54
|
+
* present; an absent key means the site does not provide that capability.
|
|
55
|
+
*/
|
|
56
|
+
capabilities: {
|
|
57
|
+
search?: McpSearchCapability;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export type CreateMcpSiteConfigOptions = {
|
|
61
|
+
documentCount: number;
|
|
62
|
+
locales: string[];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Assemble the MCP site config from build-time metadata.
|
|
66
|
+
*
|
|
67
|
+
* Unlike the previous pagefind-based descriptor, this no longer reads an
|
|
68
|
+
* entry JSON file - the Orama index is a single binary blob, so the caller
|
|
69
|
+
* supplies the document count and locale list directly from the build step
|
|
70
|
+
* that produced the index.
|
|
71
|
+
*/
|
|
72
|
+
export declare function createMcpSiteConfig(projectConfig: ResolvedProjectConfig, options: CreateMcpSiteConfigOptions): McpSiteConfig;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { AnyOrama } from '@orama/orama';
|
|
2
|
+
import { ContentRoute } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Orama schema for the MCP search index.
|
|
5
|
+
*
|
|
6
|
+
* - `path`, `title`, `description`, `content` are full-text searchable strings.
|
|
7
|
+
* - `locale` is an `enum` so we can use `where: { locale: { eq } }` filters at
|
|
8
|
+
* query time. (`string` fields cannot be filtered in Orama.)
|
|
9
|
+
* - `keywords` is a `string[]` also indexed for full-text matching.
|
|
10
|
+
*/
|
|
11
|
+
export declare const mcpSearchSchema: {
|
|
12
|
+
readonly path: "string";
|
|
13
|
+
readonly title: "string";
|
|
14
|
+
readonly description: "string";
|
|
15
|
+
readonly locale: "enum";
|
|
16
|
+
readonly content: "string";
|
|
17
|
+
readonly keywords: "string[]";
|
|
18
|
+
};
|
|
19
|
+
export type McpSearchDocument = {
|
|
20
|
+
path: string;
|
|
21
|
+
title: string;
|
|
22
|
+
description: string;
|
|
23
|
+
locale: string;
|
|
24
|
+
content: string;
|
|
25
|
+
keywords: string[];
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Tokenize text for Orama indexing and querying.
|
|
29
|
+
*
|
|
30
|
+
* CJK locales use `Intl.Segmenter` (word granularity), which splits
|
|
31
|
+
* spaceless scripts into words and individual characters. Latin/whitespace
|
|
32
|
+
* locales fall back to a Unicode-aware split on spaces and punctuation.
|
|
33
|
+
*
|
|
34
|
+
* All tokens are lowercased so queries match regardless of case.
|
|
35
|
+
*/
|
|
36
|
+
export declare function tokenizeForSearch(text: string, locale?: string): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Build an Orama tokenizer component bound to a specific default locale.
|
|
39
|
+
*
|
|
40
|
+
* The tokenizer receives the raw field value and the per-field language hint
|
|
41
|
+
* from Orama (which we don't set per-field, so it falls back to the default
|
|
42
|
+
* language). We resolve the segmenter locale from the default locale at
|
|
43
|
+
* construction time so the same tokenizer handles all documents in a
|
|
44
|
+
* predominantly single-locale index.
|
|
45
|
+
*
|
|
46
|
+
* For multi-locale indexes, the tokenizer is also used at query time. Since
|
|
47
|
+
* the query locale is not known to Orama's tokenizer callback, we use the
|
|
48
|
+
* index's default locale - this is acceptable because:
|
|
49
|
+
* - CJK queries get CJK segmentation (correct)
|
|
50
|
+
* - Latin queries against a CJK-default index still work because Latin
|
|
51
|
+
* text has no word boundaries for CJK segmenters to mis-split; the
|
|
52
|
+
* segmenter passes through Latin words as-is.
|
|
53
|
+
*/
|
|
54
|
+
export declare function createMcpTokenizer(defaultLocale?: string): {
|
|
55
|
+
language: string;
|
|
56
|
+
normalizationCache: Map<string, string>;
|
|
57
|
+
tokenize(raw: unknown, language?: string): string[];
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Compose the searchable text for a route. Shared between the Pagefind
|
|
61
|
+
* (browser) and Orama (MCP) indexing paths so both backends see the same
|
|
62
|
+
* field order and content.
|
|
63
|
+
*/
|
|
64
|
+
export declare function routeSearchContent(route: ContentRoute): string;
|
|
65
|
+
/**
|
|
66
|
+
* Convert a `ContentRoute` into the document shape stored in the Orama index.
|
|
67
|
+
*/
|
|
68
|
+
export declare function routeToSearchDocument(route: ContentRoute, defaultLocale?: string): McpSearchDocument | null;
|
|
69
|
+
/**
|
|
70
|
+
* Create an Orama index pre-configured with the MCP schema and CJK-aware
|
|
71
|
+
* tokenizer. Both the build step and the runtime loader use this so the
|
|
72
|
+
* tokenizer is guaranteed to match between indexing and querying.
|
|
73
|
+
*
|
|
74
|
+
* Annotated as `AnyOrama` (Orama's exported base type) rather than inferred
|
|
75
|
+
* via `ReturnType<typeof create>` because the inference would pull in
|
|
76
|
+
* Orama's internal component types (`DocumentsStore`, `Index`, `Sorter`)
|
|
77
|
+
* which are not exported and break `.d.ts` generation (TS2883).
|
|
78
|
+
*/
|
|
79
|
+
export declare function createMcpSearchIndex(defaultLocale?: string): McpSearchDb;
|
|
80
|
+
/** Orama index instance type for the MCP search schema. */
|
|
81
|
+
export type McpSearchDb = AnyOrama<typeof mcpSearchSchema>;
|
|
82
|
+
/**
|
|
83
|
+
* Insert search documents into an Orama index.
|
|
84
|
+
*/
|
|
85
|
+
export declare function indexSearchDocuments(db: McpSearchDb, documents: McpSearchDocument[]): void;
|
|
86
|
+
/**
|
|
87
|
+
* Build a ready-to-search Orama index from content routes.
|
|
88
|
+
*
|
|
89
|
+
* Filters out bare aliases and empty routes. Returns the populated db.
|
|
90
|
+
*/
|
|
91
|
+
export declare function buildSearchIndex(routes: ContentRoute[], defaultLocale?: string): {
|
|
92
|
+
db: McpSearchDb;
|
|
93
|
+
documentCount: number;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Collect the distinct locale codes that will be present in the Orama index,
|
|
97
|
+
* in stable insertion order. Bare aliases are skipped (they duplicate the
|
|
98
|
+
* default-locale route). Locales with no code fall back to the project
|
|
99
|
+
* default so single-locale sites still surface one locale.
|
|
100
|
+
*/
|
|
101
|
+
export declare function collectIndexedLocales(routes: ContentRoute[], defaultLocale?: string): string[];
|
|
102
|
+
export type McpSearchParams = {
|
|
103
|
+
query: string;
|
|
104
|
+
locale?: string;
|
|
105
|
+
limit?: number;
|
|
106
|
+
};
|
|
107
|
+
export type McpSearchHit = {
|
|
108
|
+
path: string;
|
|
109
|
+
title: string;
|
|
110
|
+
description: string;
|
|
111
|
+
locale: string;
|
|
112
|
+
score: number;
|
|
113
|
+
excerpt: string;
|
|
114
|
+
keywords: string[];
|
|
115
|
+
};
|
|
116
|
+
export type McpSearchResult = {
|
|
117
|
+
hits: McpSearchHit[];
|
|
118
|
+
count: number;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Search an Orama MCP index.
|
|
122
|
+
*
|
|
123
|
+
* Applies an optional locale filter (via the `enum` field) and returns a
|
|
124
|
+
* compact, LLM-friendly hit shape. Excerpts are derived from the matched
|
|
125
|
+
* content: Orama does not return highlighted excerpts, so we synthesize a
|
|
126
|
+
* short window around the first query term occurrence.
|
|
127
|
+
*/
|
|
128
|
+
export declare function searchMcpIndex(db: McpSearchDb, params: McpSearchParams): McpSearchResult;
|
|
129
|
+
/**
|
|
130
|
+
* Serialize an Orama index to a msgpack binary buffer.
|
|
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.
|
|
135
|
+
*/
|
|
136
|
+
export declare function serializeSearchIndex(db: McpSearchDb): Uint8Array;
|
|
137
|
+
/**
|
|
138
|
+
* Deserialize a msgpack binary buffer into a ready-to-search Orama index.
|
|
139
|
+
*
|
|
140
|
+
* The caller must supply the same `defaultLocale` used when the index was
|
|
141
|
+
* built, so the tokenizer matches. A mismatch would not corrupt data but
|
|
142
|
+
* would cause CJK query terms to be tokenized incorrectly (e.g. "文档" left
|
|
143
|
+
* as a single token instead of split into "文" + "档").
|
|
144
|
+
*/
|
|
145
|
+
export declare function deserializeSearchIndex(buffer: Uint8Array, defaultLocale?: string): McpSearchDb;
|
|
146
|
+
/**
|
|
147
|
+
* Write an Orama index to a `.msp` (msgpack) file on disk.
|
|
148
|
+
*/
|
|
149
|
+
export declare function writeSearchIndex(db: McpSearchDb, filePath: string): void;
|
|
150
|
+
/**
|
|
151
|
+
* Read an Orama index from a `.msp` (msgpack) file on disk.
|
|
152
|
+
*/
|
|
153
|
+
export declare function readSearchIndex(filePath: string, defaultLocale?: string): McpSearchDb;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
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
|
-
export declare const OPENAPI_SPEC_PREFIX = "virtual:clarify/openapi-spec/";
|
|
5
4
|
export declare function specVirtualModuleId(specKey: string): string;
|
|
6
5
|
export declare function generateOpenAPIRegistryModule(openApiSpecs: Record<string, string>): string;
|
|
7
6
|
export declare function generateOpenAPIServerRegistryModule(openApiSpecs: Record<string, OpenAPISpec>): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function createSourceEditUrl(filePath: string, contentRoot: string, source:
|
|
3
|
-
export declare function attachSourceEditUrls(routes: ContentRoute[], contentRoot: string, source?:
|
|
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
|
@@ -19,14 +19,16 @@ export type ClarifyLocaleConfig = {
|
|
|
19
19
|
label: string;
|
|
20
20
|
dir?: 'ltr' | 'rtl';
|
|
21
21
|
};
|
|
22
|
-
export type
|
|
23
|
-
/** Default visible locale.
|
|
24
|
-
|
|
22
|
+
export type ClarifyLocalesConfig = {
|
|
23
|
+
/** Default visible locale. Localized content is read from rootDirectory/<locale>. */
|
|
24
|
+
default?: string;
|
|
25
25
|
/** Missing translation behavior. Fallback uses default locale content. */
|
|
26
26
|
missing?: 'fallback' | '404' | 'hide';
|
|
27
27
|
locales: ClarifyLocaleConfig[];
|
|
28
28
|
};
|
|
29
|
-
export type
|
|
29
|
+
export type ResolvedClarifyLocalesConfig = {
|
|
30
|
+
default: string;
|
|
31
|
+
missing: 'fallback' | '404' | 'hide';
|
|
30
32
|
locales: ClarifyLocaleConfig[];
|
|
31
33
|
};
|
|
32
34
|
export type ClarifyNavbarLink = {
|
|
@@ -49,10 +51,10 @@ export type ClarifyVariableValue = ClarifyVariablePrimitive | {
|
|
|
49
51
|
[key: string]: ClarifyVariableValue;
|
|
50
52
|
};
|
|
51
53
|
export type ClarifyVariablesConfig = Record<string, ClarifyVariableValue>;
|
|
52
|
-
export type
|
|
54
|
+
export type ClarifyRepositoryConfig = {
|
|
53
55
|
/** Repository web URL, for example https://github.com/owner/repo. */
|
|
54
|
-
|
|
55
|
-
/** Source branch
|
|
56
|
+
url?: string;
|
|
57
|
+
/** Source branch. Default: main. */
|
|
56
58
|
branch?: string;
|
|
57
59
|
/** Directory prefix inside the repository that maps to rootDirectory. */
|
|
58
60
|
directory?: string;
|
|
@@ -102,8 +104,6 @@ export type ClarifyThemeConfig = {
|
|
|
102
104
|
tokens?: ClarifyThemeTokensConfig;
|
|
103
105
|
/** Documentation layout overrides applied on top of the selected preset. */
|
|
104
106
|
layout?: ClarifyThemeLayoutConfig;
|
|
105
|
-
/** Expose the live theme editor in the built site. Dev mode enables it automatically. */
|
|
106
|
-
editor?: boolean;
|
|
107
107
|
};
|
|
108
108
|
export type ResolvedClarifyThemeTokensConfig = {
|
|
109
109
|
colors: Required<ClarifyThemeColorTokensConfig>;
|
|
@@ -114,7 +114,6 @@ export type ResolvedClarifyThemeConfig = {
|
|
|
114
114
|
preset: ClarifyThemePreset;
|
|
115
115
|
tokens: ResolvedClarifyThemeTokensConfig;
|
|
116
116
|
layout: ResolvedClarifyThemeLayoutConfig;
|
|
117
|
-
editor: boolean;
|
|
118
117
|
};
|
|
119
118
|
export type ClarifyPagesItem = string | ClarifyPagesGroup | {
|
|
120
119
|
page: string;
|
|
@@ -175,6 +174,45 @@ export type ClarifyTabItem = {
|
|
|
175
174
|
pages?: ClarifyPagesConfig;
|
|
176
175
|
};
|
|
177
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
|
+
/** Whether to emit the MCP search index + descriptor for `clarify mcp`. Default: true. */
|
|
189
|
+
mcp?: boolean;
|
|
190
|
+
}>;
|
|
191
|
+
repository?: ClarifyFeatureConfig<ClarifyRepositoryConfig>;
|
|
192
|
+
themeEditor?: ClarifyFeatureConfig;
|
|
193
|
+
openapi?: ClarifyFeatureConfig<{
|
|
194
|
+
playground?: boolean;
|
|
195
|
+
}>;
|
|
196
|
+
};
|
|
197
|
+
export type ResolvedClarifyFeaturesConfig = {
|
|
198
|
+
search: {
|
|
199
|
+
enabled: boolean;
|
|
200
|
+
mcp: boolean;
|
|
201
|
+
};
|
|
202
|
+
repository: {
|
|
203
|
+
enabled: boolean;
|
|
204
|
+
url?: string;
|
|
205
|
+
branch?: string;
|
|
206
|
+
directory?: string;
|
|
207
|
+
};
|
|
208
|
+
themeEditor: {
|
|
209
|
+
enabled: boolean;
|
|
210
|
+
};
|
|
211
|
+
openapi: {
|
|
212
|
+
enabled: boolean;
|
|
213
|
+
playground: boolean;
|
|
214
|
+
};
|
|
215
|
+
};
|
|
178
216
|
export type ClarifyProjectConfig = {
|
|
179
217
|
/** Site title. Used in Header and SEO meta tags. */
|
|
180
218
|
title?: string;
|
|
@@ -182,54 +220,47 @@ export type ClarifyProjectConfig = {
|
|
|
182
220
|
description?: string;
|
|
183
221
|
/** Canonical public site URL. Enables sitemap.xml and robots.txt generation. */
|
|
184
222
|
siteUrl?: string;
|
|
185
|
-
/**
|
|
186
|
-
|
|
223
|
+
/** Route prefix where the site is mounted. Default: '/'. */
|
|
224
|
+
routePrefix?: string;
|
|
225
|
+
/** Path or URL prefix for emitted assets. Defaults to routePrefix. */
|
|
226
|
+
assetPrefix?: string;
|
|
187
227
|
/** Path to site logo image (relative to rootDirectory or absolute). Supports light/dark mode. */
|
|
188
228
|
logo?: ClarifyLogoConfig;
|
|
189
229
|
/** URL used when clicking the top navigation logo. Defaults to '/'. */
|
|
190
230
|
homeUrl?: string;
|
|
191
231
|
/** Favicon path or light/dark variants. */
|
|
192
232
|
favicon?: ClarifyFaviconConfig;
|
|
193
|
-
/** Theme preset, token overrides, and
|
|
233
|
+
/** Theme preset, token overrides, and layout options. */
|
|
194
234
|
theme?: ClarifyThemeConfig;
|
|
195
|
-
/**
|
|
196
|
-
|
|
197
|
-
/** Base path or URL for emitted static assets. Defaults to routePrefix. */
|
|
198
|
-
assetPrefix?: string;
|
|
199
|
-
/** Top navigation links. */
|
|
200
|
-
navbar?: {
|
|
201
|
-
links?: ClarifyNavbarLink[];
|
|
202
|
-
};
|
|
235
|
+
/** Top navigation links and documentation tabs. */
|
|
236
|
+
navigation?: ClarifyNavigationConfig;
|
|
203
237
|
/** Announcement banner displayed at the top of the page. */
|
|
204
238
|
banner?: ClarifyBannerConfig;
|
|
205
239
|
/** Footer configuration. */
|
|
206
240
|
footer?: ClarifyFooterConfig;
|
|
241
|
+
/** Localized content configuration. */
|
|
242
|
+
locales?: ClarifyLocalesConfig;
|
|
207
243
|
/** Reusable constants available in supported content via {{ variableName }} placeholders. */
|
|
208
244
|
variables?: ClarifyVariablesConfig;
|
|
209
|
-
/**
|
|
210
|
-
|
|
211
|
-
/** Top-level documentation tabs. Each tab owns its own sidebar pages. */
|
|
212
|
-
tabs?: ClarifyTabsConfig;
|
|
245
|
+
/** Optional product capabilities. All built-in features are enabled by default. */
|
|
246
|
+
features?: ClarifyFeaturesConfig;
|
|
213
247
|
};
|
|
214
248
|
export type ResolvedProjectConfig = {
|
|
215
249
|
title: string;
|
|
216
|
-
logo?: ClarifyLogoConfig;
|
|
217
|
-
homeUrl?: string;
|
|
218
250
|
description: string;
|
|
219
251
|
siteUrl?: string;
|
|
220
|
-
source?: ClarifySourceConfig;
|
|
221
252
|
routePrefix: string;
|
|
222
253
|
assetPrefix: string;
|
|
254
|
+
logo?: ClarifyLogoConfig;
|
|
255
|
+
homeUrl?: string;
|
|
223
256
|
favicon?: ClarifyFaviconConfig;
|
|
224
257
|
theme: ResolvedClarifyThemeConfig;
|
|
225
|
-
|
|
226
|
-
links?: ClarifyNavbarLink[];
|
|
227
|
-
};
|
|
258
|
+
navigation?: ClarifyNavigationConfig;
|
|
228
259
|
banner?: ClarifyBannerConfig;
|
|
229
260
|
footer?: ClarifyFooterConfig;
|
|
261
|
+
locales?: ResolvedClarifyLocalesConfig;
|
|
230
262
|
variables: ClarifyVariablesConfig;
|
|
231
|
-
|
|
232
|
-
tabs?: ClarifyTabsConfig;
|
|
263
|
+
features: ResolvedClarifyFeaturesConfig;
|
|
233
264
|
};
|
|
234
265
|
export type ContentSection = {
|
|
235
266
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clarify-labs/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -39,10 +39,13 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@apidevtools/swagger-parser": "^12.1.0",
|
|
42
|
-
"@clarify-labs/renderer": "0.
|
|
43
|
-
"@clarify-labs/templates": "0.
|
|
42
|
+
"@clarify-labs/renderer": "0.11.1",
|
|
43
|
+
"@clarify-labs/templates": "0.11.1",
|
|
44
44
|
"@mdx-js/mdx": "^3.1.1",
|
|
45
45
|
"@mdx-js/rollup": "^3.1.1",
|
|
46
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
47
|
+
"@msgpack/msgpack": "^3.1.3",
|
|
48
|
+
"@orama/orama": "^3.1.18",
|
|
46
49
|
"@shikijs/rehype": "^4.3.0",
|
|
47
50
|
"@tailwindcss/vite": "^4.3.2",
|
|
48
51
|
"@vitejs/plugin-react": "^6.0.3",
|
|
@@ -61,7 +64,6 @@
|
|
|
61
64
|
"rehype-raw": "^7.0.0",
|
|
62
65
|
"rehype-slug": "^6.0.0",
|
|
63
66
|
"remark": "^15.0.1",
|
|
64
|
-
"remark-gfm": "^4.0.1",
|
|
65
67
|
"shiki": "4.3.0",
|
|
66
68
|
"unist-util-visit": "^5.1.0",
|
|
67
69
|
"vite": "^8.1.4",
|