Skip to content

Latest commit

 

History

History
169 lines (132 loc) · 7.39 KB

CONTRIBUTING.md

File metadata and controls

169 lines (132 loc) · 7.39 KB

Contributing to Void

Thanks for your interest in contributing! Here's how to get started.

Reporting Bugs

Open a bug report with steps to reproduce, expected behavior, and your OS/version.

Suggesting Features

Open a feature request describing the problem and your proposed solution.

Development Setup

Prerequisites

  • Rust 1.95+ (stable toolchain)
  • macOS: Xcode Command Line Tools
  • Linux: ./scripts/linux-deps.sh (Debian/Ubuntu: xkbcommon, Wayland, fontconfig, freetype, Vulkan loader)
  • Windows: the MSVC build tools

Building

git clone https://github.com/eladbash/void.git
cd void

# Run tests (including the desktop window's headless tests)
cargo test --workspace

# Build everything (core, app, CLI)
cargo build

# Run the desktop app
cargo run -p deepclean-app

# Run the CLI
cargo run -p void-cli -- scan

Trying things safely

Never point a work-in-progress build at your real home directory in a mode that deletes anything. Build a sandbox instead:

cargo run -p void-cli -- dev seed /tmp/void-home   # fake home: agent worktrees in every
                                                    # state, ~/.claude, Ollama / HF stores,
                                                    # stale projects
cargo run -p void-cli -- --home /tmp/void-home scan
VOID_HOME=/tmp/void-home cargo run -p deepclean-app                   # the real app, sandboxed

VOID_HOME runs the desktop app against the fake home: scans, settings, history and the Trash all stay inside it, the window title says SANDBOX, and any action that could reach the real machine (Docker prunes, ollama rm, system caches) is dropped.

For UI work on macOS, build with the driver (cargo build -p void-cli -p deepclean-app --features deepclean-app/drive), then python3 scripts/drive.py target/debug/void-app <out-dir> runs the app in a fresh sandbox and saves a window screenshot per step (light and dark, both densities). The window stays behind yours and never takes focus or input from you, so you can keep working while it runs. scripts/compare.py <before> <after> <out> pairs two runs side by side for review.

Project Structure

crates/
  deepclean-core/   # Scanning engine, models, safety checker, action executor
    src/
      scanner/      # Per-ecosystem scanners (rust.rs, node.rs, worktrees.rs, models.rs, ...)
        registry.rs # Which scanner handles which ecosystem (shared by app, CLI, MCP)
      action/       # Clean action execution with safety gates
      git.rs        # Worktree remove / prune / branch delete, re-checked at run time
      dedup.rs      # Duplicate model files -> clones / hardlinks
      guard.rs      # Free-space watch and auto-clean policies
      hooks.rs      # Claude Code hooks and MCP config
      trash.rs      # Move to Trash (system or a directory, for tests)
      testkit/      # FakeHome and per-feature seeds for tests and `void dev seed`
      model.rs      # Data types (CleanableItem, Ecosystem, RiskLevel, etc.)
      safety.rs     # Path safety checker
      staleness.rs  # Last-modified staleness detection
      config.rs     # App configuration
  deepclean-app/    # Native desktop app (GPUI)
    src/
      model/        # UI logic without a window: labels, action choice, selection, filtering, plans
      backend/      # Scans, cleans, Guard and integrations on a tokio runtime; events to the window
      platform/     # Tray, notifications, launch at login
      ui/           # GPUI views: theme, icons, components, one file per screen; tests.rs
      state.rs      # Shared app state and persistence
    assets/icons/   # The product's SVG icons
  void-cli/         # `void` CLI and MCP server

Adding a New Scanner

  1. Create crates/deepclean-core/src/scanner/myecosystem.rs and declare it in scanner/mod.rs.
  2. Implement the EcosystemScanner trait. Take the home directory as a constructor argument (MyScanner::new(home: PathBuf, config: &AppConfig)) instead of looking it up, so tests can point it at a fake home. Use analyze_many if one directory yields several items.
  3. Add the variant to Ecosystem in model.rs, plus any new ArtifactKinds, and add it to Ecosystem::ALL. Order matters: the walker gives a directory to the first scanner that claims it and does not descend further.
  4. Construct it in scanner/registry.rs. The app, the CLI and the MCP server all build scanners from there; there is nothing to add in commands.rs.
  5. Add display labels for the new ecosystem and kinds in crates/deepclean-app/src/model/labels.rs, an accent colour in src/ui/theme.rs and an eco-<id>.svg icon in assets/icons/. The label matches are exhaustive, so the app does not compile until every variant has one.
  6. Every item's actions list the lowest-risk option first, sizes come from the staleness helpers, and facts the user needs to decide go in details.

Tests are required

  • Unit tests in the module for parsing and other pure logic.
  • An integration test in crates/deepclean-core/tests/<feature>.rs that builds a fake home with testkit::FakeHome, runs the real scanner (or the real ScanOrchestrator via registry::build_with_home) and the real ActionExecutor with TrashBackend::Directory, then asserts on disk what was removed and what was preserved. Include the negative cases: the dirty worktree survives, credentials survive, a blocked path is refused.
  • A testkit/<feature>.rs seed so void dev seed shows your ecosystem.
  • Never touch the real home directory or the real Trash in a test. Use tempfile::tempdir(), SafetyChecker::with_home(home, vec![]) and ActionExecutor::with_trash(safety, TrashBackend::Directory(tmp)).
  • Tests must be deterministic and offline, and pass on Linux and macOS CI. Only git is available there. For tools like docker or ollama, test the shape of the action you emit; never run it.

Git Hooks

Enable the repo's hooks once per clone:

git config core.hooksPath .githooks

The pre-commit hook runs cargo fmt --check — the same check as CI's fmt job — so formatting problems surface before you push. Bypass it for a single commit with git commit --no-verify.

Code Style

  • Run cargo fmt before committing
  • Run cargo clippy --workspace --all-targets -- -D warnings and fix all warnings
  • Write tests for new scanners and safety-critical code

Pull Request Process

  1. Fork the repo and create a feature branch
  2. Make your changes with tests
  3. Ensure cargo test --workspace and cargo clippy pass
  4. Open a PR with a clear description of the changes

Releasing

Push a vX.Y.Z tag. The Release workflow builds every bundle, then writes manifest.json (each asset's size and SHA-256) and SHA256SUMS and signs the manifest with scripts/release-manifest.sh. Signing needs the VOID_RELEASE_SIGNING_KEY repository secret: the Ed25519 private key (PEM) whose public half is crates/deepclean-core/src/update/release-key.pem. The app trusts updates signed by that key alone, so keep it out of the repository. If you replace it, commit the new public key in the same release, because older apps can't verify anything signed by a key they don't know.

Code of Conduct

This project follows the Contributor Covenant. Be kind and constructive.