envfix 0.4.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.
- envfix-0.4.0/LICENSE +91 -0
- envfix-0.4.0/PKG-INFO +450 -0
- envfix-0.4.0/README.md +330 -0
- envfix-0.4.0/envfix/__init__.py +3 -0
- envfix-0.4.0/envfix/ai.py +261 -0
- envfix-0.4.0/envfix/cache.py +134 -0
- envfix-0.4.0/envfix/config.py +36 -0
- envfix-0.4.0/envfix/context.py +122 -0
- envfix-0.4.0/envfix/logger.py +147 -0
- envfix-0.4.0/envfix/main.py +485 -0
- envfix-0.4.0/envfix/preview.py +77 -0
- envfix-0.4.0/envfix/runner.py +26 -0
- envfix-0.4.0/envfix.egg-info/PKG-INFO +450 -0
- envfix-0.4.0/envfix.egg-info/SOURCES.txt +22 -0
- envfix-0.4.0/envfix.egg-info/dependency_links.txt +1 -0
- envfix-0.4.0/envfix.egg-info/entry_points.txt +2 -0
- envfix-0.4.0/envfix.egg-info/requires.txt +8 -0
- envfix-0.4.0/envfix.egg-info/top_level.txt +1 -0
- envfix-0.4.0/pyproject.toml +47 -0
- envfix-0.4.0/setup.cfg +4 -0
- envfix-0.4.0/tests/test_phase1.py +229 -0
- envfix-0.4.0/tests/test_phase2.py +345 -0
- envfix-0.4.0/tests/test_phase4.py +86 -0
- envfix-0.4.0/tests/test_phase6.py +159 -0
envfix-0.4.0/LICENSE
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Licensor: LOVE KUSH KUMHAR
|
|
4
|
+
Licensed Work: envfix (the "Licensed Work")
|
|
5
|
+
The Licensed Work is (c) 2026 LOVE KUSH KUMHAR
|
|
6
|
+
|
|
7
|
+
Additional Use Grant: You may use, copy, modify, and redistribute
|
|
8
|
+
the Licensed Work for any purpose, including
|
|
9
|
+
commercial use, EXCEPT that you may not offer
|
|
10
|
+
the Licensed Work, or any modified or derivative
|
|
11
|
+
version of it, to third parties as a hosted or
|
|
12
|
+
managed service (for example, a paid or free
|
|
13
|
+
cloud-based version of envfix that performs
|
|
14
|
+
the same core function of diagnosing and
|
|
15
|
+
fixing environment errors on behalf of users
|
|
16
|
+
who do not run the software themselves).
|
|
17
|
+
|
|
18
|
+
Running envfix locally, integrating it into
|
|
19
|
+
your own development workflow, or using it
|
|
20
|
+
within your own company for internal purposes
|
|
21
|
+
is fully permitted, including at commercial
|
|
22
|
+
organizations, at no cost.
|
|
23
|
+
|
|
24
|
+
Change Date: July 26, 2029
|
|
25
|
+
|
|
26
|
+
Change License: Apache License, Version 2.0
|
|
27
|
+
|
|
28
|
+
For information about alternative licensing arrangements
|
|
29
|
+
(e.g., to offer envfix as a hosted service), contact:
|
|
30
|
+
lovekushkumhar64@gmail.com
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
Notice
|
|
35
|
+
|
|
36
|
+
The Business Source License (this document, or the "License") is
|
|
37
|
+
not an Open Source license. However, the Licensed Work will
|
|
38
|
+
eventually be made available under an Open Source License, as
|
|
39
|
+
stated in this License.
|
|
40
|
+
|
|
41
|
+
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights
|
|
42
|
+
Reserved. "Business Source License" is a trademark of MariaDB
|
|
43
|
+
Corporation Ab.
|
|
44
|
+
|
|
45
|
+
-----------------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
Terms
|
|
48
|
+
|
|
49
|
+
The Licensor hereby grants you the right to copy, modify, create
|
|
50
|
+
derivative works, redistribute, and make non-production use of
|
|
51
|
+
the Licensed Work. The Licensor may make an Additional Use Grant,
|
|
52
|
+
above, permitting limited production use.
|
|
53
|
+
|
|
54
|
+
Effective on the Change Date, or the fourth anniversary of the
|
|
55
|
+
first publicly available distribution of a specific version of
|
|
56
|
+
the Licensed Work under this License, whichever comes first, the
|
|
57
|
+
Licensor hereby grants you rights under the terms of the Change
|
|
58
|
+
License, and the rights granted in the paragraph above terminate.
|
|
59
|
+
|
|
60
|
+
If your use of the Licensed Work does not comply with the
|
|
61
|
+
requirements currently in effect as described in this License,
|
|
62
|
+
you must purchase a commercial license from the Licensor, its
|
|
63
|
+
affiliated entities, or authorized resellers, or you must refrain
|
|
64
|
+
from using the Licensed Work.
|
|
65
|
+
|
|
66
|
+
All copies of the original and modified Licensed Work, and
|
|
67
|
+
derivative works of the Licensed Work, are subject to this
|
|
68
|
+
License. This License applies separately for each version of
|
|
69
|
+
the Licensed Work and the Change Date may vary for each version
|
|
70
|
+
of the Licensed Work released by Licensor.
|
|
71
|
+
|
|
72
|
+
You must conspicuously display this License on each original or
|
|
73
|
+
modified copy of the Licensed Work. If you receive the Licensed
|
|
74
|
+
Work in original or modified form from a third party, the terms
|
|
75
|
+
and conditions set forth in this License apply to your use of
|
|
76
|
+
that work.
|
|
77
|
+
|
|
78
|
+
Any use of the Licensed Work in violation of this License will
|
|
79
|
+
automatically terminate your rights under this License for the
|
|
80
|
+
current and all other versions of the Licensed Work.
|
|
81
|
+
|
|
82
|
+
This License does not grant you any right in any trademark or
|
|
83
|
+
logo of Licensor or its affiliates (provided that you may use a
|
|
84
|
+
trademark or logo of Licensor as expressly required by this
|
|
85
|
+
License).
|
|
86
|
+
|
|
87
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS
|
|
88
|
+
PROVIDED ON AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL
|
|
89
|
+
WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT
|
|
90
|
+
LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
91
|
+
PURPOSE, NON-INFRINGEMENT, AND TITLE.
|
envfix-0.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: envfix
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: CLI tool that diagnoses and auto-fixes Python/ML environment errors using a local LLM.
|
|
5
|
+
License: Business Source License 1.1
|
|
6
|
+
|
|
7
|
+
Licensor: LOVE KUSH KUMHAR
|
|
8
|
+
Licensed Work: envfix (the "Licensed Work")
|
|
9
|
+
The Licensed Work is (c) 2026 LOVE KUSH KUMHAR
|
|
10
|
+
|
|
11
|
+
Additional Use Grant: You may use, copy, modify, and redistribute
|
|
12
|
+
the Licensed Work for any purpose, including
|
|
13
|
+
commercial use, EXCEPT that you may not offer
|
|
14
|
+
the Licensed Work, or any modified or derivative
|
|
15
|
+
version of it, to third parties as a hosted or
|
|
16
|
+
managed service (for example, a paid or free
|
|
17
|
+
cloud-based version of envfix that performs
|
|
18
|
+
the same core function of diagnosing and
|
|
19
|
+
fixing environment errors on behalf of users
|
|
20
|
+
who do not run the software themselves).
|
|
21
|
+
|
|
22
|
+
Running envfix locally, integrating it into
|
|
23
|
+
your own development workflow, or using it
|
|
24
|
+
within your own company for internal purposes
|
|
25
|
+
is fully permitted, including at commercial
|
|
26
|
+
organizations, at no cost.
|
|
27
|
+
|
|
28
|
+
Change Date: July 26, 2029
|
|
29
|
+
|
|
30
|
+
Change License: Apache License, Version 2.0
|
|
31
|
+
|
|
32
|
+
For information about alternative licensing arrangements
|
|
33
|
+
(e.g., to offer envfix as a hosted service), contact:
|
|
34
|
+
lovekushkumhar64@gmail.com
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
Notice
|
|
39
|
+
|
|
40
|
+
The Business Source License (this document, or the "License") is
|
|
41
|
+
not an Open Source license. However, the Licensed Work will
|
|
42
|
+
eventually be made available under an Open Source License, as
|
|
43
|
+
stated in this License.
|
|
44
|
+
|
|
45
|
+
License text copyright (c) 2017 MariaDB Corporation Ab, All Rights
|
|
46
|
+
Reserved. "Business Source License" is a trademark of MariaDB
|
|
47
|
+
Corporation Ab.
|
|
48
|
+
|
|
49
|
+
-----------------------------------------------------------------
|
|
50
|
+
|
|
51
|
+
Terms
|
|
52
|
+
|
|
53
|
+
The Licensor hereby grants you the right to copy, modify, create
|
|
54
|
+
derivative works, redistribute, and make non-production use of
|
|
55
|
+
the Licensed Work. The Licensor may make an Additional Use Grant,
|
|
56
|
+
above, permitting limited production use.
|
|
57
|
+
|
|
58
|
+
Effective on the Change Date, or the fourth anniversary of the
|
|
59
|
+
first publicly available distribution of a specific version of
|
|
60
|
+
the Licensed Work under this License, whichever comes first, the
|
|
61
|
+
Licensor hereby grants you rights under the terms of the Change
|
|
62
|
+
License, and the rights granted in the paragraph above terminate.
|
|
63
|
+
|
|
64
|
+
If your use of the Licensed Work does not comply with the
|
|
65
|
+
requirements currently in effect as described in this License,
|
|
66
|
+
you must purchase a commercial license from the Licensor, its
|
|
67
|
+
affiliated entities, or authorized resellers, or you must refrain
|
|
68
|
+
from using the Licensed Work.
|
|
69
|
+
|
|
70
|
+
All copies of the original and modified Licensed Work, and
|
|
71
|
+
derivative works of the Licensed Work, are subject to this
|
|
72
|
+
License. This License applies separately for each version of
|
|
73
|
+
the Licensed Work and the Change Date may vary for each version
|
|
74
|
+
of the Licensed Work released by Licensor.
|
|
75
|
+
|
|
76
|
+
You must conspicuously display this License on each original or
|
|
77
|
+
modified copy of the Licensed Work. If you receive the Licensed
|
|
78
|
+
Work in original or modified form from a third party, the terms
|
|
79
|
+
and conditions set forth in this License apply to your use of
|
|
80
|
+
that work.
|
|
81
|
+
|
|
82
|
+
Any use of the Licensed Work in violation of this License will
|
|
83
|
+
automatically terminate your rights under this License for the
|
|
84
|
+
current and all other versions of the Licensed Work.
|
|
85
|
+
|
|
86
|
+
This License does not grant you any right in any trademark or
|
|
87
|
+
logo of Licensor or its affiliates (provided that you may use a
|
|
88
|
+
trademark or logo of Licensor as expressly required by this
|
|
89
|
+
License).
|
|
90
|
+
|
|
91
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS
|
|
92
|
+
PROVIDED ON AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL
|
|
93
|
+
WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT
|
|
94
|
+
LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
95
|
+
PURPOSE, NON-INFRINGEMENT, AND TITLE.
|
|
96
|
+
|
|
97
|
+
Project-URL: Homepage, https://github.com/LOVEKUSH-rgb/deepproblemsolver
|
|
98
|
+
Project-URL: Repository, https://github.com/LOVEKUSH-rgb/deepproblemsolver
|
|
99
|
+
Project-URL: Bug Tracker, https://github.com/LOVEKUSH-rgb/deepproblemsolver/issues
|
|
100
|
+
Keywords: cli,llm,ollama,python,environment,debugging
|
|
101
|
+
Classifier: Development Status :: 3 - Alpha
|
|
102
|
+
Classifier: Environment :: Console
|
|
103
|
+
Classifier: Intended Audience :: Developers
|
|
104
|
+
Classifier: License :: Other/Proprietary License
|
|
105
|
+
Classifier: Programming Language :: Python :: 3
|
|
106
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
107
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
108
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
109
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
110
|
+
Requires-Python: >=3.10
|
|
111
|
+
Description-Content-Type: text/markdown
|
|
112
|
+
License-File: LICENSE
|
|
113
|
+
Requires-Dist: typer[all]>=0.12
|
|
114
|
+
Requires-Dist: ollama>=0.2
|
|
115
|
+
Requires-Dist: groq>=0.9.0
|
|
116
|
+
Requires-Dist: google-genai>=0.1.0
|
|
117
|
+
Requires-Dist: tomli>=2.0.1; python_version < "3.11"
|
|
118
|
+
Requires-Dist: tomli-w>=1.0.0
|
|
119
|
+
Dynamic: license-file
|
|
120
|
+
|
|
121
|
+
# envfix 🛠️
|
|
122
|
+
|
|
123
|
+
> **`envfix` wraps any failing shell command, asks a local AI model what went wrong, and proposes a one-click fix — fully offline, no API key, no cloud.**
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
without envfix with envfix
|
|
127
|
+
────────────────────────────────────── ──────────────────────────────────────────
|
|
128
|
+
$ python train.py $ envfix run python train.py
|
|
129
|
+
|
|
130
|
+
ModuleNotFoundError: ✗ Command Failed
|
|
131
|
+
No module named 'torch' │ ModuleNotFoundError: No module named 'torch'
|
|
132
|
+
|
|
133
|
+
↓ Google the error 🤖 Asking Ollama (llama3.1:8b)…
|
|
134
|
+
↓ Stack Overflow rabbit hole
|
|
135
|
+
↓ Try three different pip commands ╭─────────── envfix Suggestion ────────────╮
|
|
136
|
+
↓ Wrong CUDA version │ DIAGNOSIS │
|
|
137
|
+
↓ Try again │ PyTorch is not installed in this env. │
|
|
138
|
+
│ │
|
|
139
|
+
~20 minutes later: │ FIX │
|
|
140
|
+
$ python -m pip install torch │ python -m pip install torch │
|
|
141
|
+
╰──────────────────────────────────────────╯
|
|
142
|
+
|
|
143
|
+
Run this fix? [y/n] (n): y
|
|
144
|
+
✓ Success! The fix resolved the issue.
|
|
145
|
+
(total time: ~30 seconds)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
> ⚠️ **Early / experimental.** Works best for common Python, Node.js, and
|
|
149
|
+
> package-manager errors. See [Known limitations](#known-limitations).
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Prerequisites
|
|
154
|
+
|
|
155
|
+
| Requirement | Version | Why |
|
|
156
|
+
|---|---|---|
|
|
157
|
+
| Python | ≥ 3.10 | f-strings, match syntax |
|
|
158
|
+
| [Ollama](https://ollama.com/download) | latest | (Optional) runs the local AI model |
|
|
159
|
+
| API Keys | | (Optional) `GROQ_API_KEY` or `GEMINI_API_KEY` for cloud models |
|
|
160
|
+
| RAM | ≥ 8 GB | for local `llama3.1:8b` — or ≥ 4 GB for `qwen2.5:3b` |
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Install
|
|
165
|
+
|
|
166
|
+
### Step 1 — Choose your AI provider
|
|
167
|
+
|
|
168
|
+
`envfix` supports local and cloud models.
|
|
169
|
+
|
|
170
|
+
**Option A (Default): Local Ollama**
|
|
171
|
+
Download from **[ollama.com/download](https://ollama.com/download)** (Windows, macOS, Linux).
|
|
172
|
+
|
|
173
|
+
On Linux you can also run:
|
|
174
|
+
```bash
|
|
175
|
+
curl -fsSL https://ollama.com/install.sh | sh
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Step 2 — Pull a model
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Recommended (needs ~8 GB RAM free)
|
|
182
|
+
ollama pull llama3.1:8b
|
|
183
|
+
|
|
184
|
+
# Lighter alternatives if you have ≤ 4 GB free RAM
|
|
185
|
+
ollama pull qwen2.5:3b
|
|
186
|
+
ollama pull llama3.2:3b
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Option B: Groq API (Cloud)**
|
|
190
|
+
1. Get a free API key from [console.groq.com](https://console.groq.com/).
|
|
191
|
+
2. Set it in your terminal:
|
|
192
|
+
```bash
|
|
193
|
+
# Windows PowerShell
|
|
194
|
+
$env:GROQ_API_KEY="your-key-here"
|
|
195
|
+
# Linux/macOS
|
|
196
|
+
export GROQ_API_KEY="your-key-here"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Option C: Gemini API (Cloud)**
|
|
200
|
+
1. Get a free API key from [Google AI Studio](https://aistudio.google.com/).
|
|
201
|
+
2. Set it in your terminal:
|
|
202
|
+
```bash
|
|
203
|
+
# Windows PowerShell
|
|
204
|
+
$env:GEMINI_API_KEY="your-key-here"
|
|
205
|
+
# Linux/macOS
|
|
206
|
+
export GEMINI_API_KEY="your-key-here"
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Step 3 — Start Ollama
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
ollama serve
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
> **Windows tip:** The Ollama installer adds a system-tray icon that starts the
|
|
216
|
+
> service automatically on login — you may be able to skip this step.
|
|
217
|
+
> *(Skip this step if you are using Groq or Gemini).*
|
|
218
|
+
|
|
219
|
+
### Step 4 — Install envfix
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
git clone https://github.com/LOVEKUSH-rgb/deepproblemsolver.git
|
|
223
|
+
cd deepproblemsolver
|
|
224
|
+
pip install -e .
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
> **Why `-e`?** Editable mode means changes to the source code take effect
|
|
228
|
+
> immediately without reinstalling. For a "permanent" install just use
|
|
229
|
+
> `pip install .` instead.
|
|
230
|
+
|
|
231
|
+
Verify the install:
|
|
232
|
+
```bash
|
|
233
|
+
envfix --help
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Usage
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
envfix run <your failing command>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Common examples
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# Missing Python module
|
|
248
|
+
envfix run python -m non_existent_module
|
|
249
|
+
|
|
250
|
+
# Broken requirements file
|
|
251
|
+
envfix run python -m pip install -r requirements.txt
|
|
252
|
+
|
|
253
|
+
# Node / npm error
|
|
254
|
+
envfix run npm run build --category node
|
|
255
|
+
|
|
256
|
+
# CUDA / GPU error
|
|
257
|
+
envfix run python train.py --gpu 0
|
|
258
|
+
|
|
259
|
+
# Use a lighter model on a low-RAM machine
|
|
260
|
+
envfix run python train.py --model qwen2.5:3b
|
|
261
|
+
|
|
262
|
+
# Use a cloud provider instead of local Ollama
|
|
263
|
+
envfix run npm install --provider groq
|
|
264
|
+
envfix run npm install --provider gemini
|
|
265
|
+
|
|
266
|
+
# Check your fix history
|
|
267
|
+
envfix history
|
|
268
|
+
envfix history --last 5
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### What you'll see
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
▶ Running: python -m pip install -r requirements.txt
|
|
275
|
+
|
|
276
|
+
╭──────────── ✗ Command Failed ────────────╮
|
|
277
|
+
│ ERROR: Could not find a version that │
|
|
278
|
+
│ satisfies the requirement bogus-pkg │
|
|
279
|
+
╰──────────────────────────────────────────╯
|
|
280
|
+
|
|
281
|
+
🤖 Asking Ollama (llama3.1:8b) for a diagnosis…
|
|
282
|
+
|
|
283
|
+
╭────────── envfix Suggestion ─────────────╮
|
|
284
|
+
│ DIAGNOSIS │
|
|
285
|
+
│ The package 'bogus-pkg' does not exist │
|
|
286
|
+
│ on PyPI. │
|
|
287
|
+
│ │
|
|
288
|
+
│ FIX │
|
|
289
|
+
│ python -m pip install <correct-name> │
|
|
290
|
+
╰──────────────────────────────────────────╯
|
|
291
|
+
|
|
292
|
+
📋 What this will do: Installs a package from PyPI
|
|
293
|
+
|
|
294
|
+
Run this fix? [y/n] (n): y
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
If the same (or very similar) error has appeared before, `envfix` skips the
|
|
298
|
+
model call entirely and shows the cached suggestion instead:
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
⚡ Found a previously verified fix (97% match) — skipping model call.
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
If the suggested fix contains a destructive command (`rm -rf`, `sudo`,
|
|
305
|
+
`delete`, etc.), `envfix` shows an explicit warning and requires you to type
|
|
306
|
+
`yes` in full:
|
|
307
|
+
|
|
308
|
+
```
|
|
309
|
+
⚠️ DANGEROUS COMMAND DETECTED
|
|
310
|
+
This command may delete files, change permissions, or execute remote code.
|
|
311
|
+
Type 'yes' to run this fix (no):
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Command reference
|
|
315
|
+
|
|
316
|
+
| Command | What it does |
|
|
317
|
+
|---|---|
|
|
318
|
+
| `envfix run <cmd>` | Run a command; diagnose + suggest fix on failure |
|
|
319
|
+
| `envfix run <cmd> --provider <name>` | Select AI provider (`ollama` [default], `groq`, `gemini`) |
|
|
320
|
+
| `envfix run <cmd> --model <tag>` | Use a specific model tag/name for the chosen provider |
|
|
321
|
+
| `envfix run <cmd> --category <eco>` | Hint the ecosystem (`python`, `node`, `docker` …) |
|
|
322
|
+
| `envfix history` | Show the last 20 attempts |
|
|
323
|
+
| `envfix history --last N` | Show last N attempts |
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## How it works
|
|
328
|
+
|
|
329
|
+
```
|
|
330
|
+
envfix run <cmd>
|
|
331
|
+
│
|
|
332
|
+
▼
|
|
333
|
+
subprocess: run the command, capture stderr
|
|
334
|
+
│
|
|
335
|
+
succeeded? ──Yes──► ✓ Nothing to fix
|
|
336
|
+
│
|
|
337
|
+
No
|
|
338
|
+
▼
|
|
339
|
+
Check per-user log (envfix_log_<username>.json) for similar past error
|
|
340
|
+
│
|
|
341
|
+
Cache hit ──Yes──► Show cached fix (skip Ollama)
|
|
342
|
+
│
|
|
343
|
+
No
|
|
344
|
+
▼
|
|
345
|
+
Build structured prompt → POST to local Ollama service
|
|
346
|
+
│
|
|
347
|
+
▼
|
|
348
|
+
Parse DIAGNOSIS + FIX from model response
|
|
349
|
+
│
|
|
350
|
+
▼
|
|
351
|
+
Dry-run description for non-obvious commands
|
|
352
|
+
Destructive guard for dangerous commands (requires "yes" in full)
|
|
353
|
+
│
|
|
354
|
+
▼
|
|
355
|
+
User approves → apply fix → re-run original command
|
|
356
|
+
│
|
|
357
|
+
▼
|
|
358
|
+
Log result to envfix_log_<username>.json
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## Per-user history
|
|
364
|
+
|
|
365
|
+
Every attempt is logged to `envfix_log_<username>.json` in the directory where
|
|
366
|
+
you run `envfix`. Each user on the same machine gets their own separate file —
|
|
367
|
+
no shared state, no accounts.
|
|
368
|
+
|
|
369
|
+
The file is excluded from git by `.gitignore` so your personal history never
|
|
370
|
+
gets committed.
|
|
371
|
+
|
|
372
|
+
Sample entry:
|
|
373
|
+
```json
|
|
374
|
+
{
|
|
375
|
+
"timestamp": "2026-07-26T08:00:00Z",
|
|
376
|
+
"original_command": "python train.py",
|
|
377
|
+
"error_text": "ModuleNotFoundError: No module named 'torch'",
|
|
378
|
+
"diagnosis": "PyTorch is not installed in this environment.",
|
|
379
|
+
"fix_command": "python -m pip install torch",
|
|
380
|
+
"user_approved": true,
|
|
381
|
+
"fix_worked": true,
|
|
382
|
+
"source": "ollama",
|
|
383
|
+
"category": "python",
|
|
384
|
+
"context_included": false,
|
|
385
|
+
"provider": "ollama"
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
## Known limitations
|
|
392
|
+
|
|
393
|
+
- **Model quality varies.** `envfix` is only as good as the local model you
|
|
394
|
+
pull. Smaller models (`qwen2.5:3b`, `llama3.2:3b`) sometimes produce vague
|
|
395
|
+
or wrong diagnoses for complex errors. `llama3.1:8b` is the recommended
|
|
396
|
+
minimum.
|
|
397
|
+
- **Works best for common errors.** Highly project-specific errors (e.g. a bug
|
|
398
|
+
in your custom C extension) will likely produce generic suggestions.
|
|
399
|
+
- **Windows path assumptions.** The tool normalises `pip install` →
|
|
400
|
+
`python -m pip install` because `pip` is often not on the Windows PATH. On
|
|
401
|
+
macOS/Linux both forms work but the normalisation is harmless.
|
|
402
|
+
- **Single fix per failure.** `envfix` proposes one fix at a time. If the
|
|
403
|
+
first fix doesn't work, run `envfix run <cmd>` again — the model may suggest
|
|
404
|
+
something different.
|
|
405
|
+
- **Needs Ollama running.** If `ollama serve` is not active, `envfix` exits
|
|
406
|
+
with a clear error message rather than a cryptic timeout.
|
|
407
|
+
- **Still early.** Prompt engineering and cache fuzzy-matching were tuned for
|
|
408
|
+
Python/ML and Node errors. Other ecosystems (Rust, Docker, CMake …) will
|
|
409
|
+
work but with less accuracy.
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
## Running the tests
|
|
414
|
+
|
|
415
|
+
```bash
|
|
416
|
+
# No Ollama needed — all tests are offline
|
|
417
|
+
python -m pytest tests/ -v
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
67 tests across three files covering the AI parser, subprocess runner, JSON
|
|
421
|
+
logger, two-tier cache, dry-run preview, safety guardrails, and per-category
|
|
422
|
+
matching.
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## Troubleshooting
|
|
427
|
+
|
|
428
|
+
| Symptom | Fix |
|
|
429
|
+
|---|---|
|
|
430
|
+
| `Error reaching Ollama: Connection refused` | Run `ollama serve` in a separate terminal |
|
|
431
|
+
| `model "llama3.1:8b" not found` | Run `ollama pull llama3.1:8b` |
|
|
432
|
+
| `envfix: command not found` | Run `pip install -e .` from the repo root |
|
|
433
|
+
| Fix runs but original still fails | The model diagnosis was wrong — run again or fix manually |
|
|
434
|
+
| Model returns garbled output | Try `--model qwen2.5:3b` |
|
|
435
|
+
| Always shows cached (wrong) fix | Cache threshold is 0.85; if the fix is wrong, say `n` and re-run — Ollama will be called fresh |
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
## Contributing
|
|
440
|
+
|
|
441
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for the module map, ground rules, and
|
|
442
|
+
how to submit a fix.
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
## License
|
|
447
|
+
|
|
448
|
+
This project is licensed under the Business Source License 1.1 (BSL 1.1).
|
|
449
|
+
It requires a commercial license for enterprise/managed service use.
|
|
450
|
+
See the [LICENSE](LICENSE) file for complete details.
|