|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thank you for helping improve Agentic Control Plane. This document describes how to work on the repo locally and what we expect in pull requests. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- [Go 1.22+](https://go.dev/dl/) (see `go.mod`) |
| 8 | +- GNU **Make** (optional; the [`Makefile`](Makefile) wraps common Go commands) |
| 9 | + |
| 10 | +## Getting started |
| 11 | + |
| 12 | +```bash |
| 13 | +git clone https://github.com/LAA-Software-Engineering/agentic-control-plane.git |
| 14 | +cd agentic-control-plane |
| 15 | +go mod download |
| 16 | +make build # or: go build -o bin/agentctl ./cmd/agentctl |
| 17 | +``` |
| 18 | + |
| 19 | +Run **`make`** or **`make help`** for a full list of targets. |
| 20 | + |
| 21 | +## Before you open a pull request |
| 22 | + |
| 23 | +1. **Format** — `make fmt` or ensure `gofmt -l .` prints nothing (same check as CI). |
| 24 | +2. **Static analysis** — `make vet` (or `go vet ./...`). |
| 25 | +3. **Tests** — `make test` (`go test ./... -race`). |
| 26 | + |
| 27 | +A convenient local gate (format check, vet, tests; no build): |
| 28 | + |
| 29 | +```bash |
| 30 | +make ci |
| 31 | +``` |
| 32 | + |
| 33 | +CI in [`.github/workflows/ci.yml`](.github/workflows/ci.yml) also **builds** `agentctl`, runs tests with **`-count=1 -shuffle=on -timeout=10m`**, and writes a **coverage** profile. To mirror that test invocation closely: |
| 34 | + |
| 35 | +```bash |
| 36 | +go test -race -count=1 -shuffle=on -timeout=10m ./... |
| 37 | +go build -o bin/agentctl ./cmd/agentctl |
| 38 | +``` |
| 39 | + |
| 40 | +### CLI golden tests |
| 41 | + |
| 42 | +If you intentionally change table (or other) CLI output captured by golden files: |
| 43 | + |
| 44 | +```bash |
| 45 | +GO_UPDATE_GOLDEN=1 go test ./internal/cli/... -run TestGolden_ |
| 46 | +``` |
| 47 | + |
| 48 | +Commit the updated files under `internal/cli/testdata/` with your change. |
| 49 | + |
| 50 | +## Project layout |
| 51 | + |
| 52 | +High-level map (details in [`README.md`](README.md) and [`docs/DESIGN_DOC.md`](docs/DESIGN_DOC.md)): |
| 53 | + |
| 54 | +| Area | Path | |
| 55 | +|------|------| |
| 56 | +| CLI entrypoint | `cmd/agentctl` | |
| 57 | +| Commands, flags, golden tests | `internal/cli` | |
| 58 | +| YAML spec types and validation | `internal/spec`, `internal/project` | |
| 59 | +| Plan / apply / engine / policy | `internal/plan`, `internal/apply`, `internal/engine`, `internal/policy` | |
| 60 | +| SQLite state | `internal/state/sqlite` | |
| 61 | +| End-to-end CLI tests | `test/integration` | |
| 62 | + |
| 63 | +## Code style |
| 64 | + |
| 65 | +- Match existing patterns in nearby files (naming, error handling, test style). |
| 66 | +- Prefer small, focused changes; avoid unrelated refactors in the same PR. |
| 67 | +- Keep user-visible strings and behaviour aligned with [`docs/DESIGN_DOC.md`](docs/DESIGN_DOC.md) when touching the CLI or YAML semantics. |
| 68 | + |
| 69 | +## Pull requests |
| 70 | + |
| 71 | +- Describe **what** changed and **why** (context for reviewers). |
| 72 | +- Link related **issues** when applicable. |
| 73 | +- Ensure **CI would pass** (formatting, vet, tests, build). Note: pushes that **only** change `Makefile` or `**/*.md` do not trigger CI via `paths-ignore`; for doc-only edits, run `make ci` locally if you also changed Go code elsewhere in the same branch. |
| 74 | + |
| 75 | +## License |
| 76 | + |
| 77 | +By contributing, you agree that your contributions will be licensed under the same terms as the project: **[MIT](LICENSE)**. |
0 commit comments