✅ WordPerfect Production Support: - Comprehensive WordPerfect processor with 5-layer fallback chain - Support for WP 4.2, 5.0-5.1, 6.0+ (.wpd, .wp, .wp5, .wp6) - libwpd integration (wpd2text, wpd2html, wpd2raw) - Binary strings extraction and emergency parsing - Password detection and encoding intelligence - Document structure analysis and integrity checking 🏗️ Infrastructure Enhancements: - Created comprehensive CLAUDE.md development guide - Updated implementation status documentation - Added WordPerfect processor test suite - Enhanced format detection with WP magic signatures - Production-ready with graceful dependency handling 📊 Project Status: - 2/4 core processors complete (dBASE + WordPerfect) - 25+ legacy format detection engine operational - Phase 2 complete: Ready for Lotus 1-2-3 implementation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
123 lines
4.5 KiB
Python
123 lines
4.5 KiB
Python
"""
|
|
Basic test without dependencies to verify core structure.
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
|
|
# Add src to path
|
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'src'))
|
|
|
|
def test_basic_imports():
|
|
"""Test basic imports without external dependencies."""
|
|
print("🏛️ MCP Legacy Files - Basic Structure Test")
|
|
print("=" * 60)
|
|
|
|
try:
|
|
from mcp_legacy_files import __version__
|
|
print(f"✅ Package version: {__version__}")
|
|
except ImportError as e:
|
|
print(f"❌ Version import failed: {e}")
|
|
return False
|
|
|
|
# Test individual components that don't require dependencies
|
|
print("\n📦 Testing core modules...")
|
|
|
|
try:
|
|
# Test format mappings exist
|
|
from mcp_legacy_files.core.detection import LegacyFormatDetector
|
|
detector = LegacyFormatDetector()
|
|
|
|
# Test magic signatures
|
|
if detector.magic_signatures:
|
|
print(f"✅ Magic signatures loaded: {len(detector.magic_signatures)} format families")
|
|
else:
|
|
print("❌ No magic signatures loaded")
|
|
|
|
# Test extension mappings
|
|
if detector.extension_mappings:
|
|
print(f"✅ Extension mappings loaded: {len(detector.extension_mappings)} extensions")
|
|
|
|
# Show some examples
|
|
legacy_extensions = [ext for ext in detector.extension_mappings.keys() if '.db' in ext or '.wp' in ext][:5]
|
|
print(f" Sample legacy extensions: {', '.join(legacy_extensions)}")
|
|
else:
|
|
print("❌ No extension mappings loaded")
|
|
|
|
# Test format database
|
|
if detector.format_database:
|
|
print(f"✅ Format database loaded: {len(detector.format_database)} formats")
|
|
else:
|
|
print("❌ No format database loaded")
|
|
|
|
except ImportError as e:
|
|
print(f"❌ Detection module import failed: {e}")
|
|
return False
|
|
except Exception as e:
|
|
print(f"❌ Detection module error: {e}")
|
|
return False
|
|
|
|
# Test dBASE processor basic structure
|
|
print("\n🔧 Testing dBASE processor...")
|
|
try:
|
|
from mcp_legacy_files.processors.dbase import DBaseProcessor
|
|
processor = DBaseProcessor()
|
|
|
|
if processor.supported_versions:
|
|
print(f"✅ dBASE processor loaded: {len(processor.supported_versions)} versions supported")
|
|
else:
|
|
print("❌ No dBASE versions configured")
|
|
|
|
processing_chain = processor.get_processing_chain()
|
|
if processing_chain:
|
|
print(f"✅ Processing chain: {' → '.join(processing_chain)}")
|
|
else:
|
|
print("❌ No processing chain configured")
|
|
|
|
except ImportError as e:
|
|
print(f"❌ dBASE processor import failed: {e}")
|
|
return False
|
|
except Exception as e:
|
|
print(f"❌ dBASE processor error: {e}")
|
|
return False
|
|
|
|
# Test validation utilities
|
|
print("\n🛡️ Testing utilities...")
|
|
try:
|
|
from mcp_legacy_files.utils.validation import is_legacy_extension, get_safe_filename
|
|
|
|
# Test legacy extension detection
|
|
test_extensions = ['.dbf', '.wpd', '.wk1', '.doc', '.txt']
|
|
legacy_count = sum(1 for ext in test_extensions if is_legacy_extension('test' + ext))
|
|
print(f"✅ Legacy extension detection: {legacy_count}/5 detected as legacy")
|
|
|
|
# Test safe filename generation
|
|
safe_name = get_safe_filename("test file with spaces!@#.dbf")
|
|
if safe_name and safe_name != "test file with spaces!@#.dbf":
|
|
print(f"✅ Safe filename generation: '{safe_name}'")
|
|
else:
|
|
print("❌ Safe filename generation failed")
|
|
|
|
except ImportError as e:
|
|
print(f"❌ Utilities import failed: {e}")
|
|
return False
|
|
except Exception as e:
|
|
print(f"❌ Utilities error: {e}")
|
|
return False
|
|
|
|
print("\n" + "=" * 60)
|
|
print("🏆 Basic structure test completed!")
|
|
print("\n📋 Status Summary:")
|
|
print(" • Core detection engine: ✅ Ready")
|
|
print(" • dBASE processor: ✅ Ready")
|
|
print(" • Format database: ✅ Loaded")
|
|
print(" • Validation utilities: ✅ Working")
|
|
print("\n⚠️ Note: Full functionality requires dependencies:")
|
|
print(" pip install fastmcp structlog aiofiles aiohttp diskcache")
|
|
print(" pip install dbfread simpledbf pandas # For dBASE processing")
|
|
|
|
return True
|
|
|
|
if __name__ == "__main__":
|
|
success = test_basic_imports()
|
|
sys.exit(0 if success else 1) |