Skip to main content

Natural language CLI that converts instructions into shell commands using LLMs

Project description

phi

phi is a global CLI tool that converts natural‑language instructions into real shell commands using LLMs and executes them on your machine.

Example:

phi apply the current stash
phi show processes running on port 6379
phi kill the process on port 6379

Installation

Install phi globally using pip:

pip install phi

Verify installation:

phi --help

The phi command is now available globally in your terminal.


LLM API Keys

phi currently uses OpenAI by default.

You must export an API key before running any command.

OpenAI

export OPENAI_API_KEY="sk-..."

To make this persistent, add it to your shell config file:

  • ~/.zshrc
  • ~/.bashrc
  • ~/.profile

First Run & Configuration

On the first run, phi automatically creates a user‑level configuration file that stores environment information such as OS, shell, and tool preferences.

Config file location

  • macOS / Linux

    ~/.config/phi/config.json
    
  • Windows

    %APPDATA%\phi\config.json
    

Config File Structure

Example config.json:

{
  "os": "Darwin",
  "shell": "zsh",
  "provider": "openai",
  "preferred_tools": [
    {
      "name": "git",
      "description": "Use git commands assuming GitLab remotes and standard workflows"
    },
    {
      "name": "lsof",
      "description": "Use lsof on macOS instead of Linux tools like fuser"
    }
  ]
}

Fields

  • os
    Automatically detected operating system (Darwin, Linux, Windows).

  • shell
    Detected from your environment (zsh, bash, etc.).

  • provider
    LLM provider to use (openai by default).

  • preferred_tools
    Optional list of tools that phi should prefer when generating commands.

    Each tool entry contains:

    • name: tool name
    • description: how and when the tool should be used

You can edit this file manually at any time.


Usage

Run phi followed by a natural‑language instruction:

phi list all git branches
phi check if redis is running
phi show processes using port 6379

phi will:

  1. Convert your instruction into shell commands using an LLM
  2. Execute them in your terminal
  3. Print the output

Notes

  • phi executes real shell commands — use with care
  • Commands are generated to match your OS automatically
  • Safety checks, retries, and confirmations are planned for future versions

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyphi_cli-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyphi_cli-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pyphi_cli-0.1.0.tar.gz.

File metadata

  • Download URL: pyphi_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pyphi_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e2af5bb7167fc7ba947051382a27e9fe9ea865630c2b2b3091fd25d0da1a3600
MD5 6b2738203267078d11df1cd4a3507430
BLAKE2b-256 4eb48ecae5e894cce930270cdbff41b2c6265948e2b1f200ea02a295579d7cfc

See more details on using hashes here.

File details

Details for the file pyphi_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyphi_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pyphi_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9a68f8bcefa4f0245195dc5fed2fe1af24f8b42a86d0db80f898bfa96a645c1
MD5 235ab1b4955358ba7faf16de484c0376
BLAKE2b-256 16af170206c8317f84b012af6ed824457fd9bb8a699de24248d6a2fc2ae367be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page