@xynogen/pix-find 0.1.0 → 0.1.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 ADDED
@@ -0,0 +1,25 @@
1
+ # pix-find
2
+
3
+ Pi tool — glob file search with FFF acceleration.
4
+
5
+ ## What it does
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 with file icons, match counts, and a dim preview of the top hits. Call labels show the glob pattern and search directory inline. Depends on `@xynogen/pix-pretty`, installed automatically as a dependency.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pi install npm:@xynogen/pix-find
13
+ ```
14
+
15
+ ## Full distro
16
+
17
+ To install the complete pix suite (all packages + Pi itself):
18
+
19
+ ```bash
20
+ curl -fsSL https://raw.githubusercontent.com/xynogen/pix-mono/main/scripts/install.sh | sh
21
+ ```
22
+
23
+ ## License
24
+
25
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-find",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Pi tool — glob file search",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/extension.ts CHANGED
@@ -5,35 +5,37 @@ import type {
5
5
  TextComponentCtor,
6
6
  } from "@xynogen/pix-pretty/types";
7
7
  import { shortPath } from "@xynogen/pix-pretty/utils";
8
-
9
8
  import { registerFindTool } from "./find.js";
9
+ import { once } from "./once.ts";
10
10
 
11
11
  export default function pixFindExtension(pi: PiPrettyApi): void {
12
- let sdk: PiPrettySdk;
13
- try {
14
- sdk = require("@earendil-works/pi-coding-agent");
15
- } catch {
16
- return;
17
- }
12
+ once("pix-find", () => {
13
+ let sdk: PiPrettySdk;
14
+ try {
15
+ sdk = require("@earendil-works/pi-coding-agent");
16
+ } catch {
17
+ return;
18
+ }
18
19
 
19
- const createFindTool = sdk.createFindToolDefinition ?? sdk.createFindTool;
20
- if (!createFindTool) return;
20
+ const createFindTool = sdk.createFindToolDefinition ?? sdk.createFindTool;
21
+ if (!createFindTool) return;
21
22
 
22
- let TextComponent: TextComponentCtor;
23
- try {
24
- TextComponent = require("@earendil-works/pi-tui").Text;
25
- } catch {
26
- return;
27
- }
23
+ let TextComponent: TextComponentCtor;
24
+ try {
25
+ TextComponent = require("@earendil-works/pi-tui").Text;
26
+ } catch {
27
+ return;
28
+ }
28
29
 
29
- const cwd = process.cwd();
30
- const home = process.env.HOME ?? "";
30
+ const cwd = process.cwd();
31
+ const home = process.env.HOME ?? "";
31
32
 
32
- registerFindTool(pi, createFindTool, {
33
- cwd,
34
- sp: (p: string) => shortPath(cwd, home, p),
35
- TextComponent,
36
- fffState,
37
- cursorStore: new CursorStore(),
33
+ registerFindTool(pi, createFindTool, {
34
+ cwd,
35
+ sp: (p: string) => shortPath(cwd, home, p),
36
+ TextComponent,
37
+ fffState,
38
+ cursorStore: new CursorStore(),
39
+ });
38
40
  });
39
41
  }
package/src/once.ts ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Idempotency guard for extension activation.
3
+ *
4
+ * pix-core (the meta-package) invokes this package's factory in addition to a
5
+ * possible direct install. Pi's loader uses jiti with `moduleCache: false`, so
6
+ * each load pass re-evaluates modules — a plain module-level flag would not be
7
+ * shared. The dedupe key therefore lives on `globalThis`, which persists for
8
+ * the lifetime of the process across all load passes.
9
+ */
10
+ export function once(key: string, fn: () => void): void {
11
+ const g = globalThis as { __pixLoaded?: Set<string> };
12
+ const loaded = (g.__pixLoaded ??= new Set<string>());
13
+ if (loaded.has(key)) return;
14
+ loaded.add(key);
15
+ fn();
16
+ }