exfil-cli
v1.0.0
Published
A professional CLI tool to scan, detect, and export important local-only project files (.env, .pem, keys, certs, configs) for safe migration between environments.
Downloads
110
Maintainers
Readme
🔐 exfil-cli
Scan · Detect · Extract · Export — A professional CLI to find and export important local-only project files for safe migration.
Why?
When migrating to a new OS, reformatting, or switching machines, the files that aren't in version control are often the ones you need most:
.env,.env.local,.env.production- Private keys (
.pem,.key,.p12) - SSL certificates
- OAuth tokens and service-account JSONs
- IDE run-configurations & debug settings
- Docker overrides (
docker-compose.override.yml) - Database dumps, local scripts, build caches
exfil-cli recursively scans your project directories, detects 90+ file patterns across 14 categories, respects .gitignore, and copies everything into a neatly organised folder — ready to zip and carry.
Installation
# Global (recommended)
npm install -g exfil-cli
# Or with yarn
yarn global add exfil-cli
# Or run without installing
npx exfil-cliQuick Start
# Interactive mode (guided wizard)
exfil
# Scan a project and see what's important
exfil scan --dir ~/projects/my-app
# Extract important files into an organised folder
exfil extract --dir ~/projects --output ./backup
# Scan → Extract → Zip in one shot
exfil zip --dir ~/projects --output ./backup.zipCommands
| Command | Description |
|---|---|
| exfil | Launch interactive wizard (default) |
| exfil scan | Scan directories and report findings |
| exfil extract | Copy important files into organised output |
| exfil zip | Scan, extract, and create a zip archive |
| exfil init | Create a .extractorrc.json config file |
| exfil rules list | Show all active rules (built-in + user) |
| exfil rules builtin | Show full built-in detection rules table |
| exfil rules add | Add a custom include/exclude rule |
| exfil rules remove | Remove a user rule by index |
| exfil rules reset | Reset config to defaults |
Common Options
-d, --dir <path> Target directory to scan (default: current dir)
-o, --output <path> Output directory or zip path
-p, --priority <level> Minimum priority: CRITICAL, HIGH, MEDIUM, LOW
-v, --verbose Show detailed output during scanWhat It Detects
exfil-cli ships with 90+ built-in rules organised into 14 categories:
| # | Category | Examples |
|---|---|---|
| 1 | 🔑 Environment Variables | .env, .env.local, .env.production |
| 2 | 🔐 Crypto & Keys | *.pem, *.key, *.p12, *.jks, *.keystore |
| 3 | 📜 Certificates | *.crt, *.cer, *.pfx, ca-certificates/ |
| 4 | 🔒 Auth & Tokens | token.json, .netrc, .npmrc with tokens |
| 5 | ☁️ Cloud Credentials | AWS credentials, GCP service accounts, Azure config |
| 6 | 🗄️ Databases | *.sqlite, *.db, dumps, migration seeds |
| 7 | 🐳 Docker Overrides | docker-compose.override.yml, .docker/ |
| 8 | ⚙️ IDE & Editor | .vscode/launch.json, .idea/runConfigurations/ |
| 9 | 🔧 Local Config | local.settings.json, *.local.js |
| 10 | 📦 Build Artefacts | Signing keys, provisioning profiles |
| 11 | 🛡️ CI / CD Secrets | .github/secrets, deploy keys |
| 12 | 📝 Local Scripts | scripts/, shell scripts not in VCS |
| 13 | 🗂️ Data Files | CSVs, JSON fixtures, seed data |
| 14 | 📋 Miscellaneous | Licence keys, internal docs, notes |
Priority Levels
| Priority | Meaning | |---|---| | 🔴 CRITICAL | Secrets that would cause a security breach if lost | | 🟠 HIGH | Hard-to-recreate credentials and configs | | 🟡 MEDIUM | Useful local configurations | | 🟢 LOW | Nice-to-have files, notes, scripts |
Run exfil rules builtin to see every rule, or filter by priority:
exfil rules builtin --priority CRITICALConfiguration
Initialise a config file in your project:
exfil initThis creates .extractorrc.json:
{
"include": {
"patterns": [],
"filenames": [],
"extensions": []
},
"exclude": {
"patterns": [],
"paths": [],
"extensions": []
},
"priorityOverrides": {},
"customRules": [],
"scan": {
"maxFileSizeMB": 50,
"followSymlinks": false,
"extraScanDirs": []
},
"output": {
"defaultDir": "./extracted-files",
"includeMetadata": true,
"generateRestoreScripts": true
}
}Adding Rules via CLI
# Include extra patterns
exfil rules add include pattern "**/.secret-*"
exfil rules add include filename "my-custom-config.yml"
exfil rules add include extension ".bak"
# Exclude things you don't need
exfil rules add exclude pattern "**/test-fixtures/**"
exfil rules add exclude path "vendor/"
exfil rules add exclude extension ".log"
# Check what's active
exfil rules listOutput Structure
extracted-files/
├── my-app/
│ ├── CRITICAL/
│ │ ├── env-variables/
│ │ │ └── .env
│ │ └── crypto-keys/
│ │ └── server.key
│ ├── HIGH/
│ │ ├── cloud-credentials/
│ │ │ └── gcp-service-account.json
│ │ └── auth-tokens/
│ │ └── token.json
│ └── MEDIUM/
│ └── ide-editor/
│ └── .vscode/launch.json
├── another-project/
│ └── ...
├── MANIFEST.json ← Full index of every extracted file
├── SUMMARY.txt ← Human-readable overview
├── RESTORE.ps1 ← PowerShell script to put files back
└── RESTORE.sh ← Bash script to put files backProgrammatic API
const { Scanner, Organizer, Zipper, Reporter } = require('exfil-cli');
// Scan
const scanner = new Scanner({ dir: './projects', minPriority: 'HIGH' });
const results = await scanner.scan();
Reporter.printScanReport(results);
// Extract
const organizer = new Organizer(results, { outputDir: './backup' });
const extraction = await organizer.organize();
Reporter.printExtractionReport(extraction);
// Zip
const zipper = new Zipper('./backup', './backup.zip');
const zipInfo = await zipper.zip();
Reporter.printZipReport(zipInfo);Features
- ✅ 90+ built-in detection rules across 14 categories
- ✅ Priority classification — CRITICAL / HIGH / MEDIUM / LOW
- ✅
.gitignore-aware — focuses on files excluded from version control - ✅ User-configurable include/exclude rules via
.extractorrc.json - ✅ Interactive wizard for guided extraction
- ✅ Restore scripts generated automatically (PowerShell + Bash)
- ✅ Manifest & summary for every extraction
- ✅ Crypto metadata sidecars for key/cert files
- ✅ Zip export with maximum compression
- ✅ Programmatic API for scripting and CI integration
Requirements
- Node.js ≥ 14.0.0
