Skip to content

Commit b9ea9b4

Browse files
DjinnSGuillaume Leccesenlevee
authored
chore(ai): initiale AGENTS.md file (#902)
* chore(ai): initiale AGENTS.md file * chore: restructure AGENTS.md to provide behavioral guidelines for LLM coding practices * chore(ai): structure AGENTS.md guidance per monorepo area - Condense generic preamble in root AGENTS.md; fix factual errors (golangci-lint is CI-only, *_types.go, commit scopes, monorepo map) - Add scoped AGENTS.md for api/v1alpha1 (CRD codegen) and deploy (Helm) - Refine controllers and ui guidance to match real stack - Add CLAUDE.md symlinks so each area has a single maintained file --------- Co-authored-by: Guillaume Leccese <guillaume.leccese@theodo.com> Co-authored-by: Nicolas Levée <nicolas.levee@theodo.com>
1 parent 90001ba commit b9ea9b4

12 files changed

Lines changed: 138 additions & 0 deletions

File tree

.claude/settings.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"permissions": {
3+
"deny": [
4+
"Read(**/zz_generated.deepcopy.go)",
5+
"Read(**/zz_generated.register.go)",
6+
"Read(**/yarn.lock)",
7+
"Read(**/go.sum)",
8+
"Read(config/crd/bases/**)",
9+
"Read(config/webhook/**)",
10+
"Read(manifests/**)",
11+
"Read(ui/node_modules/**)"
12+
]
13+
}
14+
}

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../AGENTS.md

AGENTS.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# AGENTS.md — Burrito
2+
3+
Monorepo for **Burrito**: a Kubernetes operator that automates Terraform (TACoS).
4+
This file is the canonical guidance for AI agents. `CLAUDE.md` is a symlink to it.
5+
Nested `AGENTS.md` files add directory-specific rules — read them when working in their scope.
6+
7+
## Working Principles
8+
9+
- **Think first.** State assumptions; if multiple interpretations exist, surface them instead of picking silently. If something is unclear, ask.
10+
- **Simplicity.** Minimum code that solves the problem. No speculative features, abstractions, or config that wasn't requested.
11+
- **Surgical changes.** Touch only what the task requires. Match existing style. Don't refactor or reformat unrelated code; flag dead code rather than deleting it.
12+
- **Verify.** Turn tasks into checkable goals and run the relevant build/test/lint command before claiming done.
13+
14+
## Monorepo Map
15+
16+
- `api/v1alpha1/` — CRD Go types (see nested AGENTS.md). **Codegen-sensitive.**
17+
- `internal/controllers/` — reconciliation logic, one package per resource (see nested AGENTS.md).
18+
- `ui/` — React/Vite/TS dashboard (see nested AGENTS.md).
19+
- `deploy/charts/burrito/` — Helm chart (see nested AGENTS.md).
20+
- `cmd/` — binary entrypoints. `hack/` — dev/build scripts. `manifests/` & `config/crd/bases/` — generated manifests. `testdata/` — fixtures. `docs/` — documentation.
21+
22+
## Never Touch (generated / vendored)
23+
24+
Do not read, edit, or use as reference:
25+
26+
- `*zz_generated.deepcopy.go` (produced by `controller-gen`).
27+
- Lock files: `go.sum`, `ui/yarn.lock`.
28+
- Generated manifests in `config/crd/bases/` and `manifests/`.
29+
30+
To change CRDs: edit `api/v1alpha1/*_types.go`, then run `make manifests` (and `make generate`).
31+
32+
## Build & Validation
33+
34+
- **Go:** `make build` · `make test` (spins up envtest + docker-compose — heavy) · `make vet`
35+
- **Lint (Go):** `golangci-lint run ./...` — there is no `make` target; it runs in CI ([.github/workflows/ci.yaml](.github/workflows/ci.yaml)).
36+
- **After API changes:** `make manifests && make generate`
37+
- **UI:** `yarn --cwd ui lint` · `yarn --cwd ui build` · `yarn --cwd ui format-check`
38+
39+
## Go Style
40+
41+
- Always check errors explicitly. Never `_ = err` or silently ignored returns.
42+
- No `panic()` in reconcilers — see `internal/controllers/AGENTS.md`.
43+
44+
## Commits — Conventional Commits
45+
46+
Format: `<type>(<scope>): <description>`.
47+
48+
- **Types:** `feat`, `fix`, `chore`, `docs`, `test`, `refactor`.
49+
- **Scopes** (use the closest fit): `controller`, `api`, `ui`, `helm`, `ci`, `deps`, `docker`. Scope is optional when none applies.

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

