oh-my-lsp 0.1.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.
Files changed (134) hide show
  1. package/.claude/settings.local.json +27 -0
  2. package/.github/workflows/ci.yml +382 -0
  3. package/AGENTS.md +18 -0
  4. package/CLAUDE.md +18 -0
  5. package/LICENSE +21 -0
  6. package/README.md +223 -0
  7. package/dist/index.js +2871 -0
  8. package/package.json +52 -0
  9. package/scripts/fix-shebang.cjs +22 -0
  10. package/skills/oh-my-lsp/SKILL.md +177 -0
  11. package/src/ast-grep/cli.ts +159 -0
  12. package/src/ast-grep/constants.ts +3 -0
  13. package/src/ast-grep/index.ts +3 -0
  14. package/src/ast-grep/language-support.ts +63 -0
  15. package/src/ast-grep/result-formatter.ts +99 -0
  16. package/src/ast-grep/sg-cli-path.ts +56 -0
  17. package/src/ast-grep/sg-compact-json-output.ts +58 -0
  18. package/src/ast-grep/types.ts +48 -0
  19. package/src/commands/ast-grep-command.ts +66 -0
  20. package/src/commands/diagnostics-command.ts +53 -0
  21. package/src/commands/find-references-command.ts +242 -0
  22. package/src/commands/goto-definition-command.ts +43 -0
  23. package/src/commands/rename-command.ts +62 -0
  24. package/src/commands/symbols-command.ts +78 -0
  25. package/src/index.ts +377 -0
  26. package/src/lsp/client.ts +3 -0
  27. package/src/lsp/config.ts +3 -0
  28. package/src/lsp/constants.ts +6 -0
  29. package/src/lsp/language-config.ts +5 -0
  30. package/src/lsp/language-mappings.ts +171 -0
  31. package/src/lsp/lombok-detector.ts +148 -0
  32. package/src/lsp/lsp-client-connection.ts +66 -0
  33. package/src/lsp/lsp-client-transport.ts +416 -0
  34. package/src/lsp/lsp-client-wrapper.ts +164 -0
  35. package/src/lsp/lsp-client.ts +131 -0
  36. package/src/lsp/lsp-formatters.ts +193 -0
  37. package/src/lsp/lsp-manager-process-cleanup.ts +45 -0
  38. package/src/lsp/lsp-manager-temp-directory-cleanup.ts +29 -0
  39. package/src/lsp/lsp-process.ts +147 -0
  40. package/src/lsp/lsp-server.ts +212 -0
  41. package/src/lsp/server-config-loader.ts +118 -0
  42. package/src/lsp/server-definitions.ts +91 -0
  43. package/src/lsp/server-installation.ts +70 -0
  44. package/src/lsp/server-resolution.ts +109 -0
  45. package/src/lsp/types.ts +125 -0
  46. package/src/lsp/workspace-edit.ts +121 -0
  47. package/src/shared/data-path.ts +47 -0
  48. package/src/shared/jsonc-parser.ts +122 -0
  49. package/src/shared/logger.ts +23 -0
  50. package/src/shared/opencode-config-dir-types.ts +15 -0
  51. package/src/shared/opencode-config-dir.ts +138 -0
  52. package/tests/commands/ast-grep-command.test.ts +184 -0
  53. package/tests/commands/find-references-command.test.ts +178 -0
  54. package/tests/commands/goto-definition-command.test.ts +72 -0
  55. package/tests/commands/language-support-navigation-command.test.ts +95 -0
  56. package/tests/commands/language-support-rename-command.test.ts +91 -0
  57. package/tests/commands/language-support-symbols-diagnostics-command.test.ts +89 -0
  58. package/tests/commands/rename-command.test.ts +130 -0
  59. package/tests/commands/symbols-command.test.ts +155 -0
  60. package/tests/fixtures/bash/diagnostics_fail.sh +9 -0
  61. package/tests/fixtures/bash/sample.sh +10 -0
  62. package/tests/fixtures/c/diagnostics_fail.c +11 -0
  63. package/tests/fixtures/c/sample.c +11 -0
  64. package/tests/fixtures/cpp/diagnostics_fail.cpp +11 -0
  65. package/tests/fixtures/cpp/sample.cpp +11 -0
  66. package/tests/fixtures/csharp/diagnostics_fail.cs +8 -0
  67. package/tests/fixtures/csharp/sample.cs +12 -0
  68. package/tests/fixtures/css/diagnostics_fail.css +2 -0
  69. package/tests/fixtures/css/sample.css +4 -0
  70. package/tests/fixtures/dockerfile/diagnostics_fail.dockerfile +2 -0
  71. package/tests/fixtures/dockerfile/sample.dockerfile +4 -0
  72. package/tests/fixtures/go/diagnostics_fail.go +10 -0
  73. package/tests/fixtures/go/go.mod +3 -0
  74. package/tests/fixtures/go/sample.go +12 -0
  75. package/tests/fixtures/java/App.java +6 -0
  76. package/tests/fixtures/java/DiagnosticsFail.java +6 -0
  77. package/tests/fixtures/java/Helper.java +5 -0
  78. package/tests/fixtures/java/Sample.java +6 -0
  79. package/tests/fixtures/javascript/diagnostics_fail.js +5 -0
  80. package/tests/fixtures/javascript/sample.js +6 -0
  81. package/tests/fixtures/kotlin/diagnostics_fail.kt +4 -0
  82. package/tests/fixtures/kotlin/sample.kt +11 -0
  83. package/tests/fixtures/lua/diagnostics_fail.lua +5 -0
  84. package/tests/fixtures/lua/sample.lua +10 -0
  85. package/tests/fixtures/php/diagnostics_fail.php +8 -0
  86. package/tests/fixtures/php/sample.php +7 -0
  87. package/tests/fixtures/python/diagnostics_fail.py +5 -0
  88. package/tests/fixtures/python/sample.py +5 -0
  89. package/tests/fixtures/ruby/diagnostics_fail.rb +5 -0
  90. package/tests/fixtures/ruby/sample.rb +6 -0
  91. package/tests/fixtures/rust/Cargo.toml +6 -0
  92. package/tests/fixtures/rust/diagnostics_fail.rs +7 -0
  93. package/tests/fixtures/rust/src/main.rs +8 -0
  94. package/tests/fixtures/typescript/diagnostics_fail.ts +6 -0
  95. package/tests/fixtures/typescript/sample.ts +6 -0
  96. package/tests/fixtures/yaml/diagnostics_fail.yaml +4 -0
  97. package/tests/fixtures/yaml/sample.yaml +4 -0
  98. package/tests/integration/cli/ast-grep-replace-cli.integration.test.ts +154 -0
  99. package/tests/integration/cli/ast-grep-search-cli.integration.test.ts +138 -0
  100. package/tests/integration/cli/bash-cli.integration.test.ts +139 -0
  101. package/tests/integration/cli/c-cli.integration.test.ts +155 -0
  102. package/tests/integration/cli/cli-test-utils.ts +143 -0
  103. package/tests/integration/cli/cpp-cli.integration.test.ts +155 -0
  104. package/tests/integration/cli/csharp-cli.integration.test.ts +154 -0
  105. package/tests/integration/cli/css-cli.integration.test.ts +48 -0
  106. package/tests/integration/cli/dockerfile-cli.integration.test.ts +53 -0
  107. package/tests/integration/cli/go-cli.integration.test.ts +153 -0
  108. package/tests/integration/cli/java-cli.integration.test.ts +156 -0
  109. package/tests/integration/cli/javascript-cli.integration.test.ts +140 -0
  110. package/tests/integration/cli/kotlin-cli.integration.test.ts +143 -0
  111. package/tests/integration/cli/lua-cli.integration.test.ts +140 -0
  112. package/tests/integration/cli/not-installed-cli.integration.test.ts +67 -0
  113. package/tests/integration/cli/php-cli.integration.test.ts +102 -0
  114. package/tests/integration/cli/python-cli.integration.test.ts +140 -0
  115. package/tests/integration/cli/ruby-cli.integration.test.ts +85 -0
  116. package/tests/integration/cli/rust-cli.integration.test.ts +183 -0
  117. package/tests/integration/cli/typescript-cli.integration.test.ts +151 -0
  118. package/tests/integration/cli/yaml-cli.integration.test.ts +53 -0
  119. package/tests/lsp/client-wrapper.test.ts +138 -0
  120. package/tests/lsp/formatters.test.ts +40 -0
  121. package/tests/lsp/jdtls-jvm-args.test.ts +155 -0
  122. package/tests/lsp/language-config.test.ts +15 -0
  123. package/tests/lsp/language-fixtures.test.ts +96 -0
  124. package/tests/lsp/lombok-detector.test.ts +268 -0
  125. package/tests/lsp/manager-temp-directory-cleanup.test.ts +26 -0
  126. package/tests/lsp/process.test.ts +41 -0
  127. package/tests/lsp/request-timeout.test.ts +55 -0
  128. package/tests/lsp/server-definitions.test.ts +12 -0
  129. package/tests/lsp/server-resolution.test.ts +137 -0
  130. package/tests/lsp/workspace-edit.test.ts +46 -0
  131. package/tests/shared/jsonc-parser.test.ts +41 -0
  132. package/tsconfig.json +16 -0
  133. package/tsup.config.ts +11 -0
  134. package/vitest.cli.config.ts +12 -0
