From a7c03a91eae7404535dbd23adc2be5b47b590484 Mon Sep 17 00:00:00 2001 From: Ivan Pusic <450140+ivpusic@users.noreply.github.com> Date: Fri, 20 Nov 2026 09:55:08 +0000 Subject: [PATCH] Enable Claude review and auto-approve (dry run) Adds AGENTS.md with the review risk boundaries Claude judges PRs against, and a caller of the shared Claude workflow in duneanalytics/actions with auto-approve in dry-run mode. Approvals also need duneanalytics/cli on the allowlist in duneanalytics/actions. --- .github/workflows/claude.yml | 42 +++++++++++++++++++++++++++++ AGENTS.md | 51 ++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 .github/workflows/claude.yml create mode 100644 AGENTS.md diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 0000000..f48ea6f --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,42 @@ +name: Claude + +# Review on every ready PR, then auto-approve when Claude rates the diff low risk +# against "Review risk boundaries" in AGENTS.md. Approvals are submitted by the Claude +# GitHub App, and only once duneanalytics/cli is on the allowlist in duneanalytics/actions. + +on: + pull_request: + types: [opened, ready_for_review, reopened] + issue_comment: + types: [created] + +permissions: + contents: read + pull-requests: write + checks: read + statuses: read + id-token: write + +jobs: + claude: + # Public repository: PRs from forks get no secrets or OIDC token, so they are skipped. + # Org members can still run "@claude review" on any PR. + if: github.event_name == 'issue_comment' || github.event.pull_request.head.repo.full_name == github.repository + uses: duneanalytics/actions/.github/workflows/claude.yml@main + with: + # The self-hosted runner group does not allow public repositories. + runs-on: '"ubuntu-latest"' + auto-approve: true + # Decision comments only, until they look right; then set to false. + dry-run: true + deny-paths: | + .github/* + install.sh + .goreleaser.yml + AGENTS.md + CLAUDE.md + authconfig/* + tracking/* + secrets: + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + SIETCH_APP_PRIVATE_KEY: ${{ secrets.SIETCH_APP_PRIVATE_KEY }} diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..7dedfc2 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,51 @@ +# Agent Instructions for cli + +> Keep this document lean. It is a navigation and working guide; usage belongs in `README.md`. + +## Overview + +`dune` is Dune's public command-line client. Commands call the REST API through +`duneapi-client-go`; only features with no REST endpoint call the Dune MCP server +through `dunemcp/`. Users and scripts depend on command names, flags, exit codes and +`-o json` output. + +## Repository Map + +| Path | Responsibility | +| ------------------------ | -------------------------------------------------------- | +| `cmd/` | One package per command group; `cmd/main.go` is the entry. | +| `cli/` | Root command and wiring. | +| `cmdutil/`, `output/` | Shared flag parsing, clients and text/JSON output. | +| `dunemcp/` | Small MCP client and its test fake. | +| `authconfig/` | API key and identity stored on the user's disk. | +| `tracking/` | Amplitude usage telemetry. | +| `install.sh`, `.goreleaser.yml`, `flake.nix` | Distribution. | + +## Build & Test + +```bash +make lint +make test +``` + +`flake.nix` pins a `vendorHash`; update it when `go.mod` or `go.sum` changes. + +## Review risk boundaries + +Claude auto-approve may approve a pull request only when every change is low risk: +bug fixes and features inside `cmd/`, `cli/`, `cmdutil/`, `output/` and `dunemcp/`, +tests, documentation, and patch or minor bumps of existing Go dependencies. + +These changes need a human review: + +- Everything under `.github/`, `install.sh`, `.goreleaser.yml`, and `AGENTS.md` or `CLAUDE.md`. +- `authconfig/`: how the API key is read, stored or written, and file permissions. +- `tracking/`: what telemetry is sent, when, or how users opt out. +- Sending the API key or user data to a new host, or changing which host a command calls. +- Breaking changes for users and scripts: removing or renaming a command or flag, + changing a flag's default, changing the exit code of an existing case, or removing or + renaming a key in `-o json` output. +- Newly added dependencies, major-version bumps of a dependency (a `0.x` minor counts as + major), the Go version in `go.mod`, and dependencies from a source other than the Go + module proxy (`replace` directives, forks). +- Deleting a test whose subject code stays.