Skip to content

Zhihong0321/better-wsl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Better WSL ๐Ÿš€

For Windows users: A far better WSL to run AI Coding CLI tools natively
Built for AI-powered coding workflows with intelligent multi-session management, smart paste handling, and advanced customization.

Windows 11 WSL 2 Node.js SolidJS


๐Ÿš€ Quick Start - Get Your Windows 11 Ready

Run SETUP.bat to set up Better WSL on your Windows 11

# Simply double-click setup.bat or run in PowerShell:
.\setup.bat

What happens:

  1. โœ… Launches standalone setup wizard on port 5174
  2. โœ… Detects/installs WSL distros (Fedora, Ubuntu, Debian)
  3. โœ… Configures development environment automatically
  4. โœ… Installs Node.js, npm, and essential tools
  5. โœ… Ready to use in minutes!

๐Ÿ’ก First time on Windows 11? setup.bat handles everything - no prerequisites needed!


๐Ÿ“ธ Screenshots

Multi-Session Terminal in Action

Better WSL Interface Multi-session terminals with AI coding workflow, sidebar navigation, and real-time Git integration


๐ŸŽฏ Why Better WSL?

Modern AI coding tools like Aider, Cursor, Claude, and GitHub Copilot require seamless terminal interaction. Better WSL eliminates friction by providing:

โœจ Smart clipboard handling - Paste images directly as base64
โšก Configurable shortcuts - Remap keys to match your workflow
๐ŸŽจ Multi-session terminals - Work on multiple projects simultaneously
๐Ÿ”ง One-click WSL setup - Initialize your dev environment in minutes
๐ŸŒ Git integration - Time-travel through commits visually
๐Ÿ“Š Auto-Pilot mode - Coordinate multiple AI agents for complex tasks


๐ŸŒŸ Key Features

๐Ÿ–ฅ๏ธ Advanced Terminal Management

  • Multi-session support - Run unlimited WSL terminals in tabs
  • Smart paste inserter - Paste images/code with preview before sending
  • Configurable keyboard shortcuts:
    • Shift+Enter โ†’ New line in AI CLIs (remappable to Ctrl+Enter or Alt+Enter)
    • Ctrl+C โ†’ Copy text OR cancel process (your choice)
    • Ctrl+End โ†’ Dedicated cancel key when Ctrl+C is set to copy
  • Session activity tracking - Visual indicators for running/waiting states
  • Auto-session detection - Resumes last session on startup

๐ŸŽจ Smart Clipboard Manager

  • Image paste support - Drag/drop or paste images (up to 45MB)
  • Base64 auto-encoding - Perfect for AI CLI tools
  • Text sanitization - Prevents accidental command execution
  • Rich preview - See images/text before sending to terminal

๐Ÿ”ง WSL Setup Wizard

  • One-click initialization - Launch setup.bat and follow the guide
  • Cross-distro support - Works with Fedora, Ubuntu, Debian
  • Auto package manager detection - Uses dnf or apt automatically
  • Essential tools installer:
    • โœ… Node.js (via fnm)
    • โœ… npm with global packages
    • โœ… sudo, curl, unzip
    • โœ… Git configuration
  • Progress tracking - Real-time feedback during installation

๐ŸŒ Git Time Travel

  • Visual commit history - Browse commits with one click
  • Instant checkout - Jump to any commit in your timeline
  • Branch tracking - See current branch and remote status
  • Quick commits - Commit from the sidebar instantly

๐Ÿค– Auto-Pilot Mode (Experimental)

  • Dual-agent coordination - Planner + Coder working together
  • Task delegation - Planner instructs Coder via terminal
  • Real-time communication - Watch agents collaborate

โš™๏ธ WSL Distribution Management

  • List all distros - See installed distributions and their status
  • Set default - Change which distro launches by default
  • Terminate processes - Stop running distributions safely
  • Update WSL - One-click WSL version updates

๐Ÿ“ File System Integration

  • Import from Windows - Browse PC drives and mount folders
  • Workspace management - Organized ~/better-cli-workspace structure
  • File explorer per session - Browse files within each terminal
  • Symlink mounting - Fast, efficient folder sharing

