Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions .zenflow/tasks/init-d417/plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
- **Reference Documents**:
- `requirements.md` - Product Requirements Document
- `spec.md` - Technical Specification
- **Rules**:
1. Test each step before moving to the next.
2. Create a different branch for each step.
3. Add enough testing to pass quality gate.
4. Run quality gate and make sure everything is right.

---

Expand Down Expand Up @@ -60,7 +65,8 @@ Initialize the Tauri + React project structure.

---

### [ ] Step: Rust Data Models
### [x] Step: Rust Data Models
<!-- chat-id: c40132f0-29cc-42da-95df-b5406c251877 -->
<!-- phase: 1 -->

Implement core data structures in Rust backend.
Expand All @@ -85,7 +91,7 @@ Implement core data structures in Rust backend.

---

### [ ] Step: TypeScript Types
### [x] Step: TypeScript Types
<!-- phase: 1 -->

Define TypeScript interfaces mirroring Rust models.
Expand All @@ -105,7 +111,7 @@ Define TypeScript interfaces mirroring Rust models.

---

### [ ] Step: Rust Utilities
### [x] Step: Rust Utilities
<!-- phase: 1 -->

Implement utility functions for file system operations.
Expand All @@ -129,7 +135,7 @@ Implement utility functions for file system operations.

---

### [ ] Step: Cache Scanner Implementation
### [x] Step: Cache Scanner Implementation
<!-- phase: 1 -->

Implement the core cache scanning logic.
Expand All @@ -154,7 +160,7 @@ Implement the core cache scanning logic.

---

### [ ] Step: Tauri Commands - Scan
### [x] Step: Tauri Commands - Scan
<!-- phase: 1 -->

Implement Tauri command handlers for scanning operations.
Expand All @@ -178,7 +184,7 @@ Implement Tauri command handlers for scanning operations.

---

### [ ] Step: Cleaner Implementation
### [x] Step: Cleaner Implementation
<!-- phase: 1 -->

Implement safe file deletion operations.
Expand All @@ -202,7 +208,7 @@ Implement safe file deletion operations.

---

### [ ] Step: Tauri Commands - Clean & Config
### [x] Step: Tauri Commands - Clean & Config
<!-- phase: 1 -->

Implement Tauri commands for cleaning and configuration.
Expand All @@ -225,7 +231,7 @@ Implement Tauri commands for cleaning and configuration.

---

### [ ] Step: Tauri Commands - System
### [x] Step: Tauri Commands - System
<!-- phase: 1 -->

Implement system information commands.
Expand Down
89 changes: 89 additions & 0 deletions GEMINI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# CleanMac

CleanMac is a native macOS disk cleanup and optimization utility built with Tauri and React. It helps users reclaim disk space by identifying and removing unnecessary files while protecting important data, specifically designed to be developer-aware.

## Tech Stack

**Frontend:**
* **Framework:** React 19
* **Language:** TypeScript 5.x
* **Build Tool:** Vite 7.x
* **Styling:** Tailwind CSS 3.x
* **State Management:** Zustand
* **Routing:** React Router 7
* **Testing:** Vitest, React Testing Library

**Backend:**
* **Framework:** Tauri 2.x
* **Language:** Rust 1.75+
* **Key Crates:** `tokio` (async), `walkdir` (fs traversal), `rayon` (parallelism), `trash` (safe deletion), `plist` (macOS config)

## Architecture

* **`src/` (Frontend):** Contains the React application.
* `components/`: Reusable UI components organized by feature (dashboard, cache, duplicates, etc.).
* `stores/`: Zustand state management stores.
* `hooks/`: Custom React hooks.
* `lib/`: Utilities and Tauri API wrappers (`tauri.ts`).
* `types/`: TypeScript definitions.
* **`src-tauri/` (Backend):** Contains the Rust application.
* `src/commands/`: Tauri command handlers (scan, clean, config).
* `src/scanner/`: Logic for scanning files (cache, large files, duplicates).
* `src/cleaner/`: Logic for safe file deletion/moving to trash.
* `src/analyzer/`: Analysis logic (developer detector, cache categorizer).
* `tauri.conf.json`: Tauri configuration.

