Skip to content

Commit 2e38b18

Browse files
authored
chore: add agents.md (#190)
1 parent 75d8cfe commit 2e38b18

File tree

2 files changed

+133
-0
lines changed

2 files changed

+133
-0
lines changed

.cspell.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"language": "en",
77
"version": "0.2",
88
"words": [
9+
"agentic",
910
"apiextensions",
1011
"apimachinery",
1112
"apiserver",
@@ -25,7 +26,9 @@
2526
"genall",
2627
"gofmt",
2728
"jsonschema",
29+
"kopium",
2830
"krusty",
31+
"kubeconform",
2932
"kustomization",
3033
"kustomizations",
3134
"kustomizer",

AGENTS.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# AGENTS.md
2+
3+
This file provides guidelines for agents working in this repository.
4+
5+
## Project Overview
6+
7+
This is the CRD Catalog - a tool that aggregates hundreds of popular Kubernetes CRDs (CustomResourceDefinition) including their JSON schema format. The catalog is used for validation (kubeconform), code generation (kopium), and language server support.
8+
9+
## Build, Lint, and Test Commands
10+
11+
### Running Tests
12+
13+
**Full test suite:**
14+
15+
```bash
16+
make test
17+
```
18+
19+
This runs on PRs to main via GitHub Actions (`.github/workflows/tests.yaml`). It includes:
20+
21+
- Go unit tests with coverage
22+
- Schema validation
23+
- Smoke tests with Docker
24+
- Makefile linting
25+
- EditorConfig checks
26+
27+
**Run Go unit tests locally:**
28+
29+
```bash
30+
go test ./... -timeout 10s -shuffle on -p 1 -tags containers_image_openpgp -skip 'TestCheckLocal'
31+
```
32+
33+
**Run a single test:**
34+
35+
```bash
36+
go test ./... -run TestName -timeout 10s
37+
```
38+
39+
Note: `-skip 'TestCheckLocal'` is required because that test is for manual debugging of uncommitted configuration files and should not run in normal test execution.
40+
41+
### Static Analysis and Formatting
42+
43+
**Format check:**
44+
45+
```bash
46+
gofmt -l .
47+
```
48+
49+
**Go vet:**
50+
51+
```bash
52+
go vet ./...
53+
```
54+
55+
**Check for mod file changes:**
56+
57+
```bash
58+
go mod tidy -diff
59+
```
60+
61+
### Build
62+
63+
```bash
64+
go build -o build/bin/catalog -buildvcs=false -tags containers_image_openpgp
65+
```
66+
67+
## Code Style Guidelines
68+
69+
### Go Conventions
70+
71+
- **Formatting**: Use `gofmt` (standard Go formatter). All code should be formatted before committing.
72+
- **Language**: Go (version managed automatically by GitHub workflows)
73+
- **Testing**: Uses testify/assert for assertions
74+
- **Error handling**:
75+
- Use sentinel errors with `errors.New` for defined error cases
76+
- Use `errors.Join` to combine multiple errors
77+
- **CLI**: Uses standard `flag` package for command-line argument parsing
78+
- **Build tags**: Required tag is `containers_image_openpgp`
79+
- **Comments**: Do NOT add comments unless explicitly requested
80+
81+
### EditorConfig (Non-Go Files)
82+
83+
Follow the settings in `.editorconfig`.
84+
85+
## GitHub Workflows
86+
87+
`.github/dependabot.yml`:
88+
89+
- **dependabot.yml**: Weekly updates for GitHub Actions and Go module dependencies
90+
91+
`.github/workflows/`:
92+
93+
- **tests.yaml**: Runs `make test` on PRs to main, auto-merges bot PRs (dependabot, crd-automation)
94+
- **scheduled-jobs.yaml**: Runs on a schedule every few hours:
95+
- `make update` - fetches CRD schemas from Helm charts
96+
- `make comparison` - compares with datreeio/CRDs-catalog
97+
- `make tags` - synchronizes Kubernetes version tags
98+
- **upgrade-go.yaml**: Weekly check for Go updates, automatically upgrades go.mod and .tool-versions via PR
99+
100+
## Project Structure
101+
102+
```
103+
/schema # Generated OpenAPI schema files
104+
/definitions # Generated definition files (for kopium)
105+
/configuration.yaml # CRD sources configuration
106+
/registry.yaml # Tracks source versions
107+
/internal/ # Go source code
108+
/command/ # CLI commands (compare, update, verify)
109+
/make.d/ # Makefile includes
110+
/test/ # Test fixtures and scripts
111+
```
112+
113+
## Configuration
114+
115+
The main configuration file is `configuration.yaml`. It defines CRD sources (Helm charts, URLs, etc.) that are fetched to generate the schema and definition files.
116+
117+
The configuration file can be validated against the JSON schema at `internal/configuration/schema.json` using:
118+
119+
```bash
120+
go run . verify --schema internal/configuration/schema.json --file configuration.yaml
121+
```
122+
123+
## Important Notes
124+
125+
- Do NOT commit changes to `/schema`, `/definitions`, `registry.yaml` directly - these are generated by the `make update` workflow
126+
- The `.tool-versions` file is managed automatically by GitHub workflows
127+
128+
## Maintaining AGENTS.md
129+
130+
This file documents project conventions for agentic coding tools. Update this file to reflect changes when adding new commands, changing build processes, updating dependencies, or modifying code style conventions. Agents operating in this repository should follow the guidelines outlined here.

0 commit comments

Comments
 (0)