Skip to content

Commit 98d2c00

Browse files
committed
Improve AI bug automation readiness
- Add AGENTS.md (renamed from CLAUDE.md) for tool-agnostic agent guidelines - Add .pre-commit-config.yaml with local hooks (go-fmt, go-vet, golangci-lint, tests) - Add .github/ISSUE_TEMPLATE/bug_report.yml (YAML form-based template) - Update CONTRIBUTING.md with development setup section - Add e2e alias target in Makefile - Update OWNERS to use platform team alias - Replace local ADR with pointer to org-level ADR repository
1 parent 74f26e9 commit 98d2c00

File tree

7 files changed

+135
-32
lines changed

7 files changed

+135
-32
lines changed

.github/pull_request_template.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Description
2+
3+
<!-- What does this PR do? -->
4+
5+
## Testing
6+
7+
- [ ] Unit tests pass (`make test`)
8+
- [ ] Linter passes (`make lint`)
9+
- [ ] New functionality includes tests
10+
11+
## Review checklist
12+
13+
- [ ] Code follows project conventions (see docs/coding/)
14+
- [ ] Changes are documented if needed

.pre-commit-config.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
args: [--allow-multiple-documents]
9+
- id: check-merge-conflict
10+
11+
- repo: local
12+
hooks:
13+
- id: go-fmt
14+
name: go fmt
15+
entry: make fmt
16+
language: system
17+
pass_filenames: false
18+
types: [go]
19+
- id: go-vet
20+
name: go vet
21+
entry: go vet ./...
22+
language: system
23+
pass_filenames: false
24+
types: [go]
25+
- id: go-unit-tests
26+
name: go test
27+
entry: make test
28+
language: system
29+
pass_filenames: false
30+
stages: [pre-push]

AGENTS.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# odh-cli Development Guidelines
2+
3+
## Project Overview
4+
5+
kubectl plugin for ODH (Open Data Hub) and RHOAI (Red Hat OpenShift AI). The CLI validates cluster configuration, assesses upgrade readiness, and backs up workloads.
6+
7+
## Architecture
8+
9+
The project follows a standard Go CLI structure with Cobra commands:
10+
11+
```text
12+
cmd/ - Command definitions (Cobra wrappers)
13+
pkg/ - Business logic, lint checks, utilities
14+
internal/ - Internal version information
15+
docs/ - Development documentation
16+
```
17+
18+
Commands use a four-phase lifecycle: AddFlags -> Complete -> Validate -> Run.
19+
All commands use `Command` struct with `NewCommand()` constructor.
20+
21+
## Build and Run
22+
23+
```bash
24+
make build # Build the binary
25+
make run # Run the CLI
26+
make fmt # Format code (NEVER use gci/gofmt directly)
27+
make lint # Run linter (NEVER use golangci-lint directly)
28+
make lint/fix # Auto-fix lint issues (try this FIRST)
29+
make test # Run tests
30+
make check # Run all quality gates (lint)
31+
make tidy # Tidy dependencies
32+
make clean # Clean build artifacts
33+
```
34+
35+
CRITICAL: Always use `make` commands for formatting and linting. Never invoke `gci`, `gofmt`, or `golangci-lint` directly. Direct `go test` is acceptable for targeted test runs.
36+
37+
## Test Guidelines
38+
39+
- Use vanilla Gomega (not Ginkgo) with dot imports
40+
- Use `t.Run()` subtests and `t.Context()` (Go 1.24+)
41+
- All test data must be package-level constants, never inline
42+
- Use `HaveField`/`MatchFields` for struct assertions
43+
- Mocks must use testify/mock in `pkg/util/test/mocks/`
44+
- Use fake clients from `sigs.k8s.io/controller-runtime/pkg/client/fake`
45+
46+
## Debug and Troubleshooting
47+
48+
- Run `make lint/fix` first for any lint issues before manual debug
49+
- Use `make check` after every implementation change
50+
- For test failures: `go test -v ./pkg/<package> -run TestName`
51+
- Check `.golangci.yml` for linter configuration
52+
53+
## CRITICAL: Required Reading for All Agents
54+
55+
**Before starting ANY work on this project, agents MUST read the following documents:**
56+
57+
### Core Guidelines
58+
- @docs/agent.md
59+
- @docs/development.md (navigation hub - read this first)
60+
- @docs/design.md
61+
62+
### Setup and Workflow
63+
- @docs/setup.md
64+
- @docs/quality.md
65+
- @docs/code-review.md
66+
67+
### Coding Standards
68+
- @docs/coding/conventions.md
69+
- @docs/coding/patterns.md
70+
- @docs/coding/formatting.md
71+
72+
### Testing and Extensibility
73+
- @docs/testing.md
74+
- @docs/extensibility.md
75+
76+
### Lint Command (when working on lint features)
77+
- @docs/lint/architecture.md
78+
- @docs/lint/writing-checks.md
79+
80+
These documents contain critical requirements that MUST be followed.
81+
Failure to read and follow these guidelines will result in code that does not meet project standards.

CLAUDE.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ check: lint
8888
# Run tests
8989
.PHONY: test
9090
test:
91-
go test ./...
91+
go test -coverprofile=coverage.out ./...
9292

9393
# Build container image without pushing (creates local manifest)
9494
.PHONY: build-image

OWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
approvers:
2+
- platform
3+
reviewers:
4+
- platform

docs/adr/0001-cli-architecture.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Architecture Decision Records
2+
3+
This project's ADRs are maintained in the organization-level repository:
4+
5+
https://github.com/opendatahub-io/architecture-decision-records

0 commit comments

Comments
 (0)