Insight is an AI-native codebase analysis and exploration tool designed to help developers quickly understand unknown repositories, inspect code architecture, gather static metrics, and generate AI-powered walkthroughs.
- System Requirements
- Installation
- API Key Setup & Configuration
- CLI Command Reference
- Understanding Generated Reports
- Ignoring Files with
.insightignore - Troubleshooting & FAQs
- Operating System: macOS (Intel & Apple Silicon), Linux (Ubuntu, Debian, Fedora, Arch, etc.), or Windows (10/11)
- Python: Python 3.9, 3.10, 3.11, 3.12, or 3.13
- Network: Internet connectivity to communicate with the Google Generative AI API (when generating AI summaries)
To install the latest stable version of Insight CLI directly from the Python Package Index:
pip install insight-cli-sarangVerify that the installation was successful:
insight-cli --versionIf you wish to run the bleeding-edge version or contribute to Insight:
-
Clone the repository:
git clone https://github.com/ferrix-lab/Insight-Py.git cd Insight-Py -
Create a virtual environment:
python3 -m venv venv
-
Activate the virtual environment:
- macOS / Linux:
source venv/bin/activate - Windows (PowerShell):
venv\Scripts\Activate.ps1
- Windows (Command Prompt):
venv\Scripts\activate.bat
- macOS / Linux:
-
Install dependencies and register editable package:
pip install --upgrade pip pip install -r requirements.txt pip install -e .
Insight uses Google's Generative AI models (Gemini) to generate natural-language file explanations and evaluate code patterns.
- Navigate to Google AI Studio.
- Sign in with your Google account.
- Click Create API key and copy the generated key string.
Set the environment variable in your terminal session before executing Insight. Both GOOGLE_API_KEY and GEMINI_API_KEY are supported.
export GOOGLE_API_KEY="AIzaSyYourActualKeyHere"set -x GOOGLE_API_KEY "AIzaSyYourActualKeyHere"$env:GOOGLE_API_KEY="AIzaSyYourActualKeyHere"set GOOGLE_API_KEY=AIzaSyYourActualKeyHereIf you do not want to export your API key every time you open a new terminal:
-
macOS (Zsh - default): Add the following line to
~/.zshrc:echo 'export GOOGLE_API_KEY="your_api_key_here"' >> ~/.zshrc source ~/.zshrc
-
Linux (Bash): Add the following line to
~/.bashrc:echo 'export GOOGLE_API_KEY="your_api_key_here"' >> ~/.bashrc source ~/.bashrc
-
Windows: Run in PowerShell or CMD (sets user environment variable):
[System.Environment]::SetEnvironmentVariable('GOOGLE_API_KEY', 'your_api_key_here', [System.EnvironmentVariableTarget]::User)
Both insight and insight-cli aliases are available when installed:
insight [OPTIONS] <PATH>
# or
insight-cli [OPTIONS] <PATH>| Flag | Long Flag | Description | Default |
|---|---|---|---|
<PATH> |
Path to the target file or codebase directory | Required | |
-o |
--output |
Directory where generated reports will be stored | report |
--limit |
Maximum number of source files to process | None (all) |
|
-h |
--help |
Display command help and exit | |
-v |
--version |
Display the installed version and exit |
insight .insight /path/to/my-projectinsight . -o ./docs/audit_reportsinsight . --limit 5insight src/app.py -o ./single_reportWhen an analysis run completes, Insight generates the target output directory containing:
report/
├── summary.md # Global repository summary and file index
├── app.py.md # Detailed report for app.py
├── utils.py.md # Detailed report for utils.py
└── ...
Provides high-level repository statistics:
- Total number of files scanned
- Total lines of source code
- Full index table with links to individual markdown reports
Each .md report contains:
- File Metadata: File path, extension, and total line count.
- Code Metrics: Total functions, classes, comments, and external/internal imports.
- AI-Powered Explanation: Comprehensive natural-language summary explaining the primary purpose, key functions, and business logic.
- Code Preview: A syntax-highlighted snapshot of the file's initial lines.
To exclude specific files or directories from being scanned (such as build artifacts, cache folders, or data dumps), create a .insightignore file in the root of your analyzed directory.
Insight automatically skips the following directories:
venv/,node_modules/,__pycache__/,.git/,dist/,build/
# Ignore documentation and tests
docs/
tests/
# Ignore custom build outputs
bin/
out/
tmp/
# Ignore private data files
secrets/Cause: The CLI cannot locate a valid API key in your current shell environment.
Fix: Verify that GOOGLE_API_KEY or GEMINI_API_KEY is exported in the exact terminal session you are running the command from:
echo $GOOGLE_API_KEY # macOS / Linux
echo $env:GOOGLE_API_KEY # Windows PowerShellCause: PowerShell's default script execution policy prevents running venv\Scripts\Activate.ps1.
Fix: Open PowerShell as Administrator and run:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserCause: Gemini API free-tier quotas allow up to 15 RPM (requests per minute). Running Insight over large repositories in one go can trigger rate limits.
Fix: Use the --limit flag to analyze codebases in batches (e.g. insight . --limit 10).
Answer: Static analysis support without an API key is planned for an upcoming release (Issue #30). Currently, an API key is required to perform code analysis.