mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-10 02:24:35 +08:00
refactor: Remove unused context-tools-ace.md and clean up CLI status management
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
- **CLI Tools Usage**: @~/.claude/workflows/cli-tools-usage.md
|
- **CLI Tools Usage**: @~/.claude/workflows/cli-tools-usage.md
|
||||||
- **Coding Philosophy**: @~/.claude/workflows/coding-philosophy.md
|
- **Coding Philosophy**: @~/.claude/workflows/coding-philosophy.md
|
||||||
- **Context Requirements**: @~/.claude/workflows/context-tools-ace.md
|
- **Context Requirements**: @~/.claude/workflows/context-tools.md
|
||||||
- **File Modification**: @~/.claude/workflows/file-modification.md
|
- **File Modification**: @~/.claude/workflows/file-modification.md
|
||||||
- **CLI Endpoints Config**: @.claude/cli-tools.json
|
- **CLI Endpoints Config**: @.claude/cli-tools.json
|
||||||
|
|
||||||
|
|||||||
@@ -1,105 +0,0 @@
|
|||||||
## MCP Tools Usage
|
|
||||||
|
|
||||||
### search_context (ACE) - Code Search (REQUIRED - HIGHEST PRIORITY)
|
|
||||||
|
|
||||||
**OVERRIDES**: All other search/discovery rules in other workflow files
|
|
||||||
|
|
||||||
**When**: ANY code discovery task, including:
|
|
||||||
- Find code, understand codebase structure, locate implementations
|
|
||||||
- Explore unknown locations
|
|
||||||
- Verify file existence before reading
|
|
||||||
- Pattern-based file discovery
|
|
||||||
- Semantic code understanding
|
|
||||||
|
|
||||||
**Priority Rule**:
|
|
||||||
1. **Always use mcp__ace-tool__search_context FIRST** for any code/file discovery
|
|
||||||
2. Only use Built-in Grep for single-file exact line search (after location confirmed)
|
|
||||||
3. Only use Built-in Read for known, confirmed file paths
|
|
||||||
|
|
||||||
**How**:
|
|
||||||
```javascript
|
|
||||||
// Natural language code search - best for understanding and exploration
|
|
||||||
mcp__ace-tool__search_context({
|
|
||||||
project_root_path: "/path/to/project",
|
|
||||||
query: "authentication logic"
|
|
||||||
})
|
|
||||||
|
|
||||||
// With keywords for better semantic matching
|
|
||||||
mcp__ace-tool__search_context({
|
|
||||||
project_root_path: "/path/to/project",
|
|
||||||
query: "I want to find where the server handles user login. Keywords: auth, login, session"
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
**Good Query Examples**:
|
|
||||||
- "Where is the function that handles user authentication?"
|
|
||||||
- "What tests are there for the login functionality?"
|
|
||||||
- "How is the database connected to the application?"
|
|
||||||
- "I want to find where the server handles chunk merging. Keywords: upload chunk merge"
|
|
||||||
- "Locate where the system refreshes cached data. Keywords: cache refresh, invalidation"
|
|
||||||
|
|
||||||
**Bad Query Examples** (use grep or file view instead):
|
|
||||||
- "Find definition of constructor of class Foo" (use grep tool instead)
|
|
||||||
- "Find all references to function bar" (use grep tool instead)
|
|
||||||
- "Show me how Checkout class is used in services/payment.py" (use file view tool instead)
|
|
||||||
|
|
||||||
**Key Features**:
|
|
||||||
- Real-time index of the codebase (always up-to-date)
|
|
||||||
- Cross-language retrieval support
|
|
||||||
- Semantic search with embeddings
|
|
||||||
- No manual index initialization required
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### read_file - Read File Contents
|
|
||||||
|
|
||||||
**When**: Read files found by search_context
|
|
||||||
|
|
||||||
**How**:
|
|
||||||
```javascript
|
|
||||||
read_file(path="/path/to/file.ts") // Single file
|
|
||||||
read_file(path="/src/**/*.config.ts") // Pattern matching
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### edit_file - Modify Files
|
|
||||||
|
|
||||||
**When**: Built-in Edit tool fails or need advanced features
|
|
||||||
|
|
||||||
**How**:
|
|
||||||
```javascript
|
|
||||||
edit_file(path="/file.ts", old_string="...", new_string="...", mode="update")
|
|
||||||
edit_file(path="/file.ts", line=10, content="...", mode="insert_after")
|
|
||||||
```
|
|
||||||
|
|
||||||
**Modes**: `update` (replace text), `insert_after`, `insert_before`, `delete_line`
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### write_file - Create/Overwrite Files
|
|
||||||
|
|
||||||
**When**: Create new files or completely replace content
|
|
||||||
|
|
||||||
**How**:
|
|
||||||
```javascript
|
|
||||||
write_file(path="/new-file.ts", content="...")
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Exa - External Search
|
|
||||||
|
|
||||||
**When**: Find documentation/examples outside codebase
|
|
||||||
|
|
||||||
**How**:
|
|
||||||
```javascript
|
|
||||||
mcp__exa__search(query="React hooks 2025 documentation")
|
|
||||||
mcp__exa__search(query="FastAPI auth example", numResults=10)
|
|
||||||
mcp__exa__search(query="latest API docs", livecrawl="always")
|
|
||||||
```
|
|
||||||
|
|
||||||
**Parameters**:
|
|
||||||
- `query` (required): Search query string
|
|
||||||
- `numResults` (optional): Number of results to return (default: 5)
|
|
||||||
- `livecrawl` (optional): `"always"` or `"fallback"` for live crawling
|
|
||||||
@@ -1,35 +1,27 @@
|
|||||||
## MCP Tools Usage
|
## Context Acquisition (MCP Tools Priority)
|
||||||
|
|
||||||
### smart_search - Code Search (REQUIRED - HIGHEST PRIORITY)
|
**For task context gathering and analysis, ALWAYS prefer MCP tools**:
|
||||||
|
|
||||||
**OVERRIDES**: All other search/discovery rules in other workflow files
|
1. **mcp__ace-tool__search_context** - HIGHEST PRIORITY for code discovery
|
||||||
|
- Semantic search with real-time codebase index
|
||||||
|
- Use for: finding implementations, understanding architecture, locating patterns
|
||||||
|
- Example: `mcp__ace-tool__search_context(project_root_path="/path", query="authentication logic")`
|
||||||
|
|
||||||
**When**: ANY code discovery task, including:
|
2. **smart_search** - Fallback for structured search
|
||||||
- Find code, understand codebase structure, locate implementations
|
- Use `smart_search(query="...")` for keyword/regex search
|
||||||
- Explore unknown locations
|
- Use `smart_search(action="find_files", pattern="*.ts")` for file discovery
|
||||||
- Verify file existence before reading
|
- Supports modes: `auto`, `hybrid`, `exact`, `ripgrep`
|
||||||
- Pattern-based file discovery
|
|
||||||
|
|
||||||
**Priority Rule**:
|
3. **read_file** - Batch file reading
|
||||||
1. **Always use smart_search FIRST** for any code/file discovery
|
- Read multiple files in parallel: `read_file(path="file1.ts")`, `read_file(path="file2.ts")`
|
||||||
2. Only use Built-in Grep for single-file exact line search (after location confirmed)
|
- Supports glob patterns: `read_file(path="src/**/*.config.ts")`
|
||||||
3. Only use Built-in Read for known, confirmed file paths
|
|
||||||
|
|
||||||
**Workflow** (search first, init if needed):
|
**Priority Order**:
|
||||||
```javascript
|
```
|
||||||
// Step 1: Try search directly (works if index exists or uses ripgrep fallback)
|
ACE search_context (semantic) → smart_search (structured) → read_file (batch read) → shell commands (fallback)
|
||||||
smart_search(query="authentication logic")
|
|
||||||
|
|
||||||
// Step 2: Only if search warns "No CodexLens index found", then init
|
|
||||||
smart_search(action="init", path=".") // Creates FTS index only
|
|
||||||
|
|
||||||
// Note: For semantic/vector search, use "ccw view" dashboard to create vector index
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**Modes**: `auto` (intelligent routing), `hybrid` (semantic, needs vector index), `exact` (FTS), `ripgrep` (no index)
|
**NEVER** use shell commands (`cat`, `find`, `grep`) when MCP tools are available.
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### read_file - Read File Contents
|
### read_file - Read File Contents
|
||||||
|
|
||||||
**When**: Read files found by smart_search
|
**When**: Read files found by smart_search
|
||||||
|
|||||||
@@ -21,24 +21,6 @@ let nativeResumeEnabled = localStorage.getItem('ccw-native-resume') !== 'false';
|
|||||||
// Recursive Query settings (for hierarchical storage aggregation)
|
// Recursive Query settings (for hierarchical storage aggregation)
|
||||||
let recursiveQueryEnabled = localStorage.getItem('ccw-recursive-query') !== 'false'; // default true
|
let recursiveQueryEnabled = localStorage.getItem('ccw-recursive-query') !== 'false'; // default true
|
||||||
|
|
||||||
// Code Index MCP provider (codexlens, ace, or none)
|
|
||||||
let codeIndexMcpProvider = 'codexlens';
|
|
||||||
|
|
||||||
// ========== Helper Functions ==========
|
|
||||||
/**
|
|
||||||
* Get the context-tools filename based on provider
|
|
||||||
*/
|
|
||||||
function getContextToolsFileName(provider) {
|
|
||||||
switch (provider) {
|
|
||||||
case 'ace':
|
|
||||||
return 'context-tools-ace.md';
|
|
||||||
case 'none':
|
|
||||||
return 'context-tools-none.md';
|
|
||||||
default:
|
|
||||||
return 'context-tools.md';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ========== Initialization ==========
|
// ========== Initialization ==========
|
||||||
function initCliStatus() {
|
function initCliStatus() {
|
||||||
// Load all statuses in one call using aggregated endpoint
|
// Load all statuses in one call using aggregated endpoint
|
||||||
@@ -259,12 +241,7 @@ async function loadCliToolsConfig() {
|
|||||||
defaultCliTool = data.defaultTool;
|
defaultCliTool = data.defaultTool;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load Code Index MCP provider from config
|
console.log('[CLI Config] Loaded from:', data._configInfo?.source || 'unknown', '| Default:', data.defaultTool);
|
||||||
if (data.settings?.codeIndexMcp) {
|
|
||||||
codeIndexMcpProvider = data.settings.codeIndexMcp;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('[CLI Config] Loaded from:', data._configInfo?.source || 'unknown', '| Default:', data.defaultTool, '| CodeIndexMCP:', codeIndexMcpProvider);
|
|
||||||
return data;
|
return data;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to load CLI tools config:', err);
|
console.error('Failed to load CLI tools config:', err);
|
||||||
@@ -637,33 +614,6 @@ function renderCliStatus() {
|
|||||||
</div>
|
</div>
|
||||||
<p class="cli-setting-desc">Cache prefix/suffix injection mode for prompts</p>
|
<p class="cli-setting-desc">Cache prefix/suffix injection mode for prompts</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="cli-setting-item">
|
|
||||||
<label class="cli-setting-label">
|
|
||||||
<i data-lucide="search" class="w-3 h-3"></i>
|
|
||||||
Code Index MCP
|
|
||||||
</label>
|
|
||||||
<div class="cli-setting-control">
|
|
||||||
<div class="flex items-center bg-muted rounded-lg p-0.5">
|
|
||||||
<button class="code-mcp-btn px-3 py-1.5 text-xs font-medium rounded-md transition-all ${codeIndexMcpProvider === 'codexlens' ? 'bg-primary text-primary-foreground shadow-sm' : 'text-muted-foreground hover:text-foreground'}"
|
|
||||||
onclick="setCodeIndexMcpProvider('codexlens')">
|
|
||||||
CodexLens
|
|
||||||
</button>
|
|
||||||
<button class="code-mcp-btn px-3 py-1.5 text-xs font-medium rounded-md transition-all ${codeIndexMcpProvider === 'ace' ? 'bg-primary text-primary-foreground shadow-sm' : 'text-muted-foreground hover:text-foreground'}"
|
|
||||||
onclick="setCodeIndexMcpProvider('ace')">
|
|
||||||
ACE
|
|
||||||
</button>
|
|
||||||
<button class="code-mcp-btn px-3 py-1.5 text-xs font-medium rounded-md transition-all ${codeIndexMcpProvider === 'none' ? 'bg-primary text-primary-foreground shadow-sm' : 'text-muted-foreground hover:text-foreground'}"
|
|
||||||
onclick="setCodeIndexMcpProvider('none')">
|
|
||||||
None
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<p class="cli-setting-desc">Code search provider (updates CLAUDE.md context-tools reference)</p>
|
|
||||||
<p class="cli-setting-desc text-xs text-muted-foreground mt-1">
|
|
||||||
<i data-lucide="file-text" class="w-3 h-3 inline-block mr-1"></i>
|
|
||||||
Current: <code class="bg-muted px-1 rounded">${getContextToolsFileName(codeIndexMcpProvider)}</code>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
@@ -786,33 +736,6 @@ async function setCacheInjectionMode(mode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setCodeIndexMcpProvider(provider) {
|
|
||||||
try {
|
|
||||||
const response = await fetch('/api/cli/code-index-mcp', {
|
|
||||||
method: 'PUT',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
body: JSON.stringify({ provider: provider })
|
|
||||||
});
|
|
||||||
if (response.ok) {
|
|
||||||
codeIndexMcpProvider = provider;
|
|
||||||
if (window.claudeCliToolsConfig && window.claudeCliToolsConfig.settings) {
|
|
||||||
window.claudeCliToolsConfig.settings.codeIndexMcp = provider;
|
|
||||||
}
|
|
||||||
const providerName = provider === 'ace' ? 'ACE (Augment)' : provider === 'none' ? 'None (Built-in only)' : 'CodexLens';
|
|
||||||
showRefreshToast(`Code Index MCP switched to ${providerName}`, 'success');
|
|
||||||
// Re-render both CLI status and settings section
|
|
||||||
if (typeof renderCliStatus === 'function') renderCliStatus();
|
|
||||||
if (typeof renderCliSettingsSection === 'function') renderCliSettingsSection();
|
|
||||||
} else {
|
|
||||||
const data = await response.json();
|
|
||||||
showRefreshToast(`Failed to switch Code Index MCP: ${data.error}`, 'error');
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Failed to switch Code Index MCP:', err);
|
|
||||||
showRefreshToast('Failed to switch Code Index MCP', 'error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function refreshAllCliStatus() {
|
async function refreshAllCliStatus() {
|
||||||
await loadAllStatuses();
|
await loadAllStatuses();
|
||||||
renderCliStatus();
|
renderCliStatus();
|
||||||
|
|||||||
@@ -560,8 +560,6 @@ const i18n = {
|
|||||||
'cli.recursiveQueryDesc': 'Aggregate CLI history and memory data from parent and child projects',
|
'cli.recursiveQueryDesc': 'Aggregate CLI history and memory data from parent and child projects',
|
||||||
'cli.maxContextFiles': 'Max Context Files',
|
'cli.maxContextFiles': 'Max Context Files',
|
||||||
'cli.maxContextFilesDesc': 'Maximum files to include in smart context',
|
'cli.maxContextFilesDesc': 'Maximum files to include in smart context',
|
||||||
'cli.codeIndexMcp': 'Code Index MCP',
|
|
||||||
'cli.codeIndexMcpDesc': 'Code search provider (updates CLAUDE.md context-tools reference)',
|
|
||||||
|
|
||||||
// CCW Install
|
// CCW Install
|
||||||
'ccw.install': 'CCW Install',
|
'ccw.install': 'CCW Install',
|
||||||
@@ -2414,8 +2412,6 @@ const i18n = {
|
|||||||
'cli.recursiveQueryDesc': '聚合显示父项目和子项目的 CLI 历史与内存数据',
|
'cli.recursiveQueryDesc': '聚合显示父项目和子项目的 CLI 历史与内存数据',
|
||||||
'cli.maxContextFiles': '最大上下文文件数',
|
'cli.maxContextFiles': '最大上下文文件数',
|
||||||
'cli.maxContextFilesDesc': '智能上下文包含的最大文件数',
|
'cli.maxContextFilesDesc': '智能上下文包含的最大文件数',
|
||||||
'cli.codeIndexMcp': '代码索引 MCP',
|
|
||||||
'cli.codeIndexMcpDesc': '代码搜索提供者 (更新 CLAUDE.md 的 context-tools 引用)',
|
|
||||||
|
|
||||||
// CCW Install
|
// CCW Install
|
||||||
'ccw.install': 'CCW 安装',
|
'ccw.install': 'CCW 安装',
|
||||||
|
|||||||
@@ -987,24 +987,6 @@ function renderCliSettingsSection() {
|
|||||||
'</div>' +
|
'</div>' +
|
||||||
'<p class="cli-setting-desc">' + t('cli.maxContextFilesDesc') + '</p>' +
|
'<p class="cli-setting-desc">' + t('cli.maxContextFilesDesc') + '</p>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<div class="cli-setting-item">' +
|
|
||||||
'<label class="cli-setting-label">' +
|
|
||||||
'<i data-lucide="search" class="w-3 h-3"></i>' +
|
|
||||||
t('cli.codeIndexMcp') +
|
|
||||||
'</label>' +
|
|
||||||
'<div class="cli-setting-control">' +
|
|
||||||
'<select class="cli-setting-select" onchange="setCodeIndexMcpProvider(this.value)">' +
|
|
||||||
'<option value="codexlens"' + (codeIndexMcpProvider === 'codexlens' ? ' selected' : '') + '>CodexLens</option>' +
|
|
||||||
'<option value="ace"' + (codeIndexMcpProvider === 'ace' ? ' selected' : '') + '>ACE (Augment)</option>' +
|
|
||||||
'<option value="none"' + (codeIndexMcpProvider === 'none' ? ' selected' : '') + '>None (Built-in)</option>' +
|
|
||||||
'</select>' +
|
|
||||||
'</div>' +
|
|
||||||
'<p class="cli-setting-desc">' + t('cli.codeIndexMcpDesc') + '</p>' +
|
|
||||||
'<p class="cli-setting-desc text-xs text-muted-foreground">' +
|
|
||||||
'<i data-lucide="file-text" class="w-3 h-3 inline-block mr-1"></i>' +
|
|
||||||
'Current: <code class="bg-muted px-1 rounded">' + getContextToolsFileName(codeIndexMcpProvider) + '</code>' +
|
|
||||||
'</p>' +
|
|
||||||
'</div>' +
|
|
||||||
'</div>';
|
'</div>';
|
||||||
|
|
||||||
container.innerHTML = settingsHtml;
|
container.innerHTML = settingsHtml;
|
||||||
|
|||||||
Reference in New Issue
Block a user