Contributing to ContextShare

September 8, 2025 ยท View on GitHub

Thank you for your interest in contributing to ContextShare! This document provides guidelines and instructions for contributing to the project.

๐Ÿš€ Getting Started

Prerequisites

  • Node.js: Version 18+ with npm
  • Visual Studio Code: Version 1.90.0 or later
  • TypeScript: Version 5.4+
  • Git: For version control

Development Setup

  1. Fork and Clone

    git clone https://github.com/your-username/vscode-contextshare.git
    cd vscode-contextshare
    
  2. Install Dependencies

    npm install
    
  3. Build the Extension

    npm run build
    
  4. Run Tests

    npm test
    

๐Ÿ”„ Development Workflow

We follow a Test-Driven Development (TDD) approach and adhere to strict quality gates:

1. Red โ†’ Green โ†’ Refactor Cycle

  1. REPRO (for bugs): Reproduce the issue manually
  2. RED: Write a failing test first that demonstrates the problem
  3. GREEN: Implement the minimal code to make the test pass
  4. REFACTOR: Clean up the implementation while keeping tests green

2. Version Management

  • Update package.json version following Semantic Versioning
  • Keep vsix/extension.vsixmanifest version synchronized
  • Update CHANGELOG.md with user-visible changes
  • Place new changelog entries at the TOP (newest first)

3. Quality Gates

Before any pull request:

# 1. Clean build (must succeed)
rm -rf dist/
npm run build

# 2. Run all tests (must pass)
npm test

# 3. Check TypeScript compilation
npx tsc --noEmit

# 4. Package extension (Windows only)
pwsh ./build_vsix.ps1

๐Ÿ“ Coding Standards

TypeScript Guidelines

  • Use strict TypeScript configuration
  • Prefer explicit types over any
  • Follow existing code style and patterns
  • Use meaningful variable and function names
  • Add JSDoc comments for public APIs

Testing Requirements

  • Every bug fix must include a new test that would fail without the fix
  • Every new feature must have corresponding test coverage
  • Tests should be fast, deterministic, and independent
  • Avoid network calls in tests (use mocks when needed)

Test Categories

TypeLocationPurpose
Unit Teststest/*.test.tsFast, isolated logic testing
Integration Teststest/integration/Component interaction testing
E2E Teststest/e2e/Full workflow testing

๐ŸŒŸ Contribution Types

We welcome various types of contributions:

๐Ÿ› Bug Fixes

  1. Search existing issues to avoid duplicates
  2. Reproduce the bug and create a minimal test case
  3. Write a failing test that demonstrates the issue
  4. Implement the fix to make the test pass
  5. Update documentation if behavior changes

โœจ New Features

  1. Discuss the feature by opening an issue first
  2. Design the API and get feedback from maintainers
  3. Write tests for the expected behavior
  4. Implement the feature incrementally
  5. Update documentation and examples

๐Ÿ“š Documentation

  1. Improve README and setup guides
  2. Add code examples and usage patterns
  3. Update API documentation for new features
  4. Fix typos and improve clarity

๐Ÿงช Testing

  1. Increase test coverage for existing code
  2. Add edge case tests that weren't previously covered
  3. Improve test reliability and reduce flakiness
  4. Add performance tests for critical paths

๐Ÿ“‹ Pull Request Process

1. Branch Naming

Use descriptive branch names:

  • feature/add-remote-catalog-support
  • bugfix/fix-resource-activation-race
  • docs/improve-setup-guide
  • test/add-hat-service-coverage

2. Commit Messages

Follow Conventional Commits:

feat: add support for remote catalog URLs
fix: resolve race condition in resource activation
docs: update installation instructions
test: add coverage for MCP server merging

3. Pull Request Template

When opening a PR, include:

## Description
Brief description of changes

## Type of Change
- [ ] Bug fix (non-breaking change fixing an issue)
- [ ] New feature (non-breaking change adding functionality)
- [ ] Breaking change (fix or feature causing existing functionality to change)
- [ ] Documentation update

## Testing
- [ ] Added/updated tests for changes
- [ ] All tests pass locally
- [ ] Manual testing completed

## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] Version bumped appropriately
- [ ] CHANGELOG.md updated

4. Review Process

  1. Automated checks must pass (CI/CD pipeline)
  2. At least one approval required from maintainers
  3. Address review feedback promptly
  4. Squash commits before merging (if requested)

๐Ÿšจ Issue Reporting

Bug Reports

Use our bug report template:

**Bug Description**
Clear description of the bug

**Steps to Reproduce**
1. Go to '...'
2. Click on '...'
3. See error

**Expected Behavior**
What should happen

**Screenshots**
If applicable

**Environment**
- OS: [e.g., Windows 11]
- VS Code Version: [e.g., 1.90.0]
- Extension Version: [e.g., 0.1.33]

Feature Requests

**Feature Description**
Clear description of the desired feature

**Use Case**
Why is this feature needed?

**Proposed Solution**
How should it work?

**Alternatives Considered**
Other approaches you've thought about

๐Ÿ”’ Security

  • Never commit sensitive information (API keys, passwords, etc.)
  • Report security vulnerabilities privately via SECURITY.md
  • Follow secure coding practices and validate all inputs
  • Use dependency scanning to avoid vulnerable packages

๐ŸŽฏ Code of Conduct

This project follows the Microsoft Open Source Code of Conduct. Please be respectful and professional in all interactions.

๐Ÿ“ž Getting Help

  • GitHub Issues: For bugs and feature requests
  • GitHub Discussions: For questions and general discussion
  • Documentation: Check existing docs before asking questions

๐Ÿ† Recognition

Contributors will be recognized in:

  • Release notes for their contributions
  • GitHub contributors page
  • Special thanks for significant contributions

Thank you for helping make ContextShare better! ๐Ÿš€