Skip to content

Latest commit

 

History

History
176 lines (126 loc) · 5.02 KB

File metadata and controls

176 lines (126 loc) · 5.02 KB

Contributing to WispGPT Code Explainer

We love your input! We want to make contributing to WispGPT as easy and transparent as possible, whether it's:

  • Reporting a bug
  • Discussing the current state of the code
  • Submitting a fix
  • Proposing new features
  • Becoming a maintainer

Development Process

We use GitHub to host code, to track issues and feature requests, as well as accept pull requests.

  1. Fork the repo and create your branch from main
  2. If you've added code that should be tested, add tests
  3. If you've changed APIs, update the documentation
  4. Ensure the test suite passes
  5. Make sure your code lints
  6. Issue that pull request!

Pull Request Process

  1. Update the README.md with details of changes to the interface, including new environment variables, exposed ports, useful file locations, and container parameters
  2. Increase the version numbers in any examples files and the README.md to the new version that this Pull Request would represent
  3. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you

Any contributions you make will be under the MIT Software License

In short, when you submit code changes, your submissions are understood to be under the same MIT License that covers the project. Feel free to contact the maintainers if that's a concern.

Report bugs using GitHub's issue tracker

We use GitHub issues to track public bugs. Report a bug by opening a new issue.

Great Bug Reports tend to have:

  • A quick summary and/or background
  • Steps to reproduce
    • Be specific!
    • Give sample code if you can
  • What you expected would happen
  • What actually happens
  • Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)

Coding Style

  • Use 2 spaces for indentation
  • Follow the existing code style in the repository
  • Use meaningful variable and function names
  • Add comments for complex logic
  • Keep functions small and focused
  • Use modern JavaScript features (ES6+)

Adding New AI Providers

To add a new AI provider:

  1. Create a new file in lib/providers/ following the pattern of existing providers
  2. Extend the BaseProvider class
  3. Implement required methods: generateResponse(), validateConfig(), getName()
  4. Add the provider to lib/providers/index.js
  5. Update documentation and examples
  6. Add tests

Example:

import { BaseProvider } from './base.js';

export class NewProvider extends BaseProvider {
  constructor(config) {
    super(config);
    // Initialize your provider
  }

  async generateResponse(messages, options = {}) {
    // Implement API call to your provider
  }

  validateConfig() {
    // Validate required configuration
  }

  getName() {
    return 'New Provider';
  }
}

Adding New Languages

To add support for a new programming language:

  1. Update lib/core/language-detector.js:
    • Add patterns to LANGUAGE_PATTERNS
    • Add comment removal function to COMMENT_REMOVERS
  2. Update lib/core/prompts.js:
    • Add language-specific prompt if needed
  3. Update documentation with the new language
  4. Add test cases

Testing

  • Write unit tests for new features
  • Test with multiple AI providers if possible
  • Include edge cases in your tests
  • Test CLI commands manually
  • Verify examples work correctly

Run tests with:

npm test

Documentation

  • Update README.md for user-facing changes
  • Add JSDoc comments for new functions
  • Update examples if APIs change
  • Include provider-specific notes when relevant

Local Development Setup

# Clone your fork
git clone https://github.com/yourusername/wispgpt-code-explainer.git
cd wispgpt-code-explainer

# Install dependencies
npm install

# Set up environment
cp .env.example .env
# Add your API keys to .env

# Run tests
npm test

# Start development server
npm run dev

# Test CLI
npm link
wispgpt --help

Feature Requests

We welcome feature requests! Please:

  1. Check if the feature already exists or is planned
  2. Open an issue with the "enhancement" label
  3. Provide a clear description of the problem and proposed solution
  4. Include examples of how the feature would be used

Code of Conduct

Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone.

Our Standards

Examples of behavior that contributes to a positive environment:

  • Using welcoming and inclusive language
  • Being respectful of differing viewpoints and experiences
  • Gracefully accepting constructive criticism
  • Focusing on what is best for the community

Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement.

License

By contributing, you agree that your contributions will be licensed under its MIT License.