## Key Commands

### Development
* **Start App (Dev Mode):** `pnpm tauri dev` (Starts Vite server + compiles Rust + opens app)
* **Start Frontend Only:** `pnpm dev`
* **Lint Frontend:** `pnpm lint`
* **Typecheck Frontend:** `pnpm typecheck`
* **Lint Backend:** `cd src-tauri && cargo clippy -- -D warnings`
* **Format Backend:** `cd src-tauri && cargo fmt`

### Testing
* **Frontend Tests:** `pnpm test` (Vitest)
* **Backend Tests:** `cd src-tauri && cargo test`
* **Full Quality Check:** `pnpm quality` (Runs typecheck, lint, and test)

### Build
* **Build Production App:** `pnpm tauri build` (Outputs to `src-tauri/target/release/bundle/`)
* **Build Frontend Only:** `pnpm build`

## Development Conventions

* **State Management:** Use Zustand for global state. Stores are located in `src/stores/`.
* **Tauri Commands:**
1. Define the command in `src-tauri/src/commands/`.
2. Register the command in `src-tauri/src/lib.rs`.
3. Create a TypeScript wrapper in `src/lib/tauri.ts`.
* **Styling:** Use Tailwind CSS utility classes.
* **Security:**
* Operations should be 100% local.
* Files should be moved to Trash by default, not permanently deleted immediately.
* The app requires Full Disk Access.
* **Code Style:**
* Follow `eslint` rules for TypeScript/React.
* Follow `cargo fmt` and `clippy` for Rust.

## Current Status

The project is in **Phase 1: Foundation (MVP)**.

* **Completed Steps:**
* Requirements & Spec creation.
* Project Setup (Tauri + React structure initialized).
* Rust Data Models (`src-tauri/src/models/`).
* TypeScript Types (`src/types/index.ts`).
* Rust Utilities (`src-tauri/src/utils/`).

* **Next Steps:**
* Implement Cache Scanner (`src-tauri/src/scanner/`).
* Implement Tauri Commands (`src-tauri/src/commands/`).
* Implement Cleaner (`src-tauri/src/cleaner/`).
* Frontend integration (State management, Components, Pages).

**Immediate Task:**
The next unchecked item in `.zenflow/tasks/init-d417/plan.md` is **"Step: Cache Scanner Implementation"**.
128 changes: 4 additions & 124 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,127 +1,7 @@
# CleanMac
# Tauri + React + Typescript

A native macOS disk cleanup and optimization utility built with Tauri and React.
This template should help get you started developing with Tauri, React and Typescript in Vite.

