Commit 78cf3ca
Refactor nREPL evaluation for robustness and simplicity (#132)
* Refactor: Switch nREPL client to stateless connection model
- Replaced long-lived nREPL connections and async polling with ephemeral, blocking connections per evaluation.
- `clojure-mcp.nrepl`:
- Removed `start-polling`, `stop-polling`, and callback logic.
- Added blocking `eval-code` taking a `:session-type` (e.g., `:default`, `:tools`, `:shadow`, `:figwheel`).
- State is now a simple map tracking session IDs by port and type.
- Added `current-ns` helper to track namespace by session type.
- Tools updates:
- `eval`: Updated to use blocking `eval-code` and accept `:session-type`.
- `bash`: Removed custom session creation; uses `:tools` session type.
- `figwheel` & `shadow`: Updated to use `:session-type` for dedicated sessions.
- Core & CLI:
- `clojure-mcp.core`: Removed polling initialization.
- `prompt-cli`: Removed polling initialization.
- Tests:
- Updated `eval` tool tests to reflect API changes.
* Test updates: Align tests with new nREPL session handling
- Updated and to reflect the removal of direct session creation and the use of .
- Updated and to remove obsolete polling calls and use the new signature.
- Formatted modified test files with Usage: clj-paren-repair FILE [FILE ...]
Fix delimiter errors and format Clojure files.
Features enabled by default:
- Delimiter error detection and repair
- cljfmt formatting
Options:
-h, --help Show this help message.
* nrepl-refactor tweaks
* adding id to shadow repl code
* tweask to dev script
---------
Co-authored-by: Bruce Hauman <bhauman@gmail.com>1 parent 5dae6ed commit 78cf3ca
File tree
19 files changed
+291
-500
lines changed- src/clojure_mcp
- main_examples
- tools
- bash
- eval
- figwheel
- test/clojure_mcp
- repl_tools
- tools
- bash
- eval
- project
19 files changed
+291
-500
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
114 | | - | |
115 | | - | |
| 113 | + | |
116 | 114 | | |
117 | 115 | | |
118 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
277 | 276 | | |
278 | 277 | | |
279 | 278 | | |
| |||
285 | 284 | | |
286 | 285 | | |
287 | 286 | | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 287 | + | |
292 | 288 | | |
293 | 289 | | |
294 | 290 | | |
| |||
314 | 310 | | |
315 | 311 | | |
316 | 312 | | |
317 | | - | |
318 | 313 | | |
319 | 314 | | |
320 | 315 | | |
| |||
331 | 326 | | |
332 | 327 | | |
333 | 328 | | |
334 | | - | |
335 | 329 | | |
336 | 330 | | |
337 | 331 | | |
338 | 332 | | |
339 | 333 | | |
340 | 334 | | |
341 | | - | |
342 | | - | |
343 | 335 | | |
344 | 336 | | |
345 | 337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
82 | | - | |
83 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
| |||
93 | 96 | | |
94 | 97 | | |
95 | 98 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
100 | 107 | | |
101 | 108 | | |
102 | 109 | | |
| |||
107 | 114 | | |
108 | 115 | | |
109 | 116 | | |
110 | | - | |
| 117 | + | |
111 | 118 | | |
112 | 119 | | |
113 | 120 | | |
114 | 121 | | |
115 | 122 | | |
116 | 123 | | |
117 | 124 | | |
118 | | - | |
| 125 | + | |
119 | 126 | | |
120 | 127 | | |
121 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
52 | 49 | | |
53 | 50 | | |
54 | 51 | | |
55 | 52 | | |
56 | 53 | | |
57 | 54 | | |
58 | 55 | | |
59 | | - | |
60 | 56 | | |
61 | | - | |
| 57 | + | |
62 | 58 | | |
| 59 | + | |
63 | 60 | | |
64 | 61 | | |
65 | 62 | | |
66 | 63 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
72 | 69 | | |
73 | 70 | | |
74 | 71 | | |
| |||
0 commit comments