heywtf 0.1.0__tar.gz
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.
- heywtf-0.1.0/LICENSE +21 -0
- heywtf-0.1.0/PKG-INFO +184 -0
- heywtf-0.1.0/README.md +156 -0
- heywtf-0.1.0/heywtf/__init__.py +3 -0
- heywtf-0.1.0/heywtf/cli.py +412 -0
- heywtf-0.1.0/heywtf/config.py +91 -0
- heywtf-0.1.0/heywtf/display.py +60 -0
- heywtf-0.1.0/heywtf/gemini_provider.py +63 -0
- heywtf-0.1.0/heywtf/ollama_client.py +59 -0
- heywtf-0.1.0/heywtf/openai_provider.py +45 -0
- heywtf-0.1.0/heywtf/prompts.py +62 -0
- heywtf-0.1.0/heywtf/provider_factory.py +27 -0
- heywtf-0.1.0/heywtf/providers.py +32 -0
- heywtf-0.1.0/heywtf/shell/__init__.py +0 -0
- heywtf-0.1.0/heywtf/shell/buddy.zsh +106 -0
- heywtf-0.1.0/heywtf.egg-info/PKG-INFO +184 -0
- heywtf-0.1.0/heywtf.egg-info/SOURCES.txt +21 -0
- heywtf-0.1.0/heywtf.egg-info/dependency_links.txt +1 -0
- heywtf-0.1.0/heywtf.egg-info/entry_points.txt +4 -0
- heywtf-0.1.0/heywtf.egg-info/requires.txt +4 -0
- heywtf-0.1.0/heywtf.egg-info/top_level.txt +1 -0
- heywtf-0.1.0/pyproject.toml +44 -0
- heywtf-0.1.0/setup.cfg +4 -0
heywtf-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 litlig
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
heywtf-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: heywtf
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: AI-powered terminal assistant — ask anything or diagnose failures with 'hey wtf'
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Keywords: terminal,cli,ai,assistant,ollama,llm,shell
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Operating System :: MacOS
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: System :: Shells
|
|
19
|
+
Classifier: Topic :: Utilities
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: requests>=2.28.0
|
|
24
|
+
Requires-Dist: rich>=13.0.0
|
|
25
|
+
Requires-Dist: openai>=1.0.0
|
|
26
|
+
Requires-Dist: google-generativeai>=0.5.0
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# heywtf
|
|
30
|
+
|
|
31
|
+
AI-powered terminal assistant for macOS. Ask how to do things in the terminal, or diagnose the last failed command.
|
|
32
|
+
|
|
33
|
+
> **Platform:** macOS with zsh. Linux works for `hey` queries but `hey wtf` shell integration is zsh-only.
|
|
34
|
+
|
|
35
|
+
**Backends:**
|
|
36
|
+
- **Ollama** — local, private, no API key (default)
|
|
37
|
+
- **OpenAI** — GPT-4o, GPT-4o-mini (API key required)
|
|
38
|
+
- **Gemini** — Google Gemini (API key required)
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
### macOS
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
brew install litlig/tap/heywtf
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Linux / manual
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
git clone https://github.com/litlig/heywtf.git
|
|
52
|
+
cd heywtf
|
|
53
|
+
pip install -e .
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## First-time setup
|
|
57
|
+
|
|
58
|
+
Run the interactive setup wizard:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
hey config
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
It will ask you to choose a backend, set an API key if needed, and optionally add shell integration to your `~/.zshrc` so `hey wtf` works.
|
|
65
|
+
|
|
66
|
+
## Usage
|
|
67
|
+
|
|
68
|
+
### Ask a question
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
hey how to count words in a file
|
|
72
|
+
hey find all python files modified in the last 24 hours
|
|
73
|
+
hey compress a directory with tar
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Diagnose a failed command
|
|
77
|
+
|
|
78
|
+
After any failed command, run:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
hey wtf
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Example:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
$ chmod 777 /etc/hosts
|
|
88
|
+
chmod: changing permissions of '/etc/hosts': Operation not permitted
|
|
89
|
+
|
|
90
|
+
$ hey wtf
|
|
91
|
+
|
|
92
|
+
heywtf • powered by ollama (qwen2.5-coder:0.5b)
|
|
93
|
+
❌ Command failed: chmod 777 /etc/hosts
|
|
94
|
+
──────────────────────────────────────────────────
|
|
95
|
+
|
|
96
|
+
Permission denied — use sudo for system files:
|
|
97
|
+
sudo chmod 777 /etc/hosts
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Requires shell integration (set up via `hey config`). To temporarily pause capture:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
buddy-off # pause (e.g. before an interactive session)
|
|
104
|
+
buddy-on # resume
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### One-off backend override
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
hey o explain async/await in Python # use OpenAI for this query
|
|
111
|
+
hey g what is the difference between TCP and UDP # use Gemini for this query
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Configure
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
hey config # interactive setup wizard
|
|
118
|
+
hey config show # view current config
|
|
119
|
+
hey config set backend openai # set default backend
|
|
120
|
+
hey config set openai_api_key sk-... # set API key
|
|
121
|
+
hey config set ollama_model qwen3-coder:3b
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
API keys can also be set via environment variables: `OPENAI_API_KEY`, `GOOGLE_API_KEY`.
|
|
125
|
+
|
|
126
|
+
## Ollama setup
|
|
127
|
+
|
|
128
|
+
Ollama is the default backend — local, private, no API key needed.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
brew install ollama
|
|
132
|
+
ollama serve
|
|
133
|
+
ollama pull qwen2.5-coder:0.5b
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## How `hey wtf` works
|
|
137
|
+
|
|
138
|
+
1. A `preexec` zsh hook captures each command and its stderr
|
|
139
|
+
2. A `precmd` hook checks the exit code — if non-zero, saves the command + error
|
|
140
|
+
3. `hey wtf` reads that saved context and asks the AI to diagnose it
|
|
141
|
+
4. Interactive commands (vim, ssh, top, etc.) are skipped to avoid breaking them
|
|
142
|
+
|
|
143
|
+
## Architecture
|
|
144
|
+
|
|
145
|
+
- **`heywtf/providers.py`** — abstract `Provider` base class + `Backend` enum
|
|
146
|
+
- **`heywtf/provider_factory.py`** — instantiates providers by backend
|
|
147
|
+
- **`heywtf/ollama_client.py`** — Ollama (local inference)
|
|
148
|
+
- **`heywtf/openai_provider.py`** — OpenAI API
|
|
149
|
+
- **`heywtf/gemini_provider.py`** — Google Gemini API
|
|
150
|
+
- **`heywtf/config.py`** — config read/write (`~/.config/heywtf/config.json`)
|
|
151
|
+
- **`heywtf/cli.py`** — entry points and interactive config wizard
|
|
152
|
+
- **`heywtf/prompts.py`** — system prompts for ask vs. wtf modes
|
|
153
|
+
- **`heywtf/display.py`** — Rich terminal UI
|
|
154
|
+
- **`heywtf/shell/buddy.zsh`** — zsh hooks for error capture
|
|
155
|
+
|
|
156
|
+
Adding a backend: inherit from `Provider`, implement `chat_stream()`, register in `provider_factory.py` and `config.py`.
|
|
157
|
+
|
|
158
|
+
## Development
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
git clone https://github.com/litlig/heywtf.git
|
|
162
|
+
cd heywtf
|
|
163
|
+
python3 -m venv .venv
|
|
164
|
+
source .venv/bin/activate
|
|
165
|
+
pip install -e .
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Test changes immediately:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
hey how to list files
|
|
172
|
+
hey wtf
|
|
173
|
+
hey config
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
To test shell hooks in your current session:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
source heywtf/shell/buddy.zsh
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
MIT
|
heywtf-0.1.0/README.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# heywtf
|
|
2
|
+
|
|
3
|
+
AI-powered terminal assistant for macOS. Ask how to do things in the terminal, or diagnose the last failed command.
|
|
4
|
+
|
|
5
|
+
> **Platform:** macOS with zsh. Linux works for `hey` queries but `hey wtf` shell integration is zsh-only.
|
|
6
|
+
|
|
7
|
+
**Backends:**
|
|
8
|
+
- **Ollama** — local, private, no API key (default)
|
|
9
|
+
- **OpenAI** — GPT-4o, GPT-4o-mini (API key required)
|
|
10
|
+
- **Gemini** — Google Gemini (API key required)
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
### macOS
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
brew install litlig/tap/heywtf
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Linux / manual
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
git clone https://github.com/litlig/heywtf.git
|
|
24
|
+
cd heywtf
|
|
25
|
+
pip install -e .
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## First-time setup
|
|
29
|
+
|
|
30
|
+
Run the interactive setup wizard:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
hey config
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
It will ask you to choose a backend, set an API key if needed, and optionally add shell integration to your `~/.zshrc` so `hey wtf` works.
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
### Ask a question
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
hey how to count words in a file
|
|
44
|
+
hey find all python files modified in the last 24 hours
|
|
45
|
+
hey compress a directory with tar
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Diagnose a failed command
|
|
49
|
+
|
|
50
|
+
After any failed command, run:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
hey wtf
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Example:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
$ chmod 777 /etc/hosts
|
|
60
|
+
chmod: changing permissions of '/etc/hosts': Operation not permitted
|
|
61
|
+
|
|
62
|
+
$ hey wtf
|
|
63
|
+
|
|
64
|
+
heywtf • powered by ollama (qwen2.5-coder:0.5b)
|
|
65
|
+
❌ Command failed: chmod 777 /etc/hosts
|
|
66
|
+
──────────────────────────────────────────────────
|
|
67
|
+
|
|
68
|
+
Permission denied — use sudo for system files:
|
|
69
|
+
sudo chmod 777 /etc/hosts
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Requires shell integration (set up via `hey config`). To temporarily pause capture:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
buddy-off # pause (e.g. before an interactive session)
|
|
76
|
+
buddy-on # resume
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### One-off backend override
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
hey o explain async/await in Python # use OpenAI for this query
|
|
83
|
+
hey g what is the difference between TCP and UDP # use Gemini for this query
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Configure
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
hey config # interactive setup wizard
|
|
90
|
+
hey config show # view current config
|
|
91
|
+
hey config set backend openai # set default backend
|
|
92
|
+
hey config set openai_api_key sk-... # set API key
|
|
93
|
+
hey config set ollama_model qwen3-coder:3b
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
API keys can also be set via environment variables: `OPENAI_API_KEY`, `GOOGLE_API_KEY`.
|
|
97
|
+
|
|
98
|
+
## Ollama setup
|
|
99
|
+
|
|
100
|
+
Ollama is the default backend — local, private, no API key needed.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
brew install ollama
|
|
104
|
+
ollama serve
|
|
105
|
+
ollama pull qwen2.5-coder:0.5b
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## How `hey wtf` works
|
|
109
|
+
|
|
110
|
+
1. A `preexec` zsh hook captures each command and its stderr
|
|
111
|
+
2. A `precmd` hook checks the exit code — if non-zero, saves the command + error
|
|
112
|
+
3. `hey wtf` reads that saved context and asks the AI to diagnose it
|
|
113
|
+
4. Interactive commands (vim, ssh, top, etc.) are skipped to avoid breaking them
|
|
114
|
+
|
|
115
|
+
## Architecture
|
|
116
|
+
|
|
117
|
+
- **`heywtf/providers.py`** — abstract `Provider` base class + `Backend` enum
|
|
118
|
+
- **`heywtf/provider_factory.py`** — instantiates providers by backend
|
|
119
|
+
- **`heywtf/ollama_client.py`** — Ollama (local inference)
|
|
120
|
+
- **`heywtf/openai_provider.py`** — OpenAI API
|
|
121
|
+
- **`heywtf/gemini_provider.py`** — Google Gemini API
|
|
122
|
+
- **`heywtf/config.py`** — config read/write (`~/.config/heywtf/config.json`)
|
|
123
|
+
- **`heywtf/cli.py`** — entry points and interactive config wizard
|
|
124
|
+
- **`heywtf/prompts.py`** — system prompts for ask vs. wtf modes
|
|
125
|
+
- **`heywtf/display.py`** — Rich terminal UI
|
|
126
|
+
- **`heywtf/shell/buddy.zsh`** — zsh hooks for error capture
|
|
127
|
+
|
|
128
|
+
Adding a backend: inherit from `Provider`, implement `chat_stream()`, register in `provider_factory.py` and `config.py`.
|
|
129
|
+
|
|
130
|
+
## Development
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
git clone https://github.com/litlig/heywtf.git
|
|
134
|
+
cd heywtf
|
|
135
|
+
python3 -m venv .venv
|
|
136
|
+
source .venv/bin/activate
|
|
137
|
+
pip install -e .
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Test changes immediately:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
hey how to list files
|
|
144
|
+
hey wtf
|
|
145
|
+
hey config
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
To test shell hooks in your current session:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
source heywtf/shell/buddy.zsh
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
MIT
|