owo-cli 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +378 -0
  3. package/dist/owo-cli.js +24869 -0
  4. package/package.json +52 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) Use Context, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,378 @@
1
+ <h1 align="center">
2
+ <br>
3
+ <a href="https://github.com/context-labs/uwu"><img src="https://raw.githubusercontent.com/context-labs/uwu/main/assets/uwu.jpg" alt="owo" width="200" style="border-radius:8px;"></a>
4
+ <br>
5
+ owo
6
+ <br>
7
+ </h1>
8
+
9
+ <h4 align="center">✨ Natural language to shell commands using AI ✨</h4>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/owo-cli">
13
+ <img alt="npm version" src="https://img.shields.io/npm/v/owo-cli.svg" />
14
+ </a>
15
+ <a href="https://github.com/context-labs/uwu/releases/latest">
16
+ <img alt="GitHub Release" src="https://img.shields.io/github/v/release/context-labs/uwu" />
17
+ </a>
18
+ <a href="https://x.com/inference_net">
19
+ <img alt="X (formerly Twitter)" src="https://img.shields.io/badge/X-@inference.net-1DA1F2?style=flat&logo=x&logoColor=white" />
20
+ </a>
21
+ <a href="https://opensource.org/licenses/MIT">
22
+ <img alt="License" src="https://img.shields.io/badge/License-MIT-yellow.svg" />
23
+ </a>
24
+ <a href="https://github.com/context-labs/uwu">
25
+ <img alt="GitHub" src="https://img.shields.io/github/stars/context-labs/uwu?style=social" />
26
+ </a>
27
+
28
+ </p>
29
+
30
+ <p align="center">
31
+ <a href="#what-is-this">What is this?</a> •
32
+ <a href="#installation">Installation</a> •
33
+ <a href="#usage">Usage</a> •
34
+ <a href="#contributing">Contributing</a>
35
+ </p>
36
+
37
+ ## What is this?
38
+
39
+ `owo` is a lightweight, focused CLI tool that converts natural language into shell commands using Large Language Models (LLMs) like GPT-5. Unlike comprehensive agentic development tools like [Claude Code](https://www.anthropic.com/claude-code) or [Cursor](https://cursor.com), `owo` has a simple, singular purpose: **helping you write shell commands faster, without switching context**.
40
+
41
+ `owo` is not a replacement for comprehensive agentic development tools -- it is simple tool that excels at one thing. Consider it the terminal equivalent of quickly searching "how do I..." and getting an immediately runnable answer.
42
+
43
+ ![owo demo](https://raw.githubusercontent.com/context-labs/uwu/main/assets/uwu.gif)
44
+
45
+ After a response is generated, you can edit it before pressing enter to execute the command. This is useful if you want to add flags, or other modifications to the command.
46
+
47
+ ## Installation
48
+
49
+ ### Option A: npm (Recommended)
50
+
51
+ Requires [Node.js](https://nodejs.org) 18+.
52
+
53
+ ```bash
54
+ npm install -g owo-cli
55
+ ```
56
+
57
+ ### Option B: Homebrew (macOS / Linux)
58
+
59
+ ```bash
60
+ brew install ibealec/owo/owo-cli
61
+ ```
62
+
63
+ ### Option C: Build from source
64
+
65
+ Requires [Bun](https://bun.sh).
66
+
67
+ ```bash
68
+ git clone https://github.com/context-labs/uwu.git
69
+ cd uwu
70
+ bun install
71
+ bun run build
72
+ chmod +x dist/owo-cli
73
+ mv dist/owo-cli /usr/local/bin/owo-cli
74
+ ```
75
+
76
+ ### Configuration
77
+
78
+ `owo` is configured through a single `config.json` file. The first time you run `owo`, it will automatically create a default configuration file to get you started.
79
+
80
+ #### Configuration File Location
81
+
82
+ The `config.json` file is located in a standard, platform-specific directory:
83
+
84
+ - **Linux:** `~/.config/owo/config.json`
85
+ - **macOS:** `~/Library/Preferences/owo/config.json`
86
+ - **Windows:** `%APPDATA%\\owo\\config.json` (e.g., `C:\\Users\\<user>\\AppData\\Roaming\\owo\\config.json`)
87
+
88
+ #### Provider Types
89
+
90
+ You can configure `owo` to use different AI providers by setting the `type` field in your `config.json`. The supported types are `"OpenAI"`, `"Custom"`, `"Claude"`, `"Gemini"`, `"GitHub"`, and `"ClaudeCode"`.
91
+
92
+ Below are examples for each provider type.
93
+
94
+ ---
95
+
96
+ ##### **1. OpenAI (`type: "OpenAI"`)**
97
+
98
+ This is the default configuration.
99
+
100
+ ```json
101
+ {
102
+ "type": "OpenAI",
103
+ "apiKey": "sk-your_openai_api_key",
104
+ "model": "gpt-4.1"
105
+ }
106
+ ```
107
+
108
+ - `apiKey`: Your OpenAI API key. If empty, `owo` will fall back to the `OPENAI_API_KEY` environment variable.
109
+
110
+ ---
111
+
112
+ ##### **2. Claude (`type: "Claude"`)**
113
+
114
+ Uses the native Anthropic API.
115
+
116
+ ```json
117
+ {
118
+ "type": "Claude",
119
+ "apiKey": "your-anthropic-api-key",
120
+ "model": "claude-3-opus-20240229"
121
+ }
122
+ ```
123
+
124
+ - `apiKey`: Your Anthropic API key. If empty, `owo` will fall back to the `ANTHROPIC_API_KEY` environment variable.
125
+
126
+ ---
127
+
128
+ ##### **3. Gemini (`type: "Gemini"`)**
129
+
130
+ Uses the native Google Gemini API.
131
+
132
+ ```json
133
+ {
134
+ "type": "Gemini",
135
+ "apiKey": "your-google-api-key",
136
+ "model": "gemini-pro"
137
+ }
138
+ ```
139
+
140
+ - `apiKey`: Your Google AI Studio API key. If empty, `owo` will fall back to the `GOOGLE_API_KEY` environment variable.
141
+
142
+ ---
143
+
144
+ ##### **4. GitHub (`type: "GitHub"`)**
145
+ Uses multiple free to use GitHub models.
146
+ ```json
147
+ {
148
+ "type": "GitHub",
149
+ "apiKey": "your-github-token",
150
+ "model": "openai/gpt-4.1-nano"
151
+ }
152
+ ```
153
+
154
+ - `apiKey`: Your GitHub token. If empty, `owo` will fall back to the `GITHUB_TOKEN` environment variable.
155
+
156
+ ---
157
+
158
+ ##### **5. Claude Code (`type: "ClaudeCode"`)**
159
+
160
+ Uses the locally installed [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI. No API key needed -- Claude Code handles its own authentication.
161
+
162
+ ```json
163
+ {
164
+ "type": "ClaudeCode",
165
+ "model": "sonnet"
166
+ }
167
+ ```
168
+
169
+ - `model`: Optional. The model to use (e.g., `"sonnet"`, `"opus"`). If omitted, Claude Code uses its default.
170
+ - **Requires**: The `claude` CLI to be installed and authenticated.
171
+
172
+ ---
173
+
174
+ ##### **6. Custom / Local Models (`type: "Custom"`)**
175
+
176
+ This type is for any other OpenAI-compatible API endpoint, such as Ollama, LM Studio, or a third-party proxy service.
177
+
178
+ ```json
179
+ {
180
+ "type": "Custom",
181
+ "model": "llama3",
182
+ "baseURL": "http://localhost:11434/v1",
183
+ "apiKey": "ollama"
184
+ }
185
+ ```
186
+
187
+ - `model`: The name of the model you want to use (e.g., `"llama3"`).
188
+ - `baseURL`: The API endpoint for the service.
189
+ - `apiKey`: An API key, if required by the service. For local models like Ollama, this can often be a non-empty placeholder like `"ollama"`.
190
+
191
+ ---
192
+
193
+ #### Context Configuration (Optional)
194
+
195
+ `owo` can include recent command history from your shell to provide better context for command generation. This feature is disabled by default but can be enabled. When enabled, `owo` includes the raw last N lines from your shell history (e.g., bash, zsh, fish), preserving any extra metadata your shell records:
196
+
197
+ ```json
198
+ {
199
+ "type": "OpenAI",
200
+ "apiKey": "sk-your_api_key",
201
+ "model": "gpt-4.1",
202
+ "context": {
203
+ "enabled": true,
204
+ "maxHistoryCommands": 10
205
+ }
206
+ }
207
+ ```
208
+
209
+ - `enabled`: Whether to include command history context (default: `false`)
210
+ - `maxHistoryCommands`: Number of recent commands to include (default: `10`)
211
+ When enabled, `owo` automatically detects and parses history from bash, zsh, and fish shells.
212
+
213
+ ##### Notes on history scanning performance
214
+
215
+ - **Chunk size unit**: When scanning shell history files, `owo` reads from the end of the file in fixed-size chunks of 64 KiB. This is not currently configurable but can be made if desired.
216
+
217
+ ##### Windows notes
218
+
219
+ - **History detection**: On Windows, `owo` searches for PowerShell PSReadLine history at:
220
+ - `%APPDATA%\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt` (Windows PowerShell 5.x)
221
+ - `%APPDATA%\Microsoft\PowerShell\PSReadLine\ConsoleHost_history.txt` (PowerShell 7+)
222
+ If not found, it falls back to Unix-like history files that may exist when using Git Bash/MSYS/Cygwin (e.g., `.bash_history`, `.zsh_history`).
223
+ - **Directory listing**: On Windows, directory listing uses `dir /b`; on Linux/macOS it uses `ls`.
224
+
225
+ #### Clipboard Integration
226
+
227
+ `owo` can automatically copy generated commands to your system clipboard:
228
+
229
+ ```json
230
+ {
231
+ "type": "OpenAI",
232
+ "apiKey": "sk-your_api_key",
233
+ "model": "gpt-4.1",
234
+ "clipboard": true
235
+ }
236
+ ```
237
+
238
+ - `clipboard`: Whether to automatically copy generated commands to clipboard (default: `false`)
239
+
240
+ When enabled, every command generated by `owo` is automatically copied to your system clipboard, making it easy to paste commands elsewhere. The clipboard integration works cross-platform:
241
+ - **macOS**: Uses `pbcopy`
242
+ - **Windows**: Uses `clip`
243
+ - **Linux**: Uses `xclip` or `xsel` (falls back to `xsel` if `xclip` is not available)
244
+
245
+ **Note**: On Linux, you'll need either `xclip` or `xsel` installed for clipboard functionality to work.
246
+
247
+ ### Shell Helper Function
248
+
249
+ This function lets you type `owo <description>` and get an editable command preloaded in your shell.
250
+
251
+ #### zsh
252
+
253
+ ```zsh
254
+ # ~/.zshrc
255
+
256
+ owo() {
257
+ local cmd
258
+ cmd="$(owo-cli "$@")" || return
259
+ vared -p "" -c cmd
260
+ print -s -- "$cmd" # add to history
261
+ eval "$cmd"
262
+ }
263
+ ```
264
+
265
+ After editing `~/.zshrc`, reload it:
266
+
267
+ ```bash
268
+ source ~/.zshrc
269
+ ```
270
+
271
+ #### bash
272
+ ```bash
273
+ owo() {
274
+ local cmd
275
+ cmd="$(owo-cli "$@")" || return
276
+ # requires interactive shell and Bash 4+
277
+ read -e -i "$cmd" -p "" cmd || return
278
+ builtin history -s -- "$cmd"
279
+ eval -- "$cmd"
280
+ }
281
+ ```
282
+
283
+ #### Powershell / Conhost / Windows Terminal
284
+
285
+ Note: This only applies to Windows with Powershell installed
286
+
287
+ To your Powershell profile, add this snippet
288
+
289
+ ```Powershell
290
+ function owo {
291
+ param(
292
+ [Parameter(ValueFromRemainingArguments=$true)]
293
+ $args
294
+ )
295
+ $Source = '
296
+ using System;
297
+ using System.Runtime.InteropServices;
298
+
299
+ public class ConsoleInjector {
300
+ [StructLayout(LayoutKind.Sequential)]
301
+ public struct KEY_EVENT_RECORD {
302
+ public bool bKeyDown;
303
+ public ushort wRepeatCount;
304
+ public ushort wVirtualKeyCode;
305
+ public ushort wVirtualScanCode;
306
+ public char UnicodeChar;
307
+ public uint dwControlKeyState;
308
+ }
309
+
310
+ [StructLayout(LayoutKind.Sequential)]
311
+ public struct INPUT_RECORD {
312
+ public ushort EventType;
313
+ public KEY_EVENT_RECORD KeyEvent;
314
+ }
315
+
316
+ [DllImport("kernel32.dll", SetLastError = true)]
317
+ public static extern IntPtr GetStdHandle(int nStdHandle);
318
+
319
+ [DllImport("kernel32.dll", SetLastError = true)]
320
+ public static extern bool WriteConsoleInput(
321
+ IntPtr hConsoleInput,
322
+ INPUT_RECORD[] lpBuffer,
323
+ int nLength,
324
+ out int lpNumberOfEventsWritten
325
+ );
326
+
327
+ const int STD_INPUT_HANDLE = -10;
328
+ const ushort KEY_EVENT = 0x0001;
329
+
330
+ public static void SendCommand(string text) {
331
+ IntPtr hIn = GetStdHandle(STD_INPUT_HANDLE);
332
+ var records = new INPUT_RECORD[text.Length];
333
+
334
+ int i = 0;
335
+ for (; i < text.Length; i++) {
336
+ records[i].EventType = KEY_EVENT;
337
+ records[i].KeyEvent.bKeyDown = true;
338
+ records[i].KeyEvent.wRepeatCount = 1;
339
+ records[i].KeyEvent.UnicodeChar = text[i];
340
+ }
341
+
342
+ int written;
343
+ WriteConsoleInput(hIn, records, i, out written);
344
+ }
345
+ }';
346
+ $cmd = owo-cli @args;
347
+ Add-Type -TypeDefinition $Source;
348
+ [ConsoleInjector]::SendCommand($cmd)
349
+ }
350
+ ```
351
+
352
+ This will work for Powershell terminals. To add this functionality to Conhost / Terminal, save this as `owo.bat` and let it be accessible in ```PATH``` (you must do the Powershell step as well). For example,
353
+
354
+ ```Batch
355
+ :: assumes that ECHO ON and CHCP 437 is user preference
356
+ @ECHO OFF
357
+ CHCP 437 >NUL
358
+ POWERSHELL owo %*
359
+ @ECHO ON
360
+ ```
361
+
362
+ ## Usage
363
+
364
+ Once installed and configured:
365
+
366
+ ```bash
367
+ owo generate a new ssh key called owo-key and add it to the ssh agent
368
+ ```
369
+
370
+ You'll see the generated command in your shell's input line. Press **Enter** to run it, or edit it first. Executed commands will show up in your shell's history just like any other command.
371
+
372
+ ## License
373
+
374
+ [MIT](LICENSE)
375
+
376
+ ## Contributing
377
+
378
+ Contributions are welcome! Please feel free to submit a pull request.