Installation
How to install CommitStudio and set up your credentials
Prerequisites
Before installing CommitStudio, make sure you have:
- Node.js: Version 18.0.0 or higher installed on your system
- Git: Installed and configured on your system
- GitHub Repository: A repository on GitHub that you want to analyze
- API Credentials:
- A GitHub personal access token with 'repo' scope
- An OpenAI API key
Installation Methods
Global Installation (Recommended)
Installing CommitStudio globally allows you to run it from any directory:
# Install globally with npm
npm install -g commitstudio
# OR install globally with pnpm
pnpm add -g commitstudio
# OR install globally with yarn
yarn global add commitstudio
After installation, verify it's working:
commitstudio --version
Using Without Installation
You can run CommitStudio directly without installing it using npx:
npx commitstudio
This approach will download and execute CommitStudio on demand, ensuring you always use the latest version.
Setting Up Credentials
CommitStudio requires authentication with both GitHub and OpenAI. You have several options to provide these credentials:
Environment Variables (Recommended)
Set up environment variables to avoid entering credentials every time:
# GitHub personal access token
export GITHUB_TOKEN=your_github_token
# OpenAI API key
export OPENAI_API_KEY=your_openai_api_key
For permanent setup, add these to your shell profile file (.bashrc
, .zshrc
, etc.).
Interactive Prompt
If credentials aren't found in environment variables, CommitStudio will prompt you to enter them interactively during the first run.
Optional: GitHub OAuth Setup
For a browser-based authentication flow instead of using a personal access token:
- Create a GitHub OAuth App at: https://github.com/settings/developers
- Set the Authorization callback URL to: https://github.com/devices
- Set the Client ID as an environment variable:
export GITHUB_CLIENT_ID=your_client_id
GitHub Access Token
CommitStudio requires a GitHub personal access token to:
- Access repository information
- Fetch commit details
- Post comments to commits
Creating a GitHub Token
- Go to GitHub Settings > Developer settings > Personal access tokens
- Click "Generate new token" (classic)
- Give it a descriptive name like "CommitStudio"
- Select the
repo
scope (this grants access to your repositories) - Click "Generate token"
- Copy the generated token (you'll only see it once!)
OpenAI API Key
CommitStudio uses OpenAI's API to analyze code. You need an API key with sufficient quota.
Getting an OpenAI API Key
- Create an account or sign in at OpenAI's platform
- Go to API Keys
- Create a new secret key
- Give it a name like "CommitStudio"
- Copy your API key (you'll only see it once!)
Verifying Your Installation
After installation, verify everything is working correctly:
# Check the installed version
commitstudio --version
# View available commands and options
commitstudio --help
Troubleshooting Installation Issues
Node.js Version Error
If you see an error about Node.js version, upgrade Node.js:
# Using nvm (Node Version Manager)
nvm install 18
nvm use 18
# OR download the latest version from nodejs.org
Permission Errors
If you encounter permission errors during global installation:
# Install with sudo (not recommended)
sudo npm install -g commitstudio
# OR fix npm permissions (recommended)
# https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
Connection Issues
If CommitStudio can't connect to GitHub or OpenAI:
- Verify your internet connection
- Check that your API keys are correct
- Ensure you don't have a proxy or firewall blocking connections
Next Steps
Now that CommitStudio is installed, you can:
- Continue to the Quick Start guide
- Learn about Standard Mode for code analysis
- Explore Configuration Options to customize the tool