{"id":30044637,"url":"https://github.com/bernabedev/gai-cli","last_synced_at":"2025-10-12T03:16:41.853Z","repository":{"id":307340636,"uuid":"1029266778","full_name":"bernabedev/gai-cli","owner":"bernabedev","description":"An AI-powered CLI to generate conventional commit messages using Google Gemini.","archived":false,"fork":false,"pushed_at":"2025-09-12T19:41:55.000Z","size":21,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-14T23:27:38.195Z","etag":null,"topics":["ai","automation","cli","commit","conventional-commits","gemini","git"],"latest_commit_sha":null,"homepage":"https://gai-cli.vercel.app","language":"JavaScript","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/bernabedev.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-30T19:19:00.000Z","updated_at":"2025-09-12T19:41:58.000Z","dependencies_parsed_at":"2025-07-30T20:12:10.457Z","dependency_job_id":"217862f2-6f09-419b-8eee-a5df16f6a68a","html_url":"https://github.com/bernabedev/gai-cli","commit_stats":null,"previous_names":["bernabedev/gai-cli"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bernabedev/gai-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernabedev%2Fgai-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernabedev%2Fgai-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernabedev%2Fgai-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernabedev%2Fgai-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bernabedev","download_url":"https://codeload.github.com/bernabedev/gai-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernabedev%2Fgai-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010176,"owners_count":26084691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["ai","automation","cli","commit","conventional-commits","gemini","git"],"created_at":"2025-08-07T06:43:44.939Z","updated_at":"2025-10-12T03:16:41.848Z","avatar_url":"https://github.com/bernabedev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gai - AI-Powered Git Commits\n\n[![NPM Version](https://img.shields.io/npm/v/gai-cli.svg)](https://www.npmjs.com/package/gai-cli)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n[![Built with: TypeScript](https://img.shields.io/badge/Built%20with-TypeScript-blue.svg?logo=typescript\u0026logoColor=white)](https://www.typescriptlang.org/)\n\nSay goodbye to tedious commit messages. `gai` is a command-line interface (CLI) that leverages AI to automatically generate clear, concise, and conventional commit messages from your staged changes.\n\n## Features\n\n-   **Intelligent Commit Generation**: Analyzes your code changes (`git diff`) and writes a high-quality commit message.\n-   **Zero Configuration Required**: Works out-of-the-box by using a public backend. No API key needed to get started.\n-   **API-Key Optional**: You can optionally provide your own Google Gemini API key for private, direct API access.\n-   **Conventional Commits Compliant**: Generated messages follow the [Conventional Commits](https://www.conventionalcommits.org/) specification.\n-   **Seamless Git Workflow**: Integrates directly with your Git workflow, supporting staging, amending, and more.\n-   **Safe \u0026 Transparent**: Use `--dry-run` to preview the commit and `--verbose` for detailed output.\n\n## Prerequisites\n\nBefore you begin, ensure you have the following installed:\n-   [Node.js](https://nodejs.org/) (v18 or later)\n-   [Git](https://git-scm.com/)\n\n## Installation\n\nInstall `gai` globally on your system using `npm`. This will make the `gai` command available in any terminal session.\n\n```bash\nnpm install -g gai-cli\n```\n\nOnce installed, you can run `gai` from any Git repository on your system.\n\n## Usage\n\nUsing `gai` is simple. Navigate to your Git repository, stage some files, and run the command.\n\n### Basic Usage\n\n1.  Stage the files you want to commit:\n    ```bash\n    git add src/index.ts package.json\n    ```\n\n2.  Run `gai` to generate and create the commit:\n    ```bash\n    gai\n    ```\n\nThis will analyze the staged changes, generate a commit message, display it for you, and then execute the `git commit` command.\n## Optional Configuration: Using Your Own API Key\n\n`gai` is designed to work without any configuration. By default, it uses a shared public backend to generate commit messages, making it accessible to everyone immediately.\n\nHowever, if you prefer to use your own Google Gemini API key for privacy, to bypass potential rate limits on the public endpoint, or to have direct control over the AI model, you can optionally provide it by setting the `GEMINI_API_KEY` environment variable.\n\nIf you wish to use your own key, follow these steps:\n\n1.  **Get an API Key**: Visit [Google AI Studio](https://aistudio.google.com/app/apikey) to create your free API key.\n\n2.  **Set the Environment Variable**: You need to export the API key as an environment variable named `GEMINI_API_KEY`.\n\n    ```bash\n    export GEMINI_API_KEY=\"YOUR_API_KEY_HERE\"\n    ```\n\n3.  **(Recommended) Make it Permanent**: To avoid running the `export` command in every new terminal session, add it to your shell's configuration file (e.g., `.zshrc`, `.bashrc`, or `.profile`):\n\n    ```bash\n    # For Zsh users\n    echo 'export GEMINI_API_KEY=\"YOUR_API_KEY_HERE\"' \u003e\u003e ~/.zshrc\n\n    # For Bash users\n    echo 'export GEMINI_API_KEY=\"YOUR_API_KEY_HERE\"' \u003e\u003e ~/.bashrc\n\n    # Then, reload your shell to apply the changes\n    source ~/.zshrc\n    # or\n    source ~/.bashrc\n    ```\n\n### Options\n\n| Option                  | Alias | Description                                                        | Default   |\n| ----------------------- | ----- | ------------------------------------------------------------------ | --------- |\n| `--help`                | `-h`  | Display the help menu.                                             |           |\n| `--version`             | `-V`  | Display the version of the application.                            |           |\n| `--all`                 | `-a`  | Stage all tracked and untracked changes before committing (`git add -A`). | `false`   |\n| `--amend`               | `-A`  | Amend the previous commit instead of creating a new one.           | `false`   |\n| `--dry-run`             | `-n`  | Show the generated commit message and command without executing it. | `false`   |\n| `--message \u003cmessage\u003e`   | `-m`  | Provide a custom commit message and skip the AI generation.        |           |\n| `--type \u003ctype\u003e`         | `-t`  | Force a specific Conventional Commit type (e.g., `feat`, `fix`).   |           |\n| `--scope \u003cscope\u003e`       | `-s`  | Specify a scope for the commit (e.g., `api`, `auth`).              |           |\n| `--lang \u003clang\u003e`         | `-l`  | Language for the generated message (e.g., `spanish`, `french`).    | `english` |\n| `--verbose`             | `-v`  | Show detailed information about the process.                       | `false`   |\n\n### Examples\n\n**1. Stage all changes and generate a commit in Spanish**\n```bash\ngai -a -l spanish\n```\n\n**2. Force a `feat` type with a specific scope**\n```bash\n# First, stage your files\ngit add .\n\n# Run with type and scope\ngai -t feat -s payments\n```\n\u003e **Generated commit:** `feat(payments): add new endpoint for processing transactions`\n\n**3. Preview a commit message without executing it (Dry Run)**\n```bash\ngai -a -n\n```\n\u003e **Output:**\n\u003e ```\n\u003e COMMIT READY\n\u003e refactor(auth): simplify token validation logic\n\u003e\n\u003e Dry Run: The following command will not be executed:\n\u003e $ git commit -m \"refactor(auth): simplify token validation logic\"\n\u003e ```\n\n**4. Amend the last commit**\nStage the additional changes you want to include, then run:\n```bash\ngit add src/fix.ts\ngai -A\n```\n\u003e This will use all currently staged changes to amend the previous commit, generating a new message that reflects the complete set of changes.\n\n**5. Skip AI and use your own message**\n```bash\ngai -a -m \"docs: update README with new installation instructions\"\n```\n\n## Contributing\n\nContributions are welcome! If you'd like to contribute, please follow these steps:\n\n1.  Fork the repository.\n2.  Create a new branch (`git checkout -b feature/your-feature`).\n3.  Make your changes.\n4.  Commit your changes (`git commit -am 'feat: add some feature'`).\n5.  Push to the branch (`git push origin feature/your-feature`).\n6.  Create a new Pull Request.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbernabedev%2Fgai-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbernabedev%2Fgai-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbernabedev%2Fgai-cli/lists"}