@saifymatteo/pi-x-ide 0.0.0-stage → 1.20.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/CHANGELOG.md +328 -0
- package/CONTRIBUTING.md +119 -0
- package/CONTRIBUTING.zh-CN.md +106 -0
- package/LICENSE +201 -0
- package/README.md +33 -2
- package/README.zh-CN.md +34 -0
- package/RELEASE.md +213 -0
- package/config.example.json +9 -0
- package/dist/src/pi/chunks/chunk-4RHJAL4S.js +200 -0
- package/dist/src/pi/chunks/chunk-UUXVCTOS.js +819 -0
- package/dist/src/pi/chunks/config-ui-LO3DVQFC.js +8073 -0
- package/dist/src/pi/chunks/runtime-services-TUOTPMCH.js +19569 -0
- package/dist/src/pi/commands.js +126 -0
- package/dist/src/pi/config-ui.js +127 -0
- package/dist/src/pi/connection.js +237 -0
- package/dist/src/pi/context.js +30 -0
- package/dist/src/pi/diagnostic-renderer.js +326 -0
- package/dist/src/pi/diagnostic-types.js +1 -0
- package/dist/src/pi/diagnostics.js +104 -0
- package/dist/src/pi/discovery.js +135 -0
- package/dist/src/pi/effect-boundary.js +5 -0
- package/dist/src/pi/ide-host.js +68 -0
- package/dist/src/pi/index.js +636 -0
- package/dist/src/pi/install.js +308 -0
- package/dist/src/pi/reconnect.js +57 -0
- package/dist/src/pi/runtime-loader.js +38 -0
- package/dist/src/pi/runtime-services.js +356 -0
- package/dist/src/pi/safety.js +61 -0
- package/dist/src/pi/selection.js +18 -0
- package/dist/src/pi/state.js +13 -0
- package/dist/src/pi/ui.js +304 -0
- package/dist/src/pi/zed.js +409 -0
- package/dist/src/shared/config-options.js +45 -0
- package/dist/src/shared/config.js +183 -0
- package/dist/src/shared/display-width.js +99 -0
- package/dist/src/shared/effect-errors.js +36 -0
- package/dist/src/shared/effect-runtime.js +36 -0
- package/dist/src/shared/effect-schema.js +120 -0
- package/dist/src/shared/errors.js +48 -0
- package/dist/src/shared/format.js +92 -0
- package/dist/src/shared/ide-server.js +167 -0
- package/dist/src/shared/jsonrpc-guard.js +12 -0
- package/dist/src/shared/lock-file-heartbeat.js +58 -0
- package/dist/src/shared/lock-file.js +50 -0
- package/dist/src/shared/paths.js +79 -0
- package/dist/src/shared/platform.js +57 -0
- package/dist/src/shared/protocol.js +3 -0
- package/dist/src/shared/schema.js +37 -0
- package/dist/src/shared/version.js +1 -0
- package/dist/src/shared/ws.js +8 -0
- package/docs/explanation/architecture.md +123 -0
- package/docs/explanation/discovery.md +113 -0
- package/docs/explanation/effect.md +127 -0
- package/docs/how-to/install-jetbrains.md +58 -0
- package/docs/how-to/install-neovim.md +138 -0
- package/docs/how-to/install-vscode.md +75 -0
- package/docs/how-to/install-zed.md +70 -0
- package/docs/how-to/troubleshoot-connection.md +103 -0
- package/docs/how-to/use-wsl2.md +90 -0
- package/docs/reference/commands.md +59 -0
- package/docs/reference/configuration.md +101 -0
- package/docs/reference/feature-parity.md +26 -0
- package/docs/reference/protocol.md +71 -0
- package/docs/specs/ide-protocol.md +215 -0
- package/docs/tutorials/get-started.md +133 -0
- package/docs/zh-CN/explanation/architecture.md +93 -0
- package/docs/zh-CN/explanation/discovery.md +71 -0
- package/docs/zh-CN/explanation/effect.md +90 -0
- package/docs/zh-CN/how-to/install-jetbrains.md +49 -0
- package/docs/zh-CN/how-to/install-neovim.md +126 -0
- package/docs/zh-CN/how-to/install-vscode.md +67 -0
- package/docs/zh-CN/how-to/install-zed.md +56 -0
- package/docs/zh-CN/how-to/troubleshoot-connection.md +85 -0
- package/docs/zh-CN/how-to/use-wsl2.md +75 -0
- package/docs/zh-CN/reference/commands.md +54 -0
- package/docs/zh-CN/reference/configuration.md +94 -0
- package/docs/zh-CN/reference/feature-parity.md +21 -0
- package/docs/zh-CN/reference/protocol.md +54 -0
- package/docs/zh-CN/tutorials/get-started.md +101 -0
- package/package.json +86 -4
- package/schemas/config.json +77 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Install the Neovim plugin
|
|
2
|
+
|
|
3
|
+
Neovim support uses a Lua plugin plus a **sidecar** process. The plugin observes
|
|
4
|
+
your editor and selection; the sidecar owns the WebSocket server that Pi connects
|
|
5
|
+
to. The sidecar binary is downloaded automatically on first start, with a Node.js
|
|
6
|
+
fallback.
|
|
7
|
+
|
|
8
|
+
## Prerequisites
|
|
9
|
+
|
|
10
|
+
- The [`pi`](https://github.com/earendil-works/pi-coding-agent) CLI installed.
|
|
11
|
+
- The `pi-x-ide` Pi package installed: `pi install npm:pi-x-ide`.
|
|
12
|
+
- Neovim ≥ 0.9.
|
|
13
|
+
|
|
14
|
+
## Install with lazy.nvim
|
|
15
|
+
|
|
16
|
+
```lua
|
|
17
|
+
{
|
|
18
|
+
"saifymatteo/pi-x-ide",
|
|
19
|
+
build = function(plugin)
|
|
20
|
+
vim.opt.rtp:prepend(plugin.dir .. "/ide-plugins/nvim")
|
|
21
|
+
require("pi_x_ide.download").run({ refresh = true })
|
|
22
|
+
end,
|
|
23
|
+
init = function(plugin)
|
|
24
|
+
vim.opt.rtp:prepend(plugin.dir .. "/ide-plugins/nvim")
|
|
25
|
+
end,
|
|
26
|
+
main = "pi_x_ide",
|
|
27
|
+
opts = {
|
|
28
|
+
keymap = "<leader>aa",
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
> **Note:** The `init` block adds the plugin subdirectory to the runtime path to
|
|
34
|
+
> work around a Lua module resolution issue with some lazy.nvim versions. The
|
|
35
|
+
> optional `build` hook pre-downloads the sidecar binary; it is safe to omit - the
|
|
36
|
+
> plugin downloads it lazily on first start.
|
|
37
|
+
|
|
38
|
+
## Install as a native package
|
|
39
|
+
|
|
40
|
+
```vim
|
|
41
|
+
set runtimepath+=/path/to/pi-x-ide/ide-plugins/nvim
|
|
42
|
+
lua require("pi_x_ide").setup({ keymap = "<leader>pa" })
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Verify the connection
|
|
46
|
+
|
|
47
|
+
1. Open a project in Neovim.
|
|
48
|
+
2. Open a terminal in that project and start Pi:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pi
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
3. Open a file and select some text (visual mode). The Pi widget should show:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
⧉ ⇡ foo.ts#L10-L20
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
If the widget does not appear, see [Troubleshoot the sidecar](#troubleshoot-the-sidecar)
|
|
61
|
+
and [Troubleshoot a missing connection](troubleshoot-connection.md).
|
|
62
|
+
|
|
63
|
+
## Attach a selection
|
|
64
|
+
|
|
65
|
+
With text selected, either press your configured `keymap` (default `<C-A-k>`) or
|
|
66
|
+
run:
|
|
67
|
+
|
|
68
|
+
```vim
|
|
69
|
+
:PiXIdeAttach
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Pi inserts `@relative/path#Lx-Ly` into the input box. Submit your message to send
|
|
73
|
+
the selected text as LLM context.
|
|
74
|
+
|
|
75
|
+
## Configuration
|
|
76
|
+
|
|
77
|
+
```lua
|
|
78
|
+
require("pi_x_ide").setup({
|
|
79
|
+
enabled = true,
|
|
80
|
+
keymap = "<C-A-k>",
|
|
81
|
+
debounce_ms = 150,
|
|
82
|
+
-- sidecar_cmd = { "node", "/absolute/path/to/pi-x-ide-nvim-sidecar.cjs" },
|
|
83
|
+
-- workspace_folders = { "/path/to/project" },
|
|
84
|
+
})
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
| Option | Default | Description |
|
|
88
|
+
| ------------------- | --------- | ------------------------------------------------ |
|
|
89
|
+
| `enabled` | `true` | Enable or disable the plugin. |
|
|
90
|
+
| `keymap` | `<C-A-k>` | Keymap to attach the current selection to Pi. |
|
|
91
|
+
| `debounce_ms` | `150` | Debounce interval for selection notifications. |
|
|
92
|
+
| `sidecar_cmd` | (auto) | Override the sidecar command. |
|
|
93
|
+
| `workspace_folders` | (auto) | Override the workspace folders advertised to Pi. |
|
|
94
|
+
|
|
95
|
+
## Commands
|
|
96
|
+
|
|
97
|
+
| Command | Behavior |
|
|
98
|
+
| --------------- | --------------------------------------------------------------------- |
|
|
99
|
+
| `:PiXIdeStart` | Start the sidecar and write the lock file. |
|
|
100
|
+
| `:PiXIdeStop` | Stop the sidecar and remove the lock file. |
|
|
101
|
+
| `:PiXIdeStatus` | Show whether the sidecar is running. |
|
|
102
|
+
| `:PiXIdeAttach` | Attach the current file or selection to Pi as `@relative/path#Lx-Ly`. |
|
|
103
|
+
|
|
104
|
+
## How the sidecar is resolved
|
|
105
|
+
|
|
106
|
+
The plugin resolves the sidecar in this order:
|
|
107
|
+
|
|
108
|
+
1. A platform binary bundled in `ide-plugins/nvim/bin/`.
|
|
109
|
+
2. A cached binary downloaded from GitHub Releases, verified by SHA256.
|
|
110
|
+
3. A fallback Node.js script (`pi-x-ide-nvim-sidecar.cjs`).
|
|
111
|
+
|
|
112
|
+
See [Architecture](../explanation/architecture.md#the-neovim-sidecar) for why a
|
|
113
|
+
sidecar exists at all.
|
|
114
|
+
|
|
115
|
+
## Troubleshoot the sidecar
|
|
116
|
+
|
|
117
|
+
If the widget never appears, the sidecar likely failed to start.
|
|
118
|
+
|
|
119
|
+
1. Run `:PiXIdeStatus` to see whether the sidecar is running.
|
|
120
|
+
2. Check that the lock file was written:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
ls -l ~/.pi/pi-x-ide/lock
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
You should see a file like `nvim-<pid>-<port>.lock`. If not, the sidecar did
|
|
127
|
+
not start.
|
|
128
|
+
|
|
129
|
+
3. If the binary download failed, point `sidecar_cmd` at the Node fallback
|
|
130
|
+
explicitly:
|
|
131
|
+
|
|
132
|
+
```lua
|
|
133
|
+
require("pi_x_ide").setup({
|
|
134
|
+
sidecar_cmd = { "node", "/path/to/pi-x-ide/ide-plugins/nvim/bin/pi-x-ide-nvim-sidecar.cjs" },
|
|
135
|
+
})
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
4. Make sure `node` is on your `PATH` if you rely on the fallback.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Install the VS Code extension
|
|
2
|
+
|
|
3
|
+
Pi × IDE integrates with VS Code, Cursor, and Windsurf through a single extension.
|
|
4
|
+
This guide covers the three install paths and how to verify the connection.
|
|
5
|
+
|
|
6
|
+
## Prerequisites
|
|
7
|
+
|
|
8
|
+
- The [`pi`](https://github.com/earendil-works/pi-coding-agent) CLI installed.
|
|
9
|
+
- The `pi-x-ide` Pi package installed: `pi install npm:pi-x-ide`.
|
|
10
|
+
- VS Code, Cursor, or Windsurf.
|
|
11
|
+
|
|
12
|
+
## Option A: Install from the Marketplace (recommended)
|
|
13
|
+
|
|
14
|
+
Open your IDE's **Extensions** panel and search for
|
|
15
|
+
[`balaenis.pi-x-ide`](https://marketplace.visualstudio.com/items?itemName=balaenis.pi-x-ide),
|
|
16
|
+
then install it. Reload the window after installing.
|
|
17
|
+
|
|
18
|
+
## Option B: Install via the Pi CLI
|
|
19
|
+
|
|
20
|
+
Inside Pi's TUI, run:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
/ide install
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Pi auto-detects the `code`, `cursor`, or `windsurf` CLI on your `PATH` and runs
|
|
27
|
+
`--force --install-extension` against it.
|
|
28
|
+
|
|
29
|
+
## Option C: Auto-install on Pi startup
|
|
30
|
+
|
|
31
|
+
When Pi starts from a supported VS Code integrated terminal, it attempts to
|
|
32
|
+
auto-install or update the extension asynchronously. This is on by default. To
|
|
33
|
+
disable it, set:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
PI_X_IDE_AUTO_INSTALL=0
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
See the [configuration reference](../reference/configuration.md) for all
|
|
40
|
+
Pi-side options.
|
|
41
|
+
|
|
42
|
+
## Verify the connection
|
|
43
|
+
|
|
44
|
+
1. Open a project folder in your IDE.
|
|
45
|
+
2. Open an integrated terminal in that folder and start Pi:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pi
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
3. Open a source file and select some text. The Pi widget should show:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
⧉ ⇡ foo.ts#L10-L20
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
If the widget does not appear, see
|
|
58
|
+
[Troubleshoot a missing connection](troubleshoot-connection.md).
|
|
59
|
+
|
|
60
|
+
## VS Code settings
|
|
61
|
+
|
|
62
|
+
| Key | Type | Default | Description |
|
|
63
|
+
| ---------------- | --------- | ------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
64
|
+
| `piXIde.useTmux` | `boolean` | `false` | Open Pi through `tmux` from the terminal icon. Each click creates a new session that is destroyed when the terminal detaches. |
|
|
65
|
+
|
|
66
|
+
## Diagnostic Quick Fix
|
|
67
|
+
|
|
68
|
+
Place the cursor on an error or warning, open Quick Fix (`Ctrl+.`), and choose:
|
|
69
|
+
|
|
70
|
+
- **Pi: Fix it** - sends the diagnostic to Pi and starts an analysis turn.
|
|
71
|
+
- **Pi: Send diagnostic** - pastes the diagnostic context into the Pi input box
|
|
72
|
+
without starting a turn.
|
|
73
|
+
|
|
74
|
+
The prompt prefix used by **Pi: Fix it** is configurable via `fixPrompt`. See
|
|
75
|
+
[Configuration](../reference/configuration.md#top-level-options).
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Use Pi × IDE with Zed
|
|
2
|
+
|
|
3
|
+
Zed requires no extension. Pi detects Zed automatically when you run it inside a
|
|
4
|
+
Zed terminal and reads Zed's local state database to track the active file and
|
|
5
|
+
selection.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
- The [`pi`](https://github.com/earendil-works/pi-coding-agent) CLI installed.
|
|
10
|
+
- The `pi-x-ide` Pi package installed: `pi install npm:pi-x-ide`.
|
|
11
|
+
- Zed installed.
|
|
12
|
+
|
|
13
|
+
## Connect
|
|
14
|
+
|
|
15
|
+
1. Open a project folder in Zed.
|
|
16
|
+
2. Open a terminal in Zed (`Zed -> Terminal -> New Terminal`) and start Pi:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pi
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Pi detects the Zed environment (`ZED_TERM=true` or `TERM_PROGRAM=zed`) and begins
|
|
23
|
+
polling Zed's SQLite database. A widget appears above the Pi input box showing the
|
|
24
|
+
active file and selection.
|
|
25
|
+
|
|
26
|
+
## Verify it works
|
|
27
|
+
|
|
28
|
+
Open a file in Zed and select some text. The widget should update in real time:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
⧉ ⇡ foo.ts#L10-L20
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Focus the Pi TUI and press `Ctrl+Alt+K` (macOS: `Ctrl+Option+K`) to insert the
|
|
35
|
+
selection as `@src/foo.ts#L10-L20`, then submit your message.
|
|
36
|
+
|
|
37
|
+
## How tracking works
|
|
38
|
+
|
|
39
|
+
Zed has no extension API, so Pi reads its editor state directly from the local
|
|
40
|
+
SQLite database. Polling runs every 1000 ms by default and skips a tick when the
|
|
41
|
+
database's WAL file has not changed. See
|
|
42
|
+
[Architecture](../explanation/architecture.md#zed-polling) for details.
|
|
43
|
+
|
|
44
|
+
## Configuration
|
|
45
|
+
|
|
46
|
+
| Environment variable | Default | Description |
|
|
47
|
+
| ------------------------------- | ------------- | ------------------------------------------------------ |
|
|
48
|
+
| `PI_X_IDE_ZED_DB` | (auto-detect) | Override the path to Zed's SQLite database. |
|
|
49
|
+
| `PI_X_IDE_ZED_POLL_INTERVAL_MS` | `1000` | Polling interval in milliseconds, clamped to 100–2000. |
|
|
50
|
+
|
|
51
|
+
Default database paths:
|
|
52
|
+
|
|
53
|
+
- **Linux:** `~/.local/share/zed/db/0-stable/db.sqlite`
|
|
54
|
+
- **macOS:** `~/Library/Application Support/Zed/db/0-stable/db.sqlite`
|
|
55
|
+
- **Windows:** `%LOCALAPPDATA%\Zed\db\0-stable\db.sqlite`
|
|
56
|
+
- **WSL with Windows Zed:** `/mnt/c/Users/<user>/AppData/Local/Zed/db/0-stable/db.sqlite`
|
|
57
|
+
|
|
58
|
+
These variables can be set as real environment variables or in
|
|
59
|
+
`~/.pi/pi-x-ide/config.json` under `env`. See
|
|
60
|
+
[Configuration](../reference/configuration.md).
|
|
61
|
+
|
|
62
|
+
## Notes
|
|
63
|
+
|
|
64
|
+
- Zed support is **polling-based**, so the widget updates at most once per poll
|
|
65
|
+
interval rather than on every keystroke.
|
|
66
|
+
- The IDE-side attach shortcut (`Ctrl+Alt+K` in VS Code/JetBrains) is not
|
|
67
|
+
available in Zed - use the Pi TUI shortcut instead.
|
|
68
|
+
- Diagnostic Quick Fix and auto-install are VS Code-family features and are not
|
|
69
|
+
available for Zed. See the [feature parity](../reference/feature-parity.md)
|
|
70
|
+
table.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Troubleshoot a missing connection
|
|
2
|
+
|
|
3
|
+
The Pi widget does not appear, or it shows no IDE connection. Work through these
|
|
4
|
+
steps in order.
|
|
5
|
+
|
|
6
|
+
## 1. Confirm both sides are running
|
|
7
|
+
|
|
8
|
+
- The IDE extension/plugin is installed and the window was reloaded after install.
|
|
9
|
+
- Pi was started **from a terminal inside the IDE's workspace folder** (or the
|
|
10
|
+
same project directory).
|
|
11
|
+
|
|
12
|
+
If the IDE was started _after_ Pi, reload the IDE window so it writes its lock
|
|
13
|
+
file, then re-attempt matching in Pi:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/ide auto
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 2. Check the lock file
|
|
20
|
+
|
|
21
|
+
The IDE plugin writes a lock file to `~/.pi/pi-x-ide/lock/`. List the directory:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ls -l ~/.pi/pi-x-ide/lock
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
You should see a file like `vscode-12345-48123.lock`, `nvim-98765-50001.lock`, or
|
|
28
|
+
`jetbrains-4242-51234.lock`.
|
|
29
|
+
|
|
30
|
+
- **No file at all:** the IDE extension is not running. Reload the IDE window or
|
|
31
|
+
restart the IDE. For VS Code, run **Developer: Reload Window**.
|
|
32
|
+
- **File exists but Pi did not connect:** continue to step 3.
|
|
33
|
+
|
|
34
|
+
## 3. Check the working directory match
|
|
35
|
+
|
|
36
|
+
Pi auto-connects only when your terminal `cwd` is **inside** one of the IDE's
|
|
37
|
+
workspace folders. If you started Pi in a parent directory (for example `~/`),
|
|
38
|
+
there is no exact match. Either:
|
|
39
|
+
|
|
40
|
+
- Restart Pi from inside the project directory, or
|
|
41
|
+
- Run `/ide` to open the selector and pick a connection manually, or
|
|
42
|
+
- Run `/ide auto` to re-attempt matching.
|
|
43
|
+
|
|
44
|
+
## 4. Inspect the connection status
|
|
45
|
+
|
|
46
|
+
Run:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
/ide status
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This shows the current connection, workspace, and most recent selection. If it
|
|
53
|
+
reports no connection, run `/ide list` to see the candidate lock files Pi found.
|
|
54
|
+
|
|
55
|
+
## 5. Stale or dead lock files
|
|
56
|
+
|
|
57
|
+
If a previous IDE instance crashed, its lock file may linger. Pi keeps a lock when
|
|
58
|
+
authoritative PID or WSL TCP liveness succeeds. Pi uses age-only cleanup only when
|
|
59
|
+
authoritative liveness is unavailable or disabled.
|
|
60
|
+
|
|
61
|
+
An active VS Code, Neovim, or JetBrains producer normally recreates an externally
|
|
62
|
+
deleted lock on its next 15-minute heartbeat. For the mechanism, see
|
|
63
|
+
[How discovery works](../explanation/discovery.md).
|
|
64
|
+
|
|
65
|
+
Confirm the IDE is stopped before you delete lock files manually:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
rm ~/.pi/pi-x-ide/lock/*.lock
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Then reload or restart the producer and run `/ide auto` in Pi.
|
|
72
|
+
|
|
73
|
+
> Do **not** delete Windows-side lock files manually from WSL if the IDE is still
|
|
74
|
+
> running on Windows - Pi uses `runningInWindows: true` to probe them safely.
|
|
75
|
+
|
|
76
|
+
## 6. Neovim sidecar did not start
|
|
77
|
+
|
|
78
|
+
For Neovim, the widget depends on a sidecar process. See
|
|
79
|
+
[Install the Neovim plugin -> Troubleshoot the sidecar](install-neovim.md#troubleshoot-the-sidecar).
|
|
80
|
+
|
|
81
|
+
## 7. WSL2 cross-boundary issues
|
|
82
|
+
|
|
83
|
+
If Pi runs in WSL and the IDE runs on Windows, automatic host discovery may fail
|
|
84
|
+
behind restrictive networking. Set `PI_X_IDE_HOST_OVERRIDE` - see
|
|
85
|
+
[Use Pi × IDE over WSL2](use-wsl2.md#when-automatic-discovery-fails).
|
|
86
|
+
|
|
87
|
+
## Disable the integration
|
|
88
|
+
|
|
89
|
+
If you need to stop Pi from attaching IDE context temporarily:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
/ide off
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
This disconnects and disables automatic context attachment. Run `/ide auto` to
|
|
96
|
+
re-enable it.
|
|
97
|
+
|
|
98
|
+
## Still stuck
|
|
99
|
+
|
|
100
|
+
- [How discovery works](../explanation/discovery.md) - the matching and host
|
|
101
|
+
resolution rules.
|
|
102
|
+
- [`/ide` command reference](../reference/commands.md) - all available commands.
|
|
103
|
+
- [Architecture](../explanation/architecture.md) - the components and data flow.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Use Pi × IDE over WSL2
|
|
2
|
+
|
|
3
|
+
When Pi runs inside WSL2 and your IDE runs on native Windows, Pi × IDE discovers
|
|
4
|
+
the IDE connection across the WSL boundary automatically. This guide covers the
|
|
5
|
+
common case and the manual override for restricted networking.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
- The [`pi`](https://github.com/earendil-works/pi-coding-agent) CLI installed
|
|
10
|
+
inside WSL.
|
|
11
|
+
- The `pi-x-ide` Pi package installed: `pi install npm:pi-x-ide`.
|
|
12
|
+
- Your IDE (VS Code, Cursor, Windsurf, or JetBrains) running on Windows, with the
|
|
13
|
+
`pi-x-ide` extension/plugin installed.
|
|
14
|
+
|
|
15
|
+
## Connect
|
|
16
|
+
|
|
17
|
+
1. Open your project in the Windows IDE.
|
|
18
|
+
2. From inside WSL, `cd` into the same project directory and start Pi:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
cd /mnt/c/Users/you/project
|
|
22
|
+
pi
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Pi scans both the Linux home lock directory and the Windows user profile lock
|
|
26
|
+
directory. When it finds a Windows lock file (`runningInWindows: true`), it
|
|
27
|
+
resolves a reachable host automatically (see below) and connects. The widget
|
|
28
|
+
appears above the Pi input box.
|
|
29
|
+
|
|
30
|
+
## How the host is resolved
|
|
31
|
+
|
|
32
|
+
The lock file's `host` is `127.0.0.1`, which is correct for the IDE process on
|
|
33
|
+
Windows but not reachable from inside WSL. Pi resolves a usable host in this
|
|
34
|
+
order:
|
|
35
|
+
|
|
36
|
+
1. **`PI_X_IDE_HOST_OVERRIDE`** - if set, used directly.
|
|
37
|
+
2. **WSL default gateway** - parsed from `ip route show` and used only if a short
|
|
38
|
+
TCP probe to `<gateway>:<port>` succeeds.
|
|
39
|
+
3. The lock file `host` value, then `127.0.0.1` as a final fallback.
|
|
40
|
+
|
|
41
|
+
In most setups, step 2 handles everything with no configuration. For the full
|
|
42
|
+
explanation, see [How discovery works](../explanation/discovery.md#resolving-the-connection-host).
|
|
43
|
+
|
|
44
|
+
## When automatic discovery fails
|
|
45
|
+
|
|
46
|
+
If your WSL networking mode, firewall, or endpoint security blocks the gateway
|
|
47
|
+
probe, Pi cannot reach the IDE. Override the host explicitly.
|
|
48
|
+
|
|
49
|
+
### Same machine, mirrored/localhost networking
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
PI_X_IDE_HOST_OVERRIDE=127.0.0.1 pi
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### NAT networking - use the Windows host IP
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
PI_X_IDE_HOST_OVERRIDE=<windows-host-ip> pi
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Find the Windows host IP from the WSL default gateway:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
ip route show | grep default
|
|
65
|
+
# default via 172.x.x.1 dev eth0
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Use the gateway address (`172.x.x.1`) as `<windows-host-ip>`.
|
|
69
|
+
|
|
70
|
+
### Persist the override
|
|
71
|
+
|
|
72
|
+
Set the variable in `~/.pi/pi-x-ide/config.json` instead of the shell:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"env": {
|
|
77
|
+
"PI_X_IDE_HOST_OVERRIDE": "172.x.x.1"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
See [Configuration](../reference/configuration.md) for the full env reference.
|
|
83
|
+
|
|
84
|
+
## Notes
|
|
85
|
+
|
|
86
|
+
- Paths from a Windows IDE are normalized to Linux before workspace matching, so
|
|
87
|
+
`/mnt/c/...` and `C:\...` both match your WSL project directory.
|
|
88
|
+
- Zed running on Windows is also discovered across WSL; its database is read from
|
|
89
|
+
`/mnt/c/Users/<user>/AppData/Local/Zed/db/0-stable/db.sqlite`. Override with
|
|
90
|
+
`PI_X_IDE_ZED_DB` if needed.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# `/ide` command reference
|
|
2
|
+
|
|
3
|
+
Pi × IDE registers the `/ide` command family in the Pi TUI for managing IDE
|
|
4
|
+
connections.
|
|
5
|
+
|
|
6
|
+
| Command | Behavior |
|
|
7
|
+
| --------------- | ------------------------------------------------------------------ |
|
|
8
|
+
| `/ide` | Open the TUI selector to list available IDE connections. |
|
|
9
|
+
| `/ide status` | Show the current connection, workspace, and most recent selection. |
|
|
10
|
+
| `/ide list` | List candidate connections from the lock directory. |
|
|
11
|
+
| `/ide auto` | Re-attempt automatic matching by `cwd` and connect when matched. |
|
|
12
|
+
| `/ide off` | Disconnect and disable automatic context attachment. |
|
|
13
|
+
| `/ide attach` | Manually insert the latest selection range into the input box. |
|
|
14
|
+
| `/ide install` | Install or update `balaenis.pi-x-ide` through a supported IDE CLI. |
|
|
15
|
+
| `/ide settings` | Open IDE settings (`Display`, `AutoInstall`, …). |
|
|
16
|
+
|
|
17
|
+
### `/ide settings`
|
|
18
|
+
|
|
19
|
+
Unified settings entry. Layout:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
Settings:
|
|
23
|
+
→ Display widget IDE status placement: widget or statusline
|
|
24
|
+
AutoInstall true Auto-install VS Code-family extension on startup
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Setting | Values | Config key / env | Default |
|
|
28
|
+
| ------------- | ----------------------- | --------------------------- | -------- |
|
|
29
|
+
| `Display` | `widget` / `statusline` | `status_display` | `widget` |
|
|
30
|
+
| `AutoInstall` | `true` / `false` | `env.PI_X_IDE_AUTO_INSTALL` | `true` |
|
|
31
|
+
|
|
32
|
+
Keybindings:
|
|
33
|
+
|
|
34
|
+
| Key | Action |
|
|
35
|
+
| -------- | ----------------------------------- |
|
|
36
|
+
| `↑`/`↓` | Move between settings |
|
|
37
|
+
| `Space` | Cycle the selected setting's value |
|
|
38
|
+
| `Ctrl+S` | Save all settings to global config |
|
|
39
|
+
| `Ctrl+P` | Save all settings to project config |
|
|
40
|
+
| `Esc` | Cancel without saving |
|
|
41
|
+
|
|
42
|
+
- **Global:** `~/.pi/pi-x-ide/config.json`
|
|
43
|
+
- **Project:** `<cwd>/.pi/pi-x-ide/config.json` (overrides global)
|
|
44
|
+
|
|
45
|
+
`Display` applies immediately in the current Pi session. See
|
|
46
|
+
[Configuration](configuration.md).
|
|
47
|
+
|
|
48
|
+
## The attach shortcut
|
|
49
|
+
|
|
50
|
+
Pi registers `Ctrl+Alt+K` in the TUI as a shortcut for `/ide attach` by default.
|
|
51
|
+
Repeated presses append the latest selected range to the current input, so you can
|
|
52
|
+
select multiple ranges in the editor and attach them one by one.
|
|
53
|
+
|
|
54
|
+
- **macOS:** this is a terminal shortcut (`Ctrl+Option+K`). `Cmd` shortcuts are
|
|
55
|
+
handled by the terminal/OS and are not available to Pi's TUI.
|
|
56
|
+
- **Customize:** set `PI_X_IDE_ATTACH_SHORTCUT` to another pi key id.
|
|
57
|
+
- **Disable:** set `PI_X_IDE_ATTACH_SHORTCUT` to `off`, `none`, `false`, or `0`.
|
|
58
|
+
|
|
59
|
+
See [Configuration](configuration.md) for the full environment variable reference.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Configuration reference
|
|
2
|
+
|
|
3
|
+
Pi × IDE is configured through three layers: per-IDE settings, Pi-side
|
|
4
|
+
environment variables, and top-level options in config JSON files.
|
|
5
|
+
|
|
6
|
+
Config files:
|
|
7
|
+
|
|
8
|
+
- **Global:** `~/.pi/pi-x-ide/config.json`
|
|
9
|
+
- **Project:** `<cwd>/.pi/pi-x-ide/config.json` (overrides global for supported keys)
|
|
10
|
+
|
|
11
|
+
Pi-side variables can be set as real environment variables **or** in config
|
|
12
|
+
`env`. Real environment variables take precedence. Interactive settings
|
|
13
|
+
(`Display`, `AutoInstall`, …) are available via [`/ide settings`](commands.md).
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"$schema": "https://raw.githubusercontent.com/saifymatteo/pi-x-ide/refs/heads/main/schemas/config.json",
|
|
18
|
+
"fixPrompt": "Analyze the errors and warnings at the following location, and try to fix them:\n{DIAGNOSTIC}",
|
|
19
|
+
"status_display": "widget",
|
|
20
|
+
"env": {
|
|
21
|
+
"PI_X_IDE_AUTO_INSTALL": "1",
|
|
22
|
+
"PI_X_IDE_ATTACH_SHORTCUT": "ctrl+alt+k"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
See [`config.example.json`](../../config.example.json) for a starting template and
|
|
28
|
+
[`schemas/config.json`](../../schemas/config.json) for the editor schema.
|
|
29
|
+
|
|
30
|
+
## VS Code settings
|
|
31
|
+
|
|
32
|
+
| Key | Type | Default | Description |
|
|
33
|
+
| ---------------- | --------- | ------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
34
|
+
| `piXIde.useTmux` | `boolean` | `false` | Open Pi through `tmux` from the terminal icon. Each click creates a new session that is destroyed when the terminal detaches. |
|
|
35
|
+
|
|
36
|
+
## Zed
|
|
37
|
+
|
|
38
|
+
| Environment variable | Default | Description |
|
|
39
|
+
| ------------------------------- | ------------- | ----------------------------------------------------------------- |
|
|
40
|
+
| `PI_X_IDE_ZED_DB` | (auto-detect) | Override the path to Zed's SQLite database. |
|
|
41
|
+
| `PI_X_IDE_ZED_POLL_INTERVAL_MS` | `1000` | Zed SQLite polling interval in milliseconds, clamped to 100–2000. |
|
|
42
|
+
|
|
43
|
+
Default database paths:
|
|
44
|
+
|
|
45
|
+
- **Linux:** `~/.local/share/zed/db/0-stable/db.sqlite`
|
|
46
|
+
- **macOS:** `~/Library/Application Support/Zed/db/0-stable/db.sqlite`
|
|
47
|
+
- **Windows:** `%LOCALAPPDATA%\Zed\db\0-stable\db.sqlite`
|
|
48
|
+
- **WSL with Windows Zed:** `/mnt/c/Users/<user>/AppData/Local/Zed/db/0-stable/db.sqlite`
|
|
49
|
+
|
|
50
|
+
## Neovim
|
|
51
|
+
|
|
52
|
+
```lua
|
|
53
|
+
require("pi_x_ide").setup({
|
|
54
|
+
enabled = true,
|
|
55
|
+
keymap = "<C-A-k>",
|
|
56
|
+
debounce_ms = 150,
|
|
57
|
+
-- sidecar_cmd = { "node", "/absolute/path/to/pi-x-ide-nvim-sidecar.cjs" },
|
|
58
|
+
-- workspace_folders = { "/path/to/project" },
|
|
59
|
+
})
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
| Option | Default | Description |
|
|
63
|
+
| ------------------- | --------- | ------------------------------------------------ |
|
|
64
|
+
| `enabled` | `true` | Enable or disable the plugin. |
|
|
65
|
+
| `keymap` | `<C-A-k>` | Keymap to attach the current selection to Pi. |
|
|
66
|
+
| `debounce_ms` | `150` | Debounce interval for selection notifications. |
|
|
67
|
+
| `sidecar_cmd` | (auto) | Override the sidecar command. |
|
|
68
|
+
| `workspace_folders` | (auto) | Override the workspace folders advertised to Pi. |
|
|
69
|
+
|
|
70
|
+
If the sidecar does not start, run `:PiXIdeStatus`, or set `sidecar_cmd` to a
|
|
71
|
+
custom command. See
|
|
72
|
+
[Install the Neovim plugin](../how-to/install-neovim.md#troubleshoot-the-sidecar).
|
|
73
|
+
|
|
74
|
+
| Command | Behavior |
|
|
75
|
+
| --------------- | --------------------------------------------------------------------- |
|
|
76
|
+
| `:PiXIdeStart` | Start the Neovim sidecar and write the lock file. |
|
|
77
|
+
| `:PiXIdeStop` | Stop the sidecar and remove the lock file. |
|
|
78
|
+
| `:PiXIdeStatus` | Show whether the sidecar is running. |
|
|
79
|
+
| `:PiXIdeAttach` | Attach the current file or selection to Pi as `@relative/path#Lx-Ly`. |
|
|
80
|
+
|
|
81
|
+
## Pi-side environment variables
|
|
82
|
+
|
|
83
|
+
| Variable | Default | Description |
|
|
84
|
+
| ------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
85
|
+
| `PI_X_IDE_AUTO_INSTALL` | `1` | Auto-install the VS Code extension on Pi startup. Set to `0`/`false`/`off` to disable. Also configurable as `AutoInstall` in `/ide settings`. |
|
|
86
|
+
| `PI_X_IDE_ATTACH_SHORTCUT` | `ctrl+alt+k` | Pi TUI shortcut for `/ide attach`. Set to `off`, `none`, `false`, or `0` to disable. |
|
|
87
|
+
| `PI_X_IDE_HOST_OVERRIDE` | (unset) | Override the host Pi uses for IDE WebSocket connections. Useful for WSL2 networking. |
|
|
88
|
+
| `PI_X_IDE_ZED_DB` | (auto-detect) | Override the path to Zed's SQLite database. |
|
|
89
|
+
| `PI_X_IDE_ZED_POLL_INTERVAL_MS` | `1000` | Zed SQLite polling interval in milliseconds, clamped to 100–2000. |
|
|
90
|
+
|
|
91
|
+
## Top-level options
|
|
92
|
+
|
|
93
|
+
<a id="top-level-options"></a>
|
|
94
|
+
|
|
95
|
+
| Option | Default | Description |
|
|
96
|
+
| ---------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
97
|
+
| `fixPrompt` | `Analyze the errors and warnings at the following location, and try to fix them:\n{DIAGNOSTIC}` | Custom prompt prefix when requesting a fix for IDE diagnostics. Use `{DIAGNOSTIC}` as a placeholder for the diagnostic context. If the placeholder is omitted, the diagnostic context is appended after your prompt. |
|
|
98
|
+
| `status_display` | `widget` | Where to show IDE connection status in the Pi TUI. Default `widget` (above-editor); `statusline` uses the footer status line. Only one placement is active at a time. Project config overrides global. Set as `Display` via `/ide settings`. |
|
|
99
|
+
|
|
100
|
+
The `fixPrompt` controls the prompt used by the VS Code **Pi: Fix it** Quick Fix
|
|
101
|
+
action. See [Install the VS Code extension](../how-to/install-vscode.md#diagnostic-quick-fix).
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Feature parity
|
|
2
|
+
|
|
3
|
+
Capabilities supported by each editor integration.
|
|
4
|
+
|
|
5
|
+
| Feature | VS Code | Zed | Neovim | JetBrains |
|
|
6
|
+
| --------------------------------------------- | ----------------------- | ---------- | ----------------------------- | ----------------------- |
|
|
7
|
+
| Live file tracking | ✅ Real-time push | ✅ polling | ✅ Real-time push via sidecar | ✅ Real-time push |
|
|
8
|
+
| Live selection tracking | ✅ Real-time push | ✅ polling | ✅ Real-time push via sidecar | ✅ Real-time push |
|
|
9
|
+
| IDE context attach shortcut | ✅ Default `Ctrl+Alt+K` | ❌ | ✅ Custom configured keymap | ✅ Default `Ctrl+Alt+K` |
|
|
10
|
+
| Pi TUI attach shortcut (default `Ctrl+Alt+K`) | ✅ | ✅ | ✅ | ✅ |
|
|
11
|
+
| LLM context injection | ✅ | ✅ | ✅ | ✅ |
|
|
12
|
+
| `/ide auto` | ✅ | ✅ | ✅ | ✅ |
|
|
13
|
+
| Diagnostic Quick Fix | ✅ | ❌ | ❌ | ❌ |
|
|
14
|
+
| Auto-install | ✅ VS Code-family only | N/A | ❌ | ❌ |
|
|
15
|
+
|
|
16
|
+
## Notes
|
|
17
|
+
|
|
18
|
+
- **Zed** has no extension API, so file and selection tracking are polling-based
|
|
19
|
+
(default 1000 ms). See [Architecture](../explanation/architecture.md#zed-polling).
|
|
20
|
+
- **Neovim** uses a sidecar process to host the WebSocket server; the attach
|
|
21
|
+
shortcut is configured in the Lua plugin, not inherited from Pi. See
|
|
22
|
+
[Install the Neovim plugin](../how-to/install-neovim.md).
|
|
23
|
+
- **Diagnostic Quick Fix** and **auto-install** are VS Code-family features.
|
|
24
|
+
- **WSL2** cross-boundary discovery works for all editors that write lock files
|
|
25
|
+
(VS Code-family, Neovim, JetBrains) and for Zed via its Windows database path.
|
|
26
|
+
See [Use Pi × IDE over WSL2](../how-to/use-wsl2.md).
|