api/v1alpha1/AGENTS.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Scope: CRD API Types (`api/v1alpha1/`)
2+
3+
Source of truth for Burrito's Custom Resource Definitions. **Codegen-sensitive directory.**
4+
5+
Type files (edit these): `terraformlayer_types.go`, `terraformrun_types.go`,
6+
`terraformrepository_types.go`, `terraformpullrequest_types.go`, `common.go`.
7+
`groupversion_info.go` registers the scheme.
8+
9+
## Rules
10+
11+
- To change an API, edit only the Go structs in `*_types.go`. Keep `+kubebuilder:` marker
12+
comments accurate — they drive CRD generation and validation.
13+
- **Never hand-edit `zz_generated.deepcopy.go`.** It is generated by `controller-gen`.
14+
- After any change to types or markers, run `make manifests && make generate`, and tell the
15+
user to commit the regenerated output. Do not edit `config/crd/bases/` or `manifests/` directly.
16+
- Treat the CRD shape as a contract: the `ui/` TypeScript interfaces mirror these structs —
17+
flag breaking field changes.
18+
- Tests live alongside types (`common_test.go`); keep them passing with `make test`.

api/v1alpha1/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

deploy/AGENTS.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Scope: Helm Chart (`deploy/`)
2+
3+
The Burrito Helm chart lives in `deploy/charts/burrito/` (templates under `templates/`).
4+
5+
## Rules
6+
7+
- Keep `values.yaml` the single source of defaults; expose new behavior through values rather
8+
than hardcoding it in templates. Document every new value.
9+
- Templates must stay in sync with the CRDs in `api/v1alpha1` and the controller's expected
10+
config. If a chart change requires updated CRD manifests, regenerate them with `make manifests`
11+
(don't hand-edit generated CRD YAML).
12+
- Bump `Chart.yaml` `version` (chart) / `appVersion` (image) appropriately when changing the chart.
13+
- Validate before declaring done: `helm lint deploy/charts/burrito` and
14+
`helm template deploy/charts/burrito` render without errors.
15+
- Use scope `helm` for commits touching this directory.

deploy/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

internal/controllers/AGENTS.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Scope: Kubernetes Controllers (`internal/controllers/`)
2+
3+
Go core engine, built on `controller-runtime` / Kubebuilder. One reconciler package per
4+
custom resource: `terraformlayer/`, `terraformrun/`, `terraformrepository/`,
5+
`terraformpullrequest/`. `metrics/` holds Prometheus instrumentation. `manager.go` wires them.
6+
7+
## Rules & Gotchas
8+
9+
- Follow standard `controller-runtime` reconciliation patterns and the Kubebuilder layout.
10+
- Reconcilers must be **idempotent** — they can run on the same object repeatedly.
11+
- Never block the reconcile loop. For retries/transient failures, return a requeue
12+
(`ctrl.Result{RequeueAfter: ...}`), do not sleep.
13+
- **Never `panic()`.** Return an error or a requeue.
14+
- Always check errors explicitly — no `_ = err`.
15+
- Use structured logging via the `logr.Logger` carried in `ctx` (`log.FromContext(ctx)`).
16+
- Propagate `ctx` and set timeouts on every external call (GitHub, GitLab, Terraform).
17+
- CRD shapes live in `api/v1alpha1`; never edit generated deepcopy code. After API changes run `make manifests && make generate`.

internal/controllers/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

0 commit comments

Comments
 (0)