@huangjunsen/vault-cli
v0.2.0
Published
macOS vault CLI: hide/unhide directories with .noindex and manage encrypted sparsebundles
Maintainers
Readme
Vault CLI (macOS)
Goal: Make selected directories fully disappear from common macOS searchers (Spotlight/mdfind/uTools/VSCode/find/grep) and not show in Finder when hidden, with a simple Node.js CLI.
Two modes:
- rename_noindex: Rename folder to ..noindex to disable Spotlight indexing and hide from Finder.
- sparsebundle: Attach/detach an encrypted .sparsebundle image via hdiutil, optionally with -nobrowse and Spotlight disabled while mounted.
Install / Run
- Local dev: node bin/vault.js --help
- Global (recommended for users): npm install -g vault-cli, then use vault-cli
Publish & Global Install
- Publish (scoped, public): npm publish
- Install globally: npm install -g @huangjunsen/vault-cli
- Use: vault-cli (alias: vault)
Config Option A (no-config, pass paths directly):
- Hide by path: vault-cli off /abs/path/A /abs/path/B --dry-run
- Restore by path: vault-cli on /abs/path/A /abs/path/B
Option B (config file): use an array of folder paths (rename_noindex by default). Create ~/.vaultconfig.json
[ "/Users/you/Projects/Company", "/Users/you/Private" ]
Add paths to existing config
- Append paths: vault-cli add /abs/path/C /abs/path/D
- Works with array config or object config (appends targets[] with rename_noindex).
Edit config
- Open default config (auto-create if missing): vault-cli config --edit
- Open custom path (auto-create if missing): vault-cli config --edit --config /custom/path.json
Commands
- vault-cli add <absPath...>
- vault-cli config --edit
- vault-cli on <target...|--all|--group > [--dry-run]: Show folder(s) or attach sparsebundle(s)
- vault-cli off <target...|--all|--group > [--dry-run]: Hide folder(s) or detach sparsebundle(s)
- vault-cli status [<target...>|--all|--group ]: Show state
- vault-cli targets: List configured target names
- vault-cli sweep [--full-index]: Clear QuickLook cache and Recent Documents; with --full-index also rebuild Spotlight (expensive)
Why this works
- Finder visibility: A leading dot (.) hides items in Finder; detached volumes do not appear anywhere.
- Spotlight indexing: Folders ending with .noindex are excluded; unmounted images are not indexed at all. When mounted, you can also disable Spotlight for the mountpoint.
- Grep/find/mdfind/uTools/VSCode: With the folder renamed to .*.noindex it won’t be in the index, and most tools skip dotfolders by default; detached sparsebundles expose no plaintext files.
Operational notes
- rename_noindex is fast and reversible (atomic rename within same parent folder).
- sparsebundle offers encryption and complete off-state invisibility; attach uses your interactive password prompt (stdin), nothing is stored.
- sweep: By default clears QuickLook caches and Recent Documents. --full-index triggers mdutil -E / which is system-wide and slow.
Examples
- Hide: vault off company
- Show: vault on company
- Mount: vault on vault
- Detach: vault off vault
- Status: vault status
Safety
- This CLI targets macOS only. It runs hdiutil, mdutil, qlmanage under your user.
- Avoid using --full-index unless you truly need to guarantee Spotlight has purged past traces.
