API Documentation
Execute a shell command and return its output.
Parameter | Type | Required | Description |
---|---|---|---|
command | string | Yes | The shell command to execute |
run_command("ls -la")
Execute a git operation in the project repository.
Parameter | Type | Required | Description |
---|---|---|---|
operation | string | Yes | The git operation to perform (e.g., "status", "log", "branch") |
confirm | boolean | No | Set to true to execute operations that require confirmation (like push) |
git_operation("status")
git_operation("push origin main", confirm=True)
Read the contents of a file within the project directory.
Parameter | Type | Required | Description |
---|---|---|---|
file_path | string | Yes | Path to the file (relative to project root or absolute) |
read_file("README.md")
Edit a file with various operations: write, append, insert, replace, or delete.
Parameter | Type | Required | Description |
---|---|---|---|
file_path | string | Yes | Path to the file (relative to project root or absolute) |
operation | string | Yes | Type of edit ('write', 'append', 'insert', 'replace', 'delete', 'delete_lines') |
content | string | No | Content to write, append, or insert, or replacement content |
line_number | integer | No | Line number for insert operation (1-based index) |
pattern | string | No | Pattern to find for replace or delete operations |
start_line | integer | No | First line to remove for delete_lines operation (1-based index) |
end_line | integer | No | Last line to remove for delete_lines operation (1-based index, inclusive) |
confirm | boolean | No | Set to true to execute the edit, false to preview only |
edit_file("example.py", operation="write", content="print('Hello, World!')", confirm=True)
edit_file("example.py", operation="replace", pattern="Hello", content="Greetings", confirm=True)
Enhanced file editing with smart pattern matching and function-level operations.
Parameter | Type | Required | Description |
---|---|---|---|
file_path | string | Yes | Path to the file (relative to project root or absolute) |
operation | string | No | Type of edit ('preview', 'update_function', 'replace', 'delete', 'append', 'write', 'edit_block') |
function_name | string | No | Target function name for function-level operations |
pattern | string | No | Pattern to find (with flexible whitespace matching) |
new_content | string | No | New content to insert/replace |
regex_mode | boolean | No | Enable regex pattern matching |
context_lines | integer | No | Number of context lines to show in previews |
confirm | boolean | No | Set to true to execute the edit, false to preview only |
edit_format | string | No | Format for edits ('search_replace', 'unified_diff', 'whole_file') when using edit_block operation |
fuzzy_match | boolean | No | Enable fuzzy matching for more flexible pattern matching |
match_indent | boolean | No | Account for indentation differences when matching patterns |
smart_edit("app.py", operation="preview", function_name="process_data")
smart_edit("app.py", operation="update_function", function_name="process_data", new_content="def process_data(data):\n # Updated implementation\n if data is None:\n return {}\n return data", confirm=True)
Process edit blocks to modify code across multiple files.
Parameter | Type | Required | Description |
---|---|---|---|
edit_content | string | Yes | Text containing edit blocks in either search/replace or unified diff format |
confirm | boolean | No | Set to true to execute the edits, false to preview only |
edit_block("""app.py
<<<<<<< SEARCH
def get_data():
return {"status": "ok"}
=======
def get_data():
return {"status": "ok", "version": "1.0"}
>>>>>>> REPLACE
""", confirm=True)
List the contents of a directory within the project in a tree-like format.
Parameter | Type | Required | Description |
---|---|---|---|
dir_path | string | No | Path to the directory (relative to project root or absolute, empty for project root) |
max_depth | integer | No | Maximum depth for the directory tree (default: 10) |
list_directory("src", max_depth=2)
Create a directory within the project.
Parameter | Type | Required | Description |
---|---|---|---|
dir_path | string | Yes | Path to the directory to create (relative to project root or absolute) |
create_directory("new_folder/subfolder")
Delete a file or directory within the project.
Parameter | Type | Required | Description |
---|---|---|---|
path_to_delete | string | Yes | Path to delete (relative to project root or absolute) |
confirm | boolean | No | Set to true to execute the deletion, false to preview only |
delete_path("temp_file.txt", confirm=True)