Skip to main content

AI-powered GitHub repo analyzer CLI โ€” analyze, chat, and visualize any codebase. Run 'gitputra info' to see all commands and features.

Project description

๐Ÿ” GitPutra

GitPutra Logo

PyPI Version Python Versions Downloads License AI Providers

โ—ˆ 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)
visualize 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 report
  • diagram_full.html โ€” Interactive full call graph
  • diagram_crossmodule.html โ€” Cross-module call graph
  • diagram_modules.html โ€” Module dependency graph
  • mermaid_<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:

  1. Open the .md file
  2. Paste it into any AI chat
  3. Say: "Here is my codebase context. Read it and help me continue."

visualize โ€” 3D Code Galaxy

Generates an interactive 3D visualization of your repo's architecture, explorable in the browser.

# Remote repo
gitputra visualize https://github.com/user/repo

# Local codebase
gitputra visualize ./my-project

# Easter egg: visualize GitPutra's own RAG pipeline
gitputra visualize --self-map

# Custom output directory
gitputra visualize ./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-text regardless of the --ollama-model you pass โ€” only the chat/analysis model is overridden. Make sure nomic-embed-text is pulled: ollama pull nomic-embed-text.

Fallback: If Ollama is unreachable (server not running), GitPutra will automatically fall back to Gemini using the API_KEY from 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 ast module 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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitputra-0.3.1.tar.gz (529.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitputra-0.3.1-py3-none-any.whl (524.8 kB view details)

Uploaded Python 3

File details

Details for the file gitputra-0.3.1.tar.gz.

File metadata

  • Download URL: gitputra-0.3.1.tar.gz
  • Upload date:
  • Size: 529.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for gitputra-0.3.1.tar.gz
Algorithm Hash digest
SHA256 96d0da263c0d3be01992b922c38e4e6b30eb135b92298f0ad75bf66941ce6056
MD5 c67109daae23ad0bb5386bc5aeea99c0
BLAKE2b-256 3c5054d385370414fd11dd777156668a0c6b2fcd745d9832f925d714e62505f6

See more details on using hashes here.

File details

Details for the file gitputra-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: gitputra-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 524.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for gitputra-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eac8a5ac28af92b1a9acfd1fff0c50bb45acba6e57279e629eda9a8344d20355
MD5 89d1454238090b8e14c306292bd6023a
BLAKE2b-256 9a2ba1d4c6c8fe9bffdfd2eb54269344331c0210d546eda95735b512ab47b80b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page