untitledui-mcp 0.1.0 → 0.1.3
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 +15 -5
- package/dist/index.js +158 -23
- package/package.json +4 -1
- package/.env.example +0 -1
- package/assets/cover.png +0 -0
- package/src/api/client.test.ts +0 -46
- package/src/api/client.ts +0 -117
- package/src/api/endpoints.ts +0 -12
- package/src/api/types.ts +0 -84
- package/src/cache/memory-cache.test.ts +0 -56
- package/src/cache/memory-cache.ts +0 -64
- package/src/index.ts +0 -96
- package/src/server.ts +0 -374
- package/src/utils/descriptions.ts +0 -65
- package/src/utils/license.test.ts +0 -45
- package/src/utils/license.ts +0 -35
- package/src/utils/search.test.ts +0 -39
- package/src/utils/search.ts +0 -71
- package/tsconfig.json +0 -16
package/src/utils/search.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
export interface SearchableItem {
|
|
2
|
-
name: string;
|
|
3
|
-
type: string;
|
|
4
|
-
fullPath: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface SearchResult extends SearchableItem {
|
|
8
|
-
matchType: "exact" | "partial";
|
|
9
|
-
score: number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function fuzzySearch(
|
|
13
|
-
query: string,
|
|
14
|
-
items: SearchableItem[],
|
|
15
|
-
limit = 20
|
|
16
|
-
): SearchResult[] {
|
|
17
|
-
const queryLower = query.toLowerCase();
|
|
18
|
-
|
|
19
|
-
const results: SearchResult[] = [];
|
|
20
|
-
|
|
21
|
-
for (const item of items) {
|
|
22
|
-
const nameLower = item.name.toLowerCase();
|
|
23
|
-
const fullPathLower = item.fullPath.toLowerCase();
|
|
24
|
-
|
|
25
|
-
let score = 0;
|
|
26
|
-
let matchType: "exact" | "partial" = "partial";
|
|
27
|
-
|
|
28
|
-
// Exact match on name
|
|
29
|
-
if (nameLower === queryLower) {
|
|
30
|
-
score = 1.0;
|
|
31
|
-
matchType = "exact";
|
|
32
|
-
}
|
|
33
|
-
// Name starts with query
|
|
34
|
-
else if (nameLower.startsWith(queryLower)) {
|
|
35
|
-
score = 0.9;
|
|
36
|
-
}
|
|
37
|
-
// Name contains query
|
|
38
|
-
else if (nameLower.includes(queryLower)) {
|
|
39
|
-
score = 0.7;
|
|
40
|
-
}
|
|
41
|
-
// Full path contains query
|
|
42
|
-
else if (fullPathLower.includes(queryLower)) {
|
|
43
|
-
score = 0.5;
|
|
44
|
-
}
|
|
45
|
-
// Fuzzy: all query chars appear in order
|
|
46
|
-
else {
|
|
47
|
-
let queryIndex = 0;
|
|
48
|
-
for (const char of nameLower) {
|
|
49
|
-
if (char === queryLower[queryIndex]) {
|
|
50
|
-
queryIndex++;
|
|
51
|
-
}
|
|
52
|
-
if (queryIndex === queryLower.length) {
|
|
53
|
-
score = 0.3;
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (score > 0) {
|
|
60
|
-
results.push({
|
|
61
|
-
...item,
|
|
62
|
-
matchType,
|
|
63
|
-
score,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return results
|
|
69
|
-
.sort((a, b) => b.score - a.score)
|
|
70
|
-
.slice(0, limit);
|
|
71
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"strict": true,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"outDir": "dist",
|
|
10
|
-
"rootDir": "src",
|
|
11
|
-
"declaration": true,
|
|
12
|
-
"resolveJsonModule": true
|
|
13
|
-
},
|
|
14
|
-
"include": ["src/**/*"],
|
|
15
|
-
"exclude": ["node_modules", "dist"]
|
|
16
|
-
}
|