Thank you for your interest in contributing to github-viewer-stats!
- Node.js >= 18
- npm >= 9
- GitHub Personal Access Token with required scopes
-
Clone and install:
git clone https://github.com/TomerFi/github-viewer-stats.git cd github-viewer-stats npm install -
Set up your GITHUB_TOKEN:
export GITHUB_TOKEN="your_token_here"
Required scopes:
repo- Repository statisticsread:packages- Package informationread:user- User contribution statisticsread:discussion- Discussion contributionsread:orgoradmin:org- Organization statistics
-
Test locally:
npm run lint npm run contribs npm run repo <your-repo-name> npm run org <org-name>
This project is optimized for Cursor IDE with specialized agents, commands, and skills.
- code-reviewer - Pre-commit review checklist for ensuring code quality
- docs-writer - Documentation update patterns and guidelines
/lint- Run ESLint on source files/test-contribs- Test user contributions statistics (requires GITHUB_TOKEN)/test-repo- Test repository statistics (requires GITHUB_TOKEN)/test-org- Test organization statistics (requires GITHUB_TOKEN)
- add-stats-module - Step-by-step guide for adding new statistics modules
src/
├── api.js # GraphQL client factory (singleton pattern)
├── cli.js # CLI entrypoint
├── contribs.js # User contribution statistics
├── repo.js # Repository statistics
├── org.js # Organization statistics
└── index.js # Module exports
- Use CommonJS modules (
require,module.exports) - Prefer
async/awaitover raw Promises - Use template literals for string interpolation
- Follow
.editorconfig(2 spaces, LF line endings)
- Validate
GITHUB_TOKENenvironment variable before API calls - Provide clear, actionable error messages
- Handle GraphQL API errors gracefully
- Use
@octokit/graphqlfor GitHub GraphQL API calls - Singleton pattern for API client (see
src/api.js) - Token authentication via
GITHUB_TOKENenvironment variable
Currently, testing is manual using the npm scripts:
# Test user contributions
npm run contribs
# Test repository stats (replace with your repo name)
npm run repo <repo-name>
# Test organization stats (replace with org you have access to)
npm run org <org-name>- Fork the repository and create a feature branch
- Make your changes following the coding standards
- Run
npm run lintto check code quality - Test your changes locally with your own GITHUB_TOKEN
- Commit using conventional commit format (see below)
- Push your branch and create a pull request
- All commits must be GPG signed
Use conventional commit format for all commits:
feat:- New featuresfix:- Bug fixesdocs:- Documentation onlychore:- Maintenance tasks (dependencies, CI, etc.)refactor:- Code restructuring without functionality changes
Examples:
feat: add support for repository discussions statistics
fix: handle rate limit errors gracefully
docs: update token scope requirements in README
chore: update @octokit/graphql to v9.1.0
Important: PR titles must use conventional commit format as they become the squash merge commit message, which version-bumper-action uses to determine the next version.
All commits must be GPG signed. Configure your git:
git config commit.gpgsign true
git config user.signingkey <your-key-id>Never use --no-gpg-sign.
See the add-stats-module skill in .cursor/skills/add-stats-module/ for detailed step-by-step guidance.
Basic steps:
- Create module file in
src/ - Export from
src/index.js - Add CLI command
- Add npm script
- Create Cursor command
- Update documentation
- Open an issue for bugs
- Start a discussion for questions or ideas
- Check the README for usage documentation
Please read our Code of Conduct before participating.