Thank you for your interest in contributing to Dataweave! This guide will help you get started with development, understand our processes, and make meaningful contributions to the project.
- Getting Started
- Development Setup
- Architecture Overview
- Development Workflow
- Code Standards
- Testing Guidelines
- Documentation
- Submitting Changes
- Release Process
- Community Guidelines
Ensure you have the following installed:
- Node.js (version 16.0.0 or higher)
- npm or yarn package manager
- Git for version control
- VSCode (recommended) with extensions:
- TypeScript Hero
- ESLint
- Prettier
- GitLens
# Fork and clone the repository
git clone https://github.com/yourusername/dataweave.git
cd dataweave
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
# Start development
npm run dev -- --help# Fork the repository on GitHub
# Then clone your fork
git clone https://github.com/yourusername/dataweave.git
cd dataweave
# Add upstream remote
git remote add upstream https://github.com/openconjecture/dataweave.git# Install Node.js dependencies
npm install
# Verify installation
npm run typecheck
npm run lint
npm test# Create development branch
git checkout -b feature/your-feature-name
# Start development mode
npm run dev -- init test-project
# Run tests continuously
npm run test:watch{
"typescript.preferences.importModuleSpecifier": "relative",
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.autoFixOnSave": true,
"files.exclude": {
"**/node_modules": true,
"**/dist": true,
"**/.DS_Store": true
}
}- TypeScript Hero: Import organization
- ESLint: Code linting
- Prettier: Code formatting
- GitLens: Git integration
- Thunder Client: API testing
dataweave/
βββ src/ # Source code
β βββ cli.ts # Main CLI entry point
β βββ scaffolding/ # Project scaffolding engine
β βββ dbt/ # DBT integration
β βββ dagster/ # Dagster integration
β βββ ai/ # AI/LLM integration
β βββ utils/ # Shared utilities
βββ tests/ # Test files
βββ docs/ # Documentation
βββ dist/ # Compiled JavaScript
βββ examples/ # Example projects
- Command registration and parsing
- Global error handling
- User interface (progress bars, styling)
- Command routing and execution
- Template-based project generation
- Configuration file creation
- Directory structure setup
- Initial file content generation
- Model generation and management
- SQL template processing
- Schema.yml management
- DBT command execution
- Asset creation and management
- Job definition generation
- Python code templating
- Pipeline validation
- LLM provider abstraction
- Prompt engineering
- Code generation and analysis
- Response parsing and validation
- Modularity: Each component should be independently testable
- Extensibility: Easy to add new integrations and features
- Type Safety: Comprehensive TypeScript coverage
- Error Handling: Graceful failure with helpful messages
- Performance: Fast execution and minimal resource usage
- Create Issue: Describe the feature/bug with clear requirements
- Design Discussion: Discuss approach in issue comments
- Break Down: Split large features into smaller tasks
- Branch Creation: Use descriptive branch names
- Incremental Development: Make small, focused commits
- Testing: Write tests alongside implementation
- Documentation: Update docs as you develop
- Self Review: Test thoroughly before submitting
- Pull Request: Create PR with detailed description
- Code Review: Address feedback constructively
- Integration: Ensure CI passes before merge
# Feature branches
feature/ai-code-optimization
feature/supabase-integration
# Bug fixes
fix/model-generation-error
fix/memory-leak-dagster
# Documentation
docs/api-reference-update
docs/contributing-guide
# Refactoring
refactor/dbt-manager-cleanup
refactor/error-handlingtype(scope): description
[optional body]
[optional footer]
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Test changeschore: Build process or auxiliary tool changes
Examples:
feat(ai): add code optimization suggestions
fix(dbt): resolve model generation path issues
docs(api): update command reference
refactor(cli): improve error handling consistency// Use interfaces for object shapes
interface DbtModelOptions {
name: string;
sql?: string;
description?: string;
materializedAs?: 'view' | 'table' | 'incremental';
tags?: string[];
}
// Use type aliases for unions and primitives
type AIProvider = 'openai' | 'anthropic' | 'local';
type LogLevel = 'debug' | 'info' | 'warn' | 'error';// Clear parameter types and return types
async function generateDbtModel(
options: DbtModelOptions
): Promise<{ success: boolean; filePath: string }> {
// Implementation
}
// Use optional parameters appropriately
function createAsset(
name: string,
description?: string,
dependencies: string[] = []
): Promise<void> {
// Implementation
}// Custom error classes
class DataweaveError extends Error {
constructor(
message: string,
public code: string,
public details?: Record<string, unknown>
) {
super(message);
this.name = 'DataweaveError';
}
}
// Consistent error handling
try {
await riskyOperation();
} catch (error) {
throw new DataweaveError(
'Operation failed',
'OPERATION_FAILED',
{ originalError: error }
);
}// Variables and functions: camelCase
const projectName = 'my-project';
const generateModel = () => {};
// Classes: PascalCase
class DbtManager {}
class ProjectScaffolder {}
// Constants: SCREAMING_SNAKE_CASE
const DEFAULT_PORT = 3000;
const MAX_RETRY_ATTEMPTS = 3;
// Files: kebab-case
// dbt-manager.ts, project-scaffolder.ts// 1. Node.js built-in modules
import { join, resolve } from 'path';
import { readFile, writeFile } from 'fs/promises';
// 2. Third-party modules
import chalk from 'chalk';
import ora from 'ora';
import { Command } from 'commander';
// 3. Internal modules (relative imports)
import { DbtManager } from './dbt';
import { ProjectScaffolder } from './scaffolding';
import { AIEngine } from './ai';// Group related functionality
export class DbtManager {
// 1. Properties
private projectPath: string;
private modelsDir: string;
// 2. Constructor
constructor(options: DbtManagerOptions) {
this.projectPath = options.projectPath;
this.modelsDir = options.modelsDir;
}
// 3. Public methods
async generateModel(options: DbtModelOptions): Promise<void> {
// Implementation
}
// 4. Private methods
private getModelPath(name: string): string {
// Implementation
}
}// .eslintrc.js
module.exports = {
extends: [
'@typescript-eslint/recommended',
'prettier'
],
rules: {
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/explicit-function-return-type': 'warn',
'prefer-const': 'error',
'no-var': 'error'
}
};// .prettierrc
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 2
}import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { DbtManager } from '../src/dbt';
describe('DbtManager', () => {
let manager: DbtManager;
let tempDir: string;
beforeEach(async () => {
// Setup test environment
tempDir = await createTempDir();
manager = new DbtManager({ projectPath: tempDir });
});
afterEach(async () => {
// Cleanup
await removeTempDir(tempDir);
});
describe('generateModel', () => {
it('should create basic DBT model', async () => {
// Arrange
const options = { name: 'test_model' };
// Act
await manager.generateModel(options);
// Assert
const modelPath = join(tempDir, 'models', 'staging', 'test_model.sql');
expect(await fileExists(modelPath)).toBe(true);
});
it('should handle invalid model names', async () => {
// Arrange
const options = { name: 'invalid-model-name!' };
// Act & Assert
await expect(manager.generateModel(options))
.rejects
.toThrow('Invalid model name');
});
});
});- Isolation: Each test should be independent
- Descriptive Names: Test names should explain the scenario
- AAA Pattern: Arrange, Act, Assert
- Edge Cases: Test error conditions and boundaries
- Mocking: Mock external dependencies appropriately
- Overall Coverage: > 85%
- Function Coverage: > 90%
- Branch Coverage: > 80%
- Statement Coverage: > 85%
/**
* Generates a new DBT model with intelligent directory placement
* @param options - Model generation options
* @returns Promise resolving to generation result
* @throws DataweaveError when model creation fails
* @example
* ```typescript
* await manager.generateModel({
* name: 'user_metrics',
* materializedAs: 'table',
* description: 'User engagement metrics'
* });
* ```
*/
async generateModel(options: DbtModelOptions): Promise<GenerationResult> {
// Implementation
}- API Reference: Complete command documentation
- Getting Started: Setup and basic usage
- Examples: Real-world use cases
- Architecture: Technical design decisions
- Contributing: Development guidelines (this document)
- Use clear, concise language
- Include practical examples
- Keep information up-to-date
- Cross-reference related sections
- Use consistent formatting
-
Create Pull Request
# Push your branch git push origin feature/your-feature # Create pull request on GitHub # Use the PR template
-
PR Description Template
## Summary Brief description of changes ## Changes Made - Feature/fix 1 - Feature/fix 2 ## Testing - [ ] Unit tests pass - [ ] Integration tests pass - [ ] Manual testing completed ## Documentation - [ ] Updated relevant documentation - [ ] Added code comments where needed ## Breaking Changes List any breaking changes ## Screenshots (if applicable) Add screenshots for UI changes
-
Review Process
- Automated checks must pass
- At least one maintainer review required
- Address feedback promptly
- Squash commits if requested
- Tests added/updated for new functionality
- Documentation updated
- Code follows style guidelines
- No breaking changes (or properly documented)
- CI checks pass
- Self-review completed
We follow Semantic Versioning:
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
-
Version Bump
npm version [patch|minor|major]
-
Update Changelog
- Document all changes
- Categorize by type (Features, Fixes, Breaking Changes)
- Include migration guide for breaking changes
-
Create Release
git tag v1.2.3 git push origin v1.2.3
-
Publish to NPM
npm publish
-
GitHub Release
- Create release on GitHub
- Include changelog
- Attach binaries if needed
- Breaking API changes
- Major feature additions
- Architecture changes
- Migration guide required
- New features
- Enhanced functionality
- Backward compatible changes
- No breaking changes
- Bug fixes
- Security patches
- Performance improvements
- Documentation updates
We are committed to providing a welcoming and inclusive environment. Please:
- Be respectful and considerate
- Use inclusive language
- Accept constructive feedback gracefully
- Focus on what's best for the community
- Show empathy towards other contributors
- GitHub Issues: Bug reports and feature requests
- GitHub Discussions: General questions and ideas
- Pull Requests: Code review and collaboration
- Email: security@openconjecture.com for security issues
- Documentation: Check existing docs first
- Search Issues: Your question may already be answered
- Create Issue: Use appropriate templates
- Discussion: For general questions and ideas
Contributors are recognized through:
- Contributor list in README
- Release notes mentions
- GitHub contributor graphs
- Community highlights
- Core Features: CLI commands and functionality
- Integrations: DBT, Dagster, Supabase improvements
- AI Features: Code generation and analysis
- Testing: Comprehensive test coverage
- Documentation: User guides and examples
Look for issues labeled:
good first issue: Perfect for newcomershelp wanted: Community assistance neededdocumentation: Docs improvementstests: Testing enhancements
- New integrations (Airflow, Snowflake, etc.)
- Performance optimizations
- Architecture improvements
- Security enhancements
Thank you for contributing to Dataweave! Your contributions help make modern data pipeline development more accessible and efficient for everyone.
Questions? Feel free to reach out through GitHub issues or discussions. We're here to help and excited to see what you'll build! π