Plugin Setup
This guide walks you through integrating tauri-plugin-pilot into an existing Tauri v2 application.
1. Add the dependency
Section titled “1. Add the dependency”In your app’s src-tauri/Cargo.toml, add the plugin under [dependencies]:
[dependencies]tauri-plugin-pilot = { git = "https://github.com/mpiton/tauri-pilot" }2. Register the plugin
Section titled “2. Register the plugin”Register the plugin in your app entry point using a #[cfg(debug_assertions)] guard:
fn main() { let mut builder = tauri::Builder::default();
#[cfg(debug_assertions)] { builder = builder.plugin(tauri_plugin_pilot::init()); }
builder.run(tauri::generate_context!()).expect("error running app");}3. Debug-only compilation
Section titled “3. Debug-only compilation”The #[cfg(debug_assertions)] guard is intentional and important:
- The plugin is only compiled and included in debug builds
- Production builds (
cargo build --release) will not include the plugin - There is zero runtime overhead or binary size impact in production
- No need to strip or disable the plugin before shipping
4. Socket path
Section titled “4. Socket path”Once your app starts in dev mode, the plugin creates a Unix socket at:
/tmp/tauri-pilot-{identifier}.sockThe {identifier} value comes from the identifier field in your tauri.conf.json.
Example: an app with identifier com.myapp.dev creates the socket at:
/tmp/tauri-pilot-com.myapp.dev.sockThe CLI auto-discovers this socket when you run commands.
5. Permissions
Section titled “5. Permissions”The plugin requires the pilot:default permission for its internal __callback IPC command. Add it to your capability file (e.g. src-tauri/capabilities/default.json):
{ "permissions": ["core:default", "pilot:default"]}Without this permission, eval commands will time out with “eval timed out after 10s”.
6. Verify the setup
Section titled “6. Verify the setup”Start your Tauri app in development mode, then test the connection from a second terminal:
# Terminal 1 — start your appcargo tauri dev
# Terminal 2 — verify the plugin is reachabletauri-pilot ping# Expected output: pongIf you see pong, the plugin is running and the CLI can reach it. You are ready to start using the snapshot/action workflow.