refactor: major cleanup of legacy and temporary files

- Removed ~965MB of temporary directories (temp/, extracted-nodes/, etc)
- Deleted outdated database files and backups (.bak files)
- Removed legacy shell scripts (mcp-server-v20.sh, rebuild-v20.sh)
- Cleaned up orphan test files and debugging scripts
- Removed duplicate schema file (src/db/schema.sql)
- Deleted old Dockerfile.old and empty database files
- Updated documentation structure in README.md
- Added n8n_diagnostic tool to documentation
- Condensed version history in CLAUDE.md
- Created release notes for v2.7.0

Total impact: Removed 34 files, saving ~965MB+ of disk space

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-06-29 19:06:31 +02:00
parent 91386b2d02
commit 1907e5ce8e
34 changed files with 112 additions and 2898 deletions

View File

@@ -1,94 +0,0 @@
#!/usr/bin/env node
const { NodeDocumentationService } = require('../dist/services/node-documentation-service');
async function testCompleteFix() {
console.log('=== Testing Complete Documentation Fix ===\n');
const service = new NodeDocumentationService('./data/test-nodes-v2.db');
try {
// First check if we have any nodes
const existingNodes = await service.listNodes();
console.log(`📊 Current database has ${existingNodes.length} nodes`);
if (existingNodes.length === 0) {
console.log('\n🔄 Rebuilding database with fixed documentation fetcher...');
const stats = await service.rebuildDatabase();
console.log(`\n✅ Rebuild complete:`);
console.log(` - Total nodes found: ${stats.total}`);
console.log(` - Successfully processed: ${stats.successful}`);
console.log(` - Failed: ${stats.failed}`);
if (stats.errors.length > 0) {
console.log('\n⚠ Errors encountered:');
stats.errors.slice(0, 5).forEach(err => console.log(` - ${err}`));
}
}
// Test specific nodes
console.log('\n📋 Testing specific nodes:');
const testNodes = ['slack', 'if', 'httpRequest', 'webhook'];
for (const nodeName of testNodes) {
const nodeInfo = await service.getNodeInfo(`n8n-nodes-base.${nodeName}`);
if (nodeInfo) {
console.log(`\n${nodeInfo.displayName || nodeName}:`);
console.log(` - Type: ${nodeInfo.nodeType}`);
console.log(` - Description: ${nodeInfo.description?.substring(0, 80)}...`);
console.log(` - Has source code: ${!!nodeInfo.sourceCode}`);
console.log(` - Has documentation: ${!!nodeInfo.documentation}`);
console.log(` - Documentation URL: ${nodeInfo.documentationUrl || 'N/A'}`);
console.log(` - Has example: ${!!nodeInfo.exampleWorkflow}`);
console.log(` - Category: ${nodeInfo.category || 'N/A'}`);
// Check if it's getting the right documentation
if (nodeInfo.documentation) {
const isCredentialDoc = nodeInfo.documentation.includes('credentials') &&
!nodeInfo.documentation.includes('node documentation');
console.log(` - Is credential doc: ${isCredentialDoc} ${isCredentialDoc ? '❌' : '✅'}`);
}
} else {
console.log(`\n${nodeName}: Not found in database`);
}
}
// Test search functionality
console.log('\n🔍 Testing search functionality:');
const searchTests = [
{ query: 'webhook', label: 'Webhook nodes' },
{ query: 'http', label: 'HTTP nodes' },
{ query: 'slack', label: 'Slack nodes' }
];
for (const test of searchTests) {
const results = await service.searchNodes({ query: test.query });
console.log(`\n ${test.label}: ${results.length} results`);
results.slice(0, 3).forEach(node => {
console.log(` - ${node.displayName} (${node.nodeType})`);
});
}
// Get final statistics
console.log('\n📊 Final database statistics:');
const stats = service.getStatistics();
console.log(` - Total nodes: ${stats.totalNodes}`);
console.log(` - Nodes with documentation: ${stats.nodesWithDocs}`);
console.log(` - Nodes with examples: ${stats.nodesWithExamples}`);
console.log(` - Trigger nodes: ${stats.triggerNodes}`);
console.log(` - Webhook nodes: ${stats.webhookNodes}`);
console.log('\n✅ All tests completed!');
} catch (error) {
console.error('\n❌ Test failed:', error);
process.exit(1);
} finally {
service.close();
}
}
testCompleteFix().catch(console.error);

View File

@@ -1,38 +0,0 @@
#!/usr/bin/env node
const { EnhancedDocumentationFetcher } = require('../dist/utils/enhanced-documentation-fetcher');
async function debugTest() {
console.log('=== Debug Enhanced Documentation ===\n');
const fetcher = new EnhancedDocumentationFetcher();
try {
await fetcher.ensureDocsRepository();
// Test Slack documentation parsing
console.log('Testing Slack documentation...');
const slackDoc = await fetcher.getEnhancedNodeDocumentation('n8n-nodes-base.slack');
if (slackDoc) {
console.log('\nSlack Documentation:');
console.log('- Operations found:', slackDoc.operations?.length || 0);
// Show raw markdown around operations section
const operationsIndex = slackDoc.markdown.indexOf('## Operations');
if (operationsIndex > -1) {
console.log('\nRaw markdown around Operations section:');
console.log('---');
console.log(slackDoc.markdown.substring(operationsIndex, operationsIndex + 1000));
console.log('---');
}
}
} catch (error) {
console.error('Error:', error);
} finally {
await fetcher.cleanup();
}
}
debugTest().catch(console.error);

View File

@@ -1,57 +0,0 @@
#!/usr/bin/env node
const { DocumentationFetcher } = require('../dist/utils/documentation-fetcher');
const { NodeSourceExtractor } = require('../dist/utils/node-source-extractor');
async function testDocsFix() {
console.log('=== Testing Documentation Fix ===\n');
const docsFetcher = new DocumentationFetcher();
const extractor = new NodeSourceExtractor();
try {
// Test nodes
const testNodes = [
'n8n-nodes-base.slack',
'n8n-nodes-base.if',
'n8n-nodes-base.httpRequest',
'n8n-nodes-base.webhook'
];
for (const nodeType of testNodes) {
console.log(`\n📋 Testing ${nodeType}:`);
// Test documentation fetching
const docs = await docsFetcher.getNodeDocumentation(nodeType);
if (docs) {
console.log(` ✅ Documentation found`);
console.log(` 📄 URL: ${docs.url}`);
const titleMatch = docs.markdown.match(/title:\s*(.+)/);
if (titleMatch) {
console.log(` 📝 Title: ${titleMatch[1]}`);
}
console.log(` 📏 Length: ${docs.markdown.length} characters`);
console.log(` 🔧 Has examples: ${docs.examples && docs.examples.length > 0}`);
} else {
console.log(` ❌ No documentation found`);
}
// Test source extraction
try {
const source = await extractor.extractNodeSource(nodeType);
console.log(` ✅ Source code found at: ${source.location}`);
} catch (error) {
console.log(` ❌ Source extraction failed: ${error.message}`);
}
}
console.log('\n✅ Test completed!');
} catch (error) {
console.error('\n❌ Test failed:', error);
} finally {
await docsFetcher.cleanup();
}
}
testDocsFix().catch(console.error);

View File

