@xynogen/pix-find 0.1.6 → 0.1.9
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 +1 -1
- package/package.json +2 -2
- package/src/find.test.ts +23 -5
- package/src/once.ts +2 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Pi tool — glob file search with FFF acceleration.
|
|
|
4
4
|
|
|
5
5
|
## What it does
|
|
6
6
|
|
|
7
|
-
Replaces Pi's default `find` tool with an enhanced version backed by `pix-pretty`. Uses FFF (frecency-ranked, SIMD-accelerated file finder) when available, falling back to the standard glob search. Results are rendered
|
|
7
|
+
Replaces Pi's default `find` tool with an enhanced version backed by `pix-pretty`. Uses FFF (frecency-ranked, SIMD-accelerated file finder) when available, falling back to the standard glob search. Results are rendered as a dim preview of the matched relative paths; the call label shows the glob pattern and search directory inline. The finder is shared with `pix-grep` (owned there) — install `pix-grep` alongside to actually populate the index. Depends on `@xynogen/pix-pretty`, installed automatically as a dependency.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xynogen/pix-find",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Pi tool — glob file search",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@xynogen/pix-pretty": "
|
|
37
|
+
"@xynogen/pix-pretty": "^1.7.9"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@earendil-works/pi-coding-agent": "*"
|
package/src/find.test.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from "bun:test";
|
|
2
|
+
import type { CursorStore, FffState } from "@xynogen/pix-pretty/fff";
|
|
3
|
+
import type { PiPrettyApi, TextComponentCtor } from "@xynogen/pix-pretty/types";
|
|
2
4
|
import { registerFindTool } from "./find";
|
|
3
5
|
|
|
4
6
|
class MockTextComponent {
|
|
@@ -14,15 +16,31 @@ class MockTextComponent {
|
|
|
14
16
|
describe("registerFindTool", () => {
|
|
15
17
|
it("registers a tool named 'find'", () => {
|
|
16
18
|
const tools: string[] = [];
|
|
19
|
+
const mockPi: PiPrettyApi = {
|
|
20
|
+
registerTool(t: unknown) {
|
|
21
|
+
tools.push((t as { name: string }).name);
|
|
22
|
+
},
|
|
23
|
+
registerCommand() {},
|
|
24
|
+
on() {},
|
|
25
|
+
};
|
|
26
|
+
|
|
17
27
|
registerFindTool(
|
|
18
|
-
|
|
19
|
-
() => ({ execute: async () => ({ content: [] }) })
|
|
28
|
+
mockPi,
|
|
29
|
+
() => ({ execute: async () => ({ content: [], details: undefined }) }),
|
|
20
30
|
{
|
|
21
31
|
cwd: process.cwd(),
|
|
22
32
|
sp: (p: string) => p,
|
|
23
|
-
TextComponent: MockTextComponent as
|
|
24
|
-
fffState: {
|
|
25
|
-
|
|
33
|
+
TextComponent: MockTextComponent as unknown as TextComponentCtor,
|
|
34
|
+
fffState: {
|
|
35
|
+
module: null,
|
|
36
|
+
finder: null,
|
|
37
|
+
partialIndex: false,
|
|
38
|
+
dbDir: null,
|
|
39
|
+
} satisfies FffState,
|
|
40
|
+
cursorStore: {
|
|
41
|
+
store: () => "",
|
|
42
|
+
get: () => undefined,
|
|
43
|
+
} as unknown as CursorStore,
|
|
26
44
|
},
|
|
27
45
|
);
|
|
28
46
|
expect(tools).toEqual(["find"]);
|
package/src/once.ts
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
*/
|
|
15
15
|
export function once(pi: object, key: string, fn: () => void): void {
|
|
16
16
|
const g = globalThis as { __pixOnce?: WeakMap<object, Set<string>> };
|
|
17
|
-
|
|
17
|
+
if (!g.__pixOnce) g.__pixOnce = new WeakMap<object, Set<string>>();
|
|
18
|
+
const registry = g.__pixOnce;
|
|
18
19
|
let loaded = registry.get(pi);
|
|
19
20
|
if (!loaded) {
|
|
20
21
|
loaded = new Set<string>();
|