# Add Deep Link Handling to a Tauri App

Yes. An agent registers a custom URL scheme with Tauri's deep-link plugin, routes the URL to the running window and the Vue store, builds it, and opens a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-deep-links/tauri/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent clones the repository into its own cloud sandbox and reads both halves of the app. In a Tauri 2 app like Uninen/tauri-vue-template, `src-tauri/tauri.conf.json` has no `plugins` section, `src-tauri/src/lib.rs` registers only the shell and prevent-default plugins, and there is no `src-tauri/capabilities/` directory at all, so the webview holds no plugin permissions today. On the frontend, `src/main.ts` mounts `App.vue` with a Pinia store from `src/store.ts` whose state is `debug`, `version`, `isInitialized` and `name`, and `vite.config.ts` auto-imports `useStore` so components call it without an import line. The agent notes that nothing in the app reacts to a URL.

It adds the scheme in three places. `cargo add tauri-plugin-deep-link` in `src-tauri/` and `pnpm add @tauri-apps/plugin-deep-link` bring in the Rust and JavaScript halves, and `tauri.conf.json` gains `"plugins": { "deep-link": { "desktop": { "schemes": ["tauri-app"] } } }`, the product name reused as the scheme. In `lib.rs` the agent registers `tauri_plugin_deep_link::init()`, and inside `setup` calls `app.deep_link().register_all()` under `cfg(any(target_os = "linux", all(debug_assertions, windows)))`, because on those platforms a scheme only resolves for an installed app and this call is what makes `pnpm tauri dev` testable. On Windows and Linux a deep link reaches a new process as a command-line argument, so the agent also adds `tauri-plugin-single-instance` with its `deep-link` feature under the desktop target and registers it before every other plugin, which forwards the URL to the instance already running.

The URL then has to reach the page. In Rust, `app.deep_link().on_open_url` receives `event.urls()` and the agent checks each one's scheme before trusting it, since any process can start the app with a made-up argument. In the frontend it adds `onOpenUrl` and `getCurrent` from `@tauri-apps/plugin-deep-link` to `src/main.ts`, writes the last URL into a new `lastDeepLink` field on the store in `src/store.ts`, and shows it in `App.vue` so a reviewer can see the round trip. For the webview to call the plugin and listen for its event, the agent creates `src-tauri/capabilities/default.json` for the `main` window with `core:default` and `deep-link:default`. A small parser that turns `tauri-app://open?item=42` into a route and parameters gets a `vitest` test next to `tests/unit/example.test.ts`.

It proves what a Linux sandbox can prove. After installing the webkit2gtk, appindicator, rsvg and patchelf packages the workflows install, it runs `cargo check` and `cargo build` with `--manifest-path src-tauri/Cargo.toml`, `cargo clippy` on the crate, `pnpm build` so `vue-tsc` type-checks the new store field, and `pnpm test`. The description tells a reviewer how to try it by hand: `xdg-open tauri-app://open?item=42` on Linux, `start tauri-app://open?item=42` on Windows, and on macOS only from a bundled app installed in Applications, because macOS does not register schemes at runtime.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add deep link handling to this Tauri 2 app for a custom scheme named after the product. Read src-tauri/tauri.conf.json, src-tauri/Cargo.toml, src-tauri/src/lib.rs, package.json, vite.config.ts, src/main.ts, src/store.ts, src/App.vue and the workflows under .github/workflows first, and confirm there is no plugins section, no capabilities directory and no URL handling today. Add tauri-plugin-deep-link and @tauri-apps/plugin-deep-link, configure the desktop scheme in tauri.conf.json, register the plugin, call register_all on Linux and on Windows debug builds, and add tauri-plugin-single-instance with its deep-link feature registered first so a second launch forwards the URL. Validate the scheme of every URL before using it. Create src-tauri/capabilities/default.json with core:default and deep-link:default. In the frontend, subscribe with onOpenUrl and getCurrent, store the last URL in the Pinia store, show it in App.vue, and add a vitest test for the URL parser. In your sandbox install the Linux build packages, run cargo check, cargo build and cargo clippy on src-tauri, run pnpm build and pnpm test, and open a pull request that lists the files changed, how to test the scheme on each platform, and the command output.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request touching `src-tauri/Cargo.toml`, `src-tauri/Cargo.lock`, `src-tauri/tauri.conf.json`, `src-tauri/src/lib.rs`, a new `src-tauri/capabilities/default.json`, `package.json`, `pnpm-lock.yaml`, `src/main.ts`, `src/store.ts`, `src/App.vue` and a new unit test. The description names the scheme, explains why the single-instance plugin came along for Windows and Linux, and gives the one command per platform that opens a link.

