Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ter-9001/WannaCut/llms.txt

Use this file to discover all available pages before exploring further.

WannaCut’s Rust backend exposes 27 Tauri commands called via invoke() from the React frontend. These commands handle every privileged operation the browser-based WebView cannot perform on its own: file I/O, FFmpeg/FFprobe subprocess management, font downloads, YouTube video fetching, and project data persistence. All commands are async (powered by Tokio) and return serialized JSON.
All invoke() calls use Tauri v2’s @tauri-apps/api/core package. Parameters are passed as a plain object (the second argument to invoke), and return values are typed generics:
import { invoke } from '@tauri-apps/api/core';

// Example: get video duration
const meta = await invoke<{ duration: number }>('get_duration', {
  path: '/home/user/projects/MyProject/videos/clip.mp4'
});
console.log(meta.duration); // e.g. 42.5 (seconds)

// Example: list projects
const projects = await invoke<Array<{ name: string; path: string; thumbnail?: string }>>(
  'list_projects',
  { rootPath: '/home/user/WannaCutWorkspace' }
);

Project Management Commands

These commands handle creating, loading, saving, renaming, and deleting projects. A WannaCut project is a directory on disk containing a project.json config file, a videos/ assets folder, an extracted_audios/ folder, and timestamped .project save files.

list_projects

Lists all projects in the workspace root directory. Each item in the returned array represents one project folder.
rootPath
string
required
Absolute path to the WannaCut workspace directory (e.g. /home/user/WannaCutWorkspace).
Returns: Array<{ name: string; path: string; thumbnail?: string }> Each object contains the project name, its absolute path, and an optional thumbnail path (points to the most recently generated frame PNG in the project directory, if available).

create_project_setup

Creates a new project directory structure on disk, including the videos/, extracted_audios/, and thumbnails/ subdirectories, and writes the initial project.json config file.
rootPath
string
required
Absolute path to the workspace root.
projectName
string
required
Name for the new project. Used as the directory name.
config
ProjectSettings
required
Initial project configuration object with name, width, height, fps, backgroundColor, and sampleRate.
Returns: string — The absolute path to the newly created project directory.

load_latest_project

Reads the most recently timestamped .project file from a project directory and returns its raw JSON content. Used when opening an existing project to restore the last editing session.
projectPath
string
required
Absolute path to the project directory.
Returns: string — Raw JSON string of the latest .project file. Parsed by the frontend to restore clips, assets, and tracks.

save_project_data

Saves the current project state (clips, assets, tracks) to a new timestamped .project file. Called automatically by the frontend with a 500 ms debounce whenever clips or assets change. This creates an incremental history of saves, which can be browsed via list_project_files and read_specific_file.
projectPath
string
required
Absolute path to the project directory.
data
string
required
JSON-serialized ProjectFileData object containing projectName, assets, clips, tracks, and lastModified.
timestamp
number
required
Unix timestamp in milliseconds. Used as the filename suffix for the saved .project file.
Returns: void

load_project_config

Reads the project.json file from a project directory and returns the parsed project settings (resolution, FPS, name, etc.).
path
string
required
Absolute path to the project directory.
Returns: ProjectSettings — Object with name, width, height, fps, backgroundColor, sampleRate.

save_project_config

Saves updated project settings to project.json. If the name field has changed, the project directory is also renamed on disk to match the new name.
path
string
required
Absolute path to the current project directory.
config
ProjectSettings
required
Updated settings object. If config.name differs from the current directory name, the directory is renamed.
Returns: string — The (potentially new) absolute path to the project directory after saving and any rename.

delete_project

Permanently deletes an entire project directory and all its contents (assets, audio extractions, thumbnails, save files). This action is irreversible.
path
string
required
Absolute path to the project directory to delete.
Returns: void
delete_project removes the directory recursively using fs_extra. There is no trash/recycle bin — the data is gone immediately.

list_project_files

Lists all .project history files in a project directory, sorted by timestamp. Used by the Settings modal to display the project’s save history for rollback.
projectPath
string
required
Absolute path to the project directory.
Returns: string[] — Array of .project filenames (e.g. ["main_1700000000000.project", "main_1700000500000.project"]), sorted oldest to newest.

