mirror of
https://github.com/tw93/Mole.git
synced 2026-02-16 17:00:17 +00:00
Merge branch 'windows' into windows
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -14,3 +14,8 @@ bin/*.exe
|
||||
# Test artifacts
|
||||
*.test
|
||||
coverage.out
|
||||
|
||||
# Main branch specific files
|
||||
ANTIGRAVITY.md
|
||||
CLAUDE.md
|
||||
windows-readme-update.md
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 309 KiB After Width: | Height: | Size: 325 KiB |
76
README.md
76
README.md
@@ -1,4 +1,5 @@
|
||||
<div align="center">
|
||||
<img src="https://cdn.tw93.fun/pic/cole.png" alt="Mole Logo" width="120" height="120" style="border-radius:50%" />
|
||||
<h1>Mole</h1>
|
||||
<p><em>Deep clean and optimize your Windows.</em></p>
|
||||
</div>
|
||||
@@ -12,9 +13,8 @@
|
||||
<a href="https://t.me/+GclQS9ZnxyI2ODQ1"><img src="https://img.shields.io/badge/chat-Telegram-blueviolet?style=flat-square&logo=Telegram" alt="Telegram"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://cdn.tw93.fun/img/mole.jpeg" alt="Mole - 95.50GB freed" width="1000" />
|
||||
</p>
|
||||
> [!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
|
||||
|
||||
@@ -36,26 +36,33 @@ Mole is designed for Windows 10/11. This is the native Windows version ported fr
|
||||
|
||||
## Quick Start
|
||||
|
||||
Install via PowerShell:
|
||||
### Quick Install (One-Liner)
|
||||
|
||||
**Recommended:** Run this single command in PowerShell:
|
||||
|
||||
```powershell
|
||||
# Download and run installer (recommended)
|
||||
iwr -Uri "https://raw.githubusercontent.com/tw93/mole/windows/install.ps1" -OutFile "$env:TEMP\mole-install.ps1"; & "$env:TEMP\mole-install.ps1" -AddToPath
|
||||
|
||||
# Or install with specific options
|
||||
# -Branch windows for latest code, -Tag v1.17.0 for specific version
|
||||
iwr -Uri "https://raw.githubusercontent.com/tw93/mole/windows/install.ps1" -OutFile "$env:TEMP\mole-install.ps1"; & "$env:TEMP\mole-install.ps1" -AddToPath -CreateShortcut
|
||||
iwr -useb https://raw.githubusercontent.com/tw93/Mole/windows/quick-install.ps1 | iex
|
||||
```
|
||||
|
||||
Or install manually:
|
||||
This will automatically download and install Mole with PATH configuration.
|
||||
|
||||
### Manual Installation
|
||||
|
||||
If you prefer to review the code first or customize the installation:
|
||||
|
||||
```powershell
|
||||
# Clone the repository and checkout windows branch
|
||||
git clone -b windows https://github.com/tw93/Mole.git
|
||||
# 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:
|
||||
@@ -153,6 +160,7 @@ System: 12/32 GB RAM | 280/460 GB Disk (61%) | Uptime 6d
|
||||
✓ Refresh Windows Search index
|
||||
✓ Clear thumbnail cache
|
||||
✓ Optimize startup programs
|
||||
✓ System repairs (Font/Icon/Store/Search)
|
||||
|
||||
====================================================================
|
||||
System optimization completed
|
||||
@@ -242,6 +250,9 @@ Custom scan paths can be configured with `mo purge --paths`.
|
||||
|
||||
# Create Start Menu shortcut
|
||||
.\install.ps1 -AddToPath -CreateShortcut
|
||||
|
||||
# Optional: Custom install location
|
||||
.\install.ps1 -InstallDir C:\Tools\Mole -AddToPath
|
||||
```
|
||||
|
||||
### Uninstall
|
||||
@@ -269,12 +280,12 @@ mole/ (windows branch)
|
||||
├── 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
|
||||
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
|
||||
@@ -320,6 +331,33 @@ go build -o bin/status.exe ./cmd/status/
|
||||
|
||||
## Community Love
|
||||
|
||||
### Phase 1: Core Infrastructure ✅
|
||||
|
||||
- [x] `install.ps1` - Windows installer
|
||||
- [x] `mole.ps1` - Main CLI entry point
|
||||
- [x] `lib/core/*` - Core utility libraries
|
||||
|
||||
### Phase 2: Cleanup Features ✅
|
||||
|
||||
- [x] `bin/clean.ps1` - Deep cleanup orchestrator
|
||||
- [x] `bin/uninstall.ps1` - App removal with leftover detection
|
||||
- [x] `bin/optimize.ps1` - System optimization
|
||||
- [x] `bin/purge.ps1` - Project artifact cleanup
|
||||
- [x] `lib/clean/*` - Cleanup modules
|
||||
|
||||
### Phase 3: TUI Tools ✅
|
||||
|
||||
- [x] `cmd/analyze/` - Disk usage analyzer (Go)
|
||||
- [x] `cmd/status/` - Real-time system monitor (Go)
|
||||
- [x] `bin/analyze.ps1` - Analyzer wrapper
|
||||
- [x] `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! ❤️
|
||||
|
||||
[](https://github.com/tw93/Mole/graphs/contributors)
|
||||
|
||||
@@ -20,6 +20,20 @@ param(
|
||||
[switch]$Whitelist,
|
||||
|
||||
[Alias('h')]
|
||||
|
||||
[Alias('system')]
|
||||
[switch]$System,
|
||||
|
||||
[Alias('game-media')]
|
||||
[switch]$GameMedia,
|
||||
|
||||
[Alias('debug')]
|
||||
[switch]$DebugMode,
|
||||
|
||||
[Alias('whitelist')]
|
||||
[switch]$Whitelist,
|
||||
|
||||
[Alias('help')]
|
||||
[switch]$ShowHelp
|
||||
)
|
||||
|
||||
|
||||
@@ -11,6 +11,11 @@ param(
|
||||
[switch]$DebugMode,
|
||||
|
||||
[Alias('h')]
|
||||
|
||||
[Alias('debug')]
|
||||
[switch]$DebugMode,
|
||||
|
||||
[Alias('help')]
|
||||
[switch]$ShowHelp
|
||||
)
|
||||
|
||||
@@ -52,16 +57,15 @@ function Show-OptimizeHelp {
|
||||
Write-Host " --help Show this help message"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mWhat it does:$esc[0m"
|
||||
Write-Host " - Disk optimization (TRIM for SSD, defrag for HDD)"
|
||||
Write-Host " - DNS cache flush"
|
||||
Write-Host " - Network stack optimization"
|
||||
Write-Host " - Font cache rebuild"
|
||||
Write-Host " - Icon cache rebuild"
|
||||
Write-Host " - Windows Search optimization"
|
||||
Write-Host " - Windows Store cache reset"
|
||||
Write-Host " - Startup program analysis"
|
||||
Write-Host " - Disk health check"
|
||||
Write-Host " - Windows Update status"
|
||||
Write-Host " - Disk optimization (TRIM/Defrag)"
|
||||
Write-Host " - Windows Search & Update check"
|
||||
Write-Host " - Network & DNS optimization"
|
||||
Write-Host " - System cache cleanup & repairs"
|
||||
Write-Host " (Font cache, Icon cache, Store cache)"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mExamples:$esc[0m"
|
||||
Write-Host " mo optimize # Run all optimizations"
|
||||
Write-Host " mo optimize --dry-run # Preview what would happen"
|
||||
Write-Host ""
|
||||
Write-Host "$esc[33mExamples:$esc[0m"
|
||||
Write-Host " mo optimize # Run all optimizations"
|
||||
@@ -706,6 +710,10 @@ function Show-OptimizeSummary {
|
||||
else {
|
||||
Write-Host " Optimizations applied: $esc[32m$($script:OptimizationsApplied)$esc[0m"
|
||||
|
||||
if ($script:RepairsApplied -gt 0) {
|
||||
Write-Host " Repairs applied: $esc[32m$($script:RepairsApplied)$esc[0m"
|
||||
}
|
||||
|
||||
if ($script:IssuesFixed -gt 0) {
|
||||
Write-Host " Issues fixed: $esc[32m$($script:IssuesFixed)$esc[0m"
|
||||
}
|
||||
@@ -763,17 +771,29 @@ function Main {
|
||||
Clear-DnsCache
|
||||
Optimize-Network
|
||||
|
||||
# Run cache rebuilds (repairs integrated into optimize)
|
||||
Repair-FontCache
|
||||
Repair-IconCache
|
||||
Optimize-SearchIndex
|
||||
Repair-StoreCache
|
||||
|
||||
# Run health checks
|
||||
Get-StartupPrograms
|
||||
Test-DiskHealth
|
||||
Test-WindowsUpdate
|
||||
|
||||
# Run repairs (consolidated)
|
||||
Write-Host ""
|
||||
Write-Host "$esc[34m$($script:Icons.Arrow) System Repairs$esc[0m"
|
||||
|
||||
Repair-FontCache
|
||||
Repair-StoreCache
|
||||
Repair-SearchIndex
|
||||
Repair-IconCache
|
||||
|
||||
# System file check is slow, ask first
|
||||
if (-not $script:DryRun -and (Test-IsAdmin)) {
|
||||
Write-Host ""
|
||||
$runSfc = Read-Host "Run System File Checker? This may take several minutes (y/N)"
|
||||
if ($runSfc -eq 'y' -or $runSfc -eq 'Y') {
|
||||
Test-SystemFiles
|
||||
}
|
||||
}
|
||||
|
||||
# Summary
|
||||
Show-OptimizeSummary
|
||||
}
|
||||
|
||||
@@ -11,6 +11,13 @@ param(
|
||||
[switch]$Paths,
|
||||
|
||||
[Alias('h')]
|
||||
[Alias('debug')]
|
||||
[switch]$DebugMode,
|
||||
|
||||
[Alias('paths')]
|
||||
[switch]$Paths,
|
||||
|
||||
[Alias('help')]
|
||||
[switch]$ShowHelp
|
||||
)
|
||||
|
||||
|
||||
36
mole.ps1
36
mole.ps1
@@ -60,12 +60,12 @@ function Show-MainHelp {
|
||||
Write-Host ""
|
||||
Write-Host " ${green}COMMANDS:${nc}"
|
||||
Write-Host ""
|
||||
Write-Host " ${cyan}clean${nc} Deep system cleanup (caches, temp, logs)"
|
||||
Write-Host " ${cyan}clean${nc} Deep system cleanup"
|
||||
Write-Host " ${cyan}uninstall${nc} Smart application uninstaller"
|
||||
Write-Host " ${cyan}analyze${nc} Visual disk space analyzer"
|
||||
Write-Host " ${cyan}status${nc} Real-time system monitor"
|
||||
Write-Host " ${cyan}optimize${nc} System optimization and repairs"
|
||||
Write-Host " ${cyan}purge${nc} Clean project build artifacts"
|
||||
Write-Host " ${cyan}analyze${nc} Disk space analyzer"
|
||||
Write-Host " ${cyan}status${nc} System monitor"
|
||||
Write-Host " ${cyan}purge${nc} Clean project artifacts"
|
||||
Write-Host ""
|
||||
Write-Host " ${green}OPTIONS:${nc}"
|
||||
Write-Host ""
|
||||
@@ -83,6 +83,12 @@ function Show-MainHelp {
|
||||
Write-Host " ${gray}mo optimize${nc} ${gray}# Optimize system (includes repairs)${nc}"
|
||||
Write-Host " ${gray}mo optimize --dry-run${nc} ${gray}# Preview optimizations${nc}"
|
||||
Write-Host " ${gray}mo purge${nc} ${gray}# Clean dev artifacts${nc}"
|
||||
Write-Host " ${gray}mo${nc} ${gray}# Interactive menu${nc}"
|
||||
Write-Host " ${gray}mo clean${nc} ${gray}# Deep cleanup${nc}"
|
||||
Write-Host " ${gray}mo clean --dry-run${nc} ${gray}# Preview cleanup${nc}"
|
||||
Write-Host " ${gray}mo optimize${nc} ${gray}# Optimize system${nc}"
|
||||
Write-Host " ${gray}mo optimize --dry-run${nc} ${gray}# Preview optimization${nc}"
|
||||
Write-Host " ${gray}mo uninstall${nc} ${gray}# Uninstall apps${nc}"
|
||||
Write-Host ""
|
||||
Write-Host " ${green}ENVIRONMENT:${nc}"
|
||||
Write-Host ""
|
||||
@@ -105,6 +111,12 @@ function Show-MainMenu {
|
||||
Command = "clean"
|
||||
Icon = $script:Icons.Trash
|
||||
}
|
||||
@{
|
||||
Name = "Optimize"
|
||||
Description = "Optimization & repairs"
|
||||
Command = "optimize"
|
||||
Icon = $script:Icons.Arrow
|
||||
}
|
||||
@{
|
||||
Name = "Uninstall"
|
||||
Description = "Remove applications"
|
||||
@@ -123,12 +135,6 @@ function Show-MainMenu {
|
||||
Command = "status"
|
||||
Icon = $script:Icons.Solid
|
||||
}
|
||||
@{
|
||||
Name = "Optimize"
|
||||
Description = "Optimization & repairs"
|
||||
Command = "optimize"
|
||||
Icon = $script:Icons.Arrow
|
||||
}
|
||||
@{
|
||||
Name = "Purge"
|
||||
Description = "Clean dev artifacts"
|
||||
@@ -161,7 +167,7 @@ function Invoke-MoleCommand {
|
||||
if (-not (Test-Path $scriptPath)) {
|
||||
Write-MoleError "Unknown command: $CommandName"
|
||||
Write-Host ""
|
||||
Write-Host "Run 'mole -ShowHelp' for available commands"
|
||||
Write-Host "Run 'mo --help' for available commands"
|
||||
return
|
||||
}
|
||||
|
||||
@@ -177,13 +183,13 @@ function Invoke-MoleCommand {
|
||||
# Remove surrounding quotes if present
|
||||
$cleanArg = $arg.Trim("'`"")
|
||||
|
||||
if ($cleanArg -match '^-(\w+)$') {
|
||||
# It's a switch parameter (e.g., -DryRun)
|
||||
if ($cleanArg -match '^-{1,2}([\w-]+)$') {
|
||||
# It's a switch parameter (e.g., -DryRun or --dry-run)
|
||||
$paramName = $Matches[1]
|
||||
$splatParams[$paramName] = $true
|
||||
}
|
||||
elseif ($cleanArg -match '^-(\w+)[=:](.+)$') {
|
||||
# It's a named parameter with value (e.g., -Name=Value or -Name:Value)
|
||||
elseif ($cleanArg -match '^-{1,2}([\w-]+)[=:](.+)$') {
|
||||
# It's a named parameter with value (e.g., --name=value)
|
||||
$paramName = $Matches[1]
|
||||
$paramValue = $Matches[2].Trim("'`"")
|
||||
$splatParams[$paramName] = $paramValue
|
||||
|
||||
87
quick-install.ps1
Normal file
87
quick-install.ps1
Normal file
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env pwsh
|
||||
# Mole Quick Installer for Windows
|
||||
# One-liner install: iwr -useb https://raw.githubusercontent.com/tw93/Mole/windows/quick-install.ps1 | iex
|
||||
|
||||
#Requires -Version 5.1
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
# Colors
|
||||
$ESC = [char]27
|
||||
$Colors = @{
|
||||
Green = "$ESC[32m"
|
||||
Yellow = "$ESC[33m"
|
||||
Cyan = "$ESC[36m"
|
||||
Red = "$ESC[31m"
|
||||
NC = "$ESC[0m"
|
||||
}
|
||||
|
||||
function Write-Step {
|
||||
param([string]$Message)
|
||||
Write-Host " $($Colors.Cyan)→$($Colors.NC) $Message"
|
||||
}
|
||||
|
||||
function Write-Success {
|
||||
param([string]$Message)
|
||||
Write-Host " $($Colors.Green)✓$($Colors.NC) $Message"
|
||||
}
|
||||
|
||||
function Write-ErrorMsg {
|
||||
param([string]$Message)
|
||||
Write-Host " $($Colors.Red)✗$($Colors.NC) $Message"
|
||||
}
|
||||
|
||||
# Main installation
|
||||
try {
|
||||
Write-Host ""
|
||||
Write-Host " $($Colors.Cyan)Mole Quick Installer$($Colors.NC)"
|
||||
Write-Host " $($Colors.Yellow)Installing experimental Windows version...$($Colors.NC)"
|
||||
Write-Host ""
|
||||
|
||||
# Check prerequisites
|
||||
Write-Step "Checking prerequisites..."
|
||||
|
||||
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
|
||||
Write-ErrorMsg "Git is not installed. Please install Git first:"
|
||||
Write-Host " https://git-scm.com/download/win"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Success "Git found"
|
||||
|
||||
# Create temp directory
|
||||
$TempDir = Join-Path $env:TEMP "mole-install-$(Get-Random)"
|
||||
Write-Step "Downloading Mole..."
|
||||
|
||||
# Clone windows branch
|
||||
git clone --quiet --depth 1 --branch windows https://github.com/tw93/Mole.git $TempDir 2>&1 | Out-Null
|
||||
|
||||
if (-not (Test-Path "$TempDir\install.ps1")) {
|
||||
Write-ErrorMsg "Failed to download installer"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Success "Downloaded to temp directory"
|
||||
|
||||
# Run installer
|
||||
Write-Step "Running installer..."
|
||||
Write-Host ""
|
||||
|
||||
& "$TempDir\install.ps1" -AddToPath
|
||||
|
||||
Write-Host ""
|
||||
Write-Success "Installation complete!"
|
||||
Write-Host ""
|
||||
Write-Host " Run ${Colors.Green}mole$($Colors.NC) to get started"
|
||||
Write-Host ""
|
||||
|
||||
} catch {
|
||||
Write-ErrorMsg "Installation failed: $_"
|
||||
exit 1
|
||||
} finally {
|
||||
# Cleanup
|
||||
if (Test-Path $TempDir) {
|
||||
Remove-Item $TempDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user