This document contains guidelines and commands for agentic coding agents working on the mdns-browser repository.
This is a Tauri desktop application for browsing mDNS services with:
- Rust backend (src-tauri/) using Tauri framework
- Frontend (src/) built with Leptos web framework
- Shared models and constants in crates/
- Targets: Windows, macOS, Linux, Android, iOS
# Build the entire application (frontend + Tauri app)
cargo --locked tauri build --no-bundle --no-sign
# Development build with hot reload
cargo tauri dev# Run all tests using nextest (preferred)
cargo nextest run --profile ci
# Run specific package tests
cargo nextest run -p mdns-browser --profile ci
cargo nextest run -p models --profile ci
# Run a single test
cargo nextest run --profile ci test_name
# Traditional cargo test (fallback)
cargo test -p models -p mdns-browser
# Run tests with specific features
cargo nextest run --profile ci --features desktop# Format Rust code
cargo fmt
# Format Leptos components
leptosfmt --check src
# Check formatting without modifying
cargo fmt -- --check
# Run clippy lints
cargo clippy --workspace --tests -- -D warningsactionlint .github/workflows/*.ymlcargo fmt -- --check && \
cd src-tauri && cargo fmt -- --check && \
cd .. && \
leptosfmt --check src && \
cargo clippy --workspace --tests -- -D warnings && \
cargo nextest run --profile ci && \
actionlint .github/workflows/*.yml# Start development server
cargo tauri dev
# With custom arguments
cargo tauri dev -- --log-level debug --enable-devtools
- REQUIRED: Create a branch for your changes
- Make changes to source code
- Run
cargo fmtto format code - Run
cargo clippy --tests -- -D warningsto check for issues - Run
cargo nextest run --profile cito run tests - Run
cargo --locked tauri build --no-bundle --no-signto build release version - Run
cargo clippy --release -workspace --tests -- -D warningsto ensure no warnings in release - Run
actionlintto check GitHub Actions workflows if modified - If README.md was updated, update the manpage (
docs/mdns-browser.1) - Commit only when all checks pass
- After committing, push to the repository and create a pull request if applicable
- After the pull request is created, add a comment
@coderabbitai review - Use conventional commit format (e.g.,
feat:,fix:,docs:) for commit messages
All source files must include:
// Copyright 2026 hrzlgnm
// SPDX-License-Identifier: MIT-0- Use
cargo fmtfor formatting - Clippy must pass with
--tests -- -D warnings - Prefer explicit error handling over
unwrap() - Use
Result<T, String>for Tauri command return types - Follow Rust naming conventions (snake_case for functions, PascalCase for types)
- Use workspace dependencies defined in root Cargo.toml
- Use
leptosfmtfor component formatting - Components use PascalCase naming
- Files in
src/app/are organized by feature - Use leptos
prelude::*imports consistently - Prefer
<Show>over conditional rendering in view! macros - Use
view! { }macro for all UI components
- Group imports: std, external crates, workspace crates, local modules
- Use
{}for single-item imports when possible - Keep imports at file level, not inside functions
- Tauri commands should return
Result<T, String> - Use
map_err()for error conversion with context - Log errors with
log::error!()before propagating - Use
?operator for error propagation
- Use
tauri::async_runtime::spawn()for background tasks - Prefer
recv_async()for channel operations - Handle task lifecycle properly (don't forget event listeners)
- Use
Arc<Mutex<T>>for shared state between threads - Use
AtomicBoolfor simple flags withOrdering::SeqCst - Prefer
State<T>injection for Tauri commands when possible
- All structs crossing the frontend-backend boundary need
#[derive(Serialize, Deserialize)] - Use
serde(rename_all = "camelCase")for frontend compatibility - Dates use microsecond timestamps with
serde_with::DisplayFromStr
- Write unit tests in
#[cfg(test)]modules - Use descriptive test names following
test_functionality_scenariopattern - Test error cases as well as success cases
- Mock external dependencies when needed
- Use
#[cfg(target_os = "...")]for OS-specific code - Use
#[cfg(desktop)]vs#[cfg(mobile)]for platform targeting - Separate platform-specific implementations into submodules
- Document public APIs with rustdoc comments
- Include example usage in complex functions
- Document Tauri command purposes and parameters
- Use
#[deprecated]for old APIs that must remain
├── src/ # Leptos frontend
│ ├── app/ # Feature modules
│ └── main.rs # Frontend entry point
├── src-tauri/ # Tauri backend
│ ├── src/ # Rust backend code
│ ├── tauri.conf.json # Tauri configuration
│ └── Cargo.toml # Backend dependencies
├── crates/ # Shared libraries
│ ├── models/ # Data structures and validation
│ └── shared_constants/ # Constants shared across crates
├── Trunk.toml # Frontend build configuration
├── Cargo.toml # Workspace configuration
└── .config/nextest.toml # Test configuration
- This is a workspace with multiple crates - always run commands from root
- The application uses custom Tauri plugins for system integration
- mDNS functionality uses the
mdns-sdcrate - Frontend and backend communicate via Tauri events and commands
- The app supports both desktop and mobile platforms
- CI runs on Ubuntu, macOS, and Windows - ensure cross-platform compatibility
- The project uses auditible binaries with
cargo-auditable
- Create a branch for your changes (never commit directly to main)
- Run the full CI check:
cargo fmt -- --check && \
cd src-tauri && cargo fmt -- --check && \
cd .. && \
leptosfmt --check src && \
cargo clippy --workspace --tests -- -D warnings && \
cargo nextest run --profile ci && \
actionlint .github/workflows/*.yml- Use conventional commits: Follow the conventional commits format (e.g.,
feat:,fix:,chore:,docs:,refactor:)
When changing any GitHub Actions workflows (.github/workflows/.yml) or actions (.github/actions//action.yml):
-
Run actionlint validation:
actionlint .github/workflows/*.yml -
Fix any actionlint issues before committing:
- Remove invalid syntax or context usage
- Ensure proper secret definitions
- Follow GitHub Actions best practices
- Validate workflow structure
-
Re-run actionlint to ensure all issues are resolved
This ensures your workflow changes follow GitHub Actions best practices and will execute correctly.
- Never use
unsafecode - this will cause CI to fail - Never add
#[allow(warnings)]attributes to suppress warnings - fix the underlying issues instead - Never amend commits - commits will be squashed in GitHub, just create a new commit instead
- Always format code before committing
- Always run clippy and fix warnings (both debug and release)
- Don't add dependencies without updating Cargo.toml properly
- Don't break the async patterns used throughout the codebase
- Don't ignore test failures - all tests must pass
- Don't have warnings in release builds - run
cargo clippy --release --workspace --tests -- -D warningsbefore committing