|
1 | | -# AGENTS.md |
2 | | - |
3 | | -TODO |
| 1 | +# Development Guide |
4 | 2 |
|
5 | 3 | ## Project Overview |
6 | 4 |
|
7 | | -GitHub Action that evaluates PR contributor quality using objective GitHub metrics to combat AI-generated spam. Analyzes |
8 | | -user's contribution history and calculates a score (0-1000) based on PR merge rate, contributions to quality repos, |
9 | | -community engagement, and more. |
| 5 | +**Contributor Report** is a GitHub Action that evaluates PR contributor quality using objective GitHub metrics to combat |
| 6 | +AI-generated spam PRs (also known as "AI slop" or "slop code"). It analyzes a contributor's GitHub activity history and |
| 7 | +calculates scores based on PR merge rate, contributions to quality repositories, community engagement, and behavioral |
| 8 | +patterns. |
| 9 | + |
| 10 | +The goal is to help open source maintainers identify low-quality, spam, or AI-generated contributions that waste |
| 11 | +maintainer time and resources, while being fair to legitimate contributors, especially newcomers. |
10 | 12 |
|
11 | 13 | ## Common Commands |
12 | 14 |
|
@@ -92,3 +94,50 @@ const { myFunction } = await import('../src/module.js') |
92 | 94 | - Use `.js` extensions in imports (ESM requirement) |
93 | 95 | - Document functions with JSDoc comments |
94 | 96 | - Weights must sum to 1.0 for proper normalization |
| 97 | +- Always run tests before committing: `pnpm test` |
| 98 | +- Keep test coverage above 80% |
| 99 | + |
| 100 | +## Development Workflow |
| 101 | + |
| 102 | +1. Create a feature branch: `git checkout -b feature/your-feature` |
| 103 | +2. Make your changes in `src/` |
| 104 | +3. Add/update tests in `__tests__/` |
| 105 | +4. Run the full test suite: `pnpm run all` |
| 106 | +5. Bundle for distribution: `pnpm bundle` |
| 107 | +6. Commit changes (including `dist/` updates) |
| 108 | +7. Open a PR against `main` |
| 109 | + |
| 110 | +## Testing Locally |
| 111 | + |
| 112 | +To test the action locally with real GitHub data: |
| 113 | + |
| 114 | +1. Copy `.env.example` to `.env` |
| 115 | +2. Add your GitHub token and test repository details |
| 116 | +3. Run: `pnpm local-action` |
| 117 | + |
| 118 | +## Adding New Metrics |
| 119 | + |
| 120 | +1. Create new file in `src/metrics/your-metric.ts` |
| 121 | +2. Export a function that returns a `MetricResult` |
| 122 | +3. Add it to `src/metrics/index.ts` |
| 123 | +4. Add corresponding tests in `__tests__/metrics/` |
| 124 | +5. Update the scoring engine in `src/scoring/engine.ts` |
| 125 | +6. Document the metric in README.md |
| 126 | + |
| 127 | +## Troubleshooting |
| 128 | + |
| 129 | +**Tests failing with ESM errors?** |
| 130 | + |
| 131 | +- Ensure imports use `.js` extensions |
| 132 | +- Use `jest.unstable_mockModule()` for mocking |
| 133 | +- Import modules after mocking is set up |
| 134 | + |
| 135 | +**dist/ out of sync?** |
| 136 | + |
| 137 | +- Run `pnpm bundle` after any `src/` changes |
| 138 | +- The CI will fail if `dist/` is not up to date |
| 139 | + |
| 140 | +**Rate limits?** |
| 141 | + |
| 142 | +- Use a personal access token with higher limits |
| 143 | +- The action includes automatic rate limit handling |
0 commit comments