Skip to content

CLI Reference

The Aegis CLI provides command-line access to PII detection and masking.


Installation

The CLI is included with the SDK:

pip install aegis-sdk

Or install standalone with pipx:

pipx install aegis-sdk

Verify installation:

aegis --version
aegis-sdk 0.1.3

The CLI automatically checks for updates and notifies you when a new version is available.


Commands

aegis scan

Scan text for PII without processing decisions.

aegis scan [OPTIONS] [TEXT]

Options

Option Short Description
--file PATH -f Scan a file instead of text
--no-samples Don't include samples in output
--json Output as JSON

Examples

Scan text:

aegis scan "Customer email: [email protected], SSN: 123-45-6789"

Output:

Detected 2 type(s) of sensitive data:

  - EMAIL: 1 occurrence(s) (sample: j***@example.com)
  - SSN: 1 occurrence(s) (sample: ***-**-6789)

Scan file:

aegis scan -f report.txt

JSON output:

aegis scan "[email protected]" --json
{
  "detected": [
    {
      "type": "EMAIL",
      "count": 1,
      "sample": "j***@example.com"
    }
  ],
  "has_pii": true
}

aegis mask

Mask PII in text.

aegis mask [OPTIONS] [TEXT]

Options

Option Short Description
--file PATH -f Mask a file
--output PATH -o Output file path

Examples

Mask text:

aegis mask "My email is [email protected]"
My email is j***@example.com

Mask file:

aegis mask -f input.txt -o output.txt
Masked output written to output.txt

aegis process

Process text with full policy decision logic.

aegis process [OPTIONS] [TEXT]

Options

Option Short Description
--file PATH -f Process a file
--output PATH -o Output file path
--destination DEST -d Destination: AI_TOOL, VENDOR, CUSTOMER
--no-samples Don't include samples
--json Output as JSON

Examples

Process text:

aegis process "Customer SSN: 123-45-6789" -d AI_TOOL

Output:

Decision: Decision.BLOCKED
Summary: Content blocked - SSN not allowed for AI_TOOL

Detected:
  - SSN: 1

Suggested fix: Remove or redact SSN data before sending

Process with masking:

aegis process "Email: [email protected]" -d AI_TOOL
Decision: Decision.ALLOWED_WITH_MASKING
Summary: Content allowed after masking EMAIL

Detected:
  - EMAIL: 1

Masked content:
Email: j***@example.com

JSON output:

aegis process "[email protected]" -d AI_TOOL --json
{
  "decision": "ALLOWED_WITH_MASKING",
  "summary": "Content allowed after masking EMAIL",
  "detected": [
    {"type": "EMAIL", "count": 1}
  ],
  "masked_content": "t***@email.com",
  "is_blocked": false,
  "bytes_processed": 14
}

aegis process-file

Process large files with streaming (for files over 10MB).

aegis process-file [OPTIONS] INPUT

Options

Option Short Description
--output PATH -o Output file path
--destination DEST -d Destination: AI_TOOL, VENDOR, CUSTOMER
--chunk-mb SIZE Chunk size in MB (default: 10)
--no-header CSV has no header row
--stop-on-block Stop processing if blocked
--quiet -q Suppress progress output
--json Output as JSON

Examples

Process large text file:

aegis process-file logs.txt -o logs_masked.txt -d VENDOR
Processed: 150.2 MB
Decision: Decision.ALLOWED_WITH_MASKING
Summary: Processed 150.20 MB in 16 chunks
Processed: 150.20 MB in 16 chunks

Detected:
  - EMAIL: 1523
  - PHONE: 847

Output: logs_masked.txt

Process CSV file:

aegis process-file customers.csv -o customers_safe.csv -d AI_TOOL

Stop on block:

aegis process-file data.csv -d VENDOR --stop-on-block

aegis check-license

Check license status.

aegis check-license [OPTIONS]

Options

Option Description
--license-key KEY License key (or use AEGIS_LICENSE_KEY env var)
--offline Offline mode
--json Output as JSON

Examples

Check license:

aegis check-license --license-key aegis_lic_xxx
License Status: Valid
Organization: acme_corp
Expires: 2025-12-31
Policy Version: 1

With environment variable:

export AEGIS_LICENSE_KEY="aegis_lic_xxx"
aegis check-license

JSON output:

aegis check-license --json
{
  "valid": true,
  "org_id": "acme_corp",
  "expires": "2025-12-31",
  "policy_version": "1"
}

Exit Codes

Code Meaning
0 Success (no PII found or allowed)
1 PII detected or content blocked

Use in scripts:

aegis scan -f document.txt
if [ $? -eq 0 ]; then
    echo "No PII detected - safe to proceed"
else
    echo "PII detected - review required"
fi

Piping and Scripting

Pipe input:

echo "SSN: 123-45-6789" | aegis mask

Process multiple files:

for file in *.csv; do
    aegis process-file "$file" -o "masked_$file" -d VENDOR -q
done

With jq for JSON processing:

aegis process "Test content" -d AI_TOOL --json | jq '.decision'

Environment Variables

Variable Description
AEGIS_LICENSE_KEY License key for enterprise features

See Also