termi-ai 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.
- termi_ai-0.1.0/LICENSE +21 -0
- termi_ai-0.1.0/PKG-INFO +238 -0
- termi_ai-0.1.0/README.md +195 -0
- termi_ai-0.1.0/pyproject.toml +71 -0
- termi_ai-0.1.0/setup.cfg +4 -0
- termi_ai-0.1.0/termi/__init__.py +3 -0
- termi_ai-0.1.0/termi/cli.py +389 -0
- termi_ai-0.1.0/termi/core/__init__.py +16 -0
- termi_ai-0.1.0/termi/core/agent.py +131 -0
- termi_ai-0.1.0/termi/core/conversation.py +50 -0
- termi_ai-0.1.0/termi/core/error_explainer.py +47 -0
- termi_ai-0.1.0/termi/core/executor.py +141 -0
- termi_ai-0.1.0/termi/core/explainer.py +38 -0
- termi_ai-0.1.0/termi/core/intent.py +60 -0
- termi_ai-0.1.0/termi/core/provider_manager.py +45 -0
- termi_ai-0.1.0/termi/core/settings.py +92 -0
- termi_ai-0.1.0/termi/core/system.py +65 -0
- termi_ai-0.1.0/termi/core/system_query.py +82 -0
- termi_ai-0.1.0/termi/database/__init__.py +6 -0
- termi_ai-0.1.0/termi/database/database.py +99 -0
- termi_ai-0.1.0/termi/database/history_repository.py +124 -0
- termi_ai-0.1.0/termi/providers/__init__.py +19 -0
- termi_ai-0.1.0/termi/providers/anthropic_provider.py +79 -0
- termi_ai-0.1.0/termi/providers/base.py +37 -0
- termi_ai-0.1.0/termi/providers/factory.py +75 -0
- termi_ai-0.1.0/termi/providers/gemini_provider.py +87 -0
- termi_ai-0.1.0/termi/providers/groq_provider.py +72 -0
- termi_ai-0.1.0/termi/providers/ollama_provider.py +82 -0
- termi_ai-0.1.0/termi/providers/openai_provider.py +72 -0
- termi_ai-0.1.0/termi/utils/__init__.py +31 -0
- termi_ai-0.1.0/termi/utils/dangerous_commands.py +58 -0
- termi_ai-0.1.0/termi/utils/exceptions.py +45 -0
- termi_ai-0.1.0/termi/utils/logger.py +53 -0
- termi_ai-0.1.0/termi_ai.egg-info/PKG-INFO +238 -0
- termi_ai-0.1.0/termi_ai.egg-info/SOURCES.txt +43 -0
- termi_ai-0.1.0/termi_ai.egg-info/dependency_links.txt +1 -0
- termi_ai-0.1.0/termi_ai.egg-info/entry_points.txt +2 -0
- termi_ai-0.1.0/termi_ai.egg-info/requires.txt +29 -0
- termi_ai-0.1.0/termi_ai.egg-info/top_level.txt +1 -0
- termi_ai-0.1.0/tests/test_conversation.py +59 -0
- termi_ai-0.1.0/tests/test_database.py +63 -0
- termi_ai-0.1.0/tests/test_history_repository.py +81 -0
- termi_ai-0.1.0/tests/test_provider_factory.py +68 -0
- termi_ai-0.1.0/tests/test_provider_manager.py +56 -0
- termi_ai-0.1.0/tests/test_settings.py +63 -0
termi_ai-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Termi Contributors
|
|
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.
|
termi_ai-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: termi-ai
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: AI-powered cross-platform terminal assistant that converts natural language into shell commands.
|
|
5
|
+
Author: Termi Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: cli,ai,llm,terminal,shell,assistant
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Classifier: Topic :: System :: Shells
|
|
16
|
+
Requires-Python: >=3.12
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: typer>=0.12.0
|
|
20
|
+
Requires-Dist: rich>=13.7.0
|
|
21
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
22
|
+
Requires-Dist: requests>=2.31.0
|
|
23
|
+
Provides-Extra: groq
|
|
24
|
+
Requires-Dist: groq>=0.9.0; extra == "groq"
|
|
25
|
+
Provides-Extra: openai
|
|
26
|
+
Requires-Dist: openai>=1.30.0; extra == "openai"
|
|
27
|
+
Provides-Extra: gemini
|
|
28
|
+
Requires-Dist: google-genai>=0.3.0; extra == "gemini"
|
|
29
|
+
Provides-Extra: anthropic
|
|
30
|
+
Requires-Dist: anthropic>=0.30.0; extra == "anthropic"
|
|
31
|
+
Provides-Extra: all
|
|
32
|
+
Requires-Dist: groq>=0.9.0; extra == "all"
|
|
33
|
+
Requires-Dist: openai>=1.30.0; extra == "all"
|
|
34
|
+
Requires-Dist: google-genai>=0.3.0; extra == "all"
|
|
35
|
+
Requires-Dist: anthropic>=0.30.0; extra == "all"
|
|
36
|
+
Provides-Extra: dev
|
|
37
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
|
|
39
|
+
Requires-Dist: black>=24.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: ruff>=0.5.0; extra == "dev"
|
|
41
|
+
Requires-Dist: isort>=5.13.0; extra == "dev"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# 🤖 Termi
|
|
45
|
+
|
|
46
|
+
**AI-powered multi-LLM terminal assistant that converts natural language into executable shell commands.**
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 📖 Project Description
|
|
51
|
+
|
|
52
|
+
**Termi** lets you describe what you want to do in plain English and get back a real, executable shell command — no more digging through `man` pages or half-remembered `find` flags.
|
|
53
|
+
|
|
54
|
+
It works across **Windows, Linux, and macOS**, automatically detects your operating system and shell, and supports **five different LLM providers** so you're never locked into one vendor. Termi remembers what you've asked in the current session. It can explain what a command does before you run it, diagnose *why* a command failed after you run it and like any responsible assistant sitting in front of your terminal, it always asks before executing anything.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 🎥 Demo
|
|
59
|
+
|
|
60
|
+
> Demo GIF / Video coming soon
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## ✨ Features
|
|
68
|
+
|
|
69
|
+
| | Feature | Description |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| ✅ | **Natural language → shell commands** | Describe a task in plain English, get back a real, runnable command |
|
|
72
|
+
| ✅ | **Multiple LLM providers** | Groq, OpenAI, Gemini, Anthropic, and Ollama (local) |
|
|
73
|
+
| ✅ | **Runtime provider switching** | Swap providers mid-session with `/provider set <name>` |
|
|
74
|
+
| ✅ | **Automatic OS detection** | Detects Windows, Linux, or macOS automatically |
|
|
75
|
+
| ✅ | **Automatic shell detection** | Detects bash, zsh, fish, PowerShell, or cmd automatically |
|
|
76
|
+
| ✅ | **Persistent command history** | Every prompt, command, and result is logged to SQLite |
|
|
77
|
+
| ✅ | **Command explanation** | Ask Termi to explain any shell command in plain English |
|
|
78
|
+
| ✅ | **AI-powered error explanation** | When a command fails, Termi diagnoses why and suggests a fix |
|
|
79
|
+
| ✅ | **Confirmation before execution** | Nothing runs without your explicit go-ahead |
|
|
80
|
+
| ✅ | **Cross-platform** | Windows, Linux, and macOS |
|
|
81
|
+
| ✅ | **Installable CLI package** | `pip install -e .` and run `termi` from anywhere |
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 🏗️ Architecture
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
┌─────────────────────┐
|
|
89
|
+
│ CLI (Typer/Rich) │
|
|
90
|
+
│ │
|
|
91
|
+
└──────────┬───────────┘
|
|
92
|
+
│
|
|
93
|
+
▼
|
|
94
|
+
┌─────────────────────┐
|
|
95
|
+
│ Agent │
|
|
96
|
+
│ (orchestrator) │
|
|
97
|
+
└──────────┬───────────┘
|
|
98
|
+
│
|
|
99
|
+
┌───────────────┬───────────┼───────────────┬───────────────┐
|
|
100
|
+
▼ ▼ ▼ ▼ ▼
|
|
101
|
+
┌───────────────┐ ┌───────────┐ ┌─────────┐ ┌───────────────┐ ┌───────────┐
|
|
102
|
+
│ Conversation │ │ Provider │ │ Command │ │ Settings │ │ System │
|
|
103
|
+
│ Manager │ │ Manager │ │Executor │ │ Manager │ │ Detector │
|
|
104
|
+
└───────────────┘ └─────┬─────┘ └─────────┘ └───────────────┘ └───────────┘
|
|
105
|
+
│
|
|
106
|
+
▼
|
|
107
|
+
┌──────────────────────┐
|
|
108
|
+
│ ProviderFactory │
|
|
109
|
+
└──────────┬────────────┘
|
|
110
|
+
│
|
|
111
|
+
┌────────┬──────────┼──────────┬────────────┐
|
|
112
|
+
▼ ▼ ▼ ▼ ▼
|
|
113
|
+
┌──────┐ ┌────────┐ ┌────────┐ ┌───────────┐ ┌────────┐
|
|
114
|
+
│ Groq │ │ OpenAI │ │ Gemini │ │ Anthropic │ │ Ollama │
|
|
115
|
+
└──────┘ └────────┘ └────────┘ └───────────┘ └────────┘
|
|
116
|
+
|
|
117
|
+
│
|
|
118
|
+
▼
|
|
119
|
+
┌──────────────────────┐
|
|
120
|
+
│ SQLite Database │
|
|
121
|
+
│ │
|
|
122
|
+
└───────────────────────┘
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 📦 Installation
|
|
128
|
+
|
|
129
|
+
### From source
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
git clone https://github.com/<shreya-ramesh>/termi.git
|
|
133
|
+
cd termi
|
|
134
|
+
|
|
135
|
+
python3 -m venv .venv
|
|
136
|
+
source .venv/bin/activate
|
|
137
|
+
|
|
138
|
+
pip install -e ".[dev]"
|
|
139
|
+
|
|
140
|
+
cp .env.example .env
|
|
141
|
+
# add your API key(s) to .env
|
|
142
|
+
|
|
143
|
+
termi
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Via pip (once published)
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
pip install termi
|
|
150
|
+
termi
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## ⚙️ Configuration
|
|
156
|
+
|
|
157
|
+
Termi reads its configuration from a `.env` file at the project root so fill in the keys for whichever provider(s) you plan to use — you only need the ones you'll actually use.
|
|
158
|
+
|
|
159
|
+
| Variable | Description |
|
|
160
|
+
|---|---|
|
|
161
|
+
| `GROQ_API_KEY` | API key for Groq |
|
|
162
|
+
| `OPENAI_API_KEY` | API key for OpenAI |
|
|
163
|
+
| `GEMINI_API_KEY` | API key for Google Gemini |
|
|
164
|
+
| `ANTHROPIC_API_KEY` | API key for Anthropic Claude |
|
|
165
|
+
| `OLLAMA_BASE_URL` | URL of a locally running Ollama server (default: `http://localhost:11434`) |
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
## 📁 Project Structure
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
termi/
|
|
174
|
+
├── termi/
|
|
175
|
+
│ ├── __init__.py
|
|
176
|
+
│ ├── cli.py # Typer + Rich CLI entrypoint
|
|
177
|
+
│ ├── core/
|
|
178
|
+
│ │ ├── agent.py # Orchestrates generation, safety, execution
|
|
179
|
+
│ │ ├── provider_manager.py # Single entry point to LLM providers
|
|
180
|
+
│ │ ├── conversation.py # Conversational memory
|
|
181
|
+
│ │ ├── executor.py # Shell command execution
|
|
182
|
+
│ │ ├── settings.py # Persistent user settings
|
|
183
|
+
│ │ ├── system.py # OS / shell / cwd / user detection
|
|
184
|
+
│ │ ├── system_query.py # Local (LLM-free) system-info queries
|
|
185
|
+
│ │ ├── explainer.py # Command explanation
|
|
186
|
+
│ │ ├── error_explainer.py # AI-powered failure diagnosis
|
|
187
|
+
│ │ └── intent.py # LLM output → clean shell command
|
|
188
|
+
│ ├── providers/
|
|
189
|
+
│ │ ├── base.py # Abstract BaseProvider interface
|
|
190
|
+
│ │ ├── factory.py # ProviderFactory
|
|
191
|
+
│ │ ├── groq_provider.py
|
|
192
|
+
│ │ ├── openai_provider.py
|
|
193
|
+
│ │ ├── gemini_provider.py
|
|
194
|
+
│ │ ├── anthropic_provider.py
|
|
195
|
+
│ │ └── ollama_provider.py
|
|
196
|
+
│ ├── database/
|
|
197
|
+
│ │ ├── database.py # SQLite connection + schema
|
|
198
|
+
│ │ └── history_repository.py # History CRUD
|
|
199
|
+
│ ├
|
|
200
|
+
│ │
|
|
201
|
+
│ └── utils/
|
|
202
|
+
│ ├── logger.py
|
|
203
|
+
│ ├── exceptions.py
|
|
204
|
+
│ └── dangerous_commands.py # Destructive-command heuristics
|
|
205
|
+
├── tests/ # pytest suite
|
|
206
|
+
├── settings.json
|
|
207
|
+
├── pyproject.toml
|
|
208
|
+
├── requirements.txt
|
|
209
|
+
├── .env.example
|
|
210
|
+
├── .gitignore
|
|
211
|
+
└── LICENSE
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## 🤝 Contributing
|
|
217
|
+
|
|
218
|
+
Contributions are welcome! If you'd like to help:
|
|
219
|
+
|
|
220
|
+
1. Fork the repository
|
|
221
|
+
2. Create a feature branch (`git checkout -b feature/my-feature`)
|
|
222
|
+
3. Make your changes, following the existing style (`black`, `isort`, `ruff`)
|
|
223
|
+
4. Run the test suite (`pytest`)
|
|
224
|
+
5. Open a pull request describing what changed and why
|
|
225
|
+
|
|
226
|
+
> 📋 Please keep pull requests focused on one feature or fix per PR makes review much faster.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## 📄 License
|
|
231
|
+
|
|
232
|
+
This project is licensed under the **MIT License** — see [LICENSE](LICENSE) for details.
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## 🙏 Acknowledgements
|
|
237
|
+
|
|
238
|
+
Termi is built on top of a great open-source ecosystem, including [Typer](https://typer.tiangolo.com/), [Rich](https://github.com/Textualize/rich), and [python-dotenv](https://github.com/theskumar/python-dotenv), along with the official SDKs for Groq, OpenAI, Google Gemini, and Anthropic, plus [Ollama](https://ollama.com/) for local inference.
|
termi_ai-0.1.0/README.md
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# 🤖 Termi
|
|
2
|
+
|
|
3
|
+
**AI-powered multi-LLM terminal assistant that converts natural language into executable shell commands.**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 📖 Project Description
|
|
8
|
+
|
|
9
|
+
**Termi** lets you describe what you want to do in plain English and get back a real, executable shell command — no more digging through `man` pages or half-remembered `find` flags.
|
|
10
|
+
|
|
11
|
+
It works across **Windows, Linux, and macOS**, automatically detects your operating system and shell, and supports **five different LLM providers** so you're never locked into one vendor. Termi remembers what you've asked in the current session. It can explain what a command does before you run it, diagnose *why* a command failed after you run it and like any responsible assistant sitting in front of your terminal, it always asks before executing anything.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 🎥 Demo
|
|
16
|
+
|
|
17
|
+
> Demo GIF / Video coming soon
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## ✨ Features
|
|
25
|
+
|
|
26
|
+
| | Feature | Description |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| ✅ | **Natural language → shell commands** | Describe a task in plain English, get back a real, runnable command |
|
|
29
|
+
| ✅ | **Multiple LLM providers** | Groq, OpenAI, Gemini, Anthropic, and Ollama (local) |
|
|
30
|
+
| ✅ | **Runtime provider switching** | Swap providers mid-session with `/provider set <name>` |
|
|
31
|
+
| ✅ | **Automatic OS detection** | Detects Windows, Linux, or macOS automatically |
|
|
32
|
+
| ✅ | **Automatic shell detection** | Detects bash, zsh, fish, PowerShell, or cmd automatically |
|
|
33
|
+
| ✅ | **Persistent command history** | Every prompt, command, and result is logged to SQLite |
|
|
34
|
+
| ✅ | **Command explanation** | Ask Termi to explain any shell command in plain English |
|
|
35
|
+
| ✅ | **AI-powered error explanation** | When a command fails, Termi diagnoses why and suggests a fix |
|
|
36
|
+
| ✅ | **Confirmation before execution** | Nothing runs without your explicit go-ahead |
|
|
37
|
+
| ✅ | **Cross-platform** | Windows, Linux, and macOS |
|
|
38
|
+
| ✅ | **Installable CLI package** | `pip install -e .` and run `termi` from anywhere |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 🏗️ Architecture
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
┌─────────────────────┐
|
|
46
|
+
│ CLI (Typer/Rich) │
|
|
47
|
+
│ │
|
|
48
|
+
└──────────┬───────────┘
|
|
49
|
+
│
|
|
50
|
+
▼
|
|
51
|
+
┌─────────────────────┐
|
|
52
|
+
│ Agent │
|
|
53
|
+
│ (orchestrator) │
|
|
54
|
+
└──────────┬───────────┘
|
|
55
|
+
│
|
|
56
|
+
┌───────────────┬───────────┼───────────────┬───────────────┐
|
|
57
|
+
▼ ▼ ▼ ▼ ▼
|
|
58
|
+
┌───────────────┐ ┌───────────┐ ┌─────────┐ ┌───────────────┐ ┌───────────┐
|
|
59
|
+
│ Conversation │ │ Provider │ │ Command │ │ Settings │ │ System │
|
|
60
|
+
│ Manager │ │ Manager │ │Executor │ │ Manager │ │ Detector │
|
|
61
|
+
└───────────────┘ └─────┬─────┘ └─────────┘ └───────────────┘ └───────────┘
|
|
62
|
+
│
|
|
63
|
+
▼
|
|
64
|
+
┌──────────────────────┐
|
|
65
|
+
│ ProviderFactory │
|
|
66
|
+
└──────────┬────────────┘
|
|
67
|
+
│
|
|
68
|
+
┌────────┬──────────┼──────────┬────────────┐
|
|
69
|
+
▼ ▼ ▼ ▼ ▼
|
|
70
|
+
┌──────┐ ┌────────┐ ┌────────┐ ┌───────────┐ ┌────────┐
|
|
71
|
+
│ Groq │ │ OpenAI │ │ Gemini │ │ Anthropic │ │ Ollama │
|
|
72
|
+
└──────┘ └────────┘ └────────┘ └───────────┘ └────────┘
|
|
73
|
+
|
|
74
|
+
│
|
|
75
|
+
▼
|
|
76
|
+
┌──────────────────────┐
|
|
77
|
+
│ SQLite Database │
|
|
78
|
+
│ │
|
|
79
|
+
└───────────────────────┘
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 📦 Installation
|
|
85
|
+
|
|
86
|
+
### From source
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
git clone https://github.com/<shreya-ramesh>/termi.git
|
|
90
|
+
cd termi
|
|
91
|
+
|
|
92
|
+
python3 -m venv .venv
|
|
93
|
+
source .venv/bin/activate
|
|
94
|
+
|
|
95
|
+
pip install -e ".[dev]"
|
|
96
|
+
|
|
97
|
+
cp .env.example .env
|
|
98
|
+
# add your API key(s) to .env
|
|
99
|
+
|
|
100
|
+
termi
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Via pip (once published)
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pip install termi
|
|
107
|
+
termi
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## ⚙️ Configuration
|
|
113
|
+
|
|
114
|
+
Termi reads its configuration from a `.env` file at the project root so fill in the keys for whichever provider(s) you plan to use — you only need the ones you'll actually use.
|
|
115
|
+
|
|
116
|
+
| Variable | Description |
|
|
117
|
+
|---|---|
|
|
118
|
+
| `GROQ_API_KEY` | API key for Groq |
|
|
119
|
+
| `OPENAI_API_KEY` | API key for OpenAI |
|
|
120
|
+
| `GEMINI_API_KEY` | API key for Google Gemini |
|
|
121
|
+
| `ANTHROPIC_API_KEY` | API key for Anthropic Claude |
|
|
122
|
+
| `OLLAMA_BASE_URL` | URL of a locally running Ollama server (default: `http://localhost:11434`) |
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
## 📁 Project Structure
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
termi/
|
|
131
|
+
├── termi/
|
|
132
|
+
│ ├── __init__.py
|
|
133
|
+
│ ├── cli.py # Typer + Rich CLI entrypoint
|
|
134
|
+
│ ├── core/
|
|
135
|
+
│ │ ├── agent.py # Orchestrates generation, safety, execution
|
|
136
|
+
│ │ ├── provider_manager.py # Single entry point to LLM providers
|
|
137
|
+
│ │ ├── conversation.py # Conversational memory
|
|
138
|
+
│ │ ├── executor.py # Shell command execution
|
|
139
|
+
│ │ ├── settings.py # Persistent user settings
|
|
140
|
+
│ │ ├── system.py # OS / shell / cwd / user detection
|
|
141
|
+
│ │ ├── system_query.py # Local (LLM-free) system-info queries
|
|
142
|
+
│ │ ├── explainer.py # Command explanation
|
|
143
|
+
│ │ ├── error_explainer.py # AI-powered failure diagnosis
|
|
144
|
+
│ │ └── intent.py # LLM output → clean shell command
|
|
145
|
+
│ ├── providers/
|
|
146
|
+
│ │ ├── base.py # Abstract BaseProvider interface
|
|
147
|
+
│ │ ├── factory.py # ProviderFactory
|
|
148
|
+
│ │ ├── groq_provider.py
|
|
149
|
+
│ │ ├── openai_provider.py
|
|
150
|
+
│ │ ├── gemini_provider.py
|
|
151
|
+
│ │ ├── anthropic_provider.py
|
|
152
|
+
│ │ └── ollama_provider.py
|
|
153
|
+
│ ├── database/
|
|
154
|
+
│ │ ├── database.py # SQLite connection + schema
|
|
155
|
+
│ │ └── history_repository.py # History CRUD
|
|
156
|
+
│ ├
|
|
157
|
+
│ │
|
|
158
|
+
│ └── utils/
|
|
159
|
+
│ ├── logger.py
|
|
160
|
+
│ ├── exceptions.py
|
|
161
|
+
│ └── dangerous_commands.py # Destructive-command heuristics
|
|
162
|
+
├── tests/ # pytest suite
|
|
163
|
+
├── settings.json
|
|
164
|
+
├── pyproject.toml
|
|
165
|
+
├── requirements.txt
|
|
166
|
+
├── .env.example
|
|
167
|
+
├── .gitignore
|
|
168
|
+
└── LICENSE
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 🤝 Contributing
|
|
174
|
+
|
|
175
|
+
Contributions are welcome! If you'd like to help:
|
|
176
|
+
|
|
177
|
+
1. Fork the repository
|
|
178
|
+
2. Create a feature branch (`git checkout -b feature/my-feature`)
|
|
179
|
+
3. Make your changes, following the existing style (`black`, `isort`, `ruff`)
|
|
180
|
+
4. Run the test suite (`pytest`)
|
|
181
|
+
5. Open a pull request describing what changed and why
|
|
182
|
+
|
|
183
|
+
> 📋 Please keep pull requests focused on one feature or fix per PR makes review much faster.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## 📄 License
|
|
188
|
+
|
|
189
|
+
This project is licensed under the **MIT License** — see [LICENSE](LICENSE) for details.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 🙏 Acknowledgements
|
|
194
|
+
|
|
195
|
+
Termi is built on top of a great open-source ecosystem, including [Typer](https://typer.tiangolo.com/), [Rich](https://github.com/Textualize/rich), and [python-dotenv](https://github.com/theskumar/python-dotenv), along with the official SDKs for Groq, OpenAI, Google Gemini, and Anthropic, plus [Ollama](https://ollama.com/) for local inference.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "termi-ai"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "AI-powered cross-platform terminal assistant that converts natural language into shell commands."
|
|
9
|
+
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "Termi Contributors" }]
|
|
13
|
+
keywords = ["cli", "ai", "llm", "terminal", "shell", "assistant"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Environment :: Console",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
22
|
+
"Topic :: System :: Shells",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
dependencies = [
|
|
26
|
+
"typer>=0.12.0",
|
|
27
|
+
"rich>=13.7.0",
|
|
28
|
+
"python-dotenv>=1.0.0",
|
|
29
|
+
"requests>=2.31.0",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
groq = ["groq>=0.9.0"]
|
|
34
|
+
openai = ["openai>=1.30.0"]
|
|
35
|
+
gemini = ["google-genai>=0.3.0"]
|
|
36
|
+
anthropic = ["anthropic>=0.30.0"]
|
|
37
|
+
all = ["groq>=0.9.0", "openai>=1.30.0", "google-genai>=0.3.0", "anthropic>=0.30.0"]
|
|
38
|
+
dev = [
|
|
39
|
+
"pytest>=8.0.0",
|
|
40
|
+
"pytest-cov>=5.0.0",
|
|
41
|
+
"black>=24.0.0",
|
|
42
|
+
"ruff>=0.5.0",
|
|
43
|
+
"isort>=5.13.0",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.scripts]
|
|
47
|
+
termi = "termi.cli:run"
|
|
48
|
+
|
|
49
|
+
[tool.setuptools.packages.find]
|
|
50
|
+
include = ["termi*"]
|
|
51
|
+
|
|
52
|
+
[tool.black]
|
|
53
|
+
line-length = 100
|
|
54
|
+
target-version = ["py312"]
|
|
55
|
+
|
|
56
|
+
[tool.isort]
|
|
57
|
+
profile = "black"
|
|
58
|
+
line_length = 100
|
|
59
|
+
known_first_party = ["termi"]
|
|
60
|
+
|
|
61
|
+
[tool.ruff]
|
|
62
|
+
line-length = 100
|
|
63
|
+
target-version = "py312"
|
|
64
|
+
|
|
65
|
+
[tool.ruff.lint]
|
|
66
|
+
select = ["E", "F", "I", "UP", "B", "SIM"]
|
|
67
|
+
ignore = ["E501"]
|
|
68
|
+
|
|
69
|
+
[tool.pytest.ini_options]
|
|
70
|
+
testpaths = ["tests"]
|
|
71
|
+
addopts = "-ra -q"
|
termi_ai-0.1.0/setup.cfg
ADDED