Skip to content

mirzasaikatahmmed/git-ai-pilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

39 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

โœˆ๏ธ Git AI Pilot

Automate your entire Git workflow with AI-generated commit messages and built-in security scanning.

npm version npm downloads License: ISC Node.js Built with TypeScript Sponsor Buy Me a Coffee


One command to pull, stage, commit, scan, and push โ€” powered by Google Gemini & OpenAI.


๐Ÿงฉ What it does

Run git-auto in any project folder. The tool will:

Step Action
โ“ Ask whether to pull โ€” press y / Enter for yes, n to skip
๐Ÿ“ฅ Pull latest changes from remote (if confirmed)
๐Ÿ”’ Security scan โ€” checks working directory for secrets before staging
๐Ÿšซ Abort if secrets or sensitive files are detected โ€” saves a report
๐Ÿ“‚ Stage all modified files (only if scan passes)
๐Ÿง  Generate a commit message with Gemini AI (falls back to OpenAI)
๐Ÿ’พ Commit the changes
โ˜๏ธ Push to GitHub / GitLab
๐Ÿ”— Print the direct commit URL (e.g. github.com/.../commit/abc123)

All commands

Command Description
git-auto Run the full workflow
git-auto --config Set Gemini or OpenAI API keys interactively
git-auto --custom-command Set a custom command alias (e.g. gitsync)
git-auto --reset-command Reset alias back to git-auto
git-auto --show-command Show the currently active command name
git-auto --help Show the help screen
git-auto --version Show version number

๐Ÿ“ฆ Installation

Requirements

  • Node.js v18 or higher โ€” Download
  • npm v7 or higher (comes with Node.js)
  • A Git repository with a configured remote

Install

npm install -g git-ai-pilot

Verify the install:

git-auto --version

On first run, the setup wizard will prompt for your Gemini and/or OpenAI API key.


๐Ÿ”„ Update

git-auto automatically checks npm on every run and shows a banner when a newer version is available:

  โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
  โ•‘     ๐Ÿš€  Update available  v1.2.2 โ†’ v1.2.3       โ•‘
  โ•‘        Run: npm install -g git-ai-pilot          โ•‘
  โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

Check your current version manually:

git-auto --version
# or
npm list -g git-ai-pilot

Update to the latest release:

npm update -g git-ai-pilot

To install a specific version:

npm install -g git-ai-pilot@1.2.3

Your API keys in ~/.git-ai-pilot/config.json are preserved across updates.


๐Ÿ—‘๏ธ Uninstall

npm uninstall -g git-ai-pilot

This removes the git-auto command. To also delete your stored API keys:

# macOS / Linux
rm -rf ~/.git-ai-pilot

# Windows (PowerShell)
Remove-Item -Recurse -Force "$env:USERPROFILE\.git-ai-pilot"

๐Ÿš€ Quick Start

# 1. Install
npm install -g git-ai-pilot

# 2. Go to any project with uncommitted changes
cd your-project

# 3. Run
git-auto

On first run, the setup wizard will ask for your API key(s).


๐Ÿ”‘ API Keys

Provider Where to get it Role
Google Gemini aistudio.google.com/app/apikey Primary
OpenAI platform.openai.com/api-keys Fallback

Keys are stored locally in ~/.git-ai-pilot/config.json โ€” never in your project.


๐Ÿ”’ Security Scan

The scan runs before git add so secrets are caught before they ever enter git history.

Interactive pull prompt

Pull latest changes from remote? (y/n):

Press y or Enter to pull. Press n to skip.

Secret Detection

Detects secrets in two ways:

1. Sensitive files by name โ€” flagged as CRITICAL the moment they appear in the diff:

File Label
.env, .env.local, .env.production, .env.staging โ€ฆ .env file / variant
id_rsa, id_ed25519, id_ecdsa, id_dsa SSH private key
*.pem PEM certificate/key
credentials.json/yml, secrets.json/yml credentials / secrets file
serviceAccountKey.json service account key
*.keystore, *.jks, *.p12, *.pfx certificate keystore
.netrc, .pgpass, .npmrc auth config file

2. Inline patterns โ€” scanned on every added line:

Pattern Severity
AWS Access / Secret Key CRITICAL
Google API Key CRITICAL
OpenAI API Key CRITICAL
GitHub Token CRITICAL
Stripe Secret Key CRITICAL
Private Key header CRITICAL
Database URL with credentials CRITICAL
ENV secret variables (unquoted) HIGH
Slack Token, JWT Token HIGH
Connection string passwords HIGH
Hardcoded secrets in code MEDIUM

Example output

โ”โ”โ” Security Scan Report โ”โ”โ”
  โœ–  2 secret(s) found:
     Critical : 1
     High     : 1

     [CRITICAL] Sensitive file committed (.env file)
       .env
     [HIGH] ENV Secret Variable
       src/config.ts:8
       โ†’ OPENAI_API_KEY=sk-abc123...

  Result: BLOCKED โ€” secrets detected

โŒ Aborted: secrets detected in working directory.
   Report saved to: .security-reports/security-report-1234567890.json
   Remove the secrets before running git-auto again.

Vulnerability Audit

Runs npm audit and reports severity counts alongside every scan:

โ”โ”โ” Security Scan Report โ”โ”โ”
  โœ”  No secrets detected
  โš   3 npm vulnerabilities:
     High     : 1
     Moderate : 2
     โ€ข lodash [high] โ€” fix available

Tip: Add .security-reports/ to your .gitignore.


๐Ÿ“ Project Structure

