# Add Native File Dialogs to a Tauri App

Yes. An agent adds the Tauri dialog plugin to your app, a capability that allows it, open and save dialogs in the frontend, a test, and opens a PR with screenshots.

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

## What the agent does

The agent reads how the app is put together before adding a plugin. In a Tauri 2 app like Uninen/tauri-vue-template, `src-tauri/Cargo.toml` depends on `tauri` 2, `tauri-plugin-shell` 2 and `tauri-plugin-prevent-default` 5, and `src-tauri/src/lib.rs` registers both plugins on the builder, opens devtools in debug builds and exposes one command, `greet`, through `generate_handler!`. The frontend is Vue 3 with Pinia: `src/components/GreetComponent.vue` calls `invoke('greet', { name })` from `@tauri-apps/api/core`, `src/store.ts` holds the app state, and `vite.config.ts` auto-imports `vue`, `pinia` and `useStore`, so a new component writes no import lines for those. `src-tauri/tauri.conf.json` sets a content security policy whose `connect-src` allows `ipc:` and `http://ipc.localhost`, one window labelled by default `main`, and `bundle.targets` of `all`. There is no `src-tauri/capabilities` directory in the template, and `src-tauri/.gitignore` ignores `/gen/`, where Tauri writes the permission schemas at build time.

The plugin goes in on both sides, as Tauri's dialog documentation lays out. The agent adds `tauri-plugin-dialog` to `Cargo.toml` and `.plugin(tauri_plugin_dialog::init())` to the builder in `lib.rs`, and `@tauri-apps/plugin-dialog` to `package.json` with pnpm, the package manager the template's lockfile and workflows use. Because no capability file exists, the plugin's commands would be refused from the webview, so it creates `src-tauri/capabilities/default.json` with the `main` window, `core:default`, and the dialog plugin's default permission set, which the plugin documents as allowing the message, open and save dialogs, and points its `$schema` at `../gen/schemas/desktop-schema.json` so the editor completes permission names once a build has generated it. The `shell` plugin, already registered but with no capability granting it, is left as it is and noted in the pull request.

The frontend gets one component, `src/components/FileDialogs.vue`, beside the greeter: an Open button that calls `open({ multiple: false, directory: false, filters: [{ name: 'Text', extensions: ['txt', 'md'] }] })` and shows the chosen path, a Choose folder button that calls `open` with `directory: true`, and a Save button that calls `save` with the same filter and shows where the file would be written. The paths go into the Pinia store next to `name`, so the rest of the app can read them, and a cancelled dialog, which the API reports as `null`, leaves the previous value in place. For a Rust-side need the agent also adds a `pick_config` command in `lib.rs` that calls `app.dialog().file().add_filter("Config", &["toml"]).blocking_pick_file()` from a command, and registers it in `generate_handler!`, so the pull request shows both ways to open a dialog and when each fits.

To check it, the agent installs the Linux packages the `test-build.yml` workflow installs (`libwebkit2gtk-4.1-dev`, `libappindicator3-dev`, `librsvg2-dev`, `patchelf`), runs `pnpm install` and `cargo check --manifest-path src-tauri/Cargo.toml`, which the `check` script already wraps, then `pnpm tauri build` to confirm the capability compiles into the bundle. It adds a Vitest test beside `tests/unit/example.test.ts` that mounts the new component with `@tauri-apps/plugin-dialog` mocked to return a path and then `null`, asserting the store is set and then left alone, and runs `pnpm test` as `test.yml` does. Finally it starts `pnpm tauri dev` under a virtual display, clicks each button in the app window and screenshots the native dialog over the window, so the pull request shows the dialogs on Linux.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Add native file dialogs to this Tauri 2 app. Read src-tauri/Cargo.toml, lib.rs, tauri.conf.json, any capabilities directory, package.json, the Vite config and the existing components and store to learn how plugins are registered, which package manager is used and how the frontend talks to Rust. Add the dialog plugin on the Rust side and the JavaScript side, create or extend the capability for the main window with the plugin's default permission set and the core defaults, and add a component with open file, choose folder and save buttons that store the chosen paths in the app's state and leave it unchanged on cancel. Add one Rust command that opens a file dialog from the backend so both routes are shown. Install the system packages the build workflow installs, run cargo check, the unit tests with the dialog module mocked, and a full tauri build, then run the app under a virtual display, click each button and screenshot the dialogs. Open a pull request with the commands, their output and the screenshots, and note any plugin already registered without a capability.",
  "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

