Files
claudetools/tests/test_import_preview.py
Mike Swanson 06f7617718 feat: Major directory reorganization and cleanup
Reorganized project structure for better maintainability and reduced
disk usage by 95.9% (11 GB -> 451 MB).

Directory Reorganization (85% reduction in root files):
- Created docs/ with subdirectories (deployment, testing, database, etc.)
- Created infrastructure/vpn-configs/ for VPN scripts
- Moved 90+ files from root to organized locations
- Archived obsolete documentation (context system, offline mode, zombie debugging)
- Moved all test files to tests/ directory
- Root directory: 119 files -> 18 files

Disk Cleanup (10.55 GB recovered):
- Deleted Rust build artifacts: 9.6 GB (target/ directories)
- Deleted Python virtual environments: 161 MB (venv/ directories)
- Deleted Python cache: 50 KB (__pycache__/)

New Structure:
- docs/ - All documentation organized by category
- docs/archives/ - Obsolete but preserved documentation
- infrastructure/ - VPN configs and SSH setup
- tests/ - All test files consolidated
- logs/ - Ready for future logs

Benefits:
- Cleaner root directory (18 vs 119 files)
- Logical organization of documentation
- 95.9% disk space reduction
- Faster navigation and discovery
- Better portability (build artifacts excluded)

Build artifacts can be regenerated:
- Rust: cargo build --release (5-15 min per project)
- Python: pip install -r requirements.txt (2-3 min)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-18 20:42:28 -07:00

89 lines
3.2 KiB
Python

#!/usr/bin/env python3
"""
Quick preview of what would be imported from Claude projects folder
No API or auth required - just scans and shows what it finds
"""
import sys
from pathlib import Path
# Add api directory to path
sys.path.insert(0, str(Path(__file__).parent))
from api.utils.conversation_parser import scan_folder_for_conversations, categorize_conversation, parse_jsonl_conversation
from api.utils.credential_scanner import scan_for_credential_files
def preview_import(folder_path: str):
"""Preview what would be imported from the given folder"""
print("=" * 70)
print("CLAUDE CONTEXT IMPORT PREVIEW")
print("=" * 70)
print(f"\nScanning: {folder_path}\n")
# Scan for conversation files
print("\n[1] Scanning for conversation files...")
try:
conversation_files = scan_folder_for_conversations(folder_path)
print(f" Found {len(conversation_files)} conversation file(s)")
# Categorize each file
categories = {"msp": 0, "development": 0, "general": 0}
for i, file_path in enumerate(conversation_files[:20]): # Limit to first 20
try:
conv = parse_jsonl_conversation(file_path)
category = categorize_conversation(conv.get("messages", []))
categories[category] += 1
# Show first 5
if i < 5:
rel_path = Path(file_path).relative_to(folder_path)
print(f" [{category.upper()}] {rel_path}")
except Exception as e:
print(f" [ERROR] Failed to parse: {Path(file_path).name} - {e}")
if len(conversation_files) > 20:
print(f" ... and {len(conversation_files) - 20} more files")
print(f"\n Category Breakdown:")
print(f" MSP Work: {categories['msp']} files")
print(f" Development: {categories['development']} files")
print(f" General: {categories['general']} files")
except Exception as e:
print(f" Error scanning conversations: {e}")
# Scan for credential files
print("\n[2] Scanning for credential files...")
try:
credential_files = scan_for_credential_files(folder_path)
print(f" Found {len(credential_files)} credential file(s)")
for i, file_path in enumerate(credential_files[:10]): # Limit to first 10
rel_path = Path(file_path).relative_to(folder_path)
print(f" {i+1}. {rel_path}")
if len(credential_files) > 10:
print(f" ... and {len(credential_files) - 10} more files")
except Exception as e:
print(f" Error scanning credentials: {e}")
print("\n" + "=" * 70)
print("PREVIEW COMPLETE")
print("=" * 70)
print("\nTo actually import:")
print(" 1. Ensure API is running: python -m api.main")
print(" 2. Setup auth: bash scripts/setup-context-recall.sh")
print(" 3. Run import: python scripts/import-claude-context.py --folder \"path\" --execute")
print("\n")
if __name__ == "__main__":
if len(sys.argv) > 1:
folder = sys.argv[1]
else:
folder = r"C:\Users\MikeSwanson\claude-projects"
preview_import(folder)