| import gradio as gr |
|
|
| INSTALL_CMD = "npm install -g git-commit-at" |
| NPM_URL = "https://www.npmjs.com/package/git-commit-at" |
| GITHUB_URL = "https://github.com/bhargavirengarajan21/git-commit-at" |
| DEMO_URL = "#" |
|
|
| ABOUT_MD = """ |
| # git commit-at |
| |
| **AI-powered git commit message generator** β local, private, no API key needed. |
| |
| `git commit-at` analyzes your staged changes and suggests 3 conventional commit messages |
| using a locally-running AI model (Ollama). Pick one, customize it, and commit β all from |
| the terminal. |
| |
| --- |
| |
| ## Why git commit-at? |
| |
| | | git commit-at | Manual commits | Cloud AI tools | |
| |---|---|---|---| |
| | **Private** | β
100% local | β
| β sends code to cloud | |
| | **No API key** | β
| β
| β requires subscription | |
| | **Conventional commits** | β
auto | β manual discipline | β οΈ sometimes | |
| | **Branch visualizer** | β
built-in | β | β | |
| | **Commit history** | β
tracked | β | β | |
| |
| --- |
| |
| ## Install |
| |
| ```bash |
| npm install -g git commit-at |
| ``` |
| |
| Requires: **Docker** (all AI/backend services run in containers β no extra setup). |
| |
| --- |
| |
| ## How to use |
| |
| ```bash |
| # 1. Stage your changes |
| git add . |
| |
| # 2. Run the tool |
| git commit-at |
| |
| # 3. First time: register/login at http://localhost:7860 |
| # 4. Pick a suggested commit message |
| # 5. Confirm β done! |
| ``` |
| |
| On first run, Docker starts Ollama, Redis, and the Gradio UI automatically. |
| |
| --- |
| |
| ## Features |
| |
| - π€ **3 AI suggestions** per run, tailored to your actual diff |
| - π **Conventional commits** β `feat:`, `fix:`, `refactor:`, `chore:`, etc. |
| - π« **Ticket integration** β prefix messages with JIRA/Linear ticket numbers |
| - πΏ **Branch visualizer** β live git branch DAG in the web UI |
| - π **Commit history** β track everything you've committed across repos |
| - π **Session persistence** β stay logged in between runs |
| - π³ **Zero local dependencies** β everything runs in Docker |
| |
| --- |
| |
| ## Numbers |
| |
| *(TBH β to be updated with real metrics)* |
| |
| | Metric | Value | |
| |--------|-------| |
| | Average suggestion time | ~5β10 s | |
| | First-run setup time | ~30 s | |
| | AI model size | ~1 GB (qwen2.5-coder:1.5b) | |
| | Runs entirely offline after setup | β
| |
| |
| --- |
| |
| ## Links |
| |
| - π¦ **npm**: [{npm}]({npm}) |
| - π» **GitHub**: [{gh}]({gh}) |
| - π¬ **Demo**: [Coming soon]({demo}) |
| """.format(npm=NPM_URL, gh=GITHUB_URL, demo=DEMO_URL) |
|
|
| QUICKSTART_MD = """ |
| ## Quick Start |
| |
| ```bash |
| # Install |
| npm install -g git commit-at |
| |
| # Go to any git repo |
| cd your-project |
| git add . |
| |
| # Generate commit message |
| git commit-at |
| ``` |
| |
| The first run starts all Docker services and opens the login UI at `http://localhost:7860`. |
| After login, you'll see 3 commit message suggestions based on your staged diff. |
| """ |
|
|
| HOW_IT_WORKS_MD = """ |
| ## How it works |
| |
| ``` |
| git commit-at (CLI) |
| β |
| βββ Checks Docker services |
| β βββ Ollama (AI model, port 11434) |
| β βββ Redis (session + cache, port 6379) |
| β βββ Gradio (web UI, port 7860) |
| β |
| βββ Waits for login at http://localhost:7860 |
| β |
| βββ Runs commit flow |
| βββ Reads git diff of staged files |
| βββ Sends diff to Ollama (qwen2.5-coder:1.5b) |
| βββ Streams 3 commit suggestions |
| βββ Prompts: ticket number? format? |
| βββ You pick a message |
| βββ git commit -m "..." |
| ``` |
| """ |
|
|
| with gr.Blocks(title="git commit-at") as demo: |
| with gr.Row(): |
| with gr.Column(scale=2): |
| gr.Markdown(ABOUT_MD) |
| with gr.Column(scale=1): |
| gr.Markdown("## Install now") |
| gr.Code(value=INSTALL_CMD, language="shell", label="npm") |
| gr.Markdown(f"[View on npm]({NPM_URL}) Β· [GitHub]({GITHUB_URL})") |
| gr.Markdown("---") |
| gr.Markdown(QUICKSTART_MD) |
|
|
| with gr.Row(): |
| gr.Markdown(HOW_IT_WORKS_MD) |
|
|
| if __name__ == "__main__": |
| demo.launch() |
|
|