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
Add FCC uninstall scripts (#836)
Ali Khokharc51a15608d2c
diff --git a/AGENTS.md b/AGENTS.mdindex ef4c3ac9..07043c3b 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -10,10 +10,13 @@- Current uv ruff formatter is set to py314 which has supports multiple exception types without paranthesis (except TypeError, ValueError:)- Read `.env.example` for environment variables.- All CI checks must pass; failing checks block merge.-- Add tests for new changes (including edge cases), then run `uv run pytest`.-- Run checks in this order: `uv run ruff format`, `uv run ruff check`, `uv run ty check`, `uv run pytest`.+- 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.+- 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`.- Do not add `# type: ignore` or `# ty: ignore`; fix the underlying type issue.-- All 5 checks are enforced in `tests.yml` on push/merge (parallel jobs: suppression grep, ruff-format, ruff-check, ty, pytest).+- 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).- 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 & CONTEXT@@ -40,7 +43,7 @@1. **ANALYZE**: Read relevant files. Do not guess.2. **PLAN**: Map out the logic. Identify root cause or required changes. Order changes by dependency.3. **EXECUTE**: Fix the cause, not the symptom. Execute incrementally with clear commits.-4. **VERIFY**: Run ci checks and relevant smoke tests. Confirm the fix via logs or output.+4. **VERIFY**: Run `./scripts/ci.sh` or `.\scripts\ci.ps1`, plus relevant smoke tests when needed. Confirm the fix via logs or output.5. **SPECIFICITY**: Do exactly as much as asked; nothing more, nothing less.6. **PROPAGATION**: Changes impact multiple files; propagate updates correctly.7. **VERSION**: If the commit touches production files on `main`, bump semver in the same commit (see [Versioning](#versioning-main)).@@ -56,7 +59,7 @@ These paths count as production (runtime, packaging, or install surface):- `api/`, `cli/`, `config/`, `core/`, `messaging/`, `providers/`- `.env.example`- `pyproject.toml` (dependencies, scripts, packaging)-- `scripts/install.sh`, `scripts/install.ps1`+- `scripts/install.sh`, `scripts/install.ps1`, `scripts/uninstall.sh`, `scripts/uninstall.ps1`, `scripts/ci.sh`, `scripts/ci.ps1`These do **not** require a version bump on their own:diff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex 6a3c63c7..8823b4f2 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -99,6 +99,14 @@ Console scripts are registered in [pyproject.toml](pyproject.toml):- `fcc-claude` calls `cli.entrypoints:launch_claude`.- `fcc-codex` calls `cli.entrypoints:launch_codex`.+[scripts/install.sh](scripts/install.sh) and [scripts/install.ps1](scripts/install.ps1)+install or update the uv tool plus optional voice extras. [scripts/uninstall.sh](scripts/uninstall.sh)+and [scripts/uninstall.ps1](scripts/uninstall.ps1) remove only the FCC uv tool and always+delete the managed `~/.fcc/` tree from [config/paths.py](config/paths.py); they do not remove+uv, Claude Code, Codex, or uv-managed Python runtimes. [scripts/ci.sh](scripts/ci.sh) and+[scripts/ci.ps1](scripts/ci.ps1) mirror [.github/workflows/tests.yml](.github/workflows/tests.yml)+for local pre-push verification.+[cli/entrypoints.py](cli/entrypoints.py) starts the FastAPI server with Uvicorn.`serve()` migrates legacy env files when needed, loads cached settings, runs asupervised server instance, and can restart the server after admin config changes.diff --git a/CLAUDE.md b/CLAUDE.mdindex 226e9e53..9287bf2a 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -10,10 +10,13 @@- Current uv ruff formatter is set to py314 which has supports multiple exception types without paranthesis (except TypeError, ValueError:)- Read `.env.example` for environment variables.- All CI checks must pass; failing checks block merge.-- Add tests for new changes (including edge cases), then run `uv run pytest`.-- Run checks in this order: `uv run ruff format`, `uv run ruff check`, `uv run ty check`, `uv run pytest`.+- 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.+- 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`.- Do not add `# type: ignore` or `# ty: ignore`; fix the underlying type issue.-- All 5 checks are enforced in `tests.yml` on push/merge (parallel jobs: suppression grep, ruff-format, ruff-check, ty, pytest).+- 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).- 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 & CONTEXT@@ -40,7 +43,7 @@1. **ANALYZE**: Read relevant files. Do not guess.2. **PLAN**: Map out the logic. Identify root cause or required changes. Order changes by dependency.3. **EXECUTE**: Fix the cause, not the symptom. Execute incrementally with clear commits.-4. **VERIFY**: Run ci checks and relevant smoke tests. Confirm the fix via logs or output.+4. **VERIFY**: Run `./scripts/ci.sh` or `.\scripts\ci.ps1`, plus relevant smoke tests when needed. Confirm the fix via logs or output.5. **SPECIFICITY**: Do exactly as much as asked; nothing more, nothing less.6. **PROPAGATION**: Changes impact multiple files; propagate updates correctly.7. **VERSION**: If the commit touches production files on `main`, bump semver in the same commit (see [Versioning](#versioning-main)).@@ -56,7 +59,7 @@ These paths count as production (runtime, packaging, or install surface):- `api/`, `cli/`, `config/`, `core/`, `messaging/`, `providers/`- `.env.example`- `pyproject.toml` (dependencies, scripts, packaging)-- `scripts/install.sh`, `scripts/install.ps1`+- `scripts/install.sh`, `scripts/install.ps1`, `scripts/uninstall.sh`, `scripts/uninstall.ps1`, `scripts/ci.sh`, `scripts/ci.ps1`These do **not** require a version bump on their own:diff --git a/README.md b/README.mdindex 4ea3695e..30370cbe 100644--- a/README.md+++ b/README.md@@ -86,6 +86,22 @@ irm "https://github.com/Alishahryar1/free-claude-code/blob/main/scripts/install.Review the installers at [scripts/install.sh](https://github.com/Alishahryar1/free-claude-code/blob/main/scripts/install.sh) and [scripts/install.ps1](https://github.com/Alishahryar1/free-claude-code/blob/main/scripts/install.ps1). They install Claude Code and Codex when missing, then install or update the proxy. Re-run these commands to update to the latest version.+To remove only Free Claude Code (not uv, Claude Code, Codex, or the uv-managed Python runtime):++macOS/Linux:++```bash+curl -fsSL "https://raw.githubusercontent.com/Alishahryar1/free-claude-code/main/scripts/uninstall.sh" | sh+```++Windows PowerShell:++```powershell+irm "https://raw.githubusercontent.com/Alishahryar1/free-claude-code/main/scripts/uninstall.ps1" | iex+```++Review [scripts/uninstall.sh](https://github.com/Alishahryar1/free-claude-code/blob/main/scripts/uninstall.sh) and [scripts/uninstall.ps1](https://github.com/Alishahryar1/free-claude-code/blob/main/scripts/uninstall.ps1). They remove the FCC uv tool and always delete `~/.fcc/`. Stop any running `fcc-server`, `fcc-claude`, `fcc-codex`, `fcc-init`, or `free-claude-code` process before uninstalling.+### 2. Start The Proxy```bash@@ -580,14 +596,28 @@ uv run uvicorn server:app --host 0.0.0.0 --port 8082### 3. Commands+Run all GitHub CI checks locally (requires `uv` on PATH):++```bash+./scripts/ci.sh+```++```powershell+.\scripts\ci.ps1+```++Useful flags: `--only pytest`, `--skip pytest`, `--dry-run` (PowerShell: `-Only pytest`, `-Skip pytest`, `-DryRun`).++Or run individual checks manually:+```bash-uv run ruff format+uv run ruff format --checkuv run ruff checkuv run ty check-uv run pytest+uv run pytest -v --tb=short```-Run them in that order before pushing. CI enforces the same checks.+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 675a0b6b..bcd730a2 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "hatchling.build"[project]name = "free-claude-code"-version = "2.2.1"+version = "2.3.0"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.ps1new file mode 100644index 00000000..ad56bd9d--- /dev/null+++ b/scripts/ci.ps1@@ -0,0 +1,209 @@+param(+ [string[]] $Only = @(),+ [string[]] $Skip = @(),+ [switch] $DryRun,+ [switch] $Help,+ [Parameter(ValueFromRemainingArguments = $true)]+ [object[]] $RemainingArgs = @()+)++Set-StrictMode -Version Latest+$ErrorActionPreference = "Stop"++$CheckOrder = @(+ "suppressions",+ "ruff-format",+ "ruff-check",+ "ty",+ "pytest"+)++function Show-Usage {+ @"+Usage: ci.ps1 [options]++Runs the same local checks enforced by GitHub CI (.github/workflows/tests.yml).+Requires uv on PATH when running ruff, ty, or pytest checks.++Checks (in order):+ suppressions Ban # type: ignore / # ty: ignore suppressions+ ruff-format uv run ruff format --check+ ruff-check uv run ruff check+ ty uv run ty check+ pytest uv run pytest -v --tb=short++Options:+ -Only ID Run only the given check (repeatable)+ -Skip ID Skip the given check (repeatable)+ -DryRun Print commands without running them.+ -Help Show this help text.+"@+}++function Write-Step {+ param([string] $Message)++ Write-Host ""+ Write-Host "==> $Message"+}++function Format-Argument {+ param([string] $Value)++ if ($Value -match '^[A-Za-z0-9_./:@%+=,\[\]-]+$') {+ return $Value+ }++ return "'" + ($Value -replace "'", "''") + "'"+}++function Invoke-CiCommand {+ param(+ [string] $FilePath,+ [string[]] $Arguments = @()+ )++ $parts = @($FilePath) + $Arguments+ $commandText = ($parts | ForEach-Object { Format-Argument ([string] $_) }) -join " "+ Write-Host "+ $commandText"++ if (-not $DryRun) {+ & $FilePath @Arguments+ if ($LASTEXITCODE -ne 0) {+ throw "Command failed with exit code ${LASTEXITCODE}: $commandText"+ }+ }+}++function Test-ValidCheckId {+ param([string] $CheckId)++ return $CheckOrder -contains $CheckId+}++function Assert-ValidCheckId {+ param([string] $CheckId)++ if (-not (Test-ValidCheckId $CheckId)) {+ throw "unknown check id: $CheckId (expected one of: $($CheckOrder -join ', '))"+ }+}++function Test-ShouldRunCheck {+ param([string] $CheckId)++ if ($Only.Count -gt 0 -and ($Only -notcontains $CheckId)) {+ return $false+ }++ if ($Skip -contains $CheckId) {+ return $false+ }++ return $true+}++function Assert-UvAvailable {+ if (-not (Get-Command uv -ErrorAction SilentlyContinue)) {+ throw "uv is required but was not found on PATH. Install uv first (see README or scripts/install.ps1)."+ }+}++function Test-SelectedChecksNeedUv {+ if ($DryRun) {+ return $false+ }++ foreach ($checkId in $CheckOrder) {+ if ((Test-ShouldRunCheck $checkId) -and $checkId -ne "suppressions") {+ return $true+ }+ }++ return $false+}++function Invoke-SuppressionsCheck {+ Write-Step "Ban type ignore suppressions"+ $pattern = '# type: ignore|# ty: ignore'+ Write-Host "+ Get-ChildItem -Recurse -Filter *.py (excluding .venv, .git) | Select-String '$pattern'"++ if (-not $DryRun) {+ $matches = Get-ChildItem -Path . -Recurse -Filter *.py -File |+ Where-Object {+ $full = $_.FullName+ $full -notmatch '[\\/]\.venv[\\/]' -and+ $full -notmatch '[\\/]\.git[\\/]'+ } |+ Select-String -Pattern $pattern++ if ($matches) {+ $matches | ForEach-Object { Write-Host $_.Line }+ throw "type: ignore / ty: ignore comments are not allowed. Fix the underlying type errors instead."+ }+ }+}++function Invoke-RuffFormatCheck {+ Write-Step "ruff format --check"+ Invoke-CiCommand -FilePath "uv" -Arguments @("run", "ruff", "format", "--check")+}++function Invoke-RuffLintCheck {+ Write-Step "ruff check"+ Invoke-CiCommand -FilePath "uv" -Arguments @("run", "ruff", "check")+}++function Invoke-TyCheck {+ Write-Step "ty check"+ Invoke-CiCommand -FilePath "uv" -Arguments @("run", "ty", "check")+}++function Invoke-PytestCheck {+ Write-Step "pytest"+ Invoke-CiCommand -FilePath "uv" -Arguments @("run", "pytest", "-v", "--tb=short")+}++function Invoke-Check {+ param([string] $CheckId)++ switch ($CheckId) {+ "suppressions" { Invoke-SuppressionsCheck }+ "ruff-format" { Invoke-RuffFormatCheck }+ "ruff-check" { Invoke-RuffLintCheck }+ "ty" { Invoke-TyCheck }+ "pytest" { Invoke-PytestCheck }+ default { throw "unknown check id: $CheckId" }+ }+}++if ($Help) {+ Show-Usage+ return+}++if ($RemainingArgs.Count -gt 0) {+ Show-Usage+ throw "Unknown option: $($RemainingArgs -join ' ')"+}++foreach ($checkId in $Only) {+ Assert-ValidCheckId $checkId+}++foreach ($checkId in $Skip) {+ Assert-ValidCheckId $checkId+}++if (Test-SelectedChecksNeedUv) {+ Assert-UvAvailable+}++foreach ($checkId in $CheckOrder) {+ if (Test-ShouldRunCheck $checkId) {+ Invoke-Check $checkId+ }+}++Write-Host ""+Write-Host "All selected CI checks passed."diff --git a/scripts/ci.sh b/scripts/ci.shnew file mode 100755index 00000000..4e164ad7--- /dev/null+++ b/scripts/ci.sh@@ -0,0 +1,210 @@+#!/bin/sh+set -eu++CHECK_ORDER="suppressions ruff-format ruff-check ty pytest"++dry_run=0+only_checks=""+skip_checks=""++show_usage() {+ cat <<'USAGE'+Usage: ci.sh [options]++Runs the same local checks enforced by GitHub CI (.github/workflows/tests.yml).+Requires uv on PATH when running ruff, ty, or pytest checks.++Checks (in order):+ suppressions Ban # type: ignore / # ty: ignore suppressions+ ruff-format uv run ruff format --check+ ruff-check uv run ruff check+ ty uv run ty check+ pytest uv run pytest -v --tb=short++Options:+ --only ID Run only the given check (repeatable)+ --skip ID Skip the given check (repeatable)+ --dry-run Print commands without running them.+ --help Show this help text.+USAGE+}++fail() {+ printf 'error: %s\n' "$*" >&2+ exit 1+}++step() {+ printf '\n==> %s\n' "$1"+}++quote_arg() {+ case "$1" in+ *[!A-Za-z0-9_./:@%+=,-]*|"")+ escaped=$(printf '%s' "$1" | sed 's/\\/\\\\/g; s/"/\\"/g')+ printf '"%s"' "$escaped"+ ;;+ *)+ printf '%s' "$1"+ ;;+ esac+}++print_command() {+ printf '+'+ for arg in "$@"; do+ printf ' '+ quote_arg "$arg"+ done+ printf '\n'+}++run() {+ print_command "$@"+ if [ "$dry_run" -eq 0 ]; then+ "$@"+ fi+}++valid_check_id() {+ case "$1" in+ suppressions | ruff-format | ruff-check | ty | pytest) return 0 ;;+ *) return 1 ;;+ esac+}++validate_check_id() {+ if ! valid_check_id "$1"; then+ fail "unknown check id: $1 (expected one of: $CHECK_ORDER)"+ fi+}++contains_check_id() {+ list=$1+ id=$2+ case " $list " in+ *" $id "*) return 0 ;;+ *) return 1 ;;+ esac+}++should_run_check() {+ check_id=$1++ if [ -n "$only_checks" ] && ! contains_check_id "$only_checks" "$check_id"; then+ return 1+ fi++ if contains_check_id "$skip_checks" "$check_id"; then+ return 1+ fi++ return 0+}++assert_uv_available() {+ if ! command -v uv >/dev/null 2>&1; then+ fail "uv is required but was not found on PATH. Install uv first (see README or scripts/install.sh)."+ fi+}++selected_checks_need_uv() {+ if [ "$dry_run" -ne 0 ]; then+ return 1+ fi++ for check_id in $CHECK_ORDER; do+ if should_run_check "$check_id" && [ "$check_id" != "suppressions" ]; then+ return 0+ fi+ done++ return 1+}++run_suppressions() {+ step "Ban type ignore suppressions"+ print_command grep -rE '# type: ignore|# ty: ignore' --include='*.py' . \+ --exclude-dir=.venv --exclude-dir=.git+ if [ "$dry_run" -eq 0 ]; then+ if grep -rE '# type: ignore|# ty: ignore' --include='*.py' . \+ --exclude-dir=.venv --exclude-dir=.git; then+ fail "type: ignore / ty: ignore comments are not allowed. Fix the underlying type errors instead."+ fi+ fi+}++run_ruff_format() {+ step "ruff format --check"+ run uv run ruff format --check+}++run_ruff_check() {+ step "ruff check"+ run uv run ruff check+}++run_ty() {+ step "ty check"+ run uv run ty check+}++run_pytest() {+ step "pytest"+ run uv run pytest -v --tb=short+}++run_check() {+ case "$1" in+ suppressions) run_suppressions ;;+ ruff-format) run_ruff_format ;;+ ruff-check) run_ruff_check ;;+ ty) run_ty ;;+ pytest) run_pytest ;;+ *) fail "unknown check id: $1" ;;+ esac+}++parse_args() {+ while [ "$#" -gt 0 ]; do+ case "$1" in+ --only)+ shift+ [ "$#" -gt 0 ] || fail "--only requires a check id."+ validate_check_id "$1"+ only_checks="${only_checks} $1"+ ;;+ --skip)+ shift+ [ "$#" -gt 0 ] || fail "--skip requires a check id."+ validate_check_id "$1"+ skip_checks="${skip_checks} $1"+ ;;+ --dry-run)+ dry_run=1+ ;;+ --help|-h)+ show_usage+ exit 0+ ;;+ *)+ show_usage >&2+ fail "unknown option: $1"+ ;;+ esac+ shift+ done+}++parse_args "$@"+if selected_checks_need_uv; then+ assert_uv_available+fi++for check_id in $CHECK_ORDER; do+ if should_run_check "$check_id"; then+ run_check "$check_id"+ fi+done++printf '\nAll selected CI checks passed.\n'diff --git a/scripts/uninstall.ps1 b/scripts/uninstall.ps1new file mode 100644index 00000000..f431aff9--- /dev/null+++ b/scripts/uninstall.ps1@@ -0,0 +1,175 @@+param(+ [switch] $DryRun,+ [switch] $Help,+ [Parameter(ValueFromRemainingArguments = $true)]+ [object[]] $RemainingArgs = @()+)++Set-StrictMode -Version Latest+$ErrorActionPreference = "Stop"++$PackageName = "free-claude-code"+$FccHomeDirname = ".fcc"+$FccCommands = @(+ "fcc-server",+ "fcc-claude",+ "fcc-codex",+ "fcc-init",+ "free-claude-code"+)++function Show-Usage {+ @"+Usage: uninstall.ps1 [options]++Removes the Free Claude Code uv tool and deletes ~/.fcc/.+Does not remove uv, Claude Code, Codex, or the uv-managed Python runtime.++Options:+ -DryRun Print commands without running them.+ -Help Show this help text.+"@+}++function Write-Step {+ param([string] $Message)++ Write-Host ""+ Write-Host "==> $Message"+}++function Format-Argument {+ param([string] $Value)++ if ($Value -match '^[A-Za-z0-9_./:@%+=,\[\]-]+$') {+ return $Value+ }++ return "'" + ($Value -replace "'", "''") + "'"+}++function Test-MissingUvToolError {+ param([string] $Output)++ $normalized = $Output.ToLowerInvariant()+ return (+ $normalized.Contains("not installed") -or+ $normalized.Contains("no tool") -or+ $normalized.Contains("nothing to uninstall")+ )+}++function Add-PathEntry {+ param([string] $PathEntry)++ if ([string]::IsNullOrWhiteSpace($PathEntry)) {+ return+ }++ $separator = [IO.Path]::PathSeparator+ $entries = @()+ if (-not [string]::IsNullOrEmpty($env:Path)) {+ $entries = $env:Path -split [regex]::Escape([string] $separator)+ }++ if ($entries -notcontains $PathEntry) {+ $env:Path = "$PathEntry$separator$env:Path"+ }+}++function Add-UvToPath {+ Add-PathEntry (Join-Path $HOME ".local\bin")+ Add-PathEntry (Join-Path $HOME ".cargo\bin")+}++function Assert-NoFccProcessesRunning {+ $running = @()++ foreach ($commandName in $FccCommands) {+ $processes = @(Get-Process -Name $commandName -ErrorAction SilentlyContinue)+ if ($processes.Count -gt 0) {+ $running += $commandName+ }+ }++ if ($running.Count -gt 0) {+ throw "Free Claude Code is still running ($($running -join ', ')). Stop those processes, then rerun uninstall."+ }+}++function Uninstall-FreeClaudeCode {+ Add-UvToPath++ if (-not (Get-Command uv -ErrorAction SilentlyContinue)) {+ Write-Host "uv not found on PATH; skipping uv tool uninstall."+ return+ }++ Write-Host "+ uv tool uninstall $PackageName"+ if (-not $DryRun) {+ $previousErrorActionPreference = $ErrorActionPreference+ $ErrorActionPreference = "Continue"+ try {+ $output = (& uv tool uninstall $PackageName 2>&1 | Out-String).Trim()+ $exitCode = $LASTEXITCODE+ if ($exitCode -eq 0) {+ return+ }+ if (Test-MissingUvToolError -Output $output) {+ Write-Host "Free Claude Code uv tool not installed or already removed; skipping uv tool uninstall."+ return+ }+ if (-not [string]::IsNullOrWhiteSpace($output)) {+ [Console]::Error.WriteLine($output)+ }+ throw "uv tool uninstall $PackageName failed with exit code $exitCode; aborting before deleting ~/.fcc."+ }+ finally {+ $ErrorActionPreference = $previousErrorActionPreference+ }+ }+}++function Purge-FccHome {+ $fccHome = Join-Path $HOME $FccHomeDirname+ if (-not (Test-Path -LiteralPath $fccHome)) {+ Write-Host "No FCC config directory at $fccHome; skipping purge."+ return+ }++ $commandText = @(+ "Remove-Item",+ "-LiteralPath",+ (Format-Argument $fccHome),+ "-Recurse",+ "-Force"+ ) -join " "+ Write-Host "+ $commandText"++ if (-not $DryRun) {+ Remove-Item -LiteralPath $fccHome -Recurse -Force+ }+}++if ($Help) {+ Show-Usage+ return+}++if ($RemainingArgs.Count -gt 0) {+ Show-Usage+ throw "Unknown option: $($RemainingArgs -join ' ')"+}++Write-Step "Checking for running Free Claude Code processes"+Assert-NoFccProcessesRunning++Write-Step "Removing Free Claude Code uv tool"+Uninstall-FreeClaudeCode++Write-Step "Purging FCC config and data from ~/.fcc"+Purge-FccHome++Write-Host ""+Write-Host "Free Claude Code has been removed."+Write-Host "uv, Claude Code, Codex, and the uv-managed Python runtime were left installed."diff --git a/scripts/uninstall.sh b/scripts/uninstall.shnew file mode 100644index 00000000..5f93a48b--- /dev/null+++ b/scripts/uninstall.sh@@ -0,0 +1,192 @@+#!/bin/sh+set -eu++PACKAGE_NAME="free-claude-code"+FCC_HOME_DIRNAME=".fcc"+FCC_COMMANDS="fcc-server fcc-claude fcc-codex fcc-init free-claude-code"++dry_run=0++show_usage() {+ cat <<'USAGE'+Usage: uninstall.sh [options]++Removes the Free Claude Code uv tool and deletes ~/.fcc/.+Does not remove uv, Claude Code, Codex, or the uv-managed Python runtime.++Options:+ --dry-run Print commands without running them.+ --help Show this help text.+USAGE+}++fail() {+ printf 'error: %s\n' "$*" >&2+ exit 1+}++step() {+ printf '\n==> %s\n' "$1"+}++quote_arg() {+ case "$1" in+ *[!A-Za-z0-9_./:@%+=,-]*|"")+ escaped=$(printf '%s' "$1" | sed 's/\\/\\\\/g; s/"/\\"/g')+ printf '"%s"' "$escaped"+ ;;+ *)+ printf '%s' "$1"+ ;;+ esac+}++print_command() {+ printf '+'+ for arg in "$@"; do+ printf ' '+ quote_arg "$arg"+ done+ printf '\n'+}++run() {+ print_command "$@"+ if [ "$dry_run" -eq 0 ]; then+ "$@"+ fi+}++is_missing_uv_tool_error() {+ normalized=$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]')+ case "$normalized" in+ *"not installed"* | *"no tool"* | *"nothing to uninstall"*) return 0 ;;+ *) return 1 ;;+ esac+}++add_path_entry() {+ [ -n "$1" ] || return 0+ case ":$PATH:" in+ *":$1:"*) ;;+ *) PATH="$1:$PATH" ;;+ esac+}++add_uv_to_path() {+ if [ -n "${XDG_BIN_HOME:-}" ]; then+ add_path_entry "$XDG_BIN_HOME"+ fi++ if [ -n "${HOME:-}" ]; then+ add_path_entry "$HOME/.local/bin"+ add_path_entry "$HOME/.cargo/bin"+ fi++ export PATH+}++is_fcc_command_running() {+ command_name=$1++ if command -v pgrep >/dev/null 2>&1; then+ if pgrep -x "$command_name" >/dev/null 2>&1; then+ return 0+ fi+ if pgrep -f "(^|/)${command_name}( |$)" >/dev/null 2>&1; then+ return 0+ fi+ return 1+ fi++ if ps -A -o comm= 2>/dev/null | grep -qx "$command_name"; then+ return 0+ fi++ return 1+}++assert_no_fcc_processes_running() {+ running=""++ for command_name in $FCC_COMMANDS; do+ if is_fcc_command_running "$command_name"; then+ running="${running} ${command_name}"+ fi+ done++ if [ -n "$running" ]; then+ fail "Free Claude Code is still running (${running# }). Stop those processes, then rerun uninstall."+ fi+}++uninstall_free_claude_code() {+ add_uv_to_path++ if ! command -v uv >/dev/null 2>&1; then+ printf 'uv not found on PATH; skipping uv tool uninstall.\n'+ return 0+ fi++ print_command uv tool uninstall "$PACKAGE_NAME"+ if [ "$dry_run" -eq 0 ]; then+ if output=$(uv tool uninstall "$PACKAGE_NAME" 2>&1); then+ return 0+ else+ status=$?+ fi+ if is_missing_uv_tool_error "$output"; then+ printf 'Free Claude Code uv tool not installed or already removed; skipping uv tool uninstall.\n'+ return 0+ fi+ if [ -n "$output" ]; then+ printf '%s\n' "$output" >&2+ fi+ fail "uv tool uninstall $PACKAGE_NAME failed with exit code $status; aborting before deleting ~/.fcc."+ fi+}++purge_fcc_home() {+ [ -n "${HOME:-}" ] || fail "HOME is not set; cannot locate ~/.fcc."++ fcc_home="$HOME/$FCC_HOME_DIRNAME"+ if [ ! -e "$fcc_home" ]; then+ printf 'No FCC config directory at %s; skipping purge.\n' "$fcc_home"+ return 0+ fi++ run rm -rf "$fcc_home"+}++parse_args() {+ while [ "$#" -gt 0 ]; do+ case "$1" in+ --dry-run)+ dry_run=1+ ;;+ --help|-h)+ show_usage+ exit 0+ ;;+ *)+ show_usage >&2+ fail "unknown option: $1"+ ;;+ esac+ shift+ done+}++parse_args "$@"++step "Checking for running Free Claude Code processes"+assert_no_fcc_processes_running++step "Removing Free Claude Code uv tool"+uninstall_free_claude_code++step "Purging FCC config and data from ~/.fcc"+purge_fcc_home++printf '\nFree Claude Code has been removed.\n'+printf 'uv, Claude Code, Codex, and the uv-managed Python runtime were left installed.\n'diff --git a/tests/scripts/test_ci_scripts.py b/tests/scripts/test_ci_scripts.pynew file mode 100644index 00000000..0c6109d6--- /dev/null+++ b/tests/scripts/test_ci_scripts.py@@ -0,0 +1,236 @@+import os+import shutil+import subprocess+from pathlib import Path++import pytest+++def _repo_root() -> Path:+ return Path(__file__).resolve().parents[2]+++def _script_text(name: str) -> str:+ return (_repo_root() / "scripts" / name).read_text(encoding="utf-8")+++def _braced_body(text: str, declaration: str) -> str:+ start = text.index(declaration)+ brace_start = text.index("{", start)+ depth = 0++ for index, char in enumerate(text[brace_start:], start=brace_start):+ if char == "{":+ depth += 1+ elif char == "}":+ depth -= 1+ if depth == 0:+ return text[brace_start + 1 : index]++ raise AssertionError(f"Unclosed function body for {declaration}")+++def _path_without_uv() -> str:+ uv_names = ("uv", "uv.exe", "uv.cmd", "uv.bat")+ entries = []+ for raw_entry in os.environ.get("PATH", "").split(os.pathsep):+ if not raw_entry:+ continue+ entry = Path(raw_entry)+ if any((entry / name).exists() for name in uv_names):+ continue+ entries.append(raw_entry)+ return os.pathsep.join(entries)+++def _shell_interpreter() -> str:+ sh = shutil.which("sh")+ if sh is None:+ pytest.skip("sh is not available on this platform")+ return sh+++def _powershell_interpreter() -> str:+ pwsh = shutil.which("pwsh") or shutil.which("powershell")+ if pwsh is None:+ pytest.skip("PowerShell is not available on this platform")+ return pwsh+++def test_ci_sh_runs_ci_checks_in_order() -> None:+ text = _script_text("ci.sh")++ assert 'CHECK_ORDER="suppressions ruff-format ruff-check ty pytest"' in text+ assert "grep -rE" in text+ assert "Fix the underlying type errors instead" in text+ assert "--exclude-dir=.venv" in text+ assert "--exclude-dir=.git" in text+ assert "uv run ruff format --check" in text+ assert "uv run ruff check" in text+ assert "uv run ty check" in text+ assert "uv run pytest -v --tb=short" in text+ assert "--only" in text+ assert "--skip" in text+ assert "--dry-run" in text+ assert "uv is required but was not found on PATH" in text+ assert "npm" not in text+ assert "smoke/" not in text+ assert "uv self update" not in text+++def test_ci_sh_dry_run_does_not_require_uv() -> None:+ result = subprocess.run(+ [+ _shell_interpreter(),+ str(_repo_root() / "scripts" / "ci.sh"),+ "--only",+ "pytest",+ "--dry-run",+ ],+ cwd=_repo_root(),+ env={**os.environ, "PATH": _path_without_uv()},+ text=True,+ capture_output=True,+ check=False,+ )++ assert result.returncode == 0+ assert "+ uv run pytest -v --tb=short" 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(+ [+ _shell_interpreter(),+ str(_repo_root() / "scripts" / "ci.sh"),+ "--only",+ "suppressions",+ ],+ cwd=_repo_root(),+ env={**os.environ, "PATH": _path_without_uv()},+ text=True,+ capture_output=True,+ check=False,+ )++ assert result.returncode == 0+ assert "Ban type ignore suppressions" in result.stdout+ assert "uv is required" not in result.stderr+++def test_ci_sh_is_tracked_executable() -> None:+ result = subprocess.run(+ ["git", "ls-files", "--stage", "scripts/ci.sh"],+ cwd=_repo_root(),+ text=True,+ capture_output=True,+ check=True,+ )++ assert result.stdout.startswith("100755 ")+++def test_ci_sh_fail_fast_runs_checks_sequentially() -> None:+ text = _script_text("ci.sh")+ main = text[text.index('parse_args "$@"') :]++ suppress_index = text.index("run_suppressions()")+ ruff_format_index = text.index("run_ruff_format()")+ ruff_check_index = text.index("run_ruff_check()")+ ty_index = text.index("run_ty()")+ pytest_index = text.index("run_pytest()")++ assert (+ suppress_index < ruff_format_index < ruff_check_index < ty_index < pytest_index+ )+ assert "for check_id in $CHECK_ORDER" in main+++def test_ci_ps1_runs_ci_checks_in_order() -> None:+ text = _script_text("ci.ps1")++ assert '"suppressions"' in text+ assert '"ruff-format"' in text+ assert '"ruff-check"' in text+ assert '"ty"' in text+ assert '"pytest"' in text+ assert "Select-String -Pattern" in text+ assert "Fix the underlying type errors instead" in text+ assert ".venv" in text+ assert ".git" in text+ assert '"format", "--check"' in text+ assert '"-v", "--tb=short"' in text+ assert "-Only" in text+ assert "-Skip" in text+ assert "-DryRun" in text+ assert "uv is required but was not found on PATH" in text+ assert "npm" not in text+ assert "smoke/" not in text+ assert "uv self update" not in text+++def test_ci_ps1_dry_run_does_not_require_uv() -> None:+ result = subprocess.run(+ [+ _powershell_interpreter(),+ "-NoProfile",+ "-File",+ str(_repo_root() / "scripts" / "ci.ps1"),+ "-Only",+ "pytest",+ "-DryRun",+ ],+ cwd=_repo_root(),+ env={**os.environ, "PATH": _path_without_uv()},+ text=True,+ capture_output=True,+ check=False,+ )++ assert result.returncode == 0+ assert "+ uv run pytest -v --tb=short" 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(+ [+ _powershell_interpreter(),+ "-NoProfile",+ "-File",+ str(_repo_root() / "scripts" / "ci.ps1"),+ "-Only",+ "suppressions",+ ],+ cwd=_repo_root(),+ env={**os.environ, "PATH": _path_without_uv()},+ text=True,+ capture_output=True,+ check=False,+ )++ assert result.returncode == 0+ assert "Ban type ignore suppressions" in result.stdout+ assert "uv is required" not in result.stderr+++def test_ci_ps1_fail_fast_runs_checks_sequentially() -> None:+ text = _script_text("ci.ps1")++ assert "foreach ($checkId in $CheckOrder)" in text+ assert "Invoke-SuppressionsCheck" in text+ assert "Invoke-RuffFormatCheck" in text+ assert "Invoke-RuffLintCheck" in text+ assert "Invoke-TyCheck" in text+ assert "Invoke-PytestCheck" in text++ suppress_index = text.index("function Invoke-SuppressionsCheck")+ ruff_format_index = text.index("function Invoke-RuffFormatCheck")+ ruff_check_index = text.index("function Invoke-RuffLintCheck")+ ty_index = text.index("function Invoke-TyCheck")+ pytest_index = text.index("function Invoke-PytestCheck")++ assert (+ suppress_index < ruff_format_index < ruff_check_index < ty_index < pytest_index+ )diff --git a/tests/scripts/test_uninstallers.py b/tests/scripts/test_uninstallers.pynew file mode 100644index 00000000..bc306675--- /dev/null+++ b/tests/scripts/test_uninstallers.py@@ -0,0 +1,387 @@+import os+import shutil+import stat+import subprocess+from pathlib import Path++import pytest+++def _repo_root() -> Path:+ return Path(__file__).resolve().parents[2]+++def _script_text(name: str) -> str:+ return (_repo_root() / "scripts" / name).read_text(encoding="utf-8")+++def test_readme_uninstall_one_liners_use_raw_github_urls() -> None:+ text = (_repo_root() / "README.md").read_text(encoding="utf-8")++ assert (+ 'curl -fsSL "https://raw.githubusercontent.com/'+ 'Alishahryar1/free-claude-code/main/scripts/uninstall.sh" | sh'+ ) in text+ assert (+ 'irm "https://raw.githubusercontent.com/'+ 'Alishahryar1/free-claude-code/main/scripts/uninstall.ps1" | iex'+ ) in text+ assert "blob/main/scripts/uninstall.sh?raw=1" not in text+ assert "blob/main/scripts/uninstall.ps1?raw=1" not in text+++def _braced_body(text: str, declaration: str) -> str:+ start = text.index(declaration)+ brace_start = text.index("{", start)+ depth = 0++ for index, char in enumerate(text[brace_start:], start=brace_start):+ if char == "{":+ depth += 1+ elif char == "}":+ depth -= 1+ if depth == 0:+ return text[brace_start + 1 : index]++ raise AssertionError(f"Unclosed function body for {declaration}")+++def _shell_path_with_mock(bin_dir: Path) -> str:+ return f"{bin_dir}:/usr/bin:/bin"+++def _path_prepending(path: Path) -> str:+ return os.pathsep.join((str(path), os.environ.get("PATH", "")))+++def _path_without_uv(prefix: Path) -> str:+ uv_names = ("uv", "uv.exe", "uv.cmd", "uv.bat")+ entries = [str(prefix)]+ for raw_entry in os.environ.get("PATH", "").split(os.pathsep):+ if not raw_entry:+ continue+ entry = Path(raw_entry)+ if any((entry / name).exists() for name in uv_names):+ continue+ entries.append(raw_entry)+ return os.pathsep.join(entries)+++def _write_mock_uv(bin_dir: Path, *, message: str, exit_code: int) -> None:+ if os.name == "nt":+ uv = bin_dir / "uv.cmd"+ uv.write_text(+ f"@echo off\necho {message} 1>&2\nexit /b {exit_code}\n",+ encoding="utf-8",+ )+ return++ uv = bin_dir / "uv"+ uv.write_text(+ f"#!/bin/sh\nprintf '%s\\n' '{message}' >&2\nexit {exit_code}\n",+ encoding="utf-8",+ )+ uv.chmod(uv.stat().st_mode | stat.S_IXUSR)+++def test_uninstall_sh_removes_uv_tool_and_purges_fcc_home() -> None:+ text = _script_text("uninstall.sh")+ tool_body = _braced_body(text, "uninstall_free_claude_code()")+ purge_body = _braced_body(text, "purge_fcc_home()")++ assert "Does not remove uv, Claude Code, Codex" in text+ assert "uv tool uninstall" in tool_body+ assert 'PACKAGE_NAME="free-claude-code"' in text+ assert "uv not found on PATH; skipping uv tool uninstall." in tool_body+ assert "is_missing_uv_tool_error" in tool_body+ assert "aborting before deleting ~/.fcc." in tool_body+ assert "rm -rf" in purge_body+ assert ".fcc" in purge_body+ assert "npm uninstall" not in text+ assert "uv self uninstall" not in text+ assert "uv python uninstall" not in text+++def test_uninstall_sh_fails_when_fcc_commands_are_running() -> None:+ text = _script_text("uninstall.sh")+ guard_body = _braced_body(text, "assert_no_fcc_processes_running()")+ main = text[text.index('parse_args "$@"') :]++ for command in (+ "fcc-server",+ "fcc-claude",+ "fcc-codex",+ "fcc-init",+ "free-claude-code",+ ):+ assert command in text++ assert "FCC_COMMANDS" in text++ assert "Free Claude Code is still running" in guard_body+ assert (+ 'step "Checking for running Free Claude Code processes"\nassert_no_fcc_processes_running'+ in main+ )+++def test_uninstall_ps1_removes_uv_tool_and_purges_fcc_home() -> None:+ text = _script_text("uninstall.ps1")+ tool_body = _braced_body(text, "function Uninstall-FreeClaudeCode")+ purge_body = _braced_body(text, "function Purge-FccHome")++ assert "Does not remove uv, Claude Code, Codex" in text+ assert "uv tool uninstall" in tool_body+ assert '$PackageName = "free-claude-code"' in text+ assert "uv not found on PATH; skipping uv tool uninstall." in tool_body+ assert "Test-MissingUvToolError" in tool_body+ assert "aborting before deleting ~/.fcc." in tool_body+ assert "Remove-Item" in purge_body+ assert purge_body.count("Remove-Item -LiteralPath") == 1+ assert '$FccHomeDirname = ".fcc"' in text+ assert "npm uninstall" not in text+ assert "uv self uninstall" not in text+ assert "uv python uninstall" not in text+++def test_uninstall_ps1_fails_when_fcc_commands_are_running() -> None:+ text = _script_text("uninstall.ps1")+ guard_body = _braced_body(text, "function Assert-NoFccProcessesRunning")++ for command in (+ "fcc-server",+ "fcc-claude",+ "fcc-codex",+ "fcc-init",+ "free-claude-code",+ ):+ assert command in text++ assert "FccCommands" in text++ assert "Free Claude Code is still running" in guard_body+ assert (+ 'Write-Step "Checking for running Free Claude Code processes"\n'+ "Assert-NoFccProcessesRunning" in text+ )+++def test_uninstall_sh_missing_tool_detection_is_narrow() -> None:+ text = _script_text("uninstall.sh")+ detector_body = _braced_body(text, "is_missing_uv_tool_error()")++ assert "not installed" in detector_body+ assert "no tool" in detector_body+ assert "nothing to uninstall" in detector_body+ assert "permission denied" not in detector_body+ assert "locked" not in detector_body+++def test_uninstall_ps1_missing_tool_detection_is_narrow() -> None:+ text = _script_text("uninstall.ps1")+ detector_body = _braced_body(text, "function Test-MissingUvToolError")++ assert "not installed" in detector_body+ assert "no tool" in detector_body+ assert "nothing to uninstall" in detector_body+ assert "permission denied" not in detector_body+ assert "locked" not in detector_body+++def test_uninstall_sh_generic_uv_failure_does_not_delete_fcc_home(+ tmp_path: Path,+) -> None:+ sh = shutil.which("sh")+ if sh is None:+ pytest.skip("sh is not available on this platform")++ home = tmp_path / "home"+ fcc_home = home / ".fcc"+ bin_dir = home / ".local" / "bin"+ fcc_home.mkdir(parents=True)+ bin_dir.mkdir(parents=True)+ uv = bin_dir / "uv"+ uv.write_text(+ "#!/bin/sh\n"+ "printf '%s\\n' 'permission denied while removing tool' >&2\n"+ "exit 42\n",+ encoding="utf-8",+ )+ uv.chmod(uv.stat().st_mode | stat.S_IXUSR)++ result = subprocess.run(+ [sh, str(_repo_root() / "scripts" / "uninstall.sh")],+ cwd=_repo_root(),+ env={**os.environ, "HOME": str(home), "PATH": _shell_path_with_mock(bin_dir)},+ text=True,+ capture_output=True,+ check=False,+ )++ assert result.returncode != 0+ assert fcc_home.exists()+ assert "failed with exit code 42" in result.stderr+ assert "before deleting ~/.fcc" in result.stderr+++def test_uninstall_sh_missing_tool_still_deletes_fcc_home(tmp_path: Path) -> None:+ sh = shutil.which("sh")+ if sh is None:+ pytest.skip("sh is not available on this platform")++ home = tmp_path / "home"+ fcc_home = home / ".fcc"+ bin_dir = home / ".local" / "bin"+ fcc_home.mkdir(parents=True)+ bin_dir.mkdir(parents=True)+ uv = bin_dir / "uv"+ uv.write_text(+ "#!/bin/sh\n"+ "printf '%s\\n' 'tool free-claude-code is not installed' >&2\n"+ "exit 2\n",+ encoding="utf-8",+ )+ uv.chmod(uv.stat().st_mode | stat.S_IXUSR)++ result = subprocess.run(+ [sh, str(_repo_root() / "scripts" / "uninstall.sh")],+ cwd=_repo_root(),+ env={**os.environ, "HOME": str(home), "PATH": _shell_path_with_mock(bin_dir)},+ text=True,+ capture_output=True,+ check=False,+ )++ assert result.returncode == 0+ assert not fcc_home.exists()+++def test_uninstall_sh_missing_uv_still_deletes_fcc_home(tmp_path: Path) -> None:+ sh = shutil.which("sh")+ if sh is None:+ pytest.skip("sh is not available on this platform")++ home = tmp_path / "home"+ fcc_home = home / ".fcc"+ empty_bin = tmp_path / "empty-bin"+ fcc_home.mkdir(parents=True)+ empty_bin.mkdir()++ result = subprocess.run(+ [sh, str(_repo_root() / "scripts" / "uninstall.sh")],+ cwd=_repo_root(),+ env={+ **os.environ,+ "HOME": str(home),+ "PATH": f"{empty_bin}:/usr/bin:/bin",+ },+ text=True,+ capture_output=True,+ check=False,+ )++ assert result.returncode == 0+ assert not fcc_home.exists()+ assert "uv not found on PATH; skipping uv tool uninstall." in result.stdout+++def test_uninstall_ps1_generic_uv_failure_does_not_delete_fcc_home(+ tmp_path: Path,+) -> None:+ pwsh = shutil.which("pwsh") or shutil.which("powershell")+ if pwsh is None:+ pytest.skip("PowerShell is not available on this platform")++ home = tmp_path / "home"+ fcc_home = home / ".fcc"+ bin_dir = home / ".local" / "bin"+ fcc_home.mkdir(parents=True)+ bin_dir.mkdir(parents=True)+ _write_mock_uv(+ bin_dir,+ message="permission denied while removing tool",+ exit_code=42,+ )++ result = subprocess.run(+ [pwsh, "-NoProfile", "-File", str(_repo_root() / "scripts" / "uninstall.ps1")],+ cwd=_repo_root(),+ env={+ **os.environ,+ "HOME": str(home),+ "USERPROFILE": str(home),+ "PATH": _path_prepending(bin_dir),+ },+ text=True,+ capture_output=True,+ check=False,+ )++ assert result.returncode != 0+ assert fcc_home.exists()+ assert "failed with exit code 42" in result.stderr+ assert "before deleting ~/.fcc" in result.stderr+++def test_uninstall_ps1_missing_tool_still_deletes_fcc_home(tmp_path: Path) -> None:+ pwsh = shutil.which("pwsh") or shutil.which("powershell")+ if pwsh is None:+ pytest.skip("PowerShell is not available on this platform")++ home = tmp_path / "home"+ fcc_home = home / ".fcc"+ bin_dir = home / ".local" / "bin"+ fcc_home.mkdir(parents=True)+ bin_dir.mkdir(parents=True)+ _write_mock_uv(+ bin_dir,+ message="tool free-claude-code is not installed",+ exit_code=2,+ )++ result = subprocess.run(+ [pwsh, "-NoProfile", "-File", str(_repo_root() / "scripts" / "uninstall.ps1")],+ cwd=_repo_root(),+ env={+ **os.environ,+ "HOME": str(home),+ "USERPROFILE": str(home),+ "PATH": _path_prepending(bin_dir),+ },+ text=True,+ capture_output=True,+ check=False,+ )++ assert result.returncode == 0+ assert not fcc_home.exists()+++def test_uninstall_ps1_missing_uv_still_deletes_fcc_home(tmp_path: Path) -> None:+ pwsh = shutil.which("pwsh") or shutil.which("powershell")+ if pwsh is None:+ pytest.skip("PowerShell is not available on this platform")++ home = tmp_path / "home"+ fcc_home = home / ".fcc"+ empty_bin = tmp_path / "empty-bin"+ fcc_home.mkdir(parents=True)+ empty_bin.mkdir()++ result = subprocess.run(+ [pwsh, "-NoProfile", "-File", str(_repo_root() / "scripts" / "uninstall.ps1")],+ cwd=_repo_root(),+ env={+ **os.environ,+ "HOME": str(home),+ "USERPROFILE": str(home),+ "PATH": _path_without_uv(empty_bin),+ },+ text=True,+ capture_output=True,+ check=False,+ )++ assert result.returncode == 0+ assert not fcc_home.exists()+ assert "uv not found on PATH; skipping uv tool uninstall." in result.stdoutdiff --git a/uv.lock b/uv.lockindex 40750114..b36fb2cd 100644--- a/uv.lock+++ b/uv.lock@@ -561,7 +561,7 @@ wheels = [[[package]]name = "free-claude-code"-version = "2.2.1"+version = "2.3.0"source = { editable = "." }dependencies = [{ name = "aiohttp" },