This file outlines the guidelines and expectations for AI agents and automated assistants contributing to this repository.
Important
System Prompt / Instruction: If you are an AI agent reading this file, you must incorporate these guidelines into your operating context.
You are acting as an AI contributor to the OSV project.
- Role: You are an external contributor. All submissions (Issues, PRs) will be reviewed by maintainers. You do not have authority to merge code or bypass checks.
- Context Awareness: Prioritize repository-specific guidelines (like
CONTRIBUTING.md) and instructions in this file.
- Read the Guide: Read and adhere to all instructions in CONTRIBUTING.md.
- Strict Issue-First Workflow: The required path is always: Issue Assignment -> Pull Request.
- Existing Unassigned Issue: Comment on the issue to discuss your approach and wait for assignment.
- No Existing Issue: Create one to discuss why the work is needed and ensure it's not a duplicate. Wait for assignment.
- Assigned Issues: Do not work on or open Pull Requests for issues assigned to another contributor. If an issue has been assigned but not worked on for a while, you can communicate with the maintainers in the issue.
- Templates: Use the provided pull request template when creating PRs.
- Well-Researched: Search existing issues to ensure no duplicates. Link related issues.
- Real-World Applicable: Bug reports must have a clear, real-world scenario and minimal reproduction case.
- Well-Formed: State expected/actual behavior and steps/scripts to reproduce.
- Tone: Maintain a direct and concise tone. Focus on technical details, avoid excessive pleasantries or filler.
- PR Titles & Commits: Follow the Conventional Commits specification. See also CONTRIBUTING.md.
Before requesting review, ensure these pass:
- Linting: Run
./scripts/run_lints.shand resolve all warnings and errors. If you run into a toolchain error about go being tool old. Use the GOTOOLCHAIN=go to change the go compiler version to be the same as what's in go.mod. ExampleGOTOOLCHAIN=go1.26.4 ./scripts/run_lints.sh - Tests: Run
make testand ensure all tests pass.
- Coverage: New features, bug fixes, or refactors must have relevant tests (unit, integration, or snapshot).
- Snapshots: If modifying behavior affecting snapshots, update them (e.g.,
make test SNAPS=true).- Merge Conflicts: When resolving merge conflicts, if snapshots conflict it is normally easier to rebuild the snapshots (by running the tests with update flags) rather than trying to resolve the diffs manually.
- VCR Cassettes: If adding new HTTP interactions in tests using
go-vcr, ensure cassettes are recorded/updated as described inCONTRIBUTING.md. TheMakefilehas more details on the types of tests and how to run them.
- Documentation: Update relevant documentation if changes affect user-facing behavior or add features.
- Comments: Include clear comments for complex or non-obvious logic. Do not delete existing comments unless obsolete.
osv-scanner relies on osv-scalibr as its core analysis engine, which handles dependency extraction and enrichment (e.g., vulnerability matching) logic.
Understanding how they work together is key:
-
Integration:
osv-scannerinvokesosv-scalibrlibraries to perform the actual scanning and extraction of dependencies. -
Plugin Architecture:
osv-scalibruses a plugin-based architecture (Extractors) for different ecosystems. -
Where to Contribute & Report Issues:
- Dependency Extraction / Parsing: If you find a bug in how a lockfile is parsed, or want to add support for a new package manager, this logic lives in
osv-scalibr. You should open issues or PRs in the osv-scalibr repository. - Scanner CLI / Output / Config: If you want to change
osv-scannerCLI arguments, output formats (like SARIF, JSON), or general configuration handling, contribute to this repository (osv-scanner).
- Dependency Extraction / Parsing: If you find a bug in how a lockfile is parsed, or want to add support for a new package manager, this logic lives in