tauri-agent-tools 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/tauri-agent-tools/SKILL.md +195 -13
- package/.agents/skills/tauri-bridge-setup/SKILL.md +82 -14
- package/.agents/skills/tauri-debug-quickstart/SKILL.md +80 -0
- package/AGENTS.md +9 -7
- package/README.md +119 -11
- package/dist/bridge/client.d.ts +21 -2
- package/dist/bridge/client.js +119 -3
- package/dist/bridge/client.js.map +1 -1
- package/dist/cli.js +47 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/appPaths.d.ts +2 -0
- package/dist/commands/appPaths.js +97 -0
- package/dist/commands/appPaths.js.map +1 -0
- package/dist/commands/capabilitiesAudit.d.ts +2 -0
- package/dist/commands/capabilitiesAudit.js +105 -0
- package/dist/commands/capabilitiesAudit.js.map +1 -0
- package/dist/commands/capture.d.ts +3 -0
- package/dist/commands/capture.js +218 -0
- package/dist/commands/capture.js.map +1 -0
- package/dist/commands/check.d.ts +5 -0
- package/dist/commands/check.js +174 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/configInspect.d.ts +2 -0
- package/dist/commands/configInspect.js +223 -0
- package/dist/commands/configInspect.js.map +1 -0
- package/dist/commands/diagnose.d.ts +2 -0
- package/dist/commands/diagnose.js +311 -0
- package/dist/commands/diagnose.js.map +1 -0
- package/dist/commands/eval.js +16 -3
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/forensics.d.ts +2 -0
- package/dist/commands/forensics.js +331 -0
- package/dist/commands/forensics.js.map +1 -0
- package/dist/commands/health.d.ts +2 -0
- package/dist/commands/health.js +39 -0
- package/dist/commands/health.js.map +1 -0
- package/dist/commands/interact/click.d.ts +6 -0
- package/dist/commands/interact/click.js +102 -0
- package/dist/commands/interact/click.js.map +1 -0
- package/dist/commands/interact/focus.d.ts +3 -0
- package/dist/commands/interact/focus.js +40 -0
- package/dist/commands/interact/focus.js.map +1 -0
- package/dist/commands/interact/navigate.d.ts +3 -0
- package/dist/commands/interact/navigate.js +49 -0
- package/dist/commands/interact/navigate.js.map +1 -0
- package/dist/commands/interact/scroll.d.ts +11 -0
- package/dist/commands/interact/scroll.js +110 -0
- package/dist/commands/interact/scroll.js.map +1 -0
- package/dist/commands/interact/select.d.ts +3 -0
- package/dist/commands/interact/select.js +59 -0
- package/dist/commands/interact/select.js.map +1 -0
- package/dist/commands/interact/shared.d.ts +23 -0
- package/dist/commands/interact/shared.js +62 -0
- package/dist/commands/interact/shared.js.map +1 -0
- package/dist/commands/interact/type.d.ts +6 -0
- package/dist/commands/interact/type.js +59 -0
- package/dist/commands/interact/type.js.map +1 -0
- package/dist/commands/invoke.d.ts +3 -0
- package/dist/commands/invoke.js +53 -0
- package/dist/commands/invoke.js.map +1 -0
- package/dist/commands/osLogs.d.ts +2 -0
- package/dist/commands/osLogs.js +130 -0
- package/dist/commands/osLogs.js.map +1 -0
- package/dist/commands/probe.d.ts +2 -0
- package/dist/commands/probe.js +117 -0
- package/dist/commands/probe.js.map +1 -0
- package/dist/commands/processTree.d.ts +2 -0
- package/dist/commands/processTree.js +45 -0
- package/dist/commands/processTree.js.map +1 -0
- package/dist/commands/shared.d.ts +10 -4
- package/dist/commands/shared.js +23 -3
- package/dist/commands/shared.js.map +1 -1
- package/dist/commands/sidecarReplay.d.ts +7 -0
- package/dist/commands/sidecarReplay.js +93 -0
- package/dist/commands/sidecarReplay.js.map +1 -0
- package/dist/commands/sidecarTap.d.ts +2 -0
- package/dist/commands/sidecarTap.js +118 -0
- package/dist/commands/sidecarTap.js.map +1 -0
- package/dist/commands/storeInspect.d.ts +13 -0
- package/dist/commands/storeInspect.js +156 -0
- package/dist/commands/storeInspect.js.map +1 -0
- package/dist/commands/webviewAttach.d.ts +2 -0
- package/dist/commands/webviewAttach.js +64 -0
- package/dist/commands/webviewAttach.js.map +1 -0
- package/dist/platform/oslog/darwin.d.ts +21 -0
- package/dist/platform/oslog/darwin.js +72 -0
- package/dist/platform/oslog/darwin.js.map +1 -0
- package/dist/platform/oslog/linux.d.ts +16 -0
- package/dist/platform/oslog/linux.js +47 -0
- package/dist/platform/oslog/linux.js.map +1 -0
- package/dist/platform/oslog/windows.d.ts +15 -0
- package/dist/platform/oslog/windows.js +16 -0
- package/dist/platform/oslog/windows.js.map +1 -0
- package/dist/schemas/bridge.d.ts +256 -0
- package/dist/schemas/bridge.js +57 -0
- package/dist/schemas/bridge.js.map +1 -1
- package/dist/schemas/commands.d.ts +126 -0
- package/dist/schemas/commands.js +28 -0
- package/dist/schemas/commands.js.map +1 -1
- package/dist/schemas/index.d.ts +3 -2
- package/dist/schemas/index.js +3 -2
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/interact.d.ts +118 -0
- package/dist/schemas/interact.js +31 -0
- package/dist/schemas/interact.js.map +1 -0
- package/dist/schemas/osLog.d.ts +34 -0
- package/dist/schemas/osLog.js +18 -0
- package/dist/schemas/osLog.js.map +1 -0
- package/dist/schemas/sidecar.d.ts +33 -0
- package/dist/schemas/sidecar.js +17 -0
- package/dist/schemas/sidecar.js.map +1 -0
- package/dist/schemas/tauriConfig.d.ts +825 -0
- package/dist/schemas/tauriConfig.js +102 -0
- package/dist/schemas/tauriConfig.js.map +1 -0
- package/dist/util/ndjson.d.ts +37 -0
- package/dist/util/ndjson.js +82 -0
- package/dist/util/ndjson.js.map +1 -0
- package/dist/util/tauriConfig.d.ts +63 -0
- package/dist/util/tauriConfig.js +235 -0
- package/dist/util/tauriConfig.js.map +1 -0
- package/examples/frontend-stub/index.html +1 -0
- package/examples/tauri-bridge/Cargo.toml +6 -0
- package/examples/tauri-bridge/build.rs +3 -0
- package/examples/tauri-bridge/icons/icon.png +0 -0
- package/examples/tauri-bridge/src/dev_bridge.rs +509 -10
- package/examples/tauri-bridge/tauri.conf.json +25 -0
- package/package.json +3 -1
- package/rust-bridge/README.md +7 -5
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tauri-agent-tools
|
|
3
|
-
description: CLI for inspecting Tauri desktop apps — DOM queries, screenshots,
|
|
4
|
-
version: 0.
|
|
5
|
-
tags: [tauri, desktop, debugging, screenshot, dom, inspection, diff, mutations, snapshot]
|
|
3
|
+
description: CLI for inspecting and interacting with Tauri desktop apps — DOM queries, screenshots, interaction (click/type/scroll), IPC monitoring, store inspection, structured assertions, plus bridge-free diagnostics (OS logs, app paths, sidecar NDJSON tap/replay, forensic bundles) and the `diagnose` super-command for one-shot triage
|
|
4
|
+
version: 0.7.0
|
|
5
|
+
tags: [tauri, desktop, debugging, screenshot, dom, inspection, diff, mutations, snapshot, interaction, click, type, scroll, invoke, probe, capture, check, store-inspect, forensics, os-logs, app-paths, sidecar, config-inspect, diagnose]
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# tauri-agent-tools
|
|
9
9
|
|
|
10
|
-
CLI tool for agent-driven inspection
|
|
10
|
+
CLI tool for agent-driven inspection and interaction with Tauri desktop applications. Inspection commands are read-only. Interaction commands (click, type, scroll, etc.) are debug-only — they only work when the app runs with the dev bridge enabled.
|
|
11
11
|
|
|
12
12
|
## Prerequisites
|
|
13
13
|
|
|
@@ -33,13 +33,40 @@ npm install -g tauri-agent-tools
|
|
|
33
33
|
Some commands require the Rust dev bridge running inside the Tauri app. Others work standalone.
|
|
34
34
|
|
|
35
35
|
**Bridge required** (needs running Tauri app with bridge):
|
|
36
|
-
`screenshot --selector`, `dom`, `eval`, `wait --selector`, `wait --eval`, `ipc-monitor`, `console-monitor`, `rust-logs`, `storage`, `page-state`, `mutations`, `snapshot`
|
|
36
|
+
`screenshot --selector`, `dom`, `eval`, `wait --selector`, `wait --eval`, `ipc-monitor`, `console-monitor`, `rust-logs`, `storage`, `page-state`, `mutations`, `snapshot`, `click`, `type`, `scroll`, `focus`, `navigate`, `select`, `invoke`, `capture`, `check`, `store-inspect`, `process-tree` *(v0.7+)*, `capabilities audit` *(v0.7+)*, `webview attach` *(v0.7+)*, `health` *(v0.7+)*
|
|
37
37
|
|
|
38
38
|
**Standalone** (no bridge needed):
|
|
39
|
-
`screenshot --title` (full window only), `wait --title`, `list-windows`, `info`, `diff`
|
|
39
|
+
`screenshot --title` (full window only), `wait --title`, `list-windows`, `info`, `diff`, `app-paths`, `config inspect`, `os-logs`, `sidecar tap`, `sidecar replay`, `forensics`
|
|
40
|
+
|
|
41
|
+
**Optional bridge:**
|
|
42
|
+
`probe` (works standalone to discover bridges, richer output with bridge)
|
|
40
43
|
|
|
41
44
|
The bridge auto-discovers via token files in `/tmp/tauri-dev-bridge-*.token`. No manual port/token configuration needed.
|
|
42
45
|
|
|
46
|
+
## Don't know where to start? `diagnose`
|
|
47
|
+
|
|
48
|
+
When something's wrong and you're not sure why, run:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
tauri-agent-tools diagnose --config ./src-tauri -o ./diagnose-out
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`diagnose` is a best-effort super-command. It always runs the bridge-free forensics half; if a dev bridge is reachable it also layers `/process`, `/capabilities`, `/devtools`, `/health` data. The master `summary.md` lists "Next steps" pointing at the right deeper command. See the [`tauri-debug-quickstart`](../tauri-debug-quickstart/SKILL.md) skill for a full symptom-to-command decision tree.
|
|
55
|
+
|
|
56
|
+
## Debugging decision tree (precision form)
|
|
57
|
+
|
|
58
|
+
When you know what you're looking at, jump straight to:
|
|
59
|
+
|
|
60
|
+
| Symptom | First command |
|
|
61
|
+
|---------|---------------|
|
|
62
|
+
| Don't know — give me everything | `tauri-agent-tools diagnose -o ./diag` |
|
|
63
|
+
| App is running and bridge is responding | Use the bridge-mediated commands listed above (`screenshot`, `dom`, `eval`, …) |
|
|
64
|
+
| Bridge isn't responding (release build, app crashed, pre-webview boot failure) | `tauri-agent-tools forensics -o ./forensics-out` |
|
|
65
|
+
| You only have the bundle id, no source tree | `tauri-agent-tools app-paths --identifier com.example.app --platform all --exists` |
|
|
66
|
+
| Need a structured snapshot of `tauri.conf.json` + capabilities | `tauri-agent-tools config inspect --json` |
|
|
67
|
+
| Suspicion: a sidecar process is emitting malformed/unexpected NDJSON | Run the sidecar under `tauri-agent-tools sidecar tap --schema <path> -- <cmd>` instead of under Tauri |
|
|
68
|
+
| OS-level error visible in Console.app/journalctl but not in app logs | `tauri-agent-tools os-logs --identifier com.example.app --level error --duration 30000` |
|
|
69
|
+
|
|
43
70
|
## Core Workflows
|
|
44
71
|
|
|
45
72
|
### Inspect DOM then screenshot an element
|
|
@@ -117,6 +144,60 @@ tauri-agent-tools rust-logs --source sidecar --duration 10000 --json
|
|
|
117
144
|
tauri-agent-tools rust-logs --source sidecar:ffmpeg --duration 5000 --json
|
|
118
145
|
```
|
|
119
146
|
|
|
147
|
+
### Bridge-extended diagnostics (process tree, capabilities, devtools, health — requires bridge v0.7.0+)
|
|
148
|
+
|
|
149
|
+
Four commands that talk to new endpoints on the dev bridge. Each calls `GET /version` first to feature-detect and emits a clear "requires bridge v0.7.0+ — re-copy dev_bridge.rs" error against older bridges.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Tauri PID + registered sidecars (uses /process)
|
|
153
|
+
tauri-agent-tools process-tree --json
|
|
154
|
+
|
|
155
|
+
# Devtron-style live capability audit (uses /capabilities)
|
|
156
|
+
tauri-agent-tools capabilities audit --json
|
|
157
|
+
# findings[] flag wildcard "*", over-broad shell:/fs:/http: scopes,
|
|
158
|
+
# capabilities that reference window labels not actually registered, etc.
|
|
159
|
+
|
|
160
|
+
# Inspector URL or platform hint (uses /devtools)
|
|
161
|
+
tauri-agent-tools webview attach # human-readable with hint
|
|
162
|
+
tauri-agent-tools webview attach --print-url # URL alone (empty if none)
|
|
163
|
+
tauri-agent-tools webview attach --open # launch in default browser
|
|
164
|
+
|
|
165
|
+
# "Is this app sick" check (uses /health). Exits non-zero on unhealthy.
|
|
166
|
+
tauri-agent-tools health --json
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Sidecars only appear in `process-tree` / `health` if integrators register them — either by passing `Some(®istry)` to `dev_bridge::spawn_sidecar_monitored`, or by calling `dev_bridge::register_sidecar` after their own spawn.
|
|
170
|
+
|
|
171
|
+
### Bridge-free diagnostics (post-mortem & sidecar workflows)
|
|
172
|
+
|
|
173
|
+
These six commands need no live bridge — useful for release builds, dead apps, and sidecar processes.
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Resolve the app's OS data/log/cache/config dirs from tauri.conf.json
|
|
177
|
+
tauri-agent-tools app-paths --config ./src-tauri --json
|
|
178
|
+
# All three platforms (handy for cross-OS forensics)
|
|
179
|
+
tauri-agent-tools app-paths --config ./src-tauri --platform all --exists
|
|
180
|
+
|
|
181
|
+
# Structured snapshot of the app config + capability/permission audit
|
|
182
|
+
tauri-agent-tools config inspect --config ./src-tauri --json
|
|
183
|
+
# warnings[] flags wildcard "*" perms, fs:allow-all, capabilities referencing
|
|
184
|
+
# plugins not declared in Cargo.toml, sidecars declared without tauri-plugin-shell.
|
|
185
|
+
|
|
186
|
+
# OS-level log tail, filtered to a Tauri bundle id (NDJSON one-per-line)
|
|
187
|
+
tauri-agent-tools os-logs --identifier com.example.app --duration 5000
|
|
188
|
+
tauri-agent-tools os-logs --level error --source main --duration 30000
|
|
189
|
+
|
|
190
|
+
# Run a sidecar under a tap to see its stdio + validate against a JSON Schema
|
|
191
|
+
tauri-agent-tools sidecar tap --schema ./schema.json --record /tmp/run.ndjson -- node my-sidecar.js
|
|
192
|
+
# Replay deterministically
|
|
193
|
+
tauri-agent-tools sidecar replay /tmp/run.ndjson --to-exec node my-sidecar.js --rate 100
|
|
194
|
+
|
|
195
|
+
# One-shot forensic bundle for post-crash analysis. Works on a DEAD app.
|
|
196
|
+
tauri-agent-tools forensics --config ./src-tauri -o ./forensics-out
|
|
197
|
+
# → ./forensics-out/{summary.md,summary.json,project.json,app-log-tail.txt,live-os-log.ndjson}
|
|
198
|
+
# summary.md includes detected panic markers + suggested next commands.
|
|
199
|
+
```
|
|
200
|
+
|
|
120
201
|
### Watch DOM mutations
|
|
121
202
|
|
|
122
203
|
```bash
|
|
@@ -134,13 +215,84 @@ tauri-agent-tools mutations ".sidebar" --attributes --duration 5000
|
|
|
134
215
|
tauri-agent-tools dom --text "Settings" --first --json
|
|
135
216
|
```
|
|
136
217
|
|
|
218
|
+
### Interact with the app
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
# Click a button
|
|
222
|
+
tauri-agent-tools click ".submit-btn" --json
|
|
223
|
+
|
|
224
|
+
# Type into an input
|
|
225
|
+
tauri-agent-tools type "#search" "hello world" --json
|
|
226
|
+
|
|
227
|
+
# Clear and retype
|
|
228
|
+
tauri-agent-tools type "#email" "new@email.com" --clear --json
|
|
229
|
+
|
|
230
|
+
# Scroll to bottom
|
|
231
|
+
tauri-agent-tools scroll --to-bottom --json
|
|
232
|
+
|
|
233
|
+
# Scroll element into view
|
|
234
|
+
tauri-agent-tools scroll --selector "#item-42" --into-view
|
|
235
|
+
|
|
236
|
+
# Focus an element
|
|
237
|
+
tauri-agent-tools focus "#username" --json
|
|
238
|
+
|
|
239
|
+
# Navigate to a route
|
|
240
|
+
tauri-agent-tools navigate "/settings" --json
|
|
241
|
+
|
|
242
|
+
# Select a dropdown value
|
|
243
|
+
tauri-agent-tools select "#country" "US" --json
|
|
244
|
+
|
|
245
|
+
# Toggle a checkbox
|
|
246
|
+
tauri-agent-tools select "input[type=checkbox]" --toggle --json
|
|
247
|
+
|
|
248
|
+
# Invoke a Tauri IPC command
|
|
249
|
+
tauri-agent-tools invoke get_release_context --json
|
|
250
|
+
tauri-agent-tools invoke save_item '{"id": 42}' --json
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Probe, capture, and check (workflow commands)
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# Discover targets and check bridge health
|
|
257
|
+
tauri-agent-tools probe --json
|
|
258
|
+
|
|
259
|
+
# Capture a full debug evidence bundle
|
|
260
|
+
tauri-agent-tools capture -o /tmp/debug --json
|
|
261
|
+
# Produces: manifest.json, screenshot.png, dom.json, page-state.json, storage.json, console-errors.json, rust-logs.json
|
|
262
|
+
|
|
263
|
+
# Run structured assertions
|
|
264
|
+
tauri-agent-tools check --selector ".app-ready" --no-errors --json
|
|
265
|
+
tauri-agent-tools check --eval "document.querySelectorAll('.block').length > 0" --json
|
|
266
|
+
tauri-agent-tools check --text "Workflow loaded" --json
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Inspect reactive stores
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
# Auto-detect framework and list all stores
|
|
273
|
+
tauri-agent-tools store-inspect --json
|
|
274
|
+
|
|
275
|
+
# Inspect a specific store
|
|
276
|
+
tauri-agent-tools store-inspect --store executionStore --json
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Target specific apps and windows
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
# Target a specific app by PID
|
|
283
|
+
tauri-agent-tools page-state --pid 12345 --json
|
|
284
|
+
|
|
285
|
+
# Target a specific window in a multi-window app
|
|
286
|
+
tauri-agent-tools eval "document.title" --window-label overlay --json
|
|
287
|
+
```
|
|
288
|
+
|
|
137
289
|
## Command Reference
|
|
138
290
|
|
|
139
291
|
| Command | Key Flags | Bridge? | Description |
|
|
140
292
|
|---------|-----------|---------|-------------|
|
|
141
293
|
| `screenshot` | `--selector <css>`, `--title <regex>`, `-o <path>`, `--max-width <n>` | selector: yes, title: no | Capture window or DOM element screenshot |
|
|
142
294
|
| `dom` | `[selector]`, `--depth <n>`, `--styles`, `--text <pattern>`, `--mode accessibility`, `--json` | yes | Query DOM structure or find elements by text |
|
|
143
|
-
| `eval` | `<js-expression>` | yes | Evaluate JavaScript in webview |
|
|
295
|
+
| `eval` | `<js-expression>`, `--file <path>` | yes | Evaluate JavaScript in webview |
|
|
144
296
|
| `wait` | `--selector <css>`, `--eval <js>`, `--title <regex>`, `--timeout <ms>` | selector/eval: yes | Wait for a condition |
|
|
145
297
|
| `list-windows` | `--tauri`, `--json` | no | List visible windows |
|
|
146
298
|
| `info` | `--title <regex>`, `--json` | no | Window geometry and display info |
|
|
@@ -149,14 +301,44 @@ tauri-agent-tools dom --text "Settings" --first --json
|
|
|
149
301
|
| `rust-logs` | `--level <lvl>`, `--target <regex>`, `--source <src>`, `--duration <ms>`, `--json` | yes | Monitor Rust logs and sidecar output |
|
|
150
302
|
| `storage` | `--type <local\|session\|cookies\|all>`, `--key <name>`, `--json` | yes | Inspect browser storage |
|
|
151
303
|
| `page-state` | `--json` | yes | URL, title, viewport, scroll, document size |
|
|
152
|
-
| `diff` | `<image1> <image2>`, `-o <path>`, `--threshold <pct>`, `--json` | no | Compare two screenshots
|
|
153
|
-
| `mutations` | `<selector>`, `--attributes`, `--duration <ms>`, `--json` | yes | Watch DOM mutations
|
|
154
|
-
| `snapshot` | `-o <prefix>`, `-s <css>`, `--dom-depth <n>`, `--eval <js>`, `--json` | yes |
|
|
304
|
+
| `diff` | `<image1> <image2>`, `-o <path>`, `--threshold <pct>`, `--json` | no | Compare two screenshots |
|
|
305
|
+
| `mutations` | `<selector>`, `--attributes`, `--duration <ms>`, `--json` | yes | Watch DOM mutations |
|
|
306
|
+
| `snapshot` | `-o <prefix>`, `-s <css>`, `--dom-depth <n>`, `--eval <js>`, `--json` | yes | Screenshot + DOM + page state + storage |
|
|
307
|
+
| `click` | `<selector>`, `--double`, `--right`, `--wait <ms>`, `--json` | yes | Click a DOM element |
|
|
308
|
+
| `type` | `<selector> <text>`, `--clear`, `--json` | yes | Type text into an input |
|
|
309
|
+
| `scroll` | `--selector <css>`, `--by <px>`, `--to-top`, `--to-bottom`, `--into-view`, `--json` | yes | Scroll window or element |
|
|
310
|
+
| `focus` | `<selector>`, `--json` | yes | Focus a DOM element |
|
|
311
|
+
| `navigate` | `<target>`, `--json` | yes | Navigate within the app |
|
|
312
|
+
| `select` | `<selector> [value]`, `--toggle`, `--json` | yes | Select dropdown or toggle checkbox |
|
|
313
|
+
| `invoke` | `<command> [args-json]`, `--json` | yes | Invoke a Tauri IPC command |
|
|
314
|
+
| `probe` | `--pid <n>`, `--json` | optional | Discover targets and bridge health |
|
|
315
|
+
| `capture` | `-o <dir>`, `-s <css>`, `--logs-duration <ms>`, `--json` | yes | Full debug evidence bundle |
|
|
316
|
+
| `check` | `--selector`, `--text`, `--eval`, `--no-errors`, `--json` | yes | Structured assertions (exit 0/1) |
|
|
317
|
+
| `store-inspect` | `--framework`, `--store <name>`, `--depth <n>`, `--json` | yes | Inspect reactive store state |
|
|
318
|
+
| `app-paths` | `--config <path>`, `--identifier <id>`, `--platform <os>`, `--exists`, `--json` | no | Resolve Tauri 2 app's OS data/log/cache/config dirs |
|
|
319
|
+
| `config inspect` | `--config <path>`, `--capabilities-dir <path>`, `--cargo-toml <path>`, `--json` | no | Structured `tauri.conf.json` snapshot + capability audit |
|
|
320
|
+
| `os-logs` | `--identifier <id>`, `--level <lvl>`, `--source <src>`, `--since <dur>`, `--duration <ms>`, `--json` | no | Tail host OS log stream filtered to a Tauri bundle id |
|
|
321
|
+
| `sidecar tap` | `-- <cmd...>`, `--schema <path>`, `--record <path>`, `--raw`, `--json` | no | Wrap-and-run a sidecar, frame NDJSON, validate envelopes |
|
|
322
|
+
| `sidecar replay` | `<file>`, `--to-exec <cmd>`, `--rate <lps>`, `--loop` | no | Replay a recorded NDJSON sidecar stream |
|
|
323
|
+
| `forensics` | `--config <path>`, `--identifier <id>`, `-o <dir>`, `--since <dur>`, `--json` | no | One-shot forensic bundle (works on dead apps) |
|
|
324
|
+
| `process-tree` | `--json` | yes (v0.7+) | Tauri PID + registered sidecars with alive/DEAD status |
|
|
325
|
+
| `capabilities audit` | `--json` | yes (v0.7+) | Live Devtron-style audit of declared Tauri capabilities |
|
|
326
|
+
| `webview attach` | `--print-url`, `--open`, `--json` | yes (v0.7+) | Print webview inspector URL or platform hint |
|
|
327
|
+
| `health` | `--json` | yes (v0.7+) | Uptime + webview/sidecar liveness (exit non-zero if unhealthy) |
|
|
328
|
+
| `diagnose` | `--config <path>`, `-o <dir>`, `--since <dur>`, `--no-bridge`, `--json` | optional | Best-effort super-bundle (forensics + live bridge enrichment) |
|
|
329
|
+
|
|
330
|
+
## Targeting Flags
|
|
331
|
+
|
|
332
|
+
All bridge-dependent commands support these flags:
|
|
333
|
+
- `--port <n>` / `--token <s>` — explicit bridge config (skips auto-discovery)
|
|
334
|
+
- `--pid <n>` — target a specific app by PID
|
|
335
|
+
- `--window-label <label>` — target a specific webview window (default: main)
|
|
155
336
|
|
|
156
337
|
## Important Notes
|
|
157
338
|
|
|
158
|
-
- **
|
|
339
|
+
- **Inspection commands are read-only.** They don't modify app state.
|
|
340
|
+
- **Interaction commands are debug-only.** They only work with the dev bridge (debug builds).
|
|
159
341
|
- **Use `--json`** for structured, parseable output in automation.
|
|
160
|
-
- **Always use `--duration`** with `ipc-monitor`, `console-monitor`, `rust-logs`, and `mutations
|
|
342
|
+
- **Always use `--duration`** with `ipc-monitor`, `console-monitor`, `rust-logs`, and `mutations`.
|
|
161
343
|
- **`screenshot --selector`** requires both the bridge AND platform screenshot tools (`imagemagick`).
|
|
162
|
-
- **
|
|
344
|
+
- **Multi-app targeting:** Use `--pid` to target a specific app. Use `probe` to discover all running bridges.
|
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tauri-bridge-setup
|
|
3
3
|
description: How to add the tauri-agent-tools Rust dev bridge to a Tauri application
|
|
4
|
-
version: 0.
|
|
5
|
-
tags: [tauri, rust, bridge, setup, integration]
|
|
4
|
+
version: 0.7.0
|
|
5
|
+
tags: [tauri, rust, bridge, setup, integration, multi-window, process-tree, capabilities, devtools, health]
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Tauri Dev Bridge Setup
|
|
9
9
|
|
|
10
|
-
Add the dev bridge to a Tauri app so `tauri-agent-tools` can inspect DOM, evaluate JS, monitor IPC,
|
|
10
|
+
Add the dev bridge to a Tauri app so `tauri-agent-tools` can inspect DOM, evaluate JS, monitor IPC, take element screenshots, and interact with the UI. Bridge v0.7 also exposes process tree, capability audit, devtools URL, and health endpoints.
|
|
11
11
|
|
|
12
12
|
The bridge runs **only in debug builds** and is stripped from release builds automatically.
|
|
13
13
|
|
|
14
|
+
## Re-copying for v0.7
|
|
15
|
+
|
|
16
|
+
> **Upgrading from v0.6:** The bridge surface grew with four new endpoints (`/process`, `/capabilities`, `/devtools`, `/health`) and `start_bridge` now returns a third tuple element (the sidecar registry). **Re-copy `dev_bridge.rs` from the latest `examples/tauri-bridge/src/dev_bridge.rs`** and adjust your `main.rs` to destructure the new return shape (see Step 3 below). The CLI's new commands (`process-tree`, `capabilities audit`, `webview attach`, `health`) feature-detect via `GET /version` and emit a clear "requires v0.7.0+" error when the bridge is older — so partial upgrades fail loudly rather than silently.
|
|
17
|
+
|
|
18
|
+
## Bridge Endpoints
|
|
19
|
+
|
|
20
|
+
The bridge exposes eight HTTP endpoints on a random localhost port:
|
|
21
|
+
|
|
22
|
+
| Endpoint | Method | Auth | Purpose |
|
|
23
|
+
|----------|--------|------|---------|
|
|
24
|
+
| `/eval` | POST | token | Evaluate JS in a webview (supports `window` param for multi-window) |
|
|
25
|
+
| `/logs` | POST | token | Drain Rust tracing logs and sidecar output |
|
|
26
|
+
| `/describe` | POST | token | Report PID, window labels, and capabilities |
|
|
27
|
+
| `/version` | GET | none | Bridge version and available endpoints (used for feature detection) |
|
|
28
|
+
| `/process` | POST | token | Tauri PID + registered sidecars (powers `process-tree`) — **v0.7+** |
|
|
29
|
+
| `/capabilities` | POST | token | Declared Tauri capability set + live window labels (powers `capabilities audit`) — **v0.7+** |
|
|
30
|
+
| `/devtools` | POST | token | Webview inspector URL or platform hint (powers `webview attach`) — **v0.7+** |
|
|
31
|
+
| `/health` | POST | token | Uptime + webview readiness + sidecar liveness (powers `health`) — **v0.7+** |
|
|
32
|
+
|
|
14
33
|
## Step 1 — Add Cargo dependencies
|
|
15
34
|
|
|
16
35
|
Add to your Tauri app's `src-tauri/Cargo.toml` under `[dependencies]`:
|
|
@@ -24,8 +43,13 @@ rand = "0.8"
|
|
|
24
43
|
uuid = { version = "1", features = ["v4"] }
|
|
25
44
|
tracing = "0.1"
|
|
26
45
|
tracing-subscriber = { version = "0.3", features = ["registry"] }
|
|
46
|
+
|
|
47
|
+
[target.'cfg(unix)'.dependencies]
|
|
48
|
+
libc = "0.2"
|
|
27
49
|
```
|
|
28
50
|
|
|
51
|
+
(`libc` is used for the cheap `kill(pid, 0)` aliveness probe powering `/process` and `/health` sidecar reporting. Windows is supported but skips the liveness check in v0.7.)
|
|
52
|
+
|
|
29
53
|
## Step 2 — Copy the bridge module
|
|
30
54
|
|
|
31
55
|
Copy `dev_bridge.rs` from the tauri-agent-tools package into your project:
|
|
@@ -63,6 +87,9 @@ fn main() {
|
|
|
63
87
|
builder
|
|
64
88
|
.setup(|app| {
|
|
65
89
|
if cfg!(debug_assertions) {
|
|
90
|
+
// start_bridge returns (port, LogBuffer, SidecarRegistry).
|
|
91
|
+
// Hold onto the registry if you plan to spawn sidecars; otherwise
|
|
92
|
+
// the bound `let _` keeps it alive for the app's lifetime.
|
|
66
93
|
if let Err(e) = dev_bridge::start_bridge(app.handle()).map(|_| ()) {
|
|
67
94
|
eprintln!("Warning: Failed to start dev bridge: {e}");
|
|
68
95
|
}
|
|
@@ -91,34 +118,71 @@ If you already have a `.setup()` call, add the `if cfg!(debug_assertions) { ...
|
|
|
91
118
|
Build and run the Tauri app in dev mode, then:
|
|
92
119
|
|
|
93
120
|
```bash
|
|
94
|
-
#
|
|
95
|
-
tauri-agent-tools
|
|
121
|
+
# Discover the bridge and check health
|
|
122
|
+
tauri-agent-tools probe --json
|
|
96
123
|
|
|
97
124
|
# Should return DOM tree
|
|
98
125
|
tauri-agent-tools dom --depth 2
|
|
99
126
|
```
|
|
100
127
|
|
|
101
|
-
Both commands succeeding confirms the bridge is working.
|
|
128
|
+
Both commands succeeding confirms the bridge is working. The `probe` output shows bridge version, available endpoints, window labels, and PID.
|
|
129
|
+
|
|
130
|
+
## Multi-Window Apps
|
|
131
|
+
|
|
132
|
+
The bridge supports evaluating JS in any named webview window. The `/eval` endpoint accepts an optional `window` field (defaults to `"main"`). The `/describe` endpoint reports all registered window labels.
|
|
133
|
+
|
|
134
|
+
From the CLI, use `--window-label` to target a specific window:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Eval in a secondary window
|
|
138
|
+
tauri-agent-tools eval "document.title" --window-label overlay --json
|
|
139
|
+
|
|
140
|
+
# Screenshot a specific window's element
|
|
141
|
+
tauri-agent-tools screenshot --selector ".content" --window-label settings -o /tmp/settings.png
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Use `probe` to discover available windows:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
tauri-agent-tools probe --json
|
|
148
|
+
# → { "bridges": [{ "windows": ["main", "overlay", "settings"], ... }] }
|
|
149
|
+
```
|
|
102
150
|
|
|
103
|
-
## Optional: Sidecar Log Capture
|
|
151
|
+
## Optional: Sidecar Log Capture + Process Visibility
|
|
104
152
|
|
|
105
|
-
To capture stdout/stderr from sidecar processes (external binaries)
|
|
153
|
+
To capture stdout/stderr from sidecar processes (external binaries) AND have them show up in `process-tree`/`health`, use `spawn_sidecar_monitored()` and pass the registry returned by `start_bridge`:
|
|
106
154
|
|
|
107
155
|
```rust
|
|
108
156
|
if cfg!(debug_assertions) {
|
|
109
|
-
let (_port, log_buffer) = dev_bridge::start_bridge(app.handle())?;
|
|
157
|
+
let (_port, log_buffer, sidecar_registry) = dev_bridge::start_bridge(app.handle())?;
|
|
110
158
|
|
|
111
|
-
// Spawn a sidecar with monitored output
|
|
159
|
+
// Spawn a sidecar with monitored output AND registry tracking
|
|
112
160
|
dev_bridge::spawn_sidecar_monitored(
|
|
113
|
-
"ffmpeg",
|
|
114
|
-
"ffmpeg",
|
|
115
|
-
&["-i", "input.mp4", "-f", "null", "-"],
|
|
161
|
+
"ffmpeg", // name (source: "sidecar:ffmpeg")
|
|
162
|
+
"ffmpeg", // command
|
|
163
|
+
&["-i", "input.mp4", "-f", "null", "-"], // args
|
|
116
164
|
&log_buffer,
|
|
165
|
+
Some(&sidecar_registry), // register for /process + /health
|
|
117
166
|
)?;
|
|
118
167
|
}
|
|
119
168
|
```
|
|
120
169
|
|
|
121
|
-
|
|
170
|
+
Pass `None` for the registry argument to opt out of process tracking (useful for ephemeral one-shot helpers).
|
|
171
|
+
|
|
172
|
+
If you spawn children with your own mechanism, register them after the fact so they appear in `process-tree`:
|
|
173
|
+
|
|
174
|
+
```rust
|
|
175
|
+
let child = my_own_spawn(...)?;
|
|
176
|
+
dev_bridge::register_sidecar(
|
|
177
|
+
&sidecar_registry,
|
|
178
|
+
"my-helper",
|
|
179
|
+
child.id(),
|
|
180
|
+
Some("/path/to/binary".to_string()),
|
|
181
|
+
vec!["--mode=watch".to_string()],
|
|
182
|
+
);
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Then monitor with: `tauri-agent-tools rust-logs --source sidecar --duration 10000`, view the tree with `tauri-agent-tools process-tree`, and check liveness with `tauri-agent-tools health`.
|
|
122
186
|
|
|
123
187
|
## Troubleshooting
|
|
124
188
|
|
|
@@ -134,3 +198,7 @@ Then monitor with: `tauri-agent-tools rust-logs --source sidecar --duration 1000
|
|
|
134
198
|
**Port conflicts:**
|
|
135
199
|
- The bridge picks a random port. If it fails, check the app's stderr for "Failed to start dev bridge".
|
|
136
200
|
- Ensure no firewall blocks localhost connections.
|
|
201
|
+
|
|
202
|
+
**Multi-window eval fails:**
|
|
203
|
+
- Verify the window label matches exactly (case-sensitive). Use `probe --json` to list available labels.
|
|
204
|
+
- The default label is `"main"` — omit `--window-label` to target it.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tauri-debug-quickstart
|
|
3
|
+
description: First-30-seconds triage for a broken Tauri desktop app. Pick the right command for the symptom you're seeing, with one-line escalations to deeper skills.
|
|
4
|
+
version: 0.7.0
|
|
5
|
+
tags: [tauri, debugging, triage, quickstart, decision-tree, forensics, diagnose]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Tauri Debug Quickstart
|
|
9
|
+
|
|
10
|
+
When something is wrong with a Tauri app, the first 30 seconds matter — they decide whether you spend the next hour reading the right logs or the wrong ones. This skill points you at the right `tauri-agent-tools` command for the symptom you're seeing.
|
|
11
|
+
|
|
12
|
+
## The single-command answer
|
|
13
|
+
|
|
14
|
+
If you don't know where to start, run this first:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
tauri-agent-tools diagnose --config ./src-tauri -o ./diagnose-out
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`diagnose` is a best-effort super-command that:
|
|
21
|
+
|
|
22
|
+
1. Resolves the app's config + OS data/log paths
|
|
23
|
+
2. Runs a forensics bundle (works even on dead apps — tails app logs for panics, pulls macOS DiagnosticReports, lists app-data files)
|
|
24
|
+
3. If a live dev bridge is reachable, layers `/process`, `/capabilities`, `/devtools`, `/health` data on top
|
|
25
|
+
4. Writes a master `summary.md` with detected anomalies and suggested next steps
|
|
26
|
+
|
|
27
|
+
Then open `./diagnose-out/summary.md` and follow the "Next steps" section.
|
|
28
|
+
|
|
29
|
+
## Symptom → command (when you need precision)
|
|
30
|
+
|
|
31
|
+
Pick the row that matches what's broken. Each command works without the bridge unless noted.
|
|
32
|
+
|
|
33
|
+
| Symptom | First command | Why |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| Don't know what's wrong | `tauri-agent-tools diagnose -o ./diag` | Everything-bundle; graceful on dead apps |
|
|
36
|
+
| App crashed at startup | `tauri-agent-tools forensics --config ./src-tauri -o ./forensics` | Reads app log + DiagnosticReports without needing a live process |
|
|
37
|
+
| App is running but bridge isn't responding | `tauri-agent-tools probe` | Detects whether the bridge process is up and shows token-file state |
|
|
38
|
+
| App is running, bridge is up, but webview looks wrong | `tauri-agent-tools health --json` *(needs bridge v0.7+)* | Returns webview_ready + sidecar liveness in one call |
|
|
39
|
+
| A sidecar process is the suspect | `tauri-agent-tools sidecar tap --schema ./schema.json -- <cmd>` | Wrap-and-run the sidecar standalone; frame NDJSON; validate envelopes |
|
|
40
|
+
| Need to know exactly which files the app touches | `tauri-agent-tools app-paths --config ./src-tauri --exists` | Resolves Tauri 2's per-platform `app_data_dir`/`app_log_dir`/etc. + checks existence |
|
|
41
|
+
| Need to audit Tauri capabilities for over-broad permissions | `tauri-agent-tools config inspect --config ./src-tauri` (static) **or** `tauri-agent-tools capabilities audit` (live, needs bridge v0.7+) | Flags `*`, `fs:allow-all`, `shell:allow-spawn`, etc. |
|
|
42
|
+
| OS-level error visible in Console.app or journalctl | `tauri-agent-tools os-logs --identifier com.example.app --level error --duration 30000` | Filters platform log stream to the Tauri bundle id |
|
|
43
|
+
| Inspector / webview attach | `tauri-agent-tools webview attach` *(needs bridge v0.7+)* | Returns inspector URL or platform-specific hint |
|
|
44
|
+
| What sidecars did this app spawn? | `tauri-agent-tools process-tree --json` *(needs bridge v0.7+)* | Tauri PID + registered sidecars with alive/dead per-PID |
|
|
45
|
+
|
|
46
|
+
## Decision tree
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
The app is...
|
|
50
|
+
│
|
|
51
|
+
├── crashed / not running ────────► forensics
|
|
52
|
+
│ └─ no source on hand? ────────► forensics --identifier com.foo.bar
|
|
53
|
+
│
|
|
54
|
+
├── running but bridge down ──────► probe → fix bridge → retry
|
|
55
|
+
│
|
|
56
|
+
└── running, bridge up
|
|
57
|
+
├── webview misbehaving ──────► health → snapshot → capabilities audit
|
|
58
|
+
├── sidecar suspected ────────► sidecar tap (run sidecar under it standalone)
|
|
59
|
+
├── IPC slow / wrong ─────────► ipc-monitor → check
|
|
60
|
+
└── DOM / UI inspection ──────► dom → screenshot → eval
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
When in doubt, escalate to `diagnose` — its `summary.md` will tell you which deeper command to use.
|
|
64
|
+
|
|
65
|
+
## Output conventions
|
|
66
|
+
|
|
67
|
+
- All commands accept `--json` for machine-readable output.
|
|
68
|
+
- Bundle commands (`forensics`, `diagnose`) write a `summary.md` agents can open directly and a `summary.json` agents can parse.
|
|
69
|
+
- Streaming commands (`os-logs`, `rust-logs`, `sidecar tap`) emit one NDJSON envelope per line on stdout.
|
|
70
|
+
- Bridge v0.7+ commands feature-detect via `GET /version` and emit a clear "re-copy dev_bridge.rs" error against older bridges.
|
|
71
|
+
|
|
72
|
+
## When this skill is wrong
|
|
73
|
+
|
|
74
|
+
This guidance assumes the agent is inspecting a Tauri 2 desktop app on macOS or Linux. Caveats:
|
|
75
|
+
|
|
76
|
+
- **Tauri 1 apps** — the `dirs`/`directories-next` path semantics that `app-paths` encodes match Tauri 2's `PathResolver`. Tauri 1's paths differ; some derived paths will be slightly off.
|
|
77
|
+
- **Windows** — `os-logs` is stubbed in v0.7 (the Windows event log adapter is planned). `forensics` and `diagnose` still produce useful bundles on Windows; they just skip the live OS-log tail.
|
|
78
|
+
- **The dev bridge requires `cfg!(debug_assertions)`** — release builds strip it, so bridge-dependent commands won't work against signed/notarized release artifacts. Use bridge-free commands (`forensics`, `app-paths`, `os-logs`, `config inspect`, `sidecar tap`) for those.
|
|
79
|
+
|
|
80
|
+
For deeper how-tos see the [`tauri-agent-tools`](../tauri-agent-tools/SKILL.md) skill. For bridge integration setup (Rust side), see [`tauri-bridge-setup`](../tauri-bridge-setup/SKILL.md).
|
package/AGENTS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# tauri-agent-tools
|
|
2
2
|
|
|
3
|
-
CLI tool for agent-driven inspection
|
|
3
|
+
CLI tool for agent-driven inspection and interaction with Tauri desktop applications. **Not an MCP server** — invoke commands directly via shell.
|
|
4
4
|
|
|
5
5
|
## Agent Skills
|
|
6
6
|
|
|
@@ -8,23 +8,25 @@ This package includes two [Agent Skills](https://agentskills.io):
|
|
|
8
8
|
|
|
9
9
|
| Skill | Path | Purpose |
|
|
10
10
|
|-------|------|---------|
|
|
11
|
-
| `tauri-agent-tools` | `.agents/skills/tauri-agent-tools/SKILL.md` | Using
|
|
11
|
+
| `tauri-agent-tools` | `.agents/skills/tauri-agent-tools/SKILL.md` | Using all 25 CLI commands to inspect and interact with Tauri apps |
|
|
12
12
|
| `tauri-bridge-setup` | `.agents/skills/tauri-bridge-setup/SKILL.md` | Adding the Rust dev bridge to a Tauri project |
|
|
13
13
|
|
|
14
14
|
## Quick Reference
|
|
15
15
|
|
|
16
16
|
**Install:** `npm install -g tauri-agent-tools`
|
|
17
17
|
|
|
18
|
-
**
|
|
18
|
+
**Inspection commands are read-only.** Interaction commands (click, type, scroll, etc.) are debug-only — they only work with the dev bridge.
|
|
19
19
|
|
|
20
20
|
**Standalone commands** (no bridge needed):
|
|
21
|
-
`list-windows`, `info`, `screenshot --title`, `wait --title`
|
|
21
|
+
`list-windows`, `info`, `screenshot --title`, `wait --title`, `diff`
|
|
22
22
|
|
|
23
23
|
**Bridge-required commands** (Tauri app must have dev bridge running):
|
|
24
|
-
`dom`, `eval`, `screenshot --selector`, `wait --selector/--eval`, `ipc-monitor`, `console-monitor`, `rust-logs`, `storage`, `page-state`, `mutations`, `snapshot`
|
|
24
|
+
`dom`, `eval`, `screenshot --selector`, `wait --selector/--eval`, `ipc-monitor`, `console-monitor`, `rust-logs`, `storage`, `page-state`, `mutations`, `snapshot`, `click`, `type`, `scroll`, `focus`, `navigate`, `select`, `invoke`, `capture`, `check`, `store-inspect`
|
|
25
25
|
|
|
26
|
-
**
|
|
27
|
-
`
|
|
26
|
+
**Optional bridge:**
|
|
27
|
+
`probe` (works standalone to discover bridges, richer output with bridge)
|
|
28
|
+
|
|
29
|
+
**Multi-app targeting:** Use `--pid <n>` to target a specific app. Use `--window-label <label>` for multi-window apps.
|
|
28
30
|
|
|
29
31
|
**Bridge auto-discovery:** The CLI finds the running bridge via token files in `/tmp/tauri-dev-bridge-*.token`. No manual configuration needed.
|
|
30
32
|
|