بنقرة واحدة
tauri-command
Scaffold a new Tauri command across Rust backend and TypeScript frontend with proper patterns.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Scaffold a new Tauri command across Rust backend and TypeScript frontend with proper patterns.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Drive the real GUI against the real engine via the standalone dev HTTP bridge (`npm run dev:bridge`). Use whenever "does the wiring test actually hold up against real code?" matters — smoke verification, UI development with live engine state, real-engine bug repro, exploratory debugging with Chrome DevTools instruments.
Generate Playwright E2E tests following project conventions (Tauri fixture, storage isolation, helpers).
Generate unit tests following project conventions. Use when the user asks to create, generate, or write tests for a file or component.
Scaffold a new React component with co-located test, shadcn/ui primitives, and barrel export registration.
Review changes and determine if PROJECT_SHADOW.md needs updating per AI_CONTRACT.md criteria. Runs automatically during code review.
| name | tauri-command |
| description | Scaffold a new Tauri command across Rust backend and TypeScript frontend with proper patterns. |
Scaffold a new Tauri command with both Rust and TypeScript sides.
Input: Command name and purpose. Example: /tauri-command check_update "Check if CLI update is available"
Steps
Add the Rust command in src-tauri/src/lib.rs:
#[tauri::command] function following existing patternsState<'_, SharedRunState> if run-related)Result<T, String> for fallible commandsinvoke_handler in run() functionIf the command spawns a CLI process:
build_engine_command() from cmd_impl.rs — never bare Command::new().cmd PATH shim wrapping (cmd /C for .cmd files)SharedRunStateAdd TypeScript bridge function in the appropriate location:
src/engine-bridge.tssrc/lib/import { invoke } from '@tauri-apps/api/core'Add capability permission if needed in src-tauri/capabilities/
Add the Tauri bridge mock in src/test/tauri-bridge-mock.ts for unit testing
Rust Pattern
#[tauri::command]
async fn my_command(arg: String) -> Result<MyResponse, String> {
// For CLI execution, ALWAYS use build_engine_command():
// let mut cmd = cmd_impl::build_engine_command(&exe, &args);
Ok(MyResponse { /* ... */ })
}
TypeScript Pattern
import { invoke } from '@tauri-apps/api/core';
export async function myCommand(arg: string): Promise<MyResponse> {
return invoke<MyResponse>('my_command', { arg });
}
Critical Landmine
Windows .cmd PATH resolution: Rust's std::process::Command only resolves .exe files. The endstate.cmd shim requires cmd /C wrapping. All spawn sites MUST use build_engine_command() from cmd_impl.rs. Direct Command::new(exe) will silently fail when the CLI is a .cmd shim on PATH.
Protected Files Warning
src/engine-bridge.ts and src-tauri/src/engine_adapter.rs are protected files. Modifications require explicit user instruction. If the new command needs changes there, flag this before proceeding.