Contributing to Jta
October 24, 2025 ยท View on GitHub
Thank you for your interest in contributing to Jta! This document provides guidelines and instructions for contributing.
๐ Ways to Contribute
There are many ways to contribute to Jta:
- ๐ Report bugs: Found an issue? Let us know!
- ๐ก Suggest features: Have an idea? We'd love to hear it!
- ๐ Improve documentation: Help others understand Jta better
- ๐ง Fix bugs: Pick an issue and submit a PR
- โจ Add features: Implement new capabilities
- ๐งช Write tests: Improve test coverage
- ๐ Translate: Help translate Jta's own messages
๐ Getting Started
Prerequisites
- Go 1.25+: Install Go
- Git: Install Git
- AI Provider API Key: For testing (OpenAI, Anthropic, or Google)
Development Setup
-
Fork the repository
Click the "Fork" button on GitHub to create your own copy.
-
Clone your fork
git clone https://github.com/YOUR_USERNAME/jta.git cd jta -
Add upstream remote
git remote add upstream https://github.com/hikanner/jta.git -
Install dependencies
go mod download -
Set up environment variables
export OPENAI_API_KEY=sk-... # Or use .env file (not tracked in git) echo "OPENAI_API_KEY=sk-..." > .env -
Run tests
go test ./... -
Build the project
go build -o jta cmd/jta/main.go -
Try it out
./jta examples/en.json --to zh
๐ Development Workflow
Creating a Feature Branch
Always create a new branch for your work:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fix
Branch naming conventions:
feature/- New featuresfix/- Bug fixesdocs/- Documentation changestest/- Test additions or modificationsrefactor/- Code refactoringperf/- Performance improvements
Making Changes
-
Write clean, readable code
- Follow Go conventions and best practices
- Use meaningful variable and function names
- Add comments for complex logic
- Keep functions focused and small
-
Add tests
- Write unit tests for new functions
- Ensure existing tests still pass
- Aim for high test coverage (target: 60%+)
-
Update documentation
- Update README.md if adding user-facing features
- Add godoc comments for exported functions
- Update CHANGELOG.md (if exists)
Code Style
We follow standard Go formatting:
# Format your code
gofmt -w .
# Run linter
golangci-lint run
# Check for common issues
go vet ./...
Testing
Running Tests
# Run all tests
go test ./...
# Run tests with coverage
go test -cover ./...
# Run tests with detailed coverage
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
# Run specific package tests
go test ./internal/translator/...
# Run with verbose output
go test -v ./...
Writing Tests
Follow these guidelines:
- Test file naming:
*_test.go - Test function naming:
Test<FunctionName> - Table-driven tests for multiple scenarios:
func TestTranslate(t *testing.T) {
tests := []struct {
name string
input string
expected string
wantErr bool
}{
{
name: "simple translation",
input: "Hello",
expected: "ไฝ ๅฅฝ",
wantErr: false,
},
// More test cases...
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result, err := Translate(tt.input)
if (err != nil) != tt.wantErr {
t.Errorf("Translate() error = %v, wantErr %v", err, tt.wantErr)
return
}
if result != tt.expected {
t.Errorf("Translate() = %v, want %v", result, tt.expected)
}
})
}
}
Committing Changes
We follow Conventional Commits:
<type>(<scope>): <subject>
<body>
<footer>
Types:
feat: New featurefix: Bug fixdocs: Documentation changestest: Adding or updating testsrefactor: Code refactoringperf: Performance improvementschore: Maintenance tasksci: CI/CD changes
Examples:
# Feature
git commit -m "feat(translator): add support for custom prompts"
# Bug fix
git commit -m "fix(format): preserve markdown bold syntax in translations"
# Documentation
git commit -m "docs(readme): add troubleshooting section"
# Multiple changes
git commit -m "feat(reflection): optimize quality check algorithm
- Reduce API calls by 30%
- Add batch processing for issues
- Improve error handling
Closes #123"
Submitting a Pull Request
-
Update your branch
git fetch upstream git rebase upstream/main -
Push to your fork
git push origin feature/your-feature-name -
Create Pull Request
- Go to the original repository on GitHub
- Click "New Pull Request"
- Select your fork and branch
- Fill in the PR template
-
PR Checklist
- Tests pass (
go test ./...) - Code is formatted (
gofmt -w .) - Documentation is updated
- Commit messages follow conventions
- PR description explains changes clearly
- Linked to related issues (if any)
- Tests pass (
PR Review Process
- Automated checks run (tests, linting)
- Maintainers review your code
- Address feedback if requested
- Approval by at least one maintainer
- Merge by maintainer
๐๏ธ Project Structure
Understanding the codebase:
jta/
โโโ cmd/
โ โโโ jta/
โ โโโ main.go # CLI entry point
โโโ internal/
โ โโโ cli/ # Command-line interface
โ โ โโโ app.go # Main application logic
โ โ โโโ root.go # Cobra root command
โ โโโ domain/ # Domain models
โ โ โโโ language.go # Language definitions
โ โ โโโ terminology.go # Terminology models
โ โ โโโ translation.go # Translation models
โ โโโ provider/ # AI provider implementations
โ โ โโโ openai.go # OpenAI integration
โ โ โโโ anthropic.go # Anthropic integration
โ โ โโโ google.go # Google Gemini integration
โ โโโ translator/ # Translation engine
โ โ โโโ engine.go # Core translation logic
โ โ โโโ batch.go # Batch processor
โ โ โโโ reflection.go # Reflection mechanism โญ
โ โโโ terminology/ # Terminology management
โ โ โโโ manager.go # Terminology manager
โ โ โโโ detector.go # LLM-based detection
โ โ โโโ repository.go # JSON storage
โ โโโ format/ # Format protection
โ โ โโโ protector.go # Format element preservation
โ โโโ incremental/ # Incremental translation
โ โ โโโ translator.go # Diff analysis
โ โโโ keyfilter/ # Key filtering
โ โ โโโ filter.go # Filter logic
โ โ โโโ matcher.go # Pattern matching
โ โโโ rtl/ # RTL language support
โ โ โโโ processor.go # Bidirectional text handling
โ โโโ ui/ # Terminal UI
โ โ โโโ styles.go # Lipgloss styles
โ โ โโโ printer.go # Styled output
โ โโโ utils/ # Utilities
โ โโโ json.go # JSON helpers
โโโ examples/ # Example files
โ โโโ en.json # Sample source file
โโโ go.mod # Go modules
โโโ go.sum # Dependencies
โโโ README.md # Main documentation
โโโ CONTRIBUTING.md # This file
โโโ LICENSE # MIT License
โโโ EXECUTION_PLAN.md # Development roadmap
๐ฏ Areas Needing Help
Current priorities:
High Priority
- Provider tests: Add unit tests for AI provider implementations
- Terminology tests: Test terminology detection and management
- Integration tests: End-to-end translation workflows
- Error handling: Improve error messages and recovery
Medium Priority
- Performance optimization: Profile and optimize hot paths
- Memory efficiency: Reduce memory usage for large files
- Better progress indicators: Real-time translation progress
- Configuration file support: YAML/TOML config files
Low Priority
- Additional providers: Azure OpenAI, local models
- Alternative formats: YAML, XML, PO file support
- Translation memory: TMX integration
- Web UI: Browser-based interface
๐ Bug Reports
Before Submitting
- Search existing issues to avoid duplicates
- Try the latest version to see if it's already fixed
- Collect information:
- Jta version (
jta --version) - Go version (
go version) - Operating system
- Steps to reproduce
- Expected vs actual behavior
- Error messages and logs
- Jta version (
Bug Report Template
## Bug Description
A clear description of what the bug is.
## To Reproduce
Steps to reproduce the behavior:
1. Run command '...'
2. With file '...'
3. See error
## Expected Behavior
What you expected to happen.
## Actual Behavior
What actually happened.
## Environment
- Jta version: x.y.z
- Go version: 1.25.0
- OS: macOS 14.0
- Provider: OpenAI GPT-4o
## Logs
Paste relevant error messages or logs here
## Additional Context
Any other context about the problem.
๐ก Feature Requests
Before Requesting
- Search existing issues to see if it's already requested
- Consider if it fits the project's goals
- Think about implementation complexity
Feature Request Template
## Feature Description
A clear description of the feature you'd like.
## Use Case
Explain why this feature would be useful.
Example scenarios where you'd use it.
## Proposed Solution
How you envision this working.
## Alternatives Considered
Other approaches you've thought about.
## Additional Context
Mockups, examples, or references.
๐ Documentation
Documentation improvements are always welcome!
Types of Documentation
- README.md: User-facing documentation
- Code comments: Inline documentation (godoc)
- Wiki: Detailed guides and tutorials
- Examples: Sample code and usage patterns
Writing Guidelines
- Use clear, simple language
- Include code examples
- Add screenshots/GIFs for UI features
- Keep it up-to-date with code changes
๐ค Code Review
For Contributors
- Be patient and respectful
- Be open to feedback
- Ask questions if unclear
- Don't take criticism personally
- Learn from the review process
For Reviewers
- Be constructive and helpful
- Explain why changes are needed
- Suggest alternatives
- Acknowledge good work
- Be timely in responses
๐ Code of Conduct
Our Standards
- Be respectful: Treat everyone with respect
- Be inclusive: Welcome diverse perspectives
- Be collaborative: Work together constructively
- Be professional: Maintain professionalism
Unacceptable Behavior
- Harassment or discrimination
- Trolling or insulting comments
- Personal or political attacks
- Publishing private information
- Other unprofessional conduct
Enforcement
Violations may result in:
- Warning
- Temporary ban
- Permanent ban
Report issues to: conduct@example.com
๐ Learning Resources
Go Programming
AI/LLM Integration
Testing
๐ฌ Communication
Channels
- GitHub Issues: Bug reports and feature requests
- GitHub Discussions: General questions and ideas
- Pull Requests: Code contributions and reviews
Getting Help
- Check the README first
- Search existing issues
- Ask in Discussions
๐ Thank You!
Every contribution, no matter how small, helps make Jta better. We appreciate your time and effort!
Questions? Feel free to ask in Discussions
Happy Contributing! ๐