feat: add EditTools.cs to implement file manipulation functions like replace_lines, delete_range, and batch_edit, updating README.md to reflect new tools and command descriptions.
This commit is contained in:
72
README.md
72
README.md
@@ -70,6 +70,8 @@ The resulting binary is ~12 MB, has no .NET runtime dependency, and starts insta
|
||||
| `/status` | Show session token usage and cost |
|
||||
| `/compact` | Manually trigger context compaction |
|
||||
| `/reset` | Clear session and reset token tracker |
|
||||
| `/load` | Load a previous session from disk |
|
||||
| `/save` | Save current session to disk |
|
||||
## Available Tools
|
||||
|
||||
**File Operations:**
|
||||
@@ -88,71 +90,7 @@ The resulting binary is ~12 MB, has no .NET runtime dependency, and starts insta
|
||||
- `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
|
||||
|
||||
**Directory Operations:**
|
||||
- `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:**
|
||||
- `execute_command` - Run shell commands (with user approval)
|
||||
|
||||
```
|
||||
AnchorCli/
|
||||
├── Program.cs # Entry point + CLI parsing
|
||||
├── ReplLoop.cs # Main REPL loop with streaming, spinners, and cancellation
|
||||
├── ChatSession.cs # AI chat client wrapper with message history
|
||||
├── ToolRegistry.cs # Centralized tool registration and dispatch
|
||||
├── AnchorConfig.cs # JSON file-based configuration (~APPDATA~/anchor/config.json)
|
||||
├── ContextCompactor.cs # Conversation history compression
|
||||
├── AppJsonContext.cs # Source-generated JSON context (AOT)
|
||||
├── SetupTui.cs # Interactive setup TUI
|
||||
├── Hashline/
|
||||
│ ├── HashlineEncoder.cs # Adler-8 + position-seed hashing
|
||||
│ └── HashlineValidator.cs # Anchor resolution + validation
|
||||
├── Tools/
|
||||
│ ├── FileTools.cs # read_file, grep_file, grep_recursive, find_files, get_file_info
|
||||
│ ├── EditTools.cs # replace_lines, insert_after, delete_range, create/delete/rename/copy/append
|
||||
│ ├── DirTools.cs # list_dir, create_dir, rename_dir, delete_dir
|
||||
│ └── CommandTool.cs # execute_command
|
||||
├── Commands/
|
||||
│ ├── ICommand.cs # Command interface
|
||||
│ ├── CommandRegistry.cs # Command registration
|
||||
│ ├── CommandDispatcher.cs # Command dispatch logic
|
||||
│ ├── ExitCommand.cs # /exit command
|
||||
│ ├── HelpCommand.cs # /help command
|
||||
│ ├── ClearCommand.cs # /clear command
|
||||
│ ├── StatusCommand.cs # /status command
|
||||
│ ├── CompactCommand.cs # /compact command
|
||||
│ ├── CompactCommand.cs # /compact command
|
||||
│ ├── LoadCommand.cs # /load command
|
||||
│ ├── SaveCommand.cs # /save command
|
||||
│ └── ResetCommand.cs # /reset command
|
||||
- `append_to_file` - Append lines to the end of a file
|
||||
- `batch_edit` - Apply multiple edits atomically in a single operation
|
||||
`/compact` | Manually trigger context compaction |
|
||||
/load` | Load a previous chat session from file |
|
||||
`/save` | Save current chat session to file |
|
||||
`/reset` | Clear session and reset token tracker |
|
||||
## Available Tools
|
||||
|
||||
**File Operations:**
|
||||
- `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:**
|
||||
- `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:**
|
||||
- `list_dir` - List directory contents
|
||||
@@ -191,7 +129,9 @@ AnchorCli/
|
||||
│ ├── StatusCommand.cs # /status command
|
||||
│ ├── CompactCommand.cs # /compact command
|
||||
│ ├── ResetCommand.cs # /reset command
|
||||
│ └── SetupCommand.cs # /setup command
|
||||
│ ├── SetupCommand.cs # /setup command
|
||||
│ ├── LoadCommand.cs # /load command
|
||||
│ └── SaveCommand.cs # /save command
|
||||
└── OpenRouter/
|
||||
└── PricingProvider.cs # Fetch model pricing from OpenRouter
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user