Skip to content

Latest commit

 

History

History
93 lines (67 loc) · 3.23 KB

File metadata and controls

93 lines (67 loc) · 3.23 KB

Development Guide

Setup

npm install
cd src-tauri && cargo generate-lockfile
npm run tauri:dev

For production builds:

npm run build
npm run tauri:build

Validation Commands

Frontend:

npm run build

Rust:

cd src-tauri
cargo test
cargo fmt -- --check
cargo clippy -- -D warnings

src-tauri/Cargo.lock is committed for reproducible application builds. Regenerate it when Rust dependencies change.

There is currently no dedicated frontend test script in package.json. For frontend-only logic, prefer adding narrowly scoped tests before larger refactors rather than relying only on manual checks.

Feature Workflow

  1. Identify the affected layers before editing: UI, Tauri command boundary, database, AI/processor, watcher/snipping.
  2. Trace the existing flow from the user action back to invoke(...), the Tauri command, and the database or background service.
  3. Update shared types and constants early so mismatches fail fast.
  4. Make the smallest coherent change across both layers.
  5. Run the relevant validation commands.
  6. Update docs when behavior, setup, or architecture changes.

Common Change Recipes

Add or change a setting

  • Update Settings in src-tauri/src/db.rs
  • Ensure the schema setup in Database::run_migrations() handles the field
  • Expose the field through get_settings and update_settings
  • Update src/components/Settings.tsx
  • If the setting maps to an OS capability such as launch-on-login, also update the relevant Tauri plugin setup and permissions
  • If first-run behavior changes, update onboarding too

Add a new frontend/backend action

  • Add or update the Tauri command in src-tauri/src/commands.rs
  • Return a shape that matches src/types/index.ts
  • Invoke it from the frontend with explicit error handling
  • If the action changes app state asynchronously, emit an event or trigger a reload path

Change the screenshot analysis flow

  • Update prompt/schema logic in src-tauri/src/ai.rs
  • Keep AnalysisResult parsing strict
  • Check the processor logic in src-tauri/src/processor.rs
  • Verify how categories and fallback task creation behave after the change
  • Manually test with a real screenshot in npm run tauri:dev

Change the database schema

  • Update runtime schema creation in src-tauri/src/db.rs
  • Keep any relevant SQL files in src-tauri/migrations/ or root reference SQL files in sync
  • Avoid destructive resets or assumptions about empty user data
  • Check existing queries that read/write the changed columns

Change watched-folder or snipping behavior

  • Update src-tauri/src/watcher.rs or src-tauri/src/snipping.rs
  • Manually test duplicate file events, pending-review flow, and window focus behavior
  • Verify platform-specific assumptions, especially on Windows

Practical Constraints

  • Do not edit generated output in dist/, src-tauri/target/, or dependencies in node_modules/
  • Do not commit local development state such as .claude/settings.local.json, target/, or src-tauri/dev.db
  • Prefer touching only the files needed for the feature
  • Preserve local-first behavior and conservative automation defaults unless the feature explicitly changes them
  • If docs are wrong after the feature lands, fix them in the same change