|
6 | 6 | [clojure.string :as string] |
7 | 7 | [eca.diff :as diff] |
8 | 8 | [eca.features.tools.util :as tools.util] |
9 | | - [eca.shared :as shared])) |
| 9 | + [eca.shared :as shared :refer [multi-str]])) |
10 | 10 |
|
11 | 11 | (set! *warn-on-reflection* true) |
12 | 12 |
|
|
39 | 39 | is-last? (= index (dec (count filepaths))) |
40 | 40 | current-prefix (if is-last? "└── " "├── ") |
41 | 41 | next-prefix (if is-last? " " "│ ")] |
42 | | - |
| 42 | + |
43 | 43 | ;; Register file/directory in stats |
44 | 44 | (if (fs/directory? absolute) |
45 | 45 | (swap! (:dir-count stats) inc) |
46 | 46 | (swap! (:file-count stats) inc)) |
47 | | - |
| 47 | + |
48 | 48 | (let [current-line (str prefix current-prefix filename "\n") |
49 | 49 | ;; Only recurse if we haven't reached max depth |
50 | | - subtree-output (if (and (fs/directory? absolute) |
51 | | - (< current-depth max-depth)) |
52 | | - (tree-walk absolute |
53 | | - (str prefix next-prefix) |
54 | | - stats |
55 | | - max-depth |
| 50 | + subtree-output (if (and (fs/directory? absolute) |
| 51 | + (< current-depth max-depth)) |
| 52 | + (tree-walk absolute |
| 53 | + (str prefix next-prefix) |
| 54 | + stats |
| 55 | + max-depth |
56 | 56 | (inc current-depth)) |
57 | 57 | "")] |
58 | 58 | (recur (inc index) |
|
297 | 297 | :handler #'write-file |
298 | 298 | :summary-fn #'write-file-summary} |
299 | 299 | "eca_edit_file" |
300 | | - {:description (str "Replace a specific string or content block in a file with new content. " |
301 | | - "Finds the exact original content and replaces it with new content. " |
302 | | - "Be extra careful to format the original-content exactly correctly, " |
303 | | - "taking extra care with whitespace and newlines. " |
304 | | - "Avoid replacing whole functions, methods, or classes, change only the needed code. " |
305 | | - "In addition to replacing strings, this can also be used to prepend, append, or delete contents from a file.") |
| 300 | + {:description (multi-str "You must use your `eca_read_file` tool to get the file’s exact contents before attempting an edit." |
| 301 | + "This tool will error if you attempt an edit without reading the file.When crafting the `orginal_content`, you must match the original content from the `eca_read_file` tool output exactly, including all indentation (spaces/tabs) and newlines." |
| 302 | + "Never include any part of the line number prefix in the `original_content` or `new_content`.The edit will FAIL if the `original_content` is not unique in the file. To resolve this, you must expand the `new_content` to include more surrounding lines of code or context to make it a unique block." |
| 303 | + "ALWAYS prefer making small, targeted edits to existing files. Avoid replacing entire functions or large blocks of code in a single step unless absolutely necessary. You can always call this tool multiple times for multiple edits." |
| 304 | + "To delete content, provide the content to be removed as the `original_content` and an empty string as the `new_content`." |
| 305 | + "To prepend or append content, the `new_content` must contain both the new content and the original content from `old_string`.") |
306 | 306 | :parameters {:type "object" |
307 | 307 | :properties {"path" {:type "string" |
308 | 308 | :description "The absolute file path to do the replace."} |
|
0 commit comments