Get comprehensive AI analysis of your code changes with insights on quality, potential issues, and improvements
GitWhisper’s analyze command provides intelligent code review powered by AI. Get detailed insights about your changes, including what was modified, potential issues, and suggestions for improvements.
Analyzing changes using openai (gpt-4o)...✓ Analysis complete:## SummaryAdded JWT authentication system with user registration and loginendpoints. Implemented secure password hashing and token generation.## Key Changes- New authentication middleware using JWT tokens- User model with bcrypt password hashing- Login endpoint with token generation- Registration endpoint with validation## Potential Issues⚠️ No rate limiting on authentication endpoints⚠️ Missing password strength validation⚠️ Token expiration not configured## Recommendations1. Add rate limiting to prevent brute force attacks2. Implement password complexity requirements3. Configure JWT token expiration (recommend 1h)4. Add refresh token mechanism for better UX
Use a specific AI model:
gw analyze --model claude
Claude often provides more detailed technical analysis:
Analyzing changes using claude (claude-sonnet-4-5)...✓ Analysis complete:## Code Changes OverviewThis commit introduces a JWT-based authentication system for yourapplication. The implementation follows industry best practices forpassword storage but has several security considerations.## Technical Details### Authentication Flow1. User registration: - Password hashed with bcrypt (cost factor: 10) - User record stored in database - Returns 201 Created on success2. User login: - Credentials validated against stored hash - JWT token generated with user ID payload - Token returned in response body### Security Analysis✅ Strengths:- Bcrypt used for password hashing (good choice)- Passwords never stored in plain text- JWT tokens for stateless authentication⚠️ Concerns:- No rate limiting (vulnerable to brute force)- Token expiration not set (tokens valid forever)- No refresh token mechanism- Password requirements not enforced- Missing HTTPS enforcement check## Recommendations1. **Critical:** Add rate limiting ```javascript const rateLimit = require('express-rate-limit'); const authLimiter = rateLimit({ windowMs: 15 * 60 * 1000, max: 5 }); app.use('/auth', authLimiter);
</Tab><Tab title="With Variant">Use a specific model variant:```bash# Use GPT-4o mini for faster analysisgw analyze --model openai --model-variant gpt-4o-mini# Use Claude Opus for most detailed analysisgw analyze --model claude --model-variant claude-opus-4-20250514
Analysis output respects your configured language:
# Set language to Spanishgw change-language> Spanish# Analysis will be in Spanishgw analyze
Analizando cambios usando openai (gpt-4o)...✓ Análisis completado:## ResumenSe agregó sistema de autenticación JWT con endpoints de registroe inicio de sesión. Se implementó hash seguro de contraseñas.## Cambios Principales- Middleware de autenticación usando tokens JWT- Modelo de usuario con hash bcrypt de contraseñas...
GitWhisper supports 20+ languages. Change your language with gw change-language.
Consider moving to managed service (e.g., Pusher, Ably)
Implement notification batching for high-volume users
Add A/B testing framework for notification effectiveness
## Multi-Repository AnalysisAnalyze multiple repositories at once:```bash$ cd workspace/$ gw analyzeNot a git repository. Checking subfolders for git repos...GitWhisper has discovered git repositories in subfolders, continue?> continueAnalysis complete for 3 git repos.----------- frontend -----------✓ UI component refactoring:- Extracted reusable Button component- Added TypeScript prop types- Improved accessibility with ARIA labels⚠️ Missing unit tests for new component--------------------------------------------- backend -----------✓ API endpoint optimization:- Reduced response payload size by 60%- Added response compression- Implemented field filtering--------------------------------------------- mobile -----------✓ Offline support implementation:- Added local SQLite cache- Sync queue for pending requests- Conflict resolution strategy⚠️ No handling for large sync backlogs----------------------------------
The analyze command is implemented in analyze_command.dart:74:
@overrideFuture<int> run() async { final configManager = ConfigManager(); await configManager.load(); // Get the language to use for analysis final language = configManager.getWhisperLanguage(); // Check if we're in a git repository if (!await GitUtils.isGitRepository()) { // Check subfolders for git repos subGitRepos = await GitUtils.findGitReposInSubfolders(); } // Get staged or unstaged diff late final String diff; if (await GitUtils.hasStagedChanges()) { diff = await GitUtils.getStagedDiff(); } else { diff = await GitUtils.getUnstagedDiff(); } // Generate analysis with AI final analysis = await generator.analyzeChanges(diff, language); _logger.success(analysis); return ExitCode.success.code;}
The analysis prompt is generated in commit_utils.dart:
String getAnalysisPrompt(String diff, Language language) { return '''Analyze the following code changes and provide insights:1. Summary of changes2. Key modifications3. Potential issues or concerns4. Recommendations for improvements5. Security considerations (if applicable)6. Performance impact (if applicable)Provide the analysis in ${language.name}.$diff''';}