hey-cli-python 1.0.1__tar.gz → 1.0.3__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.
Files changed (21) hide show
  1. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/PKG-INFO +4 -3
  2. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/hey_cli/cli.py +24 -0
  3. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/hey_cli/llm.py +28 -11
  4. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/hey_cli_python.egg-info/PKG-INFO +4 -3
  5. hey_cli_python-1.0.3/hey_cli_python.egg-info/requires.txt +1 -0
  6. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/pyproject.toml +4 -3
  7. hey_cli_python-1.0.1/hey_cli_python.egg-info/requires.txt +0 -2
  8. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/LICENSE +0 -0
  9. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/README.md +0 -0
  10. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/hey_cli/__init__.py +0 -0
  11. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/hey_cli/governance.py +0 -0
  12. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/hey_cli/history.py +0 -0
  13. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/hey_cli/models.py +0 -0
  14. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/hey_cli/runner.py +0 -0
  15. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/hey_cli/skills.py +0 -0
  16. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/hey_cli_python.egg-info/SOURCES.txt +0 -0
  17. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/hey_cli_python.egg-info/dependency_links.txt +0 -0
  18. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/hey_cli_python.egg-info/entry_points.txt +0 -0
  19. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/hey_cli_python.egg-info/top_level.txt +0 -0
  20. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/setup.cfg +0 -0
  21. {hey_cli_python-1.0.1 → hey_cli_python-1.0.3}/tests/test_cli.py +0 -0
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hey-cli-python
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: A secure, zero-bloat CLI companion that turns natural language and error logs into executable commands.
5
- Author: Mohit S.
5
+ Author: Mohit Singh Sinsniwal
6
6
  Project-URL: Homepage, https://github.com/sinsniwal/hey-cli
7
7
  Project-URL: Repository, https://github.com/sinsniwal/hey-cli
8
8
  Project-URL: Issues, https://github.com/sinsniwal/hey-cli/issues
@@ -18,10 +18,11 @@ Classifier: Programming Language :: Python :: 3.9
18
18
  Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3.11
20
20
  Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
21
23
  Requires-Python: >=3.9
22
24
  Description-Content-Type: text/markdown
23
25
  License-File: LICENSE
24
- Requires-Dist: ollama>=0.1.0
25
26
  Requires-Dist: rich>=13.0.0
26
27
  Dynamic: license-file
27
28
 
@@ -1,15 +1,36 @@
1
1
  import argparse
2
2
  import sys
3
3
  import os
4
+ import urllib.request
5
+ import urllib.error
4
6
 
5
7
  from .governance import GovernanceEngine
6
8
  from .llm import generate_command
7
9
  from .history import HistoryManager
8
10
  from .runner import CommandRunner
9
11
  from rich.console import Console
12
+ from rich.panel import Panel
13
+ from rich.text import Text
10
14
 
11
15
  console = Console()
12
16
 
17
+ def check_ollama():
18
+ """Check if Ollama is reachable at localhost:11434. Exit with instructions if not."""
19
+ try:
20
+ urllib.request.urlopen("http://localhost:11434", timeout=2)
21
+ except Exception:
22
+ msg = Text()
23
+ msg.append("Ollama is not running or not installed.\n\n", style="bold red")
24
+ msg.append("Install Ollama:\n", style="bold white")
25
+ msg.append(" Linux / macOS:\n", style="dim")
26
+ msg.append(" curl -fsSL https://ollama.com/install.sh | sh\n", style="bold cyan")
27
+ msg.append(" Windows:\n", style="dim")
28
+ msg.append(" https://ollama.com/download/windows\n\n", style="bold cyan")
29
+ msg.append("Then pull the default model:\n", style="bold white")
30
+ msg.append(" ollama pull gpt-oss:20b-cloud", style="bold cyan")
31
+ console.print(Panel(msg, title="[bold yellow]⚠ Ollama Required[/bold yellow]", border_style="yellow"))
32
+ sys.exit(1)
33
+
13
34
  def main():