read_specific_file

Reads the raw content of a specific .project history file. Used to load a previous version of the project for history rollback.
path
string
required
Absolute path to the .project file to read.
Returns: string — Raw JSON content of the file.

Asset Management Commands

These commands handle importing media files, reading metadata, and file operations within a project’s videos/ folder.

import_asset

Copies a media file from its original location into the project’s videos/ folder. This is the standard way to add assets to a project — WannaCut always works with local copies.
projectPath
string
required
Absolute path to the project directory.
filePath
string
required
Absolute path to the source media file to import.
Returns: void

list_assets

Returns the filenames of all files currently in a project’s videos/ folder.
projectPath
string
required
Absolute path to the project directory.
Returns: string[] — Array of filenames (e.g. ["clip1.mp4", "background.png", "music.mp3"]).

get_duration

Uses FFprobe to read the exact duration of a media file (video or audio).
path
string
required
Absolute path to the media file.
Returns: { duration: number } — Duration in seconds (e.g. { duration: 42.5 }). For images, returns a fallback of 10.

get_video_frame

Uses FFmpeg to extract a single frame from a video at a specific timestamp and returns it as a base64-encoded PNG data URL. Used by the Source Monitor and for the preview fast-path.
path
string
required
Absolute path to the video file.
timeMs
number
required
Time position in milliseconds to extract the frame from.
Returns: string — A base64 PNG data URL (e.g. "data:image/png;base64,iVBOR...").

get_asset_dimensions

Reads the pixel dimensions (width × height) of a video or image file.
path
string
required
Absolute path to the video or image file.
Returns: { x: number; y: number } — Width (x) and height (y) in pixels.

extract_audio

Extracts the audio track from a video file and saves it as an MP3 to the project’s extracted_audios/ folder. Called automatically for every video asset on import. The MP3 is served by the tiny_http server for preview playback.
projectPath
string
required
Absolute path to the project directory.
fileName
string
required
Filename of the video inside videos/ (e.g. "clip.mp4").
Returns: void — The extracted audio is saved as <projectPath>/extracted_audios/<name>.mp3.

generate_thumbnail

Generates (or retrieves from cache) a thumbnail PNG for a video at a specific time. Thumbnails are stored in <projectPath>/thumbnails/ and cached to avoid re-generating on every scrub.
projectPath
string
required
Absolute path to the project directory.
fileName
string
required
Filename of the video inside videos/.
timeSeconds
number
required
Time in seconds at which to capture the thumbnail frame.
Returns: string — Absolute path to the generated or cached thumbnail PNG file.

copy_file

Copies a file from one path to another. Used internally for the “Separate Audio” feature, which copies an extracted MP3 from extracted_audios/ into videos/ to make it available as a timeline asset.
source
string
required
Absolute path to the source file.
destination
string
required
Absolute path to the destination file.
Returns: void

rename_file

Renames or moves a file on disk. Used when the user renames an asset in the media library.
oldPath
string
required
Current absolute path of the file.
newPath
string
required
New absolute path (or new name within the same directory).
Returns: void

delete_file

Deletes a single file from disk. Used when the user deletes an asset from the media library (along with removing it from the timeline state).
path
string
required
Absolute path to the file to delete.
Returns: void

Export Commands

These three commands work together to implement the three-phase export pipeline: render video frames, mix audio offline, then assemble the final MP4.

save_export_frame

Saves a single rendered PNG frame to a temporary directory during export. Called once per frame in Phase 1 of the export pipeline, with a base64-encoded PNG from the offscreen Three.js renderer.
projectPath
string
required
Absolute path to the project directory. The temp frames directory is created here.
frameIndex
number
required
Zero-based frame index (e.g. 0 for the first frame, fps * duration - 1 for the last).
pngBase64
string
required
Base64-encoded PNG data URL of the rendered frame (from auxCanvas.toDataURL("image/png")).
Returns: void

assemble_exported_video

