Skip to content

mirai-toto/wslforge

Repository files navigation

⚒️ wslforge

🔎 Overview

A minimal tool to declaratively create and manage WSL instances.

wslforge logo

WSL instance manager

License: MIT build release artifacts Latest Release Rust

✨ A clean, declarative way to create WSL instances from a single YAML config, with a focus on clarity and repeatability.

wslforge does two things:

  1. Manages WSL instances — creates, configures, and optionally replaces instances from a YAML config.
  2. Automates instance setup — drives cloud-init for automation and templating.

Status: early/in-development. Some operations are still mock.

✅ Requirements

Optional: install the latest PowerShell via winget if you prefer a newer shell experience:

winget install --id Microsoft.PowerShell --source winget

WSL must be enabled on Windows before you can create instances. Run this once in an elevated PowerShell:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

If you run into issues, a WSL update may be needed:

wsl --update

⚡ Quickstart

wslforge installation demo

1. Install

Download the latest release binary from the Releases page 📦

Invoke-WebRequest -Uri https://github.com/mirai-toto/wslforge/releases/download/v1.21.0/wslforge.exe -OutFile wslforge.exe

2. No config yet?

Run wslforge with no arguments and the interactive wizard will guide you through creating one instance. It covers the essentials — instance name, user, image, proxy, and cloud-init. For advanced options like file transfers, scripts, or multi-instance setups, use a config file. 🧙

.\wslforge.exe

Looking for inspiration? Check out the ready-to-use examples.

3. Have a config?

Run it directly:

.\wslforge.exe --config config.yaml

Validate your config without provisioning anything:

.\wslforge.exe --config config.yaml --validate

Preview what will happen without making changes:

.\wslforge.exe --config config.yaml --dry-run

Write a detailed log to a file for troubleshooting:

.\wslforge.exe --config config.yaml --log-file wslforge.log

🧭 CLI

Flag Description Default
--config Path to YAML config file (optional, defaults to config.yaml) config.yaml
--dry-run Show what would be done without changes false
--validate Parse and validate the config file without provisioning false
--debug Enable extra debug output and write artifacts false
--log-file Write debug logs with timestamps to a file
--force, -f Skip confirmation prompt and proceed automatically false
--print-example-config Print a minimal example config and exit false
--generate-completion Print a shell completion script and exit (powershell)

If --config is omitted and no config.yaml is found in the current directory, an interactive wizard launches to build a config on the fly.

The --debug flag writes the rendered cloud-init user-data to the current directory as cloud-init.<name>.user-data.

.\wslforge.exe --print-example-config

Shell completions

Generate and install a completion script for your shell:

# PowerShell — load for the current session only
.\wslforge.exe --generate-completion powershell | Out-String | Invoke-Expression

# To persist across sessions, save to a separate file and dot-source it from your profile
.\wslforge.exe --generate-completion powershell | Out-File "$HOME\wslforge_completion.ps1"
Add-Content $PROFILE ". `"$HOME\wslforge_completion.ps1`""

📚 Learn more

  • 🧩 Configuration — config schema, all fields, proxy, cloud-init, image sources, file transfers, post-create scripts
  • 📋 Examples — ready-to-use configs for common setups
  • 🧱 Architecture — how the CLI, provisioner, and engine fit together
  • 💡 Rationale — why this project exists and the design decisions behind it
  • 🛠 Development — building locally, git hooks, and running CI checks

📄 License

MIT — see LICENSE.


🤝 Support

Open an issue at GitHub Issues with your logs and config details if possible.


🔗 Useful Links

About

Declarative CLI to create and configure WSL instances from a single YAML config

Topics

Resources

License

Stars

Watchers

Forks

Contributors