Skip to main content

Commit Message Format

All commits to Bifrost should follow a standardized format. This ensures clear history and makes it easy to understand changes at a glance.

Format

Types

  • feat - New feature
  • fix - Bug fix
  • refactor - Code refactoring (no feature change, no bug fix)
  • docs - Documentation changes
  • test - Test changes
  • chore - Build, dependencies, tooling changes
  • perf - Performance improvements

Key Rule: Always List Affected Packages

For every commit, explicitly mention all packages/directories that were modified. This is crucial for understanding the scope of changes.

Examples

Good:
Better (if changes are significant to multiple packages):

Go Code Conventions

Style Guidelines

  1. Follow standard Go conventions
    • Use gofmt for formatting
    • Run make fmt before committing
  2. Naming
    • Use meaningful variable names
    • Avoid single letters except in loops
    • Use camelCase for variables and functions
    • Use PascalCase for exported types
  3. Comments
    • Comment exported functions and types
    • Use clear, concise comments
    • Explain why, not what
  4. Error Handling
    • Always check and handle errors
    • Provide context in error messages
    • Don’t ignore errors with _

Structure

Documentation

Each package should have:
  • A package comment
  • Exported function/type comments
  • Complex logic explanations

TypeScript/React Code Conventions

Style Guidelines

  1. Use TypeScript - Avoid any types when possible
  2. Use functional components - No class components
  3. Props interface
  4. Naming
    • Components: PascalCase
    • Functions/variables: camelCase
    • Constants: UPPER_SNAKE_CASE

Structure

Testing Conventions

Go Tests

  1. Test file naming: *_test.go
  2. Test function naming: Test<FunctionName>
  3. Table-driven tests for multiple cases

Running Tests

Documentation Conventions

MDX Files

  1. Front matter
  2. Headings - Use H2 (##) as top level in body
  3. Code blocks - Always include language: ```go
  4. Links - Use relative paths: /features/caching

Examples

This is important information that needs highlighting.

Benefits

  • Reduces costs by 30-40%
  • Improves latency for similar queries
[type]: description @Your Name
File locations:
  • core/changelog.md
  • framework/changelog.md
  • transports/changelog.md
  • plugins/{plugin-name}/changelog.md

Code Quality Standards

Before submitting code:

Go Code

TypeScript/React

  • Use ESLint configuration from project
  • Run npm run format for formatting
  • Ensure TypeScript compilation succeeds

Key Principles

  1. Clarity - Code should be easy to understand
  2. Consistency - Follow existing patterns in codebase
  3. Testing - All code should have tests
  4. Documentation - Document public APIs and complex logic
  5. Simplicity - Avoid over-engineering
  6. Performance - Consider performance implications of changes

Common Pitfalls

Don’t:
  • Submit PRs without running tests
  • Use fmt.Println for logging (use logger)
  • Ignore error handling
  • Create huge functions (>100 lines)
  • Mix refactoring with feature changes
  • Forget to list affected packages in commit messages
Do:
  • Run make test-all before opening PR
  • Use structured logging
  • Handle all error cases
  • Keep functions focused and testable
  • Make logical, focused commits
  • Always mention affected packages and changes

Getting Help