Extract IR from source code for cross-language conversion
Extract an Intermediate Representation (IR) from source code to enable cross-language conversion and analysis.
/codebase-analysis <path> [--language <lang>] [--depth <0-4>] [--output <format>]
| Parameter | Description | Default |
|---|---|---|
path | File or directory to analyze | Required |
--language | Source language (auto-detected if omitted) | auto |
--depth | IR extraction depth (0-4) | 4 |
--output | Output format (json, yaml, summary) | json |
If --language is not specified, detect based on:
.py, .rs, .ts, .go, .scala, .roc)pyproject.toml, Cargo.toml, package.json)Identify all modules and their relationships:
Extract type definitions and relationships:
Extract function signatures and semantics:
Infer semantic properties:
Mark concepts that may not convert cleanly:
The IR is organized into 5 layers of increasing abstraction:
| Layer | Name | Description |
|---|---|---|
| 0 | Expressions | AST-level expression nodes |
| 1 | Data Flow | Value flow through variables |
| 2 | Control Flow | Execution paths and branches |
| 3 | Type System | Type definitions and relationships |
| 4 | Module Structure | Imports, exports, dependencies |