New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

git-ai-tool

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-ai-tool

A CLI tool to automate git commit and push using React Terminal

latest
npmnpm
Version
1.0.9
Version published
Maintainers
0
Created
Source

git-ai-tool

A CLI tool to automate git commit and push using a React Terminal interface.

Features

  • 🤖 AI-Powered Commit Messages: Generates semantic commit messages using OpenAI or Ollama
  • 🖥️ Interactive UI: Beautiful terminal interface built with React Ink
  • 🔍 Smart Change Detection: Automatically detects staged and unstaged changes
  • 🔄 Streamlined Workflow: Guides you through the commit and push process
  • 🔗 PR Integration: Provides pull request URLs after pushing
  • 📊 Operation Summary: Shows a summary of all actions taken

Installation

# Install globally
npm install -g git-ai-tool

# Set required environment variables for OpenAI
export OPENAI_API_KEY="your-openai-api-key"
export GITHUB_TOKEN="your-github-token" # Optional, for PR detection

Usage

Navigate to any Git repository and run:

git-ai-tool commit

By default, the tool uses OpenAI. To use Ollama instead:

git-ai-tool commit --provider ollama

The interactive terminal UI will guide you through:

  • Reviewing staged and unstaged changes
  • Staging changes if needed
  • Generating and confirming a commit message
  • Pushing changes to remote
  • Providing a PR URL if applicable

Command Line Options

Options:
  -V, --version                 output the version number
  -p, --provider <provider>     AI provider to use (openai or ollama) (default: "openai")
  --openai-api-key <key>        OpenAI API key
  --openai-model <model>        OpenAI model to use (default: "gpt-3.5-turbo")
  --ollama-host <host>          Ollama host URL (default: "http://127.0.0.1:11434")
  --ollama-model <model>        Ollama model to use (default: "llama3.1")
  -h, --help                    display help for command

Requirements

  • Node.js 16.0.0 or higher
  • Git installed and configured
  • OpenAI API key (if using OpenAI provider)
  • Ollama running locally or remotely (if using Ollama provider)
  • GitHub token (optional) for PR detection

Environment Variables

VariableRequiredDescription
OPENAI_API_KEYFor OpenAIYour OpenAI API key for generating commit messages
GITHUB_TOKENNoGitHub token for detecting existing PRs

You can set these in your shell profile or use a tool like direnv to manage them per project.

Using Ollama

To use Ollama instead of OpenAI:

  • Make sure you have Ollama installed and running
  • Run the tool with the --provider ollama flag
  • Optionally specify a different model with --ollama-model <model> (default is llama3.1)
  • Optionally specify a different host with --ollama-host <host> (default is http://127.0.0.1:11434)

Example:

git-ai-tool commit --provider ollama --ollama-model codellama

Development

Clone the repository and install dependencies:

git clone https://github.com/yourusername/git-ai-tool.git
cd git-ai-tool
npm install

Run in development mode:

npm run dev

Build the project:

npm run build

How It Works

  • Repository Check: Verifies you're in a valid Git repository
  • Change Detection: Identifies staged and unstaged changes
  • AI Generation: Uses OpenAI or Ollama to create a semantic commit message
  • Commit Process: Commits changes with the generated message
  • Push Handling: Pushes to remote and checks for PR opportunities
  • Summary: Provides a summary of all actions taken

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  • Fork the repository
  • Create your feature branch (git checkout -b feature/amazing-feature)
  • Commit your changes (git commit -m 'Add some amazing feature')
  • Push to the branch (git push origin feature/amazing-feature)
  • Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Made with ❤️ by [Your Name]


This README provides:

1. A clear description of what the tool does
2. Installation and usage instructions
3. Required environment variables
4. Development setup
5. How the tool works
6. Contributing guidelines
7. License information
8. Acknowledgments

You should replace the placeholder image URL with an actual screenshot or GIF of your tool in action once you have one, and update the GitHub repository URL and your name in the appropriate places.

Keywords

git

FAQs

Package last updated on 19 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts