1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 17:55:08 +00:00
Bhadra 3bd2869e8d feat: Add Windows package manager publishing infrastructure (#343) (#356)
* feat: Add Windows package manager publishing infrastructure (#343)

- Add comprehensive release build scripts:
  - build-release.ps1: Creates portable ZIP + SHA256 checksums
  - build-exe.ps1: Standalone executable builder (PS2EXE)
  - build-msi.ps1: MSI installer builder (WiX Toolset)

- Add GitHub Actions workflow:
  - Automated builds on version tags
  - Runs tests before building
  - Auto-creates GitHub releases with artifacts

- Add package manager manifests:
  - WinGet: Complete manifests ready for microsoft/winget-pkgs
  - Chocolatey: Full package with install/uninstall scripts
  - Scoop: JSON manifest ready for submission

- Add comprehensive documentation:
  - RELEASE.md: Complete guide for building and publishing
  - Package-specific READMEs with submission instructions
  - ISSUE-343-SUMMARY.md: Quick reference and next steps

Successfully tested: Built mole-1.0.0-x64.zip (5 MB) with SHA256 checksums

Addresses #343

* chore: update contributors [skip ci]

* fix: Support uppercase V and -windows suffix in release workflow

* fix: Remove duplicate parameter definitions in clean, optimize, and purge commands

- bin/clean.ps1: Remove duplicate System, GameMedia, DebugMode, Whitelist params
- bin/optimize.ps1: Remove duplicate DebugMode param
- bin/purge.ps1: Remove duplicate DebugMode and Paths params

These duplicates were causing parser errors in tests.

* fix: Update test regex to match --dry-run format in help text

The help output shows --dry-run (kebab-case) but test was checking for DryRun (PascalCase).
Updated regex to accept both formats.

* fix: Handle Pester 5.x result object properties correctly

Pester 5.x uses different property names (Passed.Count, Failed.Count)
instead of PassedCount, FailedCount. Added fallback logic to support both formats.

* fix: Simplify Pester result parsing with better fallback logic

Since Pester already prints test results, just check for failures
and assume success if we can't parse the result object. This handles
different Pester versions more gracefully.

* feat: Add MSI and EXE builds to release workflow

- Install WiX Toolset for MSI creation
- Install PS2EXE module for standalone EXE
- Build all three formats: ZIP, MSI, EXE
- MSI and EXE builds marked optional (continue-on-error)
- Upload all artifacts to GitHub release
- Update release notes with installation instructions for all formats
- Add SHA256 verification instructions for each format

* fix: Resolve MSI and EXE build failures

MSI build fix:
- Use UTF8 without BOM for temp WXS file to avoid XML parsing errors
- WiX compiler requires clean UTF8 encoding without byte order mark

EXE build fix:
- Remove hashtable iteration that modified collection during enumeration
- Exclude null iconFile parameter from ps2exe params instead of removing it
- Prevents 'Collection was modified' exception

* fix: Properly handle encoding and version format for MSI and EXE builds

MSI fix:
- Use System.IO.File.ReadAllText/WriteAllText for consistent UTF8 without BOM
- Prevents XML parsing errors in WiX compiler

EXE fix:
- Extract numeric version only (strip '-windows' suffix) for ps2exe
- ps2exe requires version in format n.n.n.n (numeric only)
- Fallback to 1.0.0.0 if version parsing fails

* fix: Use WriteAllBytes to ensure no BOM in MSI WXS file

- Convert string to UTF8 bytes manually
- Write bytes directly to file
- This guarantees no byte order mark is added
- Prevents WiX XML parsing error at position 7

* fix: Read WXS source as bytes to completely avoid BOM issues

- Read source file as raw bytes
- Convert bytes to string using UTF8Encoding without BOM
- Replace version in string
- Convert back to bytes and write
- This completely avoids PowerShell's Get-Content BOM handling

* chore: Simplify release workflow - remove MSI build, minimal release notes

- Remove MSI build steps (has persistent BOM/encoding issues)
- Remove WiX Toolset installation
- Simplify release notes to bare minimum
- Focus on ZIP and EXE artifacts only

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-01-24 00:08:24 +08:00
2025-10-12 20:49:10 +08:00
2026-01-08 10:20:42 +02:00
2025-12-06 00:18:57 +08:00
2025-09-23 14:35:26 +08:00
2026-01-16 12:54:40 +05:30

Mole Logo

Mole

Deep clean and optimize your Windows.

Stars Version License Commits Twitter Telegram

Warning

Experimental Status: The Windows version is currently not mature. If your computer is critical or contains important data, please do not use this tool.

Features

  • All-in-one toolkit: CCleaner, IObit Uninstaller, WinDirStat, and Task Manager combined into a single PowerShell toolkit
  • Deep cleaning: Scans and removes temp files, caches, and browser leftovers to reclaim gigabytes of space
  • Smart uninstaller: Thoroughly removes apps along with AppData, preferences, and hidden remnants
  • Disk insights: Visualizes usage, manages large files, and refreshes system services
  • Live monitoring: Real-time stats for CPU, memory, disk, and network to diagnose performance issues

Platform Support

Mole is designed for Windows 10/11. This is the native Windows version ported from the macOS original. For macOS users, please visit the main branch for the native macOS version.

Requirements

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

Quick Start

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

Run:

mo                       # Interactive menu
mo clean                 # Deep cleanup
mo uninstall             # Remove apps + leftovers
mo optimize              # Refresh caches & services
mo analyze               # Visual disk explorer
mo status                # Live system health dashboard
mo purge                 # Clean project build artifacts

mo --help                # Show help
mo --version             # Show installed version

mo clean --dry-run       # Preview the cleanup plan
mo clean --whitelist     # Manage protected caches
mo clean --dry-run --debug # Detailed preview with risk levels

mo optimize --dry-run    # Preview optimization actions
mo optimize --debug      # Run with detailed operation logs
mo purge --paths         # Configure project scan directories

Tips

  • Safety: Built with strict protections. Preview changes with mo clean --dry-run.
  • Be Careful: Although safe by design, file deletion is permanent. Please review operations carefully.
  • Debug Mode: Use --debug for detailed logs (e.g., mo clean --debug). Combine with --dry-run for comprehensive preview including risk levels and file details.
  • Navigation: Supports arrow keys for TUI navigation.
  • Configuration: Use mo clean --whitelist to manage protected paths, mo purge --paths to configure scan directories.

Features in Detail

Deep System Cleanup

mo clean
Scanning cache directories...

  ✓ User temp files                              12.3GB
  ✓ Browser cache (Chrome, Edge, Firefox)         8.5GB
  ✓ Developer tools (Node.js, npm, Python)       15.2GB
  ✓ Windows logs and temp files                   4.1GB
  ✓ App-specific cache (Spotify, Slack, VS Code)  6.8GB
  ✓ Recycle Bin                                    9.2GB

====================================================================
Space freed: 56.1GB | Free space now: 180.3GB
====================================================================

Smart App Uninstaller

mo uninstall
Select Apps to Remove
═══════════════════════════
▶ ☑ Adobe Photoshop 2024     (4.2GB) | Old
  ☐ IntelliJ IDEA             (2.8GB) | Recent
  ☐ Premiere Pro              (3.4GB) | Recent

Uninstalling: Adobe Photoshop 2024

  ✓ Removed application
  ✓ Cleaned 52 related files across 8 locations
    - AppData, Caches, Preferences
    - Logs, Registry entries
    - Extensions, Plugins

====================================================================
Space freed: 4.8GB
====================================================================

System Optimization

mo optimize
System: 12/32 GB RAM | 280/460 GB Disk (61%) | Uptime 6d

  ✓ Clear Windows Update cache
  ✓ Reset DNS cache
  ✓ Clean event logs and diagnostic reports
  ✓ Refresh Windows Search index
  ✓ Clear thumbnail cache
  ✓ Optimize startup programs
  ✓ System repairs (Font/Icon/Store/Search)

====================================================================
System optimization completed
====================================================================

Disk Space Analyzer

mo analyze
Analyze Disk  C:\Users\YourName\Documents  |  Total: 156.8GB

 ▶  1. ███████████████████  48.2%  |  📁 Downloads           75.4GB  >6mo
    2. ██████████░░░░░░░░░  22.1%  |  📁 Videos              34.6GB
    3. ████░░░░░░░░░░░░░░░  14.3%  |  📁 Pictures            22.4GB
    4. ███░░░░░░░░░░░░░░░░  10.8%  |  📁 Documents           16.9GB
    5. ██░░░░░░░░░░░░░░░░░   5.2%  |  📄 backup_2023.zip      8.2GB

  ↑↓←→ Navigate  |  O Open  |  F Show  |  Del Delete  |  L Large files  |  Q Quit

Live System Status

Real-time dashboard with system health score, hardware info, and performance metrics.

mo status
Mole Status  Health ● 92  Desktop PC · Intel i7 · 32GB · Windows 11

⚙ CPU                                    ▦ Memory
Total   ████████████░░░░░░░ 45.2%       Used    ███████████░░░░░░░  58.4%
Load    0.82 / 1.05 / 1.23 (8 cores)    Total   18.7 / 32.0 GB
Core 1  ███████████████░░░░  78.3%      Free    ████████░░░░░░░░░░  41.6%
Core 2  ████████████░░░░░░░  62.1%      Avail   13.3 GB

▤ Disk                                   ⚡ Power
Used    █████████████░░░░░░  67.2%      Status  AC Power
Free    156.3 GB                         Temp    58°C
Read    ▮▯▯▯▯  2.1 MB/s
Write   ▮▮▮▯▯  18.3 MB/s

⇅ Network                                ▶ Processes
Down    ▮▮▯▯▯  3.2 MB/s                 Code       ▮▮▮▮▯  42.1%
Up      ▮▯▯▯▯  0.8 MB/s                 Chrome     ▮▮▮▯▯  28.3%

Health score based on CPU, memory, disk, temperature, and I/O load. Color-coded by range.

Project Artifact Purge

Clean old build artifacts (node_modules, target, build, dist, etc.) from your projects to free up disk space.

mo purge
Select Categories to Clean - 18.5GB (8 selected)

➤ ● my-react-app      3.2GB | node_modules
  ● old-project       2.8GB | node_modules
  ● rust-app          4.1GB | target
  ● next-blog         1.9GB | node_modules
  ○ current-work      856MB | node_modules  | Recent
  ● django-api        2.3GB | venv
  ● vue-dashboard     1.7GB | node_modules
  ● backend-service   2.5GB | node_modules

Use with caution: This will permanently delete selected artifacts. Review carefully before confirming. Recent projects — less than 7 days old — are marked and unselected by default.

Custom scan paths can be configured with mo purge --paths.

Installation Options

Manual Installation

# Install to custom location
.\install.ps1 -InstallDir C:\Tools\Mole -AddToPath

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

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

Uninstall

.\install.ps1 -Uninstall

Configuration

Mole stores its configuration in:

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

Directory Structure

mole/ (windows branch)
├── 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/
301: │   ├── clean.ps1     # Deep cleanup orchestrator
302: │   ├── uninstall.ps1 # Interactive app uninstaller
303: │   ├── optimize.ps1  # System optimization
304: │   ├── purge.ps1     # Project artifact cleanup
305: │   ├── analyze.ps1   # Disk analyzer wrapper
306: │   └── 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:

# From the repository root

# 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

Support

  • If Mole saved you disk space, consider starring the repo or sharing it with friends.
  • Have ideas or fixes? Check our Contributing Guide, then open an issue or PR to help shape Mole's future.
  • Love Mole? Buy Tw93 an ice-cold Coke to keep the project alive and kicking! 🥤

Community Love

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

Mole wouldn't be possible without these amazing contributors. They've built countless features that make Mole what it is today. Go follow them! ❤️

Contributors

Join thousands of users worldwide who trust Mole to keep their systems clean and optimized.

License

MIT License — feel free to enjoy and participate in open source.

Languages
Shell 80.4%
Go 19.5%
Makefile 0.1%