@@ -1,156 +0,0 @@
#!/usr/bin/env node
const { EnhancedDocumentationFetcher } = require('../dist/utils/enhanced-documentation-fetcher');
const { EnhancedSQLiteStorageService } = require('../dist/services/enhanced-sqlite-storage-service');
const { NodeSourceExtractor } = require('../dist/utils/node-source-extractor');
async function testEnhancedDocumentation() {
console.log('=== Enhanced Documentation Parser Test ===\n');
const fetcher = new EnhancedDocumentationFetcher();
const extractor = new NodeSourceExtractor();
try {
// Test 1: Parse Slack documentation
console.log('1. Parsing Slack node documentation...');
const slackDoc = await fetcher.getEnhancedNodeDocumentation('n8n-nodes-base.slack');
if (slackDoc) {
console.log('\n✓ Slack Documentation Parsed:');
console.log(` Title: ${slackDoc.title}`);
console.log(` Description: ${slackDoc.description?.substring(0, 100)}...`);
console.log(` URL: ${slackDoc.url}`);
console.log(` Operations: ${slackDoc.operations?.length || 0} found`);
console.log(` API Methods: ${slackDoc.apiMethods?.length || 0} found`);
console.log(` Related Resources: ${slackDoc.relatedResources?.length || 0} found`);
// Show sample operations
if (slackDoc.operations && slackDoc.operations.length > 0) {
console.log('\n Sample Operations (first 10):');
slackDoc.operations.slice(0, 10).forEach((op, i) => {
console.log(` ${i + 1}. ${op.resource}.${op.operation}: ${op.description}`);
});
}
// Show sample API mappings
if (slackDoc.apiMethods && slackDoc.apiMethods.length > 0) {
console.log('\n Sample API Method Mappings (first 5):');
slackDoc.apiMethods.slice(0, 5).forEach((api, i) => {
console.log(` ${i + 1}. ${api.resource}.${api.operation}${api.apiMethod} (${api.apiUrl})`);
});
}
// Show related resources
if (slackDoc.relatedResources && slackDoc.relatedResources.length > 0) {
console.log('\n Related Resources:');
slackDoc.relatedResources.forEach((res, i) => {
console.log(` ${i + 1}. ${res.title} (${res.type}): ${res.url}`);
});
}
}
// Test 2: Parse HTTP Request documentation (if available)
console.log('\n\n2. Parsing HTTP Request node documentation...');
const httpDoc = await fetcher.getEnhancedNodeDocumentation('n8n-nodes-base.httpRequest');
if (httpDoc) {
console.log('\n✓ HTTP Request Documentation Parsed:');
console.log(` Title: ${httpDoc.title}`);
console.log(` Examples: ${httpDoc.examples?.length || 0} found`);
if (httpDoc.examples && httpDoc.examples.length > 0) {
console.log('\n Code Examples:');
httpDoc.examples.forEach((ex, i) => {
console.log(` ${i + 1}. ${ex.title || 'Example'} (${ex.type}): ${ex.code.length} characters`);
});
}
} else {
console.log(' HTTP Request documentation not found');
}
// Test 3: Database storage test with smaller database
console.log('\n\n3. Testing enhanced database storage...');
const storage = new EnhancedSQLiteStorageService('./data/demo-enhanced.db');
try {
// Store Slack node with documentation
const slackNodeInfo = await extractor.extractNodeSource('n8n-nodes-base.slack');
if (slackNodeInfo) {
const storedNode = await storage.storeNodeWithDocumentation(slackNodeInfo);
console.log('\n✓ Slack node stored with documentation:');
console.log(` Node Type: ${storedNode.nodeType}`);
console.log(` Documentation: ${storedNode.documentationTitle || 'No title'}`);
console.log(` Operations stored: ${storedNode.operationCount}`);
console.log(` API methods stored: ${storedNode.apiMethodCount}`);
console.log(` Examples stored: ${storedNode.exampleCount}`);
console.log(` Resources stored: ${storedNode.resourceCount}`);
}
// Store a few more nodes
const nodeTypes = ['n8n-nodes-base.if', 'n8n-nodes-base.webhook'];
for (const nodeType of nodeTypes) {
try {
const nodeInfo = await extractor.extractNodeSource(nodeType);
if (nodeInfo) {
await storage.storeNodeWithDocumentation(nodeInfo);
console.log(` ✓ Stored ${nodeType}`);
}
} catch (e) {
console.log(` ✗ Failed to store ${nodeType}: ${e.message}`);
}
}
// Test search functionality
console.log('\n\n4. Testing enhanced search...');
const searchTests = [
{ query: 'slack', description: 'Search for "slack"' },
{ query: 'message send', description: 'Search for "message send"' },
{ query: 'webhook', description: 'Search for "webhook"' }
];
for (const test of searchTests) {
const results = await storage.searchNodes({ query: test.query });
console.log(`\n ${test.description}: ${results.length} results`);
if (results.length > 0) {
const first = results[0];
console.log(` Top result: ${first.displayName || first.name} (${first.nodeType})`);
if (first.documentationTitle) {
console.log(` Documentation: ${first.documentationTitle}`);
}
}
}
// Get final statistics
console.log('\n\n5. Database Statistics:');
const stats = await storage.getEnhancedStatistics();
console.log(` Total Nodes: ${stats.totalNodes}`);
console.log(` Nodes with Documentation: ${stats.nodesWithDocumentation} (${stats.documentationCoverage}% coverage)`);
console.log(` Total Operations: ${stats.totalOperations}`);
console.log(` Total API Methods: ${stats.totalApiMethods}`);
console.log(` Total Examples: ${stats.totalExamples}`);
console.log(` Total Resources: ${stats.totalResources}`);
if (stats.topDocumentedNodes && stats.topDocumentedNodes.length > 0) {
console.log('\n Best Documented Nodes:');
stats.topDocumentedNodes.forEach((node, i) => {
console.log(` ${i + 1}. ${node.display_name || node.name}: ${node.operation_count} operations, ${node.example_count} examples`);
});
}
} finally {
storage.close();
}
} catch (error) {
console.error('\nError:', error);
} finally {
await fetcher.cleanup();
console.log('\n\n✓ Test completed and cleaned up');
}
}
// Run the test
testEnhancedDocumentation().catch(console.error);

View File

