# Contributing to EigenFlux Thank you for your interest in contributing to EigenFlux! 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 Guidelines](#code-style-guidelines) - [Commit Message Guidelines](#commit-message-guidelines) - [Pull Request Process](#pull-request-process) - [Testing Guidelines](#testing-guidelines) - [Issue Reporting](#issue-reporting) ## Code of Conduct This project adheres to the Contributor Covenant [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. ## Getting Started ### Types of Contributions We welcome various types of contributions: - **Bug Reports**: Help us identify and fix issues - **Feature Requests**: Suggest new features or improvements - **Code Contributions**: Submit bug fixes or new features - **Documentation**: Improve or translate documentation - **Testing**: Write tests or improve test coverage - **Code Review**: Review pull requests from other contributors ### Before You Start 1. Check existing [issues](../../issues) and [pull requests](../../pulls) to avoid duplication 2. For major changes, open an issue first to discuss your proposal 3. Read through this contributing guide and the project documentation ## Development Setup ### Prerequisites - **Go**: >= 1.25 - **Docker**: For running infrastructure services ### Local Environment Setup See [README.md](./README.md#setup) ### Development Workflow 1. Create a feature branch from `main` 2. Make your changes 3. Write or update tests 4. Run tests locally 5. Commit your changes 6. Push to your fork 7. Open a pull request ## Code Style Guidelines ### Go Code Style Follow standard Go conventions and best practices: - **Formatting**: Use `gofmt` or `goimports` before committing ```bash gofmt -w . goimports -w . ``` - **Linting**: Run `golangci-lint` to catch common issues ```bash golangci-lint run ``` - **Naming Conventions**: - Use `camelCase` for unexported names - Use `PascalCase` for exported names - Use descriptive names (avoid single-letter variables except in short scopes) - Interface names should end with `-er` when possible (e.g., `Reader`, `Writer`) - **Error Handling**: - Always check and handle errors - Wrap errors with context using `fmt.Errorf("context: %w", err)` - Don't ignore errors with `_` unless absolutely necessary - **Comments**: - Add comments for all exported functions, types, and constants - Use complete sentences with proper punctuation - Explain *why*, not *what* (code should be self-explanatory) - Example: ```go // CalculateScore computes the relevance score between a user profile // and an item based on keyword matching and domain overlap. func CalculateScore(profile *Profile, item *Item) float64 { // ... } ``` - **Package Organization**: - Keep packages focused and cohesive - Avoid circular dependencies - Use internal packages for code that shouldn't be imported externally ### Project-Specific Conventions - **Database Time Fields**: Use `int64` Unix millisecond timestamps, not `time.Time` - **ID Fields**: Use `BIGINT/i64` internally, return strings in HTTP JSON responses - **String Storage**: Store comma-separated values for keywords and domains - **Status Codes**: Use `0=pending, 1=processing, 2=failed, 3=completed, 4=discarded` - **API Response Format**: All responses must include `code` (0=success) and `msg` fields ## Commit Message Guidelines We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. ### Format ``` ():