pi-x-ide 1.3.0 → 1.4.1
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 +187 -104
- package/README.zh.md +187 -104
- package/dist/package.json +14 -5
- package/dist/src/nvim/sidecar-schema.d.ts +25 -0
- package/dist/src/nvim/sidecar-schema.js +64 -0
- package/dist/src/nvim/sidecar-schema.js.map +1 -0
- package/dist/src/nvim/sidecar.d.ts +16 -0
- package/dist/src/nvim/sidecar.js +173 -0
- package/dist/src/nvim/sidecar.js.map +1 -0
- package/dist/src/pi/install.js +13 -8
- package/dist/src/pi/install.js.map +1 -1
- package/dist/src/pi/zed.js +19 -12
- package/dist/src/pi/zed.js.map +1 -1
- package/dist/src/shared/config-options.d.ts +89 -0
- package/dist/src/shared/config-options.js +88 -0
- package/dist/src/shared/config-options.js.map +1 -0
- package/dist/src/shared/config.d.ts +7 -0
- package/dist/src/shared/config.js +51 -0
- package/dist/src/shared/config.js.map +1 -0
- package/dist/src/shared/ide-server.d.ts +20 -0
- package/dist/src/shared/ide-server.js +144 -0
- package/dist/src/shared/ide-server.js.map +1 -0
- package/dist/src/shared/lock-file.d.ts +16 -0
- package/dist/src/shared/lock-file.js +58 -0
- package/dist/src/shared/lock-file.js.map +1 -0
- package/dist/src/shared/paths.js +4 -3
- package/dist/src/shared/paths.js.map +1 -1
- package/dist/src/shared/protocol.d.ts +1 -1
- package/dist/src/shared/schema.js +1 -1
- package/dist/src/shared/schema.js.map +1 -1
- package/dist/test/install.test.js +13 -0
- package/dist/test/install.test.js.map +1 -1
- package/dist/test/nvim-sidecar.test.d.ts +1 -0
- package/dist/test/nvim-sidecar.test.js +148 -0
- package/dist/test/nvim-sidecar.test.js.map +1 -0
- package/dist/test/shared.test.js +37 -0
- package/dist/test/shared.test.js.map +1 -1
- package/dist/test/zed.test.js +12 -0
- package/dist/test/zed.test.js.map +1 -1
- package/nvim/bin/pi-x-ide-nvim-sidecar.cjs +21 -0
- package/nvim/doc/pi-x-ide.txt +112 -0
- package/nvim/lua/pi_x_ide/init.lua +442 -0
- package/nvim/plugin/pi-x-ide.lua +15 -0
- package/package.json +14 -5
- package/schemas/config.json +120 -0
- package/src/nvim/sidecar-schema.ts +71 -0
- package/src/nvim/sidecar.ts +219 -0
- package/src/pi/install.ts +13 -8
- package/src/pi/zed.ts +19 -12
- package/src/shared/config-options.ts +100 -0
- package/src/shared/config.ts +54 -0
- package/src/shared/ide-server.ts +120 -0
- package/src/shared/lock-file.ts +65 -0
- package/src/shared/paths.ts +4 -3
- package/src/shared/protocol.ts +1 -1
- package/src/shared/schema.ts +1 -1
package/README.md
CHANGED
|
@@ -1,120 +1,113 @@
|
|
|
1
1
|
# Pi × IDE
|
|
2
2
|
|
|
3
|
-
Pi extension package for IDE selection context integration.
|
|
3
|
+
> Pi extension package for IDE selection context integration.
|
|
4
4
|
|
|
5
|
-
Automatically attaches the currently opened or selected file and text range from VS Code
|
|
5
|
+
Automatically attaches the currently opened or selected file and text range from VS Code, Zed, and Neovim to the Pi TUI, submitting them as conversation context to the LLM.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
---
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
## Installation & Usage
|
|
10
|
+
|
|
11
|
+
### 1. Install Pi CLI
|
|
12
|
+
|
|
13
|
+
[Pi Quickstart](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/quickstart.md)
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
### 2. Install the Pi Extension Package
|
|
15
16
|
|
|
16
17
|
```bash
|
|
17
|
-
|
|
18
|
-
pnpm build
|
|
18
|
+
pi install npm:pi-x-ide
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
This installs `pi-x-ide` as a global Pi extension. Pi loads it automatically on startup — no flags needed.
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
| --------------------- | -------------------------------------------------------------------------------- |
|
|
25
|
-
| `pnpm build` | Build Pi-side TypeScript → `dist/` + VS Code-side esbuild bundle → `vscode/out/` |
|
|
26
|
-
| `pnpm typecheck` | Type-check only (no output files) |
|
|
27
|
-
| `pnpm test` | Build + run unit tests |
|
|
28
|
-
| `pnpm package:vscode` | Package VS Code extension as VSIX |
|
|
29
|
-
| `pnpm vsix` | Alias for `pnpm package:vscode` |
|
|
23
|
+
### 3. Install the IDE Extension
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
#### VS Code / Cursor / Windsurf
|
|
32
26
|
|
|
33
|
-
|
|
27
|
+
**Option A: Install from Marketplace (Recommended)**
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
2. Go to the **Run and Debug** panel (`Ctrl+Shift+D`).
|
|
37
|
-
3. Select **Run Pi x IDE VS Code Extension**.
|
|
38
|
-
4. Press **F5**:
|
|
39
|
-
- The `preLaunchTask` will automatically run `pnpm build`.
|
|
40
|
-
- A new VS Code window titled `[Extension Development Host]` opens.
|
|
29
|
+
Install `balaenis.pi-x-ide` from your IDE's Extensions marketplace.
|
|
41
30
|
|
|
42
|
-
|
|
31
|
+
**Option B: Install via Pi CLI**
|
|
43
32
|
|
|
44
|
-
|
|
45
|
-
pnpm package:vscode
|
|
46
|
-
code --install-extension './vscode'-0.1.0.vsix
|
|
47
|
-
```
|
|
33
|
+
In Pi's TUI, run `/ide install` — it auto-detects `code`, `cursor`, or `windsurf` and installs the extension.
|
|
48
34
|
|
|
49
|
-
|
|
35
|
+
**Option C: Auto-install on Pi startup**
|
|
50
36
|
|
|
51
|
-
|
|
37
|
+
When Pi starts from a supported VS Code integrated terminal, it attempts to auto-install or update the extension asynchronously. To disable:
|
|
52
38
|
|
|
53
39
|
```bash
|
|
54
|
-
|
|
40
|
+
PI_X_IDE_AUTO_INSTALL=0
|
|
55
41
|
```
|
|
56
42
|
|
|
57
|
-
|
|
43
|
+
See [Configuration Reference](#pi-side-environment-variables) for all available options.
|
|
58
44
|
|
|
59
|
-
|
|
45
|
+
#### Zed
|
|
60
46
|
|
|
61
|
-
|
|
47
|
+
No extension installation is needed. Pi automatically detects Zed when running inside a Zed terminal (`ZED_TERM=true` or `TERM_PROGRAM=zed`). Pi reads Zed's local state database to discover the active editor file and selection.
|
|
62
48
|
|
|
63
|
-
|
|
49
|
+
Requires Node.js ≥ 26 and Zed running on the same machine.
|
|
64
50
|
|
|
65
|
-
|
|
66
|
-
pi -e ./src/pi/index.ts
|
|
67
|
-
```
|
|
51
|
+
#### Neovim
|
|
68
52
|
|
|
69
|
-
|
|
53
|
+
Neovim support uses a Lua plugin plus a bundled Node.js sidecar. Pi can run from any terminal matching the Neovim workspace — it does not need to run inside Neovim.
|
|
70
54
|
|
|
71
|
-
|
|
72
|
-
- A widget below the input box showing: IDE name, workspace, current file, selection range, and `pending/sent` status
|
|
55
|
+
**lazy.nvim:**
|
|
73
56
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
57
|
+
```lua
|
|
58
|
+
{
|
|
59
|
+
"balaenis/pi-x-ide",
|
|
60
|
+
init = function()
|
|
61
|
+
vim.opt.rtp:prepend(vim.fn.stdpath("data") .. "/lazy/pi-x-ide/nvim")
|
|
62
|
+
end,
|
|
63
|
+
config = function()
|
|
64
|
+
require("pi_x_ide").setup({
|
|
65
|
+
keymap = "<C-A-k>",
|
|
66
|
+
})
|
|
67
|
+
end,
|
|
68
|
+
}
|
|
78
69
|
```
|
|
79
70
|
|
|
80
|
-
|
|
71
|
+
> **Note:** The `init` block manually adds the `nvim/` subdirectory to the runtime path to avoid a Lua module resolution issue with some lazy.nvim versions.
|
|
81
72
|
|
|
82
|
-
|
|
83
|
-
/ide auto
|
|
84
|
-
```
|
|
73
|
+
**Native package:**
|
|
85
74
|
|
|
86
|
-
|
|
75
|
+
```vim
|
|
76
|
+
set runtimepath+=/path/to/pi-x-ide/nvim
|
|
77
|
+
lua require("pi_x_ide").setup({ keymap = "<leader>pa" })
|
|
78
|
+
```
|
|
87
79
|
|
|
88
|
-
|
|
80
|
+
See [Configuration Reference](#neovim-2) for full setup options, commands, and troubleshooting.
|
|
89
81
|
|
|
90
|
-
###
|
|
82
|
+
### 4. Connect Pi & Verify
|
|
91
83
|
|
|
92
|
-
|
|
84
|
+
Start Pi in the **same project directory** as your IDE workspace:
|
|
93
85
|
|
|
86
|
+
```bash
|
|
87
|
+
pi
|
|
94
88
|
```
|
|
95
|
-
IDE: vscode ✓ src/foo.ts#L10,20 pending
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Manual Keyboard Shortcut
|
|
99
89
|
|
|
100
|
-
|
|
90
|
+
Pi auto-loads `pi-x-ide` and connects to your IDE. The TUI should display `IDE: vscode ✓` in the footer and a widget showing the IDE name, workspace, current file, and selection range.
|
|
101
91
|
|
|
102
|
-
|
|
103
|
-
- macOS: `Cmd+Alt+K`
|
|
92
|
+
**Verify it works:**
|
|
104
93
|
|
|
105
|
-
|
|
94
|
+
Open a file in your IDE and select some text. The widget should update in real time:
|
|
106
95
|
|
|
107
96
|
```
|
|
108
|
-
|
|
97
|
+
IDE: vscode ✓ src/foo.ts#L10,20 pending
|
|
109
98
|
```
|
|
110
99
|
|
|
111
|
-
|
|
100
|
+
Press `Ctrl+Alt+K` (Linux/Windows) or `Cmd+Alt+K` (macOS) — the Pi input box should insert `@src/foo.ts#L10,20`.
|
|
101
|
+
|
|
102
|
+
Type a chat prompt in Pi and submit it. The selected text is injected as LLM context (does not persist in session history). After submission, the widget shows `sent`.
|
|
112
103
|
|
|
113
|
-
|
|
104
|
+
**If the connection doesn't appear:**
|
|
114
105
|
|
|
115
|
-
|
|
106
|
+
- Run `/ide auto` in Pi to re-attempt matching.
|
|
107
|
+
- If the IDE was started after Pi, reload the IDE window and run `/ide auto` again.
|
|
108
|
+
- Run `/ide` to manually select a connection from the list.
|
|
116
109
|
|
|
117
|
-
|
|
110
|
+
### `/ide` Command Reference
|
|
118
111
|
|
|
119
112
|
| Command | Behavior |
|
|
120
113
|
| -------------- | ----------------------------------------------------------------- |
|
|
@@ -126,61 +119,151 @@ After submission, the TUI displays `sent`.
|
|
|
126
119
|
| `/ide attach` | Manually insert the latest selection range into the input box |
|
|
127
120
|
| `/ide install` | Install or update `balaenis.pi-x-ide` through a supported IDE CLI |
|
|
128
121
|
|
|
129
|
-
|
|
122
|
+
### Configuration Reference
|
|
123
|
+
|
|
124
|
+
#### VS Code
|
|
125
|
+
|
|
126
|
+
| Key | Type | Default | Description |
|
|
127
|
+
| -------------------- | --------------------- | --------- | --------------------------------------------- |
|
|
128
|
+
| `piXIde.rangeFormat` | `"comma"` \| `"dash"` | `"comma"` | File reference format for the manual shortcut |
|
|
129
|
+
|
|
130
|
+
#### Zed
|
|
131
|
+
|
|
132
|
+
| Environment Variable | Default | Description |
|
|
133
|
+
| -------------------- | ------------- | ------------------------------------ |
|
|
134
|
+
| `PI_X_IDE_ZED_DB` | (auto-detect) | Override path to Zed SQLite database |
|
|
135
|
+
|
|
136
|
+
Default database paths:
|
|
137
|
+
|
|
138
|
+
- **Linux:** `~/.local/share/zed/db/0-stable/db.sqlite`
|
|
139
|
+
- **macOS:** `~/Library/Application Support/Zed/db/0-stable/db.sqlite`
|
|
140
|
+
- **Windows:** `%LOCALAPPDATA%\Zed\db\0-stable\db.sqlite`
|
|
141
|
+
- **WSL with Windows Zed:** `/mnt/c/Users/<user>/AppData/Local/Zed/db/0-stable/db.sqlite`
|
|
142
|
+
|
|
143
|
+
When Pi runs in WSL and Zed runs as a Windows app, pi-x-ide normalizes Windows paths (`C:\Users\<user>\project`) to `/mnt/c/Users/<user>/project`, and matching WSL UNC paths to `/home/<user>/project`.
|
|
144
|
+
|
|
145
|
+
#### Neovim
|
|
146
|
+
|
|
147
|
+
```lua
|
|
148
|
+
require("pi_x_ide").setup({
|
|
149
|
+
enabled = true,
|
|
150
|
+
keymap = "<C-A-k>",
|
|
151
|
+
range_format = "comma", -- or "dash"
|
|
152
|
+
debounce_ms = 150,
|
|
153
|
+
-- sidecar_cmd = { "node", "/absolute/path/to/pi-x-ide-nvim-sidecar.cjs" },
|
|
154
|
+
-- workspace_folders = { "/path/to/project" },
|
|
155
|
+
})
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
If the sidecar does not start, run `:PiXIdeStatus`, confirm Node.js is available on Neovim's `PATH`, or set `sidecar_cmd` to an absolute Node command.
|
|
159
|
+
|
|
160
|
+
**Commands:**
|
|
161
|
+
|
|
162
|
+
| Command | Behavior |
|
|
163
|
+
| --------------- | ------------------------------------------------------------------- |
|
|
164
|
+
| `:PiXIdeStart` | Start the Neovim sidecar and write the lock file |
|
|
165
|
+
| `:PiXIdeStop` | Stop the sidecar and remove the lock file |
|
|
166
|
+
| `:PiXIdeStatus` | Show whether the sidecar is running |
|
|
167
|
+
| `:PiXIdeAttach` | Attach the current file or selection to Pi as `@relative/path#Lx,y` |
|
|
168
|
+
|
|
169
|
+
#### Pi-side Environment Variables
|
|
170
|
+
|
|
171
|
+
Pi-side variables can be set as real environment variables or in `~/.pi/config.json` under `env`. Real environment variables take precedence.
|
|
172
|
+
|
|
173
|
+
| Variable | Default | Description |
|
|
174
|
+
| ----------------------- | --------------------- | -------------------------------------------- |
|
|
175
|
+
| `PI_X_IDE_AUTO_INSTALL` | `1` | Auto-install VS Code extension on Pi startup |
|
|
176
|
+
| `PI_X_IDE_LOCK_DIR` | `~/.pi/pi-x-ide/lock` | Directory for IDE connection lock files |
|
|
177
|
+
| `PI_X_IDE_ZED_DB` | (auto-detect) | Override path to Zed SQLite database |
|
|
178
|
+
|
|
179
|
+
See [schemas/config.json](schemas/config.json) for editor schema guidance.
|
|
130
180
|
|
|
131
|
-
|
|
181
|
+
### Feature Parity
|
|
182
|
+
|
|
183
|
+
| Feature | VS Code | Zed | Neovim |
|
|
184
|
+
| ----------------------------------- | ----------------- | ------------------------------- | ----------------------------- |
|
|
185
|
+
| Live file tracking | ✅ Real-time push | ✅ 1s polling | ✅ Real-time push via sidecar |
|
|
186
|
+
| Live selection tracking | ✅ Real-time push | ✅ 1s polling | ✅ Real-time push via sidecar |
|
|
187
|
+
| `Ctrl+Alt+K` / `Cmd+Alt+K` shortcut | ✅ | Use `@<relative-path>` manually | User-configured keymap |
|
|
188
|
+
| LLM context injection | ✅ | ✅ | ✅ |
|
|
189
|
+
| `/ide auto` | ✅ | ✅ | ✅ |
|
|
190
|
+
|
|
191
|
+
### Lock File Protocol
|
|
192
|
+
|
|
193
|
+
After the IDE WebSocket server starts, connection information is written to `~/.pi/pi-x-ide/lock/` by default. Override the directory with `PI_X_IDE_LOCK_DIR`.
|
|
132
194
|
|
|
133
195
|
Pi uses `ctx.cwd` to find the longest path match against `workspaceFolders` in the lock files, selecting the best-matching and most recent IDE connection. Pi auto-connects only when the current `cwd` is inside or equal to one of the IDE `workspaceFolders`; if `cwd` is only a parent directory such as `~/`, run `/ide` to choose a connection manually.
|
|
134
196
|
|
|
135
197
|
See [docs/specs/ide-protocol.md](docs/specs/ide-protocol.md) for protocol details.
|
|
136
198
|
|
|
137
|
-
|
|
199
|
+
---
|
|
138
200
|
|
|
139
|
-
|
|
201
|
+
## Development
|
|
140
202
|
|
|
141
|
-
|
|
203
|
+
### Prerequisites
|
|
142
204
|
|
|
143
|
-
|
|
205
|
+
- Node.js ≥ 26
|
|
206
|
+
- pnpm ≥ 11 (`packageManager` declared as `pnpm@11.5.2`)
|
|
207
|
+
- VS Code ≥ 1.90 (VS Code extension only)
|
|
208
|
+
- Neovim ≥ 0.9 (Neovim plugin only)
|
|
144
209
|
|
|
145
|
-
|
|
146
|
-
| -------------------- | --------------------- | --------- | --------------------------------------------- |
|
|
147
|
-
| `piXIde.rangeFormat` | `"comma"` \| `"dash"` | `"comma"` | File reference format for the manual shortcut |
|
|
210
|
+
### Install & Build
|
|
148
211
|
|
|
149
|
-
|
|
212
|
+
Clone the repository, then build:
|
|
150
213
|
|
|
151
|
-
|
|
214
|
+
```bash
|
|
215
|
+
git clone https://github.com/balaenis/pi-x-ide.git
|
|
216
|
+
cd pi-x-ide
|
|
217
|
+
pnpm install
|
|
218
|
+
pnpm build
|
|
219
|
+
```
|
|
152
220
|
|
|
153
|
-
|
|
221
|
+
To load the local build without installing globally:
|
|
154
222
|
|
|
155
|
-
|
|
223
|
+
```bash
|
|
224
|
+
pi -e ./src/pi/index.ts
|
|
225
|
+
```
|
|
156
226
|
|
|
157
|
-
|
|
227
|
+
Common commands:
|
|
158
228
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
-
|
|
229
|
+
| Command | Description |
|
|
230
|
+
| --------------------- | -------------------------------------------------------------------------------------------------- |
|
|
231
|
+
| `pnpm build` | Build Pi-side TypeScript → `dist/` + Neovim sidecar → `nvim/bin/` + VS Code bundle → `vscode/out/` |
|
|
232
|
+
| `pnpm typecheck` | Type-check only (no output files) |
|
|
233
|
+
| `pnpm test` | Build + run unit tests |
|
|
234
|
+
| `pnpm package:vscode` | Package VS Code extension as VSIX |
|
|
235
|
+
| `pnpm vsix` | Alias for `pnpm package:vscode` |
|
|
162
236
|
|
|
163
|
-
###
|
|
237
|
+
### Testing the VS Code Extension Locally
|
|
164
238
|
|
|
165
|
-
|
|
166
|
-
| -------------------- | ------------- | ------------------------------------ |
|
|
167
|
-
| `PI_X_IDE_ZED_DB` | (auto-detect) | Override path to Zed SQLite database |
|
|
239
|
+
#### Option 1: F5 Extension Development Host (Recommended)
|
|
168
240
|
|
|
169
|
-
|
|
241
|
+
1. Open the **project root** in VS Code.
|
|
242
|
+
2. Go to the **Run and Debug** panel (`Ctrl+Shift+D`).
|
|
243
|
+
3. Select **Run Pi x IDE VS Code Extension**.
|
|
244
|
+
4. Press **F5**:
|
|
245
|
+
- The `preLaunchTask` automatically runs `pnpm build`.
|
|
246
|
+
- A new VS Code window titled `[Extension Development Host]` opens.
|
|
170
247
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
248
|
+
#### Option 2: Package VSIX and Install
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
pnpm package:vscode
|
|
252
|
+
code --install-extension './vscode'-0.1.0.vsix
|
|
253
|
+
```
|
|
175
254
|
|
|
176
|
-
|
|
255
|
+
The extension installed this way runs in all VS Code windows, independent of the F5 Extension Host.
|
|
177
256
|
|
|
178
|
-
|
|
257
|
+
#### Verify the Extension is Running
|
|
179
258
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
259
|
+
```bash
|
|
260
|
+
ls -l ~/.pi/pi-x-ide/lock
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
You should see a file like `vscode-12345-48123.lock`. If not, run **Developer: Reload Window** in VS Code.
|
|
264
|
+
|
|
265
|
+
### Release
|
|
266
|
+
|
|
267
|
+
This project uses [Release Please](https://github.com/googleapis/release-please) with [Conventional Commits](https://www.conventionalcommits.org/) to automate versioning and publishing.
|
|
268
|
+
|
|
269
|
+
See [RELEASE.md](RELEASE.md) for the full release guide.
|