@@ -1,133 +0,0 @@
#!/usr/bin/env node
const { DocumentationFetcher } = require('../dist/utils/documentation-fetcher');
const { NodeSourceExtractor } = require('../dist/utils/node-source-extractor');
const { execSync } = require('child_process');
const path = require('path');
const fs = require('fs');
async function investigateSlackDocs() {
console.log('=== Investigating Slack Node Documentation Issue ===\n');
const docsFetcher = new DocumentationFetcher();
const extractor = new NodeSourceExtractor();
try {
// 1. Ensure docs repo is available
console.log('1⃣ Ensuring documentation repository...');
await docsFetcher.ensureDocsRepository();
// 2. Check what files exist for Slack
console.log('\n2⃣ Searching for Slack documentation files...');
const docsPath = path.join(process.cwd(), 'temp', 'n8n-docs');
try {
const slackFiles = execSync(
`find ${docsPath} -name "*slack*" -type f | grep -v ".git"`,
{ encoding: 'utf-8' }
).trim().split('\n').filter(Boolean);
console.log(`Found ${slackFiles.length} files with "slack" in the name:`);
slackFiles.forEach(file => {
const relPath = path.relative(docsPath, file);
console.log(` - ${relPath}`);
});
// Check content of each file
console.log('\n3⃣ Checking content of Slack-related files...');
for (const file of slackFiles.slice(0, 5)) { // Check first 5 files
if (file.endsWith('.md')) {
const content = fs.readFileSync(file, 'utf-8');
const firstLine = content.split('\n')[0];
const isCredential = content.includes('credential') || content.includes('authentication');
console.log(`\n 📄 ${path.basename(file)}`);
console.log(` First line: ${firstLine}`);
console.log(` Is credential doc: ${isCredential}`);
// Check if it mentions being a node or credential
if (content.includes('# Slack node')) {
console.log(' ✅ This is the Slack NODE documentation!');
console.log(` Path: ${file}`);
} else if (content.includes('# Slack credentials')) {
console.log(' ⚠️ This is the Slack CREDENTIALS documentation');
}
}
}
} catch (error) {
console.log('Error searching for Slack files:', error.message);
}
// 4. Test the getNodeDocumentation method
console.log('\n4⃣ Testing getNodeDocumentation for Slack...');
const slackDocs = await docsFetcher.getNodeDocumentation('n8n-nodes-base.slack');
if (slackDocs) {
console.log(' ✅ Found documentation for Slack node');
console.log(` URL: ${slackDocs.url}`);
console.log(` Content preview: ${slackDocs.markdown.substring(0, 200)}...`);
// Check if it's credential or node docs
const isCredentialDoc = slackDocs.markdown.includes('credential') ||
slackDocs.markdown.includes('authentication') ||
slackDocs.markdown.includes('# Slack credentials');
const isNodeDoc = slackDocs.markdown.includes('# Slack node') ||
slackDocs.markdown.includes('## Properties');
console.log(` Is credential doc: ${isCredentialDoc}`);
console.log(` Is node doc: ${isNodeDoc}`);
} else {
console.log(' ❌ No documentation found for Slack node');
}
// 5. Extract the Slack node source to understand its structure
console.log('\n5⃣ Extracting Slack node source code...');
try {
const slackNode = await extractor.extractNodeSource('n8n-nodes-base.slack');
console.log(' ✅ Successfully extracted Slack node');
console.log(` Location: ${slackNode.location}`);
console.log(` Has credential code: ${!!slackNode.credentialCode}`);
// Parse the node definition
const descMatch = slackNode.sourceCode.match(/description\s*[:=]\s*({[\s\S]*?})\s*[,;]/);
if (descMatch) {
console.log(' Found node description in source');
}
} catch (error) {
console.log(' ❌ Failed to extract Slack node:', error.message);
}
// 6. Check documentation structure
console.log('\n6⃣ Checking n8n-docs repository structure...');
const docStructure = [
'docs/integrations/builtin/app-nodes',
'docs/integrations/builtin/core-nodes',
'docs/integrations/builtin/trigger-nodes',
'docs/integrations/builtin/credentials'
];
for (const dir of docStructure) {
const fullPath = path.join(docsPath, dir);
try {
const files = fs.readdirSync(fullPath);
const slackFile = files.find(f => f.toLowerCase().includes('slack'));
console.log(`\n 📁 ${dir}:`);
if (slackFile) {
console.log(` Found: ${slackFile}`);
} else {
console.log(` No Slack files found`);
}
} catch (error) {
console.log(` Directory doesn't exist`);
}
}
} catch (error) {
console.error('\n❌ Investigation failed:', error);
} finally {
// Cleanup
await docsFetcher.cleanup();
}
}
// Run investigation
investigateSlackDocs().catch(console.error);

