@dreki-gg/pi-lsp 0.1.3 → 0.2.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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # @dreki-gg/pi-lsp
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`32797ff`](https://github.com/dreki-gg/pi-extensions/commit/32797ff18d968e22c6c44e95c46e3393d8928cef) Thanks [@jalbarrang](https://github.com/jalbarrang)! - feat(plan-mode): add Windows compatibility — replace Unix shell commands with cross-platform Bun/Node APIs
8
+
9
+ Plan-mode no longer shells out to `cat`, `bash`, or `mkdir` via `pi.exec()`. File I/O now uses `Bun.file()` / `Bun.write()` and `node:fs/promises` `mkdir`, making the extension fully cross-platform. Destructive and safe command pattern lists now include Windows equivalents (`del`, `rd`, `copy`, `move`, `powershell`, `dir`, `where`, `tasklist`, etc.).
10
+
11
+ Also fixes Windows compatibility in three other packages:
12
+
13
+ - **browser-tools**: `spawn` now uses `shell: true` on Windows so `.cmd` wrappers resolve correctly; `shellEscape` uses double-quote style on Windows; install guidance is platform-aware (Homebrew shown only on macOS).
14
+ - **subagent**: `spawn` uses `shell: true` on Windows when the command is bare `pi`, allowing `pi.cmd` resolution.
15
+ - **lsp**: `globalConfigPath()` now uses `os.homedir()` on Windows instead of the unreliable `process.env.HOME`.
16
+
17
+ ## 0.2.0
18
+
19
+ ### Minor Changes
20
+
21
+ - [`d1c6d0b`](https://github.com/dreki-gg/pi-extensions/commit/d1c6d0b7da843700a7381790d9323f78dd26b152) Thanks [@jalbarrang](https://github.com/jalbarrang)! - Add Windows support for the LSP extension: spawn with `shell: true` on win32 for `.cmd` wrappers, use `where` instead of `which` for command lookup, normalize file URIs with `file:///` and forward slashes for drive-letter paths per RFC 8089, and fix `uriToPath` to correctly round-trip Windows URIs.
22
+
3
23
  ## 0.1.3
4
24
 
5
25
  ### Patch Changes
@@ -29,12 +29,19 @@ import type {
29
29
  // ── Helpers ─────────────────────────────────────────────────────────────────
30
30
 
31
31
  export function pathToUri(filePath: string): string {
32
- const abs = filePath.startsWith('/') ? filePath : resolve(filePath);
33
- return `file://${abs}`;
32
+ const abs = resolve(filePath);
33
+ const normalized = abs.replace(/\\/g, '/');
34
+ // Windows paths need file:///C:/... (three slashes)
35
+ if (/^[A-Za-z]:/.test(normalized)) return `file:///${normalized}`;
36
+ return `file://${normalized}`;
34
37
  }
35
38
 
36
39
  export function uriToPath(uri: string): string {
37
- return uri.startsWith('file://') ? uri.slice(7) : uri;
40
+ if (!uri.startsWith('file://')) return uri;
41
+ const path = uri.slice(7);
42
+ // Remove leading slash before Windows drive letter: /C:/... → C:/...
43
+ if (/^\/[A-Za-z]:/.test(path)) return path.slice(1);
44
+ return path;
38
45
  }
39
46
 
40
47
  function languageIdForFile(filePath: string): string {
@@ -21,7 +21,8 @@ import type { LspConfigFile, LspServerUserConfig, ResolvedServerConfig } from '.
21
21
  // ── Paths ───────────────────────────────────────────────────────────────────
22
22
 
23
23
  function globalConfigPath(): string {
24
- return join(process.env.HOME ?? homedir(), '.pi', 'agent', 'extensions', 'lsp', 'config.json');
24
+ const home = process.platform === 'win32' ? homedir() : (process.env.HOME ?? homedir());
25
+ return join(home, '.pi', 'agent', 'extensions', 'lsp', 'config.json');
25
26
  }
26
27
 
27
28
  function projectConfigPath(cwd: string): string {
@@ -76,7 +77,8 @@ async function loadJsonFile<T>(path: string): Promise<T | null> {
76
77
 
77
78
  function commandAvailableVia(command: string, cwd: string): 'global' | 'npx' | null {
78
79
  try {
79
- execSync(`which ${command}`, { stdio: 'pipe', timeout: 5_000 });
80
+ const whichCmd = process.platform === 'win32' ? 'where' : 'which';
81
+ execSync(`${whichCmd} ${command}`, { stdio: 'pipe', timeout: 5_000 });
80
82
  return 'global';
81
83
  } catch {
82
84
  // not global
@@ -43,6 +43,7 @@ export class LspConnection {
43
43
  stdio: ['pipe', 'pipe', 'pipe'],
44
44
  cwd: this.options?.cwd,
45
45
  env: { ...process.env, ...this.options?.env },
46
+ shell: process.platform === 'win32',
46
47
  });
47
48
 
48
49
  this.process.stdout!.on('data', (chunk: Buffer) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreki-gg/pi-lsp",
3
- "version": "0.1.3",
3
+ "version": "0.2.1",
4
4
  "description": "Language-agnostic LSP code intelligence for pi — diagnostics, hover, definitions, references, symbols, and call hierarchy",
5
5
  "keywords": [
6
6
  "pi-package"