ovm (Obsidian Vaults Manager) is a CLI application designed to streamline the management of vaults in Obsidian. This tool aims to overcome the limitations associated with performing bulk tasks on specific vaults and plugins. It enables users to install, uninstall, prune, and generate reports for a set of favorite plugins across multiple vaults, enhancing productivity and efficiency.
Manage Obsidian plugins: Install/Uninstall/Prune plugins in multiple vaults at one go.
Perform actions on Obsidian or custom vaults: By default, Obsidian vaults are supported and detected. The vault-related commands support -p flag to define a custom vault/s from a path or Glob pattern. e.g. ~/Documents/obsidian/*.
Generate reports: Generate statistics of vaults and installed plugins with Table/JSON output format.
Interactive CLI: User-friendly interface to select vaults and plugins for each command.
Cross-platform: Windows, macOS, and Linux.
Requirements
Node.js 18.x or higher
Usage
$npminstall-govm$ovmversionovm/0.1.0darwin-x64node-v20.11.0# Output may vary$ovmCOMMANDrunningcommand...$ovm--help [COMMAND]USAGE$ovmCOMMAND...
The config file is created in the user's home directory by ovm ci and is named ovm.json. It contains an array of plugins that are to be installed across single/multiple vault.
{"plugins": []}
Example config file for following Commands section is as follows:
The content used in the examples below is for illustrative purposes only. e.g. In the output sections, the vaults are stored in ~/Documents/ directory. The actual output may vary.
ovm config init
Aliases: ovm ci
Configure an ovm.json config file in user's home directory.
$ovmpluginsprune? Select the vaults: Testinfo:Removedplugin{"pluginId":"obsidian-tasks-plugin","vaultPath":"~/Documents/obsidian/Test"}info:Pruned1plugins{"vault":{"name":"Test","path":"~/Documents/obsidian/Test"}}
Run a shell command on selected vaults (using Node.js child_process).
Disclaimer: Any input containing shell metacharacters may be used to trigger arbitrary command execution, using of this command is at risk of command's caller.
$ovmvaultsrun-s"tar -cf '{0}.tar' '{0}'"-o=json? Select the vaults: Career, Financial, Goalsinfo: Run command {"command":"tar -cf '~/Documents/obsidian/Career.tar' '~/Documents/obsidian/Career'","vault":{"name":"Career","path":"~/Documents/obsidian/Career"}}
info: Run operation finished! {"custom_commands_log_path":"/var/folders/_v/j4w6kv1s27b6xjfzvl5k6lqm0000gn/T/ovm-custom-command.json"}
{"Career":{"success":true,"duration":"2 seconds","error":null },"Financial":{"success":true,"duration":"1 second","error":null },"Goals":{"success":true,"duration":"1 second","error":null }}$ovmr"echo 'Path: {0}'"info: Run command {"command":"echo 'Path: ~/Documents/obsidian/Career'","vault":{"name":"Career","path":"~/Documents/obsidian/Career"}}
Path:~/Documents/obsidian/Careerinfo: Run operation finished! {"custom_commands_log_path":"/var/folders/_v/j4w6kv1s27b6xjfzvl5k6lqm0000gn/T/ovm-custom-command.json"}
┌─────────┬─────────┬──────────┬───────┐│ (index) │ success │ duration │ error │├─────────┼─────────┼──────────┼───────┤│Career│true│'10 ms'│null│└─────────┴─────────┴──────────┴───────┘
Reserved placeholders
A custom command can be executed on vault(s) by using reserved placeholders as string value within the shell command. The placeholders are replaced with the actual values during the execution.
List of placeholders:
{0}: Vault path
{1}: Vault name
Examples:
Echo vault(s) path
ovm run "echo 'Path: {0}'"
Echo vault(s) path and name
ovm run "echo 'Path: {0}, Name: {1}'"
Echo vault(s) name and silent the command's result
ovm run -s "echo 'Path: {0}'"
Create an archive of vault(s) by tar command
ovm run "tar -cf '{0}.tar' '{0}'"
Encrypt vault(s) directory by gpg command [algo: AES256, passphrase password]