Skip to content

About

A CLI for generating commands from English language using Ollama.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ‘ป Haunted Terminal

A clean, modern command-line interface that interprets natural language commands using a local LLM and executes real system operations. The application operates completely offline after initial setup and prioritizes user safety through confirmation prompts for destructive operations.

    โ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— 
    โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•‘โ•šโ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—
    โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘
    โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•”โ•โ•โ•  โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘
    โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•‘ โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ•
    โ•šโ•โ•  โ•šโ•โ•โ•šโ•โ•  โ•šโ•โ• โ•šโ•โ•โ•โ•โ•โ• โ•šโ•โ•  โ•šโ•โ•โ•โ•   โ•šโ•โ•   โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•โ•โ•โ•โ• 

status: ready ยท model: llama3.2 ยท v0.1.0

โœจ Features

  • ๐Ÿ—ฃ๏ธ Natural Language Commands: Type what you want in plain English
  • ๐Ÿค– Local LLM Processing: Uses Ollama with llama3.2 for command interpretation
  • ๐Ÿ”’ Safety First: Warns and confirms before destructive operations
  • ๐ŸŽจ Clean, Modern Design: Minimal interface inspired by Gemini CLI with teal and purple accents
  • ๐Ÿ“œ Command History: Remembers your commands across sessions with SQLite
  • ๐Ÿ”Œ Completely Offline: No external API calls, all processing happens locally
  • โœจ Subtle Animations: Clean loading indicators and well-spaced output

๐Ÿ“‹ Requirements

System Requirements

  • Python: 3.10 or higher
  • Operating System: macOS, Linux, or Windows with WSL
  • Ollama: Local LLM service (installation instructions below)

Python Dependencies

All Python dependencies are listed in requirements.txt:

  • typer>=0.9.0 - CLI framework
  • rich>=13.0.0 - Terminal styling and formatting
  • requests>=2.31.0 - HTTP client for Ollama API
  • hypothesis>=6.92.0 - Property-based testing (development)
  • pytest>=7.4.0 - Testing framework (development)

๐Ÿš€ Installation

Step 1: Install Ollama

Ollama is required to run the local LLM that interprets your natural language commands.

macOS

brew install ollama

Linux

curl -fsSL https://ollama.com/install.sh | sh

Windows

Download the installer from ollama.com

Step 2: Pull the llama3.2 Model

After installing Ollama, download the llama3.2 model:

ollama pull llama3.2

Step 3: Start Ollama Service

Start the Ollama service (it will run in the background):

ollama serve

Note: On macOS and Windows, Ollama typically starts automatically. On Linux, you may need to start it manually or set it up as a systemd service.

Step 4: Install Haunted Terminal

Clone the repository:

# Clone the repository
git clone <repository-url>
cd haunted-terminal-cli

โญ Recommended: Professional Installation (Development Mode)

This is the professional way to install CLI tools (like pip, black, pytest):

pip install -e .

This will:

  • Install all dependencies automatically
  • Create a haunted command available system-wide
  • Allow you to edit the code and see changes immediately
  • Follow Python packaging best practices

Alternative: Manual Installation

If you prefer to install dependencies manually:

pip install -r requirements.txt

Note: With manual installation, you'll need to run python haunted.py instead of just haunted.

๐ŸŽฎ Usage

Starting the Application

If you installed with pip install -e . (recommended):

haunted

This works from anywhere on your system! ๐ŸŽ‰

Alternatively, if you installed manually:

python haunted.py

Example Commands

Once the application starts, you'll see a clean welcome header. Simply type what you want to do in natural language:

โ€บ list all python files in this directory

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
  you: list all python files in this directory
  ghost: find . -name "*.py"
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

execute? (y/n)

More Examples

โ€บ show me the current directory
โ€บ create a new folder called test
โ€บ find all files modified in the last 24 hours
โ€บ show disk usage for this folder
โ€บ count lines in all python files

Safety Features

The Haunted Terminal protects you from destructive operations:

โ€บ delete all temporary files

