# Contributing to Stack 2.9 Thank you for your interest in contributing to Stack 2.9! This document provides guidelines and instructions for contributing to the project. ## Table of Contents - [Code of Conduct](#code-of-conduct) - [Getting Started](#getting-started) - [Development Setup](#development-setup) - [Code Style](#code-style) - [Making Changes](#making-changes) - [Submitting Pull Requests](#submitting-pull-requests) - [Writing Tests](#writing-tests) - [Documentation Guidelines](#documentation-guidelines) - [Bug Reports](#bug-reports) - [Feature Requests](#feature-requests) --- ## Code of Conduct By participating in this project, you agree to maintain a respectful and inclusive environment for everyone. **Our Standards:** - Be kind and respectful in all interactions - Accept constructive criticism gracefully - Focus on what is best for the community - Show empathy towards other community members **Unacceptable Behavior:** - Harassment, discrimination, or intimidation - Personal attacks or derogatory remarks - Publishing others' private information without permission - Other conduct that could reasonably be considered inappropriate --- ## Getting Started ### Fork the Repository 1. Fork the repository on GitHub 2. Clone your fork locally: ```bash git clone https://github.com/YOUR_USERNAME/stack-2.9.git cd stack-2.9 # Add upstream remote git remote add upstream https://github.com/openclaw/stack-2.9.git ``` ### Stay Updated ```bash # Fetch latest changes from upstream git fetch upstream # Merge into your main branch git checkout main git merge upstream/main # Update your feature branch git checkout your-feature-branch git rebase main ``` --- ## Development Setup ### Prerequisites - Python 3.8+ (3.11+ recommended) - Node.js 18+ (20 LTS recommended) - Git - GPU for model-related testing (optional but recommended) ### Environment Setup ```bash # Create virtual environment python -m venv .venv source .venv/bin/activate # Linux/macOS # .venv\Scripts\activate # Windows # Install dependencies pip install -r requirements.txt # Install development dependencies pip install -e ".[dev]" # Install pre-commit hooks pre-commit install # Install Node.js dependencies (for voice features) npm install ``` ### Verify Installation ```bash # Run tests pytest # Check code formatting make lint # Run type checking mypy stack_cli/ ``` ### IDE Setup **VS Code:** ```json // .vscode/settings.json { "python.defaultInterpreterPath": ".venv/bin/python", "python.linting.enabled": true, "python.linting.pylintEnabled": true, "python.formatting.provider": "black", "editor.formatOnSave": true, "editor.rulers": [100], "files.exclude": { "**/__pycache__": true, "**/*.pyc": true, ".venv": true } } ``` **PyCharm:** 1. Settings → Project → Python Interpreter → Add → Existing Environment 2. Select `.venv/bin/python` 3. Enable Black for formatting in Settings → Python → Formatting → Black --- ## Code Style ### Python We follow PEP 8 with some modifications: - Line length: 100 characters (not 79) - Use type hints where possible - Docstrings for all public functions and classes **Style Guide:** ```python """ Module docstring describing the module's purpose. """ from typing import List, Optional, Dict from dataclasses import dataclass @dataclass class ExampleClass: """Class docstring describing the class. Attributes: name: The name of the example. value: The value of the example. """ name: str value: int def __post_init__(self): """Validate after initialization.""" if self.value < 0: raise ValueError("Value must be non-negative") def process(self, data: List[str]) -> Dict[str, int]: """Process data and return results. Args: data: List of strings to process. Returns: Dictionary mapping strings to their lengths. Raises: ValueError: If data is empty. """ if not data: raise ValueError("Data cannot be empty") return {item: len(item) for item in data} ``` ### JavaScript/TypeScript ```typescript /** * Interface for a user configuration. */ interface UserConfig { /** User's display name */ name: string; /** User's email address */ email: string; /** Whether the user is enabled */ enabled: boolean; } /** * Process user configuration and return formatted string. * * @param config - The user configuration * @returns Formatted configuration string */ export function formatConfig(config: UserConfig): string { const { name, email, enabled } = config; if (!enabled) { return `${name} (disabled)`; } return `${name} <${email}>`; } ``` ### Shell Scripts ```bash #!/usr/bin/env bash set -euo pipefail # Constant for the application name readonly APP_NAME="stack-2.9" readonly LOG_DIR="/var/log/${APP_NAME}" # Main function main() { log "Starting ${APP_NAME}..." # Implementation here } # Logging function log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" } # Run main main "$@" ``` --- ## Making Changes ### Create a Branch ```bash # Start from an updated main branch git checkout main git pull upstream main # Create a new feature branch git checkout -b feature/your-feature-name # Or for bug fixes git checkout -b fix/issue-number-description # Or for documentation git checkout -b docs/improvement-description ``` ### Branch Naming Conventions | Type | Pattern | Example | |------|---------|---------| | Feature | `feature/` | `feature/voice-integration` | | Bug Fix | `fix/-` | `fix/123-memory-leak` | | Documentation | `docs/` | `docs/api-reference` | | Refactoring | `refactor/` | `refactor/tool-execution` | | Testing | `test/` | `test/improve-coverage` | ### Making Commits ```bash # Stage changes git add path/to/changed/file.py # Commit with a descriptive message git commit -m "Add voice cloning support to the tool system - Added speech_to_text and text_to_speech tools - Implemented voice_clone tool for custom voice synthesis - Added voice processing pipeline with Coqui TTS - Updated documentation with voice examples Closes: #123" ``` ### Commit Message Format ``` ():