Thank you for your interest in contributing to xk6-ai! This document provides guidelines for contributing to this k6 extension project.
- Go 1.21 or later
- xk6 tool installed
- Git configured with your credentials
- Basic understanding of k6 and Go development
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/your-username/xk6-ai.git cd xk6-ai - Install dependencies:
go mod download
- Run tests to ensure everything works:
go test ./...
The project includes a comprehensive Makefile with targets for common development tasks:
# Install development tools (golangci-lint, xk6, gosec, govulncheck, act)
make install-tools
# Code quality
make fmt # Format code
make lint # Run linting
make lint-fix # Auto-fix linting issues
make security # Run security scans
# Testing
make test # Run unit tests
make test-coverage # Run tests with coverage
make test-race # Run tests with race detection
# Building
make build # Build k6 extension
make build-local # Build from local source
# CI testing with act
make ci-test # Run test job locally
make ci-lint # Run lint job locally
make ci-all # Run all CI jobs locally
# Full validation
make release-test # Run all CI checks
make release-check # Full release validationmake install-tools- Install required toolsmake fmt lint test- Format, lint, and testmake ci-all- Run full CI locallymake release-check- Final validation before PR
- All changes require peer review before merging
- Review for constitution compliance (see AGENTS.md)
- Check test coverage and quality
- Verify security best practices are followed
- Ensure documentation is updated appropriately
- Use GitHub Issues for bug reports and feature requests
- Follow conventional commit messages for clear history
- Link issues to specifications when applicable (spec-driven development)
- Maintain clear issue templates and descriptions
- Use appropriate labels for issue categorization
- Use feature branches for all development work
- Follow conventional branch naming (e.g.,
feature/llm-integration,fix/memory-leak) - Keep branches focused and atomic (one feature/fix per branch)
- Regular integration with main branch to avoid conflicts
- Delete feature branches after successful merge
Follow conventional commit format:
type(scope): description
[optional body]
[optional footer]
Types: feat, fix, docs, style, refactor, test, chore
Examples:
feat(llm): add OpenAI integrationfix(memory): resolve goroutine leak in clientdocs(api): update README with usage examples
This project follows spec-driven development principles:
- Clarify: Use structured clarification workflow before planning
- Specify: Create detailed specifications in
.specify/specs/ - Plan: Generate implementation plans with technical details
- Implement: Follow TDD approach with spec-kit implementation commands
- Validate: Ensure compliance with constitution and specifications
- Write unit tests for all public functions
- Use table-driven tests for multiple test cases
- Aim for high test coverage, especially for critical business logic
- Include smoke tests in
test/smoke.test.js - Run
xk6 lintto check extension compliance
- Use
gofmtandgoimportsfor formatting - Follow Go naming conventions
- Keep functions short and focused
- Write self-documenting code with clear comments
- Use
golangci-lintfor static analysis
- Use
xk6 build --with github.com/grafana/xk6-ai@latestfor testing - Ensure compatibility with target k6 versions
- Test with
xk6 lintfor compliance checking (target grade C or higher)
go.mod- Valid Go module definitionREADME.md- Comprehensive project documentationLICENSE- Acceptable open source licenseexamples/- Usage examples directorytest/smoke.test.js- Working smoke testdocs/index.d.ts- TypeScript API declarations
Before submitting PRs, ensure:
-
xk6 lintpasses with grade C or higher - All tests pass (
go test ./...) - Smoke test runs successfully
- Documentation is updated
- Examples are provided for new features
- Security scan passes (
gosec,govulncheck)
- Create a feature branch from
main - Make your changes following the guidelines above
- Write tests for new functionality
- Update documentation as needed
- Run compliance checks (
xk6 lint, tests, security scans) - Create a pull request with:
- Clear description of changes
- Reference to related issues
- Screenshots for UI changes
- Test results and compliance scores
Reviewers will check for:
- Code quality and style compliance
- Test coverage and quality
- Documentation completeness
- Security best practices
- Performance considerations
- k6 extension compliance
When reporting bugs, please include:
- k6 version and xk6-ai version
- Operating system and architecture
- Steps to reproduce
- Expected vs actual behavior
- Error messages and logs
- Minimal test case if possible
For feature requests, please include:
- Use case description
- Proposed solution
- Alternative solutions considered
- Impact assessment
This project follows the Contributor Covenant Code of Conduct. Please be respectful and constructive in all interactions.
- Check existing issues and discussions
- Join the k6 community Discord/Slack
- Create a new issue for questions
- Review the AGENTS.md file for development guidelines
By contributing to xk6-ai, you agree that your contributions will be licensed under the same license as the project (see LICENSE file).
Thank you for contributing to xk6-ai! Your contributions help make this project better for everyone.