AI-powered GitHub repo analyzer CLI โ analyze, chat, and visualize any codebase. Run 'gitputra info' to see all commands and features.
Project description
๐ GitPutra
โ Analyze โ Visualize โ Synthesize โ
Clone any repo, generate a structured analysis report, visualize architecture,
export codebase context for any AI tool, and chat with your codebase โ all from the terminal.
Turn any repository or local codebase into AI memory.
โจ Features
๐ See Beyond the Code โ Turn any repository into a fully mapped system โ architecture, patterns, flaws, and opportunities laid bare.
๐ง Export the Brain of Your Project โ Switched AI tools? Export the full project context โ function inventory, module dependency graph, and function-level call graph โ into a single Markdown file, ready to paste into any AI chat.
๐ฌ Talk to Your Codebase โ Ask anything. Get answers grounded in context, not guesses, powered by RAG and semantic search.
๐พ Chat Sessions โ Save and resume conversations. Your chat history persists across sessions so you can pick up exactly where you left off.
๐ 3D Code Galaxy โ Explore your repo as an interactive 3D architecture map in the browser. Each file is a node; call relationships are edges.
๐ AI-Powered Diff โ Compare any two branches or commits and get an AI-written summary of what changed and why it matters.
๐ฟ Git Timeline โ Visualize the branch history of any local or remote repo right in the terminal.
๐ค Choose Your Intelligence โ Switch effortlessly between Google Gemini, OpenAI, or a locally running Ollama model โ no cloud required.
๐ Rich Diagrams โ Interactive HTML call graphs (full, cross-module, module-level) powered by pyvis, plus Mermaid diagrams in multiple types โ all saved to output/.
โข๏ธ Nuclear Reset โ One command to rule them all. Wipe your vector database, all session history, and file hashes to start from a clean slate.
๐พ Robust Session Management โ Save, list, show, and resume conversations. Resume a session and GitPutra will intelligently re-index only the files that changed while you were away.
๐ Multilingual PDF Reports โ Export analysis as a styled PDF in ~110 languages.
๐ Offline Context Export โ No API key required. The functionality graph, call map, and file tree are built entirely offline using Tree-sitter AST parsing.
๐๏ธ Smart Indexing โ Skips re-embedding if a repo is already indexed. Run clear-db to reset.
๐ 50+ File Types โ From Python to Rust, configs to notebooks โ your entire stack, decoded.
๐ฆ Installation
pip install gitputra
Requires Python 3.10+
๐บ๏ธ Commands at a Glance
gitputra info
| Command | Description |
|---|---|
info |
Show all commands, AI providers, languages, and extensions |
analyze |
Clone & analyze a repo, generate report + diagrams |
chat |
RAG-powered interactive chat with a codebase |
export-context |
Export portable .md context file (offline by default) |
architecture |
Generate an interactive 3D Code Galaxy |
diff |
Compare two branches/commits with optional AI summary |
show-graph |
Render git branch timeline in the terminal |
session |
Manage sessions: --list, resume, --show, or --delete |
clear-db |
Wipe the local ChromaDB index |
nuke |
โข๏ธ Wipe everything: DB, Sessions, and Hashes |
๐ Usage
analyze โ Analyze a Repository
Clones (or reads) a repo, embeds it, runs an AI analysis, and saves a PDF report + interactive diagrams.
# Remote repo
gitputra analyze https://github.com/user/repo --ai gemini --key YOUR_API_KEY
# Local codebase
gitputra analyze ./my-project --ai gemini
# Analyze without AI (diagrams only, no report)
gitputra analyze https://github.com/user/repo
# Specific branch, different language, skip PDF
gitputra analyze https://github.com/user/repo --branch dev --ai openai --lang Bangla --no-pdf
# Custom output directory
gitputra analyze ./my-project --ai gemini --output-dir ./results
# With a local Ollama model
gitputra analyze ./my-project --ai ollama --ollama-model llama3
Outputs saved to ./output/ (or --output-dir):
report.pdfโ Full AI analysis reportdiagram_full.htmlโ Interactive full call graphdiagram_crossmodule.htmlโ Cross-module call graphdiagram_modules.htmlโ Module dependency graphmermaid_<type>.txtโ Mermaid diagram source (graph, flowchart, architecture, sequence, class)
chat โ Chat with a Repository
Interactive RAG chat grounded in your codebase. Reuses existing index if analyze was already run.
# Remote repo
gitputra chat https://github.com/user/repo --ai gemini --key YOUR_API_KEY
# Local codebase
gitputra chat ./my-project --ai gemini
# Specific branch
gitputra chat https://github.com/user/repo --branch feature/my-branch --ai gemini
# Save session on exit
gitputra chat ./my-project --ai gemini --save-session mysession
# Resume a saved session
gitputra chat ./my-project --ai gemini --load-session mysession
# With a local Ollama model
gitputra chat ./my-project --ai ollama --ollama-model mistral
๐ฌ Chat mode [repo] โ ask anything about the codebase. Type 'exit' to quit.
>> What does main.py do?
>> How is authentication handled?
>> exit
In-chat commands:
| Command | Action |
|---|---|
exit / quit / q |
Exit chat (prompts to save session) |
!switch |
Reload API_KEY from .env (quota reset, history preserved) |
!save |
Snapshot the session immediately without exiting |
export-context โ Export Codebase Context
Exports your entire codebase as a single Markdown file to paste into any AI tool (ChatGPT, Gemini, Claudeโฆ) without re-explaining the project. Fully offline by default.
The export includes:
- File tree of the project
- Tech stack detection (languages, infra, package files)
- Function inventory โ all functions extracted per module
- Module dependency graph โ Mermaid + plain-text fallback
- Function-level call graph โ cross-module calls + full call map
- Per-file summaries โ AI-generated (with
--use-ai) or function-list stats (offline) - Source snapshot โ truncated source for each file
# Current directory, fully offline
gitputra export-context
# Specific local path
gitputra export-context ./my-project
# With AI summaries
gitputra export-context ./my-project --use-ai --ai gemini --key YOUR_API_KEY
# With a local Ollama model
gitputra export-context ./my-project --use-ai --ai ollama --ollama-model llama3
# Remote repo (auto-detected from URL)
gitputra export-context https://github.com/user/repo --remote --ai gemini
# Remote repo, specific branch, with AI summaries
gitputra export-context https://github.com/user/repo --remote --branch dev --use-ai --ai gemini
# Path with spaces โ wrap in quotes
gitputra export-context "C:\Users\you\My Project"
Output saved to ./output/context_<project_name>_<timestamp>.md
How to use:
- Open the
.mdfile - Paste it into any AI chat
- Say: "Here is my codebase context. Read it and help me continue."
architecture โ 3D Code Galaxy
Generates an interactive 3D visualization of your repo's architecture, explorable in the browser.
# Remote repo
gitputra architecture https://github.com/user/repo
# Local codebase
gitputra architecture ./my-project
# Easter egg: visualize GitPutra's own RAG pipeline
gitputra architecture --self-map
# Custom output directory
gitputra architecture ./my-project --output-dir ./results
diff โ Compare Branches or Commits
Shows changed files between any two refs, with an optional AI-written summary saved as PDF.
# Last commit vs its parent (local repo)
gitputra diff .
# Compare branches with AI summary
gitputra diff https://github.com/user/repo --base main --head dev --ai gemini --key YOUR_API_KEY
# Local repo, specific commits
gitputra diff ./my-project --base abc1234 --head def5678 --ai openai
# Skip PDF output
gitputra diff . --base main --head dev --ai gemini --no-pdf
# With a local Ollama model
gitputra diff ./my-project --base main --head dev --ai ollama --ollama-model phi3:mini
show-graph โ Git Branch Timeline
Renders the git commit/branch graph in the terminal.
# Current directory
gitputra show-graph
# Local repo
gitputra show-graph ./my-project
# Remote repo (clones first)
gitputra show-graph https://github.com/user/repo
# Limit commits shown per branch
gitputra show-graph ./my-project --max-commits 50
๐พ Session Management
Manage your navigation logs with the new session suite:
# List all sessions with repo paths and turn counts
gitputra session --list
# Show the chat history of a specific session
gitputra session mysession --show
# Resume a session (auto-detects local codebase and syncs changes)
gitputra session mysession resume
# Delete a specific session
gitputra session --delete mysession
#Use --all for a clean sweep
gitputra session --delete --all
Other Commands
# Wipe the local ChromaDB index (forces full re-index on next run)
gitputra clear-db
# Check version
gitputra --version
# Show all info
gitputra info
#delete the DB & chats to start from start
gitputra nuke
๐ค AI Providers
| Flag | Provider | Text Model | Embedding Model |
|---|---|---|---|
--ai gemini |
Google Gemini | gemini-2.5-flash | gemini-embedding-001 |
--ai openai |
OpenAI | gpt-4o-mini | text-embedding-3-large |
--ai ollama |
Ollama (local) | --ollama-model user_selected (default phi3:mini) |
nomic-embed-text |
Setting Up Your API Key
Option 1 โ .env file (recommended):
API_KEY=your_api_key_here
Option 2 โ Secure interactive prompt: If no key is provided, GitPutra will prompt you at runtime โ keeping your key out of shell history.
Option 3 โ CLI flag:
gitputra analyze https://github.com/user/repo --key YOUR_API_KEY
Avoid Option 3 in shared environments โ CLI flags appear in shell history.
๐ฆ Using Ollama (Local, No API Key Required)
Ollama lets you run models entirely on your own machine โ no internet, no API key, no cost.
1. Install Ollama: ollama.com
2. Pull a model:
ollama pull llama3
ollama pull mistral
ollama pull phi3:mini # default if --ollama-model is omitted
ollama pull codellama
3. Run GitPutra with Ollama:
gitputra chat ./my-project --ai ollama --ollama-model llama3
gitputra analyze ./my-project --ai ollama --ollama-model mistral
Note: Embeddings always use
nomic-embed-textregardless of the--ollama-modelyou pass โ only the chat/analysis model is overridden. Make surenomic-embed-textis pulled:ollama pull nomic-embed-text.
Fallback: If Ollama is unreachable (server not running), GitPutra will automatically fall back to Gemini using the
API_KEYfrom your.env.
๐งฌ Call Graph Extraction (Tree-sitter AST)
The functionality graph and context export use a shared call_extractor module powered by Tree-sitter for precise AST-based extraction.
| Method | Languages |
|---|---|
| Tree-sitter (AST) | Python, JavaScript, TypeScript, JSX, TSX, C, C++ (.cc, .cxx), Go, Rust, Java |
| Regex fallback | Ruby, PHP, Swift, Kotlin, Scala, Lua, C#, Groovy, Perl, Shell/Bash |
For Python, the stdlib
astmodule is used for maximum accuracy, with Tree-sitter as fallback on syntax errors.
๐ Supported Languages (PDF Output)
GitPutra can generate PDF reports in ~110 languages across 3 scripts:
Latin Script (~100 languages) English, French, Spanish, Portuguese, Italian, German, Dutch, Swedish, Norwegian, Danish, Finnish, Polish, Czech, Slovak, Hungarian, Romanian, Croatian, Serbian (Latin), Slovenian, Albanian, Lithuanian, Latvian, Estonian, Turkish, Azerbaijani, Uzbek, Kazakh (Latin), Turkmen, Indonesian, Malay, Filipino, Swahili, Zulu, Xhosa, Afrikaans, Yoruba, Igbo, Hausa, Somali, Kinyarwanda, Welsh, Irish, Basque, Catalan, Galician, Maltese, Icelandic, Faroese, Vietnamese, Hawaiian, Maori, Tok Pisin, Tswana, Shona, Sesotho, and more.
Bangla Script: Bangla, Assamese
Devanagari Script: Hindi, Marathi, Nepali, Sanskrit, Maithili, Konkani, Bodo, Dogri
gitputra analyze https://github.com/user/repo --ai gemini --lang Bangla
AI response language depends on the chosen model's capability.
๐ Supported File Extensions (50+ types)
| Category | Extensions |
|---|---|
| Python | .py, .ipynb |
| C/C++ | .c, .h, .cpp |
| Web | .js, .ts, .jsx, .tsx, .html, .css, .vue |
| JVM | .java, .kt, .kts, .scala, .groovy, .clj, .cljs |
| Systems | .go, .rs, .swift, .dart |
| Scripting | .sh, .bat, .ps1, .pl, .lua, .r, .m, .rb, .php, .coffee, .elm |
| Config | .json, .yaml, .yml, .xml, .toml, .ini, .cfg, .conf, .gradle, .makefile |
| Docs | .md, .txt, .log, .sql, .pdf |
| Special | Dockerfile, Makefile |
๐จโ๐ป Author
Adityava Gangopadhyay
- ๐ง Email: adityava49cse@gmail.com
- ๐ LinkedIn: adityava-gangopadhyay
- ๐ฆ PyPI: pypi.org/project/gitputra
Feel free to reach out for any suggestions or issues!
AI is ARTIFICIALLY Intelligent โ YOU are NATURALLY WISE. Use the tool, but keep track of the correctness of the results it produces.
THANK YOU
๐ License
MIT License โ free to use, modify, and distribute.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitputra-0.3.0.tar.gz.
File metadata
- Download URL: gitputra-0.3.0.tar.gz
- Upload date:
- Size: 529.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9c34d80897eb4201c9dc0d91a7fa2a613fb5358f2deeaeaa5fad3f962676769
|
|
| MD5 |
19b972f2096f3923c66a1a992562c140
|
|
| BLAKE2b-256 |
cdf7ffa81e1573400866f69a95a3dd91c7c922b61a640e6717755e5c59c84ce7
|
File details
Details for the file gitputra-0.3.0-py3-none-any.whl.
File metadata
- Download URL: gitputra-0.3.0-py3-none-any.whl
- Upload date:
- Size: 524.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
291b20fe0dd860be84887e10b713434fe1a3478e4458db549bf0235935729930
|
|
| MD5 |
3da03bfbbd43b35368b5c7b79125ebc4
|
|
| BLAKE2b-256 |
bfd6fc228b65c19e637407836c977afb4f38b9457e8d78178dd0ee805ee5f3eb
|