A cross-platform Rust library for resolving XDG and platform-specific directories with proper fallbacks.
1# LLMs
2
3This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
5## Project Overview
6
7`dir_spec` is a cross-platform Rust library for resolving XDG and platform-specific directories. It prioritizes XDG
8compliance across all platforms while providing sensible platform-specific fallbacks.
9
10## Development Commands
11
12All development tasks are managed through `mise` (formerly rtx):
13
14```bash
15# Build the project
16mise run build # or: mise run b
17
18# Run linting and formatting checks
19mise run lint # or: mise run l
20
21# Run tests
22mise run test:unit # Unit tests with cargo nextest
23mise run test:coverage # Tests with code coverage
24
25# Security audit
26mise run audit
27
28# Clean build artifacts
29mise run clean
30
31# Project setup
32mise run setup
33```
34
35## Architecture
36
37The library is organized with platform-specific modules:
38
39- `src/lib.rs` - Main library entry point and public API
40- `src/xdg.rs` - XDG Base Directory Specification implementation
41- `src/linux.rs` - Linux-specific directory resolution
42- `src/macos.rs` - macOS-specific directory resolution
43- `src/windows.rs` - Windows-specific directory resolution
44
45Each platform module implements directory resolution logic that:
46
471. First checks for XDG environment variables
482. Falls back to platform-specific defaults if XDG vars aren't set
49
50## Testing Strategy
51
52- Tests are embedded in source files using `#[cfg(test)]` modules
53- Uses `cargo nextest` for faster test execution
54- Each platform module contains platform-specific tests
55- Tests verify both XDG compliance and platform-specific fallbacks
56
57## Key Development Notes
58
59- **Zero dependencies** - Only uses Rust's standard library
60- **Clippy pedantic** - Strict linting is enforced via `.clippy.toml`
61- **Platform compatibility** - Currently supports Linux and macOS (Windows support temporarily removed from CI)
62- **Type safety** - All directory methods return `Option<PathBuf>`