diff --git a/.claude/workflows/mcp-tool-strategy.md b/.claude/workflows/mcp-tool-strategy.md deleted file mode 100644 index 952f3d08..00000000 --- a/.claude/workflows/mcp-tool-strategy.md +++ /dev/null @@ -1,11 +0,0 @@ -# MCP Tool Strategy: Exa Usage - -## ⚡ Exa Triggering Mechanisms - -**Auto-Trigger**: -- User mentions "exa-code" or code-related queries → `mcp__exa__get_code_context_exa` -- Need current web information → `mcp__exa__web_search_exa` - -**Manual Trigger**: -- Complex API research → Exa Code Context -- Real-time information needs → Exa Web Search diff --git a/.claude/workflows/tool-strategy.md b/.claude/workflows/tool-strategy.md new file mode 100644 index 00000000..13034bb1 --- /dev/null +++ b/.claude/workflows/tool-strategy.md @@ -0,0 +1,71 @@ +# Tool Strategy + +## ⚡ Exa Triggering Mechanisms + +**Auto-Trigger**: +- User mentions "exa-code" or code-related queries → `mcp__exa__get_code_context_exa` +- Need current web information → `mcp__exa__web_search_exa` + +**Manual Trigger**: +- Complex API research → Exa Code Context +- Real-time information needs → Exa Web Search + +## ⚡ Bash Text Processing (sed/awk) + +**When to Use**: Edit tool fails 2+ times on same file + +### sed Quick Reference + +```bash +# Replace first occurrence per line +sed 's/old/new/' file.txt + +# Replace all occurrences (global) +sed 's/old/new/g' file.txt + +# In-place edit (modify file directly) +sed -i 's/old/new/g' file.txt + +# Delete lines matching pattern +sed '/pattern/d' file.txt + +# Insert line before match +sed '/pattern/i\new line' file.txt + +# Insert line after match +sed '/pattern/a\new line' file.txt + +# Replace on specific line number +sed '5s/old/new/' file.txt + +# Multi-line replacement (escape newlines) +sed ':a;N;$!ba;s/old\npattern/new\ntext/g' file.txt +``` + +### awk Quick Reference + +```bash +# Print specific column +awk '{print $1}' file.txt + +# Print lines matching pattern +awk '/pattern/' file.txt + +# Replace field value +awk '{$2="new"; print}' file.txt + +# Conditional replacement +awk '/pattern/{gsub(/old/,"new")}1' file.txt + +# Insert line after match +awk '/pattern/{print; print "new line"; next}1' file.txt + +# Multi-field operations +awk -F',' '{print $1, $3}' file.csv +``` + +### Fallback Strategy + +1. **Edit fails 2+ times** → Try sed for simple replacements +2. **sed fails** → Try awk for complex patterns +3. **awk fails** → Use Write to recreate file diff --git a/CLAUDE.md b/CLAUDE.md index 5c6a5014..7c45401f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -5,7 +5,7 @@ This document defines project-specific coding standards and development principles. ### CLI Tool Context Protocols For all CLI tool usage, command syntax, and integration guidelines: -- **MCP Tool Strategy**: @~/.claude/workflows/mcp-tool-strategy.md +- **Tool Strategy**: @~/.claude/workflows/tool-strategy.md - **Intelligent Context Strategy**: @~/.claude/workflows/intelligent-tools-strategy.md - **Context Search Commands**: @~/.claude/workflows/context-search-strategy.md @@ -73,6 +73,7 @@ For all CLI tool usage, command syntax, and integration guidelines: - Update plan documentation and progress tracking as you go - Learn from existing implementations - Stop after 3 failed attempts and reassess +- **Edit fallback**: When Edit tool fails 2+ times on same file, try Bash sed/awk first, then Write to recreate if still failing ## Platform-Specific Guidelines diff --git a/ccw/src/templates/dashboard-js/components/tabs-other.js b/ccw/src/templates/dashboard-js/components/tabs-other.js index ef86946a..a5f4fa36 100644 --- a/ccw/src/templates/dashboard-js/components/tabs-other.js +++ b/ccw/src/templates/dashboard-js/components/tabs-other.js @@ -157,22 +157,36 @@ function renderReviewContent(review) { // Lite Context Tab Rendering // ========================================== -function renderLiteContextContent(context, session) { +function renderLiteContextContent(context, explorations, session) { const plan = session.plan || {}; + let sections = []; + + // Render explorations if available (from exploration-*.json files) + if (explorations && explorations.manifest) { + sections.push(renderExplorationContext(explorations)); + } // If we have context from context-package.json if (context) { - return ` -
${escapeHtml(JSON.stringify(context, null, 2))}
+ sections.push(`
+ ${escapeHtml(JSON.stringify(context, null, 2))}
+ ${escapeHtml(f.path || '')}No data available
'; + const result = content.join('') || 'No data available
'; + return result; } diff --git a/ccw/src/templates/dashboard-js/utils.js b/ccw/src/templates/dashboard-js/utils.js index 4daf785d..6dd1bf94 100644 --- a/ccw/src/templates/dashboard-js/utils.js +++ b/ccw/src/templates/dashboard-js/utils.js @@ -132,3 +132,22 @@ function toggleSection(header) { } } } + +/** + * Initialize collapsible sections within a container + * @param {HTMLElement} container - Container element to search within + */ +function initCollapsibleSections(container) { + setTimeout(() => { + const headers = container.querySelectorAll('.collapsible-header'); + headers.forEach(header => { + if (!header._clickBound) { + header._clickBound = true; + header.addEventListener('click', function(e) { + e.stopPropagation(); + toggleSection(this); + }); + } + }); + }, 100); +} diff --git a/ccw/src/templates/dashboard-js/views/lite-tasks.js b/ccw/src/templates/dashboard-js/views/lite-tasks.js index 23e61f68..69979fb6 100644 --- a/ccw/src/templates/dashboard-js/views/lite-tasks.js +++ b/ccw/src/templates/dashboard-js/views/lite-tasks.js @@ -347,17 +347,14 @@ async function loadAndRenderLiteContextTab(session, contentArea) { const data = await response.json(); contentArea.innerHTML = renderLiteContextContent(data.context, data.explorations, session); - // Re-initialize collapsible sections for explorations - setTimeout(() => { - document.querySelectorAll('.collapsible-header').forEach(header => { - header.addEventListener('click', () => toggleSection(header)); - }); - }, 50); + // Re-initialize collapsible sections for explorations (scoped to contentArea) + initCollapsibleSections(contentArea); return; } } // Fallback: show plan context if available contentArea.innerHTML = renderLiteContextContent(null, null, session); + initCollapsibleSections(contentArea); } catch (err) { contentArea.innerHTML = `| Project | +MCP Servers | +Status | +
|---|---|---|
|
+
+ ${isCurrentProject ? '📍' : '📁'}
+
+
+
+
+ ${escapeHtml(path.split('\\').pop() || path)}
+ ${isCurrentProject ? '(Current)' : ''}
+
+ ${escapeHtml(path)}
+ |
+
+
+ ${serverNames.length === 0
+ ? 'No MCP servers'
+ : serverNames.map(serverName => {
+ const isEnabled = !projectDisabled.includes(serverName);
+ return `
+
+
+ ${escapeHtml(serverName)}
+
+ `;
+ }).join('')
+ }
+
+ |
+ + + ${enabledCount}/${serverNames.length} + + | +