Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Development Setup

This page covers how to set up a local development environment for working on token-privilege.

Prerequisites

  • Rust 1.91+ – the crate uses the 2024 edition
  • Git
  • mise – manages all development tool versions (Rust toolchain, cargo extensions, formatters, linters)
  • just – command runner (installed automatically by mise)

Initial Setup

Clone the repository and install all tools:

git clone https://github.com/EvilBit-Labs/token-privilege.git
cd token-privilege
just setup

just setup runs mise install, which reads mise.toml and installs all required tool versions. This includes cargo-nextest, cargo-llvm-cov, cargo-audit, cargo-deny, mdbook, and other development tools.

Common Commands

All development tasks are orchestrated through the justfile. Run just (with no arguments) to see all available recipes.

Building

CommandDescription
just buildBuild the workspace (debug).
just build-releaseBuild the workspace (release).

Testing

CommandDescription
just testRun all tests with cargo nextest.
just test-allInclude ignored and slow tests.

Run a single test by name:

cargo nextest run -E 'test(test_name)'

Formatting and Linting

CommandDescription
just fmtFormat all Rust code.
just fmt-checkCheck formatting without modifying files.
just lintRun all linters (Rust, actions, docs, justfile).
just lint-rustFormat check + Clippy (pedantic, all features).
just fixAuto-fix Clippy warnings.

Quality Checks

CommandDescription
just checkPre-commit hooks + all linters (local quality gate).
just ci-checkFull CI parity: pre-commit, fmt, clippy, test, build-release, audit, coverage, docs.

Coverage

CommandDescription
just coverageGenerate LCOV coverage report.
just coverage-checkCoverage with --fail-under-lines 85.
just coverage-reportHTML coverage report, opens in browser.
just coverage-summaryPrint coverage summary by file.

Security

CommandDescription
just auditRun cargo audit for known vulnerabilities.
just denyRun cargo deny check for license and advisory checks.

Documentation

CommandDescription
just docs-buildBuild mdBook and rustdoc.
just docs-serveServe docs locally with live reload.
just docs-checkValidate rustdoc links and mdBook build.
just docs-cleanRemove generated documentation artifacts.

Editor Configuration

The repository includes an .editorconfig file. Ensure your editor respects it or configure the following manually:

  • Indent with 4 spaces (Rust files)
  • UTF-8 encoding
  • LF line endings
  • Trailing whitespace trimmed

Pre-Commit Hooks

Pre-commit hooks are configured via .pre-commit-config.yaml. They run automatically on git commit and can be run manually with:

just check

Windows Development

The justfile supports Windows via PowerShell. All just commands work on both Windows and Unix. Windows is the primary platform for actually running the FFI tests – Linux and macOS only exercise the non-Windows stub paths.