|
5 | 5 | [pogonos.core :as pg] |
6 | 6 | [clojure-mcp.config :as config] |
7 | 7 | [clojure-mcp.tools.scratch-pad.tool :as scratch-pad] |
8 | | - [clojure-mcp.tools.scratch-pad.core :as scratch-pad-core])) |
| 8 | + [clojure-mcp.tools.scratch-pad.core :as scratch-pad-core] |
| 9 | + [clojure-mcp.utils.file :as file-utils])) |
9 | 10 |
|
10 | 11 | (defn simple-content-prompt-fn |
11 | 12 | "Returns a prompt-fn that ignores request arguments and returns |
|
20 | 21 | "Loads prompt content from a classpath resource file." |
21 | 22 | [filename] |
22 | 23 | (if-let [resource (io/resource filename)] |
23 | | - (slurp resource) |
| 24 | + (file-utils/slurp-utf8 resource) |
24 | 25 | (str "Error: Prompt file not found on classpath: " filename))) |
25 | 26 |
|
26 | 27 | ;; --- Prompt Definitions --- |
@@ -210,7 +211,7 @@ After doing this provide a very brief (8 lines) summary of where we are and then |
210 | 211 | (try |
211 | 212 | ;; Load the file |
212 | 213 | (if (.exists file) |
213 | | - (let [data (clojure.edn/read-string (slurp file)) |
| 214 | + (let [data (clojure.edn/read-string (file-utils/slurp-utf8 file)) |
214 | 215 | ;; Update the scratch pad atom |
215 | 216 | _ (scratch-pad/update-scratch-pad! nrepl-client-atom (constantly data)) |
216 | 217 | ;; Get shallow inspect of the data |
@@ -262,7 +263,7 @@ After doing this provide a very brief (8 lines) summary of where we are and then |
262 | 263 | (when-not (.exists dir) |
263 | 264 | (.mkdirs dir))) |
264 | 265 | ;; Save the data |
265 | | - (spit file (pr-str current-data)) |
| 266 | + (file-utils/spit-utf8 file (pr-str current-data)) |
266 | 267 | ;; Get shallow inspect for confirmation |
267 | 268 | (let [inspect-result (:result (scratch-pad-core/execute-inspect current-data 1 nil))] |
268 | 269 | (clj-result-k |
@@ -323,7 +324,7 @@ and using the following format: |
323 | 324 | file-path |
324 | 325 | (.getCanonicalPath (io/file working-dir file-path)))] |
325 | 326 | (when (.exists (io/file full-path)) |
326 | | - (slurp full-path))) |
| 327 | + (file-utils/slurp-utf8 full-path))) |
327 | 328 | :else nil)] |
328 | 329 | (when template-content |
329 | 330 | {:name prompt-name |
|
0 commit comments