pi-x-ide 1.13.0 → 1.13.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 CHANGED
@@ -14,8 +14,6 @@ Automatically attaches the currently opened or selected file and text range from
14
14
  pi install npm:pi-x-ide
15
15
  ```
16
16
 
17
- This installs `pi-x-ide` as a global Pi extension. Pi loads it automatically on startup — no flags needed.
18
-
19
17
  ### Install the IDE Extension
20
18
 
21
19
  #### VS Code / Cursor / Windsurf
@@ -51,16 +49,22 @@ SHA-256 digest before caching it. If the download or checksum verification fails
51
49
  or no binary matches your platform, the plugin falls back to the bundled Node.js
52
50
  sidecar — Node.js is then required on PATH.
53
51
 
54
- The binary is cached under `stdpath("cache")/pi-x-ide/` and reused on subsequent
55
- starts. Plugin updates trigger a one-time re-download.
52
+ Downloaded binaries are cached under `stdpath("cache")/pi-x-ide/` and reused on
53
+ subsequent starts. The optional lazy.nvim build hook uses the bundled binary when
54
+ present; otherwise it checks the release digest on install and update,
55
+ downloading only when the cached binary is missing or stale.
56
56
 
57
57
  **lazy.nvim:**
58
58
 
59
59
  ```lua
60
60
  {
61
61
  "balaenis/pi-x-ide",
62
+ build = function(plugin)
63
+ vim.opt.rtp:prepend(plugin.dir .. "/ide-plugins/nvim")
64
+ require("pi_x_ide.download").run({ refresh = true })
65
+ end,
62
66
  init = function(plugin)
63
- vim.opt.rtp:prepend(plugin.dir .. "/nvim")
67
+ vim.opt.rtp:prepend(plugin.dir .. "/ide-plugins/nvim")
64
68
  end,
65
69
  main = "pi_x_ide",
66
70
  opts = {
@@ -69,12 +73,19 @@ starts. Plugin updates trigger a one-time re-download.
69
73
  }
70
74
  ```
71
75
 
72
- > **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. The plugin options are passed through lazy.nvim's recommended `opts` field.
76
+ > **Note:** The `init` block manually adds the `ide-plugins/nvim/` subdirectory to the runtime path to avoid a Lua module resolution issue with some lazy.nvim versions. The plugin options are passed through lazy.nvim's recommended `opts` field.
77
+ >
78
+ > The optional `build` hook resolves the bundled sidecar binary when present;
79
+ > otherwise it checks the GitHub Release asset digest at install/update time
80
+ > (`:Lazy build pi-x-ide` to re-run) and downloads only when the cached binary is
81
+ > missing or stale. It is safe to omit: the plugin still downloads the binary
82
+ > lazily on first start and falls back to the Node.js sidecar if the download is
83
+ > unavailable.
73
84
 
74
85
  **Native package:**
75
86
 
76
87
  ```vim
77
- set runtimepath+=/path/to/pi-x-ide/nvim
88
+ set runtimepath+=/path/to/pi-x-ide/ide-plugins/nvim
78
89
  lua require("pi_x_ide").setup({ keymap = "<leader>pa" })
79
90
  ```
80
91
 
@@ -241,13 +252,13 @@ pi -e ./src/pi/index.ts
241
252
 
242
253
  All `bun run` commands have equivalent `mise run` tasks (see `mise.toml`):
243
254
 
244
- | Command | Description |
245
- | ----------------------------- | -------------------------------------------------------------------------------------------------- |
246
- | `bun run build` | Build Pi-side TypeScript → `dist/` + Neovim sidecar → `nvim/bin/` + VS Code bundle → `vscode/out/` |
247
- | `bun run typecheck` | Type-check only (no output files) |
248
- | `bun run test` | Build + run unit tests |
249
- | `bun run package:vsix` | Package VS Code extension as VSIX |
250
- | `bun run check:config-schema` | Verify `schemas/config.json` is in sync with the config registry |
255
+ | Command | Description |
256
+ | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
257
+ | `bun run build` | Build Pi-side TypeScript → `dist/` + Neovim sidecar → `ide-plugins/nvim/bin/` + VS Code bundle → `ide-plugins/vscode/out/` |
258
+ | `bun run typecheck` | Type-check only (no output files) |
259
+ | `bun run test` | Build + run unit tests |
260
+ | `bun run package:vsix` | Package VS Code extension as VSIX |
261
+ | `bun run check:config-schema` | Verify `schemas/config.json` is in sync with the config registry |
251
262
 
252
263
  ### Testing the VS Code Extension Locally
253
264
 
@@ -264,7 +275,7 @@ All `bun run` commands have equivalent `mise run` tasks (see `mise.toml`):
264
275
 
265
276
  ```bash
266
277
  bun run package:vsix
267
- cd vscode && code --install-extension dist/pi-x-ide-$(node -p "require('./package.json').version").vsix
278
+ cd ide-plugins/vscode && code --install-extension dist/pi-x-ide-$(node -p "require('./package.json').version").vsix
268
279
  ```
269
280
 
270
281
  The extension installed this way runs in all VS Code windows, independent of the F5 Extension Host.
package/README.zh-CN.md CHANGED
@@ -14,8 +14,6 @@
14
14
  pi install npm:pi-x-ide
15
15
  ```
16
16
 
17
- 将 `pi-x-ide` 安装为全局 Pi 扩展,Pi 启动时自动加载,无需额外参数。
18
-
19
17
  ### 安装 IDE 扩展
20
18
 
21
19
  #### VS Code / Cursor / Windsurf
@@ -50,16 +48,20 @@ x64 或 arm64),并在写入缓存前用 release asset 的 SHA-256 digest 做
50
48
  或校验失败、或无匹配二进制时,插件降级到内置的 Node.js sidecar — 此时需要
