Thanks for your interest in contributing! This guide will help you get set up and familiar with how the project works.
# Clone the repo
git clone https://github.com/dhaveed/diffr.git
cd diffr
# Install dependencies
pnpm install
# Run the test suite
pnpm test
# Run the full check (typecheck + lint + test + build)
pnpm typecheck && pnpm lint && pnpm test && pnpm buildsrc/
├── action/ # GitHub Action entry point
├── config/ # Configuration loading & validation
├── core/ # GitHub client, change collection & analysis
├── llm/ # LLM providers, prompt building, fallback
├── publisher/ # GitHub Release creation
├── versioning/ # Semver resolution
├── utils/ # Logger, retry, formatting
├── orchestrator.ts # Main pipeline
└── types.ts # Shared TypeScript interfaces
tests/
├── unit/ # Unit tests
├── integration/ # Full pipeline tests with mocked APIs
└── fixtures/ # Mock data for GitHub & LLM responses
| Command | What it does |
|---|---|
pnpm build |
Bundle to dist/ with ncc |
pnpm typecheck |
Run TypeScript type checking |
pnpm lint |
Lint src/ and tests/ with ESLint |
pnpm test |
Run all tests with Vitest |
pnpm test:watch |
Run tests in watch mode |
pnpm test:coverage |
Generate coverage report |
The project uses Husky to enforce quality checks:
- pre-commit — runs
typecheckandlint-staged(auto-fixes lint issues on staged.tsfiles) - pre-push — runs the full check:
typecheck→lint→test→build
These run automatically. If a hook fails, fix the issue before committing/pushing.
- Fork the repo and create a branch from
main - Make your changes — keep commits focused and use Conventional Commits where possible (e.g.
feat: add Groq provider,fix: handle empty changelogs) - Add or update tests for any new or changed behavior
- Run the full check before pushing:
pnpm typecheck && pnpm lint && pnpm test && pnpm build
- Commit
dist/— since this is a GitHub Action, the built output must be checked in. The CI will fail ifdist/is out of date. - Open a pull request against
main
After making changes to source code, you must rebuild:
pnpm buildThis bundles everything into dist/index.js using @vercel/ncc. Always commit the updated dist/ with your changes — CI verifies it's up to date.
Tests use Vitest with globals enabled (describe, it, expect are available without imports).
- Unit tests go in
tests/unit/ - Integration tests go in
tests/integration/ - Fixtures (mock data) go in
tests/fixtures/
Run a specific test file:
pnpm test tests/unit/orchestrator.test.ts- TypeScript strict mode
- ESLint with
@typescript-eslintrules - Unused variables prefixed with
_are allowed - No explicit return types required (inferred)
anytriggers a warning — prefer proper types
Lint-staged runs ESLint with --fix on commit, so most style issues are corrected automatically.
The LLM layer uses a provider interface pattern. To add a new provider:
- Create
src/llm/your-provider.tsimplementing theLLMProviderinterface fromsrc/types.ts - Register it in
src/llm/provider-factory.ts - Add default model config in
src/config/defaults.ts - Add tests covering the new provider
- Update the README with usage examples
- Check existing issues first
- Include the workflow YAML and error output when reporting bugs
- For feature requests, describe the use case and expected behavior
By contributing, you agree that your contributions will be licensed under the MIT License.