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:
@@ -53,10 +53,13 @@ interface SessionInput {
|
||||
session_id?: string;
|
||||
id?: string;
|
||||
project?: string;
|
||||
description?: string;
|
||||
status?: string;
|
||||
type?: string;
|
||||
workflow_type?: string | null;
|
||||
created_at?: string | null;
|
||||
created_at?: string | null; // For backward compatibility
|
||||
created?: string; // From SessionMetadata
|
||||
updated?: string; // From SessionMetadata
|
||||
archived_at?: string | null;
|
||||
path: string;
|
||||
}
|
||||
@@ -249,11 +252,11 @@ export async function aggregateData(sessions: ScanSessionsResult, workflowDir: s
|
||||
async function processSession(session: SessionInput, isActive: boolean): Promise<SessionData> {
|
||||
const result: SessionData = {
|
||||
session_id: session.session_id || session.id || '',
|
||||
project: session.project || session.session_id || session.id || '',
|
||||
project: session.project || session.description || session.session_id || session.id || '',
|
||||
status: session.status || (isActive ? 'active' : 'archived'),
|
||||
type: session.type || 'workflow', // Session type (workflow, review, test, docs)
|
||||
workflow_type: session.workflow_type || null, // Original workflow_type for reference
|
||||
created_at: session.created_at || null, // Raw ISO string - let frontend format
|
||||
created_at: session.created || session.created_at || null, // Prefer 'created' from SessionMetadata, fallback to 'created_at'
|
||||
archived_at: session.archived_at || null, // Raw ISO string - let frontend format
|
||||
path: session.path,
|
||||
tasks: [],
|
||||
|
||||
@@ -192,9 +192,9 @@ export async function handleCodexLensRoutes(ctx: RouteContext): Promise<boolean>
|
||||
const args = ['clean'];
|
||||
if (all) {
|
||||
args.push('--all');
|
||||
}
|
||||
if (path) {
|
||||
args.push('--path', path);
|
||||
} else if (path) {
|
||||
// Path is passed as a positional argument, not as a flag
|
||||
args.push(path);
|
||||
}
|
||||
args.push('--json');
|
||||
|
||||
|
||||
@@ -771,7 +771,8 @@ Return ONLY valid JSON in this exact format (no markdown, no code blocks, just p
|
||||
}
|
||||
|
||||
try {
|
||||
const configPath = join(projectPath, '.claude', 'CLAUDE.md');
|
||||
const rulesDir = join(projectPath, '.claude', 'rules');
|
||||
const configPath = join(rulesDir, 'active_memory.md');
|
||||
const configJsonPath = join(projectPath, '.claude', 'active_memory_config.json');
|
||||
const enabled = existsSync(configPath);
|
||||
let lastSync: string | null = null;
|
||||
@@ -823,7 +824,8 @@ Return ONLY valid JSON in this exact format (no markdown, no code blocks, just p
|
||||
}
|
||||
|
||||
const claudeDir = join(projectPath, '.claude');
|
||||
const configPath = join(claudeDir, 'CLAUDE.md');
|
||||
const rulesDir = join(claudeDir, 'rules');
|
||||
const configPath = join(rulesDir, 'active_memory.md');
|
||||
const configJsonPath = join(claudeDir, 'active_memory_config.json');
|
||||
|
||||
if (enabled) {
|
||||
@@ -831,14 +833,17 @@ Return ONLY valid JSON in this exact format (no markdown, no code blocks, just p
|
||||
if (!existsSync(claudeDir)) {
|
||||
mkdirSync(claudeDir, { recursive: true });
|
||||
}
|
||||
if (!existsSync(rulesDir)) {
|
||||
mkdirSync(rulesDir, { recursive: true });
|
||||
}
|
||||
|
||||
// Save config
|
||||
if (config) {
|
||||
writeFileSync(configJsonPath, JSON.stringify(config, null, 2), 'utf-8');
|
||||
}
|
||||
|
||||
// Create initial CLAUDE.md with header
|
||||
const initialContent = `# CLAUDE.md - Project Memory
|
||||
// Create initial active_memory.md with header
|
||||
const initialContent = `# Active Memory - Project Context
|
||||
|
||||
> Auto-generated understanding of frequently accessed files.
|
||||
> Last updated: ${new Date().toISOString()}
|
||||
@@ -901,7 +906,7 @@ Return ONLY valid JSON in this exact format (no markdown, no code blocks, just p
|
||||
return true;
|
||||
}
|
||||
|
||||
// API: Active Memory - Sync (analyze hot files using CLI and update CLAUDE.md)
|
||||
// API: Active Memory - Sync (analyze hot files using CLI and update active_memory.md)
|
||||
if (pathname === '/api/memory/active/sync' && req.method === 'POST') {
|
||||
let body = '';
|
||||
req.on('data', (chunk: Buffer) => { body += chunk.toString(); });
|
||||
@@ -917,7 +922,8 @@ Return ONLY valid JSON in this exact format (no markdown, no code blocks, just p
|
||||
}
|
||||
|
||||
const claudeDir = join(projectPath, '.claude');
|
||||
const configPath = join(claudeDir, 'CLAUDE.md');
|
||||
const rulesDir = join(claudeDir, 'rules');
|
||||
const configPath = join(rulesDir, 'active_memory.md');
|
||||
|
||||
// Get hot files from memory store - with fallback
|
||||
let hotFiles: any[] = [];
|
||||
@@ -937,8 +943,8 @@ Return ONLY valid JSON in this exact format (no markdown, no code blocks, just p
|
||||
return isAbsolute(filePath) ? filePath : join(projectPath, filePath);
|
||||
}).filter((p: string) => existsSync(p));
|
||||
|
||||
// Build the CLAUDE.md content header
|
||||
let content = `# CLAUDE.md - Project Memory
|
||||
// Build the active_memory.md content header
|
||||
let content = `# Active Memory - Project Context
|
||||
|
||||
> Auto-generated understanding of frequently accessed files using ${tool.toUpperCase()}.
|
||||
> Last updated: ${new Date().toISOString()}
|
||||
@@ -1055,10 +1061,13 @@ RULES: Be concise. Focus on practical understanding. Include function signatures
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure directory exists
|
||||
// Ensure directories exist
|
||||
if (!existsSync(claudeDir)) {
|
||||
mkdirSync(claudeDir, { recursive: true });
|
||||
}
|
||||
if (!existsSync(rulesDir)) {
|
||||
mkdirSync(rulesDir, { recursive: true });
|
||||
}
|
||||
|
||||
// Write the file
|
||||
writeFileSync(configPath, content, 'utf-8');
|
||||
|
||||
Reference in New Issue
Block a user