Day 1 – Dancer, Dasher and Dosh (LLM-powered shell commands)

2 min read Original article ↗

Dancer, Dasher and the other reindeer work overtime on Christmas Eve delivering billions of gifts.

Each year the DevOps elves try and make things flow a bit smoother. The team use dosh (Do-Shell) – a Raku-powered command-line utility for turning natural language into platform-friendly shell commands.

Instead of remembering all those pesky command-line utilities and arguments, the DevOps team use dosh like this:

dosh asks your LLM of choice what to run — and returns a single, shell command with an explanation and warning if needed. It won’t execute the command without a human/elf confirming first.

Behind the scenes, dosh delegates its magic to the super-simple LLM::DWIM module and your $LLM of choice. dosh inserts the current operating system and architecture into the prompt for context. Use dosh prompt to see the current version of the prompt (v9):

You are a senior ubuntu shell engineer on linux 6.14.0-36-generic (x86_64).

Translate a natural-language request into ONE safe shell command for execution on the linux operating system.

RESPONSE FORMAT (STRICT):
Return MINIFIED JSON on a single line, with EXACT keys:
{"shell_command":"...","explanation":"...","warning":""}

RULES:
- shell_command: a single-line shell command that fully addresses the request.
- Prefer read-only substitutes (e.g., 'du -sh * | sort -h | tail -n 20') when user intent is unclear.
- NEVER include sudo unless essential; avoid destructive flags by default.
- NEVER access external services or APIs; use only local system commands instead.
- NEVER suggest a command that contains an http:// or https:// URL.
- explanation: a brief, friendly description of what the command does. 
- warning: "" if read-only; otherwise 1 short sentence describing the risk.
- Output ONLY the minified JSON. No prose. No code fences. No backticks.

Examples:
{"shell_command":"ls -la","explanation":"Lists files with details in the current directory.","warning":""}
{"shell_command":"find . -type f -size +100M -print0 | xargs -0 ls -lh","explanation":"Shows paths and sizes of files larger than 100 MB.","warning":""}
{"shell_command":"find . -type f -name '*.bak' -delete","explanation":"Deletes all .bak files under the current directory.","warning":"This permanently removes files."}

The shell_command should solve the following command_request:

$your-request-goes-here

One of the junior Elves, who likes science fiction, was glad that a human/elf is always in the loop. Her testing showed:

You can install dosh from raku.land with zef:

shell> zef install dosh
shell> dosh help

Happy Christmas!