-
Notifications
You must be signed in to change notification settings - Fork 763
[docs] Add AGENTS.md and CLAUDE.md for AI coding agent context #4809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
abiazett
wants to merge
1
commit into
ray-project:master
Choose a base branch
from
abiazett:add-agents-md
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| # KubeRay | ||
|
|
||
| KubeRay is a Kubernetes operator for managing Ray clusters. It provides three | ||
| custom resources: RayCluster, RayJob, and RayService. | ||
|
|
||
| ## Repository Structure | ||
|
|
||
| This is a monorepo. The primary component is `ray-operator/`. | ||
|
|
||
| | Directory | Description | | ||
| | --- | --- | | ||
| | `ray-operator/` | Kubernetes operator (controllers, webhooks, CRDs) | | ||
| | `apiserver/` | KubeRay API Server (Alpha) | | ||
| | `apiserversdk/` | API Server SDK | | ||
| | `kubectl-plugin/` | kubectl plugin for Ray (Beta) | | ||
| | `helm-chart/` | Helm charts (kuberay-operator, kuberay-apiserver, ray-cluster) | | ||
| | `dashboard/` | KubeRay Dashboard (Experimental, Next.js/TypeScript) | | ||
| | `clients/` | Python client libraries | | ||
| | `proto/` | Protobuf definitions and Swagger specs | | ||
| | `scripts/` | Build, test, and automation scripts | | ||
|
|
||
| ## Build and Test Commands | ||
|
|
||
| All commands run from `ray-operator/` unless noted otherwise. | ||
|
|
||
| ```sh | ||
| # Build | ||
| make build # Build operator binary | ||
|
|
||
| # Tests | ||
| make test # Unit tests (uses envtest for controller tests) | ||
|
|
||
| # Lint and format | ||
| make lint # golangci-lint (via ./scripts/lint.sh) | ||
| make fmt # gofmt | ||
| make vet # go vet | ||
| make fumpt # gofumpt | ||
|
|
||
| # Code generation (run after modifying API types) | ||
| make generate # Regenerate DeepCopy methods and client code | ||
| make manifests # Regenerate CRDs and RBAC from kubebuilder markers | ||
| make helm # Sync CRDs into helm-chart/ | ||
|
|
||
| # API documentation | ||
| make api-docs # Regenerate CRD reference docs | ||
| ``` | ||
|
|
||
| ### Single-File Commands | ||
|
|
||
| ```sh | ||
| # Lint a single file | ||
| golangci-lint run ./path/to/file.go | ||
|
|
||
| # Format a single file | ||
| gofumpt -w path/to/file.go | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add single-file test command |
||
| ``` | ||
|
|
||
| ### Other Components | ||
|
|
||
| ```sh | ||
| # apiserver (from repo root) | ||
| cd apiserver && go test ./pkg/... ./cmd/... -race -parallel 4 | ||
|
|
||
| # apiserversdk (from repo root) | ||
| cd apiserversdk && make lint && make test | ||
|
|
||
| # kubectl-plugin (from repo root) | ||
| cd kubectl-plugin && go test ./pkg/... -race -parallel 4 | ||
| ``` | ||
|
|
||
| ## Code Generation Workflow | ||
|
|
||
| After modifying API types in `ray-operator/apis/ray/v1/types.go`: | ||
|
|
||
| ```sh | ||
| cd ray-operator | ||
| make generate # DeepCopy, client code | ||
| make manifests # CRDs, RBAC | ||
| make helm # Sync CRDs to Helm chart | ||
| make api-docs # Update API reference | ||
| ``` | ||
|
|
||
| CI will fail if generated files are out of date. | ||
|
|
||
| ## Coding Conventions | ||
|
|
||
| ### Go Style | ||
|
|
||
| - **Formatter**: gofumpt (stricter than gofmt) | ||
| - **Line length**: 120 characters max | ||
| - **Import order** (enforced by gci): | ||
| 1. Standard library | ||
| 2. Third-party packages | ||
| 3. `github.com/ray-project/kuberay` packages | ||
| - **nolint directives** must include an explanation (`//nolint:errcheck // reason`) | ||
|
|
||
| ### Pre-Commit Hooks | ||
|
|
||
| Pre-commit hooks run automatically and enforce: | ||
|
|
||
| - golangci-lint (20 linters enabled) | ||
| - shellcheck for shell scripts | ||
| - markdownlint (120-char lines) | ||
| - YAML formatting for sample files | ||
| - Helm chart validation and docs generation | ||
| - CRD schema generation for kubeconform | ||
|
|
||
| Install hooks with: `pre-commit install` | ||
|
|
||
| ### Testing | ||
|
|
||
| - Unit tests use envtest for controller tests (simulated API server) | ||
| - E2E tests require a Kubernetes cluster (not run locally) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add instruction for agents to create local Kind clusters for testing? |
||
| - Test files are co-located with source (`*_test.go` alongside `.go` files) | ||
|
|
||
| ### Pull Requests | ||
|
|
||
| - Small, focused PRs with "subject: message" format | ||
| - Include unit tests for new functionality | ||
| - Run `make generate && make manifests && make helm` if API types changed | ||
| - CI runs all checks regardless of files changed (no path filters) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| AGENTS.md |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make lintinstructionThis guide states that all commands run from
ray-operator/, but it then instructsmake lint, which is not a valid target there (ray-operator/Makefilehas nolint:rule). Following this new instruction fails withNo rule to make target 'lint', so agents and contributors using this file will immediately hit a dead-end on the documented lint workflow.Useful? React with 👍 / 👎.