@xynogen/pix-edit 0.2.5 → 0.2.7
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/LICENSE +21 -0
- package/README.md +8 -8
- package/package.json +2 -2
- package/src/edit.ts +4 -1
- package/src/extension.ts +6 -11
- package/src/index.ts +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 xynogen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -28,22 +28,22 @@ Set `collapse.tools.edit: false` to disable for this tool only. See `@xynogen/pi
|
|
|
28
28
|
pi install npm:@xynogen/pix-edit
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
>
|
|
32
|
-
>
|
|
33
|
-
> ```bash
|
|
34
|
-
> pi install npm:@xynogen/pix-core
|
|
35
|
-
> ```
|
|
31
|
+
> Bundled in [`@xynogen/pix-core`](https://www.npmjs.com/package/@xynogen/pix-core). Install it alone only if you do not use pix-core.
|
|
36
32
|
|
|
37
33
|
## Full distro
|
|
38
34
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
To install the complete pix suite (all packages + Pi itself):
|
|
35
|
+
This package is part of [Pix](https://github.com/xynogen/pix-mono). The installer sets up Pi and the full distro. See [Install](https://github.com/xynogen/pix-mono#install) for the notes for each OS.
|
|
42
36
|
|
|
43
37
|
```bash
|
|
38
|
+
# Linux / macOS
|
|
44
39
|
curl -fsSL https://raw.githubusercontent.com/xynogen/pix-mono/main/scripts/install.sh | sh
|
|
45
40
|
```
|
|
46
41
|
|
|
42
|
+
```powershell
|
|
43
|
+
# Windows
|
|
44
|
+
irm https://raw.githubusercontent.com/xynogen/pix-mono/main/scripts/install.ps1 | iex
|
|
45
|
+
```
|
|
46
|
+
|
|
47
47
|
## License
|
|
48
48
|
|
|
49
49
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xynogen/pix-edit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Pi tool — precise text replacement edit with diff rendering",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@xynogen/pix-pretty": "^1.25.0",
|
|
43
|
-
"@xynogen/pix-runtime": "^0.
|
|
43
|
+
"@xynogen/pix-runtime": "^0.12.2"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@earendil-works/pi-coding-agent": "*",
|
package/src/edit.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
dotJoin,
|
|
32
32
|
fillToolBackground,
|
|
33
33
|
frameToolResult,
|
|
34
|
+
getErrorMessage,
|
|
34
35
|
getTextContent,
|
|
35
36
|
hideCollapsedToolCall,
|
|
36
37
|
isTextContent,
|
|
@@ -118,6 +119,8 @@ export function registerEditTool(
|
|
|
118
119
|
pi.registerTool({
|
|
119
120
|
...origEdit,
|
|
120
121
|
name: "edit",
|
|
122
|
+
// The edit description and schema already carry these rules. Drop the <rules> copy (~110 tokens/turn).
|
|
123
|
+
promptGuidelines: [],
|
|
121
124
|
renderShell: "self",
|
|
122
125
|
|
|
123
126
|
async execute(
|
|
@@ -142,7 +145,7 @@ export function registerEditTool(
|
|
|
142
145
|
toolCtx,
|
|
143
146
|
)) as ToolResultLike;
|
|
144
147
|
} catch (error) {
|
|
145
|
-
const text =
|
|
148
|
+
const text = getErrorMessage(error);
|
|
146
149
|
if (sig?.aborted || /aborted/i.test(text)) throw error;
|
|
147
150
|
return {
|
|
148
151
|
content: [{ type: "text" as const, text }],
|
package/src/extension.ts
CHANGED
|
@@ -4,12 +4,14 @@ import {
|
|
|
4
4
|
type EditToolInput,
|
|
5
5
|
type ExtensionAPI,
|
|
6
6
|
} from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
7
8
|
import { CursorStore, fffState } from "@xynogen/pix-pretty/fff";
|
|
8
9
|
import { attachResizeListener, trackInvalidator } from "@xynogen/pix-pretty/resize";
|
|
9
|
-
import type { PiPrettyApi,
|
|
10
|
+
import type { PiPrettyApi, ToolFactory } from "@xynogen/pix-pretty/types";
|
|
10
11
|
import { shortPath, viewportTextConstructor } from "@xynogen/pix-pretty/utils";
|
|
11
12
|
import { once } from "@xynogen/pix-runtime/once";
|
|
12
|
-
import {
|
|
13
|
+
import { homeDir } from "@xynogen/pix-runtime/paths";
|
|
14
|
+
import { registerEditTool } from "./edit.ts";
|
|
13
15
|
|
|
14
16
|
export default function pixEditExtension(pi: ExtensionAPI): void {
|
|
15
17
|
const prettyPi = pi as unknown as PiPrettyApi;
|
|
@@ -18,15 +20,8 @@ export default function pixEditExtension(pi: ExtensionAPI): void {
|
|
|
18
20
|
createEditToolFallback) as unknown as ToolFactory<EditToolInput>;
|
|
19
21
|
if (!createEditTool) return;
|
|
20
22
|
|
|
21
|
-
let TextComponent: TextComponentCtor;
|
|
22
|
-
try {
|
|
23
|
-
TextComponent = require("@earendil-works/pi-tui").Text;
|
|
24
|
-
} catch {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
23
|
const cwd = process.cwd();
|
|
29
|
-
const home =
|
|
24
|
+
const home = homeDir();
|
|
30
25
|
|
|
31
26
|
attachResizeListener();
|
|
32
27
|
|
|
@@ -36,7 +31,7 @@ export default function pixEditExtension(pi: ExtensionAPI): void {
|
|
|
36
31
|
{
|
|
37
32
|
cwd,
|
|
38
33
|
sp: (p: string) => shortPath(cwd, home, p),
|
|
39
|
-
TextComponent: viewportTextConstructor(
|
|
34
|
+
TextComponent: viewportTextConstructor(Text),
|
|
40
35
|
fffState,
|
|
41
36
|
cursorStore: new CursorStore(),
|
|
42
37
|
},
|
package/src/index.ts
CHANGED