AI-powered git diffs analysis and commenting.
CommitStudio provides code review comments on your commits with minimal human intervention by leveraging OpenAI's capabilities to analyze code changes. It identifies potential issues, bugs, and best practices, all while providing constructive feedback.
- Auto-detect Repository: Works with local git repositories, automatically connects to GitHub
- Smart Analysis: Uses OpenAI's GPT models to analyze git diffs and generate insightful comments
- GitHub Integration: Seamlessly post comments to GitHub pull requests
- YOLO Mode: Rewrite your commit messages with AI to be more descriptive and professional
- Caching: Smart caching to avoid repeated analyses
- Interactive CLI: Easy-to-use command line interface with helpful prompts
- Secure Credentials Management: Securely handles GitHub and OpenAI API keys
- Parallel Processing: Efficiently processes multiple commits at once
- Flexible Options: Analyze specific commits, branches, or time periods
- Customizable AI Settings: Choose your preferred AI model and adjust token limits
# Install globally
npm install -g commitstudio
# Or use with npx
npx commitstudio
# Or use with pnpm
pnpm add -g commitstudio
Before using CommitStudio, you'll need:
- A GitHub personal access token with 'repo' scope
- An OpenAI API key
You can set these as environment variables:
export GITHUB_TOKEN=your_github_token
export OPENAI_API_KEY=your_openai_api_key
Or you'll be prompted to enter them when you run the tool.
If you'd like to use the browser authentication flow instead of manually entering a token:
- Create a GitHub OAuth App at: https://github.com/settings/developers
- Set the Authorization callback URL to: https://github.com/devices
- Copy your Client ID and set it as an environment variable:
export GITHUB_CLIENT_ID=your_client_id
commitstudio [options]
-p, --path <path>
: Path to the git repository (default: current directory)-c, --commits <number>
: Number of commits to analyze (default: all)-b, --branch <branch>
: Branch to analyze (default: current branch)--since <date>
: Analyze commits since date--author <email>
: Filter commits by author email--no-cache
: Ignore cache and reanalyze all commits--dry-run
: Run without posting comments to GitHub--verbose
: Show detailed logs--reset
: Clear all saved settings and credentials
commitstudio config [options]
--view
: View current configuration settings--model <model>
: Set AI model to use for analysis--max-tokens <number>
: Set maximum tokens for API requests
Available models include: gpt-4o, gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, o4-mini, o3-mini.
# View current configuration
commitstudio config --view
# Set a specific model
commitstudio config --model gpt-4o
# Set max tokens
commitstudio config --max-tokens 3000
# Update multiple settings at once
commitstudio config --model gpt-4.1-mini --max-tokens 2500
# Run interactive configuration
commitstudio config
commitstudio yolo [options]
Note: YOLO mode requires a clean working tree. Commit or stash any changes before running.
-p, --path <path>
: Path to the git repository (default: current directory)-c, --commits <number>
: Number of commits to analyze (default: last 5)-b, --branch <branch>
: Branch to analyze (default: current branch)--since <date>
: Analyze commits since date--author <email>
: Filter commits by author email--emoji
: Add random emoji to commit messages (default: on)--serious
: Generate more professional commit messages (no emojis)--dry-run
: Preview changes without applying them--verbose
: Show detailed logs
CommitStudio securely saves your GitHub token and OpenAI API key to avoid asking for them each time you run the tool.
Your credentials are securely stored in your user directory:
- macOS:
~/Library/Preferences/commitstudio-nodejs
- Linux:
~/.config/commitstudio
- Windows:
%APPDATA%\commitstudio-nodejs
If you need to clear your saved settings:
# Use the reset flag
commitstudio --reset
This will clear all stored tokens and credentials, allowing you to start fresh next time you run the tool.
GITHUB_TOKEN
: Your GitHub personal access tokenOPENAI_API_KEY
: Your OpenAI API keyGITHUB_CLIENT_ID
: (Optional) Client ID for GitHub OAuth App to enable browser authentication
✓ Repository detected: my-awesome-project
✓ Found 7 commits to analyze (3 already processed)
✓ Analyzing diffs with AI...
↪ Analyzing commit 1/4: Add user authentication
↪ Analyzing commit 2/4: Fix pagination bug
↪ Analyzing commit 3/4: Implement search feature
↪ Analyzing commit 4/4: Update dependencies
✓ Posting comments to GitHub...
↪ Posted comment on commit a1b2c3d
↪ Posted comment on commit e4f5g6h
↪ Posted comment on commit i7j8k9l
↪ Posted comment on commit m0n1o2p
✓ CommitStudio completed successfully!
If you see DEP0040 punycode deprecation warnings when running CommitStudio, these are from dependencies and don't affect functionality. To suppress these warnings, you can:
# Use the npm start script (includes the --no-deprecation flag)
npm start
# Or run with the flag directly
node --no-deprecation ./bin/cli.js
# For detailed diagnostics
npm run start:debug
- CommitStudio detects your git repository and connects to GitHub
- It fetches all commits or uses filters you specify
- For each commit, it gets the diff using git
- The diff is sent to OpenAI's API for analysis
- Results are formatted into structured comments
- Comments are posted to GitHub using the GitHub API
- Processed commits are cached to avoid duplication
MIT
npm start # commitstudio