pii-washer

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

PII-Washer is a local-only PII detection and text sanitization tool. Users paste text containing personal data, get a clean version with placeholders, use it with LLMs, then swap placeholders back. Privacy-first: no network calls, in-memory only, secure clear on shutdown.

Commands

# Backend
pip install -e ".[dev]"                    # Install with dev deps (pytest, ruff, httpx)
uvicorn pii_washer.api.main:app --reload   # Run backend on :8000

# Frontend
cd pii-washer-ui && npm install            # Install frontend deps
cd pii-washer-ui && npm run dev            # Run frontend on :5173
cd pii-washer-ui && npm run lint           # ESLint
cd pii-washer-ui && npm run test           # Frontend tests (vitest)
cd pii-washer-ui && npm run build          # TypeScript check + Vite build

# Tests
pytest                                     # Run all backend tests
pytest -m integration                      # Tests against the real Presidio/spaCy engine
pytest pii_washer/tests/test_api.py        # Run a single test file
pytest -k "test_depersonalize"             # Run tests matching a name
ruff check .                               # Backend lint

Architecture

Backend (Python): FastAPI REST API at /api/v1/. All components are wired through SessionManager, which is the single orchestration boundary — the API router calls only SessionManager methods.

Frontend (React 19 + TypeScript + Vite + Tailwind v4): SPA in pii-washer-ui/. Uses Zustand for state, TanStack React Query for API calls, Radix UI primitives, and Lucide icons. Tab-based workflow: Input → Review → Response → Results. API client in src/api/client.ts.

Desktop: PyInstaller + pywebview. Entry point at pyinstaller_entry.py — starts FastAPI in a background thread, opens a native window via pywebview. The frontend dist is bundled at ui/ inside the executable. Build command is in the README’s “Desktop app” section.

Key Constraints

Documentation Conventions