@xynogen/pix-find 0.1.11 → 0.1.12
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 +1 -1
- package/src/extension.ts +1 -5
- package/src/find.ts +8 -27
package/package.json
CHANGED
package/src/extension.ts
CHANGED
|
@@ -4,11 +4,7 @@ import {
|
|
|
4
4
|
type FindToolInput,
|
|
5
5
|
} from "@earendil-works/pi-coding-agent";
|
|
6
6
|
import { CursorStore, fffState } from "@xynogen/pix-pretty/fff";
|
|
7
|
-
import type {
|
|
8
|
-
PiPrettyApi,
|
|
9
|
-
TextComponentCtor,
|
|
10
|
-
ToolFactory,
|
|
11
|
-
} from "@xynogen/pix-pretty/types";
|
|
7
|
+
import type { PiPrettyApi, TextComponentCtor, ToolFactory } from "@xynogen/pix-pretty/types";
|
|
12
8
|
import { shortPath } from "@xynogen/pix-pretty/utils";
|
|
13
9
|
import { registerFindTool } from "./find.js";
|
|
14
10
|
import { once } from "./once.ts";
|
package/src/find.ts
CHANGED
|
@@ -58,12 +58,9 @@ export function registerFindTool(
|
|
|
58
58
|
const { items, totalMatched } = searchResult.value;
|
|
59
59
|
const trimmed = items.slice(0, effectiveLimit);
|
|
60
60
|
const notices: string[] = [];
|
|
61
|
-
if (fffState.partialIndex)
|
|
62
|
-
|
|
63
|
-
if (trimmed.length
|
|
64
|
-
notices.push(`${effectiveLimit} limit reached`);
|
|
65
|
-
if (totalMatched > trimmed.length)
|
|
66
|
-
notices.push(`${totalMatched} total matches`);
|
|
61
|
+
if (fffState.partialIndex) notices.push("Warning: partial file index");
|
|
62
|
+
if (trimmed.length >= effectiveLimit) notices.push(`${effectiveLimit} limit reached`);
|
|
63
|
+
if (totalMatched > trimmed.length) notices.push(`${totalMatched} total matches`);
|
|
67
64
|
|
|
68
65
|
const textContent = appendNotices(
|
|
69
66
|
trimmed.map((item) => item.relativePath).join("\n"),
|
|
@@ -82,17 +79,9 @@ export function registerFindTool(
|
|
|
82
79
|
}
|
|
83
80
|
|
|
84
81
|
// SDK fallback
|
|
85
|
-
const result = await origFind.execute(
|
|
86
|
-
tid,
|
|
87
|
-
params,
|
|
88
|
-
sig,
|
|
89
|
-
upd as never,
|
|
90
|
-
toolCtx,
|
|
91
|
-
);
|
|
82
|
+
const result = await origFind.execute(tid, params, sig, upd as never, toolCtx);
|
|
92
83
|
const textContent = getTextContent(result);
|
|
93
|
-
const matchCount = textContent
|
|
94
|
-
? textContent.trim().split("\n").filter(Boolean).length
|
|
95
|
-
: 0;
|
|
84
|
+
const matchCount = textContent ? textContent.trim().split("\n").filter(Boolean).length : 0;
|
|
96
85
|
|
|
97
86
|
setResultDetails<FindResultDetails>(result, {
|
|
98
87
|
_type: "findResult",
|
|
@@ -104,15 +93,9 @@ export function registerFindTool(
|
|
|
104
93
|
return result;
|
|
105
94
|
},
|
|
106
95
|
|
|
107
|
-
renderCall(
|
|
108
|
-
args: FindParams,
|
|
109
|
-
theme: ThemeLike,
|
|
110
|
-
renderCtx: RenderContextLike,
|
|
111
|
-
) {
|
|
96
|
+
renderCall(args: FindParams, theme: ThemeLike, renderCtx: RenderContextLike) {
|
|
112
97
|
const pattern = args.pattern ?? "";
|
|
113
|
-
const path = args.path
|
|
114
|
-
? ` ${theme.fg("muted", `in ${sp(args.path)}`)}`
|
|
115
|
-
: "";
|
|
98
|
+
const path = args.path ? ` ${theme.fg("muted", `in ${sp(args.path)}`)}` : "";
|
|
116
99
|
const text = renderCtx.lastComponent ?? new TextComponent("", 0, 0);
|
|
117
100
|
text.setText(
|
|
118
101
|
fillToolBackground(
|
|
@@ -140,9 +123,7 @@ export function registerFindTool(
|
|
|
140
123
|
if (tickCollapse("find", cs, renderCtx.invalidate)) {
|
|
141
124
|
const d = result.details;
|
|
142
125
|
const summary =
|
|
143
|
-
d?._type === "findResult" && d.matchCount != null
|
|
144
|
-
? `${d.matchCount} files`
|
|
145
|
-
: "found";
|
|
126
|
+
d?._type === "findResult" && d.matchCount != null ? `${d.matchCount} files` : "found";
|
|
146
127
|
text.setText(fillToolBackground(` ${theme.fg("muted", summary)}`));
|
|
147
128
|
return text;
|
|
148
129
|
}
|