Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)
Python
Make local CI scripts autofix Ruff issues
Alishahryar1e24711af3fc9
diff --git a/AGENTS.md b/AGENTS.mdindex 07043c3b..b05c6087 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -11,12 +11,12 @@- Read `.env.example` for environment variables.- All CI checks must pass; failing checks block merge.- Add tests for new changes (including edge cases).-- Before pushing, prefer `./scripts/ci.sh` (macOS/Linux) or `.\scripts\ci.ps1` (Windows) to run all GitHub CI checks locally; requires `uv` on PATH.+- Before pushing, prefer `./scripts/ci.sh` (macOS/Linux) or `.\scripts\ci.ps1` (Windows) to run the local CI sequence; requires `uv` on PATH. The local scripts run Ruff in repair mode (`ruff format`, then `ruff check --fix`) before type checking and tests.- Use `--only` / `--skip` (PowerShell: `-Only` / `-Skip`) to run a subset when iterating; use `--dry-run` to print commands without running them.-- When formatting is needed, run `uv run ruff format` first; the CI scripts run `ruff format --check` and do not rewrite files.-- Fall back to individual commands only when debugging one failure: `uv run ruff format --check`, `uv run ruff check`, `uv run ty check`, `uv run pytest -v --tb=short`.+- GitHub CI remains check-only for Ruff (`ruff format --check`, `ruff check`) so branch protection verifies committed code.+- Fall back to individual repair commands when debugging local failures: `uv run ruff format`, `uv run ruff check --fix`, `uv run ty check`, `uv run pytest -v --tb=short`. Use GitHub-style checks only when verifying enforcement locally: `uv run ruff format --check`, `uv run ruff check`.- Do not add `# type: ignore` or `# ty: ignore`; fix the underlying type issue.-- All 5 checks are mirrored in `scripts/ci.sh` / `scripts/ci.ps1` and enforced in `tests.yml` on push/merge (parallel jobs: suppression grep, ruff-format, ruff-check, ty, pytest).+- All 5 check IDs are represented in `scripts/ci.sh` / `scripts/ci.ps1` and enforced in `tests.yml` on push/merge (parallel jobs: suppression grep, ruff-format, ruff-check, ty, pytest).- Branch protection: set **required status checks** to **all** of those statuses (e.g. **Ban type ignore suppressions**, **ruff-format**, **ruff-check**, **ty**, **pytest**—use the exact labels GitHub shows, which may be prefixed with **CI /**). Remove **ci** from required checks if it was previously added for the old gate job.## IDENTITY & CONTEXTdiff --git a/CLAUDE.md b/CLAUDE.mdindex 9287bf2a..6030b6fc 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -11,12 +11,12 @@- Read `.env.example` for environment variables.- All CI checks must pass; failing checks block merge.- Add tests for new changes (including edge cases).-- Before pushing, prefer `./scripts/ci.sh` (macOS/Linux) or `.\scripts\ci.ps1` (Windows) to run all GitHub CI checks locally; requires `uv` on PATH.+- Before pushing, prefer `./scripts/ci.sh` (macOS/Linux) or `.\scripts\ci.ps1` (Windows) to run the local CI sequence; requires `uv` on PATH. The local scripts run Ruff in repair mode (`ruff format`, then `ruff check --fix`) before type checking and tests.- Use `--only` / `--skip` (PowerShell: `-Only` / `-Skip`) to run a subset when iterating; use `--dry-run` to print commands without running them.-- When formatting is needed, run `uv run ruff format` first; the CI scripts run `ruff format --check` and do not rewrite files.-- Fall back to individual commands only when debugging one failure: `uv run ruff format --check`, `uv run ruff check`, `uv run ty check`, `uv run pytest -v --tb=short`.+- GitHub CI remains check-only for Ruff (`ruff format --check`, `ruff check`) so branch protection verifies committed code.+- Fall back to individual repair commands when debugging local failures: `uv run ruff format`, `uv run ruff check --fix`, `uv run ty check`, `uv run pytest -v --tb=short`. Use GitHub-style checks only when verifying enforcement locally: `uv run ruff format --check`, `uv run ruff check`.- Do not add `# type: ignore` or `# ty: ignore`; fix the underlying type issue.-- All 5 checks are mirrored in `scripts/ci.sh` / `scripts/ci.ps1` and enforced in `tests.yml` on push/merge (parallel jobs: suppression grep, ruff-format, ruff-check, ty, pytest).+- All 5 check IDs are represented in `scripts/ci.sh` / `scripts/ci.ps1` and enforced in `tests.yml` on push/merge (parallel jobs: suppression grep, ruff-format, ruff-check, ty, pytest).- Branch protection: set **required status checks** to **all** of those statuses (e.g. **Ban type ignore suppressions**, **ruff-format**, **ruff-check**, **ty**, **pytest**—use the exact labels GitHub shows, which may be prefixed with **CI /**). Remove **ci** from required checks if it was previously added for the old gate job.## IDENTITY & CONTEXTdiff --git a/README.md b/README.mdindex 9d22d988..f6a6651d 100644--- a/README.md+++ b/README.md@@ -596,7 +596,9 @@ uv run uvicorn server:app --host 0.0.0.0 --port 8082### 3. Commands-Run all GitHub CI checks locally (requires `uv` on PATH):+Run the local CI sequence (requires `uv` on PATH). The local scripts format+Python files and apply autofixable Ruff lint fixes before type checking and+tests:```bash./scripts/ci.sh@@ -608,15 +610,18 @@ Run all GitHub CI checks locally (requires `uv` on PATH):Useful flags: `--only pytest`, `--skip pytest`, `--dry-run` (PowerShell: `-Only pytest`, `-Skip pytest`, `-DryRun`).-Or run individual checks manually:+Or run individual repair/check commands manually:```bash-uv run ruff format --check-uv run ruff check+uv run ruff format+uv run ruff check --fixuv run ty checkuv run pytest -v --tb=short```+GitHub CI remains check-only for Ruff with `uv run ruff format --check` and+`uv run ruff check`, so required status checks verify committed code.+CI also enforces a ban on `# type: ignore` / `# ty: ignore` suppressions; `scripts/ci.sh` and `scripts/ci.ps1` run that grep too.### 4. Package Scriptsdiff --git a/pyproject.toml b/pyproject.tomlindex 0e6e49b5..dc53ce46 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "hatchling.build"[project]name = "free-claude-code"-version = "2.3.9"+version = "2.3.10"description = "Middleware between Claude Code CLI (Anthropic API) and NVIDIA NIM"readme = "README.md"requires-python = ">=3.14.0"diff --git a/scripts/ci.ps1 b/scripts/ci.ps1index ad56bd9d..5bb58292 100644--- a/scripts/ci.ps1+++ b/scripts/ci.ps1@@ -22,13 +22,14 @@ function Show-Usage {@"Usage: ci.ps1 [options]-Runs the same local checks enforced by GitHub CI (.github/workflows/tests.yml).+Runs the local sequence for the same check IDs enforced by GitHub CI.Requires uv on PATH when running ruff, ty, or pytest checks.+Local ruff checks repair formatting and autofixable lint before later checks.Checks (in order):suppressions Ban # type: ignore / # ty: ignore suppressions- ruff-format uv run ruff format --check- ruff-check uv run ruff check+ ruff-format uv run ruff format+ ruff-check uv run ruff check --fixty uv run ty checkpytest uv run pytest -v --tb=short@@ -145,13 +146,13 @@ function Invoke-SuppressionsCheck {}function Invoke-RuffFormatCheck {- Write-Step "ruff format --check"- Invoke-CiCommand -FilePath "uv" -Arguments @("run", "ruff", "format", "--check")+ Write-Step "ruff format"+ Invoke-CiCommand -FilePath "uv" -Arguments @("run", "ruff", "format")}function Invoke-RuffLintCheck {- Write-Step "ruff check"- Invoke-CiCommand -FilePath "uv" -Arguments @("run", "ruff", "check")+ Write-Step "ruff check --fix"+ Invoke-CiCommand -FilePath "uv" -Arguments @("run", "ruff", "check", "--fix")}function Invoke-TyCheck {diff --git a/scripts/ci.sh b/scripts/ci.shindex 4e164ad7..1c7b9871 100755--- a/scripts/ci.sh+++ b/scripts/ci.sh@@ -11,13 +11,14 @@ show_usage() {cat <<'USAGE'Usage: ci.sh [options]-Runs the same local checks enforced by GitHub CI (.github/workflows/tests.yml).+Runs the local sequence for the same check IDs enforced by GitHub CI.Requires uv on PATH when running ruff, ty, or pytest checks.+Local ruff checks repair formatting and autofixable lint before later checks.Checks (in order):suppressions Ban # type: ignore / # ty: ignore suppressions- ruff-format uv run ruff format --check- ruff-check uv run ruff check+ ruff-format uv run ruff format+ ruff-check uv run ruff check --fixty uv run ty checkpytest uv run pytest -v --tb=short@@ -135,13 +136,13 @@ run_suppressions() {}run_ruff_format() {- step "ruff format --check"- run uv run ruff format --check+ step "ruff format"+ run uv run ruff format}run_ruff_check() {- step "ruff check"- run uv run ruff check+ step "ruff check --fix"+ run uv run ruff check --fix}run_ty() {diff --git a/tests/scripts/test_ci_scripts.py b/tests/scripts/test_ci_scripts.pyindex 0c6109d6..2a680e03 100644--- a/tests/scripts/test_ci_scripts.py+++ b/tests/scripts/test_ci_scripts.py@@ -65,8 +65,9 @@ def test_ci_sh_runs_ci_checks_in_order() -> None:assert "Fix the underlying type errors instead" in textassert "--exclude-dir=.venv" in textassert "--exclude-dir=.git" in text- assert "uv run ruff format --check" in text- assert "uv run ruff check" in text+ assert "uv run ruff format" in text+ assert "uv run ruff format --check" not in text+ assert "uv run ruff check --fix" in textassert "uv run ty check" in textassert "uv run pytest -v --tb=short" in textassert "--only" in text@@ -99,6 +100,36 @@ def test_ci_sh_dry_run_does_not_require_uv() -> None:assert "uv is required" not in result.stderr+ ("check_id", "command"),+ [+ ("ruff-format", "+ uv run ruff format"),+ ("ruff-check", "+ uv run ruff check --fix"),+ ],+)+def test_ci_sh_dry_run_prints_local_ruff_repair_commands(+ check_id: str, command: str+) -> None:+ result = subprocess.run(+ [+ _shell_interpreter(),+ str(_repo_root() / "scripts" / "ci.sh"),+ "--only",+ check_id,+ "--dry-run",+ ],+ cwd=_repo_root(),+ env={**os.environ, "PATH": _path_without_uv()},+ text=True,+ capture_output=True,+ check=False,+ )++ assert result.returncode == 0+ assert command in result.stdout+ assert "uv is required" not in result.stderr++def test_ci_sh_suppression_only_does_not_require_uv() -> None:result = subprocess.run([@@ -159,7 +190,9 @@ def test_ci_ps1_runs_ci_checks_in_order() -> None:assert "Fix the underlying type errors instead" in textassert ".venv" in textassert ".git" in text- assert '"format", "--check"' in text+ assert '"run", "ruff", "format"' in text+ assert '"format", "--check"' not in text+ assert '"run", "ruff", "check", "--fix"' in textassert '"-v", "--tb=short"' in textassert "-Only" in textassert "-Skip" in text@@ -193,6 +226,38 @@ def test_ci_ps1_dry_run_does_not_require_uv() -> None:assert "uv is required" not in result.stderr+ ("check_id", "command"),+ [+ ("ruff-format", "+ uv run ruff format"),+ ("ruff-check", "+ uv run ruff check --fix"),+ ],+)+def test_ci_ps1_dry_run_prints_local_ruff_repair_commands(+ check_id: str, command: str+) -> None:+ result = subprocess.run(+ [+ _powershell_interpreter(),+ "-NoProfile",+ "-File",+ str(_repo_root() / "scripts" / "ci.ps1"),+ "-Only",+ check_id,+ "-DryRun",+ ],+ cwd=_repo_root(),+ env={**os.environ, "PATH": _path_without_uv()},+ text=True,+ capture_output=True,+ check=False,+ )++ assert result.returncode == 0+ assert command in result.stdout+ assert "uv is required" not in result.stderr++def test_ci_ps1_suppression_only_does_not_require_uv() -> None:result = subprocess.run([diff --git a/uv.lock b/uv.lockindex e23714f5..84a6b6c1 100644--- a/uv.lock+++ b/uv.lock@@ -561,7 +561,7 @@ wheels = [[[package]]name = "free-claude-code"-version = "2.3.9"+version = "2.3.10"source = { editable = "." }dependencies = [{ name = "aiohttp" },