@taiga-ui/mcp 0.1.0-alpha.9 → 0.2.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/README.md +126 -32
- package/package.json +15 -11
- package/dist/index.js +0 -8
- package/dist/index.js.map +0 -1
- package/dist/schemas/doc-types.js +0 -2
- package/dist/schemas/doc-types.js.map +0 -1
- package/dist/server/fetch.js +0 -33
- package/dist/server/fetch.js.map +0 -1
- package/dist/server/server.js +0 -29
- package/dist/server/server.js.map +0 -1
- package/dist/tools/get-component-example.js +0 -39
- package/dist/tools/get-component-example.js.map +0 -1
- package/dist/tools/get-list-components.js +0 -39
- package/dist/tools/get-list-components.js.map +0 -1
- package/dist/tools/index.js +0 -7
- package/dist/tools/index.js.map +0 -1
- package/dist/utils/find-section.js +0 -66
- package/dist/utils/find-section.js.map +0 -1
- package/dist/utils/list-components.js +0 -20
- package/dist/utils/list-components.js.map +0 -1
- package/dist/utils/logger.js +0 -10
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/parse-content.js +0 -46
- package/dist/utils/parse-content.js.map +0 -1
- package/dist/utils/query-results.js +0 -42
- package/dist/utils/query-results.js.map +0 -1
package/README.md
CHANGED
|
@@ -3,9 +3,6 @@
|
|
|
3
3
|
[](https://lobehub.com/mcp/taiga-family-taiga-ui-mcp)
|
|
4
4
|
[](https://npmjs.com/package/@taiga-ui/mcp)
|
|
5
5
|
|
|
6
|
-
> 🚧 **Alpha Release**
|
|
7
|
-
> `@taiga-ui/mcp` is currently in **alpha**.
|
|
8
|
-
|
|
9
6
|
> **🚀 The fastest way to integrate Taiga UI components into your AI workflow**
|
|
10
7
|
|
|
11
8
|
A Model Context Protocol (MCP) server that provides AI assistants with comprehensive access to
|
|
@@ -15,7 +12,8 @@ development workflow.
|
|
|
15
12
|
### Key Features
|
|
16
13
|
|
|
17
14
|
- **Docs + code snippets**. Full Taiga UI markdown plus ready Angular examples in one place.
|
|
18
|
-
- **
|
|
15
|
+
- **Four MCP tools**. Get structured overview with `get_overview`, discover with `get_list_components`, fetch examples
|
|
16
|
+
via `get_component_example`, and access migration guides with `get_migration_guide`.
|
|
19
17
|
- **Configurable & lightweight**. Swap source URL (stable/next) without local Angular install.
|
|
20
18
|
|
|
21
19
|
### Requirements
|
|
@@ -29,17 +27,17 @@ First, install the Taiga UI MCP server with your client.
|
|
|
29
27
|
|
|
30
28
|
**Standard config** works in most of the tools:
|
|
31
29
|
|
|
32
|
-
```
|
|
30
|
+
```json
|
|
33
31
|
{
|
|
34
|
-
mcpServers: {
|
|
35
|
-
|
|
36
|
-
command:
|
|
37
|
-
args: [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
}
|
|
32
|
+
"mcpServers": {
|
|
33
|
+
"taiga-ui": {
|
|
34
|
+
"command": "npx",
|
|
35
|
+
"args": [
|
|
36
|
+
"@taiga-ui/mcp@latest",
|
|
37
|
+
"--source-url=https://taiga-ui.dev/llms-full.txt" // or file from /next version, if you want
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
43
41
|
}
|
|
44
42
|
```
|
|
45
43
|
|
|
@@ -48,21 +46,77 @@ First, install the Taiga UI MCP server with your client.
|
|
|
48
46
|
<details>
|
|
49
47
|
<summary><b>Core automation</b></summary>
|
|
50
48
|
|
|
51
|
-
1. `
|
|
49
|
+
1. `get_overview`
|
|
50
|
+
- Returns structured documentation header: import map (all packages and their exports), code generation checklist,
|
|
51
|
+
CDK types reference, common mistakes, and getting started guides.
|
|
52
|
+
- **Always call this first** before using other tools — it provides critical context for correct code generation
|
|
53
|
+
(right packages, right types, common pitfalls).
|
|
54
|
+
- Output: JSON with `sections` array (Import Map, Code Generation Checklist, CDK Types Reference, Common Mistakes,
|
|
55
|
+
Getting Started) and `totalComponents` count.
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
get_overview();
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"title": "Taiga UI - Complete Documentation",
|
|
64
|
+
"sections": [
|
|
65
|
+
{
|
|
66
|
+
"title": "Import Map - Package Exports Reference",
|
|
67
|
+
"criticalNotices": ["Always import from the correct package. This is the #1 cause of compilation errors."],
|
|
68
|
+
"subsections": [...]
|
|
69
|
+
},
|
|
70
|
+
{ "title": "Code Generation Checklist", "subsections": [...] },
|
|
71
|
+
{ "title": "CDK Types Reference", "subsections": [...] },
|
|
72
|
+
{ "title": "Common Mistakes", "subsections": [...] },
|
|
73
|
+
{
|
|
74
|
+
"title": "Getting Started",
|
|
75
|
+
"description": "Installation and setup guides",
|
|
76
|
+
"subsections": [
|
|
77
|
+
{ "title": "addons", "content": ["npm i @taiga-ui/addon-charts ..."] },
|
|
78
|
+
{ "title": "app-standalone", "content": ["import {TuiRoot} from '@taiga-ui/core'; ..."] },
|
|
79
|
+
...
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"totalComponents": 185
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
2. `get_list_components { query?: string }`
|
|
52
88
|
- Lists component / section identifiers (with fuzzy substring filtering) along with basic metadata (category,
|
|
53
89
|
package, type).
|
|
54
90
|
- Input: optional `query` string to filter IDs (case-insensitive substring).
|
|
55
|
-
- Output: strictly structured JSON containing `items`, `total
|
|
91
|
+
- Output: strictly structured JSON containing `items`, `total`.
|
|
56
92
|
|
|
57
|
-
```
|
|
93
|
+
```ts
|
|
94
|
+
get_list_components();
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
```json
|
|
58
98
|
{
|
|
59
|
-
items: [
|
|
60
|
-
|
|
61
|
-
|
|
99
|
+
"items": [
|
|
100
|
+
{
|
|
101
|
+
"id": "components/Alert",
|
|
102
|
+
"name": "Alert",
|
|
103
|
+
"category": "components",
|
|
104
|
+
"package": "CORE",
|
|
105
|
+
"type": "component"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": "components/Button",
|
|
109
|
+
"package": "CORE",
|
|
110
|
+
"type": "component",
|
|
111
|
+
"name": "Button",
|
|
112
|
+
"category": "components"
|
|
113
|
+
},
|
|
114
|
+
...
|
|
115
|
+
],
|
|
62
116
|
}
|
|
63
117
|
```
|
|
64
118
|
|
|
65
|
-
|
|
119
|
+
3. `get_component_example { "names": ["...", "..."] }`
|
|
66
120
|
- Returns full markdown content for each resolved section (entire component documentation).
|
|
67
121
|
- Fuzzy name resolution: exact match, path segment, suffix, substring, and `Tui*` variants.
|
|
68
122
|
- Input: `{ names: string[] }` (each name length ≥ 2).
|
|
@@ -70,23 +124,63 @@ First, install the Taiga UI MCP server with your client.
|
|
|
70
124
|
unresolved), `content` (array of code blocks, if examples exist). Top-level also includes `matched` (count of
|
|
71
125
|
resolved names).
|
|
72
126
|
|
|
73
|
-
```
|
|
127
|
+
```ts
|
|
128
|
+
get_component_example({names: ['Alert']});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
```json
|
|
74
132
|
{
|
|
75
|
-
results: [
|
|
133
|
+
"results": [
|
|
76
134
|
{
|
|
77
|
-
query:
|
|
78
|
-
id:
|
|
79
|
-
package:
|
|
80
|
-
type:
|
|
81
|
-
content: [
|
|
82
|
-
}
|
|
135
|
+
"query": "Alert",
|
|
136
|
+
"id": "components/Alert",
|
|
137
|
+
"package": "CORE",
|
|
138
|
+
"type": "component",
|
|
139
|
+
"content": ["# components/Alert\n- **Package**: ... (full component API, usage examples, ...)"]
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
"matched": 1
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
4. `get_migration_guide`
|
|
147
|
+
- Returns the complete Migration Guide for Taiga UI version updates with pre-update checklist, migration instructions
|
|
148
|
+
via schematics, and troubleshooting for common issues.
|
|
149
|
+
- Use this tool when you need to migrate between Taiga UI major versions or understand the migration process.
|
|
150
|
+
- Input: none (no parameters required).
|
|
151
|
+
- Output: `title`, `introduction` with version info, and `sections` array with migration guidance, code blocks for
|
|
152
|
+
CLI commands, and solutions for common problems.
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
get_migration_guide();
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"title": "Migration Guide",
|
|
161
|
+
"introduction": [
|
|
162
|
+
"**Guide to update Taiga UI v{CURRENT_MAJOR} -> v{NEXT_MAJOR}**"
|
|
83
163
|
],
|
|
84
|
-
|
|
164
|
+
"sections": [
|
|
165
|
+
{
|
|
166
|
+
"title": "Before You Update",
|
|
167
|
+
"content": [...]
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"title": "Updating",
|
|
171
|
+
"content": [...],
|
|
172
|
+
"codeBlocks": [...]
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"title": "Troubleshooting",
|
|
176
|
+
"content": [...]
|
|
177
|
+
}
|
|
178
|
+
]
|
|
85
179
|
}
|
|
86
180
|
```
|
|
87
181
|
|
|
88
|
-
> Tip:
|
|
89
|
-
> `get_component_example
|
|
182
|
+
> Tip: Start with `get_overview` to get import map and common mistakes, then use `get_list_components` to discover IDs,
|
|
183
|
+
> `get_component_example` to fetch full implementation snippets, and `get_migration_guide` for version upgrade guidance.
|
|
90
184
|
|
|
91
185
|
</details>
|
|
92
186
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taiga-ui/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Model Context Protocol server providing Taiga UI documentation search and scaffolding tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -22,6 +22,16 @@
|
|
|
22
22
|
"url": "git+https://github.com/taiga-family/taiga-ui-mcp.git"
|
|
23
23
|
},
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
|
+
"contributors": [
|
|
26
|
+
{
|
|
27
|
+
"email": "vladimir.potekh@gmail.com",
|
|
28
|
+
"name": "Vladimir Potekhin"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"email": "zidakbew@gmail.com",
|
|
32
|
+
"name": "German Panov"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
25
35
|
"type": "module",
|
|
26
36
|
"main": "./dist/index.js",
|
|
27
37
|
"bin": {
|
|
@@ -39,7 +49,6 @@
|
|
|
39
49
|
"prepublishOnly": "npm run build",
|
|
40
50
|
"prettier": "prettier !package-lock.json . --ignore-path .gitignore",
|
|
41
51
|
"release": "npm publish --access public --tag latest",
|
|
42
|
-
"postrelease": "npm dist-tag add @taiga-ui/mcp@$(node -p 'require(`./package.json`).version') alpha",
|
|
43
52
|
"start": "node dist/index.js",
|
|
44
53
|
"typecheck": "tsc --noEmit --incremental false"
|
|
45
54
|
},
|
|
@@ -59,21 +68,16 @@
|
|
|
59
68
|
],
|
|
60
69
|
"prettier": "@taiga-ui/prettier-config",
|
|
61
70
|
"dependencies": {
|
|
62
|
-
"@modelcontextprotocol/sdk": "1.
|
|
71
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
63
72
|
"zod": "3.25.76"
|
|
64
73
|
},
|
|
65
74
|
"devDependencies": {
|
|
66
|
-
"@taiga-ui/configs": "0.
|
|
67
|
-
"@types/node": "24.
|
|
75
|
+
"@taiga-ui/configs": "0.522.0",
|
|
76
|
+
"@types/node": "24.12.2",
|
|
68
77
|
"husky": "9.1.7",
|
|
69
|
-
"lint-staged": "15.5.2",
|
|
70
78
|
"typescript": "5.9.3"
|
|
71
79
|
},
|
|
72
80
|
"engines": {
|
|
73
81
|
"node": ">=18.0.0"
|
|
74
|
-
}
|
|
75
|
-
"authors": [
|
|
76
|
-
"Vladimir Potekhin <vladimir.potekh@gmail.com>",
|
|
77
|
-
"German Panov <zidakbew@gmail.com>"
|
|
78
|
-
]
|
|
82
|
+
}
|
|
79
83
|
}
|
package/dist/index.js
DELETED
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE3C,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC3B,QAAQ,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;IAEzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"doc-types.js","sourceRoot":"","sources":["../../src/schemas/doc-types.ts"],"names":[],"mappings":""}
|
package/dist/server/fetch.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { parseContent } from '../utils/parse-content.js';
|
|
2
|
-
import { state } from './server.js';
|
|
3
|
-
// 6-hour refresh window
|
|
4
|
-
const REFRESH_INTERVAL_MS = 6 * 60 * 60 * 1000;
|
|
5
|
-
export async function fetchSource() {
|
|
6
|
-
const argProvidedUrl = process.argv
|
|
7
|
-
.find((arg) => arg.startsWith('--source-url='))
|
|
8
|
-
?.split('=')[1];
|
|
9
|
-
const sourceUrl = argProvidedUrl ?? process.env.SOURCE_URL;
|
|
10
|
-
if (!sourceUrl) {
|
|
11
|
-
throw new Error('Source URL not provided. Set SOURCE_URL or pass --source-url=...');
|
|
12
|
-
}
|
|
13
|
-
const response = await fetch(sourceUrl).catch((error) => {
|
|
14
|
-
throw new Error(`Network error fetching documentation source: ${error instanceof Error ? error.message : String(error)}`);
|
|
15
|
-
});
|
|
16
|
-
if (!response.ok) {
|
|
17
|
-
throw new Error(`Failed to fetch documentation (HTTP ${response.status} ${response.statusText}) from ${sourceUrl}`);
|
|
18
|
-
}
|
|
19
|
-
const content = await response.text();
|
|
20
|
-
if (!content.trim()) {
|
|
21
|
-
throw new Error(`Fetched documentation from ${sourceUrl} is empty.`);
|
|
22
|
-
}
|
|
23
|
-
return { url: sourceUrl, content };
|
|
24
|
-
}
|
|
25
|
-
export async function ensureSourceLoaded() {
|
|
26
|
-
const isContentStale = !state.lastLoadedAt || Date.now() - state.lastLoadedAt > REFRESH_INTERVAL_MS;
|
|
27
|
-
if (!state.sections.length || isContentStale) {
|
|
28
|
-
const { url, content } = await fetchSource();
|
|
29
|
-
parseContent(content, url);
|
|
30
|
-
state.lastLoadedAt = Date.now();
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=fetch.js.map
|
package/dist/server/fetch.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/server/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAElC,wBAAwB;AACxB,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,WAAW;IAC7B,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI;SAC9B,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;QAC/C,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpB,MAAM,SAAS,GAAG,cAAc,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;IAE3D,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACX,kEAAkE,CACrE,CAAC;IACN,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QAC7D,MAAM,IAAI,KAAK,CACX,gDAAgD,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC3G,CAAC;IACN,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACX,uCAAuC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,UAAU,SAAS,EAAE,CACrG,CAAC;IACN,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAEtC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,8BAA8B,SAAS,YAAY,CAAC,CAAC;IACzE,CAAC;IAED,OAAO,EAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAC,CAAC;AACrC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACpC,MAAM,cAAc,GAChB,CAAC,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,YAAY,GAAG,mBAAmB,CAAC;IAEjF,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,cAAc,EAAE,CAAC;QAC3C,MAAM,EAAC,GAAG,EAAE,OAAO,EAAC,GAAG,MAAM,WAAW,EAAE,CAAC;QAE3C,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAE3B,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACpC,CAAC;AACL,CAAC"}
|
package/dist/server/server.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
-
import packageJson from '../../package.json' with { type: 'json' };
|
|
5
|
-
import { registerAllTools } from '../tools/index.js';
|
|
6
|
-
import { logError, logInfo } from '../utils/logger.js';
|
|
7
|
-
import { ensureSourceLoaded } from './fetch.js';
|
|
8
|
-
export const state = {
|
|
9
|
-
sections: [],
|
|
10
|
-
sourceUrl: undefined,
|
|
11
|
-
lastLoadedAt: undefined,
|
|
12
|
-
};
|
|
13
|
-
const server = new McpServer({
|
|
14
|
-
name: 'taiga-ui-mcp',
|
|
15
|
-
version: packageJson.version,
|
|
16
|
-
});
|
|
17
|
-
registerAllTools(server);
|
|
18
|
-
export async function start() {
|
|
19
|
-
try {
|
|
20
|
-
await ensureSourceLoaded();
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
logError('Initial source load failed', error);
|
|
24
|
-
}
|
|
25
|
-
const transport = new StdioServerTransport();
|
|
26
|
-
await server.connect(transport);
|
|
27
|
-
logInfo(`Angular Taiga UI MCP Server running. Fetched source components: ${state.sections.length}`);
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,SAAS,EAAC,MAAM,yCAAyC,CAAC;AAClE,OAAO,EAAC,oBAAoB,EAAC,MAAM,2CAA2C,CAAC;AAE/E,OAAO,WAAW,MAAM,oBAAoB,CAAC,OAAM,IAAI,EAAE,MAAM,EAAC,CAAC;AAEjE,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAC,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAQ9C,MAAM,CAAC,MAAM,KAAK,GAAe;IAC7B,QAAQ,EAAE,EAAE;IACZ,SAAS,EAAE,SAAS;IACpB,YAAY,EAAE,SAAS;CAC1B,CAAC;AAEF,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IACzB,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,WAAW,CAAC,OAAO;CAC/B,CAAC,CAAC;AAEH,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAEzB,MAAM,CAAC,KAAK,UAAU,KAAK;IACvB,IAAI,CAAC;QACD,MAAM,kBAAkB,EAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,QAAQ,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAE7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,CACH,mEAAmE,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,CAC7F,CAAC;AACN,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { ensureSourceLoaded } from '../server/fetch.js';
|
|
3
|
-
import { buildQueryResults } from '../utils/query-results.js';
|
|
4
|
-
export function registerGetComponentExampleTool(server) {
|
|
5
|
-
server.registerTool('get_component_example', {
|
|
6
|
-
title: 'Get Component Example',
|
|
7
|
-
description: 'Return section-related content snippets (formerly examples) for specified documentation section name(s). The presence of id indicates a successful match.',
|
|
8
|
-
inputSchema: { names: z.array(z.string().min(2)).min(1) },
|
|
9
|
-
outputSchema: {
|
|
10
|
-
results: z.array(z.object({
|
|
11
|
-
query: z.string(),
|
|
12
|
-
id: z.string().optional(),
|
|
13
|
-
package: z.string().nullable().optional(),
|
|
14
|
-
type: z.string().nullable().optional(),
|
|
15
|
-
suggestions: z.array(z.string()).optional(),
|
|
16
|
-
content: z.array(z.string()).optional(),
|
|
17
|
-
})),
|
|
18
|
-
matched: z.number(),
|
|
19
|
-
},
|
|
20
|
-
}, async ({ names }) => {
|
|
21
|
-
if (!names.length) {
|
|
22
|
-
const output = {
|
|
23
|
-
error: 'Provide at least one name in names array.',
|
|
24
|
-
};
|
|
25
|
-
return {
|
|
26
|
-
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
|
|
27
|
-
structuredContent: output,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
await ensureSourceLoaded();
|
|
31
|
-
const { results, matches } = buildQueryResults(names);
|
|
32
|
-
const output = { results, matched: matches };
|
|
33
|
-
return {
|
|
34
|
-
content: [{ type: 'text', text: JSON.stringify(output, null, 2) }],
|
|
35
|
-
structuredContent: output,
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=get-component-example.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-component-example.js","sourceRoot":"","sources":["../../src/tools/get-component-example.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAE5D,MAAM,UAAU,+BAA+B,CAAC,MAAiB;IAC7D,MAAM,CAAC,YAAY,CACf,uBAAuB,EACvB;QACI,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EACP,2JAA2J;QAC/J,WAAW,EAAE,EAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAC;QACvD,YAAY,EAAE;YACV,OAAO,EAAE,CAAC,CAAC,KAAK,CACZ,CAAC,CAAC,MAAM,CAAC;gBACL,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;gBACjB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;gBACzB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ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ponentsList } from '../utils/list-components.js';
|
|
4
|
-
export function registerGetListComponentsTool(server) {
|
|
5
|
-
server.registerTool('get_list_components', {
|
|
6
|
-
title: 'List Components',
|
|
7
|
-
description: 'List all Taiga UI documentation section IDs (structured JSON only).',
|
|
8
|
-
inputSchema: { query: z.string().optional().default('') },
|
|
9
|
-
outputSchema: {
|
|
10
|
-
items: z.array(z.object({
|
|
11
|
-
id: z.string(),
|
|
12
|
-
name: z.string(),
|
|
13
|
-
category: z.string(),
|
|
14
|
-
package: z.string().nullable(),
|
|
15
|
-
type: z.string().nullable(),
|
|
16
|
-
})),
|
|
17
|
-
total: z.number(),
|
|
18
|
-
query: z.string().nullable(),
|
|
19
|
-
},
|
|
20
|
-
}, async ({ query }) => {
|
|
21
|
-
await ensureSourceLoaded();
|
|
22
|
-
const { items, normalizedQuery } = constructComponentsList(query);
|
|
23
|
-
const output = {
|
|
24
|
-
items,
|
|
25
|
-
total: items.length,
|
|
26
|
-
query: normalizedQuery,
|
|
27
|
-
};
|
|
28
|
-
return {
|
|
29
|
-
content: [
|
|
30
|
-
{
|
|
31
|
-
type: 'text',
|
|
32
|
-
text: JSON.stringify(output, null, 2),
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
structuredContent: output,
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=get-list-components.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-list-components.js","sourceRoot":"","sources":["../../src/tools/get-list-components.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAC;AAEpE,MAAM,UAAU,6BAA6B,CAAC,MAAiB;IAC3D,MAAM,CAAC,YAAY,CACf,qBAAqB,EACrB;QACI,KAAK,EAAE,iBAAiB;QACxB,WAAW,EACP,qEAAqE;QACzE,WAAW,EAAE,EAAC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,EAAC;QACvD,YAAY,EAAE;YACV,KAAK,EAAE,CAAC,CAAC,KAAK,CACV,CAAC,CAAC,MAAM,CAAC;gBACL,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;gBACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;gBAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;gBACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;gBAC9B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;aAC9B,CAAC,CACL;YACD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;YACjB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC/B;KACJ,EACD,KAAK,EAAE,EAAC,KAAK,EAAmB,EAAE,EAAE;QAChC,MAAM,kBAAkB,EAAE,CAAC;QAE3B,MAAM,EAAC,KAAK,EAAE,eAAe,EAAC,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;QAEhE,MAAM,MAAM,GAAG;YACX,KAAK;YACL,KAAK,EAAE,KAAK,CAAC,MAAM;YACnB,KAAK,EAAE,eAAe;SACzB,CAAC;QAEF,OAAO;YACH,OAAO,EAAE;gBACL;oBACI,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;iBACxC;aACJ;YACD,iBAAiB,EAAE,MAAM;SAC5B,CAAC;IACN,CAAC,CACJ,CAAC;AACN,CAAC"}
|
package/dist/tools/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { registerGetComponentExampleTool } from './get-component-example.js';
|
|
2
|
-
import { registerGetListComponentsTool } from './get-list-components.js';
|
|
3
|
-
export function registerAllTools(server) {
|
|
4
|
-
registerGetListComponentsTool(server);
|
|
5
|
-
registerGetComponentExampleTool(server);
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
package/dist/tools/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,+BAA+B,EAAC,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAC,6BAA6B,EAAC,MAAM,0BAA0B,CAAC;AAEvE,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAC9C,6BAA6B,CAAC,MAAM,CAAC,CAAC;IACtC,+BAA+B,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { state } from '../server/server.js';
|
|
2
|
-
export function findSection(name) {
|
|
3
|
-
const pascalCase = name
|
|
4
|
-
.toLowerCase()
|
|
5
|
-
.split(/[-_\s]+/)
|
|
6
|
-
.filter(Boolean)
|
|
7
|
-
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
8
|
-
.join('');
|
|
9
|
-
const camelCase = pascalCase
|
|
10
|
-
? pascalCase.charAt(0).toLowerCase() + pascalCase.slice(1)
|
|
11
|
-
: '';
|
|
12
|
-
const tuiVariant = pascalCase.startsWith('Tui') ? pascalCase : `Tui${pascalCase}`;
|
|
13
|
-
const variants = [
|
|
14
|
-
name.toLowerCase(),
|
|
15
|
-
pascalCase,
|
|
16
|
-
camelCase,
|
|
17
|
-
tuiVariant,
|
|
18
|
-
tuiVariant.toLowerCase(),
|
|
19
|
-
].filter(Boolean);
|
|
20
|
-
// Exact match
|
|
21
|
-
for (const variant of variants) {
|
|
22
|
-
const exactMatch = state.sections.find((section) => section.id.toLowerCase() === variant.toLowerCase());
|
|
23
|
-
if (exactMatch) {
|
|
24
|
-
return exactMatch;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
// Last path segment match
|
|
28
|
-
for (const variant of variants) {
|
|
29
|
-
const segmentMatch = state.sections.find((section) => section.id.split('/').pop()?.toLowerCase() === variant.toLowerCase());
|
|
30
|
-
if (segmentMatch) {
|
|
31
|
-
return segmentMatch;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// Ends-with match
|
|
35
|
-
for (const variant of variants) {
|
|
36
|
-
const endsWithMatch = state.sections.find((section) => section.id.toLowerCase().endsWith(`/${variant.toLowerCase()}`));
|
|
37
|
-
if (endsWithMatch) {
|
|
38
|
-
return endsWithMatch;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
// Substring fallback
|
|
42
|
-
const substringMatch = state.sections.find((section) => section.id.toLowerCase().includes(name.toLowerCase()));
|
|
43
|
-
if (substringMatch) {
|
|
44
|
-
return substringMatch;
|
|
45
|
-
}
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
export function suggestSections(query) {
|
|
49
|
-
const normalizedQuery = query.toLowerCase();
|
|
50
|
-
return state.sections
|
|
51
|
-
.map((section) => {
|
|
52
|
-
const sectionIdLower = section.id.toLowerCase();
|
|
53
|
-
const matchIndex = sectionIdLower.indexOf(normalizedQuery);
|
|
54
|
-
return matchIndex === -1
|
|
55
|
-
? null
|
|
56
|
-
: {
|
|
57
|
-
id: section.id,
|
|
58
|
-
score: matchIndex * 10 +
|
|
59
|
-
Math.abs(sectionIdLower.length - normalizedQuery.length),
|
|
60
|
-
};
|
|
61
|
-
})
|
|
62
|
-
.filter((candidate) => !!candidate)
|
|
63
|
-
.sort((a, b) => a.score - b.score)
|
|
64
|
-
.map((result) => result.id);
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=find-section.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-section.js","sourceRoot":"","sources":["../../src/utils/find-section.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAC,MAAM,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AC,IAAI;YACN,CAAC,CAAC;gBACI,EAAE,EAAE,OAAO,CAAC,EAAE;gBACd,KAAK,EACD,UAAU,GAAG,EAAE;oBACf,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;aAC/D,CAAC;IACZ,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,SAAS,EAA4C,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SAC5E,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;SACjC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { state } from '../server/server.js';
|
|
2
|
-
export function constructComponentsList(query = '') {
|
|
3
|
-
const normalizedQuery = query.toLowerCase().replace(/^tui/, '');
|
|
4
|
-
const items = state.sections
|
|
5
|
-
.filter((section) => !normalizedQuery || section.id.toLowerCase().includes(normalizedQuery))
|
|
6
|
-
.map((section) => {
|
|
7
|
-
const idParts = section.id.split('/');
|
|
8
|
-
const name = idParts[idParts.length - 1] ?? section.id;
|
|
9
|
-
const category = idParts[0] ?? '';
|
|
10
|
-
return {
|
|
11
|
-
id: section.id,
|
|
12
|
-
name,
|
|
13
|
-
category,
|
|
14
|
-
package: section.package ?? null,
|
|
15
|
-
type: section.kind ?? null,
|
|
16
|
-
};
|
|
17
|
-
});
|
|
18
|
-
return { items, normalizedQuery };
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=list-components.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"list-components.js","sourceRoot":"","sources":["../../src/utils/list-components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAU1C,MAAM,UAAU,uBAAuB,CAAC,KAAK,GAAG,EAAE;IAI9C,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAEhE,MAAM,KAAK,GAAsB,KAAK,CAAC,QAAQ;SAC1C,MAAM,CACH,CAAC,OAAO,EAAE,EAAE,CACR,CAAC,eAAe,IAAI,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,CAC7E;SACA,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACb,MAAM,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtC,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC,EAAE,CAAC;QACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAElC,OAAO;YACH,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,IAAI;YACJ,QAAQ;YACR,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI;YAChC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI;SAC7B,CAAC;IACN,CAAC,CAAC,CAAC;IAEP,OAAO,EAAC,KAAK,EAAE,eAAe,EAAC,CAAC;AACpC,CAAC"}
|
package/dist/utils/logger.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// In STDIO-based MCP servers can use only stderr for logging
|
|
2
|
-
// https://modelcontextprotocol.io/docs/develop/build-server#logging-in-mcp-servers
|
|
3
|
-
export function logError(message, err) {
|
|
4
|
-
const stack = err instanceof Error ? (err.stack ?? err.message) : String(err);
|
|
5
|
-
console.error(`[ERROR] ${message}: ${stack}`);
|
|
6
|
-
}
|
|
7
|
-
export function logInfo(message) {
|
|
8
|
-
console.warn(`[INFO] ${message}`);
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=logger.js.map
|
package/dist/utils/logger.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,mFAAmF;AAEnF,MAAM,UAAU,QAAQ,CAAC,OAAe,EAAE,GAAY;IAClD,MAAM,KAAK,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAE9E,OAAO,CAAC,KAAK,CAAC,WAAW,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,OAAe;IACnC,OAAO,CAAC,IAAI,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { state } from '../server/server.js';
|
|
2
|
-
function extractMeta(text) {
|
|
3
|
-
let pkg;
|
|
4
|
-
let kind;
|
|
5
|
-
const pkgMatch = /\*\*Package\*\*:\s*`([^`]+)`/i.exec(text);
|
|
6
|
-
if (pkgMatch?.[1]) {
|
|
7
|
-
pkg = pkgMatch[1];
|
|
8
|
-
}
|
|
9
|
-
const typeMatch = /\*\*Type\*\*:\s*([^\n]+)/i.exec(text);
|
|
10
|
-
if (typeMatch?.[1]) {
|
|
11
|
-
kind = typeMatch[1].trim();
|
|
12
|
-
}
|
|
13
|
-
return { package: pkg, kind };
|
|
14
|
-
}
|
|
15
|
-
export function parseContent(rawContent, sourceUrl) {
|
|
16
|
-
state.sourceUrl = sourceUrl;
|
|
17
|
-
const lines = rawContent.split(/\r?\n/);
|
|
18
|
-
const headerIndices = [];
|
|
19
|
-
for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
|
|
20
|
-
const line = lines[lineIndex];
|
|
21
|
-
if (line === undefined) {
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
const headerMatch = /^#\s+(.+)$/.exec(line);
|
|
25
|
-
if (headerMatch?.[1]) {
|
|
26
|
-
headerIndices.push({
|
|
27
|
-
line: lineIndex,
|
|
28
|
-
title: headerMatch[1].trim(),
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
state.sections = headerIndices.map((header, headerIndex) => {
|
|
33
|
-
const start = header.line;
|
|
34
|
-
const end = headerIndices[headerIndex + 1]?.line ?? lines.length;
|
|
35
|
-
const content = lines.slice(start, end).join('\n');
|
|
36
|
-
const meta = extractMeta(content);
|
|
37
|
-
return {
|
|
38
|
-
id: header.title,
|
|
39
|
-
title: header.title,
|
|
40
|
-
content,
|
|
41
|
-
package: meta.package,
|
|
42
|
-
kind: meta.kind,
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=parse-content.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-content.js","sourceRoot":"","sources":["../../src/utils/parse-content.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAE1C,SAAS,WAAW,CAAC,IAAY;IAC7B,IAAI,GAAuB,CAAC;IAC5B,IAAI,IAAwB,CAAC;IAE7B,MAAM,QAAQ,GAAG,+BAA+B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE5D,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChB,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAED,MAAM,SAAS,GAAG,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEzD,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjB,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAED,OAAO,EAAC,OAA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AK;YACnB,OAAO;YACP,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;SAClB,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { findSection, suggestSections } from './find-section.js';
|
|
2
|
-
export function extractContentSnippets(section) {
|
|
3
|
-
const text = section.content || '';
|
|
4
|
-
const trimmed = text.trim();
|
|
5
|
-
if (!trimmed) {
|
|
6
|
-
return [];
|
|
7
|
-
}
|
|
8
|
-
const cleaned = trimmed
|
|
9
|
-
.split(/\r?\n/)
|
|
10
|
-
.map((line) => line.replace(/^#{1,6}\s*/, ''))
|
|
11
|
-
.join('\n')
|
|
12
|
-
.trim();
|
|
13
|
-
return cleaned ? [cleaned] : [];
|
|
14
|
-
}
|
|
15
|
-
export function buildQueryResults(names) {
|
|
16
|
-
const results = [];
|
|
17
|
-
for (const queryName of names) {
|
|
18
|
-
const section = findSection(queryName);
|
|
19
|
-
if (!section) {
|
|
20
|
-
const notFound = {
|
|
21
|
-
query: queryName,
|
|
22
|
-
suggestions: suggestSections(queryName),
|
|
23
|
-
};
|
|
24
|
-
results.push(notFound);
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
const snippets = extractContentSnippets(section);
|
|
28
|
-
const foundResult = {
|
|
29
|
-
query: queryName,
|
|
30
|
-
id: section.id,
|
|
31
|
-
package: section.package ?? null,
|
|
32
|
-
type: section.kind ?? null,
|
|
33
|
-
};
|
|
34
|
-
if (snippets.length) {
|
|
35
|
-
foundResult.content = snippets;
|
|
36
|
-
}
|
|
37
|
-
results.push(foundResult);
|
|
38
|
-
}
|
|
39
|
-
const matches = results.filter((result) => !!result.id).length;
|
|
40
|
-
return { results, matches };
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=query-results.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-results.js","sourceRoot":"","sources":["../../src/utils/query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