51
49
  PATH 中有 Node.js。
52
50
 
53
- 二进制文件缓存在 `stdpath("cache")/pi-x-ide/` 目录,后续启动直接复用。插件
54
- 更新后会触发一次重新下载。
51
+ 下载的二进制文件缓存在 `stdpath("cache")/pi-x-ide/` 目录,后续启动直接复用。可选的
52
+ lazy.nvim build 钩子会优先使用插件包内的 bundled binary;如果不存在,则在安装和更新时检查 release digest,仅在缓存二进制缺失或过期时下载。
55
53
 
56
54
  **lazy.nvim:**
57
55
 
58
56
  ```lua
59
57
  {
60
58
  "balaenis/pi-x-ide",
59
+ build = function(plugin)
60
+ vim.opt.rtp:prepend(plugin.dir .. "/ide-plugins/nvim")
61
+ require("pi_x_ide.download").run({ refresh = true })
62
+ end,
61
63
  init = function(plugin)
62
- vim.opt.rtp:prepend(plugin.dir .. "/nvim")
64
+ vim.opt.rtp:prepend(plugin.dir .. "/ide-plugins/nvim")
63
65
  end,
64
66
  main = "pi_x_ide",
65
67
  opts = {
@@ -68,12 +70,14 @@ PATH 中有 Node.js。
68
70
  }
69
71
  ```
70
72
 
71
- > **注意:** `init` 块手动将 `nvim/` 子目录加入 runtime path,以规避部分版本 lazy.nvim 的 Lua 模块解析兼容性问题。插件选项通过 lazy.nvim 推荐的 `opts` 字段传入。
73
+ > **注意:** `init` 块手动将 `ide-plugins/nvim/` 子目录加入 runtime path,以规避部分版本 lazy.nvim 的 Lua 模块解析兼容性问题。插件选项通过 lazy.nvim 推荐的 `opts` 字段传入。
74
+ >
75
+ > 可选的 `build` 钩子会优先使用插件包内的 bundled sidecar 二进制;如果不存在,则在安装/更新时检查 GitHub Release asset digest(用 `:Lazy build pi-x-ide` 可重新触发),仅在缓存二进制缺失或过期时下载。该钩子可以省略:插件仍会在首次启动时按需下载二进制,下载不可用时回退到 Node.js sidecar。
72
76
 
73
77
  **原生 package:**
74
78
 
75
79
  ```vim
76
- set runtimepath+=/path/to/pi-x-ide/nvim
80
+ set runtimepath+=/path/to/pi-x-ide/ide-plugins/nvim
77
81
  lua require("pi_x_ide").setup({ keymap = "<leader>pa" })
78
82
  ```
79
83
 
@@ -239,13 +243,13 @@ pi -e ./src/pi/index.ts
239
243
 
240
244
  所有 `bun run` 命令都有等效的 `mise run` 任务(见 `mise.toml`):
241
245
 
242
- | 命令 | 说明 |
243
- | ----------------------------- | ----------------------------------------------------------------------------------------------- |
244
- | `bun run build` | 编译 Pi 侧 TypeScript → `dist/` + Neovim sidecar → `nvim/bin/` + VS Code bundle → `vscode/out/` |
245
- | `bun run typecheck` | 类型检查(不产出文件) |
246
- | `bun run test` | 编译 + 运行单元测试 |
247
- | `bun run package:vsix` | 打包 VS Code 扩展为 VSIX |
248
- | `bun run check:config-schema` | 验证 `schemas/config.json` 与配置注册表是否同步 |
246
+ | 命令 | 说明 |
247
+ | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
248
+ | `bun run build` | 编译 Pi 侧 TypeScript → `dist/` + Neovim sidecar → `ide-plugins/nvim/bin/` + VS Code bundle → `ide-plugins/vscode/out/` |
249
+ | `bun run typecheck` | 类型检查(不产出文件) |
250
+ | `bun run test` | 编译 + 运行单元测试 |
251
+ | `bun run package:vsix` | 打包 VS Code 扩展为 VSIX |
252
+ | `bun run check:config-schema` | 验证 `schemas/config.json` 与配置注册表是否同步 |
249
253
 
