Introducing AI-SANY

AI-Sany AI Sanitizer CLI

AI-Sany 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.
Installation
You can install it globally or locally.

Global:

npm install -g .
Then run it anywhere using `ai-sany`.
### Local:
```bash
npm install
Run it from the project root:
```bash
npx ai-sany <file>
 Usage
### Sanitize a file in place
```bash
ai-sany test.txt
### Save sanitized text to a new file
```bash
ai-sany test.txt -o clean.txt
### Preview sanitized output (no changes written)
```bash
ai-sany test.txt --preview
### Sanitize clipboard text directly
```bash
ai-sany --clipboard
Reads text from your clipboard, sanitizes it, and writes it back.
### Add or update a custom replacement rule
```bash
ai-sany set john alfred
### Reset all custom rules
```bash
ai-sany reset
### List current rules
```bash
ai-sany --rules
### Remote rules sync
* Set a URL:
* A robust rules file ready to use:
  https://carlostkd.ch/ai-sany/rules.json
```bash
ai-sany url https://example.com/rules.json
* Remove the current URL:
```bash
ai-sany url --remove
* Sync rules from remote before sanitizing:
```bash
ai-sany <file> --sync
> Note: 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          | `user@example.com`            | `[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                          |
 Configuration
Custom replacements are stored in a JSON config file automatically created at:
~/.config/ai-sany/config.json
### Author
Created with care by **Carlostkd**  
 GitHub: [@carlostkd](https://github.com/carlostkd)
 License
MIT 
 free to use, modify, and distribute.

You'll only receive email when they publish something new.

More from Carlostkd ✅
All posts