expunct-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- expunct_cli-0.1.0/.github/workflows/ci.yml +47 -0
- expunct_cli-0.1.0/.github/workflows/publish.yml +34 -0
- expunct_cli-0.1.0/.gitignore +18 -0
- expunct_cli-0.1.0/PKG-INFO +349 -0
- expunct_cli-0.1.0/README.md +318 -0
- expunct_cli-0.1.0/pyproject.toml +56 -0
- expunct_cli-0.1.0/src/expunct_cli/__init__.py +1 -0
- expunct_cli-0.1.0/src/expunct_cli/client.py +49 -0
- expunct_cli-0.1.0/src/expunct_cli/commands/__init__.py +0 -0
- expunct_cli-0.1.0/src/expunct_cli/commands/audit.py +56 -0
- expunct_cli-0.1.0/src/expunct_cli/commands/config_cmd.py +80 -0
- expunct_cli-0.1.0/src/expunct_cli/commands/detect.py +106 -0
- expunct_cli-0.1.0/src/expunct_cli/commands/jobs.py +108 -0
- expunct_cli-0.1.0/src/expunct_cli/commands/policies.py +189 -0
- expunct_cli-0.1.0/src/expunct_cli/commands/redact.py +120 -0
- expunct_cli-0.1.0/src/expunct_cli/main.py +46 -0
- expunct_cli-0.1.0/src/expunct_cli/output.py +140 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: actions/setup-python@v5
|
|
15
|
+
with:
|
|
16
|
+
python-version: "3.12"
|
|
17
|
+
- run: pip install ruff
|
|
18
|
+
- run: ruff check src/
|
|
19
|
+
|
|
20
|
+
test:
|
|
21
|
+
runs-on: ${{ matrix.os }}
|
|
22
|
+
strategy:
|
|
23
|
+
matrix:
|
|
24
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
25
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
26
|
+
exclude:
|
|
27
|
+
- os: macos-latest
|
|
28
|
+
python-version: "3.10"
|
|
29
|
+
- os: macos-latest
|
|
30
|
+
python-version: "3.11"
|
|
31
|
+
- os: windows-latest
|
|
32
|
+
python-version: "3.10"
|
|
33
|
+
- os: windows-latest
|
|
34
|
+
python-version: "3.11"
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v4
|
|
37
|
+
- uses: actions/setup-python@v5
|
|
38
|
+
with:
|
|
39
|
+
python-version: ${{ matrix.python-version }}
|
|
40
|
+
- run: pip install -e ".[dev]"
|
|
41
|
+
- run: expunct --version
|
|
42
|
+
- run: expunct --help
|
|
43
|
+
- run: expunct redact --help
|
|
44
|
+
- run: expunct detect --help
|
|
45
|
+
- run: expunct jobs --help
|
|
46
|
+
- run: expunct policies --help
|
|
47
|
+
- run: expunct config path
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
|
|
21
|
+
- name: Install build tools
|
|
22
|
+
run: pip install build twine
|
|
23
|
+
|
|
24
|
+
- name: Build
|
|
25
|
+
run: python -m build
|
|
26
|
+
|
|
27
|
+
- name: Check distribution
|
|
28
|
+
run: twine check dist/*
|
|
29
|
+
|
|
30
|
+
- name: Publish to PyPI
|
|
31
|
+
env:
|
|
32
|
+
TWINE_USERNAME: __token__
|
|
33
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
34
|
+
run: twine upload dist/*
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: expunct-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI for the Expunct PII redaction API — redact, detect, and manage sensitive data from the command line.
|
|
5
|
+
Project-URL: Homepage, https://expunct.ai
|
|
6
|
+
Project-URL: Documentation, https://docs.expunct.ai
|
|
7
|
+
Project-URL: Repository, https://github.com/expunct/cli
|
|
8
|
+
Author: Expunct
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: cli,pii,privacy,redaction,security
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Security
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: expunct>=0.1.1
|
|
25
|
+
Requires-Dist: rich>=13.0
|
|
26
|
+
Requires-Dist: typer>=0.15
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: ruff>=0.8; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# Expunct CLI
|
|
33
|
+
|
|
34
|
+
**Privacy infrastructure for modern applications.**
|
|
35
|
+
|
|
36
|
+
Redact PII, secrets, and sensitive data from text, logs, and files — before it reaches AI, analytics, or external APIs.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 🚀 Quick Start
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install expunct-cli
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
export EXPUNCT_API_KEY=your_api_key
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
expunct redact --text "John Smith email john@gmail.com"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Output:**
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
PERSON_1 email EMAIL_1
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## ✨ Why Expunct?
|
|
63
|
+
|
|
64
|
+
Modern applications constantly handle sensitive data:
|
|
65
|
+
|
|
66
|
+
* AI prompts sent to LLMs
|
|
67
|
+
* application logs
|
|
68
|
+
* customer support tickets
|
|
69
|
+
* analytics pipelines
|
|
70
|
+
|
|
71
|
+
Expunct helps you:
|
|
72
|
+
|
|
73
|
+
* 🔒 Detect PII (emails, phone numbers, names, etc.)
|
|
74
|
+
* 🧠 Detect secrets (API keys, tokens, credentials)
|
|
75
|
+
* 🧩 Apply policies (redact, mask, pseudonymize)
|
|
76
|
+
* ⚡ Sanitize data before it leaves your system
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 🧪 Examples
|
|
81
|
+
|
|
82
|
+
### Redact sensitive data
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
expunct redact --text "Contact me at john@gmail.com"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Detect entities without modifying text
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
expunct detect --text "My email is john@gmail.com"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Process a file
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
expunct redact logs.txt
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Redact binary files (PDF, DOCX, images, video, audio)
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
expunct redact report.pdf --output redacted_report.pdf
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Use with pipes (great for scripts & agents)
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
cat logs.txt | expunct redact
|
|
110
|
+
echo "My SSN is 123-45-6789" | expunct detect
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Cloud URI redaction
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
expunct redact --uri "gs://my-bucket/file.txt"
|
|
117
|
+
expunct redact --uri "s3://my-bucket/file.txt" --no-wait
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### JSON output (for scripting & AI agents)
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
expunct redact --text "My SSN is 123-45-6789" --json
|
|
124
|
+
expunct detect --text "Jane Doe" --json | jq '.findings[] | .entity_type'
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 🧱 How It Works
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
Your App / Logs / Files
|
|
133
|
+
↓
|
|
134
|
+
Expunct
|
|
135
|
+
↓
|
|
136
|
+
Clean, safe data
|
|
137
|
+
↓
|
|
138
|
+
AI / APIs / Analytics
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Expunct acts as a **privacy layer** that removes sensitive data before it leaves your system.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 📖 Commands
|
|
146
|
+
|
|
147
|
+
### `expunct redact`
|
|
148
|
+
|
|
149
|
+
Redact PII from text, files, or URIs.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
expunct redact --text "Call me at 555-1234"
|
|
153
|
+
expunct redact notes.txt
|
|
154
|
+
expunct redact scan.pdf -o redacted_scan.pdf
|
|
155
|
+
expunct redact --uri "gs://my-bucket/file.txt"
|
|
156
|
+
cat file.txt | expunct redact
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
| Flag | Description |
|
|
160
|
+
|------|-------------|
|
|
161
|
+
| `--text, -t` | Inline text to redact |
|
|
162
|
+
| `--uri, -u` | Cloud URI to redact |
|
|
163
|
+
| `--output, -o` | Output file path (required for binary formats) |
|
|
164
|
+
| `--language, -l` | Language code (default: `en`) |
|
|
165
|
+
| `--policy-id, -p` | Policy ID to apply |
|
|
166
|
+
| `--json` | Raw JSON output |
|
|
167
|
+
| `--wait/--no-wait` | Wait for URI jobs (default: `--wait`) |
|
|
168
|
+
| `--timeout` | Wait timeout in seconds (default: `300`) |
|
|
169
|
+
|
|
170
|
+
### `expunct detect`
|
|
171
|
+
|
|
172
|
+
Detect PII entities without redacting. Shows entity type, value, confidence, and location.
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
expunct detect --text "My name is Jane Doe and my SSN is 123-45-6789"
|
|
176
|
+
expunct detect document.txt
|
|
177
|
+
expunct detect --uri "gs://bucket/file.txt"
|
|
178
|
+
echo "test@email.com" | expunct detect
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### `expunct jobs`
|
|
182
|
+
|
|
183
|
+
Manage redaction jobs.
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
expunct jobs list
|
|
187
|
+
expunct jobs list --status completed --page 2
|
|
188
|
+
expunct jobs get JOB_ID
|
|
189
|
+
expunct jobs download JOB_ID -o output.pdf
|
|
190
|
+
expunct jobs wait JOB_ID --timeout 600
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### `expunct policies`
|
|
194
|
+
|
|
195
|
+
Manage redaction policies.
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
expunct policies list
|
|
199
|
+
expunct policies create --name "strict" --confidence-threshold 0.9
|
|
200
|
+
expunct policies get POLICY_ID
|
|
201
|
+
expunct policies update POLICY_ID --name "updated-name"
|
|
202
|
+
expunct policies delete POLICY_ID --yes
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### `expunct audit`
|
|
206
|
+
|
|
207
|
+
View audit logs.
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
expunct audit list
|
|
211
|
+
expunct audit list --event-type redaction --page-size 50
|
|
212
|
+
expunct audit list --json
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### `expunct config`
|
|
216
|
+
|
|
217
|
+
Manage CLI configuration.
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
expunct config set api_key YOUR_API_KEY
|
|
221
|
+
expunct config set base_url https://api.expunct.ai
|
|
222
|
+
expunct config get base_url
|
|
223
|
+
expunct config show
|
|
224
|
+
expunct config path
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## 🔑 Authentication
|
|
230
|
+
|
|
231
|
+
**Option A: Environment variable** (recommended for CI/scripts)
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
export EXPUNCT_API_KEY=your_api_key
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**Option B: Config file**
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
expunct config set api_key YOUR_API_KEY
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Stored in `~/.expunct/config.json`:
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
{
|
|
247
|
+
"api_key": "your_api_key",
|
|
248
|
+
"base_url": "https://api.expunct.ai",
|
|
249
|
+
"tenant_id": "your-tenant-id"
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
| Variable | Description |
|
|
254
|
+
|----------|-------------|
|
|
255
|
+
| `EXPUNCT_API_KEY` | API key (overrides config file) |
|
|
256
|
+
| `EXPUNCT_BASE_URL` | API base URL (overrides config file) |
|
|
257
|
+
| `EXPUNCT_TENANT_ID` | Tenant ID (overrides config file) |
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## ⚙️ Output Modes
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
# Default: human-readable with rich formatting
|
|
265
|
+
expunct redact --text "My email is john@gmail.com"
|
|
266
|
+
|
|
267
|
+
# JSON: machine-readable for piping and scripting
|
|
268
|
+
expunct redact --text "My email is john@gmail.com" --json
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## 🤖 Agent-Friendly Design
|
|
274
|
+
|
|
275
|
+
The CLI is designed to work well with AI agents and automation:
|
|
276
|
+
|
|
277
|
+
* **Deterministic output** with `--json` flag
|
|
278
|
+
* **Stdin piping** for chaining commands
|
|
279
|
+
* **Non-interactive** — no prompts in `--json` mode
|
|
280
|
+
* **Exit codes** — 0 for success, 1 for errors
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# Pipe redacted text
|
|
284
|
+
expunct redact --text "My phone is 555-0100" --json | jq .redacted
|
|
285
|
+
|
|
286
|
+
# Chain with other tools
|
|
287
|
+
cat logs.txt | expunct redact | grep "ERROR"
|
|
288
|
+
|
|
289
|
+
# Use in scripts
|
|
290
|
+
expunct jobs list --json | jq '.jobs[].id'
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## 🖥️ Platform Support
|
|
296
|
+
|
|
297
|
+
The CLI is pure Python and works on **macOS**, **Linux**, and **Windows**:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
# All platforms via pip
|
|
301
|
+
pip install expunct-cli
|
|
302
|
+
|
|
303
|
+
# macOS via Homebrew (coming soon)
|
|
304
|
+
brew install expunct/tap/expunct-cli
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## 🔒 Built for Developers
|
|
310
|
+
|
|
311
|
+
Expunct is built on top of proven detection tools like Microsoft Presidio, with added:
|
|
312
|
+
|
|
313
|
+
* policy control
|
|
314
|
+
* hosted API
|
|
315
|
+
* scalable processing
|
|
316
|
+
* multi-format support (text, PDF, DOCX, images, video, audio)
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## 📚 Documentation
|
|
321
|
+
|
|
322
|
+
👉 [https://docs.expunct.ai](https://docs.expunct.ai)
|
|
323
|
+
|
|
324
|
+
## 🌐 Platform
|
|
325
|
+
|
|
326
|
+
👉 [https://expunct.ai](https://expunct.ai)
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## 💡 Roadmap
|
|
331
|
+
|
|
332
|
+
* Pseudonymization (reversible identity masking)
|
|
333
|
+
* Secret detection expansion
|
|
334
|
+
* Batch processing via CLI
|
|
335
|
+
* Directory processing
|
|
336
|
+
* Streaming mode
|
|
337
|
+
* Self-hosted / VPC deployment
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## 🤝 Contributing
|
|
342
|
+
|
|
343
|
+
Contributions welcome. Feel free to open issues or PRs.
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## 📄 License
|
|
348
|
+
|
|
349
|
+
MIT
|