Project agent guidelines for Snipp (Rust + Tauri + React).
- Use
git commit -S -mfor all commits (fish alias:gc). Commits must be GPG-signed. - Do NOT add co-author trailers, Amp thread IDs, or any agent metadata to commit messages.
- Always use the
ghCLI to fetch issues, PRs, and other GitHub data (e.g.gh issue view 7). Do not scrape viaread_web_page.
- Prefer small, focused changes; keep diffs readable and reversible.
- Keep command names and event names consistent across Rust and TypeScript.
- Avoid hard-coded shortcuts, paths, and feature flags; read from config.
- Keep UI logs behind a debug flag; avoid console noise in production builds.
- Use ASCII-only content unless the file already uses Unicode.
- Use
Result<T, E>with clear error messages; avoidunwrapandexpectoutside tests. - Favor
thiserroror custom error enums for command failures and IO issues. - Keep Tauri commands thin; move logic into helper modules for testability.
- Avoid blocking the async runtime; offload heavy work to threads.
- Keep macOS-only code behind
#[cfg(target_os = "macos")]. - For file IO, validate paths and create directories safely.
- Match every Rust command in
invoke_handlerwith a TS definition and UI usage. - When updating global shortcuts, unregister previous bindings before re-registering.
- Keep window creation centralized; enforce single-instance for popup/editor/preferences.
- Prefer Tauri APIs over shell commands when possible.
- Use the clipboard plugin or platform APIs for image data, not AppleScript when feasible.
- Keep hooks side-effect free; isolate Tauri calls in hooks or services.
- Treat event payloads as typed data; validate or narrow before use.
- Ensure editor state updates are idempotent and resilient to out-of-order events.
- Avoid global listeners without cleanup; always unregister on unmount.
- Cover config schema migration with tests.
- Add manual verification steps for capture -> popup -> editor flows.
- Validate on Retina and external displays with different scale factors.
- Verify OCR output, clipboard results, and hotkey registration after preferences changes.
- Issue #20:
process.envis not available in Vite browser apps. The idomatic check isimport.meta.env.DEV. - When using
import.meta.env, ensuresrc/vite-env.d.tsexists with/// <reference types="vite/client" />for proper TypeScript support.