cage-bro-cli 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.
@@ -0,0 +1,40 @@
1
+ Metadata-Version: 2.4
2
+ Name: cage-bro-cli
3
+ Version: 0.1.0
4
+ Summary: CLI installer for cage-bro sandbox — downloads the Rust binary on install
5
+ License-Expression: Apache-2.0
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: httpx>=0.24.0
9
+ Requires-Dist: cage-bro>=0.1.0
10
+
11
+ # cage-bro-cli
12
+
13
+ CLI installer for [cage-bro](https://github.com/aeroxy/cage-bro) — downloads the Rust binary on first run.
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ pip install cage-bro-cli
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```bash
24
+ cage-bro serve --port 8080
25
+ cage-bro mcp
26
+ cage-bro setup
27
+ ```
28
+
29
+ On first run, the CLI downloads the pre-built binary for your platform from GitHub releases and caches it in `~/.cache/cage-bro/` (Linux) or `~/Library/Caches/cage-bro/` (macOS).
30
+
31
+ ## Supported Platforms
32
+
33
+ | Platform | Status |
34
+ |---|---|
35
+ | macOS ARM64 | Available |
36
+ | Others | Build from source: `cargo install --git https://github.com/aeroxy/cage-bro` |
37
+
38
+ ## License
39
+
40
+ Apache-2.0
@@ -0,0 +1,30 @@
1
+ # cage-bro-cli
2
+
3
+ CLI installer for [cage-bro](https://github.com/aeroxy/cage-bro) — downloads the Rust binary on first run.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pip install cage-bro-cli
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ cage-bro serve --port 8080
15
+ cage-bro mcp
16
+ cage-bro setup
17
+ ```
18
+
19
+ On first run, the CLI downloads the pre-built binary for your platform from GitHub releases and caches it in `~/.cache/cage-bro/` (Linux) or `~/Library/Caches/cage-bro/` (macOS).
20
+
21
+ ## Supported Platforms
22
+
23
+ | Platform | Status |
24
+ |---|---|
25
+ | macOS ARM64 | Available |
26
+ | Others | Build from source: `cargo install --git https://github.com/aeroxy/cage-bro` |
27
+
28
+ ## License
29
+
30
+ Apache-2.0
@@ -0,0 +1,117 @@
1
+ """cage-bro CLI installer — downloads the Rust binary on first run."""
2
+
3
+ import os
4
+ import sys
5
+ import stat
6
+ import platform
7
+ import subprocess
8
+ from pathlib import Path
9
+
10
+ import httpx
11
+
12
+ VERSION = "0.1.0"
13
+ GITHUB_REPO = "aeroxy/cage-bro"
14
+ BINARY_NAME = "cage-bro"
15
+
16
+
17
+ def get_cache_dir() -> Path:
18
+ if sys.platform == "darwin":
19
+ return Path.home() / "Library" / "Caches" / "cage-bro"
20
+ elif sys.platform == "linux":
21
+ return Path.home() / ".cache" / "cage-bro"
22
+ else:
23
+ return Path.home() / ".cache" / "cage-bro"
24
+
25
+
26
+ def get_platform() -> tuple[str, str]:
27
+ """Return (os, arch) for download URL."""
28
+ system = platform.system().lower()
29
+ machine = platform.machine().lower()
30
+
31
+ os_map = {"darwin": "macos", "linux": "linux", "windows": "windows"}
32
+ arch_map = {"arm64": "arm64", "aarch64": "arm64", "x86_64": "x86_64", "amd64": "x86_64"}
33
+
34
+ os_name = os_map.get(system)
35
+ arch = arch_map.get(machine)
36
+
37
+ if not os_name or not arch:
38
+ raise RuntimeError(
39
+ f"No pre-built binary for {system}/{machine}. "
40
+ f"Build from source: cargo install --git https://github.com/aeroxy/cage-bro"
41
+ )
42
+
43
+ # Check if pre-built binary exists (only macos-arm64 for now)
44
+ available = {("macos", "arm64")}
45
+ if (os_name, arch) not in available:
46
+ raise RuntimeError(
47
+ f"No pre-built binary for {os_name}-{arch} yet (available: macos-arm64). "
48
+ f"Build from source: cargo install --git https://github.com/aeroxy/cage-bro"
49
+ )
50
+
51
+ return os_name, arch
52
+
53
+
54
+ def download_binary() -> Path:
55
+ """Download the cage-bro binary to cache dir."""
56
+ cache_dir = get_cache_dir()
57
+ cache_dir.mkdir(parents=True, exist_ok=True)
58
+
59
+ os_name, arch = get_platform()
60
+ ext = ".zip" if os_name == "windows" else ".tar.gz"
61
+ binary_ext = ".exe" if os_name == "windows" else ""
62
+ binary_path = cache_dir / f"{BINARY_NAME}{binary_ext}"
63
+
64
+ # Check if already downloaded
65
+ if binary_path.exists():
66
+ return binary_path
67
+
68
+ url = f"https://github.com/{GITHUB_REPO}/releases/download/{VERSION}/{BINARY_NAME}-{os_name}-{arch}{ext}"
69
+ print(f"Downloading cage-bro {VERSION} for {os_name}-{arch}...")
70
+ print(f" {url}")
71
+
72
+ archive_path = cache_dir / f"archive{ext}"
73
+
74
+ with httpx.Client(follow_redirects=True) as client:
75
+ resp = client.get(url)
76
+ resp.raise_for_status()
77
+ archive_path.write_bytes(resp.content)
78
+
79
+ # Extract
80
+ import tarfile
81
+ import zipfile
82
+
83
+ if ext == ".tar.gz":
84
+ with tarfile.open(archive_path, "r:gz") as tar:
85
+ tar.extractall(path=cache_dir)
86
+ else:
87
+ with zipfile.ZipFile(archive_path) as zf:
88
+ zf.extractall(path=cache_dir)
89
+
90
+ archive_path.unlink()
91
+
92
+ # Make executable
93
+ if sys.platform != "windows":
94
+ binary_path.chmod(binary_path.stat().st_mode | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)
95
+
96
+ print(f"Installed cage-bro to {binary_path}")
97
+ return binary_path
98
+
99
+
100
+ def get_binary_path() -> Path:
101
+ """Get path to the cage-bro binary, downloading if needed."""
102
+ cache_dir = get_cache_dir()
103
+ os_name, _ = get_platform()
104
+ ext = ".exe" if os_name == "windows" else ""
105
+ binary_path = cache_dir / f"{BINARY_NAME}{ext}"
106
+
107
+ if not binary_path.exists():
108
+ return download_binary()
109
+ return binary_path
110
+
111
+
112
+ def main():
113
+ """CLI entry point — forwards to the Rust binary."""
114
+ binary = get_binary_path()
115
+ args = sys.argv[1:]
116
+ result = subprocess.run([str(binary)] + args, cwd=os.getcwd())
117
+ sys.exit(result.returncode)
@@ -0,0 +1,40 @@
1
+ Metadata-Version: 2.4
2
+ Name: cage-bro-cli
3
+ Version: 0.1.0
4
+ Summary: CLI installer for cage-bro sandbox — downloads the Rust binary on install
5
+ License-Expression: Apache-2.0
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: httpx>=0.24.0
9
+ Requires-Dist: cage-bro>=0.1.0
10
+
11
+ # cage-bro-cli
12
+
13
+ CLI installer for [cage-bro](https://github.com/aeroxy/cage-bro) — downloads the Rust binary on first run.
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ pip install cage-bro-cli
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```bash
24
+ cage-bro serve --port 8080
25
+ cage-bro mcp
26
+ cage-bro setup
27
+ ```
28
+
29
+ On first run, the CLI downloads the pre-built binary for your platform from GitHub releases and caches it in `~/.cache/cage-bro/` (Linux) or `~/Library/Caches/cage-bro/` (macOS).
30
+
31
+ ## Supported Platforms
32
+
33
+ | Platform | Status |
34
+ |---|---|
35
+ | macOS ARM64 | Available |
36
+ | Others | Build from source: `cargo install --git https://github.com/aeroxy/cage-bro` |
37
+
38
+ ## License
39
+
40
+ Apache-2.0
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ cage_bro_cli/__init__.py
4
+ cage_bro_cli.egg-info/PKG-INFO
5
+ cage_bro_cli.egg-info/SOURCES.txt
6
+ cage_bro_cli.egg-info/dependency_links.txt
7
+ cage_bro_cli.egg-info/entry_points.txt
8
+ cage_bro_cli.egg-info/requires.txt
9
+ cage_bro_cli.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ cage-bro = cage_bro_cli:main
@@ -0,0 +1,2 @@
1
+ httpx>=0.24.0
2
+ cage-bro>=0.1.0
@@ -0,0 +1 @@
1
+ cage_bro_cli
@@ -0,0 +1,18 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "cage-bro-cli"
7
+ version = "0.1.0"
8
+ description = "CLI installer for cage-bro sandbox — downloads the Rust binary on install"
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ requires-python = ">=3.8"
12
+ dependencies = [
13
+ "httpx>=0.24.0",
14
+ "cage-bro>=0.1.0",
15
+ ]
16
+
17
+ [project.scripts]
18
+ cage-bro = "cage_bro_cli:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+