{"id":28252380,"url":"https://github.com/keli-wen/gitai-cli","last_synced_at":"2026-04-16T18:03:12.335Z","repository":{"id":293490451,"uuid":"984183334","full_name":"keli-wen/gitai-cli","owner":"keli-wen","description":"Smart CLI for AI-driven Git commit \u0026 PR generation.","archived":false,"fork":false,"pushed_at":"2025-05-17T12:04:50.000Z","size":4501,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T00:38:38.974Z","etag":null,"topics":["cli","effi","git","git-ai","llm","nodejs","prompt-engineering"],"latest_commit_sha":null,"homepage":"https://gitai-cli-web.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keli-wen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-15T14:21:37.000Z","updated_at":"2025-06-18T05:58:00.000Z","dependencies_parsed_at":"2025-05-15T16:43:04.832Z","dependency_job_id":null,"html_url":"https://github.com/keli-wen/gitai-cli","commit_stats":null,"previous_names":["keli-wen/gitai-cli"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/keli-wen/gitai-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keli-wen%2Fgitai-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keli-wen%2Fgitai-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keli-wen%2Fgitai-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keli-wen%2Fgitai-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keli-wen","download_url":"https://codeload.github.com/keli-wen/gitai-cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keli-wen%2Fgitai-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31897870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T17:33:00.867Z","status":"ssl_error","status_checked_at":"2026-04-16T17:32:57.401Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","effi","git","git-ai","llm","nodejs","prompt-engineering"],"created_at":"2025-05-19T16:15:36.480Z","updated_at":"2026-04-16T18:03:12.330Z","avatar_url":"https://github.com/keli-wen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eGitAI CLI\u003c/h1\u003e\n\u003cp align=\"center\"\u003eSmart CLI for AI-driven Git commit \u0026 PR generation.\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003ccode\u003enpm i -g @lastwhisper-dev/gitai-cli\u003c/code\u003e\u003c/p\u003e\n\n![demo1](./assets/gitai-cli-example-1.gif)\n\n\u003cvideo src=\"https://github.com/user-attachments/assets/35c83493-1705-4ee0-b2f2-33ab9486ae0b\" width=\"320\" height=\"240\" controls\u003e\n\u003c/video\u003e\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA vibe-coding project. ✨\n\n![excalidraw-animate](./assets/gitai-cli-outline-new.png)\n\n\u003e [!Note]\n\u003e\n\u003e **GitAI CLI is your intelligent Git assistant, supercharging your workflow with AI-powered command generation. Craft perfect commit messages and pull request descriptions in seconds!**\n\n\u003e [!Tip]\n\u003e\n\u003e For Chinese version, please refer to [中文文档](./README_CN.md)\n\n## ✨ Why GitAI CLI?\n\nTired of spending precious time crafting the perfect commit messages or pull request descriptions? GitAI CLI leverages the power of Large Language Models (LLMs) to automate these tasks, directly from your terminal.\n\n- **One command, zero context-switch** – `gitai commit` and `gitai pr` read your diff / file-tree / branch info and craft Conventional-Commit messages or full PR drafts automatically.  \n- **Customizable Prompts**: Unlike GitHub Copilot's more rigid suggestions, GitAI CLI allows you to define your own prompt templates (**global or project-level**). We provide defaults based on the widely adopted [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/), ensuring your commit history is clean, explicit, and machine-readable.\n- **Seamless Integration**: Forget manually copying and pasting. Compared to tools like Cursor's command+k, GitAI CLI integrates directly into your Git workflow. Generate and (optionally) apply suggestions with a single command.\n- **Multi-Provider Support (including Local LLM)**: Configure GitAI to use OpenAI, Gemini, Grok, DeepSeek, Ollama, or other compatible LLM providers. With Ollama, you can run entirely local models for maximum privacy and offline capability.\n\n## 🚀 Quick start\n\n### Install from npm\n\n```bash\n# 1. Install (latest Node 18+ required)\nnpm i -g @lastwhisper-dev/gitai-cli               # OR: pnpm add -g @lastwhisper-dev/gitai-cli\n\n# 2. Bootstrap a repo\ncd ~/my-project\ngitai init                       # creates .gitai/ with default config \u0026 .env-example\n\n# 3. Add your keys  ➜  copy .env-example \u003e .env  and fill the blanks\ncp .env-example .env\n\n# 4. Use show-config to verify your config\ngitai show-config\n\n# 5. Create some changes, stage them, then…\ngit add .\ngitai commit -n 3                # returns 3 commit-message suggestions\n\n# 6. Open a feature branch, then…\ngitai pr -t main                 # writes .gitai/pr_docs/\u003cts\u003e-feature.md\n```\n\n\u003e [!Tip]\n\u003e\n\u003e If you have permission issues, try:\n\u003e\n\u003e ```bash\n\u003e # For macOS \u0026 Linux\n\u003e sudo npm i -g @lastwhisper-dev/gitai-cli\n\u003e # For Windows, use PowerShell/CMD in admin mode\n\u003e ```\n\u003e\n\u003e If you have network issues, try:\n\u003e\n\u003e ```bash\n\u003e npm config set registry https://registry.npmmirror.com\n\u003e ```\n\n### Install from source\n\n```bash\ngit clone https://github.com/keli-wen/gitai-cli.git\ncd gitai-cli\nnpm run build \u0026\u0026 npm link        # global symlink for development\n```\n\nNow you can use `gitai` commands anywhere on your system.\n\n### Configuration\n\n1. **Set up API Keys (Environment Variables):**\n\n   GitAI CLI needs API keys for the LLM providers you intend to use. Create a `.env` file in your project root or set these globally in your shell environment. See `.env-example` for a template (created by `gitai init`):\n\n   ```env\n   OPENAI_API_KEY=\"Your OpenAI API Key\"\n   OPENAI_BASE_URL=https://api.openai.com/v1\n\n   DEEPSEEK_API_KEY=\"Your DeepSeek API Key\"\n   DEEPSEEK_BASE_URL=https://api.deepseek.com\n\n   GEMINI_API_KEY=\"Your Gemini API Key\"\n   GEMINI_BASE_URL=https://generativelanguage.googleapis.com\n\n   GROK_API_KEY=\"Your Grok API Key\"\n   GROK_BASE_URL=https://api.x.ai/v1\n\n   OLLAMA_BASE_URL=\"Your Ollama Base URL\"\n\n   # If you want to use a proxy, you can set the following environment variables\n   # HTTPS_PROXY=\"Your Proxy URL\" # or HTTP_PROXY, ALL_PROXY\n   ```\n\n   If you want to use `gitai` in any project easily, you can set the environment variables in your shell profile (e.g. `.zshrc` or `.bashrc`):\n\n   ```bash\n   # In your .zshrc or .bashrc\n   export OPENAI_API_KEY=\"Your OpenAI API Key\"\n   export OPENAI_BASE_URL=\"https://api.openai.com/v1\"\n   ```\n\n2. **Initialize GitAI Configuration:**\n\n   Navigate to your Git project's root directory and run:\n\n   ```bash\n   gitai init\n   ```\n\n   This creates a `.gitai/config.yaml` file with default settings. You can customize:\n\n   - Default LLM provider and model.\n   - Specific providers/models for `commit` and `pr` commands.\n   - Prompt template paths.\n   - Behavior for `gitai commit / gitai pr` (e.g., base branch, file tree inclusion).\n\n   Example `config.yaml` snippet:\n\n   ```yaml\n   llm:\n       default:\n           provider: openai\n           model: gpt-4o-mini\n           apiKeyEnvVar: 'OPENAI_API_KEY'\n           baseUrlEnvVar: 'OPENAI_BASE_URL'\n           temperature: 0.7\n       commands:\n           commit:\n               # provider: deepseek # Example: Override for commit\n               # model: deepseek-chat\n               # apiKeyEnvVar: 'DEEPSEEK_API_KEY'\n   # ... other configurations\n   ```\n\n   You can also initialize from the global config (`~/.gitai/config.yaml`) or with default templates:\n\n   ```bash\n   gitai init --from-global\n   gitai init --from-default --force # Overwrites existing local config\n   ```\n\n## Features\n\n- **`gitai commit`**:\n  - Automatically generates commit messages based on your staged changes.\n  - Provides multiple suggestions for you to choose from.\n  - Adheres to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format by default.\n  - Allows custom prompts for tailored message styles.\n- **`gitai pr`**:\n  - Generates comprehensive Pull Request titles and descriptions.\n  - Analyzes differences between your current branch and a target branch.\n  - Can include a snapshot of the project's file tree for better context.\n- **Flexible Configuration**:\n  - Project-level (`./.gitai/config.yaml`) or global (`~/.gitai/config.yaml`) settings.\n  - Easily switch LLM providers (OpenAI, DeepSeek, Ollama) and models.\n  - Customize temperature, API keys (via environment variables), and base URLs.\n- **Print Prompt Option**: See the exact prompt sent to the AI for debugging or using with **web-based AI interfaces** (`--print-prompt`).\n\n## 💡 Usage\n\n![gitai-help](./assets/gitai-cli-help.png)\n\nThe general command structure is:\n\n```bash\ngitai [command] [options]\n```\n\n### Global Options\n\n- `-v, --verbose`: Enable verbose logging.\n- `-q, --quiet`: Suppress non-error logs.\n\n### `init`\n\nInitialize GitAI CLI configuration in your project.\n\n```bash\ngitai init [options]\n```\n\n**Options:**\n\n- `-f, --force`: Overwrite existing configuration if it exists.\n- `--from-global`: Use configuration from your home directory (`~/.gitai`).\n- `--from-default`: Use default template configuration.\n\n**Example:**\n\n```bash\ngitai init --force\n```\n\n### `commit`\n\nGenerate AI-powered commit messages for staged changes.\n\n```bash\ngitai commit [options]\n```\n\n**Options:**\n\n- `-p, --prompt \u003cmessage\u003e`: Additional instructions to guide the AI.\n- `-n, --suggestions \u003cnumber\u003e`: Number of suggestions to generate (overrides config).\n- `--print-prompt`: Print the AI prompt instead of calling the model.\n\n**Examples:**\n\n```bash\n# Generate commit messages for staged files\ngitai commit\n\n# Provide extra context to the AI\ngitai commit -p \"Focus on the refactoring of the user service\"\n\n# Get 5 suggestions\ngitai commit -n 5\n\n# Copy the prompt to clipboard (macOS example) for use with a web AI\ngitai commit --print-prompt | pbcopy\n```\n\n### `pr`\n\nGenerate a Pull Request title \u0026 body from the current branch diff.\n\n```bash\ngitai pr [options]\n```\n\n**Options:**\n\n- `-p, --prompt \u003ctext\u003e`: Additional instructions to guide the AI.\n- `-t, --target \u003cbranch\u003e`: Target branch to diff against (defaults to `main` or as per config).\n- `-u, --unstaged`: Include unstaged changes in the diff.\n- `--no-tree`: Exclude file tree snapshot from the AI context.\n- `--print-prompt`: Print the AI prompt instead of calling the model.\n\n**Examples:**\n\n```bash\n# Generate PR description for current branch against default target\ngitai pr\n\n# Specify a target branch\ngitai pr --target develop\n\n# Add a custom instruction for the PR description\ngitai pr -p \"This PR also addresses a minor UI glitch in the login form.\"\n\n# Include unstaged changes and copy the prompt (macOS example)\ngitai pr -u --print-prompt | pbcopy\n```\n\n### `show-config`\n\nShow resolved config path and content.\n\n```bash\ngitai show-config [options]\n```\n\n**Options:**\n\n- `-p, --path-only`: Print current config path only.\n\n**Examples:**\n\n```bash\n# Display the full resolved configuration\ngitai show-config\n\n# Show only the path to the active configuration file\ngitai show-config --path-only\n```\n\n## Future Features\n\nI constantly thinking of ways to make GitAI CLI even more powerful. Here are some ideas on my radar:\n\n### `gitai query`\n\n```bash\ngitai query --prompt \"xxx\"\n```\n\nEnable direct queries to the AI about your Git repository. The system prompt will automatically include contextual information like:\n\n- All local and remote branches.\n\n- Current branch name.\n\n- Recent Git log (last 10 commits).\n\n- Current `git status`.\n\nThis allows for natural language questions like *What were the last few features merged into main?* or *Summarize changes on the feature/xyz branch.*\n\n### `gitai context`\n\nExport project information (diff, file tree, etc.) as **AI-friendly context** in Markdown or JSON format. This command would make it easy to gather relevant information for manual use with **external AI models** or for debugging.\nKey context to include:\n\n1. Current `git diff` (staged, working directory, or between specified commits).\n2. Project file structure (filterable by depth, size, extension).\n3. Potentially: `package.json` dependencies, current branch name, recent commit history.\n\n## 🤝 Contributing\n\nContributions are welcome and greatly appreciated! Whether it's bug reports, feature suggestions, or code contributions, every bit helps.\n\n**Quick Development Setup:**\n\n1. Fork → `git clone` → `npm i`\n2. Follow **Conventional Commits** for every PR.\n3. `npm run lint \u0026\u0026 npm test` must stay green.\n4. Use `npm link` to test the CLI globally during development.\n5. Open a PR.\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeli-wen%2Fgitai-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeli-wen%2Fgitai-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeli-wen%2Fgitai-cli/lists"}