Skip to content

OsDevil is a lightweight AI agent that converts natural language into operating system commands, enabling automation across development, operations, and DevSecOps workflows

License

Notifications You must be signed in to change notification settings

matank001/OsDevil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Os Devil

Os Devil is a cross-platform compiled tool that uses OpenAI's latest models and APIs to execute operating system commands.

OsDevil Logo
"Letting AI run commands on your computer is kind of like selling your soul to the devil..."

Available for Linux, macOS, and Windows.

Usage

Set OpenAI API Key

⚠️ Warning: Os Devil requires an OpenAI API key to run locally. Please treat your API key as sensitive information do not share it or commit it to public repositories.

Additionally, using the OpenAI API may incur costs on your account depending on usage.

Option A: Config file

echo "OPENAI_API_KEY=sk-your-key-here" > ~/.devilconf

Option B: Environment variable

export OPENAI_API_KEY='your-api-key-here'

Option C: Command-line flag

./devil -k "sk-your-key-here" -c "your command"

Simply Run It

Run the tool with the -c flag followed by your command or task:

# Summon the Devil with a simple command:
devil -c "print a cool devil ASCII art"

More Cool Examples

# Simple command (uses config file defaults)
devil -c "list all files in the current directory"

# Request JSON output 
devil -c "which extensions do I use in Cursor, and what are their origins?" --json > list.json

# With verbose output
devil -c "find the largest PDF file in ~/Documents" -v

# With approval required for each command
devil -c "delete old log files" -a

# Override API key
devil -k "sk-custom-key" -c "search which MCP servers are configured"

# Use different model
devil -m "gpt-4" -c "analyze system performance"

# Combine multiple flags
devil -c "check all open network connections on 0.0.0.0" -v -a --json

# Use custom config file
devil --conf /path/to/custom.conf -c "your command"

Configuration

Config File (~/.devilconf)

You can create a configuration file to set default values:

# Config file

# OpenAI API Key
OPENAI_API_KEY=sk-your-api-key-here

# Default settings (y/n, yes/no, true/false, 1/0)
JSON=n
VERBOSE=n
APPROVE=n

# Default model
MODEL=gpt-5.2

Priority order (highest to lowest):

  1. Command-line flags
  2. Config file (~/.devilconf)
  3. Environment variables (OPENAI_API_KEY)

An example config file is provided: .devilconf.example

Manual Build

# Download dependencies
go mod download

# Build the binary
go build -o devil main.go

Using Makefile

make build

Install System-Wide

make install

This will copy the binary to /usr/local/bin/devil (requires sudo).

Command-Line Flags

-c string       Command/mission prompt to execute (required)
-v              Enable verbose output (default: from config)
-a              Approve all commands before execution (default: from config)
--json          Request JSON formatted output (default: from config)
-k string       OpenAI API key (default: from config or env)
-m string       OpenAI model to use (default: gpt-5.2 or from config)
--conf string   Path to config file (default: ~/.devilconf)

Building for Different Platforms

Build All Platforms

make build-all

This creates binaries in the bin/ directory for:

  • macOS Intel (darwin-amd64)
  • macOS Apple Silicon (darwin-arm64)
  • Linux AMD64 (linux-amd64)
  • Linux ARM64 (linux-arm64)
  • Windows AMD64 (windows-amd64.exe)
  • Windows ARM64 (windows-arm64.exe)

Build Specific Platforms

# Windows only
make build-windows

# Linux only
make build-linux

# Current platform
make build

Cross-Platform Features

The tool automatically detects your operating system and uses the appropriate shell:

  • Windows: PowerShell (powershell -Command)
  • Mac/Linux/Unix: Bourne shell (sh -c)

Instructions sent to the AI are also customized based on your OS.

Download

You can download a release or compile it yourself. If Apple thinks the binary is suspicious and you trust it, you can use:

xattr -d com.apple.quarantine devil-darwin-amd64

About

OsDevil is a lightweight AI agent that converts natural language into operating system commands, enabling automation across development, operations, and DevSecOps workflows

Resources

License

Stars

Watchers

Forks

Packages

No packages published