@@ -0,0 +1,27 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npx oh-my-lsp:*)",
5
+ "Bash(git checkout:*)",
6
+ "Bash(npx vitest:*)",
7
+ "Bash(git:*)",
8
+ "Bash(npm run:*)",
9
+ "Bash(command:*)",
10
+ "Bash(gh run:*)",
11
+ "Bash(ruby-lsp:*)",
12
+ "Bash(mkdir:*)",
13
+ "Bash(ruby:*)",
14
+ "Bash(npm install:*)",
15
+ "Bash(npm test:*)",
16
+ "Bash(npx tsx:*)",
17
+ "Bash(npx tsc:*)",
18
+ "Bash(bash-language-server:*)",
19
+ "Bash(shellcheck:*)",
20
+ "Bash(OH_MY_LSP_VERBOSE=1 node:*)"
21
+ ]
22
+ },
23
+ "enableAllProjectMcpServers": true,
24
+ "enabledMcpjsonServers": [
25
+ "exa"
26
+ ]
27
+ }
@@ -0,0 +1,382 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize, reopened]
6
+ push:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Setup Node.js
18
+ uses: actions/setup-node@v4
19
+ with:
20
+ node-version: 22
21
+ cache: npm
22
+
23
+ - name: Install dependencies
24
+ run: npm ci
25
+
26
+ - name: Run test suite
27
+ run: npm run test
28
+
29
+ ast-grep-cli-tests:
30
+ name: ast-grep-cli-tests
31
+ needs: test
32
+ runs-on: ubuntu-latest
33
+
34
+ steps:
35
+ - name: Checkout
36
+ uses: actions/checkout@v4
37
+
38
+ - name: Setup Node.js
39
+ uses: actions/setup-node@v4
40
+ with:
41
+ node-version: 22
42
+ cache: npm
43
+
44
+ - name: Install dependencies
45
+ run: npm ci
46
+
47
+ - name: Install ast-grep
48
+ run: npm install -g @ast-grep/cli
49
+
50
+ - name: Verify ast-grep installation
51
+ run: command -v sg
52
+
53
+ - name: Run ast-grep search integration test
54
+ run: npm run test:cli:ast-grep-search
55
+
56
+ - name: Run ast-grep replace integration test
57
+ run: npm run test:cli:ast-grep-replace
58
+
59
+ language-cli-tests-1:
60
+ name: language-cli-tests-1 (${{ matrix.language }})
61
+ needs: test
62
+ runs-on: ubuntu-latest
63
+
64
+ strategy:
65
+ fail-fast: false
66
+ matrix:
67
+ language: [java, kotlin, go, ruby]
68
+
69
+ steps: &language_cli_tests_steps
70
+ - name: Checkout
71
+ uses: actions/checkout@v4
72
+
73
+ - name: Setup Node.js
74
+ uses: actions/setup-node@v4
75
+ with:
76
+ node-version: 22
77
+ cache: npm
78
+
79
+ - name: Install dependencies
80
+ run: npm ci
81
+
82
+ - name: Build CLI
83
+ run: npm run build
84
+
85
+ - name: Verify install hint shown before server is installed
86
+ run: |
87
+ set -euo pipefail
88
+ LANG="${{ matrix.language }}"
89
+
90
+ case "$LANG" in
91
+ java) FILE="tests/fixtures/java/App.java" ;;
92
+ rust) FILE="tests/fixtures/rust/diagnostics_fail.rs" ;;
93
+ *) FILE="$(find "tests/fixtures/$LANG" -maxdepth 1 -name 'sample.*' | head -n 1)" ;;
94
+ esac
95
+
96
+ if [ -z "$FILE" ]; then
97
+ echo "SKIP: no fixture file found for '$LANG'"
98
+ exit 0
99
+ fi
100
+
101
+ OUTPUT=$(node dist/index.js diagnostics "$FILE" 2>&1 || true)
102
+ if echo "$OUTPUT" | grep -q "NOT INSTALLED"; then
103
+ echo "PASS: '$LANG' correctly shows NOT INSTALLED hint"
104
+ elif echo "$OUTPUT" | grep -q "exited immediately"; then
105
+ echo "PASS: '$LANG' server found but exited (install hint shown for crash)"
106
+ else
107
+ echo "SKIP: '$LANG' server may already be pre-installed on this runner"
108
+ echo "Output: $OUTPUT"
109
+ fi
110
+
111
+ - name: Setup Java
112
+ if: matrix.language == 'java' || matrix.language == 'kotlin'
113
+ uses: actions/setup-java@v4
114
+ with:
115
+ distribution: temurin
116
+ java-version: '21'
117
+
118
+ - name: Setup Go
119
+ if: matrix.language == 'go'
120
+ uses: actions/setup-go@v5
121
+ with:
122
+ go-version: '1.23'
123
+ cache: false
124
+
125
+ - name: Setup .NET
126
+ if: matrix.language == 'csharp'
127
+ uses: actions/setup-dotnet@v4
128
+ with:
129
+ dotnet-version: '8.0.x'
130
+
131
+ - name: Install TypeScript language server
132
+ if: matrix.language == 'typescript' || matrix.language == 'javascript'
133
+ run: npm install -g typescript-language-server typescript
134
+
135
+ - name: Install jdtls
136
+ if: matrix.language == 'java'
137
+ run: |
138
+ set -euo pipefail
139
+
140
+ if command -v jdtls >/dev/null 2>&1; then
141
+ exit 0
142
+ fi
143
+
144
+ sudo apt-get update
145
+ if sudo apt-get install -y jdtls; then
146
+ exit 0
147
+ fi
148
+
149
+ mkdir -p "$HOME/.local/jdtls"
150
+ curl -fsSL "https://download.eclipse.org/jdtls/snapshots/jdt-language-server-latest.tar.gz" -o /tmp/jdtls.tar.gz
151
+ tar -xzf /tmp/jdtls.tar.gz -C "$HOME/.local/jdtls"
152
+ JDTLS_BIN="$(find "$HOME/.local/jdtls" -type f -name jdtls | head -n 1)"
153
+ if [ -z "$JDTLS_BIN" ]; then
154
+ echo "jdtls binary not found after fallback installation"
155
+ exit 1
156
+ fi
157
+ chmod +x "$JDTLS_BIN"
158
+ echo "$(dirname "$JDTLS_BIN")" >> "$GITHUB_PATH"
159
+
160
+ - name: Install Python language server
161
+ if: matrix.language == 'python'
162
+ run: npm install -g pyright
163
+
164
+ - name: Install PHP language server
165
+ if: matrix.language == 'php'
166
+ run: npm install -g intelephense
167
+
168
+ - name: Install Go language server
169
+ if: matrix.language == 'go'
170
+ run: go install golang.org/x/tools/gopls@latest
171
+
172
+ - name: Install C/C++ language server
173
+ if: matrix.language == 'c' || matrix.language == 'cpp'
174
+ run: |
175
+ sudo apt-get update
176
+ sudo apt-get install -y clangd
177
+
178
+ - name: Install C# language server
179
+ if: matrix.language == 'csharp'
180
+ run: |
181
+ dotnet tool install -g csharp-ls
182
+ echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"
183
+
184
+ - name: Install CSS language server
185
+ if: matrix.language == 'css'
186
+ run: npm install -g @biomejs/biome
187
+
188
+ - name: Install Bash language server
189
+ if: matrix.language == 'bash'
190
+ run: npm install -g bash-language-server
191
+
192
+ - name: Install YAML language server
193
+ if: matrix.language == 'yaml'
194
+ run: npm install -g yaml-language-server
195
+
196
+ - name: Install Dockerfile language server
197
+ if: matrix.language == 'dockerfile'
198
+ run: npm install -g dockerfile-language-server-nodejs
199
+
200
+ - name: Install Ruby language server
201
+ if: matrix.language == 'ruby'
202
+ run: |
203
+ set -euo pipefail
204
+ if ! command -v gem >/dev/null 2>&1; then
205
+ sudo apt-get update
206
+ sudo apt-get install -y ruby-full
207
+ fi
208
+ sudo gem install bundler ruby-lsp
209
+ GEM_BIN_DIR="$(ruby -r rubygems -e 'puts Gem.default_bindir')"
210
+ echo "$GEM_BIN_DIR" >> "$GITHUB_PATH"
211
+
212
+ - name: Install Rust language server
213
+ if: matrix.language == 'rust'
214
+ run: |
215
+ set -euo pipefail
216
+ if command -v rustup >/dev/null 2>&1; then
217
+ rustup component add rust-analyzer
218
+ fi
219
+ if ! command -v rust-analyzer >/dev/null 2>&1; then
220
+ sudo apt-get update
221
+ sudo apt-get install -y rust-analyzer
222
+ fi
223
+
224
+ - name: Install Kotlin language server
225
+ if: matrix.language == 'kotlin'
226
+ run: |
227
+ set -euo pipefail
228
+ if command -v kotlin-lsp >/dev/null 2>&1; then
229
+ exit 0
230
+ fi
231
+ KOTLIN_LSP_ZIP_URL="$(curl -fsSL https://github.com/Kotlin/kotlin-lsp/releases/latest | grep -o 'https://download-cdn.jetbrains.com/kotlin-lsp[^\" ]*linux-x64.zip' | head -n 1)"
232
+ if [ -z "$KOTLIN_LSP_ZIP_URL" ]; then
233
+ echo "Failed to resolve Kotlin LSP Linux artifact URL"
234
+ exit 1
235
+ fi
236
+ mkdir -p "$HOME/.local/kotlin-lsp" "$HOME/.local/bin"
237
+ curl -fsSL "$KOTLIN_LSP_ZIP_URL" -o /tmp/kotlin-lsp.zip
238
+ unzip -q -o /tmp/kotlin-lsp.zip -d "$HOME/.local/kotlin-lsp"
239
+ KOTLIN_LSP_SH="$(find "$HOME/.local/kotlin-lsp" -type f -name 'kotlin-lsp.sh' | head -n 1)"
240
+ if [ -z "$KOTLIN_LSP_SH" ]; then
241
+ echo "kotlin-lsp.sh not found after extraction"
242
+ exit 1
243
+ fi
244
+ chmod +x "$KOTLIN_LSP_SH"
245
+ ln -sf "$KOTLIN_LSP_SH" "$HOME/.local/bin/kotlin-lsp"
246
+ echo "$HOME/.local/bin" >> "$GITHUB_PATH"
247
+
248
+ - name: Install Lua language server
249
+ if: matrix.language == 'lua'
250
+ run: |
251
+ set -euo pipefail
252
+ if ! command -v lua-language-server >/dev/null 2>&1; then
253
+ sudo apt-get update
254
+ if ! sudo apt-get install -y lua-language-server; then
255
+ LUA_LS_TAG="$(curl -sI https://github.com/LuaLS/lua-language-server/releases/latest | tr -d '\r' | awk -F'/' '/^location:/{print $NF}' | tail -n 1)"
256
+ if [ -z "$LUA_LS_TAG" ]; then
257
+ echo "Failed to resolve LuaLS latest release tag"
258
+ exit 1
259
+ fi
260
+ LUA_LS_URL="https://github.com/LuaLS/lua-language-server/releases/download/${LUA_LS_TAG}/lua-language-server-${LUA_LS_TAG}-linux-x64.tar.gz"
261
+ mkdir -p "$HOME/.local/lua-language-server" "$HOME/.local/bin"
262
+ curl -fsSL "$LUA_LS_URL" -o /tmp/lua-language-server.tar.gz
263
+ tar -xzf /tmp/lua-language-server.tar.gz -C "$HOME/.local/lua-language-server"
264
+ chmod +x "$HOME/.local/lua-language-server/bin/lua-language-server"
265
+ ln -sf "$HOME/.local/lua-language-server/bin/lua-language-server" "$HOME/.local/bin/lua-language-server"
266
+ echo "$HOME/.local/bin" >> "$GITHUB_PATH"
267
+ fi
268
+ fi
269
+
270
+ - name: Verify server installation (TypeScript)
271
+ if: matrix.language == 'typescript'
272
+ run: command -v typescript-language-server
273
+
274
+ - name: Verify server installation (JavaScript)
275
+ if: matrix.language == 'javascript'
276
+ run: command -v typescript-language-server
277
+
278
+ - name: Verify server installation (Java)
279
+ if: matrix.language == 'java'
280
+ run: command -v jdtls
281
+
282
+ - name: Verify server installation (Python)
283
+ if: matrix.language == 'python'
284
+ run: command -v pyright-langserver
285
+
286
+ - name: Verify server installation (PHP)
287
+ if: matrix.language == 'php'
288
+ run: command -v intelephense
289
+
290
+ - name: Verify server installation (Go)
291
+ if: matrix.language == 'go'
292
+ run: command -v gopls
293
+
294
+ - name: Verify server installation (C)
295
+ if: matrix.language == 'c'
296
+ run: command -v clangd
297
+
298
+ - name: Verify server installation (C++)
299
+ if: matrix.language == 'cpp'
300
+ run: command -v clangd
301
+
302
+ - name: Verify server installation (C#)
303
+ if: matrix.language == 'csharp'
304
+ run: command -v csharp-ls
305
+
306
+ - name: Verify server installation (CSS)
307
+ if: matrix.language == 'css'
308
+ run: command -v biome
309
+
310
+ - name: Verify server installation (Bash)
311
+ if: matrix.language == 'bash'
312
+ run: command -v bash-language-server
313
+
314
+ - name: Verify server installation (YAML)
315
+ if: matrix.language == 'yaml'
316
+ run: command -v yaml-language-server
317
+
318
+ - name: Verify server installation (Dockerfile)
319
+ if: matrix.language == 'dockerfile'
320
+ run: command -v docker-langserver
321
+
322
+ - name: Verify server installation (Ruby)
323
+ if: matrix.language == 'ruby'
324
+ run: command -v ruby-lsp
325
+
326
+ - name: Preflight ruby-lsp startup (debug)
327
+ if: matrix.language == 'ruby'
328
+ run: |
329
+ mkdir -p /tmp/ruby-lsp-debug
330
+ cd /tmp/ruby-lsp-debug
331
+ ruby-lsp 2>&1 &
332
+ RUBY_PID=$!
333
+ sleep 10
334
+ kill "$RUBY_PID" 2>/dev/null || true
335
+ wait "$RUBY_PID" 2>/dev/null || true
336
+ echo "Preflight done (exit ignored)"
337
+
338
+ - name: Verify server installation (Rust)
339
+ if: matrix.language == 'rust'
340
+ run: command -v rust-analyzer
341
+
342
+ - name: Verify server installation (Kotlin)
343
+ if: matrix.language == 'kotlin'
344
+ run: command -v kotlin-lsp
345
+
346
+ - name: Verify server installation (Lua)
347
+ if: matrix.language == 'lua'
348
+ run: command -v lua-language-server
349
+
350
+ - name: Run CLI integration test
351
+ run: npm run test:cli:${{ matrix.language }}
352
+
353
+ language-cli-tests-2:
354
+ name: language-cli-tests-2 (${{ matrix.language }})
355
+ needs: language-cli-tests-1
356
+ runs-on: ubuntu-latest
357
+ strategy:
358
+ fail-fast: false
359
+ matrix:
360
+ language: [typescript, javascript, python, php, lua]
361
+ steps: *language_cli_tests_steps
362
+
363
+ language-cli-tests-fail:
364
+ name: language-cli-tests-fail (${{ matrix.language }})
365
+ needs: test
366
+ runs-on: ubuntu-latest
367
+ continue-on-error: true
368
+ strategy:
369
+ fail-fast: false
370
+ matrix:
371
+ language: [rust, csharp]
372
+ steps: *language_cli_tests_steps
373
+
374
+ language-cli-tests-3:
375
+ name: language-cli-tests-3 (${{ matrix.language }})
376
+ needs: language-cli-tests-2
377
+ runs-on: ubuntu-latest
378
+ strategy:
379
+ fail-fast: false
380
+ matrix:
381
+ language: [c, cpp, css, bash, yaml, dockerfile]
382
+ steps: *language_cli_tests_steps
package/AGENTS.md ADDED
@@ -0,0 +1,18 @@
1
+ # AGENTS.md
2
+
3
+ ## When Does `oh-my-lsp` Skill Apply?
4
+
5
+ The `oh-my-lsp` skill **MUST** be activated when the task involves any of:
6
+ - Finding definitions, references, or symbols
7
+ - Inspecting diagnostics (errors/warnings)
8
+ - Renaming symbols
9
+ - AST-aware pattern search or replace
10
+
11
+ ## Enforcement Rule
12
+
13
+ If a task involves:
14
+ - Semantic symbol operations → LSP commands must be used.
15
+ - Structural pattern transformations → AST-Grep must be used.
16
+ - Any modification to LSP-supported files → `diagnostics` must run before and after.
17
+
18
+ Failure to follow these sequences is considered non-compliant.
package/CLAUDE.md ADDED
@@ -0,0 +1,18 @@
1
+ # AGENTS.md
2
+
3
+ ## When Does `oh-my-lsp` Skill Apply?
4
+
5
+ The `oh-my-lsp` skill **MUST** be activated when the task involves any of:
6
+ - Finding definitions, references, or symbols
7
+ - Inspecting diagnostics (errors/warnings)
8
+ - Renaming symbols
9
+ - AST-aware pattern search or replace
10
+
11
+ ## Enforcement Rule
12
+
13
+ If a task involves:
14
+ - Semantic symbol operations → LSP commands must be used.
15
+ - Structural pattern transformations → AST-Grep must be used.
16
+ - Any workspace modification → `diagnostics` must run before and after.
17
+
18
+ Failure to follow these sequences is considered non-compliant.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 oh-my-lsp contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,223 @@
1
+ # oh-my-lsp CLI
2
+
3
+ Built by referencing `oh-my-opencode`'s [`src/tools/ast-grep`](https://github.com/code-yeongyu/oh-my-opencode/dev/src/tools/ast-grep), [`src/tools/lsp`](https://github.com/code-yeongyu/oh-my-opencode/dev/src/tools/lsp).
4
+
5
+ ## Prerequisites
6
+
7
+ `oh-my-lsp` does **not** bundle language servers or ast-grep. You must install them separately.
8
+
9
+ ### ast-grep (required for `ast_grep_search` / `ast_grep_replace`)
10
+
11
+ ```bash
12
+ npm install -g @ast-grep/cli
13
+ # or
14
+ cargo install ast-grep --locked
15
+ # or
16
+ brew install ast-grep
17
+ ```
18
+
19
+ ### LSP Servers (required for LSP commands)
20
+
21
+ Install the server for each language you need:
22
+
23
+ | Language | Install |
24
+ |----------|---------|
25
+ | TypeScript/JS | `npm install -g typescript-language-server typescript` |
26
+ | Python | `pip install basedpyright` or `pip install pyright` |
27
+ | Go | `go install golang.org/x/tools/gopls@latest` |
28
+ | Rust | `rustup component add rust-analyzer` |
29
+ | Java | See [eclipse.jdt.ls](https://github.com/eclipse-jdtls/eclipse.jdt.ls) |
30
+ | C/C++ | See [clangd](https://clangd.llvm.org/installation) |
31
+ | Ruby | `gem install ruby-lsp` |
32
+ | PHP | `npm install -g intelephense` |
33
+ | Bash | `npm install -g bash-language-server` (also install `shellcheck` for diagnostics) |
34
+ | Kotlin | See [kotlin-lsp](https://github.com/Kotlin/kotlin-lsp) |
35
+ | C# | `dotnet tool install -g csharp-ls` |
36
+ | Lua | See [lua-language-server](https://github.com/LuaLS/lua-language-server) |
37
+ | YAML | `npm install -g yaml-language-server` |
38
+ | Dockerfile | `npm install -g dockerfile-language-server-nodejs` |
39
+ | CSS/HTML | `npm install -g @biomejs/biome` |
40
+ | Vue | `npm install -g @vue/language-server` |
41
+ | Svelte | `npm install -g svelte-language-server` |
42
+ | Elixir | See [elixir-ls](https://github.com/elixir-lsp/elixir-ls) |
43
+ | Haskell | `ghcup install hls` |
44
+
45
+ > For the full list of built-in servers and install hints, see [`src/lsp/server-definitions.ts`](src/lsp/server-definitions.ts).
46
+
47
+ ## Getting Started
48
+
49
+ ```bash
50
+ npm install oh-my-lsp
51
+ ```
52
+
53
+ Run directly:
54
+
55
+ ```bash
56
+ npx oh-my-lsp diagnostics src/index.ts
57
+ ```
58
+
59
+ ## Run in Development
60
+
61
+ ```bash
62
+ npm run dev -- --help
63
+ ```
64
+
65
+ ## Build
66
+
67
+ ```bash
68
+ npm run build
69
+ ```
70
+
71
+ ## Test
72
+
73
+ ```bash
74
+ npm run test
75
+ ```
76
+
77
+ ## Commands
78
+
79
+ Basic format:
80
+
81
+ ```bash
82
+ oh-my-lsp <command> <args...>
83
+ ```
84
+
85
+ ### For AI Agents
86
+
87
+ If you are using `oh-my-lsp` with an AI coding agent (e.g. Claude Code, Cursor, Windsurf), add the following to your project's `CLAUDE.md` or `AGENTS.md` to enforce correct tool usage:
88
+
89
+ ```markdown
90
+ ## When Does `oh-my-lsp` Skill Apply?
91
+
92
+ The `oh-my-lsp` skill **MUST** be activated when the task involves any of:
93
+ - Finding definitions, references, or symbols
94
+ - Inspecting diagnostics (errors/warnings)
95
+ - Renaming symbols
96
+ - AST-aware pattern search or replace
97
+
98
+ ## Enforcement Rule
99
+
100
+ If a task involves:
101
+ - Semantic symbol operations → LSP commands must be used.
102
+ - Structural pattern transformations → AST-Grep must be used.
103
+ - Any modification to LSP-supported files → `diagnostics` must run before and after.
104
+
105
+ Failure to follow these sequences is considered non-compliant.
106
+ ```
107
+
108
+ ### LSP Tools (IDE Features for Agents)
109
+
110
+ | Tool | Description |
111
+ |------|-------------|
112
+ | **diagnostics** | Get errors/warnings before build |
113
+ | **prepare_rename** | Validate rename operation |
114
+ | **rename** | Rename symbol across workspace |
115
+ | **goto_definition** | Jump to symbol definition |
116
+ | **find_references** | Find all usages across workspace |
117
+ | **symbols** | Get file outline or workspace symbol search |
118
+
119
+ ### Language-specific LSP Command Coverage
120
+
121
+ | Language | `symbols` | `diagnostics` | `goto_definition` | `find_references` | `prepare_rename` | `rename` | verify |
122
+ |---|---|---|---|---|---|---|---|
123
+ | Bash | O | O | O | O | O | O | ✅ |
124
+ | C | O | O | O | O | O | O | ✅ |
125
+ | C++ | O | O | O | O | O | O | ✅ |
126
+ | C# | O | O | O | O | O | O | |
127
+ | CSS | X | O | X | X | X | X | ✅ |
128
+ | Dockerfile | O | O | X | X | X | X | ✅ |
129
+ | Go | O | O | O | O | O | O | |
130
+ | Java | O | O | O | O | O | O | ✅ |
131
+ | JavaScript | O | O | O | O | O | O | ✅ |
132
+ | Kotlin | O | O | O | O | X | O | ✅ |
133
+ | Lua | O | O | O | O | O | O | |
134
+ | PHP | O | O | O | O | X | X | ✅ |
135
+ | Python | O | O | O | O | O | O | ✅ |
136
+ | Ruby | O | O | X | O | X | X | ✅ |
137
+ | Rust | O | O | O | O | O | O | |
138
+ | TypeScript | O | O | O | O | O | O | ✅ |
139
+ | YAML | O | O | X | X | X | X | ✅ |
140
+
141
+ > Bash note: `goto_definition`, `find_references`, `prepare_rename`, and `rename` are supported only within the same file.
142
+ >
143
+ > CSS note: `symbols` is not supported — biome does not implement `textDocument/documentSymbol` for CSS files.
144
+ >
145
+ > PHP note: `prepare_rename` and `rename` are not supported — intelephense does not support rename for plain PHP functions.
146
+ >
147
+ > Ruby note: `goto_definition`, `prepare_rename`, and `rename` are not supported — ruby-lsp requires a full Ruby project (Gemfile) to index symbols for definition navigation, and does not support rename for method definitions in standalone files.
148
+
149
+ ### AST-Grep Tools
150
+
151
+ | Tool | Description |
152
+ |------|-------------|
153
+ | **ast_grep_search** | AST-aware code pattern search (25 languages) |
154
+ | **ast_grep_replace** | AST-aware code replacement |
155
+
156
+ ### `goto_definition`
157
+
158
+ ```bash
159
+ oh-my-lsp goto_definition <file-path> <line> <character> [--timeout=60000] [--base-path <path>] [--verbose]
160
+ ```
161
+
162
+ - `line`: 0-based (required)
163
+ - `character`: 0-based (required)
164
+
165
+ ### `find_references`
166
+
167
+ ```bash
168
+ oh-my-lsp find_references <file-path> <line> <character> [--timeout=60000] [--base-path <path>] [--verbose] [--no-include-declaration]
169
+ ```
170
+
171
+ - Includes declaration by default (`includeDeclaration=true`)
172
+ - Excludes declaration when `--no-include-declaration` is used
173
+
174
+ ### `symbols`
175
+
176
+ ```bash
177
+ oh-my-lsp symbols <file-path> [--scope document|workspace] [--query <query>] [--limit <n>] [--timeout=60000] [--base-path <path>] [--verbose]
178
+ ```
179
+
180
+ - `--query` is required when `--scope workspace`
181
+
182
+ ### `diagnostics`
183
+
184
+ ```bash
185
+ oh-my-lsp diagnostics <file-path> [--severity error|warning|information|hint|all] [--timeout=60000] [--base-path <path>] [--verbose]
186
+ ```
187
+
188
+ ### `prepare_rename`
189
+
190
+ ```bash
191
+ oh-my-lsp prepare_rename <file-path> <line> <character> [--timeout=60000] [--base-path <path>] [--verbose]
192
+ ```
193
+
194
+ ### `rename`
195
+
196
+ ```bash
197
+ oh-my-lsp rename <file-path> <new-name> <line> <character> [--timeout=60000] [--base-path <path>] [--verbose]
198
+ ```
199
+
200
+ - If `--base-path` is set, that path is used as the LSP server workspace root (`cwd/root`) instead of auto-detecting the workspace root.
201
+
202
+ ### `ast_grep_search`
203
+
204
+ ```bash
205
+ oh-my-lsp ast_grep_search <lang> <pattern> [--paths <path1> <path2> ...] [--globs <glob1> <glob2> ...] [--context <n>] [--timeout=300000] [--verbose]
206
+ ```
207
+
208
+ - Meta variable examples: `$VAR` (single node), `$$$` (multiple nodes)
209
+ - Pattern should be a complete AST node
210
+ - Supports 25 languages (`bash`, `c`, `cpp`, `csharp`, `css`, `elixir`, `go`, `haskell`, `html`, `java`, `javascript`, `json`, `kotlin`, `lua`, `nix`, `php`, `python`, `ruby`, `rust`, `scala`, `solidity`, `swift`, `typescript`, `tsx`, `yaml`)
211
+
212
+ ### `ast_grep_replace`
213
+
214
+ ```bash
215
+ oh-my-lsp ast_grep_replace <lang> <pattern> <rewrite> [--paths <path1> <path2> ...] [--globs <glob1> <glob2> ...] [--no-dry-run] [--timeout=300000] [--verbose]
216
+ ```
217
+
218
+ - Dry-run preview is default
219
+ - Use `--no-dry-run` to apply changes to files
220
+
221
+ ## License
222
+
223
+ MIT License - see LICENSE file for details