Thank you for considering contributing to package-checker.sh! This guide will help you understand our workflow and conventions.
- Getting Started
- Building
- Commit Message Convention
- Versioning and Releases
- Development Workflow
- Testing
- Pull Request Process
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/package-checker.sh.git cd package-checker.sh - Create a new branch:
git checkout -b feature/your-feature-name
script.sh (the distributable at the repo root) is generated — sources live in src/. Edit files under src/, never script.sh directly:
# 1. Edit the relevant file(s) under src/
# 2. Rebuild the distributable
./build.sh
# 3. Commit src/ and script.sh together
git add src/ script.sh
git commit -m "fix: ..."The CI job verify-build reruns build.sh and fails if script.sh doesn't match src/, so always run the build before committing.
We use Conventional Commits for commit messages. This enables automatic versioning and changelog generation.
<type>(<scope>): <subject>
<body>
<footer>
- feat: A new feature (triggers MINOR version bump)
- fix: A bug fix (triggers PATCH version bump)
- docs: Documentation only changes (triggers PATCH version bump)
- style: Code style changes (formatting, missing semi colons, etc.)
- refactor: Code refactoring without changing functionality
- perf: Performance improvements (triggers PATCH version bump)
- test: Adding or updating tests
- build: Changes to build system or dependencies (triggers PATCH version bump)
- ci: Changes to CI configuration files
- chore: Other changes that don't modify src or test files
- revert: Reverts a previous commit (triggers PATCH version bump)
Add BREAKING CHANGE: in the commit body or append ! after the type to trigger a MAJOR version bump:
feat!: remove support for Node.js 12
BREAKING CHANGE: Node.js 12 is no longer supported
Feature (minor version bump):
feat: add support for YAML vulnerability sources
Added parser for YAML-formatted vulnerability databases.
Supports both simple lists and complex structures.
Bug fix (patch version bump):
fix: correct version comparison for caret ranges
Fixed an issue where ^1.2.3 was not properly matching 1.3.0.
The semver comparison now correctly handles all caret range scenarios.
Documentation (patch version bump):
docs: update Docker usage examples
Added examples for multi-source scanning and GitHub organization scanning.
Breaking change (major version bump):
feat!: change --source flag behavior
BREAKING CHANGE: The --source flag now requires explicit format specification
when using remote URLs. Auto-detection is only available for local files.
Before: ./script.sh --source https://example.com/vulns.json
After: ./script.sh --source https://example.com/vulns.json --format json
Multiple changes:
feat: add Docker healthcheck endpoint
- Added /health endpoint for container health monitoring
- Implemented graceful shutdown handling
- Updated Dockerfile with HEALTHCHECK instruction
Closes #123
We use Semantic Versioning (SemVer) with automated releases.
MAJOR.MINOR.PATCH
- MAJOR: Breaking changes (e.g., 1.0.0 → 2.0.0)
- MINOR: New features (backward compatible) (e.g., 1.0.0 → 1.1.0)
- PATCH: Bug fixes and documentation (e.g., 1.0.0 → 1.0.1)
When you push commits to the main branch:
- Semantic Release analyzes commit messages
- Determines the next version number based on commit types
- Generates a changelog from commit messages
- Creates a GitHub release with release notes
- Tags the release (e.g.,
v1.2.3) - Docker images are automatically built and pushed with version tags
After a release, Docker images are tagged with:
vX.Y.Z- Specific version (e.g.,v1.2.3)vX.Y- Minor version (e.g.,v1.2)vX- Major version (e.g.,v1)latest- Latest stable release
Development builds from main branch are tagged with:
main- Latest development builddev- Alias for latest development build
graph LR
A[Commit to main] --> B[Semantic Release]
B --> C{Commit Type?}
C -->|feat!| D[Major Release]
C -->|feat| E[Minor Release]
C -->|fix/docs/perf| F[Patch Release]
C -->|chore/ci/test| G[No Release]
D --> H[Create GitHub Release]
E --> H
F --> H
H --> I[Build Docker Images]
I --> J[Push to ghcr.io]
Edit the relevant file(s) under src/ (or update documentation), then run ./build.sh to regenerate script.sh — see Building.
# Test with built-in feeds
./script.sh --source data/ghsa.purl
# Test with test fixtures
cd test-fixtures
../script.sh --source test-vulnerabilities.json
# Test specific functionality
./script.sh --package-name lodash --package-version 4.17.20 --source data/ghsa.purl# Stage your changes
git add .
# Commit with conventional commit message
git commit -m "feat: add new feature"git push origin feature/your-feature-name- Open a PR from your fork to the main repository
- Describe your changes clearly
- Reference any related issues
- Wait for review and CI checks to pass
Use the test fixtures in the test-fixtures/ directory:
cd test-fixtures
# Test with JSON source
../script.sh --source test-vulnerabilities.json
# Test with CSV source
../script.sh --source test-vulnerabilities.csv
# Test with PURL source
../script.sh --source test-vulnerabilities.purl
# Test safe project (should find no vulnerabilities)
cd safe-project
../../script.sh --source ../test-vulnerabilities.jsonBefore submitting a PR, test these scenarios:
- Scanning with JSON vulnerability source
- Scanning with CSV vulnerability source
- Scanning with PURL vulnerability source
- Scanning with built-in GHSA feed
- Direct package lookup
- Version range matching
- GitHub organization scanning (if applicable)
- Multiple sources
- Configuration file usage
Test Docker images locally:
# Build full image
docker build -t package-checker:test -f Dockerfile .
# Build lightweight image
docker build -t package-checker:test-lite -f Dockerfile.lite .
# Test full image
docker run -v $(pwd)/test-fixtures:/workspace package-checker:test \
--source /app/data/ghsa.purl
# Test lightweight image
docker run -v $(pwd)/test-fixtures:/workspace package-checker:test-lite \
--source http://localhost:8080/vulns.json- Update Documentation: If you've added features, update relevant documentation
- Follow Commit Convention: Use conventional commits for your PR commits
- Update CHANGELOG: Not needed - it's automatically generated from commits
- Describe Changes: Provide a clear PR description with:
- What changed
- Why it changed
- How to test it
- Wait for Review: Maintainers will review your PR
- Address Feedback: Make requested changes if needed
- Merge: Once approved, your PR will be merged to main
- Automatic Release: If your commit triggers a release, it will happen automatically
Use the same conventional commit format for PR titles:
feat: add YAML support for vulnerability sources
fix: correct semver matching for tilde ranges
docs: improve Docker usage examples
- Use bash for shell scripts
- Follow existing code style and patterns
- Keep lines under 100 characters when possible
- Add comments for complex logic
- Use meaningful variable names
When adding new features:
- Check Existing Issues: See if there's already a discussion
- Open an Issue: Discuss the feature before implementing
- Keep it Simple: Follow the Unix philosophy - do one thing well
- Document: Add documentation for new features
- Test: Add test cases in
test-fixtures/
When reporting bugs:
- Search Existing Issues: Check if it's already reported
- Provide Details:
- Steps to reproduce
- Expected behavior
- Actual behavior
- Environment (OS, bash version, etc.)
- Command used
- Error messages
- Minimal Example: Provide the smallest example that reproduces the bug
- Open an issue for questions
- Check existing documentation
- Review closed issues
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to package-checker.sh! 🎉