@oh-my-pi/pi-tui 13.16.0 → 13.16.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/CHANGELOG.md +12 -0
- package/package.json +3 -3
- package/src/autocomplete.ts +14 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [13.16.1] - 2026-03-27
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Support for optional SearchDb parameter in CombinedAutocompleteProvider constructor for improved fuzzy search performance
|
|
10
|
+
- Fuzzy matching filter for autocomplete suggestions to improve relevance of results
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Fuzzy discovery now applies fuzzy matching filter to results for improved relevance of autocomplete suggestions
|
|
15
|
+
- Autocomplete fuzzy discovery now accepts optional SearchDb instance for faster searches
|
|
16
|
+
|
|
5
17
|
## [13.16.0] - 2026-03-27
|
|
6
18
|
### Changed
|
|
7
19
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-tui",
|
|
4
|
-
"version": "13.16.
|
|
4
|
+
"version": "13.16.1",
|
|
5
5
|
"description": "Terminal User Interface library with differential rendering for efficient text-based applications",
|
|
6
6
|
"homepage": "https://github.com/can1357/oh-my-pi",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"test": "bun test test/*.test.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@oh-my-pi/pi-natives": "13.16.
|
|
37
|
-
"@oh-my-pi/pi-utils": "13.16.
|
|
36
|
+
"@oh-my-pi/pi-natives": "13.16.1",
|
|
37
|
+
"@oh-my-pi/pi-utils": "13.16.1",
|
|
38
38
|
"marked": "^17.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
package/src/autocomplete.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as os from "node:os";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
+
import type { SearchDb } from "@oh-my-pi/pi-natives";
|
|
4
5
|
import { fuzzyFind } from "@oh-my-pi/pi-natives";
|
|
5
6
|
import { getProjectDir } from "@oh-my-pi/pi-utils";
|
|
6
7
|
|
|
@@ -203,11 +204,17 @@ export class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|
|
203
204
|
// per-directory readdir fast-path for prefix completions. Global fuzzy
|
|
204
205
|
// discovery continues to use native fuzzyFind + shared scan cache.
|
|
205
206
|
#dirCache: Map<string, { entries: fs.Dirent[]; timestamp: number }> = new Map();
|
|
207
|
+
#searchDb?: SearchDb;
|
|
206
208
|
readonly #DIR_CACHE_TTL = 2000; // 2 seconds
|
|
207
209
|
|
|
208
|
-
constructor(
|
|
210
|
+
constructor(
|
|
211
|
+
commands: (SlashCommand | AutocompleteItem)[] = [],
|
|
212
|
+
basePath: string = getProjectDir(),
|
|
213
|
+
searchDb?: SearchDb,
|
|
214
|
+
) {
|
|
209
215
|
this.#commands = commands;
|
|
210
216
|
this.#basePath = basePath;
|
|
217
|
+
this.#searchDb = searchDb;
|
|
211
218
|
}
|
|
212
219
|
|
|
213
220
|
async getSuggestions(
|
|
@@ -675,11 +682,15 @@ export class CombinedAutocompleteProvider implements AutocompleteProvider {
|
|
|
675
682
|
const scopedQuery = await this.#resolveScopedFuzzyQuery(query);
|
|
676
683
|
const searchPath = scopedQuery?.baseDir ?? this.#basePath;
|
|
677
684
|
const fuzzyQuery = scopedQuery?.query ?? query;
|
|
678
|
-
const result = await fuzzyFind(buildAutocompleteFuzzyDiscoveryProfile(fuzzyQuery, searchPath));
|
|
685
|
+
const result = await fuzzyFind(buildAutocompleteFuzzyDiscoveryProfile(fuzzyQuery, searchPath), this.#searchDb);
|
|
686
|
+
const lowerQuery = fuzzyQuery.toLowerCase();
|
|
679
687
|
const filteredMatches = result.matches.filter(entry => {
|
|
680
688
|
const p = entry.path.endsWith("/") ? entry.path.slice(0, -1) : entry.path;
|
|
681
689
|
const normalized = p.replaceAll("\\", "/");
|
|
682
|
-
|
|
690
|
+
if (/(^|\/)\.git(\/|$)/.test(normalized)) {
|
|
691
|
+
return false;
|
|
692
|
+
}
|
|
693
|
+
return lowerQuery.length === 0 || fuzzyMatch(lowerQuery, normalized.toLowerCase());
|
|
683
694
|
});
|
|
684
695
|
const topEntries = filteredMatches.slice(0, 20);
|
|
685
696
|
const suggestions: AutocompleteItem[] = [];
|