LostMind Analyzer Pro (LAP)
An advanced tool designed to streamline project understanding through automated code analysis and AI-powered documentation generation.
The Problem
Developers and teams often face challenges in:
- Quickly grasping the structure and complexity of large or unfamiliar codebases.
- Keeping project documentation up-to-date and consistent with the code.
- Manually generating comprehensive reports on code metrics and project health.
- Efficiently onboarding new team members to existing projects.
- Leveraging insights from code analysis to drive refactoring and improve quality.
These challenges lead to increased development time, potential for technical debt, and inconsistencies in project understanding.
The Solution
LostMind Analyzer Pro (LAP) tackles these issues by offering:
- Advanced Code Analysis: Performs static analysis to extract key metrics, understand dependencies, and identify structural patterns.
- AI-Driven Documentation: Utilizes AI models from multiple providers (OpenAI, Anthropic, Gemini) to automatically generate relevant project documentation based on the codebase.
- Interactive Analysis: Provides tools for interactively exploring code analysis results.
- Comprehensive Metrics: Generates detailed reports on various code and project metrics.
- Multiple Export Formats: Allows analysis results and documentation to be exported in various useful formats.
Project Overview
LAP serves as an intelligent assistant for software development teams, automating the laborious tasks of analysis and documentation. By integrating sophisticated code parsing with the power of leading AI language models, it aims to significantly boost productivity and improve code quality.
Key Features
- Advanced project structure and code analysis
- AI-powered documentation generation
- Support for OpenAI, Anthropic, and Google Gemini models
- Interactive code analysis capabilities
- Comprehensive metrics generation (complexity, dependencies, etc.)
- Export results in multiple formats
Learning Journey
Building LAP involves learning about:
- Static Code Analysis: Parsing code (using ast or similar), understanding abstract syntax trees, and calculating metrics (e.g., complexity).
- AI for Code Understanding: Prompting large language models (Gemini, Claude, OpenAI) to generate documentation, explain code snippets, or suggest improvements based on analyzed code.
- Integrating Analysis & AI: Designing workflows where code analysis results feed into AI prompts for contextual documentation generation.
- Multi-API Management: Handling different API interfaces and authentication for various AI providers.
- GUI Development (PyQt6): Creating an interface to manage analysis settings, display results, and interact with the generated documentation.
Project Structure (In Development)
The application architecture implements a modular design with distinct components:
- src/
- main_app.py: Application entry point with PyQt6 interface
- analyzer/
- code_parser.py: Parses code into an understandable format (AST)
- metrics_calculator.py: Calculates various code metrics
- project_scanner.py: Scans project directories
- ai/
- client_manager.py: Handles connections to different AI APIs
- doc_generator.py: Constructs prompts and generates documentation
- ui/
- main_window.py: Main application window
- display_widgets.py: Widgets to show analysis results
- utils/: Helper functions
- config/: Settings for analysis rules, API keys, prompt templates
- tests/: Tests for analysis modules and AI interactions
Application Workflow
┌─────────────────────┐ ┌─────────────────────┐ ┌────────────────────┐
│ │ │ │ │ │
│ Project Input │ │ Analysis Engine │ │ AI Services │
│ │ │ │ │ │
└─────────┬───────────┘ └─────────┬───────────┘ └──────────┬─────────┘
│ │ │
│ │ │
▼ │ │
┌─────────────────────┐ │ │
│ Source Code Files │ │ │
│ or Project Directory│ │ │
└─────────┬───────────┘ │ │
│ │ │
│ │ │
▼ ▼ │
┌─────────────────────┐ ┌─────────────────────┐ │
│ │ │ │ │
│ Project Scanner │────▶│ Code Parser (AST) │ │
│ │ │ │ │
└─────────────────────┘ └─────────┬───────────┘ │
│ │
│ │
▼ │
┌─────────────────────┐ │
│ │ │
│ Metrics Calculator │ │
│ │ │
└─────────┬───────────┘ │
│ │
│ │
┌──────────────────────────┬┴┬──────────────────────────┐│
│ │ │ ││
▼ ▼ │ ▼│
┌─────────────────────┐ ┌─────────▼───────────┐ ┌────────────────────┐
│ │ │ │ │ │
│ Analysis Results │ │ AI Client Manager │────▶│ OpenAI/Anthropic/ │
│ and Visualization │ │ │◀────│ Gemini Integration │
│ │ │ │ │ │
└─────────────────────┘ └─────────┬───────────┘ └────────────────────┘
│
│
▼
┌─────────────────────┐
│ │
│ Documentation │
│ Generator │
│ │
└─────────┬───────────┘
│
│
▼
┌─────────────────────┐
│ │
│ Export Results │
│ (Multiple Formats) │
│ │
└─────────────────────┘
Key Libraries/APIs
- Python ast module: For parsing Python code into Abstract Syntax Trees. Documentation
- PyQt6: GUI framework. Documentation
- Google Vertex AI SDK (Python): For Gemini models. Documentation
- OpenAI API Client (Python): For GPT models. Documentation
- Anthropic API Client (Python): For Claude models. Documentation
- Potentially static analysis libraries like radon or pylint (or custom logic).
Technical Implementation
The tool is built primarily in Python, interfacing with various code analysis libraries and multiple AI provider APIs. Configuration allows users to select preferred AI models and customize analysis parameters.
# Conceptual example - core execution flow
# (Actual implementation likely more complex)
import analysis_engine
import ai_doc_generator
import config_loader
def run_analyzer(project_path):
config = config_loader.load_config()
# Perform code analysis
metrics, structure = analysis_engine.analyze(project_path, config)
analysis_engine.export_results(metrics, structure, config.export_format)
print("Analysis complete. Results exported.")
def run_doc_generator(project_path):
config = config_loader.load_config()
ai_provider = config.get_ai_provider()
# Generate documentation using AI
documentation = ai_doc_generator.generate(project_path, ai_provider, config)
ai_doc_generator.save_documentation(documentation, config.doc_format)
print("AI Documentation generation complete.")
# Example usage from main script:
# if mode == 'analyze':
# run_analyzer(args.path)
# elif mode == 'document':
# run_doc_generator(args.path)
Current Status
LAP is currently under development, with core analysis and AI integration functionalities being refined. Refer to the project repository for the latest updates.