tauri-plugin-debug-tools 0.1.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.md +346 -0
- package/LICENSE +21 -0
- package/README.md +303 -0
- package/dist-js/consoleLogger.d.ts +92 -0
- package/dist-js/consoleLogger.d.ts.map +1 -0
- package/dist-js/consoleLogger.js +317 -0
- package/dist-js/debugBridge.d.ts +50 -0
- package/dist-js/debugBridge.d.ts.map +1 -0
- package/dist-js/debugBridge.js +66 -0
- package/dist-js/index.d.ts +3 -0
- package/dist-js/index.d.ts.map +1 -0
- package/dist-js/index.js +2 -0
- package/dist-js/logAdapter.d.ts +36 -0
- package/dist-js/logAdapter.d.ts.map +1 -0
- package/dist-js/logAdapter.js +42 -0
- package/dist-js/screenshotHelper.d.ts +60 -0
- package/dist-js/screenshotHelper.d.ts.map +1 -0
- package/dist-js/screenshotHelper.js +100 -0
- package/examples/.vscode/extensions.json +3 -0
- package/examples/README.md +51 -0
- package/examples/bun.lock +265 -0
- package/examples/package.json +19 -0
- package/examples/src/assets/javascript.svg +1 -0
- package/examples/src/assets/tauri.svg +6 -0
- package/examples/src/index.html +56 -0
- package/examples/src/main.js +91 -0
- package/examples/src/styles.css +112 -0
- package/examples/src-tauri/Cargo.lock +5674 -0
- package/examples/src-tauri/Cargo.toml +25 -0
- package/examples/src-tauri/build.rs +3 -0
- package/examples/src-tauri/capabilities/default.json +7 -0
- package/examples/src-tauri/icons/128x128.png +0 -0
- package/examples/src-tauri/icons/128x128@2x.png +0 -0
- package/examples/src-tauri/icons/32x32.png +0 -0
- package/examples/src-tauri/icons/Square107x107Logo.png +0 -0
- package/examples/src-tauri/icons/Square142x142Logo.png +0 -0
- package/examples/src-tauri/icons/Square150x150Logo.png +0 -0
- package/examples/src-tauri/icons/Square284x284Logo.png +0 -0
- package/examples/src-tauri/icons/Square30x30Logo.png +0 -0
- package/examples/src-tauri/icons/Square310x310Logo.png +0 -0
- package/examples/src-tauri/icons/Square44x44Logo.png +0 -0
- package/examples/src-tauri/icons/Square71x71Logo.png +0 -0
- package/examples/src-tauri/icons/Square89x89Logo.png +0 -0
- package/examples/src-tauri/icons/StoreLogo.png +0 -0
- package/examples/src-tauri/icons/icon.icns +0 -0
- package/examples/src-tauri/icons/icon.ico +0 -0
- package/examples/src-tauri/icons/icon.png +0 -0
- package/examples/src-tauri/src/lib.rs +15 -0
- package/examples/src-tauri/src/main.rs +6 -0
- package/examples/src-tauri/tauri.conf.json +33 -0
- package/examples/tests/e2e.mac.test.ts +203 -0
- package/examples/tests/e2e.test.ts +131 -0
- package/examples/vitest.config.ts +10 -0
- package/guest-js/consoleLogger.ts +369 -0
- package/guest-js/debugBridge.ts +93 -0
- package/guest-js/index.ts +2 -0
- package/guest-js/logAdapter.ts +62 -0
- package/guest-js/screenshotHelper.ts +122 -0
- package/package.json +84 -0
- package/permissions/autogenerated/commands/append_debug_logs.toml +13 -0
- package/permissions/autogenerated/commands/capture_webview_state.toml +13 -0
- package/permissions/autogenerated/commands/get_console_logs.toml +13 -0
- package/permissions/autogenerated/commands/reset_debug_logs.toml +13 -0
- package/permissions/autogenerated/commands/send_debug_command.toml +13 -0
- package/permissions/autogenerated/commands/write_debug_snapshot.toml +13 -0
- package/permissions/autogenerated/reference.md +201 -0
- package/permissions/debug-with-logging.toml +26 -0
- package/permissions/default.toml +26 -0
- package/permissions/schemas/schema.json +384 -0
- package/skills/debug-tauri/SKILL.md +114 -0
- package/skills/debug-tauri/references/IPC_COMMANDS.md +196 -0
- package/skills/debug-tauri/references/LOGGING.md +195 -0
- package/skills/debug-tauri/references/MIGRATION.md +487 -0
- package/skills/debug-tauri/references/REFERENCE.md +206 -0
- package/skills/debug-tauri/references/REPORT_TEMPLATE.md +166 -0
- package/skills/debug-tauri/references/SCREENSHOTS.md +193 -0
- package/skills/debug-tauri/references/TROUBLESHOOTING.md +144 -0
- package/skills/debug-tauri/scripts/analyze_logs.sh +127 -0
- package/skills/debug-tauri/scripts/capture.sh +89 -0
- package/skills/debug-tauri/scripts/validate_setup.sh +181 -0
- package/src/commands.rs +147 -0
- package/src/lib.rs +41 -0
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "PermissionFile",
|
|
4
|
+
"description": "Permission file that can define a default permission, a set of permissions or a list of inlined permissions.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"default": {
|
|
8
|
+
"description": "The default permission set for the plugin",
|
|
9
|
+
"anyOf": [
|
|
10
|
+
{
|
|
11
|
+
"$ref": "#/definitions/DefaultPermission"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"type": "null"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"set": {
|
|
19
|
+
"description": "A list of permissions sets defined",
|
|
20
|
+
"type": "array",
|
|
21
|
+
"items": {
|
|
22
|
+
"$ref": "#/definitions/PermissionSet"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"permission": {
|
|
26
|
+
"description": "A list of inlined permissions",
|
|
27
|
+
"default": [],
|
|
28
|
+
"type": "array",
|
|
29
|
+
"items": {
|
|
30
|
+
"$ref": "#/definitions/Permission"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"definitions": {
|
|
35
|
+
"DefaultPermission": {
|
|
36
|
+
"description": "The default permission set of the plugin.\n\nWorks similarly to a permission with the \"default\" identifier.",
|
|
37
|
+
"type": "object",
|
|
38
|
+
"required": [
|
|
39
|
+
"permissions"
|
|
40
|
+
],
|
|
41
|
+
"properties": {
|
|
42
|
+
"version": {
|
|
43
|
+
"description": "The version of the permission.",
|
|
44
|
+
"type": [
|
|
45
|
+
"integer",
|
|
46
|
+
"null"
|
|
47
|
+
],
|
|
48
|
+
"format": "uint64",
|
|
49
|
+
"minimum": 1.0
|
|
50
|
+
},
|
|
51
|
+
"description": {
|
|
52
|
+
"description": "Human-readable description of what the permission does. Tauri convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.",
|
|
53
|
+
"type": [
|
|
54
|
+
"string",
|
|
55
|
+
"null"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
"permissions": {
|
|
59
|
+
"description": "All permissions this set contains.",
|
|
60
|
+
"type": "array",
|
|
61
|
+
"items": {
|
|
62
|
+
"type": "string"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"PermissionSet": {
|
|
68
|
+
"description": "A set of direct permissions grouped together under a new name.",
|
|
69
|
+
"type": "object",
|
|
70
|
+
"required": [
|
|
71
|
+
"description",
|
|
72
|
+
"identifier",
|
|
73
|
+
"permissions"
|
|
74
|
+
],
|
|
75
|
+
"properties": {
|
|
76
|
+
"identifier": {
|
|
77
|
+
"description": "A unique identifier for the permission.",
|
|
78
|
+
"type": "string"
|
|
79
|
+
},
|
|
80
|
+
"description": {
|
|
81
|
+
"description": "Human-readable description of what the permission does.",
|
|
82
|
+
"type": "string"
|
|
83
|
+
},
|
|
84
|
+
"permissions": {
|
|
85
|
+
"description": "All permissions this set contains.",
|
|
86
|
+
"type": "array",
|
|
87
|
+
"items": {
|
|
88
|
+
"$ref": "#/definitions/PermissionKind"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"Permission": {
|
|
94
|
+
"description": "Descriptions of explicit privileges of commands.\n\nIt can enable commands to be accessible in the frontend of the application.\n\nIf the scope is defined it can be used to fine grain control the access of individual or multiple commands.",
|
|
95
|
+
"type": "object",
|
|
96
|
+
"required": [
|
|
97
|
+
"identifier"
|
|
98
|
+
],
|
|
99
|
+
"properties": {
|
|
100
|
+
"version": {
|
|
101
|
+
"description": "The version of the permission.",
|
|
102
|
+
"type": [
|
|
103
|
+
"integer",
|
|
104
|
+
"null"
|
|
105
|
+
],
|
|
106
|
+
"format": "uint64",
|
|
107
|
+
"minimum": 1.0
|
|
108
|
+
},
|
|
109
|
+
"identifier": {
|
|
110
|
+
"description": "A unique identifier for the permission.",
|
|
111
|
+
"type": "string"
|
|
112
|
+
},
|
|
113
|
+
"description": {
|
|
114
|
+
"description": "Human-readable description of what the permission does. Tauri internal convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.",
|
|
115
|
+
"type": [
|
|
116
|
+
"string",
|
|
117
|
+
"null"
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
"commands": {
|
|
121
|
+
"description": "Allowed or denied commands when using this permission.",
|
|
122
|
+
"default": {
|
|
123
|
+
"allow": [],
|
|
124
|
+
"deny": []
|
|
125
|
+
},
|
|
126
|
+
"allOf": [
|
|
127
|
+
{
|
|
128
|
+
"$ref": "#/definitions/Commands"
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
"scope": {
|
|
133
|
+
"description": "Allowed or denied scoped when using this permission.",
|
|
134
|
+
"allOf": [
|
|
135
|
+
{
|
|
136
|
+
"$ref": "#/definitions/Scopes"
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
"platforms": {
|
|
141
|
+
"description": "Target platforms this permission applies. By default all platforms are affected by this permission.",
|
|
142
|
+
"type": [
|
|
143
|
+
"array",
|
|
144
|
+
"null"
|
|
145
|
+
],
|
|
146
|
+
"items": {
|
|
147
|
+
"$ref": "#/definitions/Target"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"Commands": {
|
|
153
|
+
"description": "Allowed and denied commands inside a permission.\n\nIf two commands clash inside of `allow` and `deny`, it should be denied by default.",
|
|
154
|
+
"type": "object",
|
|
155
|
+
"properties": {
|
|
156
|
+
"allow": {
|
|
157
|
+
"description": "Allowed command.",
|
|
158
|
+
"default": [],
|
|
159
|
+
"type": "array",
|
|
160
|
+
"items": {
|
|
161
|
+
"type": "string"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"deny": {
|
|
165
|
+
"description": "Denied command, which takes priority.",
|
|
166
|
+
"default": [],
|
|
167
|
+
"type": "array",
|
|
168
|
+
"items": {
|
|
169
|
+
"type": "string"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"Scopes": {
|
|
175
|
+
"description": "An argument for fine grained behavior control of Tauri commands.\n\nIt can be of any serde serializable type and is used to allow or prevent certain actions inside a Tauri command. The configured scope is passed to the command and will be enforced by the command implementation.\n\n## Example\n\n```json { \"allow\": [{ \"path\": \"$HOME/**\" }], \"deny\": [{ \"path\": \"$HOME/secret.txt\" }] } ```",
|
|
176
|
+
"type": "object",
|
|
177
|
+
"properties": {
|
|
178
|
+
"allow": {
|
|
179
|
+
"description": "Data that defines what is allowed by the scope.",
|
|
180
|
+
"type": [
|
|
181
|
+
"array",
|
|
182
|
+
"null"
|
|
183
|
+
],
|
|
184
|
+
"items": {
|
|
185
|
+
"$ref": "#/definitions/Value"
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
"deny": {
|
|
189
|
+
"description": "Data that defines what is denied by the scope. This should be prioritized by validation logic.",
|
|
190
|
+
"type": [
|
|
191
|
+
"array",
|
|
192
|
+
"null"
|
|
193
|
+
],
|
|
194
|
+
"items": {
|
|
195
|
+
"$ref": "#/definitions/Value"
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"Value": {
|
|
201
|
+
"description": "All supported ACL values.",
|
|
202
|
+
"anyOf": [
|
|
203
|
+
{
|
|
204
|
+
"description": "Represents a null JSON value.",
|
|
205
|
+
"type": "null"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"description": "Represents a [`bool`].",
|
|
209
|
+
"type": "boolean"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"description": "Represents a valid ACL [`Number`].",
|
|
213
|
+
"allOf": [
|
|
214
|
+
{
|
|
215
|
+
"$ref": "#/definitions/Number"
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"description": "Represents a [`String`].",
|
|
221
|
+
"type": "string"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"description": "Represents a list of other [`Value`]s.",
|
|
225
|
+
"type": "array",
|
|
226
|
+
"items": {
|
|
227
|
+
"$ref": "#/definitions/Value"
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"description": "Represents a map of [`String`] keys to [`Value`]s.",
|
|
232
|
+
"type": "object",
|
|
233
|
+
"additionalProperties": {
|
|
234
|
+
"$ref": "#/definitions/Value"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
"Number": {
|
|
240
|
+
"description": "A valid ACL number.",
|
|
241
|
+
"anyOf": [
|
|
242
|
+
{
|
|
243
|
+
"description": "Represents an [`i64`].",
|
|
244
|
+
"type": "integer",
|
|
245
|
+
"format": "int64"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"description": "Represents a [`f64`].",
|
|
249
|
+
"type": "number",
|
|
250
|
+
"format": "double"
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
},
|
|
254
|
+
"Target": {
|
|
255
|
+
"description": "Platform target.",
|
|
256
|
+
"oneOf": [
|
|
257
|
+
{
|
|
258
|
+
"description": "MacOS.",
|
|
259
|
+
"type": "string",
|
|
260
|
+
"enum": [
|
|
261
|
+
"macOS"
|
|
262
|
+
]
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"description": "Windows.",
|
|
266
|
+
"type": "string",
|
|
267
|
+
"enum": [
|
|
268
|
+
"windows"
|
|
269
|
+
]
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"description": "Linux.",
|
|
273
|
+
"type": "string",
|
|
274
|
+
"enum": [
|
|
275
|
+
"linux"
|
|
276
|
+
]
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"description": "Android.",
|
|
280
|
+
"type": "string",
|
|
281
|
+
"enum": [
|
|
282
|
+
"android"
|
|
283
|
+
]
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"description": "iOS.",
|
|
287
|
+
"type": "string",
|
|
288
|
+
"enum": [
|
|
289
|
+
"iOS"
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
]
|
|
293
|
+
},
|
|
294
|
+
"PermissionKind": {
|
|
295
|
+
"type": "string",
|
|
296
|
+
"oneOf": [
|
|
297
|
+
{
|
|
298
|
+
"description": "Enables the append_debug_logs command without any pre-configured scope.",
|
|
299
|
+
"type": "string",
|
|
300
|
+
"const": "allow-append-debug-logs",
|
|
301
|
+
"markdownDescription": "Enables the append_debug_logs command without any pre-configured scope."
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"description": "Denies the append_debug_logs command without any pre-configured scope.",
|
|
305
|
+
"type": "string",
|
|
306
|
+
"const": "deny-append-debug-logs",
|
|
307
|
+
"markdownDescription": "Denies the append_debug_logs command without any pre-configured scope."
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"description": "Enables the capture_webview_state command without any pre-configured scope.",
|
|
311
|
+
"type": "string",
|
|
312
|
+
"const": "allow-capture-webview-state",
|
|
313
|
+
"markdownDescription": "Enables the capture_webview_state command without any pre-configured scope."
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"description": "Denies the capture_webview_state command without any pre-configured scope.",
|
|
317
|
+
"type": "string",
|
|
318
|
+
"const": "deny-capture-webview-state",
|
|
319
|
+
"markdownDescription": "Denies the capture_webview_state command without any pre-configured scope."
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"description": "Enables the get_console_logs command without any pre-configured scope.",
|
|
323
|
+
"type": "string",
|
|
324
|
+
"const": "allow-get-console-logs",
|
|
325
|
+
"markdownDescription": "Enables the get_console_logs command without any pre-configured scope."
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"description": "Denies the get_console_logs command without any pre-configured scope.",
|
|
329
|
+
"type": "string",
|
|
330
|
+
"const": "deny-get-console-logs",
|
|
331
|
+
"markdownDescription": "Denies the get_console_logs command without any pre-configured scope."
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"description": "Enables the reset_debug_logs command without any pre-configured scope.",
|
|
335
|
+
"type": "string",
|
|
336
|
+
"const": "allow-reset-debug-logs",
|
|
337
|
+
"markdownDescription": "Enables the reset_debug_logs command without any pre-configured scope."
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"description": "Denies the reset_debug_logs command without any pre-configured scope.",
|
|
341
|
+
"type": "string",
|
|
342
|
+
"const": "deny-reset-debug-logs",
|
|
343
|
+
"markdownDescription": "Denies the reset_debug_logs command without any pre-configured scope."
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"description": "Enables the send_debug_command command without any pre-configured scope.",
|
|
347
|
+
"type": "string",
|
|
348
|
+
"const": "allow-send-debug-command",
|
|
349
|
+
"markdownDescription": "Enables the send_debug_command command without any pre-configured scope."
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"description": "Denies the send_debug_command command without any pre-configured scope.",
|
|
353
|
+
"type": "string",
|
|
354
|
+
"const": "deny-send-debug-command",
|
|
355
|
+
"markdownDescription": "Denies the send_debug_command command without any pre-configured scope."
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"description": "Enables the write_debug_snapshot command without any pre-configured scope.",
|
|
359
|
+
"type": "string",
|
|
360
|
+
"const": "allow-write-debug-snapshot",
|
|
361
|
+
"markdownDescription": "Enables the write_debug_snapshot command without any pre-configured scope."
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"description": "Denies the write_debug_snapshot command without any pre-configured scope.",
|
|
365
|
+
"type": "string",
|
|
366
|
+
"const": "deny-write-debug-snapshot",
|
|
367
|
+
"markdownDescription": "Denies the write_debug_snapshot command without any pre-configured scope."
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"description": "Debug tools with official logging and screenshots",
|
|
371
|
+
"type": "string",
|
|
372
|
+
"const": "debug-with-logging",
|
|
373
|
+
"markdownDescription": "Debug tools with official logging and screenshots"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"description": "Allows debug-tools commands for WebView inspection and log capture.\n\n#### Granted Permissions\n\nAll debug-tools commands are enabled by default.\n\n#### Note\n\nFor full functionality, also enable official plugins:\n- `log:default` for automatic console log collection\n- `screenshots:default` for cross-platform screenshot capture\n\n\n#### This default permission set includes:\n\n- `allow-capture-webview-state`\n- `allow-get-console-logs`\n- `allow-send-debug-command`\n- `allow-append-debug-logs`\n- `allow-reset-debug-logs`\n- `allow-write-debug-snapshot`",
|
|
377
|
+
"type": "string",
|
|
378
|
+
"const": "default",
|
|
379
|
+
"markdownDescription": "Allows debug-tools commands for WebView inspection and log capture.\n\n#### Granted Permissions\n\nAll debug-tools commands are enabled by default.\n\n#### Note\n\nFor full functionality, also enable official plugins:\n- `log:default` for automatic console log collection\n- `screenshots:default` for cross-platform screenshot capture\n\n\n#### This default permission set includes:\n\n- `allow-capture-webview-state`\n- `allow-get-console-logs`\n- `allow-send-debug-command`\n- `allow-append-debug-logs`\n- `allow-reset-debug-logs`\n- `allow-write-debug-snapshot`"
|
|
380
|
+
}
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debug-tauri
|
|
3
|
+
description: Automates Tauri WebView debugging using official plugins (tauri-plugin-log + screenshots) with process verification, automated screenshots, console logs, and state analysis. Use when debugging Tauri apps, investigating WebView issues, analyzing runtime errors, or troubleshooting UI problems.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Tauri WebView Debugger
|
|
7
|
+
|
|
8
|
+
Automated debugging workflow for Tauri applications using `tauri-plugin-debug-tools` with official plugin integration.
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
- **tauri-plugin-debug-tools** installed and registered
|
|
13
|
+
- **tauri-plugin-log** (v2.0+): Official logging plugin for automatic console collection
|
|
14
|
+
- **tauri-plugin-screenshots** (v2.0+): Cross-platform screenshot capture
|
|
15
|
+
- Debug permissions enabled: `debug-tools:default`, `log:default`, `screenshots:default`
|
|
16
|
+
- Frontend logger initialized via `attachConsole()` (recommended for automatic log forwarding)
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
Run `TAURI_APP_NAME=<app-binary-name> scripts/capture.sh` to verify process and capture screenshot.
|
|
21
|
+
|
|
22
|
+
If process not found, start your dev server (e.g., `tauri dev`) and retry.
|
|
23
|
+
|
|
24
|
+
## Debug Workflow
|
|
25
|
+
|
|
26
|
+
Copy this checklist to track progress:
|
|
27
|
+
|
|
28
|
+
```markdown
|
|
29
|
+
Debug Progress:
|
|
30
|
+
- [ ] Step 1: Verify process status
|
|
31
|
+
- [ ] Step 2: Capture screenshot
|
|
32
|
+
- [ ] Step 3: Collect console logs
|
|
33
|
+
- [ ] Step 4: Capture WebView state
|
|
34
|
+
- [ ] Step 5: Analyze findings
|
|
35
|
+
- [ ] Step 6: Generate debug report
|
|
36
|
+
- [ ] Step 7: Propose fixes
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Step 1: Verify Process Status
|
|
40
|
+
|
|
41
|
+
Run: `TAURI_APP_NAME=<your-app> scripts/capture.sh`
|
|
42
|
+
|
|
43
|
+
This checks if the app is running and captures an initial screenshot.
|
|
44
|
+
|
|
45
|
+
### Step 2: Capture Screenshot
|
|
46
|
+
|
|
47
|
+
**Via Plugin API (Recommended)**:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { captureMainWindow } from "tauri-plugin-debug-tools/screenshotHelper";
|
|
51
|
+
const imagePath = await captureMainWindow();
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Legacy**: capture.sh script (macOS screencapture). See [SCREENSHOTS.md](references/SCREENSHOTS.md) for details.
|
|
55
|
+
|
|
56
|
+
### Step 3: Collect Console Logs
|
|
57
|
+
|
|
58
|
+
**Automatic Collection (Recommended)**:
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { logger } from "tauri-plugin-debug-tools/logAdapter";
|
|
62
|
+
|
|
63
|
+
// Initialize once at app startup
|
|
64
|
+
const detach = await logger.initialize();
|
|
65
|
+
|
|
66
|
+
// Logs auto-forwarded to platform-specific location
|
|
67
|
+
logger.info("App started");
|
|
68
|
+
logger.error("Something went wrong");
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Log Locations**:
|
|
72
|
+
|
|
73
|
+
- **macOS**: `~/Library/Logs/{bundle_id}/debug.log`
|
|
74
|
+
- **Linux**: `~/.local/share/{bundle_id}/logs/debug.log`
|
|
75
|
+
- **Windows**: `{LOCALAPPDATA}\{bundle_id}\logs\debug.log`
|
|
76
|
+
|
|
77
|
+
**Alternative**: Use debugBridge API. See [IPC_COMMANDS.md](references/IPC_COMMANDS.md#console-log-collection) for all methods.
|
|
78
|
+
|
|
79
|
+
### Step 4: Capture WebView State
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { captureWebViewState } from "tauri-plugin-debug-tools/debugBridge";
|
|
83
|
+
const state = await captureWebViewState();
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Returns: `{ url, title, user_agent, viewport }`
|
|
87
|
+
|
|
88
|
+
### Step 5: Analyze Findings
|
|
89
|
+
|
|
90
|
+
- **Visual**: Check screenshot for UI issues, errors, layout problems
|
|
91
|
+
- **Logs**: Review errors, warnings, patterns
|
|
92
|
+
- **State**: Verify URL, viewport, user agent
|
|
93
|
+
- **Performance**: Check for memory leaks, high CPU usage
|
|
94
|
+
|
|
95
|
+
### Step 6: Generate Debug Report
|
|
96
|
+
|
|
97
|
+
Use template in [REPORT_TEMPLATE.md](references/REPORT_TEMPLATE.md).
|
|
98
|
+
|
|
99
|
+
### Step 7: Propose Fixes
|
|
100
|
+
|
|
101
|
+
Based on collected evidence:
|
|
102
|
+
|
|
103
|
+
- Identify root cause
|
|
104
|
+
- Suggest specific code changes
|
|
105
|
+
- Provide implementation steps
|
|
106
|
+
|
|
107
|
+
## References
|
|
108
|
+
|
|
109
|
+
**IPC Commands**: [IPC_COMMANDS.md](references/IPC_COMMANDS.md) - Console logs, WebView state, debug commands
|
|
110
|
+
**Screenshots**: [SCREENSHOTS.md](references/SCREENSHOTS.md) - Capture methods and troubleshooting
|
|
111
|
+
**Troubleshooting**: [TROUBLESHOOTING.md](references/TROUBLESHOOTING.md) - Common errors and solutions
|
|
112
|
+
**Report Template**: [REPORT_TEMPLATE.md](references/REPORT_TEMPLATE.md) - Structured debug report format
|
|
113
|
+
|
|
114
|
+
**Legacy reference**: `REFERENCE.md` contains combined documentation (will be deprecated)
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Tauri IPC Commands Reference
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
- Console Log Collection
|
|
6
|
+
- WebView State Capture
|
|
7
|
+
- Debug Commands
|
|
8
|
+
- Screenshot Commands (Deprecated)
|
|
9
|
+
|
|
10
|
+
## Console Log Collection
|
|
11
|
+
|
|
12
|
+
### Method A: Official Plugin (Recommended)
|
|
13
|
+
|
|
14
|
+
Use `tauri-plugin-log` for automatic console collection with persistence:
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { logger } from "tauri-plugin-debug-tools/logAdapter";
|
|
18
|
+
|
|
19
|
+
// Initialize once at app startup
|
|
20
|
+
const detach = await logger.initialize();
|
|
21
|
+
|
|
22
|
+
// All console.* calls are auto-forwarded
|
|
23
|
+
logger.info("App started");
|
|
24
|
+
logger.error("Something went wrong");
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Log Locations**:
|
|
28
|
+
|
|
29
|
+
- **macOS**: `~/Library/Logs/{bundle_id}/debug.log`
|
|
30
|
+
- **Linux**: `~/.local/share/{bundle_id}/logs/debug.log`
|
|
31
|
+
- **Windows**: `{LOCALAPPDATA}\{bundle_id}\logs\debug.log`
|
|
32
|
+
|
|
33
|
+
**Analysis**:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
./scripts/analyze_logs.sh
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Method B: Via debugBridge API (Legacy)
|
|
40
|
+
|
|
41
|
+
If using custom `consoleLogger` implementation:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { getConsoleLogs, getConsoleErrors } from "tauri-plugin-debug-tools/debugBridge";
|
|
45
|
+
|
|
46
|
+
const allLogs = getConsoleLogs();
|
|
47
|
+
const errors = getConsoleErrors();
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Deprecated**: Migrate to Method A (official plugin) for persistence and cross-platform support.
|
|
51
|
+
|
|
52
|
+
### Method C: Via IPC Command (Not Recommended)
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import { invoke } from "@tauri-apps/api/core";
|
|
56
|
+
|
|
57
|
+
const logs = await invoke("plugin:debug-tools|get_console_logs");
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Note**: Returns empty array. Use Method A (official plugin) instead.
|
|
61
|
+
|
|
62
|
+
**Fallback**: Only ask user for logs if all automated methods fail.
|
|
63
|
+
|
|
64
|
+
## WebView State Capture
|
|
65
|
+
|
|
66
|
+
### capture_webview_state
|
|
67
|
+
|
|
68
|
+
Retrieves WebView internal state as JSON.
|
|
69
|
+
|
|
70
|
+
**TypeScript:**
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import { captureWebViewState } from "tauri-plugin-debug-tools/debugBridge";
|
|
74
|
+
|
|
75
|
+
const state = await captureWebViewState();
|
|
76
|
+
console.log(state);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Response:**
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"url": "http://localhost:5173",
|
|
84
|
+
"title": "iori",
|
|
85
|
+
"user_agent": "TauriWebView/2.0",
|
|
86
|
+
"viewport": {
|
|
87
|
+
"width": 1200,
|
|
88
|
+
"height": 800
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Debug Commands
|
|
94
|
+
|
|
95
|
+
### send_debug_command
|
|
96
|
+
|
|
97
|
+
Send debug commands to WebView (event-based).
|
|
98
|
+
|
|
99
|
+
**Usage:**
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
import { sendDebugCommand } from "tauri-plugin-debug-tools/debugBridge";
|
|
103
|
+
|
|
104
|
+
await sendDebugCommand("get_gpu_state", { includeBuffers: true });
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Screenshot Commands (Deprecated)
|
|
108
|
+
|
|
109
|
+
### take_screenshot
|
|
110
|
+
|
|
111
|
+
**Status**: Deprecated. Use system `screencapture` command instead.
|
|
112
|
+
|
|
113
|
+
**Error message:**
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
Use system screencapture command instead.
|
|
117
|
+
Run: screencapture -x -T 0 /tmp/tauri_screenshot.png
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
See [SCREENSHOTS.md](SCREENSHOTS.md) for screenshot capture methods.
|
|
121
|
+
|
|
122
|
+
## WebGPU Debug API (Planned - Phase 4)
|
|
123
|
+
|
|
124
|
+
### captureWebGPUState()
|
|
125
|
+
|
|
126
|
+
Comprehensive WebGPU state capture.
|
|
127
|
+
|
|
128
|
+
**Returns:**
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
{
|
|
132
|
+
deviceInfo: GPUAdapterInfo,
|
|
133
|
+
bufferStats: {
|
|
134
|
+
particleBuffer: { size: number, usage: number },
|
|
135
|
+
uniformBuffer: { size: number, usage: number },
|
|
136
|
+
},
|
|
137
|
+
computeResults: Float32Array,
|
|
138
|
+
performanceMetrics: {
|
|
139
|
+
fps: number,
|
|
140
|
+
frameTime: number,
|
|
141
|
+
memoryUsage: number
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### getDeviceInfo()
|
|
147
|
+
|
|
148
|
+
Retrieve GPU device information.
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
const info = await getDeviceInfo();
|
|
152
|
+
// { vendor: "Apple", architecture: "..." }
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### exportComputeResults()
|
|
156
|
+
|
|
157
|
+
Export Compute Shader results to CPU.
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
const results = await exportComputeResults();
|
|
161
|
+
// Float32Array(100000) - particle position data
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### getPerformanceMetrics()
|
|
165
|
+
|
|
166
|
+
Retrieve performance metrics.
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
const metrics = await getPerformanceMetrics();
|
|
170
|
+
// { fps: 60, frameTime: 16.67, memoryUsage: 197 }
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Process Information
|
|
174
|
+
|
|
175
|
+
### Check Running Tauri Process
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
ps aux | grep <app-binary-name> | grep -v grep
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Example output:**
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
user 94678 1.6 0.3 440546784 197920 s011 S+ 11:47AM 0:12.85 target/debug/<app-binary-name>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Process Details
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
ps -p 94678 -o pid,vsz,rss,%cpu,%mem,command
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## References
|
|
194
|
+
|
|
195
|
+
- [Tauri IPC Commands](https://v2.tauri.app/develop/calling-rust/)
|
|
196
|
+
- [tauri-plugin-debug-tools repository](https://github.com/your-org/tauri-plugin-debug-tools)
|