@yofriadi/pi-lsp 1.16.10

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 ADDED
@@ -0,0 +1,94 @@
1
+ # LSP Extension Scaffold
2
+
3
+ Standalone package scaffold for pi LSP integration work.
4
+
5
+ ## Scope
6
+
7
+ This extension package now includes:
8
+
9
+ - Runtime lifecycle management for an LSP subprocess (Bun `spawn` when available, Node `child_process.spawn` fallback) + JSON-RPC initialize/shutdown
10
+ - PATH/Mason-first server resolution with lightweight user/project config
11
+ - Full `lsp` tool action surface (`diagnostics`, `definition`, `references`, `hover`, `symbols`, `rename`, `status`, `reload`)
12
+ - Backward-compatible `lsp_health` status alias
13
+ - Write-through hooks that run format-on-write and diagnostics-on-write for successful `write`/`edit` results
14
+
15
+ The extension remains opt-in and does not alter default pi behavior unless loaded.
16
+
17
+ ## Lightweight Server Config
18
+
19
+ Server resolution order:
20
+
21
+ 1. User config: `~/.pi/agent/lsp.json|yaml|yml` (fallback: `~/.pi/lsp.json|yaml|yml`)
22
+ 2. Project config: `<cwd>/.pi/lsp.json|yaml|yml` (overrides user config)
23
+ 3. Mason bin directories before regular `PATH`
24
+ 4. Small built-in candidate list (no large bundled server catalog)
25
+
26
+ Supported config keys:
27
+
28
+ - `serverCommand`: string or string array, e.g. `["typescript-language-server", "--stdio"]`
29
+ - `server`: command name/path with optional `args`
30
+ - `serverCandidates`: explicit command candidates in probe order
31
+
32
+ ## Package Layout
33
+
34
+ - `src/index.ts`: extension entrypoint and runtime/tool/hook wiring
35
+ - `src/client/runtime.ts`: LSP client lifecycle, JSON-RPC request surface, diagnostics cache
36
+ - `src/config/resolver.ts`: server command/config resolution
37
+ - `src/tools/lsp-tool.ts`: full `lsp` tool schema/action routing + `lsp_health` alias
38
+ - `src/hooks/writethrough.ts`: format-on-write and diagnostics-on-write hooks
39
+
40
+ ## Install and Load
41
+
42
+ ### Upstream `pi`
43
+
44
+ ```bash
45
+ # Load for one run
46
+ pi -e ./packages/coding-agent/examples/extensions/lsp
47
+
48
+ # Install as local package source
49
+ pi install ./packages/coding-agent/examples/extensions/lsp
50
+ ```
51
+
52
+ ### Fork Workflow
53
+
54
+ Use whichever launcher your fork environment provides:
55
+
56
+ ```bash
57
+ # Source-run from repo
58
+ bun packages/coding-agent/src/cli.ts -e ./packages/coding-agent/examples/extensions/lsp
59
+
60
+ # If your fork is installed as a separate binary (example name)
61
+ pib -e ./packages/coding-agent/examples/extensions/lsp
62
+ ```
63
+
64
+ ## Usage
65
+
66
+ After loading the extension:
67
+
68
+ - Run `/lsp-status` to inspect runtime/config/transport state.
69
+ - Use the `lsp` tool with action-based params:
70
+ - `status`
71
+ - `reload`
72
+ - `hover` / `definition` / `references` / `rename` (require `path`, `line`, `character`)
73
+ - `symbols` (use `query` for workspace mode or `path` for document mode)
74
+ - `diagnostics`
75
+ - Successful `write`/`edit` tool results automatically trigger format+diagnostics hooks and show a summary notification.
76
+
77
+ ## Test Coverage
78
+
79
+ Focused extension tests:
80
+
81
+ - `packages/coding-agent/test/lsp-runtime.test.ts`
82
+ - lifecycle start/stop, lspmux wrapping/fallback behavior
83
+ - `packages/coding-agent/test/lsp-tool-router.test.ts`
84
+ - `lsp` tool schema/action routing and reload/status behavior
85
+ - `packages/coding-agent/test/lsp-writethrough.test.ts`
86
+ - write-through formatting/diagnostics hooks and fallback behavior
87
+
88
+ Run focused validation:
89
+
90
+ ```bash
91
+ bun --cwd=packages/coding-agent run test -- lsp-runtime lsp-tool-router lsp-writethrough
92
+ ```
93
+
94
+ If `vitest` is not available in your current worktree, run `bun install` in repo root before re-running tests.
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@yofriadi/pi-lsp",
3
+ "version": "1.16.10",
4
+ "type": "module",
5
+ "files": [
6
+ "src",
7
+ "README.md"
8
+ ],
9
+ "keywords": [
10
+ "pi-package",
11
+ "lsp"
12
+ ],
13
+ "scripts": {
14
+ "clean": "echo 'nothing to clean'",
15
+ "build": "echo 'nothing to build'",
16
+ "check": "echo 'nothing to check'"
17
+ },
18
+ "pi": {
19
+ "extensions": [
20
+ "./src/index.ts"
21
+ ]
22
+ },
23
+ "peerDependencies": {
24
+ "@mariozechner/pi-coding-agent": "*",
25
+ "@sinclair/typebox": "*"
26
+ },
27
+ "dependencies": {
28
+ "yaml": "^2.8.2"
29
+ }
30
+ }