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.2.0.tar.gz (6.1 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.2.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyphi_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 6.1 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.2.0.tar.gz
Algorithm Hash digest
SHA256 ffc83860d2384f2dc1d9bdcf38b1cf7d134cc7ece83beb886c7e3bc80fffcbd3
MD5 021a808c5137324b544c30c5a3359fd5
BLAKE2b-256 19cd61bf9ab1d72edecb96d2f40f1045008b3bd723b439459fbeb6ba911e553b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyphi_cli-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ded1d12055034b413065ddb0f41e37db6e4b39a61aa9862bac4ed4ecba08dd3d
MD5 dc1f829cccc1d6619286f08b999d7525
BLAKE2b-256 2cc3d8018d427c698d3531b128c686b79196b17c50529bbd747b2e8d2b781bf0

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