![macOS](https://img.shields.io/badge/macOS-12%2B-blue)
![License](https://img.shields.io/badge/license-MIT-green)
![Rust](https://img.shields.io/badge/rust-1.75%2B-orange)
![Tauri](https://img.shields.io/badge/tauri-2.x-purple)
## Recommended IDE Setup

## Overview

CleanMac helps you reclaim disk space on your Mac by intelligently identifying and removing unnecessary files while protecting important data. Unlike other cleanup tools, CleanMac is **developer-aware** and won't accidentally delete your development caches and build artifacts.

## Features

- **System Cache Cleaning** - Safely remove system, browser, and application caches
- **Developer Mode** - Automatically detects developer tools and protects important caches (npm, cargo, Xcode DerivedData, etc.)
- **Application Leftovers** - Find and remove files left behind by uninstalled applications
- **Large File Finder** - Discover large files taking up space with preview support
- **Duplicate Detection** - Find duplicate files using smart hash-based comparison
- **Safe Deletion** - Files are moved to Trash by default for easy recovery

## Screenshots

*Coming soon*

## Requirements

- macOS 12 Monterey or later (ARM64 and Intel)
- Full Disk Access permission (for complete scanning)

## Installation

### Download

Download the latest release from the [Releases](https://github.com/yourusername/cleanmac/releases) page.

### Build from Source

See [DEVELOPMENT.md](DEVELOPMENT.md) for detailed build instructions.

```bash
# Quick start
git clone https://github.com/yourusername/cleanmac.git
cd cleanmac
pnpm install
pnpm tauri build
```

## Usage

1. **Grant Full Disk Access** - On first launch, CleanMac will guide you to grant Full Disk Access in System Preferences for complete scanning capabilities.

2. **Choose Your Profile**
- **Regular** - Standard cleanup suitable for most users
- **Developer** - Protects development caches and build artifacts

3. **Scan & Clean** - Use the dashboard to scan for cleanable files, review what will be removed, and clean with confidence.

## Tech Stack

| Component | Technology |
|-----------|------------|
| Framework | [Tauri 2.x](https://tauri.app/) |
| Backend | Rust 1.75+ |
| Frontend | React 19, TypeScript 5.x |
| Styling | Tailwind CSS 3.x |
| State | Zustand |
| Build | Vite 7.x, pnpm |

## Project Structure

```
cleanmac/
├── src/ # React frontend
│ ├── components/ # UI components
│ ├── stores/ # Zustand state stores
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utilities and API wrappers
│ ├── types/ # TypeScript type definitions
│ └── pages/ # Page components
├── src-tauri/ # Rust backend
│ ├── src/
│ │ ├── commands/ # Tauri command handlers
│ │ ├── scanner/ # File scanning logic
│ │ ├── analyzer/ # Analysis (developer detection, etc.)
│ │ ├── cleaner/ # Safe deletion operations
│ │ ├── models/ # Data structures
│ │ └── utils/ # Utilities
│ └── Cargo.toml
└── package.json
```

## Privacy & Security

- **100% Local** - All operations happen on your device. No data is sent anywhere.
- **No Telemetry** - CleanMac does not collect any usage data or analytics.
- **Open Source** - Full source code available for audit.
- **Safe by Default** - Files go to Trash first, allowing easy recovery.

## Contributing

Contributions are welcome! Please read the [Contributing Guidelines](CONTRIBUTING.md) before submitting a PR.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## Development

See [DEVELOPMENT.md](DEVELOPMENT.md) for detailed development setup and guidelines.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Acknowledgments

- Built with [Tauri](https://tauri.app/)
- Icons and design inspired by macOS
- Thanks to all contributors

---

**Note:** CleanMac is not affiliated with Apple Inc. macOS is a trademark of Apple Inc.
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
40 changes: 3 additions & 37 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,26 @@
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import globals from "globals";

export default tseslint.config(
{ ignores: ["dist", "src-tauri", "coverage"] },
{ ignores: ["dist", "src-tauri", "node_modules", "coverage"] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: {
...globals.browser,
...globals.node,
},
globals: globals.browser,
},
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
// React hooks rules
...reactHooks.configs.recommended.rules,

// React refresh
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],

// TypeScript strict rules
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
{ argsIgnorePattern: "^_" },
],
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-non-null-assertion": "warn",

// General code quality
"no-console": ["warn", { allow: ["warn", "error"] }],
"no-debugger": "error",
"no-duplicate-imports": "error",
"no-unused-expressions": "error",
"prefer-const": "error",
"eqeqeq": ["error", "always"],
},
},
// Test files - relaxed rules
{
files: ["**/*.test.{ts,tsx}", "**/*.spec.{ts,tsx}", "**/test/**/*.{ts,tsx}"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"no-console": "off",
},
}
);
10 changes: 1 addition & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@
"@eslint/js": "^9.17.0",
"typescript-eslint": "^8.19.1",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.16",
"globals": "^15.14.0",
"vitest": "^2.1.8",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/ui": "^2.1.8",
"@testing-library/react": "^16.1.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/user-event": "^14.5.2",
"jsdom": "^25.0.1"
"globals": "^15.14.0"
}
}
Loading
Loading