The pull request changes `Cargo.toml`, `Cargo.lock`, `lib.rs`, `package.json` and the pnpm lockfile, adds `src-tauri/capabilities/default.json`, the component, its test and the store fields, and mounts the component in `App.vue`. Its description shows the `cargo check` and `pnpm test` output, the end of the `tauri build` log with the bundle paths, the capability file in full, and three screenshots: the open dialog with its filter, the folder picker and the save dialog.

A reviewer checks the permission list in the capability, which is the security-relevant part, and the filter extensions. After merging, a build on macOS and Windows through the same `tauri build` picks up the capability unchanged, and the Rust command gives the backend a dialog for the day it needs one without the webview in the loop.

## Run it on every Linear issue labelled desktop

A team that tracks desktop work in Linear adds an automation to the Project with a `linear` trigger on `linear.issue.labeled`, the label `desktop`, with the automation set to read only. Each labelled issue starts a read-only run that reads the Rust and frontend sides and posts, as a comment on the issue, the plugin it would add, the capability it would write and the component it would mount. Only a change made by a member of the Rush org fires the trigger, and that comment is the whole result, because an automation's runs push nothing.

When the plan is agreed, a handler on the team's own server sends this body with the issue's URL added to `resources`, which puts the issue text in front of the agent through the team's Linear connection, and a `request_id` that is a UUID v5 of the issue id, so a second delivery of the same event returns the run already started instead of opening a second pull request.

## Why run it on Rush?

A Tauri plugin is three edits that must agree: the crate on the Rust side, the package on the JavaScript side and the capability that lets the webview call it, and the failure mode when they disagree is a dialog that silently never opens. The agent makes all three in its own sandbox, installs the same system packages the build workflow does, builds the app, runs it under a display and clicks the buttons, with every command and its output kept in the run's record, so the pull request shows the dialog on screen rather than a code change that should work.

It also follows the app's own conventions rather than the plugin's quick start: pnpm because the lockfile says so, auto-imports because the Vite config provides them, the Pinia store because that is where the app keeps state, and a note about the plugin already registered with no capability. Several apps with several frontends get several pull requests, each wired the way that app is wired.

## Frequently asked questions

### Why does the app need a capability file?

Tauri 2 lets the webview call a plugin's commands only when a capability grants them to the window, and the template ships none. The agent writes one for the `main` window with `core:default` and the dialog plugin's default permission set, which its documentation lists as allowing the message, open and save dialogs, and the file is small enough to review line by line.

### Does it work on macOS and Windows too?

The dialog plugin opens each platform's native dialog, and the capability and the component are the same on all three. The agent builds and screenshots on Linux in its sandbox, and the pull request says so; the mobile targets do not support a folder picker, which the plugin documents, so the folder button is desktop-only.

### What happens when the user cancels?

The dialog functions resolve to `null`, and the component leaves the stored path as it was rather than clearing it. The unit test mocks the dialog module to return a path and then `null` and checks both outcomes.

### Should dialogs open from Rust or from the frontend?

Either. The frontend route needs the JavaScript package and the capability; the Rust route needs only the crate and runs inside a command, which fits a dialog triggered by backend logic. The pull request adds one of each so the pattern is in the codebase for whichever a later feature needs.

## More Tauri jobs

- [Add a Global Keyboard Shortcut to a Tauri App](https://getrush.ai/run/add-global-shortcut/tauri/)
- [Add i18n to a Tauri App](https://getrush.ai/run/add-i18n/tauri/)
- [Add Logging to a Tauri App with tauri-plugin-log](https://getrush.ai/run/add-logging/tauri/)

## The same job on other stacks

- [Add Open and Save File Dialogs to an Electron App from a Linear Issue](https://getrush.ai/run/add-file-dialogs/electron/)

## More jobs like this: Turn a Linear label into a PR

- [Add File Uploads to a React Router App](https://getrush.ai/run/add-file-uploads/react-router/)
- [Add File Uploads to a Vapor API](https://getrush.ai/run/add-file-uploads/vapor/)

## 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/)