๐Ÿš€ Quick Start

Prerequisites

  • Windows 11 with WSL 2 enabled
  • Node.js 18+ installed on Windows
  • Git (optional, for version control features)

Don't have WSL? No problem! Use our setup wizard (see below).

Installation

# Clone the repository
git clone https://github.com/your-username/better-cli.git
cd better-cli

# Install dependencies
cd server && npm install
cd ../client && npm install

๐ŸŽฏ Launch (Recommended)

Double-click one of these files:

File Description Use When
start-silent.vbs โญ Silent background launch Daily use (no windows)
start.bat Shows server logs Debugging issues
start.ps1 PowerShell with colors You prefer PowerShell

Browser opens automatically at http://localhost:5173 ๐ŸŽ‰

To stop: Double-click stop.bat

Tip: Run create-desktop-shortcut.bat to add a desktop icon!


๐Ÿ”ง First-Time WSL Setup

Don't have WSL or essential tools? No worries!

  1. Run the setup wizard:

    setup.bat
  2. Select your WSL distribution (or install one from Microsoft Store)

  3. Click "Start Setup" and wait ~5 minutes

  4. Done! Node.js, npm, curl, and sudo are now installed

๐Ÿ“– Detailed guide: SETUP_README.md


โŒจ๏ธ Keyboard Shortcuts

Terminal

  • Shift+Enter (default) โ†’ New line in AI CLIs (remappable in Settings)
  • Ctrl+C โ†’ Copy selection OR Cancel process (configurable)
  • Ctrl+End (default) โ†’ Cancel/Interrupt when Ctrl+C = Copy
  • Paste โ†’ Opens smart paste inserter with preview

Navigation

  • Tabs โ†’ Switch between Sessions, Clipboard, Tools, Settings
  • Ctrl+Click โ†’ Open file browser for a session

๐Ÿ—๏ธ Architecture

Tech Stack

Frontend:

Backend:

Project Structure

better-cli/
โ”œโ”€โ”€ client/                    # SolidJS frontend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ App.tsx           # Main application shell
โ”‚   โ”‚   โ”œโ”€โ”€ Terminal.tsx      # Terminal component with xterm.js
โ”‚   โ”‚   โ”œโ”€โ”€ Sidebar.tsx       # Navigation and session list
โ”‚   โ”‚   โ”œโ”€โ”€ ClipboardManager.tsx  # Smart paste handler
โ”‚   โ”‚   โ”œโ”€โ”€ Setup.tsx         # WSL initialization wizard
โ”‚   โ”‚   โ”œโ”€โ”€ Settings.tsx      # WSL & keyboard settings
โ”‚   โ”‚   โ”œโ”€โ”€ FileBrowser.tsx   # Windows drive browser
โ”‚   โ”‚   โ”œโ”€โ”€ AutoPilot.tsx     # Dual-agent coordination
โ”‚   โ”‚   โ””โ”€โ”€ components/       # Reusable UI components
โ”‚   โ”œโ”€โ”€ setup.html            # Standalone setup entry point
โ”‚   โ””โ”€โ”€ vite.config.ts        # Multi-page Vite config
โ”‚
โ”œโ”€โ”€ server/                    # Node.js backend
โ”‚   โ”œโ”€โ”€ index.js              # Main Express server + Socket.IO
โ”‚   โ”œโ”€โ”€ setup-server.js       # Dedicated setup API (port 3001)
โ”‚   โ””โ”€โ”€ public/               # Static assets
โ”‚
โ”œโ”€โ”€ setup.bat                  # Standalone WSL setup launcher
โ”œโ”€โ”€ start-silent.vbs           # Silent application launcher
โ”œโ”€โ”€ start.bat                  # Standard launcher with logs
โ”œโ”€โ”€ stop.bat                   # Graceful shutdown
โ””โ”€โ”€ create-desktop-shortcut.bat # Desktop icon creator

๐ŸŽฏ Use Cases

๐Ÿค– AI-Powered Coding

Perfect for developers using:

Why Better WSL?

  • โœ… Paste images directly as base64 (for Claude, Gemini, GPT-4V)
  • โœ… Shift+Enter for multi-line prompts (no accidental sends)
  • โœ… Multi-session = work on multiple projects with different AI contexts

๐Ÿ’ป Multi-Project Development

  • Run frontend dev server in Session 1
  • Run backend API in Session 2
  • Run database in Session 3
  • All in one organized interface

๐Ÿ“ฆ DevOps & Tooling

  • Manage tools via UI instead of memorizing commands
  • One-click tool installation across projects
  • Cross-distro support (Fedora, Ubuntu, Debian)

๐Ÿ“š Documentation

Getting Started

Features

Architecture


๐Ÿ› Troubleshooting

WSL not detected

Symptoms: "WSL not installed" message on startup

Solutions:

# Check if WSL is installed
wsl --version

# Install WSL (PowerShell as Admin)
wsl --install

# List installed distributions
wsl --list --verbose

# Set default distro (if you have multiple)
wsl --set-default Ubuntu

Still not working? Run setup.bat for guided installation.

Port already in use

Symptoms: "EADDRINUSE" error when starting

Solutions:

# Check what's using port 3000
netstat -ano | findstr :3000

# Kill the process (replace PID)
taskkill /PID <process-id> /F

# Or change ports:
# Server: Edit server/index.js (line ~2300)
# Client: Edit client/vite.config.ts
Keyboard shortcuts not working

Symptoms: Shift+Enter doesn't create newline

Explanation:
Keyboard shortcuts are CLI-dependent. Most AI CLIs use Alt+Enter by default.

Solution:

  1. Open Settings (โš™๏ธ icon)
  2. Under "Terminal Behavior" โ†’ "New line shortcut"
  3. Try different combinations:
    • Alt+Enter (works with Gemini, Codex)
    • Shift+Enter (user preference)
    • Ctrl+Enter (alternative)

Better WSL translates your chosen key to Alt+Enter internally.

Images not pasting in terminal

Symptoms: Paste doesn't show preview dialog

Cause: You're pasting directly in terminal. Better WSL intercepts paste for safety.

Solution:

  1. Use the Clipboard Manager (๐Ÿ“‹ tab)
  2. Paste image there โ†’ preview appears
  3. Click "Insert into Terminal"
  4. Image is sent as base64

Why? Prevents accidental execution of pasted commands.

Setup wizard fails at Node.js step

Symptoms: "unzip: command not found"

Fix: Already patched! Update to latest version:

git pull origin main

The setup now auto-installs unzip before downloading Node.js.


๐Ÿš€ Roadmap

โœ… Completed (v1.0)

  • Multi-session terminal management
  • Smart clipboard with image support
  • Configurable keyboard shortcuts
  • WSL setup wizard
  • Git time-travel integration
  • Auto-session detection
  • File system browser
  • WSL distribution management

๐ŸŽฏ Next Up (v1.1)

  • Historical latency graphs (network monitoring)
  • Alert system for high latency
  • Session recording/replay
  • Theme customization
  • Export/import workspace configs

๐Ÿ”ฎ Future Ideas (v2.0)

  • Cloud sync for workspace
  • Collaborative sessions (multi-user)
  • Plugin system for extensions
  • Docker container management
  • SSH tunnel integration

๐Ÿค Contributing

Contributions are welcome! Here's how:

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

Development Setup

# Clone and install
git clone https://github.com/your-username/better-cli.git
cd better-cli
cd server && npm install
cd ../client && npm install

# Run in development mode
# Terminal 1:
cd server && node index.js

# Terminal 2:
cd client && npm run dev

Code Style

  • Frontend: SolidJS components with TypeScript
  • Backend: CommonJS with async/await
  • Formatting: 2 spaces, semicolons optional

๐Ÿ“„ License

MIT License - feel free to use in your projects!


๐Ÿ™ Acknowledgments

Built with amazing open-source tools:

Special thanks to the WSL team at Microsoft for making Linux on Windows seamless.


Made with โค๏ธ for developers who love AI-powered workflows

โฌ† Back to Top

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors