mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
fix: Resolve MCP installation issues and enhance path resolution
- Fixed API endpoint mismatches in mcp-manager.js to ensure global install/update buttons function correctly. - Corrected undefined function references in mcp-manager.js for project installation. - Refactored event handling to eliminate global scope pollution in mcp-manager.js. - Added comprehensive debugging guide for MCP installation issues. - Implemented a session path resolver to infer content types from filenames and paths, improving usability. - Introduced tests for embeddings improvements in init and status commands to verify functionality.
This commit is contained in:
@@ -1,29 +1,48 @@
|
||||
## File Modification
|
||||
# File Modification
|
||||
|
||||
### Use edit_file (MCP)
|
||||
- Built-in Edit tool failed 1+ times
|
||||
- Need dry-run preview before applying changes
|
||||
- Need line-based operations (insert_after, insert_before)
|
||||
- Need to replace all occurrences at once
|
||||
- Built-in Edit returns "old_string not found"
|
||||
- Whitespace/formatting issues in built-in Edit
|
||||
Before modifying files, always:
|
||||
- Try built-in Edit tool first
|
||||
- Escalate to MCP tools when built-ins fail
|
||||
- Use write_file only as last resort
|
||||
|
||||
**Mode Selection**:
|
||||
- `mode=update`: Replace text
|
||||
- `mode=line`: Line-based operations
|
||||
## MCP Tools Usage
|
||||
|
||||
### Use write_file (MCP)
|
||||
- Creating brand new files
|
||||
- MCP edit_file still fails (last resort)
|
||||
- Need to completely replace file content
|
||||
- Need backup before overwriting
|
||||
- User explicitly asks to "recreate file"
|
||||
### edit_file - Modify Files
|
||||
|
||||
**When**: Built-in Edit fails, need dry-run preview, or need line-based operations
|
||||
|
||||
**How**:
|
||||
```javascript
|
||||
edit_file(path="/file.ts", oldText="old", newText="new") // Replace text
|
||||
edit_file(path="/file.ts", oldText="old", newText="new", dryRun=true) // Preview diff
|
||||
edit_file(path="/file.ts", oldText="old", newText="new", replaceAll=true) // Replace all
|
||||
edit_file(path="/file.ts", mode="line", operation="insert_after", line=10, text="new line")
|
||||
edit_file(path="/file.ts", mode="line", operation="delete", line=5, end_line=8)
|
||||
```
|
||||
|
||||
**Modes**: `update` (replace text, default), `line` (line-based operations)
|
||||
|
||||
**Operations** (line mode): `insert_before`, `insert_after`, `replace`, `delete`
|
||||
|
||||
---
|
||||
|
||||
### write_file - Create/Overwrite Files
|
||||
|
||||
**When**: Create new files, completely replace content, or edit_file still fails
|
||||
|
||||
**How**:
|
||||
```javascript
|
||||
write_file(path="/new-file.ts", content="file content here")
|
||||
write_file(path="/existing.ts", content="...", backup=true) // Create backup first
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Priority Logic
|
||||
|
||||
**File Reading**:
|
||||
1. Known single file → Built-in Read
|
||||
2. Multiple files OR pattern matching → read_file (MCP)
|
||||
2. Multiple files OR pattern matching → smart_search (MCP)
|
||||
3. Unknown location → smart_search then Read
|
||||
4. Large codebase + repeated access → smart_search (indexed)
|
||||
|
||||
@@ -33,9 +52,9 @@
|
||||
3. Still fails → write_file (MCP)
|
||||
|
||||
**Search**:
|
||||
1. External knowledge → Exa
|
||||
1. External knowledge → Exa (MCP)
|
||||
2. Exact pattern in small codebase → Built-in Grep
|
||||
3. Semantic/unknown location → smart_search
|
||||
3. Semantic/unknown location → smart_search (MCP)
|
||||
4. Large codebase + repeated searches → smart_search (indexed)
|
||||
|
||||
## Decision Triggers
|
||||
@@ -45,4 +64,3 @@
|
||||
**Use semantic search** for exploratory tasks
|
||||
**Use indexed search** for large, stable codebases
|
||||
**Use Exa** for external/public knowledge
|
||||
|
||||
|
||||
Reference in New Issue
Block a user