From e8413af7013066b4bf19a2788ff0f529714768d7 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Sun, 1 Feb 2026 19:30:59 +0000 Subject: [PATCH] Initial upload: Git AI Documentation Generator v0.1.0 --- README.md | 187 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 185 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 99097f1..0c81d33 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,186 @@ -# git-ai-doc-generator +# Git AI Documentation Generator -A privacy-focused CLI tool that analyzes git diffs and generates intelligent commit messages, changelogs, and API documentation using local AI models via Ollama. \ No newline at end of file +A privacy-focused CLI tool that analyzes git diffs and generates intelligent commit messages, changelogs, and API documentation using local AI models via Ollama. + +## Features + +- **Commit Message Generation**: Generate conventional commit messages from staged or all changes +- **Changelog Generation**: Auto-generate changelogs from git commit history between tags/commits +- **API Documentation**: Generate OpenAPI-style documentation from code changes +- **Privacy-Focused**: All processing happens locally using Ollama - no data sent to external APIs +- **Multi-Language Support**: Supports Python, JavaScript, TypeScript, Go, Rust, and Java +- **Framework Detection**: Automatically detects FastAPI, Flask, Express, and Django patterns + +## Installation + +```bash +# Install from source +pip install -e . + +# Or install with dev dependencies +pip install -e ".[dev]" +``` + +## Prerequisites + +- Python 3.9+ +- [Ollama](https://ollama.ai/) installed and running locally +- A model pulled (e.g., `ollama pull llama3.2`) + +## Usage + +### Generate Commit Messages + +Generate a commit message from staged changes: + +```bash +git add . +git-ai-doc commit +``` + +Generate from all changes (including unstaged): + +```bash +git-ai-doc commit --all +``` + +With language context for better results: + +```bash +git-ai-doc commit --language python +``` + +### Generate Changelogs + +Generate a changelog from commits since a tag: + +```bash +git-ai-doc changelog --from v1.0.0 +``` + +Generate between two versions: + +```bash +git-ai-doc changelog --from v1.0.0 --to v2.0.0 +``` + +### Generate API Documentation + +Generate API documentation from changes: + +```bash +git-ai-doc api-docs --all +``` + +With framework hint: + +```bash +git-ai-doc api-docs --all --framework fastapi +``` + +## Commands + +### commit + +Generate a commit message from git changes. + +Options: +- `--staged/--all`: Use staged changes (default) or all changes +- `--language, -l`: Programming language context +- `--model, -m`: Ollama model to use + +### changelog + +Generate a changelog from git commit history. + +Options: +- `--from, -f`: Starting reference (tag, commit, branch) +- `--to, -t`: Ending reference (default: HEAD) +- `--limit, -l`: Maximum commits to process (default: 100) +- `--format`: Output format (markdown, json) + +### api-docs + +Generate API documentation from code changes. + +Options: +- `--staged/--all`: Use staged changes or all changes +- `--ref`: Git reference to compare against +- `--framework`: Force framework detection + +## Configuration + +### Environment Variables + +| Variable | Description | Default | +|----------|-------------|---------| +| `OLLAMA_HOST` | Ollama server URL | `http://localhost:11434` | +| `OLLAMA_MODEL` | Default model | `llama3.2` | +| `DEBUG` | Enable verbose logging | `false` | + +### Configuration File + +Create a `.ai-doc-gen.yaml` in your project root: + +```yaml +ollama_host: http://localhost:11434 +model: llama3.2 +debug: false +``` + +Or in your home directory: +- `~/.ai-doc-gen.yaml` +- `~/.git-ai-doc.yaml` + +### CLI Options + +Override config at runtime: + +```bash +git-ai-doc commit --model codellama --ollama-host http://custom:11434 +``` + +## Supported Languages + +- Python (`.py`) +- JavaScript (`.js`) +- TypeScript (`.ts`) +- Go (`.go`) +- Rust (`.rs`) +- Java (`.java`) +- C/C++ (`.c`, `.cpp`, `.h`) + +## Development + +```bash +# Install development dependencies +pip install -e ".[dev]" + +# Run tests +pytest tests/ -v + +# Run with coverage +pytest tests/ --cov=src --cov-report=term-missing + +# Lint code +ruff check src/ tests/ +``` + +## Architecture + +``` +src/ +├── cli.py # Main CLI entry point +├── config.py # Configuration management +├── git_utils.py # Git operations using GitPython +├── ollama_client.py # Ollama LLM integration +├── output.py # Rich console output formatting +└── commands/ + ├── commit.py # Commit message generation + ├── changelog.py # Changelog generation + └── api_docs.py # API documentation generation +``` + +## License + +MIT