How hrushikeshpawar/codemorph works
Project Type and Purpose
• CodeMorph is a modular, CLI-driven toolkit for semi-automated migration of legacy PL/SQL code to Java SpringBoot.
• It has two core functional packages—PL/SQL analysis and dependency graph analysis—plus an orchestration layer and demo/configuration assets.
File-Structure Analysis
• Top-level:
• packages/
├─ plsql_analyzer/ (parsing, extraction, persistence)
└─ dependency_analyzer/ (graph building, analysis, visualization)
• src/codemorph/ (main orchestrator & CLI entrypoint “codemorph”)
• demo/ (sample inputs, configs, and generated artifacts)
• pyproject.toml, README, docs, planning (roadmaps)
• Patterns & layers:
• CLI layer (cli.py, cli_app.py in each package)
• Core services (analysis, builder, orchestration modules)
• Persistence (SQLite DB modules under persistence/)
• Visualization (Graphviz-based exporter)
• Utilities & config loaders
• CI/config: uv.lock, .github, .gitignore, config.toml files.
README Insights
• Two logical subsystems: PL/SQL Analyzer and Dependency Analyzer.
• Orchestrated by codemorph CLI.
• Uses SQLite for metadata, Graphviz/NetworkX for visuals, and LLM integration for future phases.
• Roadmap includes a FastAPI backend and React frontend (future).
a. Main Components
1. CLI Orchestration Layer (src/codemorph/cli_app.py)
2. PL/SQL Analyzer Package
• Parsing Engine (signature, structural, call extractors)
• Persistence (SQLite via database_manager)
• Profiling & change-detection scripts
3. Dependency Analyzer Package
• Graph Constructor & Overload Resolver
• Analysis Engine (cycle detection, reachability, classification)
• Visualization Exporter (Graphviz)
• Persistence (graph storage)
4. Configuration Module (dep_analyzer_config.toml, plsql_analyzer_config.toml)
5. Demo Data & Artifacts (input SQL files, demo DB, graphs)
6. External Services & Libraries
• SQLite
• Graphviz
• LLM API (planned)
7. Future Web Interface
• FastAPI backend
• React frontend
b. Relationships & Interactions
• User invokes codemorph or plsql-analyzer / dependency-analyzer CLI.
• CLI layer loads configuration → calls analysis/orchestration workflows.
• PL/SQL Analyzer reads SQL files → parsing modules → metadata → persists in SQLite.
• Dependency Analyzer reads metadata DB → graph constructor → analysis modules → exports graphs.
• Orchestration layer coordinates cross-package workflows (e.g., run plsql_analyzer then dependency_analyzer).
• Future: orchestration layer will expose REST endpoints via FastAPI and serve React UI.
c. Architectural Patterns & Principles
• Layered Architecture: CLI → Orchestration → Core Services → Persistence → External Libraries
• Separation of Concerns: Parsing vs. Analysis vs. Visualization vs. Storage
• Modular Packaging: Independent installable packages for plsql and dependency analyzers
• Builder Pattern: graph_constructor, overload_resolver
• Workflow/Orchestration Pattern: extraction_workflow, cli_app
d. Key Technologies
• Python 3.12+, Pydantic for settings, Loguru for logging
• SQLite for metadata persistence
• NetworkX & Graphviz for graph modeling & rendering
• TOML config files
• uv/pip for package management
Essential Elements
• Clear component names (e.g., plsql_analyzer.core, dependency_analyzer.builder)