@zils/cli 0.4.11 → 0.4.13
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.
package/README.md
CHANGED
|
@@ -24,6 +24,17 @@ private cache. It needs internet access, takes longer than subsequent starts,
|
|
|
24
24
|
and does not modify your system Python. npm installation itself runs no setup
|
|
25
25
|
scripts. Set `ZILS_PYTHON` to an executable path if Python is not on your PATH.
|
|
26
26
|
|
|
27
|
+
## Use from an agent (MCP)
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
claude mcp add zils -- npx -y @zils/cli mcp # Claude Code
|
|
31
|
+
codex mcp add zils -- npx -y @zils/cli mcp # Codex
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Other hosts: run `npx` with the arguments `-y @zils/cli mcp` over stdio. The
|
|
35
|
+
agent can answer decisions and check, submit and follow training jobs, with a
|
|
36
|
+
required cost limit on every submission.
|
|
37
|
+
|
|
27
38
|
## Commands
|
|
28
39
|
|
|
29
40
|
```sh
|
package/bootstrap.py
CHANGED
|
@@ -66,16 +66,17 @@ def pip_install(python, target, **options):
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
def install(python, wheel):
|
|
69
|
-
"""The CLI must install; `zils merge`'s numpy
|
|
70
|
-
binary build of
|
|
69
|
+
"""The CLI must install; `zils merge`'s numpy and `zils mcp`'s MCP library are best effort,
|
|
70
|
+
since a new Python can lack a binary build of them, and that must not block other commands."""
|
|
71
71
|
pip_install(python, str(wheel), stdout=sys.stderr, check=True)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
for extra in ("merge", "mcp"):
|
|
73
|
+
if pip_install(python, f"{wheel}[{extra}]", capture_output=True, text=True).returncode:
|
|
74
|
+
version = "%d.%d" % sys.version_info[:2]
|
|
75
|
+
print(
|
|
76
|
+
f"zils {extra} is unavailable on Python {version}: its dependencies have no build for it yet."
|
|
77
|
+
" Every other command works.",
|
|
78
|
+
file=sys.stderr,
|
|
79
|
+
)
|
|
79
80
|
subprocess.run(
|
|
80
81
|
[str(python), "-I", "-c", "import zils_sdk; from zils_sdk.cli import main"],
|
|
81
82
|
stdout=sys.stderr,
|
|
@@ -83,6 +84,23 @@ def install(python, wheel):
|
|
|
83
84
|
)
|
|
84
85
|
|
|
85
86
|
|
|
87
|
+
def create_runtime(environment):
|
|
88
|
+
"""`python -m venv`. Debian and Ubuntu ship python3 without ensurepip, so this is the step
|
|
89
|
+
that fails on a fresh box; say which package fixes it instead of a bare exit status."""
|
|
90
|
+
try:
|
|
91
|
+
subprocess.run(
|
|
92
|
+
[sys.executable, "-I", "-m", "venv", str(environment)],
|
|
93
|
+
stdout=sys.stderr,
|
|
94
|
+
check=True,
|
|
95
|
+
)
|
|
96
|
+
except subprocess.CalledProcessError as error:
|
|
97
|
+
raise RuntimeError(
|
|
98
|
+
f"{sys.executable} cannot create a virtual environment (python3 -m venv failed). On"
|
|
99
|
+
" Debian or Ubuntu run: sudo apt install python3-venv (or python3.X-venv for your"
|
|
100
|
+
" Python), then retry"
|
|
101
|
+
) from error
|
|
102
|
+
|
|
103
|
+
|
|
86
104
|
def runtime():
|
|
87
105
|
package = Path(__file__).resolve().parent
|
|
88
106
|
version = json.loads((package / "package.json").read_text())["version"]
|
|
@@ -110,11 +128,7 @@ def runtime():
|
|
|
110
128
|
ready.unlink(missing_ok=True)
|
|
111
129
|
if environment.exists():
|
|
112
130
|
shutil.rmtree(environment)
|
|
113
|
-
|
|
114
|
-
[sys.executable, "-I", "-m", "venv", str(environment)],
|
|
115
|
-
stdout=sys.stderr,
|
|
116
|
-
check=True,
|
|
117
|
-
)
|
|
131
|
+
create_runtime(environment)
|
|
118
132
|
install(python, wheel)
|
|
119
133
|
ready.write_text(digest + "\n")
|
|
120
134
|
return python
|
package/package.json
CHANGED
|
index 737622d..4861f37 100644
|
|
|
Binary file
|