Skip to content

Commit 7dca431

Browse files
author
Bruce Hauman
committed
Remove comment forms from codebase
Remove all (comment ...) forms from the bottom of source files across 25 files. These comment blocks contained REPL testing examples and development code that are no longer needed. All tests pass (295 tests, 2085 assertions, 0 failures).
1 parent 66213a7 commit 7dca431

File tree

25 files changed

+8
-1001
lines changed

25 files changed

+8
-1001
lines changed

src/clojure_mcp/agent/langchain.clj

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -204,30 +204,3 @@
204204
(cond->
205205
tools (.tools (convert-tools tools)))
206206
(.chatMemory memory)))
207-
208-
(comment
209-
(def test-tool
210-
{:name "hello"
211-
:description "says hello"
212-
:schema
213-
(json/json-str {:type :object
214-
:properties
215-
{:nm {:type :string
216-
:description "Name to say hi to"}}
217-
:required [:nm]})
218-
:tool-fn (fn [_ {:keys [nm]} callback]
219-
(callback [(str "Hello " nm "!")] false))})
220-
#_(create-service AiService {})
221-
222-
(let [exec (registration-map->tool-executor test-tool)]
223-
(.execute exec (-> (ToolExecutionRequest/builder)
224-
(.name "hello")
225-
(.arguments (json/json-str {:nm "Joey"}))
226-
(.build))
227-
"asdf")))
228-
229-
;; keep this example
230-
#_(definterface StreamingAiService
231-
(^dev.langchain4j.service.TokenStream chat [^String userMessage])
232-
(^dev.langchain4j.service.TokenStream chat [^dev.langchain4j.data.message.UserMessage userMessage]))
233-

src/clojure_mcp/agent/langchain/schema.clj

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -94,62 +94,3 @@
9494
(doseq [[nm edn-schema] properties]
9595
(.addProperty obj-build (name nm) (edn->sch edn-schema)))
9696
(.build obj-build)))
97-
98-
(comment
99-
(edn->sch {:type :string
100-
:description "Hello"})
101-
(edn->sch {:type :integer
102-
:description "Hello"})
103-
(edn->sch {:type :number
104-
:description "Hello"})
105-
(edn->sch {:type :boolean
106-
:description "Hello"})
107-
108-
(edn->sch {:enum ["a"]})
109-
110-
;; Mixed types example
111-
(edn->sch {:type ["string" "number"]
112-
:description "Can be string or number"})
113-
114-
(edn->sch {:type :array
115-
:items {:type :integer
116-
:description "Hello"}})
117-
118-
;; Array with mixed types
119-
(edn->sch {:type :array
120-
:items {:type ["string" "number"]}})
121-
122-
;; Complete example: Creating a ToolSpecification
123-
(import '[dev.langchain4j.agent.tool ToolSpecification])
124-
125-
(let [schema {:type :object
126-
:properties {:op {:enum ["set_path" "get_path" "delete_path" "inspect"]}
127-
:path {:type :array
128-
:items {:type ["string" "number"]}}
129-
:value {:type ["object" "array" "string" "number" "boolean"]}
130-
:explanation {:type :string}}
131-
:required [:op :explanation]}
132-
params (edn->sch schema)]
133-
(-> (ToolSpecification/builder)
134-
(.name "scratch_pad")
135-
(.description "Persistent data storage")
136-
(.parameters params)
137-
.build))
138-
139-
(edn->sch {:type :object
140-
:description "HOWDy"
141-
:properties {:name {:type :string
142-
:description "The name"}
143-
:path {:type :array
144-
:items {:type ["string" "number"]
145-
:description "Can be string or number key"}}
146-
:value {:type ["object" "array" "string" "number" "boolean" "null"]
147-
:description "Any JSON value"}
148-
:edits {:type :array
149-
:items {:type :object
150-
:properties {:old {:type :string
151-
:description "The name"}
152-
:new {:type :string
153-
:description "The name"}}
154-
:required [:old :new]}}}}))
155-

src/clojure_mcp/dialects.clj

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,3 @@
128128
:else :unknown)))
129129