The run's record keeps the `cargo check`, `cargo build`, `cargo clippy`, `pnpm build` and `pnpm test` output, and every file the agent read before deciding to create the capabilities directory rather than extend one.

Before merging, a reviewer builds a bundle on macOS and installs it, which is the only way to exercise the scheme there, and settles two choices the pull request leaves open: the exact scheme name, which has to be unique on a user's machine, and whether a link should navigate somewhere rather than only be shown.

## Run it on every GitHub issue labelled desktop

A team that files desktop work as GitHub issues starts one run per issue from an automation with a `github` trigger on `issues.labeled` filtered to the `desktop` label, in the Project that holds the Tauri repository. The trigger adds the issue after this prompt, so an issue that names a different scheme, asks for an `https` app link instead of a custom scheme, or wants the URL to open a specific page is what the agent reads; it fills in no placeholder.

Each run clones the app into a fresh sandbox, builds it on Linux and opens its own pull request that closes the issue. An automation run has its own `max_runs_per_hour` cap, and a second labelled issue gets a second sandbox rather than waiting on the first.

## Why run it on Rush?

Deep links touch every layer at once: a config entry, a Rust plugin, a permission file the template never needed, a second plugin for two of the three desktop platforms, and frontend code. The agent reads the plugin's documentation and the app in the same run and ships the whole chain, with the platform-by-platform test instructions written down, rather than a pull request that works on the author's operating system and nowhere else.

The sandbox is a clean Linux box where the agent installs the packages the repository's own workflows install, so the build in the record matches CI. The same request runs against every Tauri app an organisation maintains, each with its own `lib.rs` read first, and each pull request keeps the command output and the list of files the agent read for the reviewer.

## Frequently asked questions

### Why is a capabilities file needed now when the app had none?

The app's own `greet` command needs no permission, which is why the template could skip the directory. Plugin commands and events do: `deep-link:default` lets the webview call `getCurrent`, and `core:default` lets it listen for the event `onOpenUrl` is built on. The file names the `main` window so the grant is scoped to it.

### Why add the single-instance plugin for a deep link?

On Windows and Linux the operating system starts a new process with the URL as an argument. Without the single-instance plugin, the user would get a second window. With it, built with the `deep-link` feature and registered first, the new process hands the URL to the running one and exits.

### Can I test it during development?

On Linux, and on Windows in debug builds, `register_all` registers the scheme for the development binary, so `pnpm tauri dev` followed by `xdg-open` or `start` with the URL works. On macOS the scheme comes from the bundle, so only an installed build responds.

### Is a custom scheme safe?

Any program on the machine can launch the app with a URL-shaped argument, so the handler checks the scheme and parses the rest before acting, and the pull request treats the URL as untrusted input. A verified `https` app link needs a hosted association file and is a separate change the description points at.

### Does this change the mobile builds?

The configuration added is under `desktop` only. A `mobile` entry with its own scheme would also generate the Android and iOS registrations, but the pull request leaves that out until the team ships mobile.

## More Tauri jobs

- [Add End-to-End Tests to a Tauri App](https://getrush.ai/run/add-e2e-tests/tauri/)
- [Add Native File Dialogs to a Tauri App](https://getrush.ai/run/add-file-dialogs/tauri/)
- [Add a Global Keyboard Shortcut to a Tauri App](https://getrush.ai/run/add-global-shortcut/tauri/)

## The same job on other stacks

- [Add Deep Link Handling to an Electron App from a Linear Issue](https://getrush.ai/run/add-deep-links/electron/)
- [Add Deep Links to an Expo App](https://getrush.ai/run/add-deep-links/expo/)
- [Add Deep Links to a Flutter App](https://getrush.ai/run/add-deep-links/flutter/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
