@stll/anonymize-cli
v1.4.11
Published
Command-line PII detection and anonymization powered by @stll/anonymize
Readme
@stll/anonymize-cli
Command-line PII detection and anonymization powered by
@stll/anonymize.
Fully offline: no network calls, ever.
Usage
# No install needed
echo "Contact Jan Novák at [email protected]" | bunx @stll/anonymize-cli
# Contact [PERSON_1] at [EMAIL_ADDRESS_1]
# Or with npx / a global install (bin name: anonymize)
npx @stll/anonymize-cli contract.txt > contract.anon.txtReversible round-trip for LLM workflows — anonymize, send the redacted text to a model, restore names in the answer:
anonymize -k key.json -o redacted.txt input.txt
# ... send redacted.txt to the LLM, save reply as reply.txt ...
anonymize -d key.json reply.txtOptions
| Flag | Meaning |
| ------------------------- | ----------------------------------------------- |
| -o, --output <path> | Output file, or directory for multiple inputs |
| -m, --mode <mode> | replace (reversible placeholders) or redact |
| -k, --key <path> | Write the redaction key JSON (replace mode) |
| -d, --deanonymise <key> | Restore text using a redaction key |
| --labels <list> | Entity labels to detect (default: all) |
| --languages <list> | Name-corpus languages, e.g. cs,de,en |
| --countries <list> | ISO 3166-1 alpha-2 deny-list/city scope |
| --threshold <n> | Minimum confidence score 0-1 (default 0.3) |
| --redact-string <s> | Replacement text in redact mode |
| --json | Emit entities + redacted text as JSON |
| --quiet | Suppress the stderr summary |
Run anonymize --help for the full reference, including the
--json schema and exit codes.
Scripting and agents
- Exit codes:
0success,1runtime error,2usage error. - The stderr summary contains entity-label counts only, never detected text.
- The interactive locale prompt appears only when stdin and stderr are TTYs and no scope flags are given; piped runs never block.
--jsonoffsets are UTF-16 code-unit indexes into the input.
Standalone binary
bun run compile produces a self-contained executable (WASM
engine, dictionaries embedded as a gzip blob) that runs without
Node, Bun, or npm. Cross-compile with --target=bun-linux-x64
etc.
License
MIT
