Skip to content

Sumandebnath943/pentashell-cli

Repository files navigation

Pentashell

The default CLI for the PentaCMD-47M SLM model — turn plain English into a terminal command, locally, on a laptop with no GPU.

Pentashell is a command-line tool that takes an instruction like "undo my last commit" and suggests the matching shell command (git revert HEAD). It shows you the command, asks for approval, and runs it only if you say yes. Everything happens on your machine — no cloud, no API keys, no GPU. You invoke it with the pentacmd command.

pentashell> undo my last commit
family: git (auto-detected from "commit")

Suggested command:

    git revert HEAD

Run this? [y/N]

It is powered by PentaCMD-47M, a from-scratch nanoGPT-style model (8 layers, 640-dim, 12k-token vocabulary) trained to translate an English instruction plus a family hint into a single command. It reaches ~87% exact-match on its validation set.

Names: PentaCMD-47M is the model; Pentashell is this CLI tool that wraps it. The command you type is pentacmd.


Demo

Interactive mode greets you with Penta, the pentagon pet, then it's one instruction at a time:

██████╗ ███████╗███╗   ██╗████████╗ █████╗ ███████╗██╗  ██╗███████╗██╗     ██╗
██╔══██╗██╔════╝████╗  ██║╚══██╔══╝██╔══██╗██╔════╝██║  ██║██╔════╝██║     ██║
██████╔╝█████╗  ██╔██╗ ██║   ██║   ███████║███████╗███████║█████╗  ██║     ██║
██╔═══╝ ██╔══╝  ██║╚██╗██║   ██║   ██╔══██║╚════██║██╔══██║██╔══╝  ██║     ██║
██║     ███████╗██║ ╚████║   ██║   ██║  ██║███████║██║  ██║███████╗███████╗███████╗
╚═╝     ╚══════╝╚═╝  ╚═══╝   ╚═╝   ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚══════╝╚══════╝╚══════╝
  ✦  the default CLI for the PentaCMD-47M SLM model  ✦

pentashell> make a virtual environment
family: python (auto-detected from "virtual environment")

Suggested command:

    python -m venv venv

Run this? [y/N] y

Running...
(finished, exit code 0)

pentashell> exit
Goodbye.

The full banner is in color, with a gradient wordmark and an animated Penta while the model loads — drop in a docs/demo.gif to show it off.


What it does

  • One instruction → one command. You describe what you want; it suggests the command.
  • Five command families: bash, git, npm, python (pip/venv), and powershell.
  • You stay in control. Nothing runs without your explicit approval (default is always No).
  • Two ways to use it: a one-shot form for quick questions, and an interactive prompt loop.
  • Runs fully offline on a 16 GB-RAM, no-GPU laptop. Loading the model takes ~1–2 seconds.

Scope: PentaCMD suggests one command and asks to run it. It is not an agent — it does not plan multiple steps, chain commands, or read results to decide what to do next. One instruction, one command, your approval.


Safety model

This is the most important part of the tool. The rules are non-negotiable:

  1. Nothing runs without explicit approval. You must type y (or yes). The default is No; pressing Enter on an empty line means No.
  2. The command is always shown first, clearly, before you're asked to run it.
  3. Destructive commands get a stronger gate. If a suggestion looks dangerous — rm, del, git reset --hard, force-push, format, dd, and similar — PentaCMD shows a warning that names the risk and requires you to type the full word yes. A casual y will not run it.

Commands currently treated as destructive include: deleting files/folders (rm, del, Remove-Item), removing directories, erasing file contents, git reset --hard, git clean -f, force-pushing, formatting a drive (format, mkfs), overwriting a disk (dd), and shutting down/restarting the machine.

The approval prompt is your control, not a formality — read every command before you approve it (see Limitations).


Install

Requirements: Python 3.9+ and Git LFS. The model weights (best_model.pt, ~180 MB) are stored with Git LFS, so you need it installed before cloning — otherwise you'll get a tiny pointer file instead of the real model.

# 0. install Git LFS once (https://git-lfs.com), then enable it:
git lfs install

