From bf96906b4a7d9f32a2700c8e1a6a00f8080e7c8d Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 13 Nov 2026 03:04:04 +0000 Subject: [PATCH 1/4] Add shared lint setup for CI and cloud agents Introduce scripts/install-lint-tools.sh and scripts/lint.sh (actionlint, zizmor, shellcheck, shfmt, rubocop), Cursor stop hook and environment install, AGENTS.md, and helper agent definitions. Add a lint job to the proxy integration workflow. Conservative .rubocop.yml plus minimal fixes. Co-authored-by: ProxyMesh AI --- .cursor/agents/ci-watcher.md | 17 ++++ .cursor/agents/ci-workflow.md | 36 ++++++++ .cursor/agents/lint-fixer.md | 23 +++++ .cursor/environment.json | 1 + .cursor/hooks.json | 6 ++ .cursor/hooks/lint-on-stop.sh | 19 +++++ .github/workflows/proxy_integration_tests.yml | 19 ++++- .rubocop.yml | 22 +++++ AGENTS.md | 75 +++++++++++++++++ ruby-proxy-headers.gemspec | 2 +- scripts/install-lint-tools.sh | 84 +++++++++++++++++++ scripts/lint.sh | 55 ++++++++++++ 12 files changed, 357 insertions(+), 2 deletions(-) create mode 100644 .cursor/agents/ci-watcher.md create mode 100644 .cursor/agents/ci-workflow.md create mode 100644 .cursor/agents/lint-fixer.md create mode 100644 .cursor/environment.json create mode 100644 .cursor/hooks.json create mode 100755 .cursor/hooks/lint-on-stop.sh create mode 100644 .rubocop.yml create mode 100644 AGENTS.md create mode 100755 scripts/install-lint-tools.sh create mode 100755 scripts/lint.sh diff --git a/.cursor/agents/ci-watcher.md b/.cursor/agents/ci-watcher.md new file mode 100644 index 0000000..d58cac5 --- /dev/null +++ b/.cursor/agents/ci-watcher.md @@ -0,0 +1,17 @@ +--- +name: ci-watcher +description: >- + Waits for the current PR's CI and returns only the failing jobs with the + tail of their logs. Use after every push instead of watching runs in the + main thread. +model: composer-2.5[fast=false] +readonly: true +--- + +# ci-watcher + +1. Run `gh pr checks --watch --fail-fast > /dev/null 2>&1 || true`, then + `gh pr checks`. +2. For each failing check, run `gh run view RUN_ID --log-failed | tail -n 80`. +3. Report PASS, or for each failure: the job name, the run URL and those 80 + lines. No analysis, no fixes, never full logs. diff --git a/.cursor/agents/ci-workflow.md b/.cursor/agents/ci-workflow.md new file mode 100644 index 0000000..a8cf4c8 --- /dev/null +++ b/.cursor/agents/ci-workflow.md @@ -0,0 +1,36 @@ +--- +name: ci-workflow +description: >- + Makes GitHub Actions workflow and dependabot.yml edits that the parent has + fully specified (SHA pins, timeouts, permissions, env indirection, + concurrency, branch filters). Not for designing new workflows or release + flows. +model: composer-2.5[fast=false] +--- + +# ci-workflow + +Rules: + +- Pin every action to a full 40-character commit SHA with an exact + `# vX.Y.Z` comment. Look the SHA up, never guess: + `gh api repos/OWNER/REPO/git/ref/tags/vX.Y.Z --jq .object`; if its type + is "tag", dereference with + `gh api repos/OWNER/REPO/git/tags/SHA --jq .object.sha`. + Reuse SHAs already pinned in this repo's other workflows. +- `runs-on: ubuntu-24.04`. `timeout-minutes` on every job. +- Workflow-level `permissions: {}` or `contents: read`; write scopes only on + the job that needs them. +- `persist-credentials: false` on checkout unless the job pushes. +- No `${{ }}` inside `run:`. Pass values through `env:` and quote them + ("$VAR"). For a list: `read -r -a args <<< "$VAR"`, then + `cmd "${args[@]}"`. +- No `pull_request_target` or `workflow_run`. +- Do not change triggers, job names or the job graph unless told to. + +Steps: make the edits, run `actionlint` and +`zizmor --offline .github/workflows`, and fix until both are clean for the +files you touched. + +Report: changes per file, each SHA with its tag, and the actionlint and +zizmor output. diff --git a/.cursor/agents/lint-fixer.md b/.cursor/agents/lint-fixer.md new file mode 100644 index 0000000..bdbf0a1 --- /dev/null +++ b/.cursor/agents/lint-fixer.md @@ -0,0 +1,23 @@ +--- +name: lint-fixer +description: >- + Fixes findings from scripts/lint.sh (actionlint, zizmor, shellcheck, shfmt, + rubocop) that need no design change. Use whenever scripts/lint.sh fails. +model: composer-2.5[fast=false] +--- + +# lint-fixer + +You fix lint findings in this repo and nothing else. + +1. Run `scripts/lint.sh`. +2. Fix each finding at its file:line with the smallest change that follows + AGENTS.md. +3. Never add disable comments, rubocop:disable, ignore files or `|| true`. Never change + workflow triggers, permissions or the job graph to silence a finding. If a + finding needs a design change, stop and report it. +4. Rerun `scripts/lint.sh`. Stop when it passes or after 3 rounds. +5. Do not commit or push. + +Report: each fix as file:line and rule, anything left and why, and the last +10 lines of `scripts/lint.sh` output. diff --git a/.cursor/environment.json b/.cursor/environment.json new file mode 100644 index 0000000..474f278 --- /dev/null +++ b/.cursor/environment.json @@ -0,0 +1 @@ +{"install": "bash scripts/install-lint-tools.sh"} diff --git a/.cursor/hooks.json b/.cursor/hooks.json new file mode 100644 index 0000000..3184952 --- /dev/null +++ b/.cursor/hooks.json @@ -0,0 +1,6 @@ +{ + "version": 1, + "hooks": { + "stop": [{ "command": ".cursor/hooks/lint-on-stop.sh", "loop_limit": 2 }] + } +} diff --git a/.cursor/hooks/lint-on-stop.sh b/.cursor/hooks/lint-on-stop.sh new file mode 100755 index 0000000..c826f54 --- /dev/null +++ b/.cursor/hooks/lint-on-stop.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Cursor stop hook: when scripts/lint.sh fails, send its output back to the +# agent as a follow-up. hooks.json caps the re-prompts with loop_limit. + +set -euo pipefail + +main() { + local output + if output="$(scripts/lint.sh 2>&1 = 2.4' s.add_development_dependency 'rake', '~> 13.0' s.add_development_dependency 'rspec', '~> 3.12' - s.add_development_dependency 'rubocop', '~> 1.50' + s.add_development_dependency 'rubocop', '~> 1.92' s.add_development_dependency 'yard', '~> 0.9' s.add_development_dependency 'excon', '~> 1.4' s.add_development_dependency 'faraday', '~> 2.14' diff --git a/scripts/install-lint-tools.sh b/scripts/install-lint-tools.sh new file mode 100755 index 0000000..2a69597 --- /dev/null +++ b/scripts/install-lint-tools.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +# Install the pinned lint tools into ~/.local/bin (linux x86_64). +# CI and .cursor/environment.json both run this script. + +set -euo pipefail + +readonly BIN_DIR="${HOME}/.local/bin" +readonly GH="https://github.com" +ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +readonly ROOT + +err() { + echo "$*" >&2 +} + +# Download a URL to a file and check its sha256. +fetch() { + local url="$1" + local sha="$2" + local dest="$3" + curl -fsSL -o "${dest}" "${url}" + echo "${sha} ${dest}" | sha256sum -c --quiet - || { + err "checksum mismatch: ${url}" + exit 1 + } +} + +install_actionlint() { + local version="1.7.12" + local sha="8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8" + fetch \ + "${GH}/rhysd/actionlint/releases/download/v${version}/actionlint_${version}_linux_amd64.tar.gz" \ + "${sha}" "${TMP}/actionlint.tar.gz" + tar -xzf "${TMP}/actionlint.tar.gz" -C "${BIN_DIR}" actionlint +} + +install_shellcheck() { + local version="0.11.0" + local sha="b7af85e41cc99489dcc21d66c6d5f3685138f06d34651e6d34b42ec6d54fe6f6" + fetch \ + "${GH}/koalaman/shellcheck/releases/download/v${version}/shellcheck-v${version}.linux.x86_64.tar.gz" \ + "${sha}" "${TMP}/shellcheck.tar.gz" + tar -xzf "${TMP}/shellcheck.tar.gz" -C "${TMP}" + install -m 755 "${TMP}/shellcheck-v${version}/shellcheck" "${BIN_DIR}" +} + +install_shfmt() { + local version="3.14.1" + local sha="76e77641faa025814b77f153b29796b8e6fa2fca03e0c76a691608b86c7ea7bf" + fetch \ + "${GH}/mvdan/sh/releases/download/v${version}/shfmt_v${version}_linux_amd64" \ + "${sha}" "${TMP}/shfmt" + install -m 755 "${TMP}/shfmt" "${BIN_DIR}/shfmt" +} + +install_zizmor() { + python3 -m pip install --user --quiet --break-system-packages \ + "zizmor==1.32.0" +} + +install_ruby_linters() { + if ! command -v bundle >/dev/null 2>&1; then + err "bundle not found; install Ruby and Bundler before running lint" + exit 1 + fi + ( + cd "${ROOT}" + bundle config set --local path 'vendor/bundle' + bundle install --quiet + ) +} + +main() { + TMP="$(mktemp -d)" + trap 'rm -rf "${TMP}"' EXIT + mkdir -p "${BIN_DIR}" + install_actionlint + install_shellcheck + install_shfmt + install_zizmor + install_ruby_linters +} + +main "$@" diff --git a/scripts/lint.sh b/scripts/lint.sh new file mode 100755 index 0000000..d5c38bb --- /dev/null +++ b/scripts/lint.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +# Run every repo lint check. CI, the stop hook and agents all run this. +# Install the tools first with scripts/install-lint-tools.sh. + +set -euo pipefail + +failed=() + +err() { + echo "$*" >&2 +} + +# Run a check and remember its name if it fails. +check() { + local name="$1" + shift + "$@" || failed+=("${name}") +} + +main() { + export PATH="${HOME}/.local/bin:${PATH}" + cd "$(git rev-parse --show-toplevel)" + local -a sh_files + mapfile -t sh_files < <(git ls-files -co --exclude-standard '*.sh') + + check actionlint actionlint + # Skip legacy release workflows; zizmor only on workflows this branch changes. + local -a wf=() + local path base="origin/main" + for path in .github/workflows/*; do + if [[ "$path" == .github/workflows/push_gem.yml ]] || + [[ "$path" == .github/workflows/github_release_on_release_branch_merge.yml ]]; then + continue + fi + if git rev-parse --verify --quiet "${base}" >/dev/null && + git cat-file -e "${base}:${path}" 2>/dev/null && + git diff --quiet "${base}" -- "$path"; then + continue + fi + wf+=("$path") + done + if ((${#wf[@]} > 0)); then + check zizmor zizmor --quiet --offline "${wf[@]}" + fi + check shellcheck shellcheck "${sh_files[@]}" + check shfmt shfmt -d -i 2 -ci "${sh_files[@]}" + check rubocop bundle exec rubocop + + if ((${#failed[@]} > 0)); then + err "lint failed: ${failed[*]}" + exit 1 + fi +} + +main "$@" From d5668847faccfc0ac0bc31cf1f6e9941b149dea5 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 13 Nov 2026 03:11:30 +0000 Subject: [PATCH 2/4] Remove obsolete rubocop:disable after conservative rubocop config Co-authored-by: ProxyMesh AI --- spec/typhoeus_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/typhoeus_spec.rb b/spec/typhoeus_spec.rb index 4d591b1..72e1c7d 100644 --- a/spec/typhoeus_spec.rb +++ b/spec/typhoeus_spec.rb @@ -114,7 +114,7 @@ def header_response(*blocks) headers: { 'X-App-Secret' => 'should-not-leak' }, ssl_verifypeer: false, ssl_verifyhost: 0, - http_version: :httpv1_1, # rubocop:disable Naming/VariableNumber -- Ethon's option name + http_version: :httpv1_1, timeout: 5 ) end From 40cf25a89ee4a02252611b25800be8f0b828bd6a Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 13 Nov 2026 03:16:25 +0000 Subject: [PATCH 3/4] Fix CI: lock rubocop dep and add Ruby setup to lint job Co-authored-by: ProxyMesh AI --- .github/workflows/proxy_integration_tests.yml | 6 ++++++ Gemfile.lock | 14 ++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/proxy_integration_tests.yml b/.github/workflows/proxy_integration_tests.yml index 0ba0c85..9f6bcd3 100644 --- a/.github/workflows/proxy_integration_tests.yml +++ b/.github/workflows/proxy_integration_tests.yml @@ -51,6 +51,12 @@ jobs: fetch-depth: 0 persist-credentials: false + - name: Set up Ruby + uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0 + with: + bundler-cache: false + ruby-version: ruby + - name: Install lint tools run: bash scripts/install-lint-tools.sh diff --git a/Gemfile.lock b/Gemfile.lock index d307ded..78b2ae1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,7 +29,6 @@ GEM logger faraday-net_http (3.5.0) net-http (~> 0.5) - ffi (1.17.4) ffi (1.17.4-aarch64-linux-gnu) ffi (1.17.4-aarch64-linux-musl) ffi (1.17.4-arm-linux-gnu) @@ -103,7 +102,7 @@ GEM parser (3.3.13.0) ast (~> 2.4.1) racc - prism (1.9.0) + prism (2.1.0) public_suffix (6.0.2) racc (1.8.1) rainbow (3.1.1) @@ -139,9 +138,9 @@ GEM rubocop-ast (>= 1.49.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.50.0) + rubocop-ast (1.51.0) parser (>= 3.3.7.2) - prism (~> 1.7) + prism (>= 1.7) ruby-progressbar (1.13.0) rubyntlm (0.6.8) base64 @@ -182,7 +181,7 @@ DEPENDENCIES rake (~> 13.0) rest-client (~> 2.1) rspec (~> 3.12) - rubocop (~> 1.50) + rubocop (~> 1.92) ruby-proxy-headers! typhoeus (~> 1.7) webmock (~> 3.18) @@ -202,7 +201,6 @@ CHECKSUMS excon (1.6.0) sha256=ebe2ab83c055ef8e117c62c91a3535b966a59a64868188219d49ab90cd83b65f faraday (2.15.1) sha256=8708154deda739c5e86cc42b74960e23e8491fce0eba9e11639a6a34b1ac288f faraday-net_http (3.5.0) sha256=2e7094c34e38754ee048cc3df47376f8657005d9375f8473bce1c3b526a22e36 - ffi (1.17.4) sha256=bcd1642e06f0d16fc9e09ac6d49c3a7298b9789bcb58127302f934e437d60acf ffi (1.17.4-aarch64-linux-gnu) sha256=b208f06f91ffd8f5e1193da3cae3d2ccfc27fc36fba577baf698d26d91c080df ffi (1.17.4-aarch64-linux-musl) sha256=9286b7a615f2676245283aef0a0a3b475ae3aae2bb5448baace630bb77b91f39 ffi (1.17.4-arm-linux-gnu) sha256=d6dbddf7cb77bf955411af5f187a65b8cd378cb003c15c05697f5feee1cb1564 @@ -242,7 +240,7 @@ CHECKSUMS nokogiri (1.19.6-x86_64-linux-musl) sha256=c92b29e897f4ddc19bea67188695aab667f695e74592a5c8741642ecb25d34d9 parallel (1.28.0) sha256=33e6de1484baf2524792d178b0913fc8eb94c628d6cfe45599ad4458c638c970 parser (3.3.13.0) sha256=e02f9b63c2fe05b0c68f692ba4df89b3cb113b663964f75d988fbebfd6c3deca - prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85 + prism (2.1.0) sha256=1c0a7c6dea0e93183390fb123f007564dbe663198e2f86ad87204151147601f3 public_suffix (6.0.2) sha256=bfa7cd5108066f8c9602e0d6d4114999a5df5839a63149d3e8b0f9c1d3558394 racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a @@ -256,7 +254,7 @@ CHECKSUMS rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47 rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c rubocop (1.92.2) sha256=14fb31eed143a0dc6f78186c550c1715e81cd38f59d05d1165050e445c1f5382 - rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788db + rubocop-ast (1.51.0) sha256=0ec311e36b191b3872d909078a35274e962ae97dbce64be6812d145ca59acfcb ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 ruby-proxy-headers (0.2.3) rubyntlm (0.6.8) sha256=054aa45ffcae40db4020d3e41da41f40427aa8733181a2b87751f04ba53ca0d5 From 1a52aa22a067367cd3c5a1275dc648fd05540a62 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 13 Nov 2026 03:18:59 +0000 Subject: [PATCH 4/4] Restore generic ffi platform entry in Gemfile.lock Co-authored-by: ProxyMesh AI --- Gemfile.lock | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 78b2ae1..90c06f2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,6 +29,7 @@ GEM logger faraday-net_http (3.5.0) net-http (~> 0.5) + ffi (1.17.4) ffi (1.17.4-aarch64-linux-gnu) ffi (1.17.4-aarch64-linux-musl) ffi (1.17.4-arm-linux-gnu) @@ -102,7 +103,7 @@ GEM parser (3.3.13.0) ast (~> 2.4.1) racc - prism (2.1.0) + prism (1.9.0) public_suffix (6.0.2) racc (1.8.1) rainbow (3.1.1) @@ -138,9 +139,9 @@ GEM rubocop-ast (>= 1.49.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.51.0) + rubocop-ast (1.50.0) parser (>= 3.3.7.2) - prism (>= 1.7) + prism (~> 1.7) ruby-progressbar (1.13.0) rubyntlm (0.6.8) base64 @@ -201,6 +202,7 @@ CHECKSUMS excon (1.6.0) sha256=ebe2ab83c055ef8e117c62c91a3535b966a59a64868188219d49ab90cd83b65f faraday (2.15.1) sha256=8708154deda739c5e86cc42b74960e23e8491fce0eba9e11639a6a34b1ac288f faraday-net_http (3.5.0) sha256=2e7094c34e38754ee048cc3df47376f8657005d9375f8473bce1c3b526a22e36 + ffi (1.17.4) sha256=bcd1642e06f0d16fc9e09ac6d49c3a7298b9789bcb58127302f934e437d60acf ffi (1.17.4-aarch64-linux-gnu) sha256=b208f06f91ffd8f5e1193da3cae3d2ccfc27fc36fba577baf698d26d91c080df ffi (1.17.4-aarch64-linux-musl) sha256=9286b7a615f2676245283aef0a0a3b475ae3aae2bb5448baace630bb77b91f39 ffi (1.17.4-arm-linux-gnu) sha256=d6dbddf7cb77bf955411af5f187a65b8cd378cb003c15c05697f5feee1cb1564 @@ -240,7 +242,7 @@ CHECKSUMS nokogiri (1.19.6-x86_64-linux-musl) sha256=c92b29e897f4ddc19bea67188695aab667f695e74592a5c8741642ecb25d34d9 parallel (1.28.0) sha256=33e6de1484baf2524792d178b0913fc8eb94c628d6cfe45599ad4458c638c970 parser (3.3.13.0) sha256=e02f9b63c2fe05b0c68f692ba4df89b3cb113b663964f75d988fbebfd6c3deca - prism (2.1.0) sha256=1c0a7c6dea0e93183390fb123f007564dbe663198e2f86ad87204151147601f3 + prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85 public_suffix (6.0.2) sha256=bfa7cd5108066f8c9602e0d6d4114999a5df5839a63149d3e8b0f9c1d3558394 racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a @@ -254,7 +256,7 @@ CHECKSUMS rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47 rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c rubocop (1.92.2) sha256=14fb31eed143a0dc6f78186c550c1715e81cd38f59d05d1165050e445c1f5382 - rubocop-ast (1.51.0) sha256=0ec311e36b191b3872d909078a35274e962ae97dbce64be6812d145ca59acfcb + rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788db ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33 ruby-proxy-headers (0.2.3) rubyntlm (0.6.8) sha256=054aa45ffcae40db4020d3e41da41f40427aa8733181a2b87751f04ba53ca0d5