The AI-native screen recorder. Record your screen and talk; the people you share it with and your AI agents both get it.
Rust agent-readableai-agentsarecclaude-codecodexcursorlocal-firstmacosprivacyrustscreen-recorderscreen-recordingtauritranscriptiontypescriptwindows
import assert from "node:assert/strict";
import { readFileSync, readdirSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { test } from "node:test";
const srcDir = fileURLToPath(new URL("../src-tauri/src/", import.meta.url));
function rustFiles(dir) {
return readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
const full = path.join(dir, entry.name);
if (entry.isDirectory()) return rustFiles(full);
return entry.name.endsWith(".rs") ? [full] : [];
});
}
/** Every `#[tauri::command]` function in the app: its file, signature and body. */
function commands() {
const found = [];
for (const file of rustFiles(srcDir)) {
const text = readFileSync(file, "utf8");
const marker = /#\[tauri::command\][^\n]*\n(?:\s*#\[[^\n]*\n)*\s*((?:pub(?:\([a-z]+\))?\s+)?(?:async\s+)?fn\s+(\w+))/g;
for (let match; (match = marker.exec(text)); ) {
const open = text.indexOf("{", match.index + match[0].length);
let depth = 0;
let end = open;
for (; end < text.length; end++) {
if (text[end] === "{") depth++;
else if (text[end] === "}" && --depth === 0) break;
}
found.push({
file: path.relative(srcDir, file),
name: match[2],
isAsync: /\basync\s+fn\b/.test(match[1]),
body: text.slice(open, end),
});
}
}
return found;
}
test("the scan finds the app's commands", () => {
const names = commands().map((c) => c.name);
assert.ok(names.includes("show_settings_window"));
assert.ok(names.includes("show_local_viewer"));
});
test("commands that build a webview window are async, or WebView2 deadlocks on Windows", () => {
const sync = commands().filter((c) => !c.isAsync && c.body.includes("WebviewWindowBuilder"));
assert.deepEqual(sync.map((c) => `${c.file}: ${c.name}`), []);
});
test("show_local_viewer is async, so opening a recording does not leave a blank window on Windows", () => {
const viewer = commands().find((c) => c.name === "show_local_viewer");
assert.equal(viewer.isAsync, true);
});