250
254
  ### 本地测试 VS Code 扩展
251
255
 
@@ -262,7 +266,7 @@ pi -e ./src/pi/index.ts
262
266
 
263
267
  ```bash
264
268
  bun run package:vsix
265
- cd vscode && code --install-extension dist/pi-x-ide-$(node -p "require('./package.json').version").vsix
269
+ cd ide-plugins/vscode && code --install-extension dist/pi-x-ide-$(node -p "require('./package.json').version").vsix
266
270
  ```
267
271
 
268
272
  这样安装的扩展在所有 VS Code 窗口中运行,不依赖 F5 Extension Host。
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-x-ide",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "Pi extension package for IDE selection context integration.",
5
5
  "files": [
6
6
  "dist",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "homepage": "https://github.com/balaenis/pi-x-ide#readme",
28
28
  "workspaces": [
29
- "vscode"
29
+ "ide-plugins/vscode"
30
30
  ],
31
31
  "packageManager": "bun@1.3.14",
32
32
  "engines": {
@@ -35,7 +35,7 @@
35
35
  "type": "commonjs",
36
36
  "main": "./dist/src/pi/index.js",
37
37
  "scripts": {
38
- "typecheck": "tsc -p tsconfig.json --noEmit && bun run --filter './vscode' typecheck",
38
+ "typecheck": "tsc -p tsconfig.json --noEmit && bun run --filter './ide-plugins/vscode' typecheck",
39
39
  "generate:config-schema": "bun run scripts/generate-config-schema.cjs",
40
40
  "check:config-schema": "bun run scripts/generate-config-schema.cjs --check",
41
41
  "test": "bun run check:config-schema && bun run compile && node --test dist/test/*.test.js",
@@ -44,9 +44,9 @@
44
44
  "format": "prettier --write .",
45
45
  "format:check": "prettier --check .",
46
46
  "compile": "tsc -p tsconfig.json",
47
- "compile:vsix": "bun run --filter './vscode' compile",
48
- "sync:vsix-assets": "bun run --filter './vscode' sync:assets",
49
- "package:vsix": "bun run --filter './vscode' package",
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
50
  "package:nvim-sidecar": "bun run scripts/build-nvim-sidecar.mjs --production",
51
51
  "package:nvim-sidecar:all": "bun run scripts/build-nvim-sidecar.mjs --production --target=all",
52
52
  "build": "bun run compile && bun run compile:vsix && bun run package:nvim-sidecar",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-x-ide",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "Pi extension package for IDE selection context integration.",
5
5
  "files": [
6
6
  "dist",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "homepage": "https://github.com/balaenis/pi-x-ide#readme",
28
28
  "workspaces": [
29
- "vscode"
29
+ "ide-plugins/vscode"
30
30
  ],
31
31
  "packageManager": "bun@1.3.14",
32
32
  "engines": {
@@ -35,7 +35,7 @@
35
35
  "type": "commonjs",
36
36
  "main": "./dist/src/pi/index.js",
37
37
  "scripts": {
38
- "typecheck": "tsc -p tsconfig.json --noEmit && bun run --filter './vscode' typecheck",
38
+ "typecheck": "tsc -p tsconfig.json --noEmit && bun run --filter './ide-plugins/vscode' typecheck",
39
39
  "generate:config-schema": "bun run scripts/generate-config-schema.cjs",
40
40
  "check:config-schema": "bun run scripts/generate-config-schema.cjs --check",
41
41
  "test": "bun run check:config-schema && bun run compile && node --test dist/test/*.test.js",
@@ -44,9 +44,9 @@
44
44
  "format": "prettier --write .",
45
45
  "format:check": "prettier --check .",
46
46
  "compile": "tsc -p tsconfig.json",
47
- "compile:vsix": "bun run --filter './vscode' compile",
48
- "sync:vsix-assets": "bun run --filter './vscode' sync:assets",
49
- "package:vsix": "bun run --filter './vscode' package",
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
50
  "package:nvim-sidecar": "bun run scripts/build-nvim-sidecar.mjs --production",
51
51
  "package:nvim-sidecar:all": "bun run scripts/build-nvim-sidecar.mjs --production --target=all",
52
52
  "build": "bun run compile && bun run compile:vsix && bun run package:nvim-sidecar",