neuroncli 6.1.0__tar.gz → 6.2.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neuroncli
3
- Version: 6.1.0
3
+ Version: 6.2.1
4
4
  Summary: NeuronCLI - AI-powered terminal assistant
5
5
  Author: RAHUL-DevelopeRR
6
6
  License: MIT
@@ -0,0 +1,100 @@
1
+ """NeuronCLI - Python shim for the Rust binary."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ import subprocess
7
+ import sys
8
+ from pathlib import Path
9
+
10
+
11
+ def _find_binary() -> Path:
12
+ """Locate the embedded neuron binary inside the installed package."""
13
+ pkg_dir = Path(__file__).resolve().parent
14
+ binary_name = "neuron.exe" if sys.platform == "win32" else "neuron"
15
+ candidate = pkg_dir / binary_name
16
+ if candidate.exists():
17
+ return candidate
18
+ # Fallback: search PATH (useful during development)
19
+ for path_dir in os.get_exec_path():
20
+ candidate = Path(path_dir) / binary_name
21
+ if candidate.exists():
22
+ return candidate
23
+ raise RuntimeError(
24
+ f"NeuronCLI binary '{binary_name}' not found inside package or PATH. "
25
+ "Try reinstalling: pip install --force-reinstall neuroncli"
26
+ )
27
+
28
+
29
+ def _ensure_scripts_on_path() -> None:
30
+ """Ensure pip's Scripts directory is on PATH.
31
+
32
+ On Windows, `pip install` puts the `neuron` entry-point into
33
+ `<python>/Scripts/` but that directory is often NOT on the user's
34
+ PATH, so `neuron` fails with "command not found" after install.
35
+
36
+ This function detects the situation and patches the user's PATH
37
+ for the current process (and optionally persists it).
38
+ """
39
+ if sys.platform != "win32":
40
+ return
41
+
42
+ scripts_dir = Path(sys.executable).parent / "Scripts"
43
+ if not scripts_dir.exists():
44
+ return
45
+
46
+ scripts_str = str(scripts_dir)
47
+ current_path = os.environ.get("PATH", "")
48
+ if scripts_str.lower() in current_path.lower():
49
+ return # Already on PATH
50
+
51
+ # Patch for current process
52
+ os.environ["PATH"] = scripts_str + os.pathsep + current_path
53
+
54
+ # Try to persist to user PATH via setx (best-effort, silent fail)
55
+ try:
56
+ # Read current user PATH from registry
57
+ import winreg
58
+ with winreg.OpenKey(
59
+ winreg.HKEY_CURRENT_USER,
60
+ r"Environment",
61
+ 0,
62
+ winreg.KEY_READ,
63
+ ) as key:
64
+ try:
65
+ user_path, _ = winreg.QueryValueEx(key, "Path")
66
+ except FileNotFoundError:
67
+ user_path = ""
68
+
69
+ if scripts_str.lower() not in user_path.lower():
70
+ new_path = scripts_str + os.pathsep + user_path if user_path else scripts_str
71
+ subprocess.run(
72
+ ["setx", "PATH", new_path],
73
+ capture_output=True,
74
+ check=False,
75
+ )
76
+ print(
77
+ f"\033[32m✓\033[0m Added {scripts_str} to user PATH. "
78
+ "Restart your terminal for the change to take effect.",
79
+ file=sys.stderr,
80
+ )
81
+ except Exception:
82
+ pass # Non-critical — PATH is patched for current process at minimum
83
+
84
+
85
+ def main() -> None:
86
+ """Invoke the Rust neuron binary with forwarded argv."""
87
+ _ensure_scripts_on_path()
88
+ binary = _find_binary()
89
+ # Replace sys.argv[0] with the actual binary path so the Rust CLI
90
+ # sees correct program name in --version / help text.
91
+ args = [str(binary), *sys.argv[1:]]
92
+ # os.execv on Windows does not reliably inherit console std streams,
93
+ # which silently swallows output for --version / --help. Use
94
+ # subprocess.run instead and forward the child's exit code.
95
+ result = subprocess.run(args, check=False)
96
+ sys.exit(result.returncode)
97
+
98
+
99
+ if __name__ == "__main__":
100
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neuroncli
3
- Version: 6.1.0
3
+ Version: 6.2.1
4
4
  Summary: NeuronCLI - AI-powered terminal assistant
5
5
  Author: RAHUL-DevelopeRR
6
6
  License: MIT
@@ -1,37 +1,37 @@
1
- [build-system]
2
- requires = ["setuptools>=61.0", "wheel"]
3
- build-backend = "setuptools.build_meta"
4
-
5
- [project]
6
- name = "neuroncli"
7
- version = "6.1.0"
8
- description = "NeuronCLI - AI-powered terminal assistant"
9
- readme = "README.md"
10
- license = {text = "MIT"}
11
- requires-python = ">=3.8"
12
- authors = [
13
- {name = "RAHUL-DevelopeRR"},
14
- ]
15
- classifiers = [
16
- "Development Status :: 4 - Beta",
17
- "Intended Audience :: Developers",
18
- "License :: OSI Approved :: MIT License",
19
- "Operating System :: Microsoft :: Windows",
20
- "Programming Language :: Python :: 3",
21
- "Programming Language :: Rust",
22
- "Topic :: Software Development",
23
- ]
24
-
25
- [project.scripts]
26
- neuron = "neuron_cli:main"
27
-
28
- [project.urls]
29
- Homepage = "https://github.com/RAHUL-DevelopeRR/neuron-v2"
30
- Repository = "https://github.com/RAHUL-DevelopeRR/neuron-v2"
31
-
32
- [tool.setuptools.packages.find]
33
- where = ["."]
34
- include = ["neuron_cli*"]
35
-
36
- [tool.setuptools.package-data]
37
- neuron_cli = ["neuron.exe"]
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "neuroncli"
7
+ version = "6.2.1"
8
+ description = "NeuronCLI - AI-powered terminal assistant"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.8"
12
+ authors = [
13
+ {name = "RAHUL-DevelopeRR"},
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: Microsoft :: Windows",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Rust",
22
+ "Topic :: Software Development",
23
+ ]
24
+
25
+ [project.scripts]
26
+ neuron = "neuron_cli:main"
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/RAHUL-DevelopeRR/neuron-v2"
30
+ Repository = "https://github.com/RAHUL-DevelopeRR/neuron-v2"
31
+
32
+ [tool.setuptools.packages.find]
33
+ where = ["."]
34
+ include = ["neuron_cli*"]
35
+
36
+ [tool.setuptools.package-data]
37
+ neuron_cli = ["neuron.exe"]
@@ -1,43 +0,0 @@
1
- """NeuronCLI - Python shim for the Rust binary."""
2
-
3
- from __future__ import annotations
4
-
5
- import os
6
- import subprocess
7
- import sys
8
- from pathlib import Path
9
-
10
-
11
- def _find_binary() -> Path:
12
- """Locate the embedded neuron binary inside the installed package."""
13
- pkg_dir = Path(__file__).resolve().parent
14
- binary_name = "neuron.exe" if sys.platform == "win32" else "neuron"
15
- candidate = pkg_dir / binary_name
16
- if candidate.exists():
17
- return candidate
18
- # Fallback: search PATH (useful during development)
19
- for path_dir in os.get_exec_path():
20
- candidate = Path(path_dir) / binary_name
21
- if candidate.exists():
22
- return candidate
23
- raise RuntimeError(
24
- f"NeuronCLI binary '{binary_name}' not found inside package or PATH. "
25
- "Try reinstalling: pip install --force-reinstall neuroncli"
26
- )
27
-
28
-
29
- def main() -> None:
30
- """Invoke the Rust neuron binary with forwarded argv."""
31
- binary = _find_binary()
32
- # Replace sys.argv[0] with the actual binary path so the Rust CLI
33
- # sees correct program name in --version / help text.
34
- args = [str(binary), *sys.argv[1:]]
35
- # os.execv on Windows does not reliably inherit console std streams,
36
- # which silently swallows output for --version / --help. Use
37
- # subprocess.run instead and forward the child's exit code.
38
- result = subprocess.run(args, check=False)
39
- sys.exit(result.returncode)
40
-
41
-
42
- if __name__ == "__main__":
43
- main()
File without changes
File without changes