termask-ai 1.0.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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Istiak Ahmmed Soyeb
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.
@@ -0,0 +1,246 @@
1
+ Metadata-Version: 2.4
2
+ Name: termask-ai
3
+ Version: 1.0.0
4
+ Summary: A lightweight CLI wrapper for Google Gemini & OpenAI — built for Termux and Linux terminals.
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/estiaksoyeb/termai
7
+ Project-URL: Repository, https://github.com/estiaksoyeb/termai
8
+ Project-URL: Bug Tracker, https://github.com/estiaksoyeb/termai/issues
9
+ Keywords: ai,cli,gemini,openai,terminal,termux,llm
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: End Users/Desktop
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.7
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Utilities
23
+ Requires-Python: >=3.7
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: requests
27
+ Dynamic: license-file
28
+
29
+ ## Termai
30
+ Termai is a lightweight, zero-dependency CLI wrapper for Google's Gemini AI, built for Termux on Android and general Linux environments.
31
+ It brings the power of Large Language Models (LLMs) directly to your command line, following the Unix philosophy of piping and standard streams.
32
+
33
+ ## Features
34
+ * **Lightweight:** Uses standard Python requests. No heavy SDKs or complex dependencies.
35
+ * **Unix Compatible:** Supports piping (stdin). Feed logs, code, or text files directly into the AI.
36
+ * **Configurable:** Built-in JSON configuration system (ai --config) to edit System Prompts, Temperature, and Models.
37
+ * **Fast:** Defaults to gemini-2.5-flash for instant responses.
38
+ * **Clean UI:** Minimalist output with syntax-highlighted green text.
39
+
40
+ ## Installation
41
+
42
+ You can install Termai as a global Python package using `pipx` (recommended for isolated environments like Termux) or standard `pip`.
43
+
44
+ ```bash
45
+ # Using pipx (recommended)
46
+ pipx install termask-ai
47
+
48
+ # Or using pip
49
+ pip install termask-ai
50
+ ```
51
+
52
+ After installation, the global commands `ai` and `termai` will be available in your terminal.
53
+
54
+ ## Setup
55
+ On the very first run, Termai will ask for your Google Gemini API Key.
56
+ * Get a free API key here: Google AI Studio
57
+ * Run the command:
58
+ ```bash
59
+ ai "hello"
60
+ ```
61
+
62
+ * Paste your key when prompted. It will be saved locally.
63
+
64
+ ## Usage
65
+ 1. Basic Questions
66
+ Ask anything directly from the terminal.
67
+ ```bash
68
+ ai "How do I untar a file in Linux?"
69
+ ```
70
+
71
+ 2. Piping (The Power Move)
72
+ Feed output from other commands into Termai.
73
+ Debug an error log:
74
+ ```bash
75
+ cat error.log | ai "Explain what caused this crash"
76
+ ```
77
+
78
+ Explain a file:
79
+ ```bash
80
+ cat README.md | ai "Summarize this project in one sentence"
81
+ ```
82
+
83
+ Generate code and save it:
84
+ ```bash
85
+ ai "Write a Python hello world script" > hello.py
86
+ ```
87
+
88
+ 3. Saving Outputs (With Terminal Output)
89
+ You can save the response to a file while still viewing the output in your terminal:
90
+ ```bash
91
+ # Save a single-query response
92
+ ai "Explain machine learning in 1 sentence" -o ml_concept.txt
93
+
94
+ # Automatically save a chat session transcript when you exit
95
+ ai chat -o chat_session.md
96
+ ```
97
+
98
+ 4. Interactive Chat
99
+ Start an interactive, multi-turn chat session with memory:
100
+ ```bash
101
+ ai chat
102
+ ```
103
+ * **Rich Terminal Aesthetics**: Interactive chat features a beautiful slate-blue header card and full-width royal-purple highlight blocks for user messages (properly aligned even when emojis are used).
104
+ * **Conversation Snapshots**: Save your chat transcript in clean Markdown format at any point during the conversation by typing:
105
+ ```text
106
+ save snapshot.md
107
+ ```
108
+
109
+ ## Profile Management
110
+ Termai supports multiple AI provider configurations. You can manage them using the `profile` subcommand:
111
+
112
+ * **List profiles**:
113
+ ```bash
114
+ ai profile
115
+ ```
116
+ *(Alias: `ai profile list`)*
117
+ * **Switch default active profile**:
118
+ ```bash
119
+ ai profile use [profile_name]
120
+ ```
121
+ *(Launches an interactive selection list if no profile name is provided)*
122
+ * **Add a new profile**:
123
+ ```bash
124
+ ai profile add <name>
125
+ ```
126
+ * **Remove a profile**:
127
+ ```bash
128
+ ai profile remove <name>
129
+ ```
130
+ *(Alias: `ai profile rm`)*
131
+ * **Run query with temporary profile**:
132
+ ```bash
133
+ ai -p <profile_name> "your query"
134
+ ```
135
+
136
+ ## Configuration
137
+ Termai comes with a built-in configuration editor. You can change the AI provider, model, and personality.
138
+ Run:
139
+ ```bash
140
+ ai --config
141
+ ```
142
+
143
+ This opens `config.json` in your preferred editor. The editor is chosen based on the following priority:
144
+ 1. The `$EDITOR` environment variable.
145
+ 2. `vim` (if installed).
146
+ 3. `nano` (as a fallback).
147
+
148
+ The configuration file looks like this:
149
+ ```json
150
+ {
151
+ "provider": "gemini",
152
+ "proxy": "http://user:pass@127.0.0.1:1080",
153
+ "gemini_config": {
154
+ "api_key": "YOUR_GEMINI_KEY",
155
+ "model_name": "gemini-2.5-flash",
156
+ "system_instruction": "You are a CLI assistant for Termux...",
157
+ "generation_config": {
158
+ "temperature": 0.7,
159
+ "maxOutputTokens": 1024
160
+ }
161
+ },
162
+ "openai_config": {
163
+ "api_key": "YOUR_OPENAI_KEY",
164
+ "model_name": "gpt-4o",
165
+ "system_instruction": "You are a helpful assistant.",
166
+ "temperature": 0.7,
167
+ "max_tokens": 1024
168
+ }
169
+ }
170
+ ```
171
+
172
+ * **`provider`**: Set to `"gemini"` or `"openai"` to choose your AI provider.
173
+ * **`proxy`**: (Optional) Set an HTTP or HTTPS proxy for all requests.
174
+ * **`gemini_config`**: Settings for when `provider` is `"gemini"`.
175
+ * `model_name`: Change to `gemini-2.5-pro` or other available models.
176
+ * `system_instruction`: Give the AI a persona.
177
+ * `temperature`: Set to `1.0` for creative answers, `0.1` for precise logic.
178
+ * **`openai_config`**: Settings for when `provider` is `"openai"`.
179
+ * `model_name`: Change to `gpt-3.5-turbo`, etc.
180
+ * `system_instruction`: A different persona for ChatGPT.
181
+ * `temperature`: Controls randomness.
182
+ * `max_tokens`: The maximum number of tokens to generate.
183
+
184
+ ## Shell Auto-Completion
185
+ Termai includes built-in dynamic shell autocompletion for subcommands, options, profile names, and models.
186
+
187
+ To enable shell auto-completion, add one of the following commands to your shell profile file (like `~/.bashrc` or `~/.zshrc`):
188
+
189
+ * **Bash** (add to `~/.bashrc`):
190
+ ```bash
191
+ source <(ai completion bash)
192
+ ```
193
+ * **Zsh** (add to `~/.zshrc`):
194
+ ```zsh
195
+ source <(ai completion zsh)
196
+ ```
197
+
198
+ ## Help & Troubleshooting
199
+ **Command List:**
200
+ ```bash
201
+ ai --help
202
+ ```
203
+
204
+ **Re-configure API Keys:**
205
+
206
+ To reset and re-enter your API keys, use the `--reinstall` flag.
207
+ ```bash
208
+ ai --reinstall
209
+ ```
210
+
211
+ **Debug Mode:**
212
+
213
+ If the AI isn't responding or you are getting errors, run:
214
+ ```bash
215
+ ai --debug "your question"
216
+ ```
217
+ This will print the raw server response and error codes.
218
+
219
+ **Debug Configuration:**
220
+ If you are having issues with your configuration, you can use the `--debug-config` flag to print the loaded configuration. API keys will be redacted for security.
221
+ ```bash
222
+ ai --debug-config
223
+ ```
224
+
225
+ ## Uninstallation
226
+ To remove Termai completely:
227
+
228
+ ```bash
229
+ # If installed via pipx
230
+ pipx uninstall termask-ai
231
+
232
+ # If installed via pip
233
+ pip uninstall termask-ai
234
+
235
+ # Optional: Remove configuration files
236
+ rm -rf ~/.config/termai
237
+ rm -rf ~/.local/share/termai
238
+ ```
239
+
240
+ ## License
241
+ This project is licensed under the MIT License.
242
+ You are free to use, modify, and distribute this software. See the LICENSE file for more details.
243
+
244
+ <p align="center">
245
+ Made for CLI enthusiasts
246
+ </p>
@@ -0,0 +1,218 @@
1
+ ## Termai
2
+ Termai is a lightweight, zero-dependency CLI wrapper for Google's Gemini AI, built for Termux on Android and general Linux environments.
3
+ It brings the power of Large Language Models (LLMs) directly to your command line, following the Unix philosophy of piping and standard streams.
4
+
5
+ ## Features
6
+ * **Lightweight:** Uses standard Python requests. No heavy SDKs or complex dependencies.
7
+ * **Unix Compatible:** Supports piping (stdin). Feed logs, code, or text files directly into the AI.
8
+ * **Configurable:** Built-in JSON configuration system (ai --config) to edit System Prompts, Temperature, and Models.
9
+ * **Fast:** Defaults to gemini-2.5-flash for instant responses.
10
+ * **Clean UI:** Minimalist output with syntax-highlighted green text.
11
+
12
+ ## Installation
13
+
14
+ You can install Termai as a global Python package using `pipx` (recommended for isolated environments like Termux) or standard `pip`.
15
+
16
+ ```bash
17
+ # Using pipx (recommended)
18
+ pipx install termask-ai
19
+
20
+ # Or using pip
21
+ pip install termask-ai
22
+ ```
23
+
24
+ After installation, the global commands `ai` and `termai` will be available in your terminal.
25
+
26
+ ## Setup
27
+ On the very first run, Termai will ask for your Google Gemini API Key.
28
+ * Get a free API key here: Google AI Studio
29
+ * Run the command:
30
+ ```bash
31
+ ai "hello"
32
+ ```
33
+
34
+ * Paste your key when prompted. It will be saved locally.
35
+
36
+ ## Usage
37
+ 1. Basic Questions
38
+ Ask anything directly from the terminal.
39
+ ```bash
40
+ ai "How do I untar a file in Linux?"
41
+ ```
42
+
43
+ 2. Piping (The Power Move)
44
+ Feed output from other commands into Termai.
45
+ Debug an error log:
46
+ ```bash
47
+ cat error.log | ai "Explain what caused this crash"
48
+ ```
49
+
50
+ Explain a file:
51
+ ```bash
52
+ cat README.md | ai "Summarize this project in one sentence"
53
+ ```
54
+
55
+ Generate code and save it:
56
+ ```bash
57
+ ai "Write a Python hello world script" > hello.py
58
+ ```
59
+
60
+ 3. Saving Outputs (With Terminal Output)
61
+ You can save the response to a file while still viewing the output in your terminal:
62
+ ```bash
63
+ # Save a single-query response
64
+ ai "Explain machine learning in 1 sentence" -o ml_concept.txt
65
+
66
+ # Automatically save a chat session transcript when you exit
67
+ ai chat -o chat_session.md
68
+ ```
69
+
70
+ 4. Interactive Chat
71
+ Start an interactive, multi-turn chat session with memory:
72
+ ```bash
73
+ ai chat
74
+ ```
75
+ * **Rich Terminal Aesthetics**: Interactive chat features a beautiful slate-blue header card and full-width royal-purple highlight blocks for user messages (properly aligned even when emojis are used).
76
+ * **Conversation Snapshots**: Save your chat transcript in clean Markdown format at any point during the conversation by typing:
77
+ ```text
78
+ save snapshot.md
79
+ ```
80
+
81
+ ## Profile Management
82
+ Termai supports multiple AI provider configurations. You can manage them using the `profile` subcommand:
83
+
84
+ * **List profiles**:
85
+ ```bash
86
+ ai profile
87
+ ```
88
+ *(Alias: `ai profile list`)*
89
+ * **Switch default active profile**:
90
+ ```bash
91
+ ai profile use [profile_name]
92
+ ```
93
+ *(Launches an interactive selection list if no profile name is provided)*
94
+ * **Add a new profile**:
95
+ ```bash
96
+ ai profile add <name>
97
+ ```
98
+ * **Remove a profile**:
99
+ ```bash
100
+ ai profile remove <name>
101
+ ```
102
+ *(Alias: `ai profile rm`)*
103
+ * **Run query with temporary profile**:
104
+ ```bash
105
+ ai -p <profile_name> "your query"
106
+ ```
107
+
108
+ ## Configuration
109
+ Termai comes with a built-in configuration editor. You can change the AI provider, model, and personality.
110
+ Run:
111
+ ```bash
112
+ ai --config
113
+ ```
114
+
115
+ This opens `config.json` in your preferred editor. The editor is chosen based on the following priority:
116
+ 1. The `$EDITOR` environment variable.
117
+ 2. `vim` (if installed).
118
+ 3. `nano` (as a fallback).
119
+
120
+ The configuration file looks like this:
121
+ ```json
122
+ {
123
+ "provider": "gemini",
124
+ "proxy": "http://user:pass@127.0.0.1:1080",
125
+ "gemini_config": {
126
+ "api_key": "YOUR_GEMINI_KEY",
127
+ "model_name": "gemini-2.5-flash",
128
+ "system_instruction": "You are a CLI assistant for Termux...",
129
+ "generation_config": {
130
+ "temperature": 0.7,
131
+ "maxOutputTokens": 1024
132
+ }
133
+ },
134
+ "openai_config": {
135
+ "api_key": "YOUR_OPENAI_KEY",
136
+ "model_name": "gpt-4o",
137
+ "system_instruction": "You are a helpful assistant.",
138
+ "temperature": 0.7,
139
+ "max_tokens": 1024
140
+ }
141
+ }
142
+ ```
143
+
144
+ * **`provider`**: Set to `"gemini"` or `"openai"` to choose your AI provider.
145
+ * **`proxy`**: (Optional) Set an HTTP or HTTPS proxy for all requests.
146
+ * **`gemini_config`**: Settings for when `provider` is `"gemini"`.
147
+ * `model_name`: Change to `gemini-2.5-pro` or other available models.
148
+ * `system_instruction`: Give the AI a persona.
149
+ * `temperature`: Set to `1.0` for creative answers, `0.1` for precise logic.
150
+ * **`openai_config`**: Settings for when `provider` is `"openai"`.
151
+ * `model_name`: Change to `gpt-3.5-turbo`, etc.
152
+ * `system_instruction`: A different persona for ChatGPT.
153
+ * `temperature`: Controls randomness.
154
+ * `max_tokens`: The maximum number of tokens to generate.
155
+
156
+ ## Shell Auto-Completion
157
+ Termai includes built-in dynamic shell autocompletion for subcommands, options, profile names, and models.
158
+
159
+ To enable shell auto-completion, add one of the following commands to your shell profile file (like `~/.bashrc` or `~/.zshrc`):
160
+
161
+ * **Bash** (add to `~/.bashrc`):
162
+ ```bash
163
+ source <(ai completion bash)
164
+ ```
165
+ * **Zsh** (add to `~/.zshrc`):
166
+ ```zsh
167
+ source <(ai completion zsh)
168
+ ```
169
+
170
+ ## Help & Troubleshooting
171
+ **Command List:**
172
+ ```bash
173
+ ai --help
174
+ ```
175
+
176
+ **Re-configure API Keys:**
177
+
178
+ To reset and re-enter your API keys, use the `--reinstall` flag.
179
+ ```bash
180
+ ai --reinstall
181
+ ```
182
+
183
+ **Debug Mode:**
184
+
185
+ If the AI isn't responding or you are getting errors, run:
186
+ ```bash
187
+ ai --debug "your question"
188
+ ```
189
+ This will print the raw server response and error codes.
190
+
191
+ **Debug Configuration:**
192
+ If you are having issues with your configuration, you can use the `--debug-config` flag to print the loaded configuration. API keys will be redacted for security.
193
+ ```bash
194
+ ai --debug-config
195
+ ```
196
+
197
+ ## Uninstallation
198
+ To remove Termai completely:
199
+
200
+ ```bash
201
+ # If installed via pipx
202
+ pipx uninstall termask-ai
203
+
204
+ # If installed via pip
205
+ pip uninstall termask-ai
206
+
207
+ # Optional: Remove configuration files
208
+ rm -rf ~/.config/termai
209
+ rm -rf ~/.local/share/termai
210
+ ```
211
+
212
+ ## License
213
+ This project is licensed under the MIT License.
214
+ You are free to use, modify, and distribute this software. See the LICENSE file for more details.
215
+
216
+ <p align="center">
217
+ Made for CLI enthusiasts
218
+ </p>
@@ -0,0 +1,43 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "termask-ai"
7
+ version = "1.0.0"
8
+ description = "A lightweight CLI wrapper for Google Gemini & OpenAI — built for Termux and Linux terminals."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.7"
12
+ dependencies = [
13
+ "requests",
14
+ ]
15
+ keywords = ["ai", "cli", "gemini", "openai", "terminal", "termux", "llm"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "Intended Audience :: End Users/Desktop",
21
+ "Operating System :: POSIX :: Linux",
22
+ "Programming Language :: Python :: 3",
23
+ "Programming Language :: Python :: 3.7",
24
+ "Programming Language :: Python :: 3.8",
25
+ "Programming Language :: Python :: 3.9",
26
+ "Programming Language :: Python :: 3.10",
27
+ "Programming Language :: Python :: 3.11",
28
+ "Programming Language :: Python :: 3.12",
29
+ "Topic :: Utilities",
30
+ ]
31
+
32
+ [project.urls]
33
+ Homepage = "https://github.com/estiaksoyeb/termai"
34
+ Repository = "https://github.com/estiaksoyeb/termai"
35
+ "Bug Tracker" = "https://github.com/estiaksoyeb/termai/issues"
36
+
37
+ [project.scripts]
38
+ ai = "termai_pkg:main"
39
+ termai = "termai_pkg:main"
40
+
41
+ [tool.setuptools.packages.find]
42
+ where = ["."]
43
+ include = ["termai_pkg*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+