We love your input! We want to make contributing to CommitWeave 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
- Node.js: ≥ 18.0.0
- npm: Latest version recommended
- Git: For version control
- VS Code: Recommended for extension development
# Fork the repo on GitHub, then:
git clone https://github.com/YOUR-USERNAME/commitweave.git
cd commitweave# Install dependencies
npm install
# Install dependencies for VS Code extension
cd vscode-extension && npm install && cd ..
# Build the project
npm run build
# Run tests to ensure everything works
npm test# Create a feature branch
git checkout -b feature/your-amazing-feature
# Make your changes...
# Use CommitWeave to commit your changes 🎉
npx tsx bin/index.ts
# or if globally installed: commitweavefeature/your-feature-name- New featuresbugfix/issue-description- Bug fixesdocs/what-you-changed- Documentation changesrefactor/component-name- Code refactoringtest/what-youre-testing- Test improvements
We use Conventional Commits (and our own tool for this! 🎉):
# Use CommitWeave itself for commits
npm start
# or manually follow conventional format:
# type(scope): descriptionExamples:
feat(cli): add new AI provider support
fix(git): resolve staging issue on Windows
docs(readme): update installation instructions
test(core): add unit tests for CommitBuilder
refactor(utils): simplify configuration loading
-
Create a new branch:
git checkout -b feature/your-feature-name
-
Make your changes following our coding standards
-
Write or update tests for your changes
-
Update documentation if needed
-
Test your changes:
npm test npm run typecheck npm run build -
Commit using CommitWeave:
npm start
commitweave/
├── src/ # Core CLI source code
│ ├── cli/ # Interactive CLI workflows
│ │ ├── createCommitFlow.ts # Main commit creation flow
│ │ ├── flags.ts # Command-line flag parsing
│ │ └── commands/ # Configuration management
│ │ ├── exportConfig.ts # Export configuration
│ │ ├── importConfig.ts # Import configuration
│ │ ├── listConfig.ts # List current config
│ │ ├── resetConfig.ts # Reset to defaults
│ │ └── doctorConfig.ts # Health diagnostics
│ ├── core/ # Core business logic
│ │ └── commitBuilder.ts # Fluent commit builder
│ ├── types/ # TypeScript definitions
│ │ ├── config.ts # Configuration interfaces
│ │ └── ai.ts # AI provider types & errors
│ ├── utils/ # Utility functions
│ │ ├── ai.ts # AI integration
│ │ ├── git.ts # Git operations
│ │ ├── configStore.ts # Configuration management
│ │ ├── configDiff.ts # Configuration diffing
│ │ └── errorHandler.ts # Centralized error handling
│ ├── config/ # Default configurations
│ │ └── defaultConfig.ts # Default commit types & settings
│ └── ui/ # User interface components
│ └── banner.ts # ASCII art and branding
├── bin/ # CLI entry points
│ └── index.ts # Main entry point (23ms cold-start)
├── vscode-extension/ # VS Code Extension
│ ├── src/
│ │ ├── extension.ts # Extension activation/commands
│ │ ├── commands/ # Command implementations
│ │ │ ├── createCommit.ts # CLI integration
│ │ │ ├── aiCommit.ts # AI-powered commits
│ │ │ ├── quickCommit.ts # Native quick commits
│ │ │ ├── validateCommit.ts # Commit validation
│ │ │ └── configure.ts # Settings panel
│ │ ├── utils/ # Extension utilities
│ │ │ ├── gitUtils.ts # Git operations
│ │ │ └── commitValidator.ts# Message validation
│ │ └── webview/ # Settings panel UI
│ │ ├── panel.ts # Webview provider
│ │ └── ui.html # HTML interface
│ └── package.json # Extension manifest
├── scripts/ # Development scripts
│ ├── bench.ts # Performance benchmarking
│ └── test-*.ts # Various testing utilities
├── tests/ # Test suite
│ ├── anthropic.spec.ts # AI provider tests
│ ├── config.spec.ts # Configuration tests
│ └── perf.spec.ts # Performance tests
├── docs/ # Documentation
└── .github/ # GitHub configuration
└── workflows/ # CI/CD pipelines
# Run all tests
npm test
# Run specific test suites
npm run test:unit
npm run test:integration
# Test the CLI locally
npx tsx bin/index.ts
# Test specific functionality
npx tsx scripts/test-local.ts
npx tsx scripts/test-cli-functions.ts
# Performance benchmarking
npm run benchWe aim for high test coverage. When adding new features:
- Write unit tests for core logic
- Add integration tests for CLI workflows
- Test error scenarios and edge cases
- Update existing tests if behavior changes
# Build extension
cd vscode-extension && npm run build
# Package extension for testing
npm run package
# Manual testing in VS Code:
# 1. Press F5 to launch Extension Development Host
# 2. Test commands via Command Palette
# 3. Check status bar integration
# 4. Test settings webview functionalityAdding new commit types is straightforward and helps customize CommitWeave for different workflows.
Edit src/config/defaultConfig.ts:
// src/config/defaultConfig.ts
export const defaultCommitTypes: CommitType[] = [
// ... existing types
{
type: 'security', // The commit type
emoji: '🔒', // Associated emoji
description: 'Security improvements', // Description for users
aliases: ['sec', 'secure'] // Optional aliases
}
];If your commit type needs special validation, update src/utils/validation.ts:
// Add specific validation rules if needed
export function validateCommitType(type: string): boolean {
const validTypes = ['feat', 'fix', 'docs', 'security', /* ... */];
return validTypes.includes(type);
}Ensure TypeScript knows about your new type in src/types/config.ts:
export interface CommitType {
type: string;
emoji: string;
description: string;
aliases?: string[];
}Create tests in tests/config.spec.ts:
describe('custom commit types', () => {
it('should validate security commit type', () => {
const result = validateCommitMessage('security: 🔒 improve password hashing');
expect(result.isValid).toBe(true);
});
it('should support security type aliases', () => {
const result = validateCommitMessage('sec: 🔒 fix XSS vulnerability');
expect(result.isValid).toBe(true);
});
});Add your new commit type to:
README.mdcommit types table- Any relevant documentation
CommitWeave supports multiple AI providers. Here's how to add a new one:
Add your provider to src/types/ai.ts:
// src/types/ai.ts
export interface YourAIProvider extends AIProvider {
name: 'your-provider';
apiKey: string;
model?: string;
maxTokens?: number;
// Add provider-specific config options
}
// Add custom error classes
export class YourProviderError extends Error {
constructor(message: string) {
super(message);
this.name = 'YourProviderError';
}
}
export class YourProviderRateLimitError extends Error {
constructor(message: string = 'Rate limit exceeded') {
super(message);
this.name = 'YourProviderRateLimitError';
}
}Create the provider implementation in src/utils/ai.ts:
// src/utils/ai.ts
class YourAIProvider implements AIProvider {
constructor(private config: YourProviderConfig) {}
async generateCommitMessage(diff: string): Promise<string> {
try {
// Make API request to your AI provider
const response = await fetch('https://api.yourprovider.com/generate', {
method: 'POST',
headers: {
'Authorization': `Bearer ${this.config.apiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
prompt: this.buildPrompt(diff),
model: this.config.model || 'your-default-model',
max_tokens: this.config.maxTokens || 150
})
});
if (!response.ok) {
throw this.handleError(response);
}
const data = await response.json();
return this.parseResponse(data);
} catch (error) {
throw this.mapError(error);
}
}
private buildPrompt(diff: string): string {
return `Generate a conventional commit message for these changes:\n\n${diff}`;
}
private parseResponse(data: any): string {
// Parse your provider's response format
return data.message || data.text || data.completion;
}
private handleError(response: Response): Error {
if (response.status === 429) {
return new YourProviderRateLimitError();
}
if (response.status === 401) {
return new YourProviderError('Invalid API key');
}
return new YourProviderError(`API error: ${response.status}`);
}
private mapError(error: any): Error {
if (error instanceof YourProviderError) {
return error;
}
return new YourProviderError(`Unexpected error: ${error.message}`);
}
}Add your provider to the factory function:
// src/utils/ai.ts
export function createAIProvider(config: AIConfig): AIProvider {
switch (config.provider) {
case 'openai':
return new OpenAIProvider(config);
case 'anthropic':
return new AnthropicProvider(config);
case 'your-provider':
return new YourAIProvider(config);
case 'mock':
return new MockAIProvider();
default:
throw new Error(`Unknown AI provider: ${config.provider}`);
}
}Add your provider to the configuration types in src/types/config.ts:
// src/types/config.ts
export interface AIConfig {
provider: 'openai' | 'anthropic' | 'your-provider' | 'mock';
apiKey?: string;
model?: string;
maxTokens?: number;
// Add provider-specific fields
yourProviderSpecificField?: string;
}Add error handling to src/utils/errorHandler.ts:
// src/utils/errorHandler.ts
export function handleAIError(error: Error): never {
if (error instanceof YourProviderRateLimitError) {
console.error(chalk.red('Rate limit exceeded. Please try again later.'));
console.log(chalk.gray('Tip: Consider upgrading your API plan or using a different provider.'));
} else if (error instanceof YourProviderError) {
console.error(chalk.red(`Your Provider Error: ${error.message}`));
console.log(chalk.gray('Tip: Check your API key configuration in glinr-commit.json'));
}
// ... handle other errors
process.exit(1);
}Update the VS Code extension to support your provider in vscode-extension/src/webview/ui.html:
<!-- Add option to AI provider dropdown -->
<select id="aiProvider">
<option value="openai">OpenAI (GPT models)</option>
<option value="anthropic">Anthropic (Claude models)</option>
<option value="your-provider">Your Provider</option>
<option value="mock">Mock Provider (for testing)</option>
</select>Create tests in tests/your-provider.spec.ts:
// tests/your-provider.spec.ts
import { YourAIProvider, YourProviderError, YourProviderRateLimitError } from '../src/utils/ai';
describe('YourAIProvider', () => {
let provider: YourAIProvider;
beforeEach(() => {
provider = new YourAIProvider({
provider: 'your-provider',
apiKey: 'test-key',
model: 'test-model'
});
});
describe('generateCommitMessage', () => {
it('should generate commit message from diff', async () => {
// Mock successful API response
global.fetch = jest.fn().mockResolvedValue({
ok: true,
json: () => Promise.resolve({ message: 'feat: add new feature' })
});
const result = await provider.generateCommitMessage('+ new feature code');
expect(result).toBe('feat: add new feature');
});
it('should handle rate limit errors', async () => {
global.fetch = jest.fn().mockResolvedValue({
ok: false,
status: 429
});
await expect(provider.generateCommitMessage('diff'))
.rejects
.toThrow(YourProviderRateLimitError);
});
it('should handle authentication errors', async () => {
global.fetch = jest.fn().mockResolvedValue({
ok: false,
status: 401
});
await expect(provider.generateCommitMessage('diff'))
.rejects
.toThrow('Invalid API key');
});
});
});Document your new provider:
- README.md: Add to the AI providers section
- Configuration docs: Add provider-specific config examples
- Error handling: Document common error scenarios
Users can then configure your provider in glinr-commit.json:
{
"version": "1.0",
"ai": {
"provider": "your-provider",
"apiKey": "your-api-key-here",
"model": "your-preferred-model",
"maxTokens": 150,
"yourProviderSpecificField": "custom-value"
}
}- Strict TypeScript - All code must be properly typed
- No
anytypes - Use proper type definitions - ESLint compliance - Follow our linting rules
- Prettier formatting - Code will be auto-formatted
- Single Responsibility - Functions and classes should have one clear purpose
- Descriptive Naming - Use clear, self-documenting names
- Error Handling - Provide helpful error messages
- Documentation - Document complex logic with comments
CommitWeave prioritizes fast startup times:
- Use lazy loading for heavy dependencies
- Minimize startup overhead
- Profile cold-start performance with
npm run bench
cd vscode-extension
npm install
npm run build
# Test extension
code . # Opens VS Code
# Press F5 to launch Extension Development Host- Follow VS Code standards - Use official guidelines
- Test in both themes - Dark and light mode compatibility
- Webview security - Follow CSP and security best practices
- Publisher compliance - Ensure marketplace standards
- Search existing issues - Someone might have already reported it
- Try the latest version - The bug might already be fixed
- Check documentation - Make sure it's actually a bug
Use our issue template or include:
- OS and version (Windows 11, macOS 13, Ubuntu 22.04)
- Node.js version (
node --version) - CommitWeave version (
commitweave --version) - Steps to reproduce the issue
- Expected behavior vs actual behavior
- Error messages (full stack traces if available)
- Configuration files (sanitized, no API keys)
- Search existing requests - Avoid duplicates
- Explain the problem your feature would solve
- Describe your proposed solution
- Consider alternative approaches
- Think about implementation complexity
- Problem Description - What issue does this solve?
- Proposed Solution - How should it work?
- Alternatives - Other ways to solve this?
- Use Cases - Who benefits from this feature?
- Implementation Notes - Technical considerations
- Installation guides for different platforms
- Configuration examples for various workflows
- Integration tutorials with popular tools
- Troubleshooting guides for common issues
- API documentation for programmatic usage
- Clear examples - Show, don't just tell
- Step-by-step instructions - Easy to follow
- Screenshots/GIFs where helpful
- Multiple platforms - Consider Windows, macOS, Linux
- Beginner-friendly - Assume minimal prior knowledge
- Automated checks must pass (tests, linting, build)
- Manual review by maintainers
- Feedback and iterations - We'll work together to improve your PR
- Approval and merge once everything looks good
- Functionality - Does it work as expected?
- Code Quality - Is it clean, readable, and maintainable?
- Performance - Does it maintain our performance standards?
- Tests - Are there adequate tests for the changes?
- Documentation - Are docs updated if needed?
- Breaking Changes - Are they necessary and well-documented?
All contributors are recognized in our:
- README.md contributors section
- CHANGELOG.md for significant contributions
- GitHub contributors page
- Social media shout-outs for major features
Active contributors may be invited to become maintainers with:
- Commit access to the repository
- Issue triage responsibilities
- PR review privileges
- Release management participation
- GitHub Issues - For bugs and feature requests
- GitHub Discussions - For questions and general discussion
- Email - support@glincker.com for private matters
- Issues - We aim to respond within 48 hours
- Pull Requests - Initial review within 1 week
- Security Issues - Within 24 hours (see SECURITY.md)
By contributing to CommitWeave, you agree that your contributions will be licensed under the same MIT License that covers the project.
We require all contributors to sign off on their commits, certifying that they have the right to submit their contribution under our open source license.
Add -s to your git commits:
git commit -s -m "your commit message"Your contributions make CommitWeave better for everyone. Whether you're fixing a typo, reporting a bug, or adding a major feature, every contribution matters.
Happy coding! 🧶✨
Maintained by GLINR STUDIOS
Questions? Open an issue or email support@glincker.com