Runs FFmpeg to combine the exported PNG frame sequence with the mixed WAV audio file into a final MP4 video. This is Phase 3 of the export pipeline and reports progress back to the frontend via Tauri events (export-progress).
projectPath
string
required
Absolute path to the project directory containing the temp frames and WAV audio.
targetPath
string
required
Absolute output path for the final MP4 file (chosen by the user via the native save dialog).
fps
number
required
Frame rate of the export (must match the FPS used to render the PNG sequence).
duration
number
required
Total duration of the video in seconds.
width
number
required
Video width in pixels.
height
number
required
Video height in pixels.
Returns: void — Progress is emitted as Tauri events (export-progress, payload: number 0–100) during execution.

cancel_export

Kills the currently running FFmpeg export subprocess. Called when the user clicks “Abort Mission” during an in-progress export. Parameters: None Returns: void
After calling cancel_export, the partially assembled output file and temp frame directory may remain on disk. WannaCut resets renderStatus to 'idle' after cancellation but does not clean up the temp files automatically.

Font & Download Commands

list_fonts

Lists all font files in the WannaCut fonts directory. Font paths are used to dynamically load @font-face declarations into the WebView so fonts are available in text clips.
fontsPath
string
required
Absolute path to the fonts directory (e.g. <settingsFolder>/fonts).
Returns: string[] — Array of absolute paths to font files.

fetch_cloud_fonts

Fetches the WannaCut cloud font manifest from wannacut.app via Rust’s reqwest HTTP client. Returns a list of available fonts that can be downloaded. Parameters: None Returns: { fonts: Array<{ file: string; [key: string]: any }> } — The font manifest JSON from the WannaCut CDN.

download_font_file

Downloads a font file from a URL and saves it to a local path (typically the app’s fonts/ directory).
url
string
required
Full HTTPS URL of the font file to download.
path
string
required
Absolute local path where the font file should be saved.
Returns: void

download_youtube_video

Downloads a video from a given URL using yt-dlp and saves it to the project’s videos/ folder. yt-dlp must be available — it is bundled with WannaCut via the Node.js runtime.
projectPath
string
required
Absolute path to the project directory. The downloaded video is saved to <projectPath>/videos/.
settingsFolder
string
required
Absolute path to the WannaCut settings folder, used to locate the bundled yt-dlp runtime.
url
string
required
URL of the video to download (YouTube, or any URL supported by yt-dlp).
Returns: void
download_youtube_video requires a Node.js runtime to be present. If the runtime is missing, the command will throw an error. The frontend catches this and displays: “YT-DLP Error: Check your JS Runtime”.

Settings Commands

read_settings_file

Reads the raw content of the WannaCut settings JSON file. Called on startup to load the user’s workspace path, GPU preference, and keyboard shortcuts.
path
string
required
Absolute path to wannacut_settings.json (e.g. <settingsFolder>/wannacut_settings.json).
Returns: string — Raw JSON content of the settings file. The frontend parses this to restore wannacutSettings state (workspace, gpu, shortcuts).

Command Quick Reference

CommandGroupKey Return
list_projectsProject{name, path, thumbnail?}[]
create_project_setupProjectstring (path)
load_latest_projectProjectstring (JSON)
save_project_dataProjectvoid
load_project_configProjectProjectSettings
save_project_configProjectstring (path)
delete_projectProjectvoid
list_project_filesProjectstring[]
read_specific_fileProjectstring (JSON)
import_assetAssetvoid
list_assetsAssetstring[]
get_durationAsset{duration: number}
get_video_frameAssetstring (base64 PNG)
get_asset_dimensionsAsset{x: number, y: number}
extract_audioAssetvoid
generate_thumbnailAssetstring (path)
copy_fileAssetvoid
rename_fileAssetvoid
delete_fileAssetvoid
save_export_frameExportvoid
assemble_exported_videoExportvoid
cancel_exportExportvoid
list_fontsFontstring[]
fetch_cloud_fontsFont{fonts: [...]}
download_font_fileFontvoid
download_youtube_videoDownloadvoid
read_settings_fileSettingsstring (JSON)

Build docs developers (and LLMs) love