-
Notifications
You must be signed in to change notification settings - Fork 41
Adding Claude slash command helper to external-dns-operator #297
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
Thealisyed
wants to merge
2
commits into
openshift:main
Choose a base branch
from
Thealisyed:addingclaude
base: main
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
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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,152 @@ | ||
| # External DNS Operator - Claude Code Commands | ||
|
|
||
| This directory contains custom Claude Code slash commands to help with development and PR review workflows. | ||
|
|
||
| ## Available Commands | ||
|
|
||
| ### `/external-dns-operator-helper` | ||
|
|
||
| Automated PR review workflow that runs comprehensive quality checks on Pull Requests. | ||
|
|
||
| --- | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| You need **Claude Code** installed and configured. See [Claude Code Documentation](https://docs.google.com/document/d/1eNARy9CI28o09E7Foq01e5WD5MvEj3LSBnXqFcprxjo/edit?tab=t.0#heading=h.8ldy5by9bpo8) for installation instructions. | ||
|
|
||
| --- | ||
|
|
||
| ## How to Use the `/external-dns-operator-helper` Command | ||
|
|
||
| ### Step 1: Open Claude Code | ||
|
|
||
| Launch Claude Code in your terminal or IDE. | ||
|
|
||
| ### Step 2: Navigate to Repository | ||
|
|
||
| Ensure you're in the external-dns-operator repository directory: | ||
|
|
||
| ```bash | ||
| cd /path/to/external-dns-operator | ||
| ``` | ||
|
|
||
| ### Step 3: Run the Command | ||
|
|
||
| In Claude Code, use the slash command with a PR URL: | ||
|
|
||
| ``` | ||
| /external-dns-operator-helper https://github.com/openshift/external-dns-operator/pull/123 | ||
| ``` | ||
|
|
||
| **Replace `123` with the actual PR number you want to review.** | ||
|
|
||
| ### Step 4: Review the Results | ||
|
|
||
| Claude Code will automatically: | ||
| 1. ✅ Check for uncommitted changes and save your current branch | ||
| 2. ✅ Checkout the PR | ||
| 3. ✅ Run `make verify` (lint, format, deps, generated code, OLM) | ||
| 4. ✅ Run `make test` (unit tests with coverage) | ||
| 5. ✅ Run `make build` (compilation check) | ||
| 6. ✅ Perform specialized checks (API changes, tests, docs) | ||
| 7. ✅ Generate comprehensive report | ||
| 8. ✅ Return to your original branch | ||
|
|
||
| --- | ||
|
|
||
| ## Common Use Cases | ||
|
|
||
| ### Use Case 1: Pre-Submission PR Check | ||
|
|
||
| **Before creating or updating your PR**, validate your changes: | ||
|
|
||
| ```bash | ||
| # 1. Push your changes to your fork | ||
| git push origin your-branch-name | ||
|
|
||
| # 2. Create the PR (via GitHub UI or gh CLI) | ||
| # Get the PR URL, then run: | ||
| /external-dns-operator-helper https://github.com/openshift/external-dns-operator/pull/YOUR-PR-NUMBER | ||
| ``` | ||
|
|
||
| ### Use Case 2: Review Someone Else's PR | ||
|
|
||
| **Before manually reviewing**, run automated checks: | ||
|
|
||
| ```bash | ||
| # Someone asks you to review PR #296 | ||
| /external-dns-operator-helper https://github.com/openshift/external-dns-operator/pull/296 | ||
| ``` | ||
|
|
||
| If automated checks pass, you can focus on code logic and architecture review. | ||
|
|
||
| ### Use Case 3: Debugging CI Failures | ||
|
|
||
| **When CI fails on your PR**, reproduce locally: | ||
|
|
||
| ```bash | ||
| # Your PR #301 failed CI, check it locally: | ||
| /external-dns-operator-helper https://github.com/openshift/external-dns-operator/pull/301 | ||
| ``` | ||
|
|
||
| The command will show the same errors CI would show, with detailed explanations. | ||
|
|
||
| ### Use Case 4: Learning Best Practices | ||
|
|
||
| **New to the project?** Use it to learn what checks are required: | ||
|
|
||
| ```bash | ||
| # Review a recent merged PR to see what passed: | ||
| /external-dns-operator-helper https://github.com/openshift/external-dns-operator/pull/296 | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## What the Command Checks | ||
|
|
||
| ### 1. Linting (`make lint`) | ||
| - errcheck, gofmt, goimports, gosimple, govet | ||
| - ineffassign, misspell, staticcheck, typecheck, unused | ||
| - Configuration: `.golangci.yaml` | ||
|
|
||
| ### 2. Formatting (`hack/verify-gofmt.sh`) | ||
| - All `.go` files must be `gofmt -s` compliant | ||
|
|
||
| ### 3. Dependencies (`hack/verify-deps.sh`) | ||
| - `go.mod` and `go.sum` are in sync | ||
| - `vendor/` directory is up-to-date | ||
|
|
||
| ### 4. Generated Code (`hack/verify-generated.sh`) | ||
| - DeepCopy methods are current (`make generate`) | ||
| - CRDs, RBAC, webhooks are current (`make manifests`) | ||
|
|
||
| ### 5. OLM Bundle (`hack/verify-olm.sh`) | ||
| - Bundle manifests are up-to-date (`make bundle`) | ||
| - Catalog is current (`make catalog`) | ||
|
|
||
| ### 6. Unit Tests (`make test`) | ||
| - All unit tests pass | ||
| - No race conditions (runs with `-race`) | ||
| - Coverage report generated | ||
|
|
||
| ### 7. Build Validation (`make build`) | ||
| - Operator binary compiles successfully | ||
|
|
||
| ### 8. Specialized Checks | ||
| - API changes → CRD updates | ||
| - Controller changes → Test updates | ||
| - User-facing changes → Documentation updates | ||
| - Kubebuilder markers → Proper documentation | ||
|
|
||
| --- | ||
|
|
||
|
|
||
|
|
||
| ## Additional Resources | ||
|
|
||
| - **AGENTS.md**: Comprehensive repository development guide | ||
| - **CLAUDE.md**: Symlink to AGENTS.md | ||
| - **Makefile**: Build targets and CI automation | ||
| - **docs/**: External DNS Operator documentation | ||
|
|
||
| --- |
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,41 @@ | ||
| ```yaml | ||
| name: external-dns-operator-helper | ||
| description: Run comprehensive PR review workflow for External DNS Operator changes with CI analysis | ||
| parameters: | ||
| - name: pr_url | ||
| description: GitHub PR URL to review (e.g., https://github.com/openshift/external-dns-operator/pull/123) | ||
| required: true | ||
| ``` | ||
|
|
||
| I'll run a comprehensive automated review of the External DNS Operator PR. This includes checking out the PR, analyzing CI status, validating commits, checking Effective Go style, running local verification, and providing actionable feedback. | ||
|
|
||
| ```bash | ||
| bash .claude/scripts/pr-review.sh "{{pr_url}}" | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## What This Does | ||
|
|
||
| **Single command execution** that runs all checks without user interaction: | ||
|
|
||
| 1. **PR Info** - Shows commits, files changed, PR size | ||
| 2. **CI Status** - Displays Prow job results with clickable links (no deep log parsing) | ||
| 3. **Commit Validation** - Checks JIRA-ID format | ||
| 4. **Effective Go** - Validates receiver names, error strings, exported docs | ||
| 5. **Make Targets** - Runs verify, test, build | ||
| 6. **Specialized** - API/CRD sync, controller/test coverage, docs | ||
| 7. **Summary** - Clear pass/fail report | ||
|
|
||
|
|
||
|
|
||
| ## Requirements | ||
|
|
||
| - Git with `upstream` remote | ||
| - `jq` (optional - degrades gracefully without it) | ||
|
|
||
| ## Usage | ||
|
|
||
| ```bash | ||
| /external-dns-operator-helper https://github.com/openshift/external-dns-operator/pull/294 | ||
| ``` | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.