diff --git a/README.md b/README.md index d082db7..ed9fa52 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,14 @@ # gai -**AI-powered git commit message generator** +**AI-powered Git commit and pull request helper** -[![Version](https://img.shields.io/badge/version-0.1.0-blue.svg)](https://github.com/mplan/git-ai) +[![Release](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgit.catpl.top%2Fapi%2Fv1%2Frepos%2FMplan%2Fgai%2Freleases%2Flatest&query=%24.tag_name&label=release&color=blue)](https://git.catpl.top/Mplan/gai/releases) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE) [![Bun](https://img.shields.io/badge/runtime-Bun-f9d71c.svg)](https://bun.sh) [![TypeScript](https://img.shields.io/badge/lang-TypeScript-3178c6.svg)](https://www.typescriptlang.org/) -Generate **Conventional Commits** messages using AI — based on your project context, code diff, and commit history. +Generate **Conventional Commits** messages and pull request descriptions using AI, based on your project context, code diff, branch changes, and commit history. @@ -18,13 +18,14 @@ Generate **Conventional Commits** messages using AI — based on your project co ## Features - **Interactive menu** — `gai` opens a menu, select actions with ↑/↓ + space/enter -- **3-layer context** — project overview, staged diff, and recent commit history +- **Context-aware commits** — reads project overview, staged diff, and recent commit history - **Conventional Commits** — `feat(scope): description` format by default - **Interactive file selection** — ↑/↓ to navigate, space to select, top-level "Select all" - **Inline editing** — edit AI-generated messages right in the terminal with cursor movement -- **OpenAI-compatible API** — works with DeepSeek, OpenAI, Ollama, and more +- **AI-generated PRs** — create GitHub or Gitea pull requests with generated title and body +- **OpenAI-compatible API** — works with DeepSeek, OpenAI, Ollama, OpenRouter, and more - **Review before commit** — confirm, edit, or abort the generated message -- **Zero dependencies** — built entirely on Bun native APIs +- **Bun-native runtime** — built on Bun APIs with no runtime npm dependencies ## Quick Start @@ -40,6 +41,9 @@ gai # Or directly generate a commit message gai commit + +# Or create an AI-generated pull request +gai pr ``` ## Usage @@ -49,6 +53,8 @@ gai Open interactive menu gai commit Generate commit message (interactive file selection) gai commit --auto Auto-stage all changed files gai commit -d Generate message without committing +gai pr Create a PR with AI-generated title and body +gai pr --draft Create a draft PR gai config Configure API settings gai --help Show help gai --version Show version @@ -96,6 +102,21 @@ $ gai commit 1 file changed, 45 insertions(+), 12 deletions(-) ``` +### Pull Request Flow + +`gai pr` detects the remote platform from `origin`: + +- GitHub remotes use the `gh` CLI +- Gitea remotes use the `tea` CLI +- Unknown remotes prompt you to choose a platform + +The command compares your current branch against the default branch, pushes the branch if needed, generates a PR title/body from the branch commits and diff, then asks for confirmation before creating the PR. + +```bash +gai pr +gai pr --draft +``` + ## Configuration ### Via `gai config` (interactive) @@ -110,7 +131,7 @@ gai config |---|---|---| | `GAI_API_KEY` | — | **Required.** Your API key | | `GAI_API_BASE` | `https://api.deepseek.com/v1` | API base URL | -| `GAI_MODEL` | `deepseek-chat` | Model name | +| `GAI_MODEL` | `deepseek-v4-flash` | Model name | | `GAI_MAX_TOKENS` | `500` | Max response tokens | | `GAI_TEMPERATURE` | `0.7` | Sampling temperature | @@ -121,7 +142,7 @@ Bun auto-loads `.env` — no dotenv needed: ```bash GAI_API_KEY=sk-your-key GAI_API_BASE=https://api.deepseek.com/v1 -GAI_MODEL=deepseek-chat +GAI_MODEL=deepseek-v4-flash ``` ### Using other providers @@ -170,14 +191,16 @@ GAI_MODEL=anthropic/claude-sonnet-4 │ └─ Directory structure │ │ │ │ 2. Collect code changes │ -│ └─ git diff --staged │ +│ ├─ git diff --staged for commits │ +│ └─ branch diff for pull requests │ │ │ │ 3. Collect commit history │ -│ └─ git log --oneline -10 │ +│ ├─ git log --oneline -10 for commits │ +│ └─ branch commits for pull requests │ │ │ │ 4. Build prompt → Call AI API │ │ │ -│ 5. Review → Confirm → Commit │ +│ 5. Review → Confirm → Commit or Create PR │ └─────────────────────────────────────────────┘ ```