Skip to content

tw93/Mole

Β 
Β 

Repository files navigation

Mole for Windows

Windows support for Mole - A system maintenance toolkit.

Requirements

  • Windows 10/11
  • PowerShell 5.1 or later (pre-installed on Windows 10/11)
  • Go 1.24+ (for building TUI tools)

Installation

Quick Install (One-Liner)

Recommended: Run this single command in PowerShell:

iwr -useb https://raw.githubusercontent.com/tw93/Mole/windows/quick-install.ps1 | iex

This will automatically download and install Mole with PATH configuration.

Manual Installation

If you prefer to review the code first or customize the installation:

# Clone the repository
git clone https://github.com/tw93/Mole.git
cd Mole

# Switch to windows branch
git checkout windows

# Run the installer
.\install.ps1 -AddToPath

# Optional: Create Start Menu shortcut
.\install.ps1 -AddToPath -CreateShortcut

# Optional: Custom install location
.\install.ps1 -InstallDir C:\Tools\Mole -AddToPath

Uninstall

.\install.ps1 -Uninstall

Usage

# Interactive menu
mole

# Show help
mole -ShowHelp

# Show version
mole -Version

# Commands
mole clean              # Deep system cleanup
mole clean -DryRun      # Preview cleanup without deleting
mole uninstall          # Interactive app uninstaller
mole optimize           # System optimization
mole purge              # Clean developer artifacts
mole analyze            # Disk space analyzer
mole status             # System health monitor

Commands

Command Description
clean Deep cleanup of temp files, caches, and logs
uninstall Interactive application uninstaller
optimize System optimization and health checks
purge Clean project build artifacts (node_modules, etc.)
analyze Interactive disk space analyzer (TUI)
status Real-time system health monitor (TUI)

Environment Variables

Variable Description
MOLE_DRY_RUN=1 Preview changes without making them
MOLE_DEBUG=1 Enable debug output
MO_ANALYZE_PATH Starting path for analyze tool

Directory Structure

windows/
β”œβ”€β”€ mole.ps1          # Main CLI entry point
β”œβ”€β”€ install.ps1       # Windows installer
β”œβ”€β”€ Makefile          # Build automation for Go tools
β”œβ”€β”€ go.mod            # Go module definition
β”œβ”€β”€ go.sum            # Go dependencies
β”œβ”€β”€ bin/
β”‚   β”œβ”€β”€ clean.ps1     # Deep cleanup orchestrator
β”‚   β”œβ”€β”€ uninstall.ps1 # Interactive app uninstaller
β”‚   β”œβ”€β”€ optimize.ps1  # System optimization
β”‚   β”œβ”€β”€ purge.ps1     # Project artifact cleanup
β”‚   β”œβ”€β”€ analyze.ps1   # Disk analyzer wrapper
β”‚   └── status.ps1    # Status monitor wrapper
β”œβ”€β”€ cmd/
β”‚   β”œβ”€β”€ analyze/      # Disk analyzer (Go TUI)
β”‚   β”‚   └── main.go
β”‚   └── status/       # System status (Go TUI)
β”‚       └── main.go
└── lib/
    β”œβ”€β”€ core/
    β”‚   β”œβ”€β”€ base.ps1      # Core definitions and utilities
    β”‚   β”œβ”€β”€ common.ps1    # Common functions loader
    β”‚   β”œβ”€β”€ file_ops.ps1  # Safe file operations
    β”‚   β”œβ”€β”€ log.ps1       # Logging functions
    β”‚   └── ui.ps1        # Interactive UI components
    └── clean/
        β”œβ”€β”€ user.ps1      # User cleanup (temp, downloads, etc.)
        β”œβ”€β”€ caches.ps1    # Browser and app caches
        β”œβ”€β”€ dev.ps1       # Developer tool caches
        β”œβ”€β”€ apps.ps1      # Application leftovers
        └── system.ps1    # System cleanup (requires admin)

Building TUI Tools

The analyze and status commands require Go to be installed:

cd windows

# Build both tools
make build

# Or build individually
go build -o bin/analyze.exe ./cmd/analyze/
go build -o bin/status.exe ./cmd/status/

# The wrapper scripts will auto-build if Go is available

Configuration

Mole stores its configuration in:

  • Config: ~\.config\mole\
  • Cache: ~\.cache\mole\
  • Whitelist: ~\.config\mole\whitelist.txt
  • Purge paths: ~\.config\mole\purge_paths.txt

Development Phases

Phase 1: Core Infrastructure βœ…

  • install.ps1 - Windows installer
  • mole.ps1 - Main CLI entry point
  • lib/core/* - Core utility libraries

Phase 2: Cleanup Features βœ…

  • bin/clean.ps1 - Deep cleanup orchestrator
  • bin/uninstall.ps1 - App removal with leftover detection
  • bin/optimize.ps1 - System optimization
  • bin/purge.ps1 - Project artifact cleanup
  • lib/clean/* - Cleanup modules

Phase 3: TUI Tools βœ…

  • cmd/analyze/ - Disk usage analyzer (Go)
  • cmd/status/ - Real-time system monitor (Go)
  • bin/analyze.ps1 - Analyzer wrapper
  • bin/status.ps1 - Status wrapper

Phase 4: Testing & CI (Planned)

  • tests/ - Pester tests
  • GitHub Actions workflows
  • scripts/build.ps1 - Build automation

License

Same license as the main Mole project.