pi-x-ide 1.13.1 → 1.14.0
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 +83 -24
- package/README.zh-CN.md +83 -24
- package/dist/package.json +5 -20
- package/dist/src/pi/connection.d.ts +8 -2
- package/dist/src/pi/connection.js +16 -7
- package/dist/src/pi/connection.js.map +1 -1
- package/dist/src/pi/discovery.d.ts +6 -1
- package/dist/src/pi/discovery.js +44 -9
- package/dist/src/pi/discovery.js.map +1 -1
- package/dist/src/pi/ide-host.d.ts +17 -0
- package/dist/src/pi/ide-host.js +72 -0
- package/dist/src/pi/ide-host.js.map +1 -0
- package/dist/src/pi/zed.d.ts +2 -1
- package/dist/src/pi/zed.js +8 -36
- package/dist/src/pi/zed.js.map +1 -1
- package/dist/src/shared/config-options.d.ts +4 -0
- package/dist/src/shared/config-options.js +4 -0
- package/dist/src/shared/config-options.js.map +1 -1
- package/dist/src/shared/format.d.ts +2 -0
- package/dist/src/shared/format.js +2 -2
- package/dist/src/shared/format.js.map +1 -1
- package/dist/src/shared/lock-file.d.ts +1 -0
- package/dist/src/shared/lock-file.js +1 -0
- package/dist/src/shared/lock-file.js.map +1 -1
- package/dist/src/shared/paths.d.ts +11 -3
- package/dist/src/shared/paths.js +52 -9
- package/dist/src/shared/paths.js.map +1 -1
- package/dist/src/shared/platform.d.ts +5 -0
- package/dist/src/shared/platform.js +77 -0
- package/dist/src/shared/platform.js.map +1 -0
- package/dist/src/shared/protocol.d.ts +2 -1
- package/dist/src/shared/protocol.js +2 -0
- package/dist/src/shared/protocol.js.map +1 -1
- package/dist/src/shared/schema.js +2 -1
- package/dist/src/shared/schema.js.map +1 -1
- package/dist/test/connection.test.js +104 -0
- package/dist/test/connection.test.js.map +1 -1
- package/dist/test/shared.test.js +275 -0
- package/dist/test/shared.test.js.map +1 -1
- package/package.json +5 -20
- package/schemas/config.json +4 -0
- package/src/pi/connection.ts +20 -6
- package/src/pi/discovery.ts +61 -9
- package/src/pi/ide-host.ts +82 -0
- package/src/pi/zed.ts +7 -33
- package/src/shared/config-options.ts +5 -0
- package/src/shared/format.ts +10 -4
- package/src/shared/lock-file.ts +2 -0
- package/src/shared/paths.ts +73 -9
- package/src/shared/platform.ts +79 -0
- package/src/shared/protocol.ts +4 -1
- package/src/shared/schema.ts +4 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
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, Zed, and
|
|
5
|
+
Automatically attaches the currently opened or selected file and text range from VS Code, Zed, Neovim, and JetBrains IDEs to the Pi TUI, submitting them as conversation context to the LLM.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -91,6 +91,28 @@ lua require("pi_x_ide").setup({ keymap = "<leader>pa" })
|
|
|
91
91
|
|
|
92
92
|
See [Configuration Reference](#neovim-2) for full setup options, commands, and troubleshooting.
|
|
93
93
|
|
|
94
|
+
#### JetBrains IDEs
|
|
95
|
+
|
|
96
|
+
JetBrains support is provided by the plugin project under `ide-plugins/jetbrains`. The MVP is installed manually: build a local ZIP and install it through the IDE, or run it in a sandbox IDE for development.
|
|
97
|
+
|
|
98
|
+
Run a sandbox IDE:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
cd ide-plugins/jetbrains
|
|
102
|
+
./gradlew runIde
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Build a plugin ZIP for manual installation:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
cd ide-plugins/jetbrains
|
|
109
|
+
./gradlew buildPlugin
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The ZIP is written to `ide-plugins/jetbrains/build/distributions/`. Install it from **Settings | Plugins | ⚙ | Install Plugin from Disk...**.
|
|
113
|
+
|
|
114
|
+
JetBrains MVP support includes live active-file tracking, live selection tracking, `Ctrl+Alt+K` / **Pi x IDE: Attach Selection**, Pi-side `/ide auto`, and **Pi x IDE: Open Pi Terminal**. Diagnostic Quick Fix actions and Pi-side automatic JetBrains plugin installation are not part of the MVP.
|
|
115
|
+
|
|
94
116
|
### Connect Pi & Verify
|
|
95
117
|
|
|
96
118
|
Start Pi in the **same project directory** as your IDE workspace:
|
|
@@ -99,7 +121,7 @@ Start Pi in the **same project directory** as your IDE workspace:
|
|
|
99
121
|
pi
|
|
100
122
|
```
|
|
101
123
|
|
|
102
|
-
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.
|
|
124
|
+
Pi auto-loads `pi-x-ide` and connects to your IDE. The TUI should display a connected IDE source such as `IDE: vscode ✓` or `IDE: jetbrains ✓` in the footer and a widget showing the IDE name, workspace, current file, and selection range.
|
|
103
125
|
|
|
104
126
|
**Verify it works:**
|
|
105
127
|
|
|
@@ -109,11 +131,11 @@ Open a file in your IDE and select some text. The widget should update in real t
|
|
|
109
131
|
IDE: vscode ✓ src/foo.ts#L10-L20 pending
|
|
110
132
|
```
|
|
111
133
|
|
|
112
|
-
Attach the selection from either side: press `Ctrl+Alt+K` (Linux/Windows) or `Cmd+Alt+K` (macOS) in a VS Code-family IDE, or focus the Pi TUI and press `Ctrl+Alt+K` / run `/ide attach`. The Pi input box should insert `@src/foo.ts#L10-L20`.
|
|
134
|
+
Attach the selection from either side: press `Ctrl+Alt+K` (Linux/Windows) or `Cmd+Alt+K` (macOS) in a VS Code-family IDE, press `Ctrl+Alt+K` or run **Pi x IDE: Attach Selection** in JetBrains, use `:PiXIdeAttach` in Neovim, or focus the Pi TUI and press `Ctrl+Alt+K` / run `/ide attach`. The Pi input box should insert `@src/foo.ts#L10-L20`.
|
|
113
135
|
|
|
114
136
|
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`.
|
|
115
137
|
|
|
116
|
-
For diagnostics in VS Code-family IDEs, connect Pi first, then place the cursor on an error or warning and open Quick Fix. The **Pi: Fix it** and **Pi: Send diagnostic** actions are shown only while at least one Pi client is connected. **Pi: Fix it** sends the diagnostic message, source range, nearby context lines, and related information to one connected Pi client and starts a diagnostic-analysis turn with a configurable prompt template (see [`fix_prompt`](#pi-side-configuration)). **Pi: Send diagnostic** sends the same context to one connected Pi client and pastes it into Pi's input box without starting a turn.
|
|
138
|
+
For diagnostics in VS Code-family IDEs, connect Pi first, then place the cursor on an error or warning and open Quick Fix. The **Pi: Fix it** and **Pi: Send diagnostic** actions are shown only while at least one Pi client is connected. **Pi: Fix it** sends the diagnostic message, source range, nearby context lines, and related information to one connected Pi client and starts a diagnostic-analysis turn with a configurable prompt template (see [`fix_prompt`](#pi-side-configuration)). **Pi: Send diagnostic** sends the same context to one connected Pi client and pastes it into Pi's input box without starting a turn. JetBrains does not provide diagnostic Quick Fix actions in the MVP.
|
|
117
139
|
|
|
118
140
|
**If the connection doesn't appear:**
|
|
119
141
|
|
|
@@ -121,6 +143,19 @@ For diagnostics in VS Code-family IDEs, connect Pi first, then place the cursor
|
|
|
121
143
|
- If the IDE was started after Pi, reload the IDE window and run `/ide auto` again.
|
|
122
144
|
- Run `/ide` to manually select a connection from the list.
|
|
123
145
|
|
|
146
|
+
### WSL2 IDE Discovery
|
|
147
|
+
|
|
148
|
+
VS Code Remote WSL works like a same-host setup: the extension host runs inside WSL, writes Linux-side lock files under `~/.pi/pi-x-ide/lock`, and binds the WebSocket server inside the WSL network namespace.
|
|
149
|
+
|
|
150
|
+
When Pi runs inside WSL2 and a native Windows IDE plugin is running on the Windows side, Pi also scans Windows user lock directories such as `/mnt/c/Users/<user>/.pi/pi-x-ide/lock`. New Windows-side lock files include `runningInWindows: true`; Pi uses that metadata to try the WSL default gateway before falling back to the lock file's `host` value. Windows and WSL UNC paths are normalized before workspace matching and before formatting `@file#Lx-Ly` mentions.
|
|
151
|
+
|
|
152
|
+
If your WSL networking mode, firewall, or endpoint security blocks the default gateway, set `PI_X_IDE_HOST_OVERRIDE`:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
PI_X_IDE_HOST_OVERRIDE=127.0.0.1 pi
|
|
156
|
+
PI_X_IDE_HOST_OVERRIDE=<windows-host-ip> pi
|
|
157
|
+
```
|
|
158
|
+
|
|
124
159
|
### `/ide` Command Reference
|
|
125
160
|
|
|
126
161
|
| Command | Behavior |
|
|
@@ -192,6 +227,7 @@ Pi-side variables can be set as real environment variables or in `~/.pi/pi-x-ide
|
|
|
192
227
|
| ------------------------------- | ------------- | ----------------------------------------------------------------------------------- |
|
|
193
228
|
| `PI_X_IDE_AUTO_INSTALL` | `1` | Auto-install VS Code extension on Pi startup |
|
|
194
229
|
| `PI_X_IDE_ATTACH_SHORTCUT` | `ctrl+alt+k` | Pi TUI shortcut for `/ide attach`; set to `off`, `none`, `false`, or `0` to disable |
|
|
230
|
+
| `PI_X_IDE_HOST_OVERRIDE` | (unset) | Override the host Pi uses for IDE WebSocket lock files; useful for WSL2 networking |
|
|
195
231
|
| `PI_X_IDE_ZED_DB` | (auto-detect) | Override path to Zed SQLite database |
|
|
196
232
|
| `PI_X_IDE_ZED_POLL_INTERVAL_MS` | `1000` | Zed SQLite polling interval, clamped to 100-2000 ms |
|
|
197
233
|
|
|
@@ -205,14 +241,16 @@ See [schemas/config.json](schemas/config.json) for editor schema guidance. A [co
|
|
|
205
241
|
|
|
206
242
|
### Feature Parity
|
|
207
243
|
|
|
208
|
-
| Feature | VS Code | Zed | Neovim |
|
|
209
|
-
| ---------------------------------------------------- | ----------------------- | ---------- | ----------------------------- |
|
|
210
|
-
| Live file tracking | ✅ Real-time push | ✅ polling | ✅ Real-time push via sidecar |
|
|
211
|
-
| Live selection tracking | ✅ Real-time push | ✅ polling | ✅ Real-time push via sidecar |
|
|
212
|
-
| IDE context attach shortcut | ✅ Default `Ctrl+Alt+K` | ❌ | ✅ Custom configured keymap |
|
|
213
|
-
| Pi TUI context attach shortcut(default `Ctrl+Alt+K`) | ✅ | ✅ | ✅ |
|
|
214
|
-
| LLM context injection | ✅ | ✅ | ✅ |
|
|
215
|
-
| `/ide auto` | ✅ | ✅ | ✅ |
|
|
244
|
+
| Feature | VS Code | Zed | Neovim | JetBrains |
|
|
245
|
+
| ---------------------------------------------------- | ----------------------- | ---------- | ----------------------------- | ----------------------- |
|
|
246
|
+
| Live file tracking | ✅ Real-time push | ✅ polling | ✅ Real-time push via sidecar | ✅ Real-time push |
|
|
247
|
+
| Live selection tracking | ✅ Real-time push | ✅ polling | ✅ Real-time push via sidecar | ✅ Real-time push |
|
|
248
|
+
| IDE context attach shortcut | ✅ Default `Ctrl+Alt+K` | ❌ | ✅ Custom configured keymap | ✅ Default `Ctrl+Alt+K` |
|
|
249
|
+
| Pi TUI context attach shortcut(default `Ctrl+Alt+K`) | ✅ | ✅ | ✅ | ✅ |
|
|
250
|
+
| LLM context injection | ✅ | ✅ | ✅ | ✅ |
|
|
251
|
+
| `/ide auto` | ✅ | ✅ | ✅ | ✅ |
|
|
252
|
+
| Diagnostic Quick Fix | ✅ | ❌ | ❌ | ❌ |
|
|
253
|
+
| Auto-install | ✅ VS Code-family only | N/A | ❌ | ❌ |
|
|
216
254
|
|
|
217
255
|
### Lock File Protocol
|
|
218
256
|
|
|
@@ -232,6 +270,7 @@ See [docs/specs/ide-protocol.md](docs/specs/ide-protocol.md) for protocol detail
|
|
|
232
270
|
- bun ≥ 1.3 (`packageManager` declared as `bun@1.3.14`)
|
|
233
271
|
- VS Code ≥ 1.120.0 (VS Code extension only)
|
|
234
272
|
- Neovim ≥ 0.9 (Neovim plugin only)
|
|
273
|
+
- JDK 21 (JetBrains plugin only; Gradle can download the toolchain automatically)
|
|
235
274
|
|
|
236
275
|
### Install & Build
|
|
237
276
|
|
|
@@ -240,8 +279,8 @@ Clone the repository, then build:
|
|
|
240
279
|
```bash
|
|
241
280
|
git clone https://github.com/balaenis/pi-x-ide.git
|
|
242
281
|
cd pi-x-ide
|
|
243
|
-
|
|
244
|
-
|
|
282
|
+
mise run setup
|
|
283
|
+
mise run build
|
|
245
284
|
```
|
|
246
285
|
|
|
247
286
|
To load the local build without installing globally:
|
|
@@ -250,15 +289,18 @@ To load the local build without installing globally:
|
|
|
250
289
|
pi -e ./src/pi/index.ts
|
|
251
290
|
```
|
|
252
291
|
|
|
253
|
-
All
|
|
292
|
+
All build and check commands are defined as `mise run` tasks (see `.mise/tasks/`):
|
|
254
293
|
|
|
255
|
-
| Command
|
|
256
|
-
|
|
|
257
|
-
| `
|
|
258
|
-
| `
|
|
259
|
-
| `
|
|
260
|
-
| `
|
|
261
|
-
| `
|
|
294
|
+
| Command | Description |
|
|
295
|
+
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
|
|
296
|
+
| `mise run build` | Build Pi-side TypeScript → `dist/` + Neovim sidecar → `ide-plugins/nvim/bin/` + VS Code bundle → `ide-plugins/vscode/out/` |
|
|
297
|
+
| `mise run typecheck` | Type-check only (no output files) |
|
|
298
|
+
| `mise run test` | Build + run unit tests |
|
|
299
|
+
| `mise run package:vsix` | Package VS Code extension as VSIX |
|
|
300
|
+
| `mise run compile:jetbrains` | Compile and test the JetBrains plugin with Gradle |
|
|
301
|
+
| `mise run package:jetbrains` | Package the JetBrains plugin ZIP under `ide-plugins/jetbrains/build/distributions/` |
|
|
302
|
+
| `mise run verify:jetbrains` | Run IntelliJ Plugin Verifier for the configured target IDE |
|
|
303
|
+
| `mise run check:config-schema` | Verify `schemas/config.json` is in sync with the config registry |
|
|
262
304
|
|
|
263
305
|
### Testing the VS Code Extension Locally
|
|
264
306
|
|
|
@@ -268,13 +310,13 @@ All `bun run` commands have equivalent `mise run` tasks (see `mise.toml`):
|
|
|
268
310
|
2. Go to the **Run and Debug** panel (`Ctrl+Shift+D`).
|
|
269
311
|
3. Select **Run Pi x IDE VS Code Extension**.
|
|
270
312
|
4. Press **F5**:
|
|
271
|
-
- The `preLaunchTask` automatically runs `
|
|
313
|
+
- The `preLaunchTask` automatically runs `mise run build`.
|
|
272
314
|
- A new VS Code window titled `[Extension Development Host]` opens.
|
|
273
315
|
|
|
274
316
|
#### Option 2: Package VSIX and Install
|
|
275
317
|
|
|
276
318
|
```bash
|
|
277
|
-
|
|
319
|
+
mise run package:vsix
|
|
278
320
|
cd ide-plugins/vscode && code --install-extension dist/pi-x-ide-$(node -p "require('./package.json').version").vsix
|
|
279
321
|
```
|
|
280
322
|
|
|
@@ -288,6 +330,23 @@ ls -l ~/.pi/pi-x-ide/lock
|
|
|
288
330
|
|
|
289
331
|
You should see a file like `vscode-12345-48123.lock`. If not, run **Developer: Reload Window** in VS Code.
|
|
290
332
|
|
|
333
|
+
### Testing the JetBrains Plugin Locally
|
|
334
|
+
|
|
335
|
+
Run a sandbox IDE:
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
cd ide-plugins/jetbrains
|
|
339
|
+
./gradlew runIde
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
Build the installable plugin ZIP:
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
mise run package:jetbrains
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
The ZIP is written under `ide-plugins/jetbrains/build/distributions/`. For a smoke test, open this repository in the sandbox IDE, start `pi` from the same directory, open and select text in a local file, then press `Ctrl+Alt+K` or run **Pi x IDE: Attach Selection**. Pi should receive an `@relative/path#Lx-Ly` mention.
|
|
349
|
+
|
|
291
350
|
### Release
|
|
292
351
|
|
|
293
352
|
This project uses [Release Please](https://github.com/googleapis/release-please) with [Conventional Commits](https://www.conventionalcommits.org/) to automate versioning and publishing.
|
package/README.zh-CN.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> 用于 IDE 选择上下文集成的 Pi 扩展包。
|
|
4
4
|
|
|
5
|
-
自动将 VS Code、Zed 和
|
|
5
|
+
自动将 VS Code、Zed、Neovim 和 JetBrains IDE 中当前打开或选中的文件与文本范围附加到 Pi TUI,并作为对话上下文提交给 LLM。
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -83,6 +83,28 @@ lua require("pi_x_ide").setup({ keymap = "<leader>pa" })
|
|
|
83
83
|
|
|
84
84
|
完整配置选项、命令和故障排查见 [配置参考](#neovim-2)。
|
|
85
85
|
|
|
86
|
+
#### JetBrains IDE
|
|
87
|
+
|
|
88
|
+
JetBrains 支持由 `ide-plugins/jetbrains` 下的插件项目提供。MVP 需要手动安装:可以构建本地 ZIP 后从 IDE 安装,也可以在开发用 sandbox IDE 中运行。
|
|
89
|
+
|
|
90
|
+
运行 sandbox IDE:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
cd ide-plugins/jetbrains
|
|
94
|
+
./gradlew runIde
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
构建用于手动安装的插件 ZIP:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
cd ide-plugins/jetbrains
|
|
101
|
+
./gradlew buildPlugin
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
ZIP 会输出到 `ide-plugins/jetbrains/build/distributions/`。在 JetBrains IDE 中通过 **Settings | Plugins | ⚙ | Install Plugin from Disk...** 安装。
|
|
105
|
+
|
|
106
|
+
JetBrains MVP 支持实时活跃文件追踪、实时选区追踪、`Ctrl+Alt+K` / **Pi x IDE: Attach Selection**、Pi 侧 `/ide auto`,以及 **Pi x IDE: Open Pi Terminal**。诊断 Quick Fix 和 Pi 侧自动安装 JetBrains 插件不属于 MVP 范围。
|
|
107
|
+
|
|
86
108
|
### 连接 Pi 并验证
|
|
87
109
|
|
|
88
110
|
在 IDE workspace **同一项目目录** 启动 Pi:
|
|
@@ -91,7 +113,7 @@ lua require("pi_x_ide").setup({ keymap = "<leader>pa" })
|
|
|
91
113
|
pi
|
|
92
114
|
```
|
|
93
115
|
|
|
94
|
-
Pi 自动加载 `pi-x-ide` 并连接 IDE。TUI
|
|
116
|
+
Pi 自动加载 `pi-x-ide` 并连接 IDE。TUI 底部应显示类似 `IDE: vscode ✓` 或 `IDE: jetbrains ✓` 的已连接 IDE source,输入框下方 widget 显示 IDE 名称、workspace、当前文件和选区范围。
|
|
95
117
|
|
|
96
118
|
**验证是否正常:**
|
|
97
119
|
|
|
@@ -101,11 +123,11 @@ Pi 自动加载 `pi-x-ide` 并连接 IDE。TUI 底部应显示 `IDE: vscode ✓`
|
|
|
101
123
|
IDE: vscode ✓ src/foo.ts#L10-L20 pending
|
|
102
124
|
```
|
|
103
125
|
|
|
104
|
-
可以从任一侧附加选区:在 VS Code 系列 IDE 中按 `Ctrl+Alt+K`(Linux/Windows)或 `Cmd+Alt+K`(macOS
|
|
126
|
+
可以从任一侧附加选区:在 VS Code 系列 IDE 中按 `Ctrl+Alt+K`(Linux/Windows)或 `Cmd+Alt+K`(macOS),在 JetBrains 中按 `Ctrl+Alt+K` 或运行 **Pi x IDE: Attach Selection**,在 Neovim 中使用 `:PiXIdeAttach`,或聚焦 Pi TUI 后按 `Ctrl+Alt+K` / 运行 `/ide attach`。Pi 输入框应插入 `@src/foo.ts#L10-L20`。
|
|
105
127
|
|
|
106
128
|
在 Pi 中输入对话提示并提交,选中文本会作为 LLM 上下文注入(不写入 session 历史)。提交后 widget 显示 `sent`。
|
|
107
129
|
|
|
108
|
-
对于 VS Code 系列 IDE 中的诊断信息,先连接 Pi,再把光标放在 error 或 warning 上并打开 Quick Fix。只有至少一个 Pi 客户端已连接时,才会显示 **Pi: Fix it** 和 **Pi: Send diagnostic**。**Pi: Fix it** 会把诊断消息、源码范围、附近上下文行和 related information 发送给一个已连接的 Pi 客户端,并用可自定义的 prompt 模板自动开始诊断分析(参见 [`fix_prompt`](#pi-侧配置))。**Pi: Send diagnostic** 会把相同上下文发送给一个已连接的 Pi 客户端并粘贴到 Pi 输入框,不会自动开始一轮对话。
|
|
130
|
+
对于 VS Code 系列 IDE 中的诊断信息,先连接 Pi,再把光标放在 error 或 warning 上并打开 Quick Fix。只有至少一个 Pi 客户端已连接时,才会显示 **Pi: Fix it** 和 **Pi: Send diagnostic**。**Pi: Fix it** 会把诊断消息、源码范围、附近上下文行和 related information 发送给一个已连接的 Pi 客户端,并用可自定义的 prompt 模板自动开始诊断分析(参见 [`fix_prompt`](#pi-侧配置))。**Pi: Send diagnostic** 会把相同上下文发送给一个已连接的 Pi 客户端并粘贴到 Pi 输入框,不会自动开始一轮对话。JetBrains MVP 不提供诊断 Quick Fix。
|
|
109
131
|
|
|
110
132
|
**如果连接未出现:**
|
|
111
133
|
|
|
@@ -113,6 +135,19 @@ IDE: vscode ✓ src/foo.ts#L10-L20 pending
|
|
|
113
135
|
- 如果 IDE 在 Pi 之后启动,reload IDE 窗口后再次运行 `/ide auto`
|
|
114
136
|
- 运行 `/ide` 手动从列表中选择连接
|
|
115
137
|
|
|
138
|
+
### WSL2 IDE 发现
|
|
139
|
+
|
|
140
|
+
VS Code Remote WSL 的行为等同于同主机连接:扩展宿主运行在 WSL 内部,在 Linux 侧的 `~/.pi/pi-x-ide/lock` 写入 lock file,并在 WSL 网络命名空间中绑定 WebSocket server。
|
|
141
|
+
|
|
142
|
+
当 Pi 运行在 WSL2 中,而原生 Windows IDE 插件运行在 Windows 侧时,Pi 也会扫描 Windows 用户 lock 目录,例如 `/mnt/c/Users/<user>/.pi/pi-x-ide/lock`。新的 Windows 侧 lock file 会包含 `runningInWindows: true`;Pi 会使用该元数据优先尝试 WSL 默认网关,再回退到 lock file 中的 `host`。Windows 路径和 WSL UNC 路径会在 workspace 匹配以及格式化 `@file#Lx-Ly` mention 前规范化。
|
|
143
|
+
|
|
144
|
+
如果你的 WSL 网络模式、防火墙或终端安全策略阻止默认网关访问,可设置 `PI_X_IDE_HOST_OVERRIDE`:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
PI_X_IDE_HOST_OVERRIDE=127.0.0.1 pi
|
|
148
|
+
PI_X_IDE_HOST_OVERRIDE=<windows-host-ip> pi
|
|
149
|
+
```
|
|
150
|
+
|
|
116
151
|
### `/ide` 命令参考
|
|
117
152
|
|
|
118
153
|
| 命令 | 行为 |
|
|
@@ -183,6 +218,7 @@ Pi 侧变量可设为真实环境变量或写入 `~/.pi/pi-x-ide/config.json`
|
|
|
183
218
|
| ------------------------------- | ------------ | ------------------------------------------------------------------------- |
|
|
184
219
|
| `PI_X_IDE_AUTO_INSTALL` | `1` | Pi 启动时自动安装 VS Code 扩展 |
|
|
185
220
|
| `PI_X_IDE_ATTACH_SHORTCUT` | `ctrl+alt+k` | Pi TUI 的 `/ide attach` 快捷键;设为 `off`、`none`、`false` 或 `0` 可禁用 |
|
|
221
|
+
| `PI_X_IDE_HOST_OVERRIDE` | (未设置) | 覆盖 Pi 连接 IDE WebSocket lock file 时使用的 host;适用于 WSL2 网络场景 |
|
|
186
222
|
| `PI_X_IDE_ZED_DB` | (自动检测) | 覆盖 Zed SQLite 数据库路径 |
|
|
187
223
|
| `PI_X_IDE_ZED_POLL_INTERVAL_MS` | `1000` | Zed SQLite 轮询间隔,会被限制在 100-2000 ms 范围 |
|
|
188
224
|
|
|
@@ -196,14 +232,16 @@ Pi 侧变量可设为真实环境变量或写入 `~/.pi/pi-x-ide/config.json`
|
|
|
196
232
|
|
|
197
233
|
### 功能对比
|
|
198
234
|
|
|
199
|
-
| 功能 | VS Code | Zed | Neovim |
|
|
200
|
-
| ------------------------------------------------ | -------------------- | ----------- | ------------------------ |
|
|
201
|
-
| 实时文件追踪 | ✅ 实时推送 | ✅ 1 秒轮询 | ✅ 通过 sidecar 实时推送 |
|
|
202
|
-
| 实时选区追踪 | ✅ 实时推送 | ✅ 1 秒轮询 | ✅ 通过 sidecar 实时推送 |
|
|
203
|
-
| IDE 上下文 attach 快捷键 | ✅ 默认 `Ctrl+Alt+K` | ❌ | ✅ 自定义快捷键 keymap |
|
|
204
|
-
| Pi TUI 上下文 attach 快捷键(默认 `Ctrl+Alt+K`) | ✅ | ✅ | ✅ |
|
|
205
|
-
| LLM 上下文注入 | ✅ | ✅ | ✅ |
|
|
206
|
-
| `/ide auto` | ✅ | ✅ | ✅ |
|
|
235
|
+
| 功能 | VS Code | Zed | Neovim | JetBrains |
|
|
236
|
+
| ------------------------------------------------ | -------------------- | ----------- | ------------------------ | -------------------- |
|
|
237
|
+
| 实时文件追踪 | ✅ 实时推送 | ✅ 1 秒轮询 | ✅ 通过 sidecar 实时推送 | ✅ 实时推送 |
|
|
238
|
+
| 实时选区追踪 | ✅ 实时推送 | ✅ 1 秒轮询 | ✅ 通过 sidecar 实时推送 | ✅ 实时推送 |
|
|
239
|
+
| IDE 上下文 attach 快捷键 | ✅ 默认 `Ctrl+Alt+K` | ❌ | ✅ 自定义快捷键 keymap | ✅ 默认 `Ctrl+Alt+K` |
|
|
240
|
+
| Pi TUI 上下文 attach 快捷键(默认 `Ctrl+Alt+K`) | ✅ | ✅ | ✅ | ✅ |
|
|
241
|
+
| LLM 上下文注入 | ✅ | ✅ | ✅ | ✅ |
|
|
242
|
+
| `/ide auto` | ✅ | ✅ | ✅ | ✅ |
|
|
243
|
+
| 诊断 Quick Fix | ✅ | ❌ | ❌ | ❌ |
|
|
244
|
+
| 自动安装 | ✅ 仅 VS Code 系列 | N/A | ❌ | ❌ |
|
|
207
245
|
|
|
208
246
|
### Lock File 协议
|
|
209
247
|
|
|
@@ -223,6 +261,7 @@ Pi 通过 `ctx.cwd` 与 lock file 中的 `workspaceFolders` 做最长路径匹
|
|
|
223
261
|
- bun ≥ 1.3(`packageManager` 声明为 `bun@1.3.14`)
|
|
224
262
|
- VS Code ≥ 1.120.0(仅 VS Code 扩展需要)
|
|
225
263
|
- Neovim ≥ 0.9(仅 Neovim 插件需要)
|
|
264
|
+
- JDK 21(仅 JetBrains 插件需要;Gradle 可自动下载 toolchain)
|
|
226
265
|
|
|
227
266
|
### 安装与构建
|
|
228
267
|
|
|
@@ -231,8 +270,8 @@ Clone 仓库后构建:
|
|
|
231
270
|
```bash
|
|
232
271
|
git clone https://github.com/balaenis/pi-x-ide.git
|
|
233
272
|
cd pi-x-ide
|
|
234
|
-
|
|
235
|
-
|
|
273
|
+
mise run setup
|
|
274
|
+
mise run build
|
|
236
275
|
```
|
|
237
276
|
|
|
238
277
|
加载本地构建(无需全局安装):
|
|
@@ -241,15 +280,18 @@ bun run build
|
|
|
241
280
|
pi -e ./src/pi/index.ts
|
|
242
281
|
```
|
|
243
282
|
|
|
244
|
-
|
|
283
|
+
所有构建与检查命令都定义为 `mise run` 任务(见 `.mise/tasks/`):
|
|
245
284
|
|
|
246
|
-
| 命令
|
|
247
|
-
|
|
|
248
|
-
| `
|
|
249
|
-
| `
|
|
250
|
-
| `
|
|
251
|
-
| `
|
|
252
|
-
| `
|
|
285
|
+
| 命令 | 说明 |
|
|
286
|
+
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
|
|
287
|
+
| `mise run build` | 编译 Pi 侧 TypeScript → `dist/` + Neovim sidecar → `ide-plugins/nvim/bin/` + VS Code bundle → `ide-plugins/vscode/out/` |
|
|
288
|
+
| `mise run typecheck` | 类型检查(不产出文件) |
|
|
289
|
+
| `mise run test` | 编译 + 运行单元测试 |
|
|
290
|
+
| `mise run package:vsix` | 打包 VS Code 扩展为 VSIX |
|
|
291
|
+
| `mise run compile:jetbrains` | 用 Gradle 编译并测试 JetBrains 插件 |
|
|
292
|
+
| `mise run package:jetbrains` | 将 JetBrains 插件打包为 `ide-plugins/jetbrains/build/distributions/` 下的 ZIP |
|
|
293
|
+
| `mise run verify:jetbrains` | 对配置的目标 IDE 运行 IntelliJ Plugin Verifier |
|
|
294
|
+
| `mise run check:config-schema` | 验证 `schemas/config.json` 与配置注册表是否同步 |
|
|
253
295
|
|
|
254
296
|
### 本地测试 VS Code 扩展
|
|
255
297
|
|
|
@@ -259,13 +301,13 @@ pi -e ./src/pi/index.ts
|
|
|
259
301
|
2. 进入 **Run and Debug** 面板(`Ctrl+Shift+D`)。
|
|
260
302
|
3. 选择 **Run Pi x IDE VS Code Extension**。
|
|
261
303
|
4. 按 **F5**:
|
|
262
|
-
- preLaunchTask 会自动执行 `
|
|
304
|
+
- preLaunchTask 会自动执行 `mise run build`。
|
|
263
305
|
- 打开一个标题包含 `[Extension Development Host]` 的新 VS Code 窗口。
|
|
264
306
|
|
|
265
307
|
#### 方式二:打包 VSIX 后安装
|
|
266
308
|
|
|
267
309
|
```bash
|
|
268
|
-
|
|
310
|
+
mise run package:vsix
|
|
269
311
|
cd ide-plugins/vscode && code --install-extension dist/pi-x-ide-$(node -p "require('./package.json').version").vsix
|
|
270
312
|
```
|
|
271
313
|
|
|
@@ -279,6 +321,23 @@ ls -l ~/.pi/pi-x-ide/lock
|
|
|
279
321
|
|
|
280
322
|
应看到类似 `vscode-12345-48123.lock` 的文件。如果没有,在 VS Code 中执行 **Developer: Reload Window**。
|
|
281
323
|
|
|
324
|
+
### 本地测试 JetBrains 插件
|
|
325
|
+
|
|
326
|
+
运行 sandbox IDE:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
cd ide-plugins/jetbrains
|
|
330
|
+
./gradlew runIde
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
构建可安装的插件 ZIP:
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
mise run package:jetbrains
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
ZIP 会输出到 `ide-plugins/jetbrains/build/distributions/`。Smoke test:在 sandbox IDE 中打开本仓库,从同一目录启动 `pi`,打开并选择一个本地文件中的文本,然后按 `Ctrl+Alt+K` 或运行 **Pi x IDE: Attach Selection**。Pi 应收到 `@relative/path#Lx-Ly` mention。
|
|
340
|
+
|
|
282
341
|
### 发布
|
|
283
342
|
|
|
284
343
|
本项目使用 [Release Please](https://github.com/googleapis/release-please) 和 [Conventional Commits](https://www.conventionalcommits.org/) 来自动化版本管理和发布流程。
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-x-ide",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "Pi extension package for IDE selection context integration.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
"vscode",
|
|
15
15
|
"zed",
|
|
16
16
|
"neovim",
|
|
17
|
-
"nvim"
|
|
17
|
+
"nvim",
|
|
18
|
+
"jetbrains",
|
|
19
|
+
"intellij",
|
|
20
|
+
"idea"
|
|
18
21
|
],
|
|
19
22
|
"license": "Apache-2.0",
|
|
20
23
|
"repository": {
|
|
@@ -34,24 +37,6 @@
|
|
|
34
37
|
},
|
|
35
38
|
"type": "commonjs",
|
|
36
39
|
"main": "./dist/src/pi/index.js",
|
|
37
|
-
"scripts": {
|
|
38
|
-
"typecheck": "tsc -p tsconfig.json --noEmit && bun run --filter './ide-plugins/vscode' typecheck",
|
|
39
|
-
"generate:config-schema": "bun run scripts/generate-config-schema.cjs",
|
|
40
|
-
"check:config-schema": "bun run scripts/generate-config-schema.cjs --check",
|
|
41
|
-
"test": "bun run check:config-schema && bun run compile && node --test dist/test/*.test.js",
|
|
42
|
-
"lint": "eslint .",
|
|
43
|
-
"lint:fix": "eslint . --fix",
|
|
44
|
-
"format": "prettier --write .",
|
|
45
|
-
"format:check": "prettier --check .",
|
|
46
|
-
"compile": "tsc -p tsconfig.json",
|
|
47
|
-
"compile:vsix": "bun run --filter './ide-plugins/vscode' compile",
|
|
48
|
-
"sync:vsix-assets": "bun run --filter './ide-plugins/vscode' sync:assets",
|
|
49
|
-
"package:vsix": "bun run --filter './ide-plugins/vscode' package",
|
|
50
|
-
"package:nvim-sidecar": "bun run scripts/build-nvim-sidecar.mjs --production",
|
|
51
|
-
"package:nvim-sidecar:all": "bun run scripts/build-nvim-sidecar.mjs --production --target=all",
|
|
52
|
-
"build": "bun run compile && bun run compile:vsix && bun run package:nvim-sidecar",
|
|
53
|
-
"build:all": "bun run compile && bun run compile:vsix && bun run package:nvim-sidecar:all"
|
|
54
|
-
},
|
|
55
40
|
"dependencies": {
|
|
56
41
|
"ws": "^8.21.0"
|
|
57
42
|
},
|
|
@@ -2,7 +2,8 @@ import { type DiagnosticFixRequestedParams, type AtMentionedParams, type EditorS
|
|
|
2
2
|
export declare const IDE_CONNECT_TIMEOUT_MS = 5000;
|
|
3
3
|
export declare class IdeConnectionTimeoutError extends Error {
|
|
4
4
|
readonly candidate: LockFileCandidate;
|
|
5
|
-
|
|
5
|
+
readonly host: string;
|
|
6
|
+
constructor(candidate: LockFileCandidate, host?: string);
|
|
6
7
|
}
|
|
7
8
|
export interface IdeConnectionCallbacks {
|
|
8
9
|
onConnected?: (server: {
|
|
@@ -17,14 +18,19 @@ export interface IdeConnectionCallbacks {
|
|
|
17
18
|
onDiagnosticFixRequested?: (params: DiagnosticFixRequestedParams) => void;
|
|
18
19
|
onError?: (error: Error) => void;
|
|
19
20
|
}
|
|
21
|
+
export interface IdeConnectionOptions {
|
|
22
|
+
resolveHost?: (lock: LockFileCandidate["lock"]) => Promise<string>;
|
|
23
|
+
env?: NodeJS.ProcessEnv;
|
|
24
|
+
}
|
|
20
25
|
export declare class IdeConnection {
|
|
21
26
|
readonly candidate: LockFileCandidate;
|
|
22
27
|
private readonly cwd;
|
|
23
28
|
private readonly callbacks;
|
|
29
|
+
private readonly options;
|
|
24
30
|
private socket?;
|
|
25
31
|
private nextId;
|
|
26
32
|
private closedByUser;
|
|
27
|
-
constructor(candidate: LockFileCandidate, cwd: string, callbacks: IdeConnectionCallbacks);
|
|
33
|
+
constructor(candidate: LockFileCandidate, cwd: string, callbacks: IdeConnectionCallbacks, options?: IdeConnectionOptions);
|
|
28
34
|
get isOpen(): boolean;
|
|
29
35
|
connect(timeoutMs?: number): Promise<void>;
|
|
30
36
|
disconnect(): void;
|
|
@@ -10,13 +10,18 @@ const ws_1 = __importDefault(require("ws"));
|
|
|
10
10
|
const protocol_1 = require("../shared/protocol");
|
|
11
11
|
const schema_1 = require("../shared/schema");
|
|
12
12
|
const errors_1 = require("../shared/errors");
|
|
13
|
+
const format_1 = require("../shared/format");
|
|
14
|
+
const platform_1 = require("../shared/platform");
|
|
13
15
|
const ws_2 = require("../shared/ws");
|
|
16
|
+
const ide_host_1 = require("./ide-host");
|
|
14
17
|
exports.IDE_CONNECT_TIMEOUT_MS = 5_000;
|
|
15
18
|
class IdeConnectionTimeoutError extends Error {
|
|
16
19
|
candidate;
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
host;
|
|
21
|
+
constructor(candidate, host = candidate.lock.host) {
|
|
22
|
+
super(`Timed out connecting to ${candidate.lock.name} at ${host}:${candidate.lock.port}`);
|
|
19
23
|
this.candidate = candidate;
|
|
24
|
+
this.host = host;
|
|
20
25
|
this.name = "IdeConnectionTimeoutError";
|
|
21
26
|
}
|
|
22
27
|
}
|
|
@@ -25,13 +30,15 @@ class IdeConnection {
|
|
|
25
30
|
candidate;
|
|
26
31
|
cwd;
|
|
27
32
|
callbacks;
|
|
33
|
+
options;
|
|
28
34
|
socket;
|
|
29
35
|
nextId = 1;
|
|
30
36
|
closedByUser = false;
|
|
31
|
-
constructor(candidate, cwd, callbacks) {
|
|
37
|
+
constructor(candidate, cwd, callbacks, options = {}) {
|
|
32
38
|
this.candidate = candidate;
|
|
33
39
|
this.cwd = cwd;
|
|
34
40
|
this.callbacks = callbacks;
|
|
41
|
+
this.options = options;
|
|
35
42
|
}
|
|
36
43
|
get isOpen() {
|
|
37
44
|
return this.socket?.readyState === ws_1.default.OPEN;
|
|
@@ -39,7 +46,8 @@ class IdeConnection {
|
|
|
39
46
|
async connect(timeoutMs = exports.IDE_CONNECT_TIMEOUT_MS) {
|
|
40
47
|
this.closedByUser = false;
|
|
41
48
|
const { lock } = this.candidate;
|
|
42
|
-
const
|
|
49
|
+
const resolvedHost = await (this.options.resolveHost ?? ide_host_1.resolveIdeHost)(lock);
|
|
50
|
+
const socket = new ws_1.default(`ws://${resolvedHost}:${lock.port}`, {
|
|
43
51
|
handshakeTimeout: timeoutMs + 1_000,
|
|
44
52
|
headers: {
|
|
45
53
|
[protocol_1.AUTH_HEADER]: lock.authToken,
|
|
@@ -65,7 +73,7 @@ class IdeConnection {
|
|
|
65
73
|
if (this.socket === socket)
|
|
66
74
|
this.socket = undefined;
|
|
67
75
|
socket.terminate();
|
|
68
|
-
reject(new IdeConnectionTimeoutError(this.candidate));
|
|
76
|
+
reject(new IdeConnectionTimeoutError(this.candidate, resolvedHost));
|
|
69
77
|
}, timeoutMs);
|
|
70
78
|
const onOpen = () => {
|
|
71
79
|
cleanup();
|
|
@@ -121,7 +129,7 @@ class IdeConnection {
|
|
|
121
129
|
if (!isNotification(parsed))
|
|
122
130
|
return;
|
|
123
131
|
if (parsed.method === "selection_changed" && (0, schema_1.isSelectionChangedParams)(parsed.params)) {
|
|
124
|
-
const params = withReceivedAt(parsed.params);
|
|
132
|
+
const params = (0, platform_1.normalizeEditorSelectionSnapshotForHost)(withReceivedAt(parsed.params), this.options.env);
|
|
125
133
|
this.emitCallback("selection changed callback", () => this.callbacks.onSelectionChanged?.(params));
|
|
126
134
|
}
|
|
127
135
|
else if (parsed.method === "selection_cleared" && (0, schema_1.isSelectionClearedParams)(parsed.params)) {
|
|
@@ -129,7 +137,8 @@ class IdeConnection {
|
|
|
129
137
|
this.emitCallback("selection cleared callback", () => this.callbacks.onSelectionCleared?.(params));
|
|
130
138
|
}
|
|
131
139
|
else if (parsed.method === "at_mentioned" && (0, schema_1.isAtMentionedParams)(parsed.params)) {
|
|
132
|
-
const
|
|
140
|
+
const snapshot = (0, platform_1.normalizeEditorSelectionSnapshotForHost)(withReceivedAt(parsed.params), this.options.env);
|
|
141
|
+
const params = { ...snapshot, rangeText: (0, format_1.formatRangeMention)(snapshot, { cwd: this.cwd, env: this.options.env }) };
|
|
133
142
|
this.emitCallback("at mentioned callback", () => this.callbacks.onAtMentioned?.(params));
|
|
134
143
|
}
|
|
135
144
|
else if (parsed.method === "diagnostic_fix_requested" && (0, schema_1.isDiagnosticFixRequestedParams)(parsed.params)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/pi/connection.ts"],"names":[],"mappings":";;;;;;AAAA,8FAA8F;AAC9F,8FAA8F;AAC9F,4CAA2B;AAC3B,iDAU4B;AAC5B,6CAK0B;AAC1B,6CAA8D;AAC9D,qCAA6C;
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/pi/connection.ts"],"names":[],"mappings":";;;;;;AAAA,8FAA8F;AAC9F,8FAA8F;AAC9F,4CAA2B;AAC3B,iDAU4B;AAC5B,6CAK0B;AAC1B,6CAA8D;AAC9D,6CAAsD;AACtD,iDAA6E;AAC7E,qCAA6C;AAC7C,yCAA4C;AAE/B,QAAA,sBAAsB,GAAG,KAAK,CAAC;AAE5C,MAAa,yBAA0B,SAAQ,KAAK;IAEvC;IACA;IAFX,YACW,SAA4B,EAC5B,OAAe,SAAS,CAAC,IAAI,CAAC,IAAI;QAE3C,KAAK,CAAC,2BAA2B,SAAS,CAAC,IAAI,CAAC,IAAI,OAAO,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAHjF,cAAS,GAAT,SAAS,CAAmB;QAC5B,SAAI,GAAJ,IAAI,CAA8B;QAG3C,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AARD,8DAQC;AAiBD,MAAa,aAAa;IAMb;IACQ;IACA;IACA;IARX,MAAM,CAAa;IACnB,MAAM,GAAG,CAAC,CAAC;IACX,YAAY,GAAG,KAAK,CAAC;IAE7B,YACW,SAA4B,EACpB,GAAW,EACX,SAAiC,EACjC,UAAgC,EAAE;QAH1C,cAAS,GAAT,SAAS,CAAmB;QACpB,QAAG,GAAH,GAAG,CAAQ;QACX,cAAS,GAAT,SAAS,CAAwB;QACjC,YAAO,GAAP,OAAO,CAA2B;IAClD,CAAC;IAEJ,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,EAAE,UAAU,KAAK,YAAS,CAAC,IAAI,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,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
-
import { type LockFileCandidate } from "../shared/protocol";
|
|
1
|
+
import { type IdeLockFile, type LockFileCandidate } from "../shared/protocol";
|
|
2
2
|
export interface DiscoverOptions {
|
|
3
3
|
cwd: string;
|
|
4
4
|
lockDir?: string;
|
|
5
|
+
homeLockDir?: string;
|
|
5
6
|
now?: number;
|
|
6
7
|
maxAgeMs?: number;
|
|
7
8
|
checkPid?: boolean;
|
|
9
|
+
env?: NodeJS.ProcessEnv;
|
|
10
|
+
windowsUsersRoot?: string;
|
|
11
|
+
resolveHost?: (lock: IdeLockFile) => Promise<string>;
|
|
12
|
+
tcpProbe?: (host: string, port: number, timeoutMs: number) => Promise<boolean>;
|
|
8
13
|
}
|
|
9
14
|
export declare function sortCandidates(candidates: LockFileCandidate[]): LockFileCandidate[];
|
|
10
15
|
export declare function discoverIdeCandidates(options: DiscoverOptions): Promise<LockFileCandidate[]>;
|