Code Whisper is an advanced AI-powered code assistant specifically designed for the Nexure.js framework. It helps developers by providing real-time code analysis, error debugging, pattern detection, and intelligent code suggestions.
- π§ AI-Powered Analysis: Leverages cutting-edge AI models to understand and improve your code
- π Pattern Detection: Identifies code patterns, anti-patterns, and potential bugs
- π οΈ Smart Error Debugging: Explains errors and suggests fixes with context-aware intelligence
- π Advanced Visualizations: View code quality metrics with intuitive visualizations including 3D representations
- π Feedback Learning: Continuously improves through user feedback
- π Multi-Provider Support: Compatible with OpenAI, Anthropic, and Google AI models
- β‘ Real-time Analysis: Background monitoring for immediate feedback
- π§© Seamless Integration: Easily integrates with your Nexure.js development workflow
- Code Whisper
npm install nexurejs-code-whisperCode Whisper supports multiple AI model providers. You'll need to provide an API key for your chosen provider.
import { CodeWhisper, AIProviderEnum } from 'nexurejs-code-whisper';
const codeWhisper = new CodeWhisper({
model: {
provider: AIProviderEnum.OPENAI,
apiKey: 'your-openai-api-key',
model: 'gpt-4' // or any other OpenAI model
}
});
await codeWhisper.initialize();import { CodeWhisper, AIProviderEnum } from 'nexurejs-code-whisper';
const codeWhisper = new CodeWhisper({
model: {
provider: AIProviderEnum.ANTHROPIC,
apiKey: 'your-anthropic-api-key',
model: 'claude-3-opus-20240229' // or any other Anthropic model
}
});
await codeWhisper.initialize();import { CodeWhisper, AIProviderEnum } from 'nexurejs-code-whisper';
const codeWhisper = new CodeWhisper({
model: {
provider: AIProviderEnum.GOOGLE,
apiKey: 'your-google-api-key',
model: 'gemini-pro' // or any other Google model
}
});
await codeWhisper.initialize();// Analyze a file
const analysis = await codeWhisper.analyzeFile('path/to/your/file.ts');
console.log(analysis.explanation);
console.log(analysis.suggestions);try {
// Your code that might throw an error
} catch (error) {
const errorContext = {
message: error.message,
stack: error.stack,
file: 'path/to/your/file.ts',
line: 10, // Line where the error occurred
};
const analysis = await codeWhisper.analyzeError(errorContext);
console.log(analysis.explanation);
console.log(analysis.suggestions);
}const suggestion = await codeWhisper.generateSuggestion(
'Write a function that validates a user input form',
{ language: 'TypeScript' }
);
console.log(suggestion.explanation);
console.log(suggestion.suggestions);Code Whisper can run continuously in the background, monitoring your files as you code and providing real-time feedback:
import { CodeWhisper, BackgroundService, AIProviderEnum } from 'nexurejs-code-whisper';
// Initialize CodeWhisper
const codeWhisper = new CodeWhisper({
model: {
provider: AIProviderEnum.OPENAI,
apiKey: process.env.OPENAI_API_KEY,
model: 'gpt-4'
}
});
// Create background service
const backgroundService = new BackgroundService({
codeWhisper,
watchDir: './src', // Directory to watch
ignorePatterns: ['**/node_modules/**', '**/dist/**'],
fileExtensions: ['.js', '.jsx', '.ts', '.tsx'],
debounceTime: 1000, // Wait 1 second after file changes
});
// Start the service
await backgroundService.start();Code Whisper includes a powerful pattern analyzer that can identify common coding issues, anti-patterns, and potential bugs:
- Multiple Detection Strategies: Combines regex-based, AST-based, and hybrid pattern detection
- Built-in Pattern Library: Includes patterns for security, performance, and code quality
- Framework-specific Patterns: Support for React, Vue, Express, and other frameworks
- Custom Pattern Creation: Define your own patterns for project-specific requirements
Read more about Pattern Analysis
The feedback system allows you to provide feedback on pattern matches and use AI to continuously improve pattern accuracy:
- Feedback Collection: Mark pattern matches as true/false positives
- AI-powered Improvement: Uses AI to refine patterns based on feedback
- Analytics Dashboard: View feedback statistics and trends
- Continuous Learning: Gets better over time with more feedback
Read more about the Feedback System
Code Whisper provides powerful visualization capabilities:
- Pattern Match Tables: Tabular display of pattern matches
- Bar Charts & Histograms: Visual representation of pattern distribution
- 3D Visualizations: Advanced 3D representation of your codebase quality
- HTML Reports: Generate comprehensive reports with all visualizations
Read more about Visualizations
Code Whisper includes a command-line interface for quick code analysis and generation:
# Show help
npx code-whisper help
# Analyze a file
npx code-whisper analyze path/to/file.ts
# Generate code based on a prompt
npx code-whisper suggest "Create a function that validates email addresses"
# Use a different AI provider
npx code-whisper analyze path/to/file.ts --provider anthropic --model claude-3-opus-20240229
# Start background monitoring of a directory
npx code-whisper watch ./src --provider openai --model gpt-4
# Pattern analysis
npx code-whisper pattern analyze ./src
# Interactive feedback collection
npx code-whisper pattern interactive ./src
# Generate visualizations
npx code-whisper pattern visualize3d --path ./srcFor more detailed documentation, please refer to the following guides:
We welcome contributions to Code Whisper! Please see our contributing guidelines for more information.
Code Whisper is licensed under the MIT License.
