build-small-hackathon/git-commit-app
3
1import gradio as gr2 3INSTALL_CMD = "npm install -g git-commit-at"4NPM_URL = "https://www.npmjs.com/package/git-commit-at"5GITHUB_URL = "https://github.com/bhargavirengarajan21/git-commit-at"6DEMO_URL = "#" # TBH7 8ABOUT_MD = """9# git commit-at10 11**AI-powered git commit message generator** — local, private, no API key needed.12 13`git commit-at` analyzes your staged changes and suggests 3 conventional commit messages14using a locally-running AI model (Ollama). Pick one, customize it, and commit — all from15the terminal.16 17---18 19## Why git commit-at?20 21| | git commit-at | Manual commits | Cloud AI tools |22|---|---|---|---|23| **Private** | ✅ 100% local | ✅ | ❌ sends code to cloud |24| **No API key** | ✅ | ✅ | ❌ requires subscription |25| **Conventional commits** | ✅ auto | ❌ manual discipline | ⚠️ sometimes |26| **Branch visualizer** | ✅ built-in | ❌ | ❌ |27| **Commit history** | ✅ tracked | ❌ | ❌ |28 29---30 31## Install32 33```bash34npm install -g git commit-at35```36 37Requires: **Docker** (all AI/backend services run in containers — no extra setup).38 39---40 41## How to use42 43```bash44# 1. Stage your changes45git add .46 47# 2. Run the tool48git commit-at49 50# 3. First time: register/login at http://localhost:786051# 4. Pick a suggested commit message52# 5. Confirm — done!53```54 55On first run, Docker starts Ollama, Redis, and the Gradio UI automatically.56 57---58 59## Features60 61- 🤖 **3 AI suggestions** per run, tailored to your actual diff62- 📋 **Conventional commits** — `feat:`, `fix:`, `refactor:`, `chore:`, etc.63- 🎫 **Ticket integration** — prefix messages with JIRA/Linear ticket numbers64- 🌿 **Branch visualizer** — live git branch DAG in the web UI65- 📊 **Commit history** — track everything you've committed across repos66- 🔐 **Session persistence** — stay logged in between runs67- 🐳 **Zero local dependencies** — everything runs in Docker68 69---70 71## Numbers72 73*(TBH — to be updated with real metrics)*74 75| Metric | Value |76|--------|-------|77| Average suggestion time | ~5–10 s |78| First-run setup time | ~30 s |79| AI model size | ~1 GB (qwen2.5-coder:1.5b) |80| Runs entirely offline after setup | ✅ |81 82---83 84## Links85 86- 📦 **npm**: [{npm}]({npm})87- 💻 **GitHub**: [{gh}]({gh})88- 🎬 **Demo**: [Coming soon]({demo})89""".format(npm=NPM_URL, gh=GITHUB_URL, demo=DEMO_URL)90 91QUICKSTART_MD = """92## Quick Start93 94```bash95# Install96npm install -g git commit-at97 98# Go to any git repo99cd your-project100git add .101 102# Generate commit message103git commit-at104```105 106The first run starts all Docker services and opens the login UI at `http://localhost:7860`.107After login, you'll see 3 commit message suggestions based on your staged diff.108"""109 110HOW_IT_WORKS_MD = """111## How it works112 113```114git commit-at (CLI)115 │116 ├── Checks Docker services117 │ ├── Ollama (AI model, port 11434)118 │ ├── Redis (session + cache, port 6379)119 │ └── Gradio (web UI, port 7860)120 │121 ├── Waits for login at http://localhost:7860122 │123 └── Runs commit flow124 ├── Reads git diff of staged files125 ├── Sends diff to Ollama (qwen2.5-coder:1.5b)126 ├── Streams 3 commit suggestions127 ├── Prompts: ticket number? format?128 ├── You pick a message129 └── git commit -m "..."130```131"""132 133with gr.Blocks(title="git commit-at") as demo:134 with gr.Row():135 with gr.Column(scale=2):136 gr.Markdown(ABOUT_MD)137 with gr.Column(scale=1):138 gr.Markdown("## Install now")139 gr.Code(value=INSTALL_CMD, language="shell", label="npm")140 gr.Markdown(f"[View on npm]({NPM_URL}) · [GitHub]({GITHUB_URL})")141 gr.Markdown("---")142 gr.Markdown(QUICKSTART_MD)143 144 with gr.Row():145 gr.Markdown(HOW_IT_WORKS_MD)146 147if __name__ == "__main__":148 demo.launch()149 