ai-sany
v1.0.2
Published
AI Sanitizer CLI safely scrub sensitive data before sending to an AI
Maintainers
Readme
AI-San AI Sanitizer CLI
AI-San AI Sanitizer is a commandline tool that safely scrubs sensitive or personally identifiable data before sending text to an AI.
It can remove emails, IPs, domains, URLs, tokens, and phone numbers. You can also define your own replacement rules.
- New in version 1.0.2 share files with the community
- Visit carlostkd.ch/ai-sany to see the community shared files
📦 Installation
You can install it globally or locally.
Global:
npm install -g .Then run it anywhere using ai-sany.
Local:
npm installRun it from the project root:
npx ai-sany <file>🚀 Usage
Sanitize a file in place
ai-sany test.txtSave sanitized text to a new file
ai-sany test.txt -o clean.txtPreview sanitized output (no changes written)
ai-sany test.txt --previewSanitize clipboard text directly
ai-sany --clipboardReads text from your clipboard, sanitizes it, and writes it back.
Add or update a custom replacement rule
ai-sany set john alfredReset all custom rules
ai-sany resetList current rules
ai-sany --rulesRemote rules sync
Set a URL:
A robust rules file ready to use: https://carlostkd.ch/ai-sany/rules.json
ai-sany url https://example.com/rules.json- Remove the current URL:
ai-sany url --remove- Sync rules from remote before sanitizing:
ai-sany <file> --syncNote: The remote rules merge with local rules, with remote rules taking precedence. You must set a URL before using
--sync.
⚙️ Built-in Rules
AI-San automatically detects and replaces:
| Type | Example | Replacement |
|----------------|-------------------------------|----------------------|
| Email | [email protected] | [EMAIL_REDACTED] |
| UUID | 550e8400-e29b-41d4-a716... | [UUID_REDACTED] |
| API Key / Token| sk-1234567890... | [TOKEN_REDACTED] |
| IPv4 Address | 192.168.0.1 | [IP_REDACTED] |
| IPv6 Address | 2001:0db8:85a3::8a2e:0370:7 | [IPV6_REDACTED] |
| URL | https://example.com | [URL_REDACTED] |
| Domain | example.com | [DOMAIN_REDACTED] |
| Phone Number | +1 555-123-4567 | [PHONE_REDACTED] |
🧩 Examples
| Command | Description |
|---------------------------------|------------------------------------------------|
| ai-sany test.txt | Sanitize file in place |
| ai-sany test.txt --preview | Preview result without saving |
| ai-sany test.txt -o clean.txt | Write sanitized output to new file |
| ai-sany set name alias | Replace custom words |
| ai-sany reset | Clear all saved rules |
| ai-sany --clipboard | Clean clipboard text instantly |
| ai-sany test.txt --sync | Fetch and merge remote rules before sanitizing |
| ai-sany url https:/<url> | Set the remote url |
| ai-sany url --remove | Remove the remote url |
| ai-sany test.txt --share | share files with the community |
💾 Configuration
Custom replacements are stored in a JSON config file automatically created at:
~/.config/ai-sany/config.jsonAuthor
Created with care by Carlostkd
🪶 GitHub: @carlostkd
🧠 License
MIT — free to use, modify, and distribute.
