@xynogen/pix-find 0.1.15 → 0.1.17
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 +4 -3
- package/src/extension.ts +1 -1
- package/src/find.ts +3 -0
- package/src/once.ts +0 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xynogen/pix-find",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "Pi tool — glob file search",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -34,8 +34,9 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@xynogen/pix-
|
|
38
|
-
"@xynogen/pix-
|
|
37
|
+
"@xynogen/pix-data": "^0.3.4",
|
|
38
|
+
"@xynogen/pix-pretty": "^1.7.22",
|
|
39
|
+
"@xynogen/pix-runtime": "^0.1.1"
|
|
39
40
|
},
|
|
40
41
|
"peerDependencies": {
|
|
41
42
|
"@earendil-works/pi-coding-agent": "*"
|
package/src/extension.ts
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
import { CursorStore, fffState } from "@xynogen/pix-pretty/fff";
|
|
7
7
|
import type { PiPrettyApi, TextComponentCtor, ToolFactory } from "@xynogen/pix-pretty/types";
|
|
8
8
|
import { shortPath } from "@xynogen/pix-pretty/utils";
|
|
9
|
+
import { once } from "@xynogen/pix-runtime/once";
|
|
9
10
|
import { registerFindTool } from "./find.js";
|
|
10
|
-
import { once } from "./once.ts";
|
|
11
11
|
|
|
12
12
|
export default function pixFindExtension(pi: PiPrettyApi): void {
|
|
13
13
|
once(pi, "pix-find", () => {
|
package/src/find.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
ToolRenderResultOptions,
|
|
5
5
|
} from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { type CollapseState, tickCollapse } from "@xynogen/pix-data/collapse";
|
|
7
|
+
import { resolveBaseBackground } from "@xynogen/pix-pretty/ansi";
|
|
7
8
|
import type { ToolContext } from "@xynogen/pix-pretty/context";
|
|
8
9
|
import type {
|
|
9
10
|
FindParams,
|
|
@@ -108,6 +109,7 @@ export function registerFindTool(
|
|
|
108
109
|
},
|
|
109
110
|
|
|
110
111
|
renderCall(args: FindParams, theme: ThemeLike, renderCtx: RenderContextLike) {
|
|
112
|
+
resolveBaseBackground(theme);
|
|
111
113
|
const pattern = args.pattern ?? "";
|
|
112
114
|
const path = args.path ? ` ${theme.fg("muted", `in ${sp(args.path)}`)}` : "";
|
|
113
115
|
const text = renderCtx.lastComponent ?? new TextComponent("", 0, 0);
|
|
@@ -131,6 +133,7 @@ export function registerFindTool(
|
|
|
131
133
|
theme: ThemeLike,
|
|
132
134
|
renderCtx: RenderContextLike,
|
|
133
135
|
) {
|
|
136
|
+
resolveBaseBackground(theme);
|
|
134
137
|
const text = renderCtx.lastComponent ?? new TextComponent("", 0, 0);
|
|
135
138
|
const d = result.details;
|
|
136
139
|
const isPartial = _opt?.isPartial === true;
|
package/src/once.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-instance idempotency guard for extension activation.
|
|
3
|
-
*
|
|
4
|
-
* pix-core (the meta-package) invokes this package's factory, and a standalone
|
|
5
|
-
* install makes Pi invoke it again — sometimes against the SAME `pi`. We must
|
|
6
|
-
* dedupe that. But Pi rebuilds the extension runtime on /new, /resume, /fork,
|
|
7
|
-
* and /reload, handing the factory a BRAND-NEW `pi`; that must re-register.
|
|
8
|
-
*
|
|
9
|
-
* Keying the registry on the `pi` instance satisfies both: same instance =>
|
|
10
|
-
* skip, new instance => run. The registry lives on globalThis because jiti
|
|
11
|
-
* (`moduleCache: false`) re-evaluates this module on every load pass, so a
|
|
12
|
-
* module-scoped WeakMap would not be shared between the aggregator pass and the
|
|
13
|
-
* standalone pass within a single session.
|
|
14
|
-
*/
|
|
15
|
-
export function once(pi: object, key: string, fn: () => void): void {
|
|
16
|
-
const g = globalThis as { __pixOnce?: WeakMap<object, Set<string>> };
|
|
17
|
-
if (!g.__pixOnce) g.__pixOnce = new WeakMap<object, Set<string>>();
|
|
18
|
-
const registry = g.__pixOnce;
|
|
19
|
-
let loaded = registry.get(pi);
|
|
20
|
-
if (!loaded) {
|
|
21
|
-
loaded = new Set<string>();
|
|
22
|
-
registry.set(pi, loaded);
|
|
23
|
-
}
|
|
24
|
-
if (loaded.has(key)) return;
|
|
25
|
-
loaded.add(key);
|
|
26
|
-
fn();
|
|
27
|
-
}
|