File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 137137 (let [max-length (get-in config [:toolCall :shellCommand :summaryMaxLength ])
138138 workspace-folders (:workspace-folders db)]
139139 (if-let [command (some-> (get args " command" )
140- (strip-workspace-cd-prefix workspace-folders))]
140+ (strip-workspace-cd-prefix workspace-folders)
141+ (string/replace #"\n " " " )
142+ string/trim)]
141143 (if (> (count command) max-length)
142144 (format " $ %s..." (subs command 0 max-length))
143145 (format " $ %s" command))
Original file line number Diff line number Diff line change 184184 (is (= (format " $ cd %s && clojure -M:test" (h/file-path " /project/foo" ))
185185 (summary-fn {:args {" command" (str " cd " (h/file-path " /project/foo" ) " && clojure -M:test" )}
186186 :config config
187- :db nil }))))))
187+ :db nil }))))
188+ (testing " trims newlines in command"
189+ (is (= " $ echo hello && echo world"
190+ (summary-fn {:args {" command" " echo hello\n && echo world" }
191+ :config config
192+ :db db}))))
193+ (testing " trims leading and trailing whitespace"
194+ (is (= " $ echo hello"
195+ (summary-fn {:args {" command" " \n echo hello \n " }
196+ :config config
197+ :db db}))))))
You can’t perform that action at this time.
0 commit comments