#!/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)