Guidance for coding agents operating in this repository.
- App: PDWN (Personal Data Watch & Neutralize)
- Stack: Tauri 2 + Rust backend + TypeScript/Vite frontend + Bun tooling
- Primary code roots:
- Frontend:
src/ - Tauri/Rust:
src-tauri/src/ - CI/workflows:
.github/workflows/
- Frontend:
.cursor/rules/: not present.cursorrules: not present.github/copilot-instructions.md: not present
If any of these are added later, treat them as authoritative and update this file.
bun installOptional (hooks):
bun run prepare- Frontend dev server:
bun run dev- Tauri desktop app in dev:
bun tauri dev- Frontend build:
bun run build- Desktop production bundle:
bun tauri build- Lint:
bun run lint- Format (write):
bun run fmt- Format check (CI-style):
bun run fmt:check- TypeScript typecheck:
bun run typecheck- i18n consistency check:
bun run i18n:check- Run all Rust tests:
cargo test --manifest-path src-tauri/Cargo.toml- Run one Rust test by name (exactly):
cargo test --manifest-path src-tauri/Cargo.toml integration_dataset_detection_consistency -- --nocapture- Run tests in one Rust module/file pattern (example):
cargo test --manifest-path src-tauri/Cargo.toml secrets::tests- Run one specific test in a module (example):
cargo test --manifest-path src-tauri/Cargo.toml secrets::tests::detects_bearer_tokensNote: there is no standalone frontend unit-test runner configured in package.json currently.
- Refresh integration dataset:
bun run dataset:sync- Validate integration dataset behavior:
bun run test:integration- Refresh + validate in one step:
bun run test:integration:refreshbun run checkThis runs TS checks + formatting + i18n + Rust fmt/clippy/tests.
Configured with lefthook.yml:
pre-commit:fmt:check,typecheck,i18n:check,cargo fmt --check,cargo clippy -D warningspre-push:bun run check
Agents should run bun run check before creating a PR.
- Formatter/linter: Biome (
biome.json) - Indentation: 2 spaces
- Max line width: 100
- Quotes: double quotes
- Semicolons: always
- Organize imports enabled; keep imports tidy and unused imports removed.
Conventions observed in src/:
- Use
camelCasefor variables/functions. - Use
PascalCasefor types and type aliases. - Use
SCREAMING_SNAKE_CASEonly for true constants. - Prefer explicit return types for exported functions.
- Prefer narrow unions for domain enums (e.g., risk levels).
- Use
typeimports where possible (import { type Foo } from ...).
API shape convention:
- Keep backend wire field names in
snake_casefor Tauri command payloads/DTOs. - Keep local JS/TS state/function names in
camelCase.
Error handling:
- Use
try/catcharound async command boundaries. - Convert unknown errors safely via
error instanceof Error ? error.message : String(error). - Do not swallow errors silently; surface actionable context in UI state/logs.
- Formatting:
cargo fmt - Lints:
cargo clippy -- -D warnings(warnings are treated as errors)
Conventions observed in src-tauri/src/:
- Modules/files:
snake_case - Functions/variables:
snake_case - Types/enums/traits:
PascalCase - Constants/statics:
SCREAMING_SNAKE_CASE - Prefer
Result<T, String>at Tauri command boundaries. - Map internal errors with context (
map_err(|e| e.to_string())or richer messages). - Use
tracingfor command-level observability.
Error handling:
- Avoid
unwrap()/expect()in runtime paths. unwrap_or_defaultis acceptable when default fallback is explicitly safe.- In tests, panics with detailed messages are acceptable.
- Keep locale files (
src/locales/*.json) structurally aligned. - Any new translation key should be added for all supported locales.
- Run
bun run i18n:checkafter locale updates.
Main workflows currently include:
ci.yml(frontend + rust quality)security.yml(secrets/audits)coverage.yml(Rust coverage gate)release.ymlandpages.yml(release + website)
Agent changes should not weaken these gates without explicit user approval.
- Keep changes scoped and cohesive.
- Prefer minimal diffs over broad refactors.
- Update docs when commands, workflows, or behavior change.
- For security-sensitive paths (detection, deletion, persistence), call out risk explicitly in PR notes.