# 1. clone the repo (LFS pulls the model weights automatically)
git clone https://github.com/Sumandebnath943/pentashell-cli.git
cd pentashell-cli

# 2. install the dependencies (torch, tokenizers, rich, pyfiglet)
pip install -r requirements.txt

# 3. install pentacmd as a command on your PATH
pip install -e .

That's it. Open a new terminal and pentacmd works from any folder.

  • Already cloned without Git LFS? Install it, then run git lfs pull to download the real weights.
  • The -e (editable) install points the command back to this folder, so the model file isn't copied a second time and any updates take effect immediately.
  • On Windows the command lands in your Python Scripts directory, which is usually already on your PATH. If pentacmd isn't found, make sure that folder is on PATH (you can find it with python -c "import sysconfig; print(sysconfig.get_path('scripts'))").

Usage

Interactive mode (recommended)

Run it with no instruction to open the prompt loop. The model loads once and stays in memory, so every question after the first is instant:

pentacmd
pentacmd> make a virtual environment
pentacmd> git: show me the current status     # force a family with a prefix
pentacmd> exit                                # or press Ctrl-C

One-shot mode

Ask a single question from any terminal:

pentacmd "undo my last commit"                # family auto-detected
pentacmd --git "create a branch called payments"   # family chosen explicitly
pentacmd -n "make a virtual environment"      # print the command only, never run

Choosing the family

The family tells the model which kind of command you want. You can:

  • Let it auto-detect from keywords in your sentence (it always shows which family it picked).
  • Force it with a flag: --bash, --git, --npm, --python, --powershell.
  • Force it in interactive mode with a family: prefix, e.g. npm: install express.

An explicit family always overrides auto-detection. When nothing matches, it falls back to bash and tells you so.

Options

Option Meaning
--bash / --git / --npm / --python / --powershell force the command family
-n, --no-run print the suggested command only — no prompt, no execution
-h, --help show help

Examples

You say Family It suggests
undo my last commit but keep my changes git git reset --soft HEAD~1
create a branch called payments and switch to it git git switch -c payments
make a virtual environment python python -m venv venv
install the requests package with pip python pip install requests
start the dev server npm npm run dev
list all files in this folder powershell Get-ChildItem

(The model picks the command from your exact wording, so phrasing can change the result.)


Limitations

Please read these — they shape how you should use the tool.

  • The model is small (47M) and can be confidently wrong. A suggestion may be plausible but incorrect, incomplete, or not quite what you meant. Always read a command before approving it. The approval step exists precisely because the model is not perfect.
  • Auto-detection is intentionally simple. It matches keywords. Ambiguous instructions (e.g. "install lodash" — pip or npm?) may land on the default family. Add a flag or a family: prefix to steer it.
  • Execution is Windows-first. Approved commands run through PowerShell, which handles git, npm, pip, python, and PowerShell commands. Unix-only bash commands (chmod, grep, …) won't run on Windows — that's expected. On macOS/Linux, commands run through bash.
  • It suggests one command, not a workflow. No multi-step planning or chaining by design.

How it works

  1. Your instruction and family are formatted into the exact prompt the model was trained on:
    ### Task (git): undo my last commit
    ### Command:
    
    (The format is matched precisely — there is no trailing space after ### Command:, which would otherwise make the model drop the first word of its answer.)
  2. The model generates the command with greedy decoding, stopping at its end-of-text token.
  3. PentaCMD extracts the command, checks it against the destructive-command list, and runs the approval flow.

In interactive mode the model is loaded a single time and reused for every prompt.


Project structure

pentacmd-cli/
├── pentacmd.py            # the CLI: inference, family detection, safety, UI
├── modeling_pentacmd.py   # the model architecture (nanoGPT-style decoder)
├── best_model.pt          # trained PentaCMD-47M weights
├── tokenizer.json         # the tokenizer
├── pyproject.toml         # packaging / entry point
├── requirements.txt       # dependencies
└── README.md

License

Released under the MIT License — see LICENSE.


PentaCMD is a portfolio project. It is a helper, not an authority: review every command before you run it.

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages