|
| 1 | +# Contributing to GoPlus AgentGuard |
| 2 | + |
| 3 | +Thanks for your interest in contributing to GoPlus AgentGuard! Here's how to get started. |
| 4 | + |
| 5 | +## Development Setup |
| 6 | + |
| 7 | +```bash |
| 8 | +git clone https://github.com/GoPlusSecurity/agentguard.git |
| 9 | +cd agentguard |
| 10 | +npm install |
| 11 | +npm run build |
| 12 | +npm test |
| 13 | +``` |
| 14 | + |
| 15 | +## Project Structure |
| 16 | + |
| 17 | +- `src/` — TypeScript source code |
| 18 | + - `scanner/` — Static analysis engine (20 detection rules) |
| 19 | + - `action/` — Runtime action evaluator (exec, network, file, web3 detectors) |
| 20 | + - `registry/` — Trust level management |
| 21 | + - `policy/` — Default policies and capability presets |
| 22 | + - `tests/` — Test suite (Node.js built-in test runner) |
| 23 | +- `skills/agentguard/` — Claude Code skill definition (SKILL.md + reference docs) |
| 24 | +- `hooks/` — Plugin hooks configuration for auto-guard |
| 25 | +- `examples/` — Demo projects for testing |
| 26 | + |
| 27 | +## Making Changes |
| 28 | + |
| 29 | +1. Fork the repository |
| 30 | +2. Create a feature branch: `git checkout -b feature/my-change` |
| 31 | +3. Make your changes |
| 32 | +4. Run `npm run build && npm test` to verify |
| 33 | +5. Submit a pull request |
| 34 | + |
| 35 | +## Adding Detection Rules |
| 36 | + |
| 37 | +New scan rules go in `src/scanner/rules/`. Each rule needs: |
| 38 | +- A unique `id` (e.g., `MY_NEW_RULE`) |
| 39 | +- `severity`: `low` | `medium` | `high` | `critical` |
| 40 | +- `pattern`: regex to match against file content |
| 41 | +- `fileTypes`: array of extensions to scan (e.g., `['.js', '.ts']`) |
| 42 | + |
| 43 | +Export the rule from the appropriate category file and add it to the `ALL_RULES` array in `src/scanner/rules/index.ts`. |
| 44 | + |
| 45 | +## Adding Action Detectors |
| 46 | + |
| 47 | +Action detectors go in `src/action/detectors/`. They evaluate runtime actions and return risk assessments with tags. |
| 48 | + |
| 49 | +## Code Style |
| 50 | + |
| 51 | +- TypeScript strict mode |
| 52 | +- Zod for runtime validation |
| 53 | +- Minimal dependencies (currently 5 production deps) |
| 54 | +- Node.js built-in test runner (no test framework needed) |
| 55 | + |
| 56 | +## Reporting Issues |
| 57 | + |
| 58 | +Please open an issue at https://github.com/GoPlusSecurity/agentguard/issues with: |
| 59 | +- What you expected to happen |
| 60 | +- What actually happened |
| 61 | +- Steps to reproduce |
| 62 | +- Your Node.js version and OS |
0 commit comments