mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
feat: 添加最近路径管理功能,包括删除路径的API和前端交互
This commit is contained in:
@@ -12,9 +12,28 @@ function initPathSelector() {
|
||||
recentPaths.forEach(path => {
|
||||
const item = document.createElement('div');
|
||||
item.className = 'path-item' + (path === projectPath ? ' active' : '');
|
||||
item.textContent = path;
|
||||
item.dataset.path = path;
|
||||
item.addEventListener('click', () => selectPath(path));
|
||||
|
||||
// Path text
|
||||
const pathText = document.createElement('span');
|
||||
pathText.className = 'path-text';
|
||||
pathText.textContent = path;
|
||||
pathText.addEventListener('click', () => selectPath(path));
|
||||
item.appendChild(pathText);
|
||||
|
||||
// Delete button (only for non-current paths)
|
||||
if (path !== projectPath) {
|
||||
const deleteBtn = document.createElement('button');
|
||||
deleteBtn.className = 'path-delete-btn';
|
||||
deleteBtn.innerHTML = '×';
|
||||
deleteBtn.title = 'Remove from recent';
|
||||
deleteBtn.addEventListener('click', async (e) => {
|
||||
e.stopPropagation();
|
||||
await removeRecentPathFromList(path);
|
||||
});
|
||||
item.appendChild(deleteBtn);
|
||||
}
|
||||
|
||||
recentContainer.appendChild(item);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -961,3 +961,137 @@ function renderConflictDetectionSection(conflictDetection) {
|
||||
|
||||
return sections.join('');
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// Session Context Tab Rendering (Standard Sessions)
|
||||
// ==========================================
|
||||
// Combines context-package, explorations, and conflict resolution
|
||||
|
||||
function renderSessionContextContent(context, explorations, conflictResolution) {
|
||||
let sections = [];
|
||||
|
||||
// Render conflict resolution decisions if available
|
||||
if (conflictResolution) {
|
||||
sections.push(renderConflictResolutionContext(conflictResolution));
|
||||
}
|
||||
|
||||
// Render explorations if available (from exploration-*.json files)
|
||||
if (explorations && explorations.manifest) {
|
||||
sections.push(renderExplorationContext(explorations));
|
||||
}
|
||||
|
||||
// Render context-package.json content
|
||||
if (context) {
|
||||
const contextJson = JSON.stringify(context, null, 2);
|
||||
window._currentContextJson = contextJson;
|
||||
|
||||
// Use existing renderContextContent for detailed rendering
|
||||
sections.push(\`
|
||||
<div class="session-context-section">
|
||||
\${renderContextContent(context)}
|
||||
</div>
|
||||
\`);
|
||||
}
|
||||
|
||||
// If we have any sections, wrap them
|
||||
if (sections.length > 0) {
|
||||
return \`<div class="context-tab-content session-context-combined">\${sections.join('')}</div>\`;
|
||||
}
|
||||
|
||||
return \`
|
||||
<div class="tab-empty-state">
|
||||
<div class="empty-icon">📦</div>
|
||||
<div class="empty-title">No Context Data</div>
|
||||
<div class="empty-text">No context-package.json, exploration files, or conflict resolution data found for this session.</div>
|
||||
</div>
|
||||
\`;
|
||||
}
|
||||
|
||||
// ==========================================
|
||||
// Conflict Resolution Context Rendering
|
||||
// ==========================================
|
||||
|
||||
function renderConflictResolutionContext(conflictResolution) {
|
||||
if (!conflictResolution) {
|
||||
return '';
|
||||
}
|
||||
|
||||
let sections = [];
|
||||
|
||||
// Header
|
||||
sections.push(\`
|
||||
<div class="conflict-resolution-header">
|
||||
<h4>⚖️ Conflict Resolution Decisions</h4>
|
||||
<div class="conflict-meta">
|
||||
<span class="meta-item">Session: <strong>\${escapeHtml(conflictResolution.session_id || 'N/A')}</strong></span>
|
||||
\${conflictResolution.resolved_at ? \`<span class="meta-item">Resolved: <strong>\${formatDate(conflictResolution.resolved_at)}</strong></span>\` : ''}
|
||||
</div>
|
||||
</div>
|
||||
\`);
|
||||
|
||||
// User decisions
|
||||
if (conflictResolution.user_decisions && Object.keys(conflictResolution.user_decisions).length > 0) {
|
||||
const decisions = Object.entries(conflictResolution.user_decisions);
|
||||
|
||||
sections.push(\`
|
||||
<div class="conflict-decisions-section collapsible-section">
|
||||
<div class="collapsible-header">
|
||||
<span class="collapse-icon">▶</span>
|
||||
<span class="section-label">🎯 User Decisions (\${decisions.length})</span>
|
||||
</div>
|
||||
<div class="collapsible-content collapsed">
|
||||
<div class="decisions-list">
|
||||
\${decisions.map(([key, decision]) => \`
|
||||
<div class="decision-item">
|
||||
<div class="decision-header">
|
||||
<span class="decision-key">\${escapeHtml(key.replace(/_/g, ' '))}</span>
|
||||
<span class="decision-choice">\${escapeHtml(decision.choice || 'N/A')}</span>
|
||||
</div>
|
||||
\${decision.description ? \`<p class="decision-description">\${escapeHtml(decision.description)}</p>\` : ''}
|
||||
\${decision.implications && decision.implications.length > 0 ? \`
|
||||
<div class="decision-implications">
|
||||
<span class="implications-label">Implications:</span>
|
||||
<ul class="implications-list">
|
||||
\${decision.implications.map(impl => \`<li>\${escapeHtml(impl)}</li>\`).join('')}
|
||||
</ul>
|
||||
</div>
|
||||
\` : ''}
|
||||
</div>
|
||||
\`).join('')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
\`);
|
||||
}
|
||||
|
||||
// Resolved conflicts
|
||||
if (conflictResolution.resolved_conflicts && conflictResolution.resolved_conflicts.length > 0) {
|
||||
sections.push(\`
|
||||
<div class="resolved-conflicts-section collapsible-section">
|
||||
<div class="collapsible-header">
|
||||
<span class="collapse-icon">▶</span>
|
||||
<span class="section-label">✅ Resolved Conflicts (\${conflictResolution.resolved_conflicts.length})</span>
|
||||
</div>
|
||||
<div class="collapsible-content collapsed">
|
||||
<div class="conflicts-list">
|
||||
\${conflictResolution.resolved_conflicts.map(conflict => \`
|
||||
<div class="resolved-conflict-item">
|
||||
<div class="conflict-row">
|
||||
<span class="conflict-id">\${escapeHtml(conflict.id || 'N/A')}</span>
|
||||
<span class="conflict-category-badge">\${escapeHtml(conflict.category || 'General')}</span>
|
||||
</div>
|
||||
<div class="conflict-brief">\${escapeHtml(conflict.brief || '')}</div>
|
||||
<div class="conflict-strategy">
|
||||
<span class="strategy-label">Strategy:</span>
|
||||
<span class="strategy-value">\${escapeHtml(conflict.strategy || 'N/A')}</span>
|
||||
</div>
|
||||
</div>
|
||||
\`).join('')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
\`);
|
||||
}
|
||||
|
||||
return \`<div class="conflict-resolution-context">\${sections.join('')}</div>\`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user