Skip to content

Commit 6e2a420

Browse files
committed
refactor and update readme
1 parent 0aac8ba commit 6e2a420

4 files changed

Lines changed: 22 additions & 16 deletions

File tree

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ A blazingly fast, interactive AI coding assistant powered by Claude, implemented
1313
- **Ultra-Fast Editing** - Optional Morph Apply integration (10,500+ tokens/sec, 96-98% accuracy)
1414
- **Code Search** - Fast regex-based code search using `ripgrep` (optional)
1515
- **Web Search** - Real-time information via DuckDuckGo
16-
- **Secure** - All file operations restricted to workspace, prevents directory traversal
16+
- **Bash Execution** - Run tests and build commands safely (read-only, sandboxed)
17+
- **Secure** - All operations restricted to workspace, prevents directory traversal
1718

1819
## Installation
1920

@@ -41,7 +42,9 @@ cargo install --path .
4142
export ANTHROPIC_API_KEY='your-api-key'
4243
```
4344

44-
### Enable Ultra-Fast Editing (Optional). When enabled, Claude can use the `edit_file_fast` tool for lightning-fast, accurate code modifications.
45+
### Enable Ultra-Fast Editing (Optional)
46+
47+
When enabled, Claude can use the `morph_edit_file` tool for lightning-fast, accurate code modifications.
4548

4649
```bash
4750
export MORPH_API_KEY='your-morph-key'
@@ -84,13 +87,14 @@ Claude can automatically use these tools:
8487
**File Operations:**
8588
- `read_file` - Read file contents
8689
- `write_file` - Create or overwrite files
87-
- `edit_file_fast` - Ultra-fast code editing (requires MORPH_API_KEY)
90+
- `morph_edit_file` - Ultra-fast code editing (requires MORPH_API_KEY)
8891
- `list_directory` - List directory contents
8992
- `create_directory` - Create directories
9093

9194
**Code & Search:**
9295
- `search_code` - Fast regex-based code search (requires `ripgrep`)
9396
- `web_search` - Search the internet
97+
- `execute_bash` - Run tests and build commands (read-only, sandboxed)
9498

9599
## Security
96100

@@ -140,12 +144,14 @@ MIT License
140144

141145
## Morph Integration
142146

143-
Sofos integrates with Morph's APIs for enhanced performance:
147+
Sofos integrates with Morph's Apply API for ultra-fast code editing:
148+
149+
- **10,500+ tokens/sec** - Lightning-fast edits
150+
- **96-98% accuracy** - Reliable code modifications
151+
- **Direct REST API** - No additional dependencies
152+
- **Optional** - Enable with `MORPH_API_KEY`
144153

145-
**Morph Apply** - Ultra-fast code editing (10,500+ tokens/sec, 96-98% accuracy)
146-
- Direct REST API integration
147-
- Works with `edit_file_fast` tool
148-
- Optional - enable with `MORPH_API_KEY`
154+
Uses the `morph_edit_file` tool when available.
149155

150156
## Acknowledgments
151157

src/conversation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl ConversationHistory {
2626
}
2727

2828
let edit_instruction = if has_morph {
29-
"- When creating new files, use the write_file tool\n- When editing existing files, ALWAYS use the edit_file_fast tool (ultra-fast, 10,500+ tokens/sec)"
29+
"- When creating new files, use the write_file tool\n- When editing existing files, ALWAYS use the morph_edit_file tool (ultra-fast, 10,500+ tokens/sec)"
3030
} else {
3131
"- When creating or editing code, use the write_file tool"
3232
};

src/tools/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ impl ToolExecutor {
127127
let results = code_search.search(pattern, file_type, max_results)?;
128128
Ok(format!("Code search results:\n\n{}", results))
129129
}
130-
"edit_file_fast" => {
130+
"morph_edit_file" => {
131131
let morph = self.morph_client.as_ref()
132132
.ok_or_else(|| SofosError::ToolExecution(
133-
"Morph client not available. Set MORPH_API_KEY to use edit_file_fast".to_string()
133+
"Morph client not available. Set MORPH_API_KEY to use morph_edit_file".to_string()
134134
))?;
135135

136136
let path = input["path"]
@@ -148,7 +148,7 @@ impl ToolExecutor {
148148
let merged_code = morph.apply_edit(instruction, &original_code, code_edit).await?;
149149

150150
self.fs_tool.write_file(path, &merged_code)?;
151-
Ok(format!("Successfully applied fast edit to '{}'", path))
151+
Ok(format!("Successfully applied Morph edit to '{}'", path))
152152
}
153153
"execute_bash" => {
154154
let command = input["command"]

src/tools/types.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn read_file_tool() -> Tool {
2020

2121
fn write_file_tool(has_morph: bool) -> Tool {
2222
let description = if has_morph {
23-
"Create a new file with the given content. For editing existing files, use edit_file_fast instead. Only works within the current project directory."
23+
"Create a new file with the given content. For editing existing files, use morph_edit_file instead. Only works within the current project directory."
2424
} else {
2525
"Create a new file or overwrite an existing file with the given content. Only works within the current project directory."
2626
};
@@ -118,9 +118,9 @@ fn execute_bash_tool() -> Tool {
118118
}
119119
}
120120

121-
fn edit_file_fast_tool() -> Tool {
121+
fn morph_edit_file_tool() -> Tool {
122122
Tool {
123-
name: "edit_file_fast".to_string(),
123+
name: "morph_edit_file".to_string(),
124124
description: "**PREFERRED FOR EDITING FILES** - Ultra-fast file editing using Morph Apply API (10,500+ tokens/sec, 96-98% accuracy). Use this for ALL modifications to existing files. Provide the instruction, original code, and your proposed changes with '// ... existing code ...' markers for unchanged sections. Much more efficient than write_file.".to_string(),
125125
input_schema: json!({
126126
"type": "object",
@@ -164,7 +164,7 @@ pub fn get_tools_with_morph() -> Vec<Tool> {
164164
create_directory_tool(),
165165
web_search_tool(),
166166
execute_bash_tool(),
167-
edit_file_fast_tool(),
167+
morph_edit_file_tool(),
168168
]
169169
}
170170

0 commit comments

Comments
 (0)