Skip to content

AI-powered code assistant for the Nexure.js framework. It helps developers by providing real-time code analysis, error debugging, and code suggestions.

Notifications You must be signed in to change notification settings

nexurejs/code-whisper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Code Whisper

Code Whisper Logo

AI-Powered Code Intelligence for Nexure.js

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.

✨ Highlights

  • 🧠 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

πŸ“‹ Table of Contents

πŸš€ Installation

npm install nexurejs-code-whisper

βš™οΈ Configuration

Code Whisper supports multiple AI model providers. You'll need to provide an API key for your chosen provider.

OpenAI

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();

Anthropic

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();

Google (Gemini)

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();

πŸ“– Usage

Analyzing Code

// Analyze a file
const analysis = await codeWhisper.analyzeFile('path/to/your/file.ts');
console.log(analysis.explanation);
console.log(analysis.suggestions);

Analyzing Errors

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);
}

Generating Code 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);

Real-time Code Analysis with Background Service

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();

πŸ”„ Features

Pattern Analysis System

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

Feedback System

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

Visualizations

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

πŸ› οΈ CLI Tool

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 ./src

πŸ“š Documentation

API Reference

Examples

🌟 Advanced Usage

For more detailed documentation, please refer to the following guides:

πŸ‘₯ Contributing

We welcome contributions to Code Whisper! Please see our contributing guidelines for more information.

πŸ“„ License

Code Whisper is licensed under the MIT License.

About

AI-powered code assistant for the Nexure.js framework. It helps developers by providing real-time code analysis, error debugging, and code suggestions.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published