Standard Mode
Comprehensive guide to CommitStudio's core analysis engine and GitHub integration
Standard Mode
Standard mode is CommitStudio's primary analysis tool, providing in-depth AI-powered code review for your Git repositories. This mode analyzes code changes, generates insightful feedback, and posts comments directly to GitHub.
How Standard Mode Works
CommitStudio's standard mode follows a sophisticated multi-step process:
-
Repository Detection
- Detects the Git repository from the current directory or specified path
- Identifies the GitHub remote and repository owner/name
- Verifies access permissions with your GitHub token
-
Commit Selection
- Retrieves commits based on your filtering options (count, branch, date, author)
- Identifies which commits have already been processed (using cache)
- Prepares unprocessed commits for analysis
-
Diff Generation
- Uses Git to extract the diff for each commit
- Formats diffs to optimize for AI analysis
- Ensures context is preserved for accurate review
-
AI Analysis
- Sends the formatted diff to OpenAI's API
- Uses a specialized prompt that instructs the AI to:
- Identify bugs, security issues, and code smells
- Suggest improvements and best practices
- Consider language-specific conventions
- Provide constructive, actionable feedback
- Processes the response into structured comment format
-
GitHub Integration
- Connects to GitHub using your personal access token
- Posts AI-generated comments on the specific commits
- Formats comments with Markdown for readability
- Ensures comments are properly attributed to CommitStudio
-
Results Caching
- Stores processed commits in a local cache
- Avoids reanalyzing the same commits in future runs
- Optimizes performance and reduces API costs
-
Feedback Presentation
- Displays a summary of the analysis in the terminal
- Shows progress indicators during analysis
- Provides links to the GitHub comments
When to Use Standard Mode
Standard mode is ideal for:
- Daily Development: Regular code review during development
- Pre-PR Review: Catching issues before creating pull requests
- Team Collaboration: Sharing AI insights with your team
- Quality Assurance: Ensuring code meets quality standards
- Knowledge Transfer: Getting explanations of complex code
Command Syntax and Options
Basic Usage
# Use default settings
commitstudio
# Specify repository path
commitstudio --path /path/to/repo
Commit Selection
# Analyze specific number of commits
commitstudio --commits 5
# Analyze commits on a specific branch
commitstudio --branch feature/new-feature
# Analyze commits since a date
commitstudio --since "2023-01-01"
# Analyze commits from a specific author
commitstudio --author "user@example.com"
Execution Options
# Analyze without posting to GitHub (preview mode)
commitstudio --dry-run
# Ignore cache and reanalyze all commits
commitstudio --no-cache
# Show detailed logs during analysis
commitstudio --verbose
Advanced Configuration
# Reset all saved settings and credentials
commitstudio --reset
# Combine multiple options
commitstudio --commits 10 --branch develop --dry-run --verbose
How AI Analysis Works
CommitStudio leverages advanced AI models to analyze your code:
The Analysis Pipeline
- Preprocessing: The diff is prepared with appropriate context
- Tokenization: The code is converted to tokens for the AI model
- AI Processing: The model analyzes the tokens using its trained knowledge
- Response Generation: The AI generates structured feedback
- Postprocessing: The response is formatted into actionable comments
What the AI Evaluates
- Logical Errors: Bugs, edge cases, and potential failures
- Security Issues: Vulnerabilities, injection risks, and unsafe practices
- Performance Concerns: Inefficient algorithms and resource usage
- Code Quality: Maintainability, readability, and best practices
- Architecture: Design patterns and structural improvements
- Documentation: Missing or unclear documentation
AI Model Selection
The quality of analysis depends on the AI model used:
- Default: gpt-4.1-mini (balanced performance and cost)
- For Critical Code: Consider upgrading to gpt-4o or gpt-4.1
- For Large Repositories: Models with higher token limits help analyze more code
To change the model:
commitstudio config --model gpt-4o
GitHub Integration Details
CommitStudio posts comments directly to your GitHub repository:
Comment Placement
- Commit Comments: Posted on the specific commit that was analyzed
- Line-Specific: Comments tied to the relevant lines of code
- Grouped: Related issues are combined when appropriate
Comment Formatting
- Markdown Support: Rich formatting with code blocks and lists
- Issue Categorization: Clear labeling of issue types
- Code Context: Relevant code snippets included
- Suggested Solutions: Actionable recommendations
Permissions Required
- Your GitHub token must have the
repo
scope - You must have write access to the repository
- CommitStudio respects repository permissions
Real-World Example
Here's a typical terminal output when running standard mode:
✓ Repository detected: username/project-name
✓ GitHub connection established
✓ Found 7 commits to analyze (3 already processed)
✓ Analyzing diffs with AI...
↪ Analyzing commit 1/4: Add user authentication (65d7a9f)
↪ Analyzing commit 2/4: Fix pagination bug (18e2b3c)
↪ Analyzing commit 3/4: Implement search feature (24f1d8e)
↪ Analyzing commit 4/4: Update dependencies (93c7b5a)
✓ Posting comments to GitHub...
↪ Posted 3 comments on commit 65d7a9f
↪ Posted 1 comment on commit 18e2b3c
↪ Posted 2 comments on commit 24f1d8e
↪ Posted 0 comments on commit 93c7b5a
✓ CommitStudio completed successfully!
📊 Summary: 4 commits analyzed, 6 comments posted
And on GitHub, comments appear like:
## 🤖 CommitStudio AI Review
### Potential Security Issue: SQL Injection Risk
The user input from `searchQuery` is directly concatenated into the SQL query,
creating a potential SQL injection vulnerability:
```js
const query = `SELECT * FROM users WHERE name LIKE '%${searchQuery}%'`;
Recommendation: Use parameterized queries to prevent SQL injection:
const query = `SELECT * FROM users WHERE name LIKE ?`;
const params = [`%${searchQuery}%`];
This ensures user input is properly escaped and keeps your database secure.
## Optimizing Your Experience
To get the most out of standard mode:
1. **Make Focused Commits**: Smaller, focused commits get better analysis
2. **Use Descriptive Messages**: Helps the AI understand context
3. **Review Incrementally**: Address issues as they're identified
4. **Configure AI Model**: Choose the right model for your needs
5. **Use Dry Run**: Preview analysis before posting to GitHub
## Related Topics
- [Configuration Options](/docs/configuration/options) - Customize AI models and behavior
- [YOLO Mode](/docs/usage/yolo-mode) - Learn about CommitStudio's commit message rewriting feature
- [CI/CD Integration](/docs/advanced/ci-cd-integration) - Automate code reviews in your pipeline