View File

@@ -1,119 +0,0 @@
#!/usr/bin/env node
const { NodeDocumentationService } = require('../dist/services/node-documentation-service');
const { NodeSourceExtractor } = require('../dist/utils/node-source-extractor');
const { DocumentationFetcher } = require('../dist/utils/documentation-fetcher');
async function testSlackFix() {
console.log('=== Testing Slack Node Fix ===\n');
const extractor = new NodeSourceExtractor();
const docsFetcher = new DocumentationFetcher();
try {
// Test 1: Node source extraction
console.log('1⃣ Testing Slack node source extraction...');
const slackSource = await extractor.extractNodeSource('n8n-nodes-base.slack');
console.log(` ✅ Source code found at: ${slackSource.location}`);
console.log(` 📏 Source length: ${slackSource.sourceCode.length} bytes`);
// Extract display name from source
const displayNameMatch = slackSource.sourceCode.match(/displayName\s*[:=]\s*['"`]([^'"`]+)['"`]/);
console.log(` 📛 Display name: ${displayNameMatch ? displayNameMatch[1] : 'Not found'}`);
// Test 2: Documentation fetching
console.log('\n2⃣ Testing Slack documentation fetching...');
const slackDocs = await docsFetcher.getNodeDocumentation('n8n-nodes-base.slack');
if (slackDocs) {
console.log(` ✅ Documentation found`);
console.log(` 📄 URL: ${slackDocs.url}`);
// Extract title from markdown
const titleMatch = slackDocs.markdown.match(/title:\s*(.+)/);
console.log(` 📝 Title: ${titleMatch ? titleMatch[1] : 'Not found'}`);
// Check if it's the correct documentation
const isNodeDoc = slackDocs.markdown.includes('Slack node') ||
slackDocs.markdown.includes('node documentation');
const isCredentialDoc = slackDocs.markdown.includes('Slack credentials') &&
!slackDocs.markdown.includes('node documentation');
console.log(` ✅ Is node documentation: ${isNodeDoc}`);
console.log(` ❌ Is credential documentation: ${isCredentialDoc}`);
if (isNodeDoc && !isCredentialDoc) {
console.log('\n🎉 SUCCESS: Slack node documentation is correctly fetched!');
} else {
console.log('\n⚠ WARNING: Documentation may not be correct');
}
// Show first few lines of content
console.log('\n📋 Documentation preview:');
const lines = slackDocs.markdown.split('\n').slice(0, 15);
lines.forEach(line => console.log(` ${line}`));
} else {
console.log(' ❌ No documentation found');
}
// Test 3: Complete node info using NodeDocumentationService
console.log('\n3⃣ Testing complete node info storage...');
const service = new NodeDocumentationService('./data/test-slack-fix.db');
try {
// Parse node definition
const nodeDefinition = {
displayName: displayNameMatch ? displayNameMatch[1] : 'Slack',
description: 'Send messages to Slack channels, users and conversations',
category: 'Communication',
icon: 'file:slack.svg',
version: 2
};
// Store node info
await service.storeNode({
nodeType: 'n8n-nodes-base.slack',
name: 'slack',
displayName: nodeDefinition.displayName,
description: nodeDefinition.description,
category: nodeDefinition.category,
icon: nodeDefinition.icon,
sourceCode: slackSource.sourceCode,
credentialCode: slackSource.credentialCode,
documentation: slackDocs?.markdown,
documentationUrl: slackDocs?.url,
packageName: 'n8n-nodes-base',
version: nodeDefinition.version,
hasCredentials: !!slackSource.credentialCode,
isTrigger: false,
isWebhook: false
});
console.log(' ✅ Node info stored successfully');
// Retrieve and verify
const retrievedNode = await service.getNodeInfo('n8n-nodes-base.slack');
if (retrievedNode) {
console.log(' ✅ Node retrieved successfully');
console.log(` 📛 Display name: ${retrievedNode.displayName}`);
console.log(` 📝 Has documentation: ${!!retrievedNode.documentation}`);
console.log(` 📄 Documentation URL: ${retrievedNode.documentationUrl || 'N/A'}`);
}
service.close();
} catch (error) {
console.error(' ❌ Error with node service:', error.message);
service.close();
}
console.log('\n✅ All tests completed!');
} catch (error) {
console.error('\n❌ Test failed:', error);
} finally {
await docsFetcher.cleanup();
}
}
testSlackFix().catch(console.error);