git-ai-pilot/
โ”œโ”€โ”€ apps/
โ”‚   โ””โ”€โ”€ cli/               # The npm package (git-ai-pilot)
โ”‚       โ”œโ”€โ”€ src/
โ”‚       โ”‚   โ”œโ”€โ”€ index.ts          # Git workflow orchestration
โ”‚       โ”‚   โ”œโ”€โ”€ ai-service.ts     # Gemini โ†’ OpenAI fallback
โ”‚       โ”‚   โ”œโ”€โ”€ gemini.ts         # Gemini integration
โ”‚       โ”‚   โ”œโ”€โ”€ openai.ts         # OpenAI integration
โ”‚       โ”‚   โ”œโ”€โ”€ security.ts       # Secret scanner & vulnerability audit
โ”‚       โ”‚   โ”œโ”€โ”€ config.ts         # Global API key management
โ”‚       โ”‚   โ””โ”€โ”€ update-check.ts   # npm update notification
โ”‚       โ”œโ”€โ”€ bin/
โ”‚       โ”‚   โ””โ”€โ”€ cli.js         # CLI entry point
โ”‚       โ””โ”€โ”€ package.json
โ”œโ”€โ”€ .github/
โ”‚   โ”œโ”€โ”€ CODEOWNERS
โ”‚   โ””โ”€โ”€ workflows/
โ”œโ”€โ”€ package.json           # Monorepo root (Turborepo)
โ””โ”€โ”€ turbo.json

๐Ÿ› ๏ธ Development

# Clone the repo
git clone https://github.com/mirzasaikatahmmed/git-ai-pilot.git
cd git-ai-pilot

# Install dependencies
npm install

# Build all packages
npm run build

# Watch mode (CLI)
cd apps/cli && npm run dev

๐Ÿ“‹ Changelog

v1.2.5 โ€” Current

  • Commit URL on push โ€” after every successful push the CLI prints the direct commit link (e.g. https://github.com/user/repo/commit/abc123); works with both HTTPS and SSH remotes

v1.2.3

  • Auto update notifications โ€” on every run, the CLI silently checks npm for a newer version; if one exists a styled yellow banner is shown with the exact npm install -g git-ai-pilot command to upgrade (times out in 3 s, never blocks the workflow)

v1.2.0

  • Windows fix โ€” git-auto --custom-command no longer fails with Command failed: npm bin -g; switched to npm prefix -g (the supported replacement) with correct path resolution on both Windows and Unix
  • Suppressed dotenv noise โ€” no more [dotenv] injecting env (N) lines on startup across all commands

v1.1.9

  • git-auto --config โ€” interactive menu to set Gemini or OpenAI API keys at any time; shows live configured/not-set status for each key

v1.1.8

  • Custom command alias โ€” git-auto --custom-command lets you set any name (e.g. gitsync); running that name triggers the full workflow
  • Reset alias โ€” git-auto --reset-command removes the alias and restores git-auto as default
  • Show active command โ€” git-auto --show-command prints the currently active command
  • Beautiful --help screen โ€” styled help with full workflow, security scan details, and live API key status
  • First-run API key prompt โ€” git-auto asks for keys on first use if postinstall was skipped
  • Fixed postinstall in non-interactive environments โ€” npm install -g no longer hangs; setup runs on first git-auto call instead
  • Emoji commit messages โ€” improved AI prompt with a full emoji guide (โœจ feat, ๐Ÿ› fix, ๐Ÿ”’ security โ€ฆ)

v1.1.7

  • Multi-language dependency audit โ€” auto-detects project type and runs the right audit tool
    • ๐ŸŸข Node.js (npm audit) ยท ๐Ÿ Python (pip-audit) ยท ๐Ÿ˜ PHP (composer audit)
    • ๐Ÿน Go (govulncheck) ยท ๐Ÿ’Ž Ruby (bundle-audit) ยท ๐Ÿฆ€ Rust (cargo audit)
    • ๐Ÿ’™ Flutter/Dart ยท โ˜• Java ยท ๐Ÿ’œ .NET (dotnet list) ยท ๐ŸŽ Swift
  • Per-language results shown in the security report with install hints for missing tools

v1.1.6

  • Full terminal UI redesign โ€” header banner, [1/5] step counters, bordered security report (โ•ญโ”€โ•ฎ), success banner
  • Fixed false positives โ€” .md, .txt, .rst files excluded from secret scanning

v1.1.2

  • Interactive pull prompt โ€” press y / Enter to pull, n to skip
  • Security scan moved before git add โ€” secrets never enter git history
  • Sensitive file detection by filename (.env, SSH keys, PEM, keystores โ€ฆ)
  • Unquoted ENV variable patterns (API_KEY=value without quotes)
  • Database URL credential detection (postgres://user:pass@host)
  • Severity levels: CRITICAL / HIGH / MEDIUM on every finding

v1.1.1

  • Fixed bin script name in package.json
  • --version now reads dynamically from package.json
  • Suppressed dotenv verbose output

v1.1.0

  • Added pre-push secret scanner โ€” blocks push on detected secrets
  • Added npm vulnerability audit with severity breakdown
  • Added .security-reports/ JSON report generation
  • AI fallback: Gemini โ†’ OpenAI when primary fails

v1.0.13

  • Initial stable release with Gemini-powered commit messages

๐Ÿค Contributing

Pull requests are welcome! For major changes, please open an issue first.

  1. Fork the repository
  2. Create your branch: git checkout -b feat/your-feature
  3. Make changes and let git-auto commit them ๐Ÿ˜„
  4. Push and open a PR

Please read CONTRIBUTING.md for full guidelines and CODE_OF_CONDUCT.md before participating. All contributors are listed in CONTRIBUTORS.md.


๐Ÿ’› Support

If Git AI Pilot saves you time, consider supporting the project:

GitHub Sponsors Buy Me a Coffee


Made with โค๏ธ by Mirza Saikat Ahmmed

About

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages