|
18 | 18 | class Biome: |
19 | 19 | """Download, install, and invoke the Biome CLI standalone binary.""" |
20 | 20 |
|
| 21 | + TAG_PREFIX = "@biomejs/biome@" |
| 22 | + |
21 | 23 | @property |
22 | 24 | def target_directory(self) -> str: |
23 | 25 | # Directory under .plain to store the binary and lockfile |
@@ -93,17 +95,16 @@ def download(self, version: str = "") -> str: |
93 | 95 | # Build download URL based on version (tag: cli/vX.Y.Z) or latest |
94 | 96 | slug = self.detect_platform_slug() |
95 | 97 | if version: |
96 | | - tag = version if version.startswith("v") else f"v{version}" |
97 | | - release = f"cli/{tag}" |
98 | 98 | url = ( |
99 | | - f"https://github.com/biomejs/biome/releases/download/{release}/" |
| 99 | + f"https://github.com/biomejs/biome/releases/download/{self.TAG_PREFIX}{version}/" |
100 | 100 | f"biome-{slug}" |
101 | 101 | ) |
102 | 102 | else: |
103 | 103 | url = ( |
104 | 104 | f"https://github.com/biomejs/biome/releases/latest/download/" |
105 | 105 | f"biome-{slug}" |
106 | 106 | ) |
| 107 | + |
107 | 108 | resp = requests.get(url, stream=True) |
108 | 109 | resp.raise_for_status() |
109 | 110 |
|
@@ -134,12 +135,11 @@ def download(self, version: str = "") -> str: |
134 | 135 | else: |
135 | 136 | resolved = "" |
136 | 137 | if resp.history: |
137 | | - # Look for redirect to tag cli/vX.Y.Z |
| 138 | + # Look for redirect to actual tag version |
138 | 139 | loc = resp.history[0].headers.get("Location", "") |
139 | | - parts = loc.split("/") |
140 | | - if "cli" in parts: |
141 | | - idx = parts.index("cli") |
142 | | - resolved = parts[idx + 1].lstrip("v") |
| 140 | + if self.TAG_PREFIX in loc: |
| 141 | + remaining = loc.split(self.TAG_PREFIX, 1)[-1] |
| 142 | + resolved = remaining.split("/")[0] |
143 | 143 |
|
144 | 144 | if not resolved: |
145 | 145 | raise RuntimeError("Failed to determine resolved version from redirect") |
|
0 commit comments