โš  warning: destructive operation detected

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
  you: delete all temporary files
  ghost: rm -rf /tmp/*
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Type 'CONFIRM' to proceed, or anything else to cancel:

Exiting the Application

Type exit or quit to leave the Haunted Terminal:

โ€บ exit

goodbye
2 commands executed this session

๐Ÿ”ง Troubleshooting

"Cannot connect to Ollama"

Problem: The application can't reach the Ollama service.

Solutions:

  1. Check if Ollama is running:

    curl http://localhost:11434/api/tags
  2. Start Ollama if it's not running:

    ollama serve
  3. Verify the llama3.2 model is installed:

    ollama list
  4. If llama3.2 is missing, pull it:

    ollama pull llama3.2

"Command interpretation timeout"

Problem: Ollama is taking too long to respond (>10 seconds).

Solutions:

  1. The llama3.2 model might be loading for the first time (this is normal)
  2. Try the command again - subsequent requests are usually faster
  3. Check system resources - Ollama requires adequate RAM
  4. Consider using a smaller model if your system is resource-constrained

"Permission denied" errors

Problem: Commands fail with permission errors.

Solutions:

  1. Some operations require sudo privileges
  2. Run the specific command with sudo manually, or
  3. Rephrase your request to avoid privileged operations

Database errors

Problem: SQLite database errors when saving history.

Solutions:

  1. Check write permissions in the application directory
  2. Delete the database file to reset: rm haunted_history.db
  3. The application will create a new database on next run

Commands not executing as expected

Problem: The interpreted command doesn't match your intent.

Solutions:

  1. Be more specific in your natural language request
  2. Review the command preview before confirming
  3. Type 'n' to cancel and rephrase your request
  4. You can always type the exact shell command if needed

โœ… Verifying Installation

To verify everything is working correctly:

1. Check Python Version

python --version
# Should show Python 3.10 or higher

2. Check Ollama Connection

curl http://localhost:11434/api/tags
# Should return JSON with available models

3. Verify llama3.2 Model

ollama list | grep llama3.2
# Should show llama3.2 in the list

4. Test the Application

haunted

Or if you didn't use pip install -e .:

python haunted.py

You should see:

  • A clean, minimal header: haunted โ–ธ terminal
  • System status showing "ready" with model info
  • A prompt waiting for input (โ€บ)

5. Run a Safe Test Command

Try a harmless command:

โ€บ show current date and time

The application should:

  1. Display the interpreted shell command in a clean box
  2. Ask for confirmation
  3. Execute and show the result with minimal, modern formatting

๐Ÿงช Running Tests

If you want to run the test suite:

# Run all tests
pytest

# Run with verbose output
pytest -v

# Run specific test file
pytest tests/test_cli.py

# Run property-based tests
pytest tests/ -k "property"

๐Ÿ“ Project Structure

haunted-terminal-cli/
โ”œโ”€โ”€ haunted.py              # Main entry point
โ”œโ”€โ”€ setup.py               # Professional packaging configuration
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ cli.py             # CLI interface and main loop
โ”‚   โ”œโ”€โ”€ theme.py           # Spooky theme and styling
โ”‚   โ”œโ”€โ”€ ollama_client.py   # Ollama LLM integration
โ”‚   โ”œโ”€โ”€ executor.py        # Command execution
โ”‚   โ”œโ”€โ”€ safety.py          # Destructive command detection
โ”‚   โ””โ”€โ”€ history.py         # SQLite command history
โ”œโ”€โ”€ tests/                 # Test suite
โ”œโ”€โ”€ requirements.txt       # Python dependencies
โ””โ”€โ”€ README.md             # This file

๐ŸŽฏ Why Use pip install -e .?

The professional installation method (pip install -e .) offers several advantages:

  1. System-wide Command: Run haunted from any directory
  2. Automatic Dependencies: All requirements installed automatically
  3. Development Mode: Edit code and see changes immediately (no reinstall needed)
  4. Standard Practice: Same approach used by pip, pytest, black, and other professional tools
  5. Easy Uninstall: Simply run pip uninstall haunted-terminal-cli
  6. Virtual Environment Friendly: Works perfectly with venv, conda, etc.

This is the recommended approach for both development and daily use!

๐Ÿ” Privacy & Security

  • Offline Operation: All processing happens locally on your machine
  • No External Calls: The application only communicates with localhost Ollama
  • Command History: Stored locally in SQLite database
  • Safety Checks: Destructive operations require explicit confirmation
  • Open Source: Review the code to verify privacy claims

๐ŸŽจ Customization

The theme and styling can be customized by editing src/theme.py:

  • Color palette (teal accent, soft purple secondary, muted gray-green for status)
  • Prompt symbols and prefixes
  • Message templates
  • Loading animations and spinners
  • Quiet mode for minimal output

๐Ÿ“ License

[Add your license information here]

๐Ÿค Contributing

[Add contribution guidelines here]

๐Ÿ› Known Issues

  • First command may be slow as Ollama loads the model into memory
  • Very complex commands might not interpret correctly
  • Some shell-specific features (pipes, redirects) may need careful phrasing

๐Ÿ’€ Credits

Built with:


๐Ÿ‘ป Clean, minimal, and modern - your terminal, reimagined.

About

A CLI for generating commands from English language using Ollama.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages