Kut — Free UI for Everyone

Kut — Free UI for Everyone
Photo by Sahand Babali / Unsplash
bettercallshao/kut
A GUI to help make running commands easier. This project aims to help in the following scenarios You are a developer…

A GUI to help make running commands easier. This project aims to address common challenges faced by developers who frequently use complex command-line scripts.

Kut is a tool that allows commands to be run via a web UI. Many useful one-liner commands range from checking an IP address to removing stale Docker containers. These commands can vary in complexity—from simple commands to piped multi-segment templates—and their parameters might change for each project.

If you’ve worked with these commands, you know how cumbersome it can be to remember them or replace values in the middle of a long string. As a result, developers often save command templates in notepads, copy-pasting them into a terminal, or rely on terminal emulator features (e.g., iTerm2) for composition. Kut provides a simpler, more intuitive way.

The first tool I created to solve this problem was pdp, a Python-based application with a GTK native GUI. It allowed users to compose commands interactively, supporting word substitution, numeric increments, and keyboard shortcuts. However, it had several limitations:

  1. Python programs are hard to install, and complications arise across different operating systems.
  2. GTK-based UIs are slow to launch and inconsistent across platforms.
  3. The application had to be relaunched every time a new command was composed.

Realizing these limitations, I revisited the problem and built Kut with the following improvements:

  1. Golang for easy distribution: Kut is written in Golang for seamless deployment on any operating system.
  2. Web-based UI: The use of a web interface ensures consistent behavior across platforms.
  3. Persistent master-server: A web server acts as a persistent master, while terminals join as workers to execute multiple commands until termination.
  4. Channel-based workers: Channels serve as slots for workers to join and operate.
  5. Menu-based commands: Menus (defined in YAML files) describe available commands for workers.

Kut in Action

The above screenshot demonstrates a domain-lookup command running as part of the windows-shell menu. The browser app (built with VueJS) communicates with the terminal-based worker via WebSocket, enabling command execution and result display. For example, the IP address for google.com is successfully retrieved. Here’s how to set up Kut on Windows.

Download the Release

Visit Kut Releases and download the latest release, kut-windows-amd64. Extract the package into a permanent directory, e.g., C:\kut.

Directory Setup

Set Up Master

  1. Right-click on kutd.exe and create a desktop shortcut.
  2. Examine the shortcut properties to ensure proper configuration.
  3. Double-click the shortcut to run kutd. A terminal window should appear, indicating the master server is running.

Master Terminal Window

Visit http://localhost:7171/ in your browser to test the web server.

Web Server Test

Ingest a Menu

In the browser interface, enter the following details:

Click Ingest Menu to load the menu into the system. The UI will display the newly added menu. You can also ingest YAML files from the local file system or edit them directly in the .kut/menus directory in your home folder.

Menu Injection

Set Up Worker

  1. Right-click on kut.exe and create a desktop shortcut.
  2. Modify the shortcut properties to include additional arguments, such as s windows-shell. Different shortcuts can be defined for various menus.

Worker Shortcut Setup

Run kut, and a terminal window for the worker will open.

Worker Terminal Window

A worker has now started on Channel 0 to serve the windows-shell menu.

Run Commands

Navigate to http://localhost:7171/ in your browser and click Channel 0.

Channel Selection

This menu includes five actions. Select domain-lookup and modify the domain parameter if needed (the default is google.com). Click Execute to run the command.

Domain Lookup Menu

The nslookup command will execute in the worker terminal, and the result will display in the web UI.

Command Execution

Summary

Kut simplifies command execution by providing a menu-driven UI (defined in YAML files) and utilizing workers for terminal-based execution. Official menus are available at Kut Menus. Kut supports Linux, Mac, and Windows, with shortcuts making deployment user-friendly, even for non-technical users.

While Kut effectively solves the problem it was designed for, I’m still exploring meaningful use cases to showcase its full potential. Your feedback and suggestions are welcome!