Metadata-Version: 2.4
Name: expunct-cli
Version: 0.1.0
Summary: CLI for the Expunct PII redaction API — redact, detect, and manage sensitive data from the command line.
Project-URL: Homepage, https://expunct.ai
Project-URL: Documentation, https://docs.expunct.ai
Project-URL: Repository, https://github.com/expunct/cli
Author: Expunct
License-Expression: MIT
Keywords: cli,pii,privacy,redaction,security
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Requires-Dist: expunct>=0.1.1
Requires-Dist: rich>=13.0
Requires-Dist: typer>=0.15
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.8; extra == 'dev'
Description-Content-Type: text/markdown

# Expunct CLI

**Privacy infrastructure for modern applications.**

Redact PII, secrets, and sensitive data from text, logs, and files — before it reaches AI, analytics, or external APIs.

---

## 🚀 Quick Start

```bash
pip install expunct-cli
```

```bash
export EXPUNCT_API_KEY=your_api_key
```

```bash
expunct redact --text "John Smith email john@gmail.com"
```

**Output:**

```
PERSON_1 email EMAIL_1
```

---

## ✨ Why Expunct?

Modern applications constantly handle sensitive data:

* AI prompts sent to LLMs
* application logs
* customer support tickets
* analytics pipelines

Expunct helps you:

* 🔒 Detect PII (emails, phone numbers, names, etc.)
* 🧠 Detect secrets (API keys, tokens, credentials)
* 🧩 Apply policies (redact, mask, pseudonymize)
* ⚡ Sanitize data before it leaves your system

---

## 🧪 Examples

### Redact sensitive data

```bash
expunct redact --text "Contact me at john@gmail.com"
```

### Detect entities without modifying text

```bash
expunct detect --text "My email is john@gmail.com"
```

### Process a file

```bash
expunct redact logs.txt
```

### Redact binary files (PDF, DOCX, images, video, audio)

```bash
expunct redact report.pdf --output redacted_report.pdf
```

### Use with pipes (great for scripts & agents)

```bash
cat logs.txt | expunct redact
echo "My SSN is 123-45-6789" | expunct detect
```

### Cloud URI redaction

```bash
expunct redact --uri "gs://my-bucket/file.txt"
expunct redact --uri "s3://my-bucket/file.txt" --no-wait
```

### JSON output (for scripting & AI agents)

```bash
expunct redact --text "My SSN is 123-45-6789" --json
expunct detect --text "Jane Doe" --json | jq '.findings[] | .entity_type'
```

---

## 🧱 How It Works

```
Your App / Logs / Files
           ↓
        Expunct
           ↓
   Clean, safe data
           ↓
AI / APIs / Analytics
```

Expunct acts as a **privacy layer** that removes sensitive data before it leaves your system.

---

## 📖 Commands

### `expunct redact`

Redact PII from text, files, or URIs.

```bash
expunct redact --text "Call me at 555-1234"
expunct redact notes.txt
expunct redact scan.pdf -o redacted_scan.pdf
expunct redact --uri "gs://my-bucket/file.txt"
cat file.txt | expunct redact
```

| Flag | Description |
|------|-------------|
| `--text, -t` | Inline text to redact |
| `--uri, -u` | Cloud URI to redact |
| `--output, -o` | Output file path (required for binary formats) |
| `--language, -l` | Language code (default: `en`) |
| `--policy-id, -p` | Policy ID to apply |
| `--json` | Raw JSON output |
| `--wait/--no-wait` | Wait for URI jobs (default: `--wait`) |
| `--timeout` | Wait timeout in seconds (default: `300`) |

### `expunct detect`

Detect PII entities without redacting. Shows entity type, value, confidence, and location.

```bash
expunct detect --text "My name is Jane Doe and my SSN is 123-45-6789"
expunct detect document.txt
expunct detect --uri "gs://bucket/file.txt"
echo "test@email.com" | expunct detect
```

### `expunct jobs`

Manage redaction jobs.

```bash
expunct jobs list
expunct jobs list --status completed --page 2
expunct jobs get JOB_ID
expunct jobs download JOB_ID -o output.pdf
expunct jobs wait JOB_ID --timeout 600
```

### `expunct policies`

Manage redaction policies.

```bash
expunct policies list
expunct policies create --name "strict" --confidence-threshold 0.9
expunct policies get POLICY_ID
expunct policies update POLICY_ID --name "updated-name"
expunct policies delete POLICY_ID --yes
```

### `expunct audit`

View audit logs.

```bash
expunct audit list
expunct audit list --event-type redaction --page-size 50
expunct audit list --json
```

### `expunct config`

Manage CLI configuration.

```bash
expunct config set api_key YOUR_API_KEY
expunct config set base_url https://api.expunct.ai
expunct config get base_url
expunct config show
expunct config path
```

---

## 🔑 Authentication

**Option A: Environment variable** (recommended for CI/scripts)

```bash
export EXPUNCT_API_KEY=your_api_key
```

**Option B: Config file**

```bash
expunct config set api_key YOUR_API_KEY
```

Stored in `~/.expunct/config.json`:

```json
{
  "api_key": "your_api_key",
  "base_url": "https://api.expunct.ai",
  "tenant_id": "your-tenant-id"
}
```

| Variable | Description |
|----------|-------------|
| `EXPUNCT_API_KEY` | API key (overrides config file) |
| `EXPUNCT_BASE_URL` | API base URL (overrides config file) |
| `EXPUNCT_TENANT_ID` | Tenant ID (overrides config file) |

---

## ⚙️ Output Modes

```bash
# Default: human-readable with rich formatting
expunct redact --text "My email is john@gmail.com"

# JSON: machine-readable for piping and scripting
expunct redact --text "My email is john@gmail.com" --json
```

---

## 🤖 Agent-Friendly Design

The CLI is designed to work well with AI agents and automation:

* **Deterministic output** with `--json` flag
* **Stdin piping** for chaining commands
* **Non-interactive** — no prompts in `--json` mode
* **Exit codes** — 0 for success, 1 for errors

```bash
# Pipe redacted text
expunct redact --text "My phone is 555-0100" --json | jq .redacted

# Chain with other tools
cat logs.txt | expunct redact | grep "ERROR"

# Use in scripts
expunct jobs list --json | jq '.jobs[].id'
```

---

## 🖥️ Platform Support

The CLI is pure Python and works on **macOS**, **Linux**, and **Windows**:

```bash
# All platforms via pip
pip install expunct-cli

# macOS via Homebrew (coming soon)
brew install expunct/tap/expunct-cli
```

---

## 🔒 Built for Developers

Expunct is built on top of proven detection tools like Microsoft Presidio, with added:

* policy control
* hosted API
* scalable processing
* multi-format support (text, PDF, DOCX, images, video, audio)

---

## 📚 Documentation

👉 [https://docs.expunct.ai](https://docs.expunct.ai)

## 🌐 Platform

👉 [https://expunct.ai](https://expunct.ai)

---

## 💡 Roadmap

* Pseudonymization (reversible identity masking)
* Secret detection expansion
* Batch processing via CLI
* Directory processing
* Streaming mode
* Self-hosted / VPC deployment

---

## 🤝 Contributing

Contributions welcome. Feel free to open issues or PRs.

---

## 📄 License

MIT
