@ff-labs/pi-fff 0.10.1 → 0.10.2-nightly.086044f
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/package.json +3 -3
- package/src/aux-finders.ts +3 -4
- package/src/index.ts +22 -16
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ff-labs/pi-fff",
|
|
3
3
|
"public": true,
|
|
4
|
-
"version": "0.10.
|
|
4
|
+
"version": "0.10.2-nightly.086044f",
|
|
5
5
|
"description": "pi extension: FFF-powered fuzzy file and content search",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"typecheck": "tsc --noEmit"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@ff-labs/fff-bun": "
|
|
44
|
-
"@ff-labs/fff-node": "
|
|
43
|
+
"@ff-labs/fff-bun": "0.10.2-nightly.086044f",
|
|
44
|
+
"@ff-labs/fff-node": "0.10.2-nightly.086044f"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@earendil-works/pi-coding-agent": "*",
|
package/src/aux-finders.ts
CHANGED
|
@@ -14,8 +14,6 @@ interface AuxPicker {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export interface AuxOpts {
|
|
17
|
-
frecencyDbPath?: string;
|
|
18
|
-
historyDbPath?: string;
|
|
19
17
|
enableFsRootScanning: boolean;
|
|
20
18
|
}
|
|
21
19
|
|
|
@@ -69,10 +67,11 @@ export class AuxFinderPool {
|
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
const { FileFinder } = await loadSdk();
|
|
70
|
+
// LMDB env can only be opened once per process; the main finder already
|
|
71
|
+
// owns the frecency/history DBs. Aux finders are transient and run without
|
|
72
|
+
// persistent scoring — see issue #700.
|
|
72
73
|
const result = FileFinder.create({
|
|
73
74
|
basePath: maybeRoot,
|
|
74
|
-
frecencyDbPath: this.opts.frecencyDbPath,
|
|
75
|
-
historyDbPath: this.opts.historyDbPath,
|
|
76
75
|
aiMode: true,
|
|
77
76
|
enableHomeDirScanning: true,
|
|
78
77
|
enableFsRootScanning: this.opts.enableFsRootScanning,
|
package/src/index.ts
CHANGED
|
@@ -344,8 +344,6 @@ export default function fffExtension(pi: ExtensionAPI) {
|
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
let auxPool = new AuxFinderPool({
|
|
347
|
-
frecencyDbPath,
|
|
348
|
-
historyDbPath,
|
|
349
347
|
enableFsRootScanning,
|
|
350
348
|
});
|
|
351
349
|
|
|
@@ -643,10 +641,10 @@ export default function fffExtension(pi: ExtensionAPI) {
|
|
|
643
641
|
description: `Grep file contents. Smart-case, auto-detects regex vs literal, git-aware. Results are ranked by frecency (most-accessed files first); matches within a file stay in source order. Default limit ${DEFAULT_GREP_LIMIT}.`,
|
|
644
642
|
promptSnippet: "Grep contents",
|
|
645
643
|
promptGuidelines: [
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
644
|
+
`${toolNames.grep}: prefer bare identifiers as patterns. Literal queries are most efficient.`,
|
|
645
|
+
`${toolNames.grep}: use path for include ('src/', '*.ts') and exclude for noise ('test/,*.min.js').`,
|
|
646
|
+
`${toolNames.grep}: caseSensitive: true when you need exact case (smart-case otherwise).`,
|
|
647
|
+
`${toolNames.grep}: after 1-2 greps, read the top match instead of more greps.`,
|
|
650
648
|
],
|
|
651
649
|
parameters: grepSchema,
|
|
652
650
|
|
|
@@ -724,7 +722,15 @@ export default function fffExtension(pi: ExtensionAPI) {
|
|
|
724
722
|
|
|
725
723
|
// automatic fuzzy fallback allows to broad the queries and find different cases
|
|
726
724
|
if (result.items.length === 0 && !params.cursor && mode !== "regex") {
|
|
727
|
-
|
|
725
|
+
// When the caller pinned a specific file (path has an extension), the
|
|
726
|
+
// fuzzy fallback broadens across the whole picker — the file may just
|
|
727
|
+
// be misnamed. For directory constraints (or no path), we keep the
|
|
728
|
+
// constrained query so the fallback does not leak matches from
|
|
729
|
+
// excluded / out-of-scope directories.
|
|
730
|
+
const lastSeg = params.path?.split(/[\\/]/).pop() ?? "";
|
|
731
|
+
const pathTargetsFile = /\.[a-zA-Z][a-zA-Z0-9]{0,9}$/.test(lastSeg);
|
|
732
|
+
const fuzzyQuery = pathTargetsFile ? pattern : query;
|
|
733
|
+
const fuzzy = picker.grep(fuzzyQuery, {
|
|
728
734
|
mode: "fuzzy",
|
|
729
735
|
smartCase,
|
|
730
736
|
maxMatchesPerFile: Math.min(effectiveLimit, 50),
|
|
@@ -822,12 +828,12 @@ export default function fffExtension(pi: ExtensionAPI) {
|
|
|
822
828
|
description: `Fuzzy path search and glob search. Matches against the whole repo-relative path, not just the filename. Frecency-ranked, git-aware. Multi-word = narrower (AND). Default limit ${DEFAULT_FIND_LIMIT}.`,
|
|
823
829
|
promptSnippet: "Find files by path or glob",
|
|
824
830
|
promptGuidelines: [
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
+
`${toolNames.find}: matches the WHOLE path, not just the filename — \`profile\` hits \`chrome/browser/profiles/x.cc\` too.`,
|
|
832
|
+
`${toolNames.find}: keep queries to 1-2 terms; extra words narrow.`,
|
|
833
|
+
`${toolNames.find}: use for paths, not content. Use ${toolNames.grep} for content.`,
|
|
834
|
+
`${toolNames.find}: for exact path matches use a glob in \`path\` — e.g. path: '**/profile.h' for exact filename, or path: 'src/**/profile.h' scoped to a subtree. Bare patterns are fuzzy.`,
|
|
835
|
+
`${toolNames.find}: to list everything inside a directory, pass path: 'dir/**' with an empty or wildcard pattern instead of using pattern alone.`,
|
|
836
|
+
`${toolNames.find}: use exclude: 'test/,*.min.js' to cut noise in large repos.`,
|
|
831
837
|
],
|
|
832
838
|
parameters: findSchema,
|
|
833
839
|
|
|
@@ -968,9 +974,9 @@ export default function fffExtension(pi: ExtensionAPI) {
|
|
|
968
974
|
"Search file contents for ANY of multiple literal patterns (OR, SIMD Aho-Corasick). Faster than regex alternation.",
|
|
969
975
|
promptSnippet: "Multi-pattern OR content search",
|
|
970
976
|
promptGuidelines: [
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
977
|
+
`${toolNames.multiGrep}: use when searching for several identifiers at once.`,
|
|
978
|
+
`${toolNames.multiGrep}: include all naming-convention variants (snake/camel/Pascal).`,
|
|
979
|
+
`${toolNames.multiGrep}: patterns are literal. Use constraints for file filters.`,
|
|
974
980
|
],
|
|
975
981
|
parameters: multiGrepSchema,
|
|
976
982
|
|