@xynogen/pix-edit 0.1.13 → 0.1.14

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/edit.ts +16 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-edit",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Pi tool — precise text replacement edit with diff rendering",
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": "^1.7.9",
37
+ "@xynogen/pix-pretty": "^1.7.20",
38
38
  "@xynogen/pix-data": "^0.3.0"
39
39
  },
40
40
  "peerDependencies": {
package/src/edit.ts CHANGED
@@ -30,7 +30,9 @@ import type {
30
30
  import {
31
31
  fillToolBackground,
32
32
  getTextContent,
33
+ hideCollapsedToolCall,
33
34
  isTextContent,
35
+ renderCollapsedToolRow,
34
36
  renderToolError,
35
37
  setResultDetails,
36
38
  termW,
@@ -171,6 +173,12 @@ export function registerEditTool(
171
173
  const fp = args?.path ?? args?.file_path ?? "";
172
174
  const operations = getEditOperations(args);
173
175
  const text = renderCtx.lastComponent ?? new TextComponent("", 0, 0);
176
+ if (
177
+ hideCollapsedToolCall(renderCtx.state as CollapseState, renderCtx.expanded, (value) =>
178
+ text.setText(value),
179
+ )
180
+ )
181
+ return text;
174
182
  const hdr = `${theme.fg("toolTitle", theme.bold("edit"))} ${theme.fg("accent", sp(fp))}`;
175
183
 
176
184
  if (operations.length === 0) {
@@ -204,9 +212,15 @@ export function registerEditTool(
204
212
  d?._type === "editInfo"
205
213
  ? (d.summary as string)
206
214
  : d?._type === "multiEditInfo"
207
- ? `${d.editCount} edits ${d.summary}`
215
+ ? `${d.editCount} edits · ${d.summary}`
208
216
  : "edited";
209
- text.setText(fillToolBackground(` ${theme.fg("muted", summary)}`));
217
+ let filePath = "";
218
+ if (d?._type === "editInfo") filePath = String(d.filePath ?? "");
219
+ else if (d?._type === "multiEditInfo") {
220
+ const ops = d.ops as Array<Record<string, unknown>> | undefined;
221
+ filePath = String(ops?.[0]?.filePath ?? "");
222
+ }
223
+ text.setText(renderCollapsedToolRow(theme, "edit", sp(filePath), summary));
210
224
  return text;
211
225
  }
212
226