Skip to content

Commit e474adc

Browse files
Jakub ZikaJakub Zika
authored andcommitted
Move tool descriptions to files
1 parent 0d1d009 commit e474adc

File tree

13 files changed

+176
-163
lines changed

13 files changed

+176
-163
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Returns a recursive tree view of files and directories starting from the specified path.
2+
The path parameter must be an absolute path, not a relative path.
3+
**Only works within the directories: $workspaceRoots.**
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
You must use your `eca_read_file` tool to get the file's exact contents before attempting an edit.
2+
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.
3+
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.
4+
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.
5+
To delete content, provide the content to be removed as the `original_content` and an empty string as the `new_content`.
6+
To prepend or append content, the `new_content` must contain both the new content and the original content from `old_string`.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Return editor diagnostics/findings (Ex: LSP diagnostics) for workspaces.
2+
Only provide the path if you want to get diagnostics for a specific file.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fast content search tool that works with any codebase size. Finds the paths to files that have matching contents using regular expressions.
2+
Supports full regex syntax (eg. "log.*Error", "function\\s+\\w+", etc.). Filter files by pattern with the include parameter (eg. "*.js", "*.{ts,tsx}").
3+
Returns matching file paths sorted by modification time. Use this tool when you need to find files containing specific patterns.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Move or rename files and directories.
2+
Can move files between directories and rename them in a single operation.
3+
If the destination exists, the operation will fail. Works across different directories and can be used for simple renaming within the same directory.
4+
Both source and destination must be within the directories: $workspaceRoots.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Preview the FINAL content that will be written to tge file when the plan is accepted.
2+
Use only for showing definitive implementation, not for iterative exploration.
3+
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.
4+
For new files, original_content must be empty string.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Read the contents of a file from the file system. Use this tool when you need to examine the contents of a single file.
2+
Optionally use the 'line_offset' and/or 'limit' parameters to read specific contents of the file when you know the range.
3+
Prefer call once this tool over multiple calls passing small offsets. **Only works within the directories: $workspaceRoots.**
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
Executes an arbitrary shell command ensuring proper handling and security measures.
2+
1. Command Execution:
3+
- Always quote file paths that contain spaces with double quotes (e.g., cd \" path with spaces/file.txt \")
4+
- Examples of proper quoting:
5+
- cd \"/Users/name/My Documents\" (correct)
6+
- cd /Users/name/My Documents (incorrect - will fail)
7+
- python \"/path/with spaces/script.py\" (correct)
8+
- python /path/with spaces/script.py (incorrect - will fail)
9+
- After ensuring proper quoting, execute the command.
10+
- Capture the output of the command.
11+
- VERY IMPORTANT: You MUST avoid using search command `grep`. Instead use eca_grep to search. You MUST avoid read tools like `cat`, `head`, `tail`, and `ls`, and use eca_read_file or eca_directory_tree.
12+
- It is very helpful if you write a clear, concise description of what this command does in 5-10 words.
13+
- When issuing multiple commands, use the ';' or '&&' operator to separate them. DO NOT use newlines (newlines are ok in quoted strings).
14+
- Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of `cd`. You may use `cd` if the User explicitly requests it.
15+
<good-example>
16+
pytest /foo/bar/tests
17+
</good-example>
18+
<bad-example>
19+
cd /foo/bar && pytest tests
20+
</bad-example>
21+
22+
# Committing changes with git
23+
24+
When the user asks you to create a new git commit, follow these steps carefully:
25+
26+
1.:
27+
- Run a git status command to see all untracked files.
28+
- Run a git diff command to see both staged and unstaged changes that will be committed.
29+
- Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.
30+
31+
2. Analyze all staged changes (both previously staged and newly added) and draft a commit message. Wrap your analysis process in <commit_analysis> tags:
32+
33+
<commit_analysis>
34+
- List the files that have been changed or added
35+
- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)
36+
- Brainstorm the purpose or motivation behind these changes
37+
- Assess the impact of these changes on the overall project
38+
- Check for any sensitive information that shouldn't be committed
39+
- Draft a concise (1-2 sentences) commit message that focuses on the \"why\" rather than the \"what\"
40+
- Ensure your language is clear, concise, and to the point
41+
- Ensure the message accurately reflects the changes and their purpose (i.e. \"add\" means a wholly new feature, \" update \" means an enhancement to an existing feature, \"fix\" means a bug fix, etc.)
42+
- Ensure the message is not generic (avoid words like \"Update\" or \"Fix\" without context)
43+
- Review the draft message to ensure it accurately reflects the changes and their purpose
44+
</commit_analysis>
45+
46+
3.:
47+
- Add relevant untracked files to the staging area.
48+
- Create the commit with a message ending with:
49+
🤖 Generated with [eca](https://eca.dev)
50+
51+
Co-Authored-By: eca <[email protected]>
52+
- Run git status to make sure the commit succeeded.
53+
54+
4. If the commit fails due to pre-commit hook changes, retry the commit ONCE to include these automated changes. If it fails again, it usually means a pre-commit hook is preventing the commit. If the commit succeeds but you notice that files were modified by the pre-commit hook, you MUST amend your commit to include them.
55+
56+
Important notes:
57+
- Use the git context at the start of this conversation to determine which files are relevant to your commit. Be careful not to stage and commit files (e.g. with `git add .`) that aren't relevant to your commit.
58+
- NEVER update the git config
59+
- DO NOT run additional commands to read or explore code, beyond what is available in the git context
60+
- DO NOT push to the remote repository
61+
- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.
62+
- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit
63+
- Ensure your commit message is meaningful and concise. It should explain the purpose of the changes, not just describe them.
64+
- Return an empty response - the user will see the git output directly
65+
- In order to ensure good formatting, ALWAYS pass the commit message via a HEREDOC, a la this example:
66+
<example>
67+
git commit -m \"$(cat <<'EOF'
68+
Commit message here.
69+
70+
🤖 Generated with [eca](https://eca.dev)
71+
72+
Co-Authored-By: eca <[email protected]>
73+
EOF
74+
)\"
75+
</example>
76+
77+
# Creating pull requests
78+
Use the gh command via the Bash tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a Github URL use the gh command to get the information needed.
79+
80+
IMPORTANT: When the user asks you to create a pull request, follow these steps carefully:
81+
82+
1. In order to understand the current state of the branch since it diverged from the main branch:
83+
- Run a git status command to see all untracked files
84+
- Run a git diff command to see both staged and unstaged changes that will be committed
85+
- Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote
86+
- Run a git log command and `git diff main...HEAD` to understand the full commit history for the current branch (from the time it diverged from the `main` branch)
87+
88+
2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary. Wrap your analysis process in <pr_analysis> tags:
89+
90+
<pr_analysis>
91+
- List the commits since diverging from the main branch
92+
- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)
93+
- Brainstorm the purpose or motivation behind these changes
94+
- Assess the impact of these changes on the overall project
95+
- Do not use tools to explore code, beyond what is available in the git context
96+
- Check for any sensitive information that shouldn't be committed
97+
- Draft a concise (1-2 bullet points) pull request summary that focuses on the \"why\" rather than the \"what\"
98+
- Ensure the summary accurately reflects all changes since diverging from the main branch
99+
- Ensure your language is clear, concise, and to the point
100+
- Ensure the summary accurately reflects the changes and their purpose (ie. \"add\" means a wholly new feature, " update " means an enhancement to an existing feature, \"fix\" means a bug fix, etc.)
101+
- Ensure the summary is not generic (avoid words like \"Update\" or \"Fix\" without context)
102+
- Review the draft summary to ensure it accurately reflects the changes and their purpose
103+
</pr_analysis>
104+
105+
3. ALWAYS run the following commands in parallel:
106+
- Create new branch if needed
107+
- Push to remote with -u flag if needed
108+
- Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.
109+
<example>
110+
gh pr create --title \"the pr title\" --body \"$(cat <<'EOF'
111+
## Summary
112+
<1-3 bullet points>
113+
114+
## Test plan
115+
[Checklist of TODOs for testing the pull request...]
116+
117+
🤖 Generated with [eca](https://eca.dev)
118+
EOF
119+
)\"
120+
</example>
121+
122+
Important:
123+
- NEVER update the git config
124+
- Return the PR URL when you're done, so the user can see it
125+
126+
# Other common operations
127+
- View comments on a Github PR: gh api repos/foo/bar/pulls/123/comments
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Create a new file or completely overwrite an existing file with new content.
2+
This tool will automatically create any necessary parent directories if they don't exist.
3+
Use this tool when you want to create a new file from scratch or completely replace the entire content of an existing file.
4+
For partial edits or content replacement within existing files, use eca_edit_file instead.
5+
**Only works within the directories: $workspaceRoots.**

src/eca/features/tools/editor.clj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@
4747

4848
(def definitions
4949
{"eca_editor_diagnostics"
50-
{:description (str "Return editor diagnostics/findings (Ex: LSP diagnostics) for workspaces. "
51-
"Only provide the path if you want to get diagnostics for a specific file.")
50+
{:description (tools.util/read-tool-description "eca_editor_diagnostics")
5251
:parameters {:type "object"
5352
:properties {"path" {:type "string"
5453
:description "Optional absolute path to a file to return diagnostics only for that file."}}

0 commit comments

Comments
 (0)