130130
;; Future dialect support placeholders
131-
(comment
132-
;; ClojureScript on Node
133-
(defmethod fetch-project-directory-exp :cljs-node
134-
[_]
135-
"js/process.cwd()")
136-
137-
;; Jank might have C++ interop
138-
(defmethod fetch-project-directory-exp :jank
139-
[_]
140-
"(jank.native/cwd)"))

src/clojure_mcp/file_content.clj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,3 @@
101101
(and (map? map)
102102
(::file-response map)))
103103

104-
(comment
105-
(-> "./dev/sponsors.pdf"
106-
->file-response
107-
file-response->file-content)
108-
109-
(should-be-file-response? "./dev/logback.xml")
110-
111-
(text-media-type? (mime-type (str->nio-path "hello.md"))))

src/clojure_mcp/nrepl.clj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,3 @@
284284
:repl/error (atom nil)
285285
::state state))))
286286

287-
(comment
288-
289-
(def serv (create {:port 54171}))
290-
(start-polling serv)
291-
(stop-polling serv)
292-
293-
(tool-eval-code serv "(+ 1 2)"))
294-

src/clojure_mcp/sexp/match.clj

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,4 @@
7777

7878
(defn find-match [pattern-str code-str]
7979
(find-match* (z/sexpr (z/of-string pattern-str))
80-
(z/of-string code-str)))
81-
82-
(comment
83-
84-
;; Define a multimethod for calculating area
85-
(defmulti area :type)
86-
87-
(defmethod area :circle
88-
[shape]
89-
(let [{:keys [radius]} shape]
90-
;; Using exact Math/PI constant instead of hardcoded value
91-
(* Math/PI radius radius))))
92-
93-
#_(z/string (find-match "(defmethod area :circle [shape]
94-
(let [{:keys [radius]} shape]
95-
;; Using exact Math/PI constant instead of hardcoded value
96-
(* _* radius radius )
97-
))" (slurp "src/clojure_mcp/sexp/match.clj")))
98-
99-
;; Example tests
100-
#_(match-sexpr '(+ _* radius radius) '(+ 3 radius radius))
101-
#_(match-sexpr '(defn calc [x y] _* (if (> x 10) x y))
102-
'(defn calc [x y] (println "calculating") (if (> x 10) x y)))
103-
#_(match-sexpr '(* Math/PI radius radius) '(* Math/PI radius radius)) ;; Regular * operators match normally
80+
(z/of-string code-str)))

src/clojure_mcp/sexp/paren_utils.clj

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -100,42 +100,4 @@
100100
(unbalanced parentheses, brackets, braces, or string quotes).
101101
Returns false otherwise."
102102
[code-str]
103-
(delimiter/delimiter-error? code-str))
104-
105-
(comment
106-
(def code1 "(defn hello [name] (str \"Hello\" name)))")
107-
(repair-parens code1)
108-
(tokenize-code code1)
109-
(fix-parens (tokenize-code code1))
110-
(repair-parens code1)
111-
112-
;; => {:repaired? true, :form "(defn hello [name] (str \"Hello\" name))", :message "Removed 1 extra closing parentheses"}
113-
114-
;; Test with missing closing paren
115-
(def code2 "(defn hello [name] (str \"Hello\" name)")
116-
(tokenize-code code2)
117-
(fix-parens (tokenize-code code2))
118-
(repair-parens code2)
119-
(parinfer-repair code2)
120-
;; => {:repaired? true, :form "(defn hello [name] (str \"Hello\" name))", :message "Added 1 missing closing parentheses"}
121-
122-
;; Test with complex case - both extra and missing parens
123-
(def code3 "(defn hello [name]
124-
(str \"Hello\" name)))
125-
(defn world []
126-
(println \"World\")")
127-
(tokenize-code code3)
128-
(fix-parens (tokenize-code code3))
129-
(repair-parens code3)
130-
(repair-parens code3)
131-
;; => {:repaired? true, :form "(defn hello [name] (str \"Hello\" name)) (defn world [] (println \"World\"))",
132-
;; :message "Removed 1 extra closing parentheses and added 1 missing closing parentheses"}
133-
134-
;; Test with parens in string
135-
(def code4 "(println \"Hello (world)\")")
136-
(tokenize-code code4)
137-
(fix-parens (tokenize-code code4))
138-
(repair-parens code4)
139-
140-
;; => {:repaired? false, :form "(println \"Hello (world)\")", :message "No repair needed"}
141-
)
103+
(delimiter/delimiter-error? code-str))

src/clojure_mcp/tool_system.clj

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -121,44 +121,3 @@
121121
[(:error-details data)])))]
122122
(callback error-msgs true)))))})
123123

124-
(comment
125-
;; === Simple testing for the tool-system ===
126-
127-
;; Set up nREPL client for testing
128-
(require '[clojure-mcp.nrepl :as nrepl])
129-
(require '[clojure-mcp.tools.eval.tool :as eval-tool])
130-
131-
(def client-atom (atom (nrepl/create {:port 7888})))
132-
(nrepl/start-polling @client-atom)
133-
134-
;; Create a tool instance
135-
(def eval-tool-instance (eval-tool/create-eval-tool client-atom))
136-
137-
;; Generate the registration map with our debug println statements
138-
(def reg-map (registration-map eval-tool-instance))
139-
140-
;; Get the tool-fn
141-
(def tool-fn (:tool-fn reg-map))
142-
143-
;; Test it directly with string keys (like it would receive from MCP)
144-
(tool-fn nil {"code" "(+ 1 2)"}
145-
(fn [result error] (println "RESULT:" result "ERROR:" error)))
146-
147-
;; See what happens with malformed code
148-
(tool-fn nil {"code" "(+ 1"}
149-
(fn [result error] (println "ERROR RESULT:" result "ERROR FLAG:" error)))
150-
151-
;; Helper function to make testing easier
152-
(defn test-eval [code]
153-
(let [p (promise)]
154-
(tool-fn nil {"code" code}
155-
(fn [result error]
156-
(deliver p {:result result :error? error})))
157-
@p))
158-
159-
(test-eval "(+ 1 2)")
160-
(test-eval "(println \"hello\")\n(+ 3 4)")
161-
(test-eval "(/ 1 0)") ;; Should trigger error handling
162-
163-
;; Clean up
164-
(nrepl/stop-polling @client-atom))

src/clojure_mcp/tools/bash/core.clj

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -224,32 +224,3 @@ EDN parsing failed: %s\nRaw result: %s"
224224
inner-value)
225225
:error "bash-command-failed"}))))))
226226

227-
(comment
228-
(require '[clojure-mcp.config :as config])
229-
230-
(def client-atom (atom (clojure-mcp.nrepl/create {:port 7888})))
231-
#_(config/set-config! client-atom :nrepl-user-dir (System/getProperty "user.dir"))
232-
#_(config/set-config! client-atom :allowed-directories [(System/getProperty "user.dir")])
233-
(clojure-mcp.nrepl/start-polling @client-atom)
234-
235-
(execute-bash-command-nrepl client-atom {:command "curl -s https://rigsomelight.com"
236-
:working-directory (System/getProperty "user.dir")})
237-
238-
(->> (eval-core/evaluate-code
239-
@client-atom
240-
{:code (generate-shell-eval-code
241-
"clojure -X:test"
242-
(System/getProperty "user.dir")
243-
100000)
244-
:timeout-ms 100000})
245-
:outputs
246-
(into {})
247-
:value
248-
edn/read-string)
249-
250-
(clojure-mcp.nrepl/stop-polling @client-atom))
251-
252-
#_(execute-bash-command
253-
{:command "ls -al"
254-
:working-directory (System/getProperty "user.dir") :timeout-ms nil})
255-

src/clojure_mcp/tools/bash/tool.clj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,3 @@ in the response to determine command success.")
160160
[nrepl-client-atom]
161161
(tool-system/registration-map (create-bash-tool nrepl-client-atom)))
162162

163-
(comment
164-
(def test-tool
165-
(tool-system/registration-map (create-bash-tool (atom {::config/config {:allowed-directories [(System/getProperty "user.dir")]
166-
:nrepl-user-dir (System/getProperty "user.dir")}}))))
167-
168-
((:tool-fn test-tool) nil {"command" "ls -al"} (fn [a b] [a b])))

0 commit comments

Comments
 (0)