54 lines
2.0 KiB
Markdown
54 lines
2.0 KiB
Markdown
# Available Tools
|
|
|
|
AnchorCli provides a comprehensive set of tools for file operations, editing, directory management, and command execution.
|
|
|
|
## File Operations
|
|
|
|
| Tool | Description |
|
|
|------|-------------|
|
|
| `read_file` | Read a file (or a window) with Hashline-tagged lines |
|
|
| `grep_file` | Search a file by regex — results are pre-tagged for immediate editing |
|
|
| `grep_recursive` | Search for a regex pattern across all files in a directory tree |
|
|
| `find_files` | Search for files matching glob patterns |
|
|
| `get_file_info` | Get detailed file information (size, permissions, etc.) |
|
|
|
|
## Edit Operations
|
|
|
|
| Tool | Description |
|
|
|------|-------------|
|
|
| `replace_lines` | Replace a range identified by `line:hash` anchors |
|
|
| `insert_after` | Insert lines after an anchor |
|
|
| `delete_range` | Delete a range between two anchors |
|
|
| `create_file` | Create a new file with optional initial content |
|
|
| `delete_file` | Delete a file permanently |
|
|
| `rename_file` | Rename or move a file |
|
|
| `copy_file` | Copy a file to a new location |
|
|
| `append_to_file` | Append lines to the end of a file |
|
|
| `batch_edit` | Apply multiple replace/delete operations atomically in a single call |
|
|
|
|
## Directory Operations
|
|
|
|
| Tool | Description |
|
|
|------|-------------|
|
|
| `list_dir` | List directory contents |
|
|
| `create_dir` | Create a new directory (with parent directories) |
|
|
| `rename_dir` | Rename or move a directory |
|
|
| `delete_dir` | Delete a directory and all its contents |
|
|
|
|
## Command Execution
|
|
|
|
| Tool | Description |
|
|
|------|-------------|
|
|
| `execute_command` | Run shell commands (with user approval) |
|
|
|
|
## Tool Usage Guidelines
|
|
|
|
- All file editing tools use **Hashline anchors** (`line:hash`) for precise, safe edits
|
|
- Before any mutation, both the line number **and** hash are validated — stale anchors are rejected
|
|
- `batch_edit` is preferred for multiple operations to prevent line drift
|
|
- `grep_file` results are pre-tagged with anchors for immediate editing
|
|
|
|
---
|
|
|
|
*For more details on the Hashline technique, see [HASHLINE.md](HASHLINE.md)*
|