|
| 1 | +# tai — Terminal AI |
| 2 | + |
| 3 | +Generate shell commands from natural language, right in your terminal. |
| 4 | + |
| 5 | +tai uses your GitHub Copilot SDK to suggest commands. Select one, run it, or edit it before executing. |
| 6 | + |
| 7 | +## Prerequisites |
| 8 | + |
| 9 | +- [GitHub Copilot CLI](https://github.com/features/copilot/cli) — installed and logged in (subscription required) |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | +```sh |
| 14 | +curl -fsSL https://raw.githubusercontent.com/NitorCreations/tai/main/install.sh | sh |
| 15 | +``` |
| 16 | + |
| 17 | +The binary is placed at `~/.local/share/tai/tai`. |
| 18 | + |
| 19 | +### Shell integration (recommended) |
| 20 | + |
| 21 | +The shell integration shim lets tai place commands directly into your shell history and prompt line instead of executing them in a subshell: |
| 22 | + |
| 23 | +```sh |
| 24 | +~/.local/share/tai/tai install # auto-detects bash or zsh |
| 25 | +~/.local/share/tai/tai install bash # explicit |
| 26 | +~/.local/share/tai/tai install zsh # explicit |
| 27 | +``` |
| 28 | + |
| 29 | +This writes a shim script to `~/.local/bin/tai`. Bind it to a key (e.g. `Alt+t`) for quick access from anywhere in the terminal. |
| 30 | + |
| 31 | +### Alternative: add binary to PATH |
| 32 | + |
| 33 | +If you prefer not to use the shell integration, add the install directory to your PATH instead: |
| 34 | + |
| 35 | +```sh |
| 36 | +export PATH="$HOME/.local/share/tai:$PATH" |
| 37 | +``` |
| 38 | + |
| 39 | +Add this to `~/.bashrc` or `~/.zshrc` to make it permanent. |
| 40 | + |
| 41 | +### Tab completions (optional) |
| 42 | + |
| 43 | +```sh |
| 44 | +# bash |
| 45 | +~/.local/share/tai/tai completion bash >> ~/.bashrc |
| 46 | + |
| 47 | +# zsh |
| 48 | +~/.local/share/tai/tai completion zsh >> ~/.zshrc |
| 49 | +``` |
| 50 | + |
| 51 | +## Usage |
| 52 | + |
| 53 | +```sh |
| 54 | +tai ask # open interactive prompt |
| 55 | +tai ask "list open ports" # start with a query pre-filled |
| 56 | +``` |
| 57 | + |
| 58 | +### TUI key bindings |
| 59 | + |
| 60 | +| State | Key | Action | |
| 61 | +|---|---|---| |
| 62 | +| Input | `Enter` | Submit query | |
| 63 | +| Results | `↑` / `↓` | Navigate suggestions | |
| 64 | +| Results | `Enter` | Accept and run command | |
| 65 | +| Results | `Tab` | Edit command before running | |
| 66 | +| Results | `/` | Follow-up query (refine results) | |
| 67 | +| Editing | `Enter` | Run edited command | |
| 68 | +| Editing | `Esc` | Cancel edit, back to results | |
| 69 | +| Follow-up | `Enter` | Submit follow-up | |
| 70 | +| Follow-up | `Esc` / `Ctrl+C` | Back to results | |
| 71 | +| Any | `Ctrl+C` | Quit | |
| 72 | + |
| 73 | +Commands marked with `⚠` are flagged as potentially destructive. |
| 74 | + |
| 75 | +## Configuration |
| 76 | + |
| 77 | +Config file: `~/.config/tai/config.json` |
| 78 | + |
| 79 | +```sh |
| 80 | +tai config get model # print current model |
| 81 | +tai config set model gpt-4o # change model |
| 82 | +tai config edit # open in $EDITOR |
| 83 | +tai config reset # restore defaults |
| 84 | +``` |
| 85 | + |
| 86 | +Default model is `auto` (Copilot selects the model). |
| 87 | + |
| 88 | +## Building from source |
| 89 | + |
| 90 | +```sh |
| 91 | +git clone https://github.com/NitorCreations/tai.git |
| 92 | +cd tai |
| 93 | +make |
| 94 | +``` |
| 95 | + |
| 96 | +The binary is placed in `dist/`. |
| 97 | + |
| 98 | +## License |
| 99 | + |
| 100 | +MIT — see [LICENSE](LICENSE). |
0 commit comments