Obsidian Plugin Sync
A command-line tool for syncing Obsidian plugin development files to your Obsidian vault.
Features
- Syncs your plugin's development files to your Obsidian vault with a single command
- Automatically detects plugin ID from manifest.json
- Optional build step before syncing
- Watch mode for automatic syncing on file changes
- No dependencies for basic functionality (watch mode requires the
watchdogpackage)
Installation
Option 1: Clone and use directly
git clone https://github.com/wrale/obsidian-plugin-sync.git
cd obsidian-plugin-sync
chmod +x obsidian-plugin-sync.pyOption 2: Install to ~/bin
curl -o ~/bin/obsidian-plugin-sync.py https://raw.githubusercontent.com/wrale/obsidian-plugin-sync/main/obsidian-plugin-sync.py chmod +x ~/bin/obsidian-plugin-sync.py
Usage
Basic Usage
./obsidian-plugin-sync.py --source /path/to/plugin/dev --vault /path/to/vault
Build Before Syncing
./obsidian-plugin-sync.py --source /path/to/plugin/dev --vault /path/to/vault --build
Specify Plugin ID Manually
./obsidian-plugin-sync.py --source /path/to/plugin/dev --vault /path/to/vault --plugin-id your-plugin-id
Watch for Changes
First, install the watchdog package:
Then run with the --watch flag:
./obsidian-plugin-sync.py --source /path/to/plugin/dev --vault /path/to/vault --build --watch
This will continuously watch for changes in your plugin files and automatically sync them to your Obsidian vault.
How It Works
The tool performs the following steps:
- Reads the plugin ID from manifest.json (or uses the one provided)
- Optionally builds the plugin using
npm run build - Copies the necessary files (main.js, manifest.json, styles.css) to your Obsidian vault's plugins directory
- In watch mode, it continuously monitors for changes and repeats steps 2-3 when files are modified
Benefits Over Manual File Copying
- Time-saving: No need to manually navigate directories and copy files
- Consistency: Always copies all required files
- Automation: Combined build and copy process
- Continuous development: Watch mode makes the development cycle faster
Requirements
- Python 3.6 or higher
- For watch mode:
watchdogpackage
License
MIT