@edxeth/pi-fff 0.7.2-edxeth.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 +152 -0
- package/package.json +54 -0
- package/src/index.ts +1281 -0
- package/src/query.ts +87 -0
package/README.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# @ff-labs/pi-fff
|
|
2
|
+
|
|
3
|
+
A [pi](https://github.com/badlogic/pi-mono) extension that replaces the built-in `find` and `grep` tools with [FFF](https://github.com/dmtrKovalenko/fff.nvim) — a Rust-native, SIMD-accelerated file finder with built-in memory.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
| Built-in tool | pi-fff replacement | Improvement |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| `find` (spawns `fd`) | `fffind` (FFF `fileSearch`) | Fuzzy matching, frecency ranking, git-aware, pre-indexed |
|
|
10
|
+
| `grep` (spawns `rg`) | `ffgrep` (FFF `grep`) | SIMD-accelerated, frecency-ordered, mmap-cached, no subprocess |
|
|
11
|
+
| *(none)* | `fff-multi-grep` (FFF `multiGrep`) | OR-logic multi-pattern search via Aho-Corasick |
|
|
12
|
+
| `@` file autocomplete (fd-backed) | `@` file autocomplete (FFF-backed, default) | Fuzzy ranking from FFF index/frecency |
|
|
13
|
+
|
|
14
|
+
### Key advantages over built-in tools
|
|
15
|
+
|
|
16
|
+
- **No subprocess spawning** — FFF is a Rust native library called through the Node binding. No `fd`/`rg` process per call.
|
|
17
|
+
- **Pre-indexed** — files are indexed in the background at session start. Searches are instant.
|
|
18
|
+
- **Frecency ranking** — files you access often rank higher. Learns across sessions.
|
|
19
|
+
- **Query history** — remembers which files were selected for which queries. Combo boost.
|
|
20
|
+
- **Git-aware** — modified/staged/untracked files are boosted in results.
|
|
21
|
+
- **Smart case** — case-insensitive when query is all lowercase, case-sensitive otherwise.
|
|
22
|
+
- **Fuzzy file search** — `find` uses fuzzy matching, not glob-only. Typo-tolerant.
|
|
23
|
+
- **Cursor pagination** — grep results include a cursor for fetching the next page.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
Requirements:
|
|
28
|
+
- pi
|
|
29
|
+
|
|
30
|
+
### Install as a pi package
|
|
31
|
+
|
|
32
|
+
**Via npm (recommended):**
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pi install npm:@ff-labs/pi-fff
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Project-local install:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pi install -l npm:@ff-labs/pi-fff
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Via git:**
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pi install git:github.com/dmtrKovalenko/fff.nvim
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Pin to a release:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pi install git:github.com/dmtrKovalenko/fff.nvim@v0.3.0
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Local development / manual install
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
git clone https://github.com/dmtrKovalenko/fff.nvim.git
|
|
60
|
+
cd fff.nvim/packages/pi-fff
|
|
61
|
+
npm install
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Then add to your pi `settings.json`:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"extensions": ["/path/to/fff.nvim/packages/pi-fff/src/index.ts"]
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Or test directly:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pi -e /path/to/fff.nvim/packages/pi-fff/src/index.ts
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
This extension registers FFF-powered tools (`fffind`, `ffgrep`, `fff-multi-grep`) alongside pi's built-in tools.
|
|
79
|
+
|
|
80
|
+
## Tools
|
|
81
|
+
|
|
82
|
+
### `ffgrep`
|
|
83
|
+
|
|
84
|
+
Search file contents. Smart case, plain text by default, regex optional.
|
|
85
|
+
|
|
86
|
+
Parameters:
|
|
87
|
+
- `pattern` — search text or regex
|
|
88
|
+
- `path` — directory/file constraint (e.g. `src/`, `*.ts`)
|
|
89
|
+
- `ignoreCase` — force case-insensitive
|
|
90
|
+
- `literal` — treat as literal string (default: true)
|
|
91
|
+
- `context` — context lines around matches
|
|
92
|
+
- `limit` — max matches (default: 100)
|
|
93
|
+
- `cursor` — pagination cursor from previous result
|
|
94
|
+
|
|
95
|
+
### `fffind`
|
|
96
|
+
|
|
97
|
+
Fuzzy file name search. Frecency-ranked.
|
|
98
|
+
|
|
99
|
+
Parameters:
|
|
100
|
+
- `pattern` — fuzzy query (e.g. `main.ts`, `src/ config`)
|
|
101
|
+
- `path` — directory constraint
|
|
102
|
+
- `limit` — max results (default: 200)
|
|
103
|
+
|
|
104
|
+
### `fff-multi-grep`
|
|
105
|
+
|
|
106
|
+
OR-logic multi-pattern content search. SIMD-accelerated Aho-Corasick.
|
|
107
|
+
|
|
108
|
+
Parameters:
|
|
109
|
+
- `patterns` — array of literal patterns (OR logic)
|
|
110
|
+
- `constraints` — file constraints (e.g. `*.{ts,tsx} !test/`)
|
|
111
|
+
- `context` — context lines
|
|
112
|
+
- `limit` — max matches (default: 100)
|
|
113
|
+
- `cursor` — pagination cursor
|
|
114
|
+
|
|
115
|
+
## Commands
|
|
116
|
+
|
|
117
|
+
- `/fff-health` — show FFF status (indexed files, git info, frecency/history DB status)
|
|
118
|
+
- `/fff-rescan` — trigger a file rescan
|
|
119
|
+
- `/fff-mode <mode>` — switch mode (tool name change requires restart)
|
|
120
|
+
|
|
121
|
+
## Modes
|
|
122
|
+
|
|
123
|
+
- `tools-and-ui` (default): registers `fffind`, `ffgrep`, `fff-multi-grep` as additional tools + FFF-backed `@` autocomplete
|
|
124
|
+
- `tools-only`: additional tools only; keep pi's default `@` autocomplete
|
|
125
|
+
- `override`: replaces pi's built-in `find`, `grep` and adds `multi_grep` + FFF-backed `@` autocomplete
|
|
126
|
+
|
|
127
|
+
Mode precedence:
|
|
128
|
+
1. `--fff-mode <mode>` CLI flag
|
|
129
|
+
2. `PI_FFF_MODE=<mode>` environment variable
|
|
130
|
+
3. default (`tools-and-ui`)
|
|
131
|
+
|
|
132
|
+
## Flags
|
|
133
|
+
|
|
134
|
+
- `--fff-mode <mode>` — set mode (see above)
|
|
135
|
+
- `--fff-frecency-db <path>` — path to frecency database (also: `FFF_FRECENCY_DB` env)
|
|
136
|
+
- `--fff-history-db <path>` — path to query history database (also: `FFF_HISTORY_DB` env)
|
|
137
|
+
|
|
138
|
+
## Data
|
|
139
|
+
|
|
140
|
+
When database paths are provided, FFF stores:
|
|
141
|
+
- frecency database — file access frequency/recency
|
|
142
|
+
- history database — query-to-file selection history
|
|
143
|
+
|
|
144
|
+
No project files are uploaded anywhere by this extension. It runs locally and only uses the configured LLM through pi itself.
|
|
145
|
+
|
|
146
|
+
## Security
|
|
147
|
+
|
|
148
|
+
- No shell execution
|
|
149
|
+
- No network calls in the extension code
|
|
150
|
+
- No telemetry
|
|
151
|
+
- No credential handling beyond whatever pi and your configured model provider already do
|
|
152
|
+
- Search state is stored locally under `~/.pi/agent/fff/`
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@edxeth/pi-fff",
|
|
3
|
+
"public": true,
|
|
4
|
+
"version": "0.7.2-edxeth.0",
|
|
5
|
+
"description": "pi extension: FFF-powered fuzzy file and content search",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/edxeth/fff.git",
|
|
11
|
+
"directory": "packages/pi-fff"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/edxeth/fff/tree/main/packages/pi-fff",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/edxeth/fff/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"pi",
|
|
19
|
+
"pi-package",
|
|
20
|
+
"pi-extension",
|
|
21
|
+
"fff",
|
|
22
|
+
"search",
|
|
23
|
+
"grep",
|
|
24
|
+
"fuzzy-search",
|
|
25
|
+
"ai-agent"
|
|
26
|
+
],
|
|
27
|
+
"pi": {
|
|
28
|
+
"extensions": [
|
|
29
|
+
"./src/index.ts"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"src"
|
|
34
|
+
],
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"test": "bun test test/",
|
|
40
|
+
"typecheck": "tsc --noEmit"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@edxeth/fff-node": "0.7.2-edxeth.0"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@mariozechner/pi-coding-agent": "*",
|
|
47
|
+
"@mariozechner/pi-tui": "*",
|
|
48
|
+
"@sinclair/typebox": "*"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^22.0.0",
|
|
52
|
+
"typescript": "^5.0.0"
|
|
53
|
+
}
|
|
54
|
+
}
|