From 6350ab78cdd114a5660f38b7f8f6040484c7324b Mon Sep 17 00:00:00 2001 From: Z User Date: Sat, 30 May 2026 21:12:44 +0000 Subject: [PATCH] trim base.md to minimal agent preamble Removed section-level topic tables, search keywords, and supplementary descriptions. Keeps only: rules, v1-vs-v2 table, and flat URL list with one-line descriptions. Compact enough to inline in a prompt. --- base.md | 173 ++++++++------------------------------------------------ 1 file changed, 23 insertions(+), 150 deletions(-) diff --git a/base.md b/base.md index b269e11..9eed853 100644 --- a/base.md +++ b/base.md @@ -1,172 +1,45 @@ -# Tauri 2.0 Reference Library — LLM Index +# Tauri 2.0 Reference — Agent Index -This file is a navigation index for LLMs and AI agents. Each document listed below is hosted as a raw Markdown file on Gitea. Fetch individual files via their URLs instead of cloning the entire repository. +**Rules**: All code is Tauri 2.0 only (no v1 patterns). You cannot compile in a sandbox — verify via logic and these docs. Plugins need 4 steps: Rust crate, `.plugin()` registration, npm package, capabilities permissions. -**Base URL pattern**: `https://git.client.guacamolebox.net/butterfly/tauri2-vin-ws-temp/raw/branch/main/` +## v1 vs v2 -**Official Tauri 2.0 Docs**: https://v2.tauri.app -**Rust API Docs**: https://docs.rs/tauri/latest/tauri/ +| v1 (wrong) | v2 (correct) | +|---|---| +| `tauri::Window` / `WindowBuilder` / `WindowUrl` | `tauri::WebviewWindow` / `WebviewWindowBuilder` / `WebviewUrl` | +| `get_window()` | `get_webview_window()` | +| `@tauri-apps/api/tauri` | `@tauri-apps/api/core` | +| `@tauri-apps/api/window` | `@tauri-apps/api/webviewWindow` | +| `@tauri-apps/api/` | `@tauri-apps/plugin-` | +| `build.distDir` | `build.frontendDist` | +| `allowlist` in config | Capabilities + Permissions (ACL) | +| `tauri::api::*` | Moved to plugins | ---- - -## Constraints for Agents - -- You **cannot compile or run code** in a sandbox. Verify correctness using logic, API pattern matching, and cross-referencing these documents. -- All code in this repository is **Tauri 2.0 only** — do NOT use v1 patterns (see migration section for full v1-to-v2 diff). -- Every plugin requires 4 things: (1) Rust crate in `Cargo.toml`, (2) `.plugin()` registration in the Builder, (3) npm package, (4) permissions in capabilities. - ---- - -## Definitive Developer Guide - -### Part 1: Core Architecture, Config, Commands, IPC (Sections 1–7) +## Docs +Core architecture, config, commands, IPC: https://git.client.guacamolebox.net/butterfly/tauri2-vin-ws-temp/raw/branch/main/tauri2-guide/01-core-architecture-config-commands-ipc.md -| Topic | Section | -|-------|----------| -| Architecture overview, project structure, scaffolding | 1–2 | -| Configuration (`tauri.conf.json` v2 schema) | 3 | -| Capabilities & permissions (ACL security model) | 4 | -| Rust backend: `lib.rs`, commands, Builder pattern | 5 | -| Frontend integration (JS imports, invoke, plugins) | 6 | -| IPC: commands, events, channels, streaming | 7 | - -### Part 2: Windows, Plugins, WebSocket, State, Migration (Sections 8–15) - +Windows, plugins, WebSocket, state, migration: https://git.client.guacamolebox.net/butterfly/tauri2-vin-ws-temp/raw/branch/main/tauri2-guide/02-windows-plugins-websocket-state-migration.md -| Topic | Section | -|-------|----------| -| Window management (multi-window, external URLs) | 8 | -| Plugin ecosystem (all 33+ official plugins) | 9 | -| Native WebSocket server (Tokio + broadcast) | 10 | -| Script injection into webview windows | 11 | -| State management (Mutex, managed state) | 12 | -| v1 to v2 migration (full API diff) | 13 | -| Anti-patterns to avoid | 14 | -| Quick reference cheat sheet | 15 | - ---- - -## Agent Prompts - -### Part 1: System Prompt + Common Prompts (Sections 1–7) - +System prompt + common agent prompts (scaffold, plugin, command, state, events, multi-window): https://git.client.guacamolebox.net/butterfly/tauri2-vin-ws-temp/raw/branch/main/tauri2-guide/01-system-prompt-and-common-prompts.md -| Topic | Section | -|-------|----------| -| Universal system prompt (REQUIRED prefix) | 1 | -| Scaffold a new Tauri 2.0 project | 2 | -| Add a Tauri plugin | 3 | -| Create a custom command (IPC) | 4 | -| Add state management | 5 | -| Implement event-based communication | 6 | -| Create multi-window app | 7 | - -### Part 2: Advanced Prompts, Checklist, Migration (Sections 8–15) - +Advanced prompts, verification checklist, v1→v2 API map, debug prompts: https://git.client.guacamolebox.net/butterfly/tauri2-vin-ws-temp/raw/branch/main/tauri2-guide/02-advanced-prompts-checklist-migration.md -| Topic | Section | -|-------|----------| -| Build a WebSocket server in Rust | 8 | -| Implement script injection | 9 | -| Set up capabilities & permissions | 10 | -| Migrate a v1 app to v2 | 11 | -| Full app build (end-to-end) | 12 | -| Verification checklist for agents | 13 | -| v1 vs v2 API map | 14 | -| Debug a Tauri 2.0 build/compile error | 15 | - ---- - -## Error Resolution Guide - -### Part 1: Build, Config, Permission, Plugin Errors (Categories A–H) - +Build, config, permission, plugin compile errors: https://git.client.guacamolebox.net/butterfly/tauri2-vin-ws-temp/raw/branch/main/tauri2-guide/01-build-config-permission-plugin-errors.md -| Topic | Category | -|-------|----------| -| Rust compilation errors (Cargo build failures) | A | -| v1-to-v2 migration compile errors | B | -| Async/thread safety errors (Mutex, Send, lifetime) | C | -| Config errors (`tauri.conf.json` validation) | D | -| Permission/capability errors ("not allowed") | E | -| Plugin integration errors | F | -| IPC / command runtime errors | G | -| Webview & window runtime errors | H | - -### Part 2: Runtime, Platform, Mobile Errors (Categories I–R) - +Runtime, platform, mobile errors + top 25 common: https://git.client.guacamolebox.net/butterfly/tauri2-vin-ws-temp/raw/branch/main/tauri2-guide/02-runtime-platform-mobile-errors.md -| Topic | Category | -|-------|----------| -| Event system errors | I | -| Content Security Policy (CSP) errors | J | -| Frontend integration errors (Vite, Next.js, SvelteKit) | K | -| WebSocket errors | L | -| Path & asset protocol errors | M | -| Shell & sidecar errors | N | -| Mobile build errors (iOS & Android) | O | -| Platform-specific build errors | P | -| Panics & runtime crashes | Q | -| Error handling best practices | R | -| Top 25 most common errors (quick lookup) | Quick-Reference | - ---- - -## Supplementary References - -### Quick-Reference Cheat Sheet - +Cheat sheet (commands, config, IPC, WebSocket): https://git.client.guacamolebox.net/butterfly/tauri2-vin-ws-temp/raw/branch/main/tauri2-docs/cheatsheet.md -Commands, config, IPC, and WebSocket patterns in condensed form. - -### WebSocket Server + Client + Injection Deep-Dive - +WebSocket server + client + injection deep-dive: https://git.client.guacamolebox.net/butterfly/tauri2-vin-ws-temp/raw/branch/main/tauri2-docs/ws_server_client_inject_guide.md -Comprehensive guide for native WebSocket server implementation, client-side JS integration, and script injection patterns. - -### Official Docs Links - +Official docs links (migration, security, config): https://git.client.guacamolebox.net/butterfly/tauri2-vin-ws-temp/raw/branch/main/tauri2-docs/tauri2-links.md - -Curated links to official Tauri 2.0 documentation for migration, security, configuration, and more. - ---- - -## Quick Reference — v1 vs v2 - -| Area | v1 (WRONG in v2) | v2 (Correct) | -|------|-------------------|---------------| -| Window type | `tauri::Window` | `tauri::WebviewWindow` | -| Window builder | `tauri::WindowBuilder` | `tauri::WebviewWindowBuilder` | -| Window URL | `tauri::WindowUrl` | `tauri::WebviewUrl` | -| Get window | `get_window("main")` | `get_webview_window("main")` | -| JS invoke import | `@tauri-apps/api/tauri` | `@tauri-apps/api/core` | -| JS window import | `@tauri-apps/api/window` | `@tauri-apps/api/webviewWindow` | -| Plugin JS imports | `@tauri-apps/api/` | `@tauri-apps/plugin-` | -| Config app section | `tauri` key | `app` key | -| Config dist dir | `build.distDir` | `build.frontendDist` | -| Security model | `allowlist` in config | Capabilities + Permissions (ACL) | -| Core logic file | `main.rs` only | `lib.rs` + `main.rs` pattern | -| Event emit | `window.emit()` | `app.emit()` (global) / `app.emit_to()` (targeted) | -| Rust APIs | `tauri::api::*` modules | Everything moved to plugins | - ---- - -## Search Keywords for LLMs - -- **Error messages**: Search exact error string (e.g., `"unresolved import tauri::api"`, `"not allowed"`) in Error Resolution Guide parts -- **API names**: Search type names (e.g., `WebviewWindowBuilder`, `Emitter`, `Channel`) in Definitive Guide parts -- **Config keys**: Search JSON key names (e.g., `frontendDist`, `withGlobalTauri`, `capabilities`) in Part 1 of Definitive Guide -- **Plugin names**: Search identifiers (e.g., `tauri-plugin-fs`, `fs:default`) in Part 2 of Definitive Guide -- **Migration**: Search old v1 names (e.g., `WindowBuilder`, `allowlist`) to find v2 replacements -- **Patterns**: Search keywords (e.g., `initialization_script`, `run_on_main_thread`, `broadcast channel`) in WebSocket guide -- **Permissions**: Search permission strings (e.g., `core:event:allow-listen`, `fs:allow-read`) in Part 1 Definitive Guide Section 4 and Error Resolution Part 1 Category E