mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-10 02:24:35 +08:00
Implement database migration framework and performance optimizations
- Added active memory configuration for manual interval and Gemini tool. - Created file modification rules for handling edits and writes. - Implemented migration manager for managing database schema migrations. - Added migration 001 to normalize keywords into separate tables. - Developed tests for validating performance optimizations including keyword normalization, path lookup, and symbol search. - Created validation script to manually verify optimization implementations.
This commit is contained in:
@@ -734,7 +734,7 @@ Return ONLY valid JSON in this exact format (no markdown, no code blocks, just p
|
||||
|
||||
try {
|
||||
const configPath = join(projectPath, '.claude', 'rules', 'active_memory.md');
|
||||
const configJsonPath = join(projectPath, '.claude', 'rules', 'active_memory_config.json');
|
||||
const configJsonPath = join(projectPath, '.claude', 'active_memory_config.json');
|
||||
const enabled = existsSync(configPath);
|
||||
let lastSync: string | null = null;
|
||||
let fileCount = 0;
|
||||
@@ -785,14 +785,18 @@ Return ONLY valid JSON in this exact format (no markdown, no code blocks, just p
|
||||
}
|
||||
|
||||
const rulesDir = join(projectPath, '.claude', 'rules');
|
||||
const claudeDir = join(projectPath, '.claude');
|
||||
const configPath = join(rulesDir, 'active_memory.md');
|
||||
const configJsonPath = join(rulesDir, 'active_memory_config.json');
|
||||
const configJsonPath = join(claudeDir, 'active_memory_config.json');
|
||||
|
||||
if (enabled) {
|
||||
// Enable: Create directory and initial file
|
||||
// Enable: Create directories and initial file
|
||||
if (!existsSync(rulesDir)) {
|
||||
mkdirSync(rulesDir, { recursive: true });
|
||||
}
|
||||
if (!existsSync(claudeDir)) {
|
||||
mkdirSync(claudeDir, { recursive: true });
|
||||
}
|
||||
|
||||
// Save config
|
||||
if (config) {
|
||||
@@ -844,11 +848,11 @@ Return ONLY valid JSON in this exact format (no markdown, no code blocks, just p
|
||||
try {
|
||||
const { config } = JSON.parse(body || '{}');
|
||||
const projectPath = initialPath;
|
||||
const rulesDir = join(projectPath, '.claude', 'rules');
|
||||
const configJsonPath = join(rulesDir, 'active_memory_config.json');
|
||||
const claudeDir = join(projectPath, '.claude');
|
||||
const configJsonPath = join(claudeDir, 'active_memory_config.json');
|
||||
|
||||
if (!existsSync(rulesDir)) {
|
||||
mkdirSync(rulesDir, { recursive: true });
|
||||
if (!existsSync(claudeDir)) {
|
||||
mkdirSync(claudeDir, { recursive: true });
|
||||
}
|
||||
|
||||
writeFileSync(configJsonPath, JSON.stringify(config, null, 2), 'utf-8');
|
||||
@@ -938,7 +942,10 @@ RULES: Be concise. Focus on practical understanding. Include function signatures
|
||||
});
|
||||
|
||||
if (result.success && result.execution?.output) {
|
||||
cliOutput = result.execution.output;
|
||||
// Extract stdout from output object
|
||||
cliOutput = typeof result.execution.output === 'string'
|
||||
? result.execution.output
|
||||
: result.execution.output.stdout || '';
|
||||
}
|
||||
|
||||
// Add CLI output to content
|
||||
@@ -1007,6 +1014,18 @@ RULES: Be concise. Focus on practical understanding. Include function signatures
|
||||
// Write the file
|
||||
writeFileSync(configPath, content, 'utf-8');
|
||||
|
||||
// Broadcast Active Memory sync completion event
|
||||
broadcastToClients({
|
||||
type: 'ACTIVE_MEMORY_SYNCED',
|
||||
payload: {
|
||||
filesAnalyzed: hotFiles.length,
|
||||
path: configPath,
|
||||
tool,
|
||||
usedCli: cliOutput.length > 0,
|
||||
timestamp: new Date().toISOString()
|
||||
}
|
||||
});
|
||||
|
||||
res.writeHead(200, { 'Content-Type': 'application/json' });
|
||||
res.end(JSON.stringify({
|
||||
success: true,
|
||||
|
||||
@@ -3757,3 +3757,205 @@
|
||||
.btn-ghost.text-destructive:hover {
|
||||
background: hsl(var(--destructive) / 0.1);
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
* Semantic Metadata Viewer Styles
|
||||
* ======================================== */
|
||||
.semantic-viewer-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0.75rem 1rem;
|
||||
background: hsl(var(--muted) / 0.3);
|
||||
border-bottom: 1px solid hsl(var(--border));
|
||||
}
|
||||
|
||||
.semantic-table-container {
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.semantic-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.semantic-table th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: hsl(var(--card));
|
||||
padding: 0.625rem 0.75rem;
|
||||
text-align: left;
|
||||
font-weight: 600;
|
||||
font-size: 0.75rem;
|
||||
color: hsl(var(--muted-foreground));
|
||||
border-bottom: 1px solid hsl(var(--border));
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.semantic-table td {
|
||||
padding: 0.625rem 0.75rem;
|
||||
border-bottom: 1px solid hsl(var(--border) / 0.5);
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.semantic-row {
|
||||
cursor: pointer;
|
||||
transition: background 0.15s ease;
|
||||
}
|
||||
|
||||
.semantic-row:hover {
|
||||
background: hsl(var(--hover));
|
||||
}
|
||||
|
||||
.semantic-cell-file {
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.semantic-cell-lang {
|
||||
width: 80px;
|
||||
color: hsl(var(--muted-foreground));
|
||||
}
|
||||
|
||||
.semantic-cell-purpose {
|
||||
max-width: 180px;
|
||||
color: hsl(var(--foreground) / 0.8);
|
||||
}
|
||||
|
||||
.semantic-cell-keywords {
|
||||
max-width: 160px;
|
||||
}
|
||||
|
||||
.semantic-cell-tool {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
.semantic-cell-date {
|
||||
width: 80px;
|
||||
color: hsl(var(--muted-foreground));
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.semantic-keyword {
|
||||
display: inline-block;
|
||||
padding: 0.125rem 0.375rem;
|
||||
margin: 0.125rem;
|
||||
background: hsl(var(--primary) / 0.1);
|
||||
color: hsl(var(--primary));
|
||||
border-radius: 0.25rem;
|
||||
font-size: 0.6875rem;
|
||||
}
|
||||
|
||||
.semantic-keyword-more {
|
||||
display: inline-block;
|
||||
padding: 0.125rem 0.375rem;
|
||||
margin: 0.125rem;
|
||||
background: hsl(var(--muted));
|
||||
color: hsl(var(--muted-foreground));
|
||||
border-radius: 0.25rem;
|
||||
font-size: 0.6875rem;
|
||||
}
|
||||
|
||||
.tool-badge {
|
||||
display: inline-block;
|
||||
padding: 0.125rem 0.5rem;
|
||||
border-radius: 0.25rem;
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 500;
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.tool-badge.tool-gemini {
|
||||
background: hsl(210 80% 55% / 0.15);
|
||||
color: hsl(210 80% 45%);
|
||||
}
|
||||
|
||||
.tool-badge.tool-qwen {
|
||||
background: hsl(142 76% 36% / 0.15);
|
||||
color: hsl(142 76% 36%);
|
||||
}
|
||||
|
||||
.tool-badge.tool-unknown {
|
||||
background: hsl(var(--muted));
|
||||
color: hsl(var(--muted-foreground));
|
||||
}
|
||||
|
||||
.semantic-detail-row {
|
||||
background: hsl(var(--muted) / 0.2);
|
||||
}
|
||||
|
||||
.semantic-detail-row.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.semantic-detail-content {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.semantic-detail-section {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.semantic-detail-section h4 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: hsl(var(--muted-foreground));
|
||||
margin-bottom: 0.5rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
.semantic-detail-section p {
|
||||
font-size: 0.8125rem;
|
||||
line-height: 1.5;
|
||||
color: hsl(var(--foreground));
|
||||
}
|
||||
|
||||
.semantic-keywords-full {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.semantic-detail-meta {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
padding-top: 0.75rem;
|
||||
border-top: 1px solid hsl(var(--border) / 0.5);
|
||||
font-size: 0.75rem;
|
||||
color: hsl(var(--muted-foreground));
|
||||
}
|
||||
|
||||
.semantic-detail-meta span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.375rem;
|
||||
}
|
||||
|
||||
.semantic-viewer-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0.75rem 1rem;
|
||||
background: hsl(var(--muted) / 0.3);
|
||||
border-top: 1px solid hsl(var(--border));
|
||||
}
|
||||
|
||||
.semantic-loading,
|
||||
.semantic-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 3rem;
|
||||
text-align: center;
|
||||
color: hsl(var(--muted-foreground));
|
||||
}
|
||||
|
||||
.semantic-loading {
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
@@ -2097,7 +2097,7 @@
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 480px;
|
||||
width: 50vw;
|
||||
max-width: 100vw;
|
||||
height: 100vh;
|
||||
background: hsl(var(--card));
|
||||
@@ -2132,7 +2132,6 @@
|
||||
justify-content: space-between;
|
||||
padding: 1rem 1.25rem;
|
||||
border-bottom: 1px solid hsl(var(--border));
|
||||
background: hsl(var(--muted) / 0.3);
|
||||
}
|
||||
|
||||
.insight-detail-header h3 {
|
||||
|
||||
@@ -238,6 +238,31 @@ function handleNotification(data) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'ACTIVE_MEMORY_SYNCED':
|
||||
// Handle Active Memory sync completion
|
||||
if (typeof addGlobalNotification === 'function') {
|
||||
const { filesAnalyzed, tool, usedCli } = payload;
|
||||
const method = usedCli ? `CLI (${tool})` : 'Basic';
|
||||
addGlobalNotification(
|
||||
'success',
|
||||
'Active Memory synced',
|
||||
{
|
||||
'Files Analyzed': filesAnalyzed,
|
||||
'Method': method,
|
||||
'Timestamp': new Date(payload.timestamp).toLocaleTimeString()
|
||||
},
|
||||
'Memory'
|
||||
);
|
||||
}
|
||||
// Refresh Active Memory status if on memory view
|
||||
if (getCurrentView && getCurrentView() === 'memory') {
|
||||
if (typeof loadActiveMemoryStatus === 'function') {
|
||||
loadActiveMemoryStatus();
|
||||
}
|
||||
}
|
||||
console.log('[Active Memory] Sync completed:', payload);
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log('[WS] Unknown notification type:', type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user