14
35
  parser = argparse.ArgumentParser(
15
36
  description="hey-cli: a secure, zero-bloat CLI companion.",
@@ -49,6 +70,9 @@ def main():
49
70
  if args.check_cache:
50
71
  sys.exit(0)
51
72
 
73
+ # Only check Ollama when we're about to call the LLM
74
+ check_ollama()
75
+
52
76
  piped_data = ""
53
77
  if not sys.stdin.isatty():
54
78
  try:
@@ -1,7 +1,8 @@
1
1
  import json
2
2
  import os
3
3
  import platform
4
- import ollama
4
+ import urllib.request
5
+ import urllib.error
5
6
  from .models import CommandResponse, TroubleshootResponse
6
7
 
7
8
  DEFAULT_MODEL = "gpt-oss:20b-cloud"
@@ -58,12 +59,20 @@ def generate_command(prompt: str, context: str = "", model_name: str = DEFAULT_M
58
59
 
59
60
  for attempt in range(max_retries):
60
61
  try:
61
- response = ollama.chat(
62
- model=model_name,
63
- messages=msgs,
64
- format="json",
65
- options={"temperature": 0.0}
62
+ payload = {
63
+ "model": model_name,
64
+ "messages": msgs,
65
+ "format": "json",
66
+ "stream": False,
67
+ "options": {"temperature": 0.0}
68
+ }
69
+ req = urllib.request.Request(
70
+ "http://localhost:11434/api/chat",
71
+ data=json.dumps(payload).encode('utf-8'),
72
+ headers={"Content-Type": "application/json"}
66
73
  )
74
+ with urllib.request.urlopen(req, timeout=30) as resp:
75
+ response = json.loads(resp.read().decode('utf-8'))
67
76
 
68
77
  raw_val = response["message"]["content"]
69
78
  content_str = raw_val
@@ -113,12 +122,20 @@ def generate_troubleshoot_step(objective: str, history: list, model_name: str =
113
122
 
114
123
  for attempt in range(max_retries):
115
124
  try:
116
- response = ollama.chat(
117
- model=model_name,
118
- messages=msgs,
119
- format="json",
120
- options={"temperature": 0.0}
125
+ payload = {
126
+ "model": model_name,
127
+ "messages": msgs,
128
+ "format": "json",
129
+ "stream": False,
130
+ "options": {"temperature": 0.0}
131
+ }
132
+ req = urllib.request.Request(
133
+ "http://localhost:11434/api/chat",
134
+ data=json.dumps(payload).encode('utf-8'),
135
+ headers={"Content-Type": "application/json"}
121
136
  )
137
+ with urllib.request.urlopen(req, timeout=30) as resp:
138
+ response = json.loads(resp.read().decode('utf-8'))
122
139
 
123
140
  raw_val = response["message"]["content"].strip()
124
141
  if not raw_val:
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hey-cli-python
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: A secure, zero-bloat CLI companion that turns natural language and error logs into executable commands.
5
- Author: Mohit S.
5
+ Author: Mohit Singh Sinsniwal
6
6
  Project-URL: Homepage, https://github.com/sinsniwal/hey-cli
7
7
  Project-URL: Repository, https://github.com/sinsniwal/hey-cli
8
8
  Project-URL: Issues, https://github.com/sinsniwal/hey-cli/issues
@@ -18,10 +18,11 @@ Classifier: Programming Language :: Python :: 3.9
18
18
  Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3.11
20
20
  Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
21
23
  Requires-Python: >=3.9
22
24
  Description-Content-Type: text/markdown
23
25
  License-File: LICENSE
24
- Requires-Dist: ollama>=0.1.0
25
26
  Requires-Dist: rich>=13.0.0
26
27
  Dynamic: license-file
27
28
 
@@ -0,0 +1 @@
1
+ rich>=13.0.0
@@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hey-cli-python"
7
- version = "1.0.1"
7
+ version = "1.0.3"
8
8
  description = "A secure, zero-bloat CLI companion that turns natural language and error logs into executable commands."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
11
11
  authors = [
12
- {name = "Mohit S."}
12
+ {name = "Mohit Singh Sinsniwal"}
13
13
  ]
14
14
  keywords = ["cli", "llm", "bash", "terminal", "ollama", "sysadmin"]
15
15
  classifiers = [
@@ -24,9 +24,10 @@ classifiers = [
24
24
  "Programming Language :: Python :: 3.10",
25
25
  "Programming Language :: Python :: 3.11",
26
26
  "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Programming Language :: Python :: 3.14",
27
29
  ]
28
30
  dependencies = [
29
- "ollama>=0.1.0",
30
31
  "rich>=13.0.0"
31
32
  ]
32
33
  urls.Homepage = "https://github.com/sinsniwal/hey-cli"
@@ -1,2 +0,0 @@
1
- ollama>=0.1.0
2
- rich>=13.0.0
File without changes
File without changes
File without changes