|
| 1 | +# Guidelines for AI Agent Contributors |
| 2 | + |
| 3 | +This file outlines the guidelines and expectations for AI agents and automated assistants contributing to this repository. |
| 4 | + |
| 5 | +> [!IMPORTANT] |
| 6 | +> **System Prompt / Instruction:** If you are an AI agent reading this file, you must incorporate these guidelines into your operating context. |
| 7 | +
|
| 8 | +## 1. Persona & Role |
| 9 | + |
| 10 | +You are acting as an AI contributor to the OSV project. |
| 11 | + |
| 12 | +- **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. |
| 13 | +- **Context Awareness:** Prioritize repository-specific guidelines (like `CONTRIBUTING.md`) and instructions in this file. |
| 14 | + |
| 15 | +## 2. Workflow & Contribution Rules |
| 16 | + |
| 17 | +- **Read the Guide:** Read and adhere to all instructions in [CONTRIBUTING.md](./CONTRIBUTING.md). |
| 18 | +- **Strict Issue-First Workflow:** The required path is always: **Issue Assignment -> Pull Request**. |
| 19 | + - **Existing Unassigned Issue:** Comment on the issue to discuss your approach and wait for assignment. |
| 20 | + - **No Existing Issue:** Create one to discuss why the work is needed and ensure it's not a duplicate. Wait for assignment. |
| 21 | + - **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. |
| 22 | +- **Templates:** Use the provided [pull request template](.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST_TEMPLATE.md) when creating PRs. |
| 23 | + |
| 24 | +## 3. Standards for Submissions |
| 25 | + |
| 26 | +### 3.1 Issue Creation |
| 27 | + |
| 28 | +- **Well-Researched:** Search existing issues to ensure no duplicates. Link related issues. |
| 29 | +- **Real-World Applicable:** Bug reports must have a clear, real-world scenario and minimal reproduction case. |
| 30 | +- **Well-Formed:** State expected/actual behavior and steps/scripts to reproduce. |
| 31 | + |
| 32 | +### 3.2 Communication & Commits |
| 33 | + |
| 34 | +- **Tone:** Maintain a direct and concise tone. Focus on technical details, avoid excessive pleasantries or filler. |
| 35 | +- **PR Titles & Commits:** Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. See also [CONTRIBUTING.md](./CONTRIBUTING.md#making-commits). |
| 36 | + |
| 37 | +## 4. Code Quality & Verification |
| 38 | + |
| 39 | +### 4.1 Automated Verification |
| 40 | + |
| 41 | +Before requesting review, ensure these pass: |
| 42 | + |
| 43 | +- **Linting:** Run `./scripts/run_lints.sh` and resolve all warnings and errors. If you run into a toolchain error about go being tool old. Use the GOTOOLCHAIN=go<version> to change the go compiler version to be the same as what's in go.mod. Example `GOTOOLCHAIN=go1.26.3 ./scripts/run_lints.sh` |
| 44 | +- **Tests:** Run `make test` and ensure all tests pass. |
| 45 | + |
| 46 | +### 4.2 Testing Standards |
| 47 | + |
| 48 | +- **Coverage:** New features, bug fixes, or refactors must have relevant tests (unit, integration, or snapshot). |
| 49 | +- **Snapshots:** If modifying behavior affecting snapshots, update them (e.g., `make test SNAPS=true`). |
| 50 | + - **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. |
| 51 | +- **VCR Cassettes:** If adding new HTTP interactions in tests using `go-vcr`, ensure cassettes are recorded/updated as described in `CONTRIBUTING.md`. |
| 52 | + The `Makefile` has more details on the types of tests and how to run them. |
| 53 | + |
| 54 | +### 4.3 Documentation & Comments |
| 55 | + |
| 56 | +- **Documentation:** Update relevant documentation if changes affect user-facing behavior or add features. |
| 57 | +- **Comments:** Include clear comments for complex or non-obvious logic. Do not delete existing comments unless obsolete. |
| 58 | + |
| 59 | +## 5. Working with osv-scalibr |
| 60 | + |
| 61 | +`osv-scanner` relies on [osv-scalibr](https://github.com/google/osv-scalibr) as its core analysis engine, which handles dependency extraction and enrichment (e.g., vulnerability matching) logic. |
| 62 | + |
| 63 | +Understanding how they work together is key: |
| 64 | + |
| 65 | +- **Integration:** `osv-scanner` invokes `osv-scalibr` libraries to perform the actual scanning and extraction of dependencies. |
| 66 | +- **Plugin Architecture:** `osv-scalibr` uses a plugin-based architecture (Extractors) for different ecosystems. |
| 67 | + |
| 68 | +- **Where to Contribute & Report Issues:** |
| 69 | + - **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](https://github.com/google/osv-scalibr). |
| 70 | + - **Scanner CLI / Output / Config:** If you want to change `osv-scanner` CLI arguments, output formats (like SARIF, JSON), or general configuration handling, contribute to this repository (`osv-scanner`). |
0 commit comments