skill-creator 1.5.1 → 1.5.2
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 +173 -103
- package/dist/buildIndex-B_9ABRtx.mjs +2 -0
- package/dist/buildIndex-B_9ABRtx.mjs.map +1 -0
- package/dist/buildIndex-Cea97e0l.mjs +1 -0
- package/dist/cli.d.mts +0 -0
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +17 -33
- package/dist/cli.mjs.map +1 -1
- package/dist/contentManager-CoVTiSDT.mjs +13 -0
- package/dist/contentManager-CoVTiSDT.mjs.map +1 -0
- package/dist/contentManager-CwquwC1s.mjs +1 -0
- package/dist/context7-BejCCqkm.mjs +1 -0
- package/dist/context7-BxMpyQiW.mjs +2 -0
- package/dist/context7-BxMpyQiW.mjs.map +1 -0
- package/dist/index.d.mts +317 -123
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -20
- package/dist/index.mjs.map +1 -1
- package/dist/{listContext7-DKXzgWdn.mjs → listContext7-DHj9AL-z.mjs} +2 -2
- package/dist/{listContext7-DKXzgWdn.mjs.map → listContext7-DHj9AL-z.mjs.map} +1 -1
- package/dist/package-CFJazwTO.mjs +2 -0
- package/dist/package-CFJazwTO.mjs.map +1 -0
- package/dist/referenceSearchUtils-DZgupMZp.mjs +2 -0
- package/dist/referenceSearchUtils-DZgupMZp.mjs.map +1 -0
- package/dist/removeContext7-BZtL4_CJ.mjs +3 -0
- package/dist/{removeContext7-DOXrTXeI.mjs.map → removeContext7-BZtL4_CJ.mjs.map} +1 -1
- package/dist/{removeSkill-C-ehFexk.mjs → removeSkill-Bat_plVG.mjs} +4 -4
- package/dist/removeSkill-Bat_plVG.mjs.map +1 -0
- package/dist/removeSkill-DjDZjhJU.mjs +1 -0
- package/dist/runScript-CSKqb831.mjs +13 -0
- package/dist/runScript-CSKqb831.mjs.map +1 -0
- package/dist/scopeSelection-BWteJQSv.mjs +2 -0
- package/dist/scopeSelection-BWteJQSv.mjs.map +1 -0
- package/dist/searchQuality-DVdHmamh.mjs +2 -0
- package/dist/searchQuality-DVdHmamh.mjs.map +1 -0
- package/dist/search_format-RyjXACJa.mjs +5 -0
- package/dist/search_format-RyjXACJa.mjs.map +1 -0
- package/dist/shared-DsVh4gOV.mjs +2 -0
- package/dist/shared-DsVh4gOV.mjs.map +1 -0
- package/dist/skillCreator-BomXoqdw.mjs +2 -0
- package/dist/skillCreator-BomXoqdw.mjs.map +1 -0
- package/dist/skillMdManager-DGBZ6M5J.mjs +7 -0
- package/dist/skillMdManager-DGBZ6M5J.mjs.map +1 -0
- package/dist/sqliteVectorSearchAdapter-56kZjbUT.mjs +28 -0
- package/dist/sqliteVectorSearchAdapter-56kZjbUT.mjs.map +1 -0
- package/dist/sqliteVectorSearchAdapter-DNkyKuZs.mjs +1 -0
- package/dist/unifiedSearch-CLdazMYU.mjs +4 -0
- package/dist/unifiedSearch-CLdazMYU.mjs.map +1 -0
- package/dist/unifiedSearch-DCFPrtzZ.mjs +1 -0
- package/package.json +32 -28
- package/templates/SKILL.md +19 -4
- package/templates/SKILL.zh-CN.md +54 -12
- package/templates/skill-creator.md +52 -19
- package/templates/skill-creator.zh-CN.md +55 -22
- package/dist/chunk-Da8dvM5T.mjs +0 -1
- package/dist/contentManager-8rmWJMb6.mjs +0 -22
- package/dist/contentManager-8rmWJMb6.mjs.map +0 -1
- package/dist/contentManager-Xt8N5psY.mjs +0 -1
- package/dist/dist-DZL34HNo.mjs +0 -8
- package/dist/dist-DZL34HNo.mjs.map +0 -1
- package/dist/dist-X_kVEzbK.mjs +0 -1
- package/dist/esm-8qfZdcpd.mjs +0 -33
- package/dist/esm-8qfZdcpd.mjs.map +0 -1
- package/dist/esm-BF5pvSbc.mjs +0 -1
- package/dist/esm-BbhxxeGF.mjs +0 -4
- package/dist/esm-BbhxxeGF.mjs.map +0 -1
- package/dist/package-Cxx_VSyD.mjs +0 -2
- package/dist/package-Cxx_VSyD.mjs.map +0 -1
- package/dist/path-CuoiIaIe.mjs +0 -2
- package/dist/path-CuoiIaIe.mjs.map +0 -1
- package/dist/removeContext7-DOXrTXeI.mjs +0 -3
- package/dist/removeSkill-C-ehFexk.mjs.map +0 -1
- package/dist/removeSkill-DWwhvzej.mjs +0 -1
- package/dist/runScript-Cr9RRN9y.mjs +0 -14
- package/dist/runScript-Cr9RRN9y.mjs.map +0 -1
- package/dist/search_format-DIs-1lKk.mjs +0 -5
- package/dist/search_format-DIs-1lKk.mjs.map +0 -1
- package/dist/shared-CFoY2Xhg.mjs +0 -2
- package/dist/shared-CFoY2Xhg.mjs.map +0 -1
- package/dist/skillMdManager-DP8fGZb7.mjs +0 -7
- package/dist/skillMdManager-DP8fGZb7.mjs.map +0 -1
- package/dist/unifiedSearch-CGZXw0NB.mjs +0 -1
- package/dist/unifiedSearch-l-lrSc9C.mjs +0 -4
- package/dist/unifiedSearch-l-lrSc9C.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/core/searchAdapter.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Search Engine Adapter Interface
|
|
4
|
+
* Provides a unified interface for different search implementations
|
|
5
|
+
*/
|
|
6
|
+
interface SearchResult$2 {
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
content: string;
|
|
10
|
+
source: 'user' | 'context7';
|
|
11
|
+
file_path: string;
|
|
12
|
+
score: number;
|
|
13
|
+
metadata: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
interface SearchOptions$1 {
|
|
16
|
+
topK?: number;
|
|
17
|
+
where?: Record<string, any>;
|
|
18
|
+
fuzzyThreshold?: number;
|
|
19
|
+
}
|
|
20
|
+
type SearchMode = 'auto' | 'fulltext' | 'fuzzy' | 'vector' | 'chroma';
|
|
21
|
+
type SearchBackendId = 'minisearch' | 'ufuzzy' | 'sqlite-vec';
|
|
22
|
+
interface SearchBackendInfo {
|
|
23
|
+
backendId: SearchBackendId;
|
|
24
|
+
mode: Exclude<SearchMode, 'chroma'>;
|
|
25
|
+
supportsPersistence: boolean;
|
|
26
|
+
supportsEmbeddings: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface SearchIndexState {
|
|
29
|
+
backendId: SearchBackendId;
|
|
30
|
+
referencesHash?: string;
|
|
31
|
+
builtAt?: string;
|
|
32
|
+
documentCount?: number;
|
|
33
|
+
rulesetVersion?: string;
|
|
34
|
+
}
|
|
35
|
+
interface SearchEngine {
|
|
36
|
+
/**
|
|
37
|
+
* Initialize backend resources if needed
|
|
38
|
+
*/
|
|
39
|
+
initialize?(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Build search index from files
|
|
42
|
+
*/
|
|
43
|
+
buildIndex(referencesDir: string): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Search for documents matching the query
|
|
46
|
+
*/
|
|
47
|
+
search(query: string, options?: SearchOptions$1): Promise<SearchResult$2[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Return backend identity/capabilities
|
|
50
|
+
*/
|
|
51
|
+
getBackendInfo(): SearchBackendInfo;
|
|
52
|
+
/**
|
|
53
|
+
* Check if the search index is built and ready
|
|
54
|
+
*/
|
|
55
|
+
isBuilt(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Get search engine statistics
|
|
58
|
+
*/
|
|
59
|
+
getStats(): Promise<{
|
|
60
|
+
totalDocuments: number;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* Read index state metadata
|
|
64
|
+
*/
|
|
65
|
+
getIndexState?(): Promise<SearchIndexState>;
|
|
66
|
+
/**
|
|
67
|
+
* Clear the search index
|
|
68
|
+
*/
|
|
69
|
+
clearIndex(): void | Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
3
72
|
//#region node_modules/.pnpm/zod@4.1.12/node_modules/zod/v4/core/standard-schema.d.cts
|
|
4
73
|
/** The Standard Schema interface. */
|
|
5
74
|
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
@@ -1500,6 +1569,8 @@ interface CreateSkillOptions {
|
|
|
1500
1569
|
skillDirname: string;
|
|
1501
1570
|
skillName: string;
|
|
1502
1571
|
skillDescription?: string;
|
|
1572
|
+
sourcePackageName?: string;
|
|
1573
|
+
sourcePackageVersionHint?: string;
|
|
1503
1574
|
force?: boolean;
|
|
1504
1575
|
}
|
|
1505
1576
|
interface CreateSkillResult {
|
|
@@ -1513,6 +1584,21 @@ interface UpdateContext7Result {
|
|
|
1513
1584
|
filesCreated: number;
|
|
1514
1585
|
message: string;
|
|
1515
1586
|
}
|
|
1587
|
+
interface CommandIndexingResult {
|
|
1588
|
+
attempted: boolean;
|
|
1589
|
+
skipped: boolean;
|
|
1590
|
+
succeeded: boolean;
|
|
1591
|
+
totalDocuments: number;
|
|
1592
|
+
backendInfo?: SearchBackendInfo | null;
|
|
1593
|
+
error?: string;
|
|
1594
|
+
}
|
|
1595
|
+
interface DownloadContext7CommandResult {
|
|
1596
|
+
projectId: string;
|
|
1597
|
+
update: UpdateContext7Result;
|
|
1598
|
+
skillMdUpdated: boolean;
|
|
1599
|
+
context7Files: string[];
|
|
1600
|
+
indexing: CommandIndexingResult;
|
|
1601
|
+
}
|
|
1516
1602
|
interface AddContentResult {
|
|
1517
1603
|
added: boolean;
|
|
1518
1604
|
updated: boolean;
|
|
@@ -1523,6 +1609,7 @@ interface AddContentResult {
|
|
|
1523
1609
|
similarContent?: Array<{
|
|
1524
1610
|
title: string;
|
|
1525
1611
|
score: number;
|
|
1612
|
+
sourceRank?: 'primary' | 'secondary';
|
|
1526
1613
|
source: string;
|
|
1527
1614
|
preview: string;
|
|
1528
1615
|
}>;
|
|
@@ -1531,6 +1618,16 @@ interface AddContentResult {
|
|
|
1531
1618
|
content: string;
|
|
1532
1619
|
};
|
|
1533
1620
|
}
|
|
1621
|
+
interface AddContentCommandResult extends AddContentResult {
|
|
1622
|
+
skillMdUpdated: boolean;
|
|
1623
|
+
userFiles: string[];
|
|
1624
|
+
}
|
|
1625
|
+
interface BuildIndexCommandResult {
|
|
1626
|
+
mode: Exclude<SearchMode, 'chroma'>;
|
|
1627
|
+
vectorEmbedder?: string;
|
|
1628
|
+
totalDocuments: number;
|
|
1629
|
+
backendInfo?: SearchBackendInfo | null;
|
|
1630
|
+
}
|
|
1534
1631
|
interface PackageVersion {
|
|
1535
1632
|
version: string;
|
|
1536
1633
|
formatted: string;
|
|
@@ -1543,6 +1640,35 @@ interface Context7Library {
|
|
|
1543
1640
|
trust_score: number;
|
|
1544
1641
|
versions?: string[];
|
|
1545
1642
|
}
|
|
1643
|
+
interface Context7ResolvedLibrary {
|
|
1644
|
+
packageName: string;
|
|
1645
|
+
version?: string;
|
|
1646
|
+
query: string;
|
|
1647
|
+
bestMatch: {
|
|
1648
|
+
id: string;
|
|
1649
|
+
title: string;
|
|
1650
|
+
description: string;
|
|
1651
|
+
totalSnippets: number;
|
|
1652
|
+
trustScore: number;
|
|
1653
|
+
benchmarkScore: number;
|
|
1654
|
+
versions: string[];
|
|
1655
|
+
matchKind: 'package-path' | 'package-slug' | 'website' | 'other';
|
|
1656
|
+
versionMatched: boolean;
|
|
1657
|
+
selectionScore: number;
|
|
1658
|
+
};
|
|
1659
|
+
candidates: Array<{
|
|
1660
|
+
id: string;
|
|
1661
|
+
title: string;
|
|
1662
|
+
description: string;
|
|
1663
|
+
totalSnippets: number;
|
|
1664
|
+
trustScore: number;
|
|
1665
|
+
benchmarkScore: number;
|
|
1666
|
+
versions: string[];
|
|
1667
|
+
matchKind: 'package-path' | 'package-slug' | 'website' | 'other';
|
|
1668
|
+
versionMatched: boolean;
|
|
1669
|
+
selectionScore: number;
|
|
1670
|
+
}>;
|
|
1671
|
+
}
|
|
1546
1672
|
//#endregion
|
|
1547
1673
|
//#region src/core/skillCreator.d.ts
|
|
1548
1674
|
declare class SkillCreator {
|
|
@@ -1551,146 +1677,135 @@ declare class SkillCreator {
|
|
|
1551
1677
|
createSkill(options: CreateSkillOptions): Promise<CreateSkillResult>;
|
|
1552
1678
|
private createDirectoryStructure;
|
|
1553
1679
|
private createSkillMdFromTemplate;
|
|
1680
|
+
private inferVersionHint;
|
|
1554
1681
|
}
|
|
1555
1682
|
//#endregion
|
|
1556
|
-
//#region src/core/
|
|
1683
|
+
//#region src/core/fuzzySearchAdapter.d.ts
|
|
1557
1684
|
/**
|
|
1558
|
-
* Search Engine Adapter
|
|
1559
|
-
*
|
|
1685
|
+
* uFuzzy-based Search Engine Adapter
|
|
1686
|
+
* Clean implementation focused only on search functionality
|
|
1560
1687
|
*/
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
file_path: string;
|
|
1567
|
-
score: number;
|
|
1568
|
-
metadata: any;
|
|
1569
|
-
}
|
|
1570
|
-
interface SearchOptions$1 {
|
|
1571
|
-
topK?: number;
|
|
1572
|
-
where?: Record<string, any>;
|
|
1573
|
-
fuzzyThreshold?: number;
|
|
1574
|
-
}
|
|
1575
|
-
interface SearchEngine {
|
|
1576
|
-
/**
|
|
1577
|
-
* Build search index from files
|
|
1578
|
-
*/
|
|
1688
|
+
declare class FuzzySearchAdapter implements SearchEngine {
|
|
1689
|
+
private documents;
|
|
1690
|
+
private fuzzy;
|
|
1691
|
+
private lastSearchInfo;
|
|
1692
|
+
constructor();
|
|
1579
1693
|
buildIndex(referencesDir: string): Promise<void>;
|
|
1580
|
-
/**
|
|
1581
|
-
* Search for documents matching the query
|
|
1582
|
-
*/
|
|
1583
1694
|
search(query: string, options?: SearchOptions$1): Promise<SearchResult$2[]>;
|
|
1584
1695
|
/**
|
|
1585
|
-
*
|
|
1586
|
-
*/
|
|
1587
|
-
isBuilt(): boolean;
|
|
1588
|
-
/**
|
|
1589
|
-
* Get search engine statistics
|
|
1696
|
+
* Basic fuzzy search using uFuzzy
|
|
1590
1697
|
*/
|
|
1591
|
-
|
|
1698
|
+
private fuzzySearch;
|
|
1592
1699
|
/**
|
|
1593
|
-
*
|
|
1700
|
+
* Enhanced fuzzy search that returns both indices and detailed info
|
|
1594
1701
|
*/
|
|
1702
|
+
private fuzzySearchWithInfo;
|
|
1703
|
+
isBuilt(): boolean;
|
|
1704
|
+
getStats(): Promise<{
|
|
1705
|
+
totalDocuments: number;
|
|
1706
|
+
}>;
|
|
1707
|
+
getBackendInfo(): SearchBackendInfo;
|
|
1708
|
+
getIndexState(): Promise<SearchIndexState>;
|
|
1709
|
+
searchByPriority(query: string, topK?: number): Promise<SearchResult$2[]>;
|
|
1595
1710
|
clearIndex(): void;
|
|
1596
1711
|
}
|
|
1597
1712
|
//#endregion
|
|
1598
|
-
//#region src/core/
|
|
1599
|
-
interface
|
|
1600
|
-
/** 技能目录路径 */
|
|
1713
|
+
//#region src/core/miniSearchAdapter.d.ts
|
|
1714
|
+
interface MiniSearchAdapterOptions {
|
|
1601
1715
|
skillDir: string;
|
|
1602
|
-
/** ChromaDB 集合名称 */
|
|
1603
|
-
collectionName: string;
|
|
1604
|
-
/** 启动超时时间(毫秒) */
|
|
1605
|
-
startupTimeout?: number;
|
|
1606
|
-
/** 是否启用自动回退 */
|
|
1607
|
-
enableFallback?: boolean;
|
|
1608
1716
|
}
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
private options;
|
|
1617
|
-
private isIndexBuilt;
|
|
1618
|
-
private embeddingFunction;
|
|
1619
|
-
constructor(options: ChromaSearchOptions);
|
|
1620
|
-
/**
|
|
1621
|
-
* 统一准备ChromaDB环境
|
|
1622
|
-
* 封装服务器启动、客户端创建和配置的通用逻辑
|
|
1623
|
-
*/
|
|
1624
|
-
private prepareChromadb;
|
|
1625
|
-
/**
|
|
1626
|
-
* 安全关闭ChromaDB服务器
|
|
1627
|
-
*/
|
|
1628
|
-
private safeShutdownServer;
|
|
1629
|
-
search(query: string, options?: SearchOptions$1): Promise<SearchResult$2[]>;
|
|
1630
|
-
/**
|
|
1631
|
-
* 计算当前文件的hash映射 {filename: hash}
|
|
1632
|
-
*/
|
|
1633
|
-
private calculateFileHashes;
|
|
1634
|
-
/**
|
|
1635
|
-
* 加载之前的文件hash缓存
|
|
1636
|
-
*/
|
|
1637
|
-
private loadFileHashCache;
|
|
1638
|
-
/**
|
|
1639
|
-
* 保存文件hash缓存
|
|
1640
|
-
*/
|
|
1641
|
-
private saveFileHashCache;
|
|
1642
|
-
/**
|
|
1643
|
-
* 分析文件变化
|
|
1644
|
-
*/
|
|
1645
|
-
private analyzeFileChanges;
|
|
1646
|
-
/**
|
|
1647
|
-
* 获取或创建集合
|
|
1648
|
-
*/
|
|
1649
|
-
private getOrCreateCollection;
|
|
1650
|
-
/**
|
|
1651
|
-
* 处理文件变化
|
|
1652
|
-
*/
|
|
1653
|
-
private processFileChanges;
|
|
1717
|
+
declare class MiniSearchAdapter implements SearchEngine {
|
|
1718
|
+
private readonly options;
|
|
1719
|
+
private index;
|
|
1720
|
+
private documents;
|
|
1721
|
+
private indexState;
|
|
1722
|
+
constructor(options: MiniSearchAdapterOptions);
|
|
1723
|
+
initialize(): Promise<void>;
|
|
1654
1724
|
buildIndex(referencesDir: string): Promise<void>;
|
|
1655
|
-
|
|
1725
|
+
search(query: string, options?: SearchOptions$1): Promise<SearchResult$2[]>;
|
|
1726
|
+
getBackendInfo(): SearchBackendInfo;
|
|
1656
1727
|
isBuilt(): boolean;
|
|
1657
1728
|
getStats(): Promise<{
|
|
1658
1729
|
totalDocuments: number;
|
|
1659
1730
|
}>;
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1731
|
+
getIndexState(): Promise<SearchIndexState>;
|
|
1732
|
+
clearIndex(): void;
|
|
1733
|
+
private createIndex;
|
|
1734
|
+
private getSearchDir;
|
|
1735
|
+
private ensureSearchDir;
|
|
1736
|
+
private getIndexFilePath;
|
|
1737
|
+
private getStateFilePath;
|
|
1738
|
+
private loadPersistedIndexIfAvailable;
|
|
1739
|
+
private persistIndex;
|
|
1740
|
+
private loadDocuments;
|
|
1741
|
+
private calculateReferencesHash;
|
|
1742
|
+
private rerankResults;
|
|
1743
|
+
private normalizeQueryTokens;
|
|
1744
|
+
private calculateCoverage;
|
|
1745
|
+
private calculatePathCoverage;
|
|
1746
|
+
private calculateTermDensity;
|
|
1747
|
+
private extractQueryPhrases;
|
|
1748
|
+
private calculatePhraseCoverage;
|
|
1749
|
+
private calculateProximityScore;
|
|
1750
|
+
private findSubstringPositions;
|
|
1751
|
+
private calibrateRawScore;
|
|
1752
|
+
private tokensLooselyMatch;
|
|
1666
1753
|
}
|
|
1667
1754
|
//#endregion
|
|
1668
|
-
//#region src/core/
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1755
|
+
//#region src/core/embeddingFunctions.d.ts
|
|
1756
|
+
interface EmbeddingFunction {
|
|
1757
|
+
generate(input: string[]): Promise<number[][]>;
|
|
1758
|
+
}
|
|
1759
|
+
//#endregion
|
|
1760
|
+
//#region src/core/sqliteVectorSearchAdapter.d.ts
|
|
1761
|
+
interface SqliteVectorSearchAdapterOptions {
|
|
1762
|
+
skillDir: string;
|
|
1763
|
+
embeddingDimensions?: number;
|
|
1764
|
+
embeddingFunction?: EmbeddingFunction;
|
|
1765
|
+
embedderMode?: string;
|
|
1766
|
+
candidateMultiplier?: number;
|
|
1767
|
+
minCandidateLimit?: number;
|
|
1768
|
+
}
|
|
1769
|
+
declare class SqliteVectorSearchAdapter implements SearchEngine {
|
|
1770
|
+
private readonly options;
|
|
1771
|
+
private db;
|
|
1772
|
+
private indexState;
|
|
1773
|
+
private embedder;
|
|
1774
|
+
constructor(options: SqliteVectorSearchAdapterOptions);
|
|
1775
|
+
initialize(): Promise<void>;
|
|
1678
1776
|
buildIndex(referencesDir: string): Promise<void>;
|
|
1679
1777
|
search(query: string, options?: SearchOptions$1): Promise<SearchResult$2[]>;
|
|
1680
|
-
|
|
1681
|
-
* Basic fuzzy search using uFuzzy
|
|
1682
|
-
*/
|
|
1683
|
-
private fuzzySearch;
|
|
1684
|
-
/**
|
|
1685
|
-
* Enhanced fuzzy search that returns both indices and detailed info
|
|
1686
|
-
*/
|
|
1687
|
-
private fuzzySearchWithInfo;
|
|
1778
|
+
getBackendInfo(): SearchBackendInfo;
|
|
1688
1779
|
isBuilt(): boolean;
|
|
1689
1780
|
getStats(): Promise<{
|
|
1690
1781
|
totalDocuments: number;
|
|
1691
1782
|
}>;
|
|
1692
|
-
|
|
1783
|
+
getIndexState(): Promise<SearchIndexState>;
|
|
1693
1784
|
clearIndex(): void;
|
|
1785
|
+
private getSearchDir;
|
|
1786
|
+
private getEmbeddingDimensions;
|
|
1787
|
+
private ensureSearchDir;
|
|
1788
|
+
private getDbPath;
|
|
1789
|
+
private getStateFilePath;
|
|
1790
|
+
private prepareSchema;
|
|
1791
|
+
private loadIndexState;
|
|
1792
|
+
private persistIndexState;
|
|
1793
|
+
private loadDocuments;
|
|
1794
|
+
private calculateReferencesHash;
|
|
1795
|
+
private loadRuntimeDependencies;
|
|
1796
|
+
static isRuntimeSupported(): Promise<boolean>;
|
|
1797
|
+
private ensureEmbedder;
|
|
1798
|
+
private rerankRows;
|
|
1799
|
+
private normalizeQueryTokens;
|
|
1800
|
+
private extractQueryPhrases;
|
|
1801
|
+
private calculateCoverage;
|
|
1802
|
+
private calculatePathCoverage;
|
|
1803
|
+
private calculatePhraseCoverage;
|
|
1804
|
+
private calculateProximityScore;
|
|
1805
|
+
private findSubstringPositions;
|
|
1806
|
+
private tokensLooselyMatch;
|
|
1807
|
+
private scoreTokenMatch;
|
|
1808
|
+
private normalizeDocumentContent;
|
|
1694
1809
|
}
|
|
1695
1810
|
//#endregion
|
|
1696
1811
|
//#region src/search_format/types.d.ts
|
|
@@ -1707,8 +1822,14 @@ interface FormattableSearchResult extends SearchResult$2 {
|
|
|
1707
1822
|
/** Display tier information */
|
|
1708
1823
|
metadata: SearchResult$2['metadata'] & {
|
|
1709
1824
|
displayTier?: 'full' | 'preview' | 'metadata-only';
|
|
1825
|
+
displayRank?: number;
|
|
1826
|
+
displayScore?: number;
|
|
1827
|
+
sourceRank?: 'primary' | 'secondary';
|
|
1710
1828
|
maxScore?: number;
|
|
1711
1829
|
averageScore?: number;
|
|
1830
|
+
qualityScore?: number;
|
|
1831
|
+
relativeScore?: number;
|
|
1832
|
+
queryCoverage?: number;
|
|
1712
1833
|
matchRanges?: number[][];
|
|
1713
1834
|
};
|
|
1714
1835
|
}
|
|
@@ -1728,8 +1849,8 @@ interface FormattedResult {
|
|
|
1728
1849
|
//#endregion
|
|
1729
1850
|
//#region src/core/searchEngineFactory.d.ts
|
|
1730
1851
|
interface SearchEngineOptions {
|
|
1731
|
-
/** Search mode
|
|
1732
|
-
mode?:
|
|
1852
|
+
/** Search mode */
|
|
1853
|
+
mode?: SearchMode;
|
|
1733
1854
|
/** Skill directory for file operations */
|
|
1734
1855
|
skillDir?: string;
|
|
1735
1856
|
/** References directory containing documentation */
|
|
@@ -1738,12 +1859,10 @@ interface SearchEngineOptions {
|
|
|
1738
1859
|
config?: SkillConfig;
|
|
1739
1860
|
/** Additional options for adapters */
|
|
1740
1861
|
adapterOptions?: {
|
|
1741
|
-
/** Enable ChromaDB fallback on failure */
|
|
1742
|
-
enableChromaFallback?: boolean;
|
|
1743
|
-
/** ChromaDB startup timeout */
|
|
1744
|
-
chromaStartupTimeout?: number;
|
|
1745
1862
|
/** Auto search quality threshold */
|
|
1746
1863
|
qualityThreshold?: number;
|
|
1864
|
+
/** Explicit vector embedder mode */
|
|
1865
|
+
vectorEmbedder?: string;
|
|
1747
1866
|
};
|
|
1748
1867
|
}
|
|
1749
1868
|
//#endregion
|
|
@@ -1799,6 +1918,8 @@ declare class UnifiedSearchEngine {
|
|
|
1799
1918
|
getStats(): Promise<{
|
|
1800
1919
|
totalDocuments: number;
|
|
1801
1920
|
}>;
|
|
1921
|
+
getBackendInfo(): Promise<SearchBackendInfo | null>;
|
|
1922
|
+
getIndexState(): Promise<SearchIndexState | null>;
|
|
1802
1923
|
/**
|
|
1803
1924
|
* Clear search index
|
|
1804
1925
|
*/
|
|
@@ -1812,20 +1933,25 @@ declare class UnifiedSearchEngine {
|
|
|
1812
1933
|
//#region src/core/contentManager.d.ts
|
|
1813
1934
|
interface ContentManagerOptions {
|
|
1814
1935
|
searchEngine: {
|
|
1936
|
+
initialize?(): Promise<void>;
|
|
1937
|
+
buildIndex?(referencesDir: string): Promise<void>;
|
|
1938
|
+
clearIndex?(): Promise<void> | void;
|
|
1815
1939
|
search(query: string, topK?: number, where?: any): Promise<any[]>;
|
|
1816
1940
|
};
|
|
1817
1941
|
referencesDir: string;
|
|
1942
|
+
fetchImpl?: typeof fetch;
|
|
1818
1943
|
}
|
|
1819
1944
|
declare class ContentManager {
|
|
1820
1945
|
private options;
|
|
1821
1946
|
private userDir;
|
|
1822
1947
|
private context7BaseDir;
|
|
1823
|
-
private md;
|
|
1824
1948
|
constructor(options: ContentManagerOptions);
|
|
1825
1949
|
/**
|
|
1826
1950
|
* Get the directory path for a specific context7 project
|
|
1827
1951
|
*/
|
|
1828
1952
|
private getContext7ProjectDir;
|
|
1953
|
+
private encodeContext7ProjectId;
|
|
1954
|
+
private decodeContext7ProjectId;
|
|
1829
1955
|
updateFromContext7(libraryId: string, force?: boolean): Promise<UpdateContext7Result>;
|
|
1830
1956
|
addUserContent(options: {
|
|
1831
1957
|
title: string;
|
|
@@ -1846,10 +1972,29 @@ declare class ContentManager {
|
|
|
1846
1972
|
private createUniqueFilePath;
|
|
1847
1973
|
private findSimilarContent;
|
|
1848
1974
|
private isContentEnhanced;
|
|
1975
|
+
private isContentDuplicate;
|
|
1976
|
+
private normalizeContentForComparison;
|
|
1977
|
+
private getSimilarityScore;
|
|
1978
|
+
private mergeSimilarResults;
|
|
1979
|
+
private findDirectUserMatches;
|
|
1980
|
+
private findUserFileByTitle;
|
|
1981
|
+
private findBestUserMergeTarget;
|
|
1982
|
+
private calculateTokenOverlap;
|
|
1983
|
+
private getSourcePriority;
|
|
1984
|
+
private clamp01;
|
|
1985
|
+
private summarizeSimilarContent;
|
|
1986
|
+
private resolveSearchResultFilePath;
|
|
1987
|
+
private getExpectedUserFilePath;
|
|
1988
|
+
private renderKnowledgeNote;
|
|
1989
|
+
private appendKnowledgeUpdate;
|
|
1990
|
+
private getNextKnowledgeUpdateIndex;
|
|
1991
|
+
private stripMatchingLeadingHeading;
|
|
1992
|
+
private writeUserContentFile;
|
|
1849
1993
|
private getHashFilePath;
|
|
1850
1994
|
private saveContentHash;
|
|
1851
1995
|
private needsUpdate;
|
|
1852
|
-
private
|
|
1996
|
+
private prepareSearchEngine;
|
|
1997
|
+
private invalidateSearchIndex;
|
|
1853
1998
|
/**
|
|
1854
1999
|
* List all context7 projects
|
|
1855
2000
|
*/
|
|
@@ -1891,6 +2036,8 @@ interface SearchOptions {
|
|
|
1891
2036
|
minScore?: number;
|
|
1892
2037
|
}
|
|
1893
2038
|
declare class PackageUtils {
|
|
2039
|
+
private static getRegistryBaseUrl;
|
|
2040
|
+
private static getSearchBaseUrl;
|
|
1894
2041
|
/**
|
|
1895
2042
|
* Get package version from npm registry
|
|
1896
2043
|
*/
|
|
@@ -1924,7 +2071,7 @@ declare class PackageUtils {
|
|
|
1924
2071
|
[key: string]: any;
|
|
1925
2072
|
} | null;
|
|
1926
2073
|
/**
|
|
1927
|
-
* Format version according to
|
|
2074
|
+
* Format version according to the skill directory naming rules.
|
|
1928
2075
|
*/
|
|
1929
2076
|
static formatVersion(version: string): string;
|
|
1930
2077
|
/**
|
|
@@ -1960,5 +2107,52 @@ declare class PackageUtils {
|
|
|
1960
2107
|
} | null>;
|
|
1961
2108
|
}
|
|
1962
2109
|
//#endregion
|
|
1963
|
-
|
|
2110
|
+
//#region src/utils/context7.d.ts
|
|
2111
|
+
declare const Context7SearchCandidateSchema: ZodObject<{
|
|
2112
|
+
id: ZodString;
|
|
2113
|
+
title: ZodString;
|
|
2114
|
+
description: ZodDefault<ZodOptional<ZodString>>;
|
|
2115
|
+
branch: ZodOptional<ZodString>;
|
|
2116
|
+
lastUpdateDate: ZodOptional<ZodString>;
|
|
2117
|
+
state: ZodOptional<ZodString>;
|
|
2118
|
+
totalTokens: ZodDefault<ZodOptional<ZodNumber>>;
|
|
2119
|
+
totalSnippets: ZodDefault<ZodOptional<ZodNumber>>;
|
|
2120
|
+
stars: ZodDefault<ZodOptional<ZodNumber>>;
|
|
2121
|
+
trustScore: ZodDefault<ZodOptional<ZodNumber>>;
|
|
2122
|
+
benchmarkScore: ZodDefault<ZodOptional<ZodNumber>>;
|
|
2123
|
+
versions: ZodDefault<ZodOptional<ZodArray<ZodString>>>;
|
|
2124
|
+
}, $strip>;
|
|
2125
|
+
type Context7SearchCandidate = output<typeof Context7SearchCandidateSchema>;
|
|
2126
|
+
interface ResolvedContext7Candidate extends Context7SearchCandidate {
|
|
2127
|
+
matchKind: 'package-path' | 'package-slug' | 'website' | 'other';
|
|
2128
|
+
versionMatched: boolean;
|
|
2129
|
+
selectionScore: number;
|
|
2130
|
+
}
|
|
2131
|
+
interface ResolveContext7Result {
|
|
2132
|
+
packageName: string;
|
|
2133
|
+
version?: string;
|
|
2134
|
+
query: string;
|
|
2135
|
+
bestMatch: ResolvedContext7Candidate;
|
|
2136
|
+
candidates: ResolvedContext7Candidate[];
|
|
2137
|
+
}
|
|
2138
|
+
interface ResolveContext7Options {
|
|
2139
|
+
version?: string;
|
|
2140
|
+
limit?: number;
|
|
2141
|
+
fetchImpl?: typeof fetch;
|
|
2142
|
+
}
|
|
2143
|
+
declare class Context7Utils {
|
|
2144
|
+
static resolveLibrary(packageName: string, options?: ResolveContext7Options): Promise<ResolveContext7Result | null>;
|
|
2145
|
+
static createSearchQuery(packageName: string, version?: string): string;
|
|
2146
|
+
private static searchLibraries;
|
|
2147
|
+
private static getLibrarySearchNames;
|
|
2148
|
+
private static getPackageBaseName;
|
|
2149
|
+
private static tokenizeIdentifier;
|
|
2150
|
+
private static acceptBestMatch;
|
|
2151
|
+
private static annotateCandidate;
|
|
2152
|
+
private static classifyCandidate;
|
|
2153
|
+
private static matchesVersion;
|
|
2154
|
+
private static getCandidateMergeScore;
|
|
2155
|
+
}
|
|
2156
|
+
//#endregion
|
|
2157
|
+
export { type AddContentCommandResult, type AddContentResult, type BuildIndexCommandResult, type CommandIndexingResult, Config, type ContentItem, ContentManager, type ContentStats, type Context7Library, type Context7ResolvedLibrary, Context7Utils, type CreateSkillOptions, type CreateSkillResult, type DownloadContext7CommandResult, FuzzySearchAdapter, MiniSearchAdapter, PackageUtils, type PackageVersion, type SearchBackendInfo, type SearchEngine, type SearchIndexState, type SearchMode, type SearchResult, type SkillConfig, SkillCreator, SqliteVectorSearchAdapter, UnifiedSearchEngine, type UpdateContext7Result };
|
|
1964
2158
|
//# sourceMappingURL=index.d.mts.map
|