- Desktop app lives in
cardinal/(React UI insrc/, Tauri/native glue insrc-tauri/, build output incardinal/dist/). - Workspace crates (root
Cargo.toml):lsf/(CLI),cardinal-sdk/(shared types),fswalk/,fs-icon/,namepool/,query-segmentation/,search-cache/,search-cancel/,cardinal-syntax/,slab-mmap/(mmap-backed slab for the cache),was/(CLI that streams FSEvents via the SDK). - Tests sit next to code; cross-crate cases belong in each crate’s
tests/directory. Generated outputs (target/,cardinal/dist/, vendor bundles) stay out of commits. - Toolchain pinned via
rust-toolchain.toml(nightly-2025-05-09); install withrustup toolchain install nightly-2025-05-09.
cargo check --workspace— fast compile validation for all crates.cargo test --workspaceorcargo test -p <crate>— run full or targeted suites.cargo clippy --workspace --all-targets— lint; fix or explain warnings.cargo fmt --all— enforce workspace rustfmt settings.- Frontend:
cd cardinal && npm ci(install),npm run dev(Vite),npm run tauri dev -- --release --features dev(desktop shell),npm run build(static bundle),npm run tauri build(release binaries).
- Rust: grouped imports, 4-space indent,
snake_casefor modules/functions,PascalCasefor types/traits. Prefer explicit modules, returnanyhow::Resultfrom fallible APIs, and usetracingfor structured logs. - React: components in
cardinal/src/componentsusePascalCase.tsx; hooks/utilities export camelCase from kebab-case folders. Runnpm run formatornpm run format:check(Prettier). Keep Vite andtsconfig*.jsonsettings intact.
- Co-locate unit tests; add crate-level integration tests for cross-cutting behaviors.
- Run
cargo test --workspaceafter shared-crate changes; targetcargo test -p lsffor query/indexing paths. Name tests for the behavior under test and include edge cases (search latency, indexing throughput, icon extraction). - UI/performance: per
TESTING.md,npm run build, then profile in Chrome DevTools/Safari and monitor FPS/memory regressions.
- Use Conventional Commits (
feat:,fix:,chore:) with scopes when helpful (e.g.,feat(fs-icon): cache lookups); squash WIP commits. - PRs should list cargo/npm commands run, link issues, include UI screenshots when relevant, and call out risks (indexing throughput, search latency, icon extraction).
- Avoid committing generated or vendor outputs; note any intentional